@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
233 lines • 10.2 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.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,
* },
* });
* 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,
* },
* });
* 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, Object.assign(Object.assign({}, 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 ? state.annotations : undefined;
resourceInputs["backupId"] = state ? state.backupId : undefined;
resourceInputs["clusterName"] = state ? state.clusterName : undefined;
resourceInputs["clusterUid"] = state ? state.clusterUid : undefined;
resourceInputs["createTime"] = state ? state.createTime : undefined;
resourceInputs["deleteTime"] = state ? state.deleteTime : undefined;
resourceInputs["description"] = state ? state.description : undefined;
resourceInputs["displayName"] = state ? state.displayName : undefined;
resourceInputs["effectiveAnnotations"] = state ? state.effectiveAnnotations : undefined;
resourceInputs["effectiveLabels"] = state ? state.effectiveLabels : undefined;
resourceInputs["encryptionConfig"] = state ? state.encryptionConfig : undefined;
resourceInputs["encryptionInfos"] = state ? state.encryptionInfos : undefined;
resourceInputs["etag"] = state ? state.etag : undefined;
resourceInputs["expiryQuantities"] = state ? state.expiryQuantities : undefined;
resourceInputs["expiryTime"] = state ? state.expiryTime : undefined;
resourceInputs["labels"] = state ? state.labels : undefined;
resourceInputs["location"] = state ? state.location : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["project"] = state ? state.project : undefined;
resourceInputs["pulumiLabels"] = state ? state.pulumiLabels : undefined;
resourceInputs["reconciling"] = state ? state.reconciling : undefined;
resourceInputs["sizeBytes"] = state ? state.sizeBytes : undefined;
resourceInputs["state"] = state ? state.state : undefined;
resourceInputs["type"] = state ? state.type : undefined;
resourceInputs["uid"] = state ? state.uid : undefined;
resourceInputs["updateTime"] = state ? state.updateTime : undefined;
}
else {
const args = argsOrState;
if ((!args || args.backupId === undefined) && !opts.urn) {
throw new Error("Missing required property 'backupId'");
}
if ((!args || args.clusterName === undefined) && !opts.urn) {
throw new Error("Missing required property 'clusterName'");
}
if ((!args || args.location === undefined) && !opts.urn) {
throw new Error("Missing required property 'location'");
}
resourceInputs["annotations"] = args ? args.annotations : undefined;
resourceInputs["backupId"] = args ? args.backupId : undefined;
resourceInputs["clusterName"] = args ? args.clusterName : undefined;
resourceInputs["description"] = args ? args.description : undefined;
resourceInputs["displayName"] = args ? args.displayName : undefined;
resourceInputs["encryptionConfig"] = args ? args.encryptionConfig : undefined;
resourceInputs["labels"] = args ? args.labels : undefined;
resourceInputs["location"] = args ? args.location : undefined;
resourceInputs["project"] = args ? args.project : undefined;
resourceInputs["type"] = args ? args.type : undefined;
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