@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
235 lines • 9.52 kB
JavaScript
;
// *** 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.Backup = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* An AlloyDB Backup.
*
* To get more information about Backup, see:
*
* * [API documentation](https://cloud.google.com/alloydb/docs/reference/rest/v1/projects.locations.backups/create)
* * How-to Guides
* * [AlloyDB](https://cloud.google.com/alloydb/docs/)
*
* ## Example Usage
*
* ### Alloydb Backup Basic
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const defaultNetwork = new gcp.compute.Network("default", {name: "alloydb-network"});
* const defaultCluster = new gcp.alloydb.Cluster("default", {
* clusterId: "alloydb-cluster",
* location: "us-central1",
* networkConfig: {
* network: defaultNetwork.id,
* },
* deletionProtection: false,
* });
* const privateIpAlloc = new gcp.compute.GlobalAddress("private_ip_alloc", {
* name: "alloydb-cluster",
* addressType: "INTERNAL",
* purpose: "VPC_PEERING",
* prefixLength: 16,
* network: defaultNetwork.id,
* });
* const vpcConnection = new gcp.servicenetworking.Connection("vpc_connection", {
* network: defaultNetwork.id,
* service: "servicenetworking.googleapis.com",
* reservedPeeringRanges: [privateIpAlloc.name],
* });
* const defaultInstance = new gcp.alloydb.Instance("default", {
* cluster: defaultCluster.name,
* instanceId: "alloydb-instance",
* instanceType: "PRIMARY",
* }, {
* dependsOn: [vpcConnection],
* });
* const _default = new gcp.alloydb.Backup("default", {
* location: "us-central1",
* backupId: "alloydb-backup",
* clusterName: defaultCluster.name,
* }, {
* dependsOn: [defaultInstance],
* });
* ```
* ### Alloydb Backup Full
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const defaultNetwork = new gcp.compute.Network("default", {name: "alloydb-network"});
* const defaultCluster = new gcp.alloydb.Cluster("default", {
* clusterId: "alloydb-cluster",
* location: "us-central1",
* networkConfig: {
* network: defaultNetwork.id,
* },
* deletionProtection: false,
* });
* const privateIpAlloc = new gcp.compute.GlobalAddress("private_ip_alloc", {
* name: "alloydb-cluster",
* addressType: "INTERNAL",
* purpose: "VPC_PEERING",
* prefixLength: 16,
* network: defaultNetwork.id,
* });
* const vpcConnection = new gcp.servicenetworking.Connection("vpc_connection", {
* network: defaultNetwork.id,
* service: "servicenetworking.googleapis.com",
* reservedPeeringRanges: [privateIpAlloc.name],
* });
* const defaultInstance = new gcp.alloydb.Instance("default", {
* cluster: defaultCluster.name,
* instanceId: "alloydb-instance",
* instanceType: "PRIMARY",
* }, {
* dependsOn: [vpcConnection],
* });
* const _default = new gcp.alloydb.Backup("default", {
* location: "us-central1",
* backupId: "alloydb-backup",
* clusterName: defaultCluster.name,
* description: "example description",
* type: "ON_DEMAND",
* labels: {
* label: "key",
* },
* }, {
* dependsOn: [defaultInstance],
* });
* ```
*
* ## Import
*
* Backup can be imported using any of these accepted formats:
*
* * `projects/{{project}}/locations/{{location}}/backups/{{backup_id}}`
*
* * `{{project}}/{{location}}/{{backup_id}}`
*
* * `{{location}}/{{backup_id}}`
*
* When using the `pulumi import` command, Backup can be imported using one of the formats above. For example:
*
* ```sh
* $ pulumi import gcp:alloydb/backup:Backup default projects/{{project}}/locations/{{location}}/backups/{{backup_id}}
* ```
*
* ```sh
* $ pulumi import gcp:alloydb/backup:Backup default {{project}}/{{location}}/{{backup_id}}
* ```
*
* ```sh
* $ pulumi import gcp:alloydb/backup:Backup default {{location}}/{{backup_id}}
* ```
*/
class Backup extends pulumi.CustomResource {
/**
* Get an existing Backup 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 Backup(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of Backup. 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'] === Backup.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["annotations"] = state?.annotations;
resourceInputs["backupId"] = state?.backupId;
resourceInputs["clusterName"] = state?.clusterName;
resourceInputs["clusterUid"] = state?.clusterUid;
resourceInputs["createTime"] = state?.createTime;
resourceInputs["deleteTime"] = state?.deleteTime;
resourceInputs["description"] = state?.description;
resourceInputs["displayName"] = state?.displayName;
resourceInputs["effectiveAnnotations"] = state?.effectiveAnnotations;
resourceInputs["effectiveLabels"] = state?.effectiveLabels;
resourceInputs["encryptionConfig"] = state?.encryptionConfig;
resourceInputs["encryptionInfos"] = state?.encryptionInfos;
resourceInputs["etag"] = state?.etag;
resourceInputs["expiryQuantities"] = state?.expiryQuantities;
resourceInputs["expiryTime"] = state?.expiryTime;
resourceInputs["labels"] = state?.labels;
resourceInputs["location"] = state?.location;
resourceInputs["name"] = state?.name;
resourceInputs["project"] = state?.project;
resourceInputs["pulumiLabels"] = state?.pulumiLabels;
resourceInputs["reconciling"] = state?.reconciling;
resourceInputs["sizeBytes"] = state?.sizeBytes;
resourceInputs["state"] = state?.state;
resourceInputs["type"] = state?.type;
resourceInputs["uid"] = state?.uid;
resourceInputs["updateTime"] = state?.updateTime;
}
else {
const args = argsOrState;
if (args?.backupId === undefined && !opts.urn) {
throw new Error("Missing required property 'backupId'");
}
if (args?.clusterName === undefined && !opts.urn) {
throw new Error("Missing required property 'clusterName'");
}
if (args?.location === undefined && !opts.urn) {
throw new Error("Missing required property 'location'");
}
resourceInputs["annotations"] = args?.annotations;
resourceInputs["backupId"] = args?.backupId;
resourceInputs["clusterName"] = args?.clusterName;
resourceInputs["description"] = args?.description;
resourceInputs["displayName"] = args?.displayName;
resourceInputs["encryptionConfig"] = args?.encryptionConfig;
resourceInputs["labels"] = args?.labels;
resourceInputs["location"] = args?.location;
resourceInputs["project"] = args?.project;
resourceInputs["type"] = args?.type;
resourceInputs["clusterUid"] = undefined /*out*/;
resourceInputs["createTime"] = undefined /*out*/;
resourceInputs["deleteTime"] = undefined /*out*/;
resourceInputs["effectiveAnnotations"] = undefined /*out*/;
resourceInputs["effectiveLabels"] = undefined /*out*/;
resourceInputs["encryptionInfos"] = undefined /*out*/;
resourceInputs["etag"] = undefined /*out*/;
resourceInputs["expiryQuantities"] = undefined /*out*/;
resourceInputs["expiryTime"] = undefined /*out*/;
resourceInputs["name"] = undefined /*out*/;
resourceInputs["pulumiLabels"] = undefined /*out*/;
resourceInputs["reconciling"] = undefined /*out*/;
resourceInputs["sizeBytes"] = undefined /*out*/;
resourceInputs["state"] = undefined /*out*/;
resourceInputs["uid"] = undefined /*out*/;
resourceInputs["updateTime"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
const secretOpts = { additionalSecretOutputs: ["effectiveLabels", "pulumiLabels"] };
opts = pulumi.mergeOptions(opts, secretOpts);
super(Backup.__pulumiType, name, resourceInputs, opts);
}
}
exports.Backup = Backup;
/** @internal */
Backup.__pulumiType = 'gcp:alloydb/backup:Backup';
//# sourceMappingURL=backup.js.map