@pulumi/openstack
Version:
A Pulumi package for creating and managing OpenStack cloud resources.
191 lines • 7.38 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.Container = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Manages a V1 container resource within OpenStack.
*
* ## Example Usage
*
* ### Basic Container
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as openstack from "@pulumi/openstack";
*
* const container1 = new openstack.objectstorage.Container("container_1", {
* region: "RegionOne",
* name: "tf-test-container-1",
* metadata: {
* test: "true",
* },
* contentType: "application/json",
* versioning: true,
* });
* ```
*
* ### Basic Container with legacy versioning
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as openstack from "@pulumi/openstack";
*
* const container1 = new openstack.objectstorage.Container("container_1", {
* region: "RegionOne",
* name: "tf-test-container-1",
* metadata: {
* test: "true",
* },
* contentType: "application/json",
* versioningLegacy: {
* type: "versions",
* location: "tf-test-container-versions",
* },
* });
* ```
*
* ### Global Read Access
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as openstack from "@pulumi/openstack";
*
* // Requires that a user know the object name they are attempting to download
* const container1 = new openstack.objectstorage.Container("container_1", {
* region: "RegionOne",
* name: "tf-test-container-1",
* containerRead: ".r:*",
* });
* ```
*
* ### Global Read and List Access
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as openstack from "@pulumi/openstack";
*
* // Any user can read any object, and list all objects in the container
* const container1 = new openstack.objectstorage.Container("container_1", {
* region: "RegionOne",
* name: "tf-test-container-1",
* containerRead: ".r:*,.rlistings",
* });
* ```
*
* ### Write-Only Access for a User
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as openstack from "@pulumi/openstack";
*
* const current = openstack.identity.getAuthScope({
* name: "current",
* });
* // The named user can only upload objects, not read objects or list the container
* const container1 = new openstack.objectstorage.Container("container_1", {
* region: "RegionOne",
* name: "tf-test-container-1",
* containerRead: `.r:-${username}`,
* containerWrite: current.then(current => `${current.projectId}:${username}`),
* });
* ```
*
* ### Set a custom storage class in the Ceph RGW Swift API
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as openstack from "@pulumi/openstack";
*
* const container1 = new openstack.objectstorage.Container("container_1", {
* name: "tf-test-container-1",
* storagePolicy: "az1",
* storageClass: "SSD",
* });
* ```
*
* ## Import
*
* This resource can be imported by specifying the name of the container:
*
* Some attributes can't be imported :
* * `force_destroy`
* * `content_type`
* * `metadata`
* * `container_sync_to`
* * `container_sync_key`
*
* So you'll have to `pulumi preview` and `pulumi up` after the import to fix those missing attributes.
*
* ```sh
* $ pulumi import openstack:objectstorage/container:Container container_1 container_name
* ```
*/
class Container extends pulumi.CustomResource {
/**
* Get an existing Container 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 Container(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of Container. 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'] === Container.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["containerRead"] = state ? state.containerRead : undefined;
resourceInputs["containerSyncKey"] = state ? state.containerSyncKey : undefined;
resourceInputs["containerSyncTo"] = state ? state.containerSyncTo : undefined;
resourceInputs["containerWrite"] = state ? state.containerWrite : undefined;
resourceInputs["contentType"] = state ? state.contentType : undefined;
resourceInputs["forceDestroy"] = state ? state.forceDestroy : undefined;
resourceInputs["metadata"] = state ? state.metadata : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["region"] = state ? state.region : undefined;
resourceInputs["storageClass"] = state ? state.storageClass : undefined;
resourceInputs["storagePolicy"] = state ? state.storagePolicy : undefined;
resourceInputs["versioning"] = state ? state.versioning : undefined;
resourceInputs["versioningLegacy"] = state ? state.versioningLegacy : undefined;
}
else {
const args = argsOrState;
resourceInputs["containerRead"] = args ? args.containerRead : undefined;
resourceInputs["containerSyncKey"] = args ? args.containerSyncKey : undefined;
resourceInputs["containerSyncTo"] = args ? args.containerSyncTo : undefined;
resourceInputs["containerWrite"] = args ? args.containerWrite : undefined;
resourceInputs["contentType"] = args ? args.contentType : undefined;
resourceInputs["forceDestroy"] = args ? args.forceDestroy : undefined;
resourceInputs["metadata"] = args ? args.metadata : undefined;
resourceInputs["name"] = args ? args.name : undefined;
resourceInputs["region"] = args ? args.region : undefined;
resourceInputs["storageClass"] = args ? args.storageClass : undefined;
resourceInputs["storagePolicy"] = args ? args.storagePolicy : undefined;
resourceInputs["versioning"] = args ? args.versioning : undefined;
resourceInputs["versioningLegacy"] = args ? args.versioningLegacy : undefined;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(Container.__pulumiType, name, resourceInputs, opts);
}
}
exports.Container = Container;
/** @internal */
Container.__pulumiType = 'openstack:objectstorage/container:Container';
//# sourceMappingURL=container.js.map