UNPKG

@pulumi/vsphere

Version:

A Pulumi package for creating vsphere resources

149 lines 6.11 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.ContentLibraryItem = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("./utilities"); /** * The `vsphere.ContentLibraryItem` resource can be used to create items in a * vSphere content library. The `fileUrl` must be accessible from the vSphere * environment as it will be downloaded from the specified location and stored * on the content library's storage backing. * * ## Example Usage * * The first example below imports an OVF Template to a content * library. * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as vsphere from "@pulumi/vsphere"; * * const datacenter = vsphere.getDatacenter({ * name: "dc-01", * }); * const contentLibrary = vsphere.getContentLibrary({ * name: "clb-01", * }); * const contentLibraryItem = new vsphere.ContentLibraryItem("content_library_item", { * name: "ovf-linux-ubuntu-server-lts", * description: "Ubuntu Server LTS OVF Template", * fileUrl: "https://releases.example.com/ubuntu/ubuntu/ubuntu-live-server-amd64.ovf", * libraryId: contentLibrary.then(contentLibrary => contentLibrary.id), * }); * ``` * * The next example imports an .iso image to a content library. * * [tf-vsphere-vm-resource]: /docs/providers/vsphere/r/virtual_machine.html * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as vsphere from "@pulumi/vsphere"; * * const datacenter = vsphere.getDatacenter({ * name: "dc-01", * }); * const contentLibrary = vsphere.getContentLibrary({ * name: "clb-01", * }); * const contentLibraryItem = new vsphere.ContentLibraryItem("content_library_item", { * name: "iso-linux-ubuntu-server-lts", * description: "Ubuntu Server LTS .iso", * type: "iso", * fileUrl: "https://releases.example.com/ubuntu/ubuntu-live-server-amd64.iso", * libraryId: contentLibrary.then(contentLibrary => contentLibrary.id), * }); * ``` * * The last example imports a virtual machine image to a content library from an * existing virtual machine. * * [tf-vsphere-vm-resource]: /docs/providers/vsphere/r/virtual_machine.html * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as vsphere from "@pulumi/vsphere"; * * const datacenter = vsphere.getDatacenter({ * name: "dc-01", * }); * const contentLibrary = vsphere.getContentLibrary({ * name: "clb-01", * }); * const contentLibraryItem = new vsphere.ContentLibraryItem("content_library_item", { * name: "tpl-linux-ubuntu-server-lts", * description: "Ubuntu Server LTS", * sourceUuid: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", * libraryId: contentLibrary.then(contentLibrary => contentLibrary.id), * }); * ``` * * ## Import * * An existing content library item can be imported into this resource by * * supplying the content library ID. An example is below: * * [docs-import]: https://developer.hashicorp.com/terraform/cli/import * * ```sh * $ pulumi import vsphere:index/contentLibraryItem:ContentLibraryItem vsphere_content_library_item iso-linux-ubuntu-server-lts xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx * ``` */ class ContentLibraryItem extends pulumi.CustomResource { /** * Get an existing ContentLibraryItem 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 ContentLibraryItem(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of ContentLibraryItem. 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'] === ContentLibraryItem.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["description"] = state ? state.description : undefined; resourceInputs["fileUrl"] = state ? state.fileUrl : undefined; resourceInputs["libraryId"] = state ? state.libraryId : undefined; resourceInputs["name"] = state ? state.name : undefined; resourceInputs["sourceUuid"] = state ? state.sourceUuid : undefined; resourceInputs["type"] = state ? state.type : undefined; } else { const args = argsOrState; if ((!args || args.libraryId === undefined) && !opts.urn) { throw new Error("Missing required property 'libraryId'"); } resourceInputs["description"] = args ? args.description : undefined; resourceInputs["fileUrl"] = args ? args.fileUrl : undefined; resourceInputs["libraryId"] = args ? args.libraryId : undefined; resourceInputs["name"] = args ? args.name : undefined; resourceInputs["sourceUuid"] = args ? args.sourceUuid : undefined; resourceInputs["type"] = args ? args.type : undefined; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(ContentLibraryItem.__pulumiType, name, resourceInputs, opts); } } exports.ContentLibraryItem = ContentLibraryItem; /** @internal */ ContentLibraryItem.__pulumiType = 'vsphere:index/contentLibraryItem:ContentLibraryItem'; //# sourceMappingURL=contentLibraryItem.js.map