UNPKG

@upcloud/pulumi-upcloud

Version:

A Pulumi package for creating and managing UpCloud resources.

132 lines 6.12 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.ObjectStorage = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("./utilities"); /** * > The `upcloud.ObjectStorage` resource manages previous generatation object storage instances that will reach end of life (EOL) by the end of 2024. For new instances, consider using the new Object Storage product managed with `upcloud.ManagedObjectStorage` resource. * * This resource represents an UpCloud Object Storage instance, which provides S3 compatible storage. * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as upcloud from "@upcloud/pulumi-upcloud"; * * // Object storage instance called storage-name in the fi-hel2 zone, with 2 buckets called "products" and "images". * const myObjectStorage = new upcloud.ObjectStorage("my_object_storage", { * size: 250, * name: "storage-name", * zone: "fi-hel2", * accessKey: "admin", * secretKey: "changeme", * description: "catalogue", * buckets: [ * { * name: "products", * }, * { * name: "images", * }, * ], * }); * ``` * * ## Import * * For object storage import to work properly, you need to set environment variables for access and secret key. * * The environment variables names are UPCLOUD_OBJECT_STORAGE_ACCESS_KEY_{name} and UPCLOUD_OBJECT_STORAGE_SECRET_KEY_{name} * * where {name} is the name of your object storage instance (not the resource label!), all uppercased, and with all dashes (-) * * replaced with underscores (_). So importing an object storage that is named "my-storage" will look like this: * * UPCLOUD_OBJECT_STORAGE_ACCESS_KEY_MY_STORAGE=accesskey \ * * UPCLOUD_OBJECT_STORAGE_SECRET_KEY_MY_STORAGE=supersecret \ * * ```sh * $ pulumi import upcloud:index/objectStorage:ObjectStorage example_storage 06c1f4b6-faf2-47d0-8896-1d941092b009 * ``` */ class ObjectStorage extends pulumi.CustomResource { /** * Get an existing ObjectStorage 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 ObjectStorage(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of ObjectStorage. 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'] === ObjectStorage.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["accessKey"] = state ? state.accessKey : undefined; resourceInputs["buckets"] = state ? state.buckets : undefined; resourceInputs["created"] = state ? state.created : undefined; resourceInputs["description"] = state ? state.description : undefined; resourceInputs["name"] = state ? state.name : undefined; resourceInputs["secretKey"] = state ? state.secretKey : undefined; resourceInputs["size"] = state ? state.size : undefined; resourceInputs["state"] = state ? state.state : undefined; resourceInputs["url"] = state ? state.url : undefined; resourceInputs["usedSpace"] = state ? state.usedSpace : undefined; resourceInputs["zone"] = state ? state.zone : undefined; } else { const args = argsOrState; if ((!args || args.accessKey === undefined) && !opts.urn) { throw new Error("Missing required property 'accessKey'"); } if ((!args || args.description === undefined) && !opts.urn) { throw new Error("Missing required property 'description'"); } if ((!args || args.secretKey === undefined) && !opts.urn) { throw new Error("Missing required property 'secretKey'"); } if ((!args || args.size === undefined) && !opts.urn) { throw new Error("Missing required property 'size'"); } if ((!args || args.zone === undefined) && !opts.urn) { throw new Error("Missing required property 'zone'"); } resourceInputs["accessKey"] = args ? args.accessKey : undefined; resourceInputs["buckets"] = args ? args.buckets : undefined; resourceInputs["description"] = args ? args.description : undefined; resourceInputs["name"] = args ? args.name : undefined; resourceInputs["secretKey"] = args ? args.secretKey : undefined; resourceInputs["size"] = args ? args.size : undefined; resourceInputs["zone"] = args ? args.zone : undefined; resourceInputs["created"] = undefined /*out*/; resourceInputs["state"] = undefined /*out*/; resourceInputs["url"] = undefined /*out*/; resourceInputs["usedSpace"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(ObjectStorage.__pulumiType, name, resourceInputs, opts); } } exports.ObjectStorage = ObjectStorage; /** @internal */ ObjectStorage.__pulumiType = 'upcloud:index/objectStorage:ObjectStorage'; //# sourceMappingURL=objectStorage.js.map