UNPKG

@huaweicloudos/pulumi

Version:

A Pulumi package for creating and managing Huaweicloud cloud resources.

154 lines 6.17 kB
"use strict"; // *** 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.Pvc = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * Manages a CCI Persistent Volume Claim resource within HuaweiCloud. * * ## Example Usage * ### Import an EVS volume * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as pulumi from "@huaweicloudos/pulumi"; * * const config = new pulumi.Config(); * const volumeId = config.requireObject("volumeId"); * const namespace = config.requireObject("namespace"); * const pvcName = config.requireObject("pvcName"); * const test = new huaweicloud.cci.Pvc("test", { * namespace: namespace, * volumeType: "ssd", * volumeId: volumeId, * }); * ``` * ### Import an OBS bucket * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as pulumi from "@huaweicloudos/pulumi"; * * const config = new pulumi.Config(); * const obsBucketName = config.requireObject("obsBucketName"); * const namespace = config.requireObject("namespace"); * const pvcName = config.requireObject("pvcName"); * const test = new huaweicloud.cci.Pvc("test", { * namespace: namespace, * volumeType: "obs", * volumeId: obsBucketName, * }); * ``` * ### Import an SFS * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as pulumi from "@huaweicloudos/pulumi"; * * const config = new pulumi.Config(); * const sfsId = config.requireObject("sfsId"); * const namespace = config.requireObject("namespace"); * const pvcName = config.requireObject("pvcName"); * const exportLocation = config.requireObject("exportLocation"); * const test = new huaweicloud.cci.Pvc("test", { * namespace: namespace, * volumeType: "nfs-rw", * volumeId: sfsId, * deviceMountPath: exportLocation, * }); * ``` * ### Import an SFS Turbo * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as pulumi from "@huaweicloudos/pulumi"; * * const config = new pulumi.Config(); * const sfsTurboId = config.requireObject("sfsTurboId"); * const namespace = config.requireObject("namespace"); * const pvcName = config.requireObject("pvcName"); * const exportLocation = config.requireObject("exportLocation"); * const test = new huaweicloud.cci.Pvc("test", { * namespace: namespace, * volumeType: "efs-standard", * volumeId: sfsTurboId, * deviceMountPath: exportLocation, * }); * ``` * * ## Import * * PVCs can be imported using the `namespace`, `volume_type` and `id`, e.g. bash * * ```sh * $ pulumi import huaweicloud:Cci/pvc:Pvc test <namespace>/<volume_type>/<id> * ``` */ class Pvc extends pulumi.CustomResource { /** * Get an existing Pvc 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 Pvc(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of Pvc. 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'] === Pvc.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["accessModes"] = state ? state.accessModes : undefined; resourceInputs["creationTimestamp"] = state ? state.creationTimestamp : undefined; resourceInputs["deviceMountPath"] = state ? state.deviceMountPath : undefined; resourceInputs["enable"] = state ? state.enable : undefined; resourceInputs["name"] = state ? state.name : undefined; resourceInputs["namespace"] = state ? state.namespace : undefined; resourceInputs["region"] = state ? state.region : undefined; resourceInputs["status"] = state ? state.status : undefined; resourceInputs["volumeId"] = state ? state.volumeId : undefined; resourceInputs["volumeType"] = state ? state.volumeType : undefined; } else { const args = argsOrState; if ((!args || args.namespace === undefined) && !opts.urn) { throw new Error("Missing required property 'namespace'"); } if ((!args || args.volumeId === undefined) && !opts.urn) { throw new Error("Missing required property 'volumeId'"); } resourceInputs["deviceMountPath"] = args ? args.deviceMountPath : undefined; resourceInputs["name"] = args ? args.name : undefined; resourceInputs["namespace"] = args ? args.namespace : undefined; resourceInputs["region"] = args ? args.region : undefined; resourceInputs["volumeId"] = args ? args.volumeId : undefined; resourceInputs["volumeType"] = args ? args.volumeType : undefined; resourceInputs["accessModes"] = undefined /*out*/; resourceInputs["creationTimestamp"] = undefined /*out*/; resourceInputs["enable"] = undefined /*out*/; resourceInputs["status"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(Pvc.__pulumiType, name, resourceInputs, opts); } } exports.Pvc = Pvc; /** @internal */ Pvc.__pulumiType = 'huaweicloud:Cci/pvc:Pvc'; //# sourceMappingURL=pvc.js.map