UNPKG

@pulumi/linode

Version:

A Pulumi package for creating and managing linode cloud resources.

156 lines 7.51 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.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, Object.assign(Object.assign({}, 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 ? state.accessKey : undefined; resourceInputs["acl"] = state ? state.acl : undefined; resourceInputs["bucket"] = state ? state.bucket : undefined; resourceInputs["cacheControl"] = state ? state.cacheControl : undefined; resourceInputs["cluster"] = state ? state.cluster : undefined; resourceInputs["content"] = state ? state.content : undefined; resourceInputs["contentBase64"] = state ? state.contentBase64 : undefined; resourceInputs["contentDisposition"] = state ? state.contentDisposition : undefined; resourceInputs["contentEncoding"] = state ? state.contentEncoding : undefined; resourceInputs["contentLanguage"] = state ? state.contentLanguage : undefined; resourceInputs["contentType"] = state ? state.contentType : undefined; resourceInputs["endpoint"] = state ? state.endpoint : undefined; resourceInputs["etag"] = state ? state.etag : undefined; resourceInputs["forceDestroy"] = state ? state.forceDestroy : undefined; resourceInputs["key"] = state ? state.key : undefined; resourceInputs["metadata"] = state ? state.metadata : undefined; resourceInputs["region"] = state ? state.region : undefined; resourceInputs["secretKey"] = state ? state.secretKey : undefined; resourceInputs["source"] = state ? state.source : undefined; resourceInputs["versionId"] = state ? state.versionId : undefined; resourceInputs["websiteRedirect"] = state ? state.websiteRedirect : undefined; } else { const args = argsOrState; if ((!args || args.bucket === undefined) && !opts.urn) { throw new Error("Missing required property 'bucket'"); } if ((!args || args.key === undefined) && !opts.urn) { throw new Error("Missing required property 'key'"); } resourceInputs["accessKey"] = args ? args.accessKey : undefined; resourceInputs["acl"] = args ? args.acl : undefined; resourceInputs["bucket"] = args ? args.bucket : undefined; resourceInputs["cacheControl"] = args ? args.cacheControl : undefined; resourceInputs["cluster"] = args ? args.cluster : undefined; resourceInputs["content"] = args ? args.content : undefined; resourceInputs["contentBase64"] = args ? args.contentBase64 : undefined; resourceInputs["contentDisposition"] = args ? args.contentDisposition : undefined; resourceInputs["contentEncoding"] = args ? args.contentEncoding : undefined; resourceInputs["contentLanguage"] = args ? args.contentLanguage : undefined; resourceInputs["contentType"] = args ? args.contentType : undefined; resourceInputs["endpoint"] = args ? args.endpoint : undefined; resourceInputs["etag"] = args ? args.etag : undefined; resourceInputs["forceDestroy"] = args ? args.forceDestroy : undefined; resourceInputs["key"] = args ? args.key : undefined; resourceInputs["metadata"] = args ? args.metadata : undefined; resourceInputs["region"] = args ? args.region : undefined; resourceInputs["secretKey"] = (args === null || args === void 0 ? void 0 : args.secretKey) ? pulumi.secret(args.secretKey) : undefined; resourceInputs["source"] = args ? args.source : undefined; resourceInputs["websiteRedirect"] = args ? args.websiteRedirect : undefined; 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