@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
230 lines • 11.3 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! ***
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.VolumeReplication = void 0;
const pulumi = __importStar(require("@pulumi/pulumi"));
const utilities = __importStar(require("../utilities"));
/**
* Volume replication creates an asynchronous mirror of a volume in a different location. This capability
* lets you use the replicated volume for critical application activity in case of a location-wide outage
* or disaster.
*
* A new destination volume is created as part of the replication resource. It's content is updated on a
* schedule with content of the source volume. It can be used as a read-only copy while the mirror is
* enabled, or as an independent read-write volume while the mirror is stopped. A destination volume will
* also contain the snapshots of the source volume. Resuming a mirror will overwrite all changes on the
* destination volume with the content of the source volume. While is mirror is enabled, all configuration
* changes done to source or destination volumes are automatically done to both. Please note that the
* destination volume is not a resource managed by Terraform.
*
* Reversing the replication direction is not supported through the provider.
*
* To get more information about VolumeReplication, see:
*
* * [API documentation](https://cloud.google.com/netapp/volumes/docs/reference/rest/v1/projects.locations.volumes.replications)
* * How-to Guides
* * [Documentation](https://cloud.google.com/netapp/volumes/docs/protect-data/about-volume-replication)
*
* ## Example Usage
*
* ### Netapp Volume Replication Create
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const _default = gcp.compute.getNetwork({
* name: "test-network",
* });
* const sourcePool = new gcp.netapp.StoragePool("source_pool", {
* name: "source-pool",
* location: "us-central1",
* serviceLevel: "PREMIUM",
* capacityGib: "2048",
* network: _default.then(_default => _default.id),
* });
* const destinationPool = new gcp.netapp.StoragePool("destination_pool", {
* name: "destination-pool",
* location: "us-west2",
* serviceLevel: "PREMIUM",
* capacityGib: "2048",
* network: _default.then(_default => _default.id),
* allowAutoTiering: true,
* });
* const sourceVolume = new gcp.netapp.Volume("source_volume", {
* location: sourcePool.location,
* name: "source-volume",
* capacityGib: "100",
* shareName: "source-volume",
* storagePool: sourcePool.name,
* protocols: ["NFSV3"],
* deletionPolicy: "FORCE",
* });
* const testReplication = new gcp.netapp.VolumeReplication("test_replication", {
* location: sourceVolume.location,
* volumeName: sourceVolume.name,
* name: "test-replication",
* replicationSchedule: "EVERY_10_MINUTES",
* description: "This is a replication resource",
* destinationVolumeParameters: {
* storagePool: destinationPool.id,
* volumeId: "destination-volume",
* shareName: "source-volume",
* description: "This is a replicated volume",
* tieringPolicy: {
* coolingThresholdDays: 20,
* tierAction: "ENABLED",
* },
* },
* deleteDestinationVolume: true,
* waitForMirror: true,
* }, {
* dependsOn: [sourceVolume],
* });
* ```
*
* ## Import
*
* VolumeReplication can be imported using any of these accepted formats:
*
* * `projects/{{project}}/locations/{{location}}/volumes/{{volume_name}}/replications/{{name}}`
* * `{{project}}/{{location}}/{{volume_name}}/{{name}}`
* * `{{location}}/{{volume_name}}/{{name}}`
*
* When using the `pulumi import` command, VolumeReplication can be imported using one of the formats above. For example:
*
* ```sh
* $ pulumi import gcp:netapp/volumeReplication:VolumeReplication default projects/{{project}}/locations/{{location}}/volumes/{{volume_name}}/replications/{{name}}
* $ pulumi import gcp:netapp/volumeReplication:VolumeReplication default {{project}}/{{location}}/{{volume_name}}/{{name}}
* $ pulumi import gcp:netapp/volumeReplication:VolumeReplication default {{location}}/{{volume_name}}/{{name}}
* ```
*/
class VolumeReplication extends pulumi.CustomResource {
/**
* Get an existing VolumeReplication 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 VolumeReplication(name, state, { ...opts, id: id });
}
/** @internal */
static __pulumiType = 'gcp:netapp/volumeReplication:VolumeReplication';
/**
* Returns true if the given object is an instance of VolumeReplication. 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'] === VolumeReplication.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["createTime"] = state?.createTime;
resourceInputs["deleteDestinationVolume"] = state?.deleteDestinationVolume;
resourceInputs["deletionPolicy"] = state?.deletionPolicy;
resourceInputs["description"] = state?.description;
resourceInputs["destinationVolume"] = state?.destinationVolume;
resourceInputs["destinationVolumeParameters"] = state?.destinationVolumeParameters;
resourceInputs["effectiveLabels"] = state?.effectiveLabels;
resourceInputs["forceStopping"] = state?.forceStopping;
resourceInputs["healthy"] = state?.healthy;
resourceInputs["hybridPeeringDetails"] = state?.hybridPeeringDetails;
resourceInputs["hybridReplicationType"] = state?.hybridReplicationType;
resourceInputs["hybridReplicationUserCommands"] = state?.hybridReplicationUserCommands;
resourceInputs["labels"] = state?.labels;
resourceInputs["location"] = state?.location;
resourceInputs["mirrorState"] = state?.mirrorState;
resourceInputs["name"] = state?.name;
resourceInputs["project"] = state?.project;
resourceInputs["pulumiLabels"] = state?.pulumiLabels;
resourceInputs["replicationEnabled"] = state?.replicationEnabled;
resourceInputs["replicationSchedule"] = state?.replicationSchedule;
resourceInputs["role"] = state?.role;
resourceInputs["sourceVolume"] = state?.sourceVolume;
resourceInputs["state"] = state?.state;
resourceInputs["stateDetails"] = state?.stateDetails;
resourceInputs["transferStats"] = state?.transferStats;
resourceInputs["volumeName"] = state?.volumeName;
resourceInputs["waitForMirror"] = state?.waitForMirror;
}
else {
const args = argsOrState;
if (args?.location === undefined && !opts.urn) {
throw new Error("Missing required property 'location'");
}
if (args?.replicationSchedule === undefined && !opts.urn) {
throw new Error("Missing required property 'replicationSchedule'");
}
if (args?.volumeName === undefined && !opts.urn) {
throw new Error("Missing required property 'volumeName'");
}
resourceInputs["deleteDestinationVolume"] = args?.deleteDestinationVolume;
resourceInputs["deletionPolicy"] = args?.deletionPolicy;
resourceInputs["description"] = args?.description;
resourceInputs["destinationVolumeParameters"] = args?.destinationVolumeParameters;
resourceInputs["forceStopping"] = args?.forceStopping;
resourceInputs["labels"] = args?.labels;
resourceInputs["location"] = args?.location;
resourceInputs["name"] = args?.name;
resourceInputs["project"] = args?.project;
resourceInputs["replicationEnabled"] = args?.replicationEnabled;
resourceInputs["replicationSchedule"] = args?.replicationSchedule;
resourceInputs["volumeName"] = args?.volumeName;
resourceInputs["waitForMirror"] = args?.waitForMirror;
resourceInputs["createTime"] = undefined /*out*/;
resourceInputs["destinationVolume"] = undefined /*out*/;
resourceInputs["effectiveLabels"] = undefined /*out*/;
resourceInputs["healthy"] = undefined /*out*/;
resourceInputs["hybridPeeringDetails"] = undefined /*out*/;
resourceInputs["hybridReplicationType"] = undefined /*out*/;
resourceInputs["hybridReplicationUserCommands"] = undefined /*out*/;
resourceInputs["mirrorState"] = undefined /*out*/;
resourceInputs["pulumiLabels"] = undefined /*out*/;
resourceInputs["role"] = undefined /*out*/;
resourceInputs["sourceVolume"] = undefined /*out*/;
resourceInputs["state"] = undefined /*out*/;
resourceInputs["stateDetails"] = undefined /*out*/;
resourceInputs["transferStats"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
const secretOpts = { additionalSecretOutputs: ["effectiveLabels", "pulumiLabels"] };
opts = pulumi.mergeOptions(opts, secretOpts);
super(VolumeReplication.__pulumiType, name, resourceInputs, opts);
}
}
exports.VolumeReplication = VolumeReplication;
//# sourceMappingURL=volumeReplication.js.map