@pulumi/vsphere
Version:
A Pulumi package for creating vsphere resources
105 lines • 4.16 kB
JavaScript
;
// *** WARNING: this file was generated by pulumi-language-nodejs. ***
// *** 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, { ...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?.createDirectories;
resourceInputs["datacenter"] = state?.datacenter;
resourceInputs["datastore"] = state?.datastore;
resourceInputs["destinationFile"] = state?.destinationFile;
resourceInputs["sourceDatacenter"] = state?.sourceDatacenter;
resourceInputs["sourceDatastore"] = state?.sourceDatastore;
resourceInputs["sourceFile"] = state?.sourceFile;
}
else {
const args = argsOrState;
if (args?.datastore === undefined && !opts.urn) {
throw new Error("Missing required property 'datastore'");
}
if (args?.destinationFile === undefined && !opts.urn) {
throw new Error("Missing required property 'destinationFile'");
}
if (args?.sourceFile === undefined && !opts.urn) {
throw new Error("Missing required property 'sourceFile'");
}
resourceInputs["createDirectories"] = args?.createDirectories;
resourceInputs["datacenter"] = args?.datacenter;
resourceInputs["datastore"] = args?.datastore;
resourceInputs["destinationFile"] = args?.destinationFile;
resourceInputs["sourceDatacenter"] = args?.sourceDatacenter;
resourceInputs["sourceDatastore"] = args?.sourceDatastore;
resourceInputs["sourceFile"] = args?.sourceFile;
}
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