@pulumi/vsphere
Version:
A Pulumi package for creating vsphere resources
105 lines • 4.5 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.File = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* ## Example Usage
*
* ### Uploading a File
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as vsphere from "@pulumi/vsphere";
*
* const ubuntuVmdkUpload = new vsphere.File("ubuntu_vmdk_upload", {
* datacenter: "dc-01",
* datastore: "datastore-01",
* sourceFile: "/my/src/path/custom_ubuntu.vmdk",
* destinationFile: "/my/dst/path/custom_ubuntu.vmdk",
* createDirectories: true,
* });
* ```
*
* ### Copying a File
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as vsphere from "@pulumi/vsphere";
*
* const ubuntuCopy = new vsphere.File("ubuntu_copy", {
* sourceDatacenter: "dc-01",
* datacenter: "dc-01",
* sourceDatastore: "datastore-01",
* datastore: "datastore-01",
* sourceFile: "/my/src/path/custom_ubuntu.vmdk",
* destinationFile: "/my/dst/path/custom_ubuntu.vmdk",
* createDirectories: true,
* });
* ```
*/
class File extends pulumi.CustomResource {
/**
* Get an existing File 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 File(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of File. 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'] === File.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["createDirectories"] = state ? state.createDirectories : undefined;
resourceInputs["datacenter"] = state ? state.datacenter : undefined;
resourceInputs["datastore"] = state ? state.datastore : undefined;
resourceInputs["destinationFile"] = state ? state.destinationFile : undefined;
resourceInputs["sourceDatacenter"] = state ? state.sourceDatacenter : undefined;
resourceInputs["sourceDatastore"] = state ? state.sourceDatastore : undefined;
resourceInputs["sourceFile"] = state ? state.sourceFile : undefined;
}
else {
const args = argsOrState;
if ((!args || args.datastore === undefined) && !opts.urn) {
throw new Error("Missing required property 'datastore'");
}
if ((!args || args.destinationFile === undefined) && !opts.urn) {
throw new Error("Missing required property 'destinationFile'");
}
if ((!args || args.sourceFile === undefined) && !opts.urn) {
throw new Error("Missing required property 'sourceFile'");
}
resourceInputs["createDirectories"] = args ? args.createDirectories : undefined;
resourceInputs["datacenter"] = args ? args.datacenter : undefined;
resourceInputs["datastore"] = args ? args.datastore : undefined;
resourceInputs["destinationFile"] = args ? args.destinationFile : undefined;
resourceInputs["sourceDatacenter"] = args ? args.sourceDatacenter : undefined;
resourceInputs["sourceDatastore"] = args ? args.sourceDatastore : undefined;
resourceInputs["sourceFile"] = args ? args.sourceFile : undefined;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(File.__pulumiType, name, resourceInputs, opts);
}
}
exports.File = File;
/** @internal */
File.__pulumiType = 'vsphere:index/file:File';
//# sourceMappingURL=file.js.map