@pulumi/libvirt
Version:
A Pulumi package for creating and managing libvirt cloud resources.
95 lines • 4.22 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.Pool = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* Manages a storage pool in libvirt. Currently only directory-based storage pool are supported. For more information on
* storage pools in libvirt, see [the official documentation](https://libvirt.org/formatstorage.html).
*
* **WARNING:** This is experimental API and may change in the future.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as libvirt from "@pulumi/libvirt";
*
* // A pool for all cluster volumes
* const cluster = new libvirt.Pool("cluster", {
* name: "cluster",
* type: "dir",
* target: {
* path: "/home/user/cluster_storage",
* },
* });
* const opensuseLeap = new libvirt.Volume("opensuse_leap", {
* name: "opensuse_leap",
* pool: cluster.name,
* source: "http://download.opensuse.org/repositories/Cloud:/Images:/Leap_42.1/images/openSUSE-Leap-42.1-OpenStack.x86_64.qcow2",
* });
* ```
*/
class Pool extends pulumi.CustomResource {
/**
* Get an existing Pool 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 Pool(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of Pool. 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'] === Pool.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["allocation"] = state ? state.allocation : undefined;
resourceInputs["available"] = state ? state.available : undefined;
resourceInputs["capacity"] = state ? state.capacity : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["path"] = state ? state.path : undefined;
resourceInputs["source"] = state ? state.source : undefined;
resourceInputs["target"] = state ? state.target : undefined;
resourceInputs["type"] = state ? state.type : undefined;
resourceInputs["xml"] = state ? state.xml : undefined;
}
else {
const args = argsOrState;
if ((!args || args.type === undefined) && !opts.urn) {
throw new Error("Missing required property 'type'");
}
resourceInputs["allocation"] = args ? args.allocation : undefined;
resourceInputs["available"] = args ? args.available : undefined;
resourceInputs["capacity"] = args ? args.capacity : undefined;
resourceInputs["name"] = args ? args.name : undefined;
resourceInputs["path"] = args ? args.path : undefined;
resourceInputs["source"] = args ? args.source : undefined;
resourceInputs["target"] = args ? args.target : undefined;
resourceInputs["type"] = args ? args.type : undefined;
resourceInputs["xml"] = args ? args.xml : undefined;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(Pool.__pulumiType, name, resourceInputs, opts);
}
}
exports.Pool = Pool;
/** @internal */
Pool.__pulumiType = 'libvirt:index/pool:Pool';
//# sourceMappingURL=pool.js.map