UNPKG

@huaweicloudos/pulumi

Version:

A Pulumi package for creating and managing Huaweicloud cloud resources.

172 lines 7.24 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 CCE Persistent Volume Claim resource within HuaweiCloud. * * ## Example Usage * ### Create PVC with EVS * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as pulumi from "@huaweicloudos/pulumi"; * * const config = new pulumi.Config(); * const clusterId = config.requireObject("clusterId"); * const namespace = config.requireObject("namespace"); * const pvcName = config.requireObject("pvcName"); * const test = new huaweicloud.cce.Pvc("test", { * clusterId: clusterId, * namespace: namespace, * annotations: { * "everest.io/disk-volume-type": "SSD", * }, * storageClassName: "csi-disk", * accessModes: ["ReadWriteOnce"], * storage: "10Gi", * }); * ``` * ### Create PVC with OBS * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as pulumi from "@huaweicloudos/pulumi"; * * const config = new pulumi.Config(); * const clusterId = config.requireObject("clusterId"); * const namespace = config.requireObject("namespace"); * const pvcName = config.requireObject("pvcName"); * const test = new huaweicloud.cce.Pvc("test", { * clusterId: clusterId, * namespace: namespace, * annotations: { * "everest.io/obs-volume-type": "STANDARD", * "csi.storage.k8s.io/fstype": "obsfs", * }, * storageClassName: "csi-obs", * accessModes: ["ReadWriteMany"], * storage: "1Gi", * }); * ``` * ### Create PVC with SFS * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as pulumi from "@huaweicloudos/pulumi"; * * const config = new pulumi.Config(); * const clusterId = config.requireObject("clusterId"); * const namespace = config.requireObject("namespace"); * const pvcName = config.requireObject("pvcName"); * const test = new huaweicloud.cce.Pvc("test", { * clusterId: clusterId, * namespace: namespace, * storageClassName: "csi-nas", * accessModes: ["ReadWriteMany"], * storage: "10Gi", * }); * ``` * * ## Import * * CCE PVC can be imported using the cluster ID, namespace and ID separated by slashes, e.g. bash * * ```sh * $ pulumi import huaweicloud:Cce/pvc:Pvc test 5c20fdad-7288-11eb-b817-0255ac10158b/default/fa540f3b-12d9-40e5-8268-04bcfed95a46 * ``` * * Note that the imported state may not be identical to your resource definition, due to some attributes missing from the API response, security or some other reason. The missing attributes include`annotations`. It is generally recommended running `terraform plan` after importing a PVC. You can then decide if changes should be applied to the PVC, or the resource definition should be updated to align with the PVC. Also you can ignore changes as below. hcl resource "huaweicloud_cce_pvc" "test" { * * ... * * lifecycle { * * ignore_changes = [ * * annotations, * * ] * * } } */ 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["annotations"] = state ? state.annotations : undefined; resourceInputs["clusterId"] = state ? state.clusterId : undefined; resourceInputs["creationTimestamp"] = state ? state.creationTimestamp : undefined; resourceInputs["labels"] = state ? state.labels : 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["storage"] = state ? state.storage : undefined; resourceInputs["storageClassName"] = state ? state.storageClassName : undefined; } else { const args = argsOrState; if ((!args || args.accessModes === undefined) && !opts.urn) { throw new Error("Missing required property 'accessModes'"); } if ((!args || args.clusterId === undefined) && !opts.urn) { throw new Error("Missing required property 'clusterId'"); } if ((!args || args.namespace === undefined) && !opts.urn) { throw new Error("Missing required property 'namespace'"); } if ((!args || args.storage === undefined) && !opts.urn) { throw new Error("Missing required property 'storage'"); } if ((!args || args.storageClassName === undefined) && !opts.urn) { throw new Error("Missing required property 'storageClassName'"); } resourceInputs["accessModes"] = args ? args.accessModes : undefined; resourceInputs["annotations"] = args ? args.annotations : undefined; resourceInputs["clusterId"] = args ? args.clusterId : undefined; resourceInputs["labels"] = args ? args.labels : undefined; resourceInputs["name"] = args ? args.name : undefined; resourceInputs["namespace"] = args ? args.namespace : undefined; resourceInputs["region"] = args ? args.region : undefined; resourceInputs["storage"] = args ? args.storage : undefined; resourceInputs["storageClassName"] = args ? args.storageClassName : undefined; resourceInputs["creationTimestamp"] = 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:Cce/pvc:Pvc'; //# sourceMappingURL=pvc.js.map