@pulumi/linode
Version:
A Pulumi package for creating and managing linode cloud resources.
156 lines • 6.66 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.ObjectStorageObject = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* Provides a Linode Object Storage Object resource. This can be used to create, modify, and delete Linodes Object Storage Objects for Buckets.
*
* ## Example Usage
*
* ### Uploading a file to a bucket
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as linode from "@pulumi/linode";
* import * as std from "@pulumi/std";
*
* const object = new linode.ObjectStorageObject("object", {
* bucket: "my-bucket",
* region: "us-mia",
* key: "my-object",
* secretKey: myKey.secretKey,
* accessKey: myKey.accessKey,
* source: std.pathexpand({
* input: "~/files/log.txt",
* }).then(invoke => invoke.result),
* });
* ```
*
* ### Uploading plaintext to a bucket
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as linode from "@pulumi/linode";
*
* const object = new linode.ObjectStorageObject("object", {
* bucket: "my-bucket",
* region: "us-mia",
* key: "my-object",
* secretKey: myKey.secretKey,
* accessKey: myKey.accessKey,
* content: "This is the content of the Object...",
* contentType: "text/plain",
* contentLanguage: "en",
* });
* ```
*
* ### Creating an object using implicitly created object credentials
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as linode from "@pulumi/linode";
* import * as std from "@pulumi/std";
*
* const object = new linode.ObjectStorageObject("object", {
* bucket: "my-bucket",
* region: "us-mia",
* key: "my-object",
* source: std.pathexpand({
* input: "~/files/log.txt",
* }).then(invoke => invoke.result),
* });
* ```
*/
class ObjectStorageObject extends pulumi.CustomResource {
/**
* Get an existing ObjectStorageObject 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 ObjectStorageObject(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of ObjectStorageObject. 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'] === ObjectStorageObject.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["accessKey"] = state?.accessKey;
resourceInputs["acl"] = state?.acl;
resourceInputs["bucket"] = state?.bucket;
resourceInputs["cacheControl"] = state?.cacheControl;
resourceInputs["cluster"] = state?.cluster;
resourceInputs["content"] = state?.content;
resourceInputs["contentBase64"] = state?.contentBase64;
resourceInputs["contentDisposition"] = state?.contentDisposition;
resourceInputs["contentEncoding"] = state?.contentEncoding;
resourceInputs["contentLanguage"] = state?.contentLanguage;
resourceInputs["contentType"] = state?.contentType;
resourceInputs["endpoint"] = state?.endpoint;
resourceInputs["etag"] = state?.etag;
resourceInputs["forceDestroy"] = state?.forceDestroy;
resourceInputs["key"] = state?.key;
resourceInputs["metadata"] = state?.metadata;
resourceInputs["region"] = state?.region;
resourceInputs["secretKey"] = state?.secretKey;
resourceInputs["source"] = state?.source;
resourceInputs["versionId"] = state?.versionId;
resourceInputs["websiteRedirect"] = state?.websiteRedirect;
}
else {
const args = argsOrState;
if (args?.bucket === undefined && !opts.urn) {
throw new Error("Missing required property 'bucket'");
}
if (args?.key === undefined && !opts.urn) {
throw new Error("Missing required property 'key'");
}
resourceInputs["accessKey"] = args?.accessKey;
resourceInputs["acl"] = args?.acl;
resourceInputs["bucket"] = args?.bucket;
resourceInputs["cacheControl"] = args?.cacheControl;
resourceInputs["cluster"] = args?.cluster;
resourceInputs["content"] = args?.content;
resourceInputs["contentBase64"] = args?.contentBase64;
resourceInputs["contentDisposition"] = args?.contentDisposition;
resourceInputs["contentEncoding"] = args?.contentEncoding;
resourceInputs["contentLanguage"] = args?.contentLanguage;
resourceInputs["contentType"] = args?.contentType;
resourceInputs["endpoint"] = args?.endpoint;
resourceInputs["etag"] = args?.etag;
resourceInputs["forceDestroy"] = args?.forceDestroy;
resourceInputs["key"] = args?.key;
resourceInputs["metadata"] = args?.metadata;
resourceInputs["region"] = args?.region;
resourceInputs["secretKey"] = args?.secretKey ? pulumi.secret(args.secretKey) : undefined;
resourceInputs["source"] = args?.source;
resourceInputs["websiteRedirect"] = args?.websiteRedirect;
resourceInputs["versionId"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
const secretOpts = { additionalSecretOutputs: ["secretKey"] };
opts = pulumi.mergeOptions(opts, secretOpts);
super(ObjectStorageObject.__pulumiType, name, resourceInputs, opts);
}
}
exports.ObjectStorageObject = ObjectStorageObject;
/** @internal */
ObjectStorageObject.__pulumiType = 'linode:index/objectStorageObject:ObjectStorageObject';
//# sourceMappingURL=objectStorageObject.js.map