@lbrlabs/pulumi-scaleway
Version:
A Pulumi package for creating and managing scaleway cloud resources.
144 lines • 6.66 kB
JavaScript
;
// *** 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.ObjectBucketWebsiteConfiguration = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* Provides an Object bucket website configuration resource.
* For more information, see [Hosting Websites on Object bucket](https://www.scaleway.com/en/docs/storage/object/how-to/use-bucket-website/).
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as scaleway from "@lbrlabs/pulumi-scaleway";
*
* const mainObjectBucket = new scaleway.ObjectBucket("mainObjectBucket", {acl: "public-read"});
* const mainObjectBucketWebsiteConfiguration = new scaleway.ObjectBucketWebsiteConfiguration("mainObjectBucketWebsiteConfiguration", {
* bucket: mainObjectBucket.name,
* indexDocument: {
* suffix: "index.html",
* },
* });
* ```
* ## Example with `policy`
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as scaleway from "@lbrlabs/pulumi-scaleway";
*
* const mainObjectBucket = new scaleway.ObjectBucket("mainObjectBucket", {acl: "public-read"});
* const mainObjectBucketPolicy = new scaleway.ObjectBucketPolicy("mainObjectBucketPolicy", {
* bucket: mainObjectBucket.name,
* policy: JSON.stringify({
* Version: "2012-10-17",
* Id: "MyPolicy",
* Statement: [{
* Sid: "GrantToEveryone",
* Effect: "Allow",
* Principal: "*",
* Action: ["s3:GetObject"],
* Resource: ["<bucket-name>/*"],
* }],
* }),
* });
* const mainObjectBucketWebsiteConfiguration = new scaleway.ObjectBucketWebsiteConfiguration("mainObjectBucketWebsiteConfiguration", {
* bucket: mainObjectBucket.name,
* indexDocument: {
* suffix: "index.html",
* },
* });
* ```
*
* ## indexDocument
*
* The `indexDocument` configuration block supports the following arguments:
*
* * `suffix` - (Required) A suffix that is appended to a request that is for a directory on the website endpoint.
*
* > **Important:** The suffix must not be empty and must not include a slash character. The routing is not supported.
*
* In addition to all above arguments, the following attribute is exported:
*
* * `id` - The region and bucket separated by a slash (/)
* * `websiteDomain` - The domain of the website endpoint. This is used to create DNS alias [records](https://www.scaleway.com/en/docs/network/domains-and-dns/how-to/manage-dns-records/).
* * `websiteEndpoint` - The website endpoint.
*
* > **Important:** Please check our concepts section to know more about the [endpoint](https://www.scaleway.com/en/docs/storage/object/concepts/#endpoint).
*
* ## errorDocument
*
* The errorDocument configuration block supports the following arguments:
*
* * `key` - (Required) The object key name to use when a 4XX class error occurs.
*
* ## Import
*
* Website configuration Bucket can be imported using the `{region}/{bucketName}` identifier, e.g. bash
*
* ```sh
* $ pulumi import scaleway:index/objectBucketWebsiteConfiguration:ObjectBucketWebsiteConfiguration some_bucket fr-par/some-bucket
* ```
*/
class ObjectBucketWebsiteConfiguration extends pulumi.CustomResource {
/**
* Get an existing ObjectBucketWebsiteConfiguration 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 ObjectBucketWebsiteConfiguration(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of ObjectBucketWebsiteConfiguration. 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'] === ObjectBucketWebsiteConfiguration.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["bucket"] = state ? state.bucket : undefined;
resourceInputs["errorDocument"] = state ? state.errorDocument : undefined;
resourceInputs["indexDocument"] = state ? state.indexDocument : undefined;
resourceInputs["projectId"] = state ? state.projectId : undefined;
resourceInputs["region"] = state ? state.region : undefined;
resourceInputs["websiteDomain"] = state ? state.websiteDomain : undefined;
resourceInputs["websiteEndpoint"] = state ? state.websiteEndpoint : undefined;
}
else {
const args = argsOrState;
if ((!args || args.bucket === undefined) && !opts.urn) {
throw new Error("Missing required property 'bucket'");
}
if ((!args || args.indexDocument === undefined) && !opts.urn) {
throw new Error("Missing required property 'indexDocument'");
}
resourceInputs["bucket"] = args ? args.bucket : undefined;
resourceInputs["errorDocument"] = args ? args.errorDocument : undefined;
resourceInputs["indexDocument"] = args ? args.indexDocument : undefined;
resourceInputs["projectId"] = args ? args.projectId : undefined;
resourceInputs["region"] = args ? args.region : undefined;
resourceInputs["websiteDomain"] = undefined /*out*/;
resourceInputs["websiteEndpoint"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(ObjectBucketWebsiteConfiguration.__pulumiType, name, resourceInputs, opts);
}
}
exports.ObjectBucketWebsiteConfiguration = ObjectBucketWebsiteConfiguration;
/** @internal */
ObjectBucketWebsiteConfiguration.__pulumiType = 'scaleway:index/objectBucketWebsiteConfiguration:ObjectBucketWebsiteConfiguration';
//# sourceMappingURL=objectBucketWebsiteConfiguration.js.map