@pulumi/vsphere
Version:
A Pulumi package for creating vsphere resources
122 lines • 5.44 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.ContentLibrary = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* The `vsphere.ContentLibrary` resource can be used to manage content libraries.
*
* > **NOTE:** This resource requires a vCenter Server instance and is not available on direct ESXi host connections.
*
* ## Example Usage
*
* The following example creates a publishing content library using the datastore named `publisher-datastore` as the storage backing.
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as vsphere from "@pulumi/vsphere";
*
* const datacenterA = vsphere.getDatacenter({
* name: "dc-01-a",
* });
* const publisherDatastore = datacenterA.then(datacenterA => vsphere.getDatastore({
* name: "publisher-datastore",
* datacenterId: datacenterA.id,
* }));
* const publisherContentLibrary = new vsphere.ContentLibrary("publisher_content_library", {
* name: "Publisher Content Library",
* description: "A publishing content library.",
* storageBackings: [publisherDatastore.then(publisherDatastore => publisherDatastore.id)],
* });
* ```
*
* The next example creates a subscribed content library using the URL of the publisher content library as the source and the datastore named `subscriber-datastore` as the storage backing.
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as vsphere from "@pulumi/vsphere";
*
* const datacenterB = vsphere.getDatacenter({
* name: "dc-01-b",
* });
* const subscriberDatastore = datacenterB.then(datacenterB => vsphere.getDatastore({
* name: "subscriber-datastore",
* datacenterId: datacenterB.id,
* }));
* const subscriberContentLibrary = new vsphere.ContentLibrary("subscriber_content_library", {
* name: "Subscriber Content Library",
* description: "A subscribing content library.",
* storageBackings: [subscriberDatastore.then(subscriberDatastore => subscriberDatastore.id)],
* subscription: {
* subscriptionUrl: "https://vc-01-a.example.com:443/cls/vcsp/lib/f42a4b25-844a-44ec-9063-a3a5e9cc88c7/lib.json",
* automaticSync: true,
* onDemand: false,
* },
* });
* ```
*
* ## Import
*
* An existing content library can be imported into this resource by supplying the content library ID. For example:
*
* [docs-import]: https://developer.hashicorp.com/terraform/cli/import
*
* ```sh
* $ pulumi import vsphere:index/contentLibrary:ContentLibrary vsphere_content_library publisher_content_library f42a4b25-844a-44ec-9063-a3a5e9cc88c7
* ```
*/
class ContentLibrary extends pulumi.CustomResource {
/**
* Get an existing ContentLibrary 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 ContentLibrary(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of ContentLibrary. 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'] === ContentLibrary.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["description"] = state ? state.description : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["publication"] = state ? state.publication : undefined;
resourceInputs["storageBackings"] = state ? state.storageBackings : undefined;
resourceInputs["subscription"] = state ? state.subscription : undefined;
}
else {
const args = argsOrState;
if ((!args || args.storageBackings === undefined) && !opts.urn) {
throw new Error("Missing required property 'storageBackings'");
}
resourceInputs["description"] = args ? args.description : undefined;
resourceInputs["name"] = args ? args.name : undefined;
resourceInputs["publication"] = args ? args.publication : undefined;
resourceInputs["storageBackings"] = args ? args.storageBackings : undefined;
resourceInputs["subscription"] = args ? args.subscription : undefined;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(ContentLibrary.__pulumiType, name, resourceInputs, opts);
}
}
exports.ContentLibrary = ContentLibrary;
/** @internal */
ContentLibrary.__pulumiType = 'vsphere:index/contentLibrary:ContentLibrary';
//# sourceMappingURL=contentLibrary.js.map