Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
com.pulumi.aws.s3.kotlin.BucketWebsiteConfigurationV2.kt Maven / Gradle / Ivy
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.aws.s3.kotlin
import com.pulumi.aws.s3.kotlin.outputs.BucketWebsiteConfigurationV2ErrorDocument
import com.pulumi.aws.s3.kotlin.outputs.BucketWebsiteConfigurationV2IndexDocument
import com.pulumi.aws.s3.kotlin.outputs.BucketWebsiteConfigurationV2RedirectAllRequestsTo
import com.pulumi.aws.s3.kotlin.outputs.BucketWebsiteConfigurationV2RoutingRule
import com.pulumi.core.Output
import com.pulumi.kotlin.KotlinCustomResource
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.ResourceMapper
import com.pulumi.kotlin.options.CustomResourceOptions
import com.pulumi.kotlin.options.CustomResourceOptionsBuilder
import com.pulumi.resources.Resource
import kotlin.Boolean
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import com.pulumi.aws.s3.kotlin.outputs.BucketWebsiteConfigurationV2ErrorDocument.Companion.toKotlin as bucketWebsiteConfigurationV2ErrorDocumentToKotlin
import com.pulumi.aws.s3.kotlin.outputs.BucketWebsiteConfigurationV2IndexDocument.Companion.toKotlin as bucketWebsiteConfigurationV2IndexDocumentToKotlin
import com.pulumi.aws.s3.kotlin.outputs.BucketWebsiteConfigurationV2RedirectAllRequestsTo.Companion.toKotlin as bucketWebsiteConfigurationV2RedirectAllRequestsToToKotlin
import com.pulumi.aws.s3.kotlin.outputs.BucketWebsiteConfigurationV2RoutingRule.Companion.toKotlin as bucketWebsiteConfigurationV2RoutingRuleToKotlin
/**
* Builder for [BucketWebsiteConfigurationV2].
*/
@PulumiTagMarker
public class BucketWebsiteConfigurationV2ResourceBuilder internal constructor() {
public var name: String? = null
public var args: BucketWebsiteConfigurationV2Args = BucketWebsiteConfigurationV2Args()
public var opts: CustomResourceOptions = CustomResourceOptions()
/**
* @param name The _unique_ name of the resulting resource.
*/
public fun name(`value`: String) {
this.name = value
}
/**
* @param block The arguments to use to populate this resource's properties.
*/
public suspend fun args(block: suspend BucketWebsiteConfigurationV2ArgsBuilder.() -> Unit) {
val builder = BucketWebsiteConfigurationV2ArgsBuilder()
block(builder)
this.args = builder.build()
}
/**
* @param block A bag of options that control this resource's behavior.
*/
public suspend fun opts(block: suspend CustomResourceOptionsBuilder.() -> Unit) {
this.opts = com.pulumi.kotlin.options.CustomResourceOptions.opts(block)
}
internal fun build(): BucketWebsiteConfigurationV2 {
val builtJavaResource = com.pulumi.aws.s3.BucketWebsiteConfigurationV2(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return BucketWebsiteConfigurationV2(builtJavaResource)
}
}
/**
* Provides an S3 bucket website configuration resource. For more information, see [Hosting Websites on S3](https://docs.aws.amazon.com/AmazonS3/latest/dev/WebsiteHosting.html).
* > This resource cannot be used with S3 directory buckets.
* ## Example Usage
* ### With `routing_rule` configured
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
* const example = new aws.s3.BucketWebsiteConfigurationV2("example", {
* bucket: exampleAwsS3Bucket.id,
* indexDocument: {
* suffix: "index.html",
* },
* errorDocument: {
* key: "error.html",
* },
* routingRules: [{
* condition: {
* keyPrefixEquals: "docs/",
* },
* redirect: {
* replaceKeyPrefixWith: "documents/",
* },
* }],
* });
* ```
* ```python
* import pulumi
* import pulumi_aws as aws
* example = aws.s3.BucketWebsiteConfigurationV2("example",
* bucket=example_aws_s3_bucket["id"],
* index_document={
* "suffix": "index.html",
* },
* error_document={
* "key": "error.html",
* },
* routing_rules=[{
* "condition": {
* "key_prefix_equals": "docs/",
* },
* "redirect": {
* "replace_key_prefix_with": "documents/",
* },
* }])
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Aws = Pulumi.Aws;
* return await Deployment.RunAsync(() =>
* {
* var example = new Aws.S3.BucketWebsiteConfigurationV2("example", new()
* {
* Bucket = exampleAwsS3Bucket.Id,
* IndexDocument = new Aws.S3.Inputs.BucketWebsiteConfigurationV2IndexDocumentArgs
* {
* Suffix = "index.html",
* },
* ErrorDocument = new Aws.S3.Inputs.BucketWebsiteConfigurationV2ErrorDocumentArgs
* {
* Key = "error.html",
* },
* RoutingRules = new[]
* {
* new Aws.S3.Inputs.BucketWebsiteConfigurationV2RoutingRuleArgs
* {
* Condition = new Aws.S3.Inputs.BucketWebsiteConfigurationV2RoutingRuleConditionArgs
* {
* KeyPrefixEquals = "docs/",
* },
* Redirect = new Aws.S3.Inputs.BucketWebsiteConfigurationV2RoutingRuleRedirectArgs
* {
* ReplaceKeyPrefixWith = "documents/",
* },
* },
* },
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/s3"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _, err := s3.NewBucketWebsiteConfigurationV2(ctx, "example", &s3.BucketWebsiteConfigurationV2Args{
* Bucket: pulumi.Any(exampleAwsS3Bucket.Id),
* IndexDocument: &s3.BucketWebsiteConfigurationV2IndexDocumentArgs{
* Suffix: pulumi.String("index.html"),
* },
* ErrorDocument: &s3.BucketWebsiteConfigurationV2ErrorDocumentArgs{
* Key: pulumi.String("error.html"),
* },
* RoutingRules: s3.BucketWebsiteConfigurationV2RoutingRuleArray{
* &s3.BucketWebsiteConfigurationV2RoutingRuleArgs{
* Condition: &s3.BucketWebsiteConfigurationV2RoutingRuleConditionArgs{
* KeyPrefixEquals: pulumi.String("docs/"),
* },
* Redirect: &s3.BucketWebsiteConfigurationV2RoutingRuleRedirectArgs{
* ReplaceKeyPrefixWith: pulumi.String("documents/"),
* },
* },
* },
* })
* if err != nil {
* return err
* }
* return nil
* })
* }
* ```
* ```java
* package generated_program;
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.aws.s3.BucketWebsiteConfigurationV2;
* import com.pulumi.aws.s3.BucketWebsiteConfigurationV2Args;
* import com.pulumi.aws.s3.inputs.BucketWebsiteConfigurationV2IndexDocumentArgs;
* import com.pulumi.aws.s3.inputs.BucketWebsiteConfigurationV2ErrorDocumentArgs;
* import com.pulumi.aws.s3.inputs.BucketWebsiteConfigurationV2RoutingRuleArgs;
* import com.pulumi.aws.s3.inputs.BucketWebsiteConfigurationV2RoutingRuleConditionArgs;
* import com.pulumi.aws.s3.inputs.BucketWebsiteConfigurationV2RoutingRuleRedirectArgs;
* import java.util.List;
* import java.util.ArrayList;
* import java.util.Map;
* import java.io.File;
* import java.nio.file.Files;
* import java.nio.file.Paths;
* public class App {
* public static void main(String[] args) {
* Pulumi.run(App::stack);
* }
* public static void stack(Context ctx) {
* var example = new BucketWebsiteConfigurationV2("example", BucketWebsiteConfigurationV2Args.builder()
* .bucket(exampleAwsS3Bucket.id())
* .indexDocument(BucketWebsiteConfigurationV2IndexDocumentArgs.builder()
* .suffix("index.html")
* .build())
* .errorDocument(BucketWebsiteConfigurationV2ErrorDocumentArgs.builder()
* .key("error.html")
* .build())
* .routingRules(BucketWebsiteConfigurationV2RoutingRuleArgs.builder()
* .condition(BucketWebsiteConfigurationV2RoutingRuleConditionArgs.builder()
* .keyPrefixEquals("docs/")
* .build())
* .redirect(BucketWebsiteConfigurationV2RoutingRuleRedirectArgs.builder()
* .replaceKeyPrefixWith("documents/")
* .build())
* .build())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* example:
* type: aws:s3:BucketWebsiteConfigurationV2
* properties:
* bucket: ${exampleAwsS3Bucket.id}
* indexDocument:
* suffix: index.html
* errorDocument:
* key: error.html
* routingRules:
* - condition:
* keyPrefixEquals: docs/
* redirect:
* replaceKeyPrefixWith: documents/
* ```
*
* ### With `routing_rules` configured
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
* const example = new aws.s3.BucketWebsiteConfigurationV2("example", {
* bucket: exampleAwsS3Bucket.id,
* indexDocument: {
* suffix: "index.html",
* },
* errorDocument: {
* key: "error.html",
* },
* routingRuleDetails: `[{
* "Condition": {
* "KeyPrefixEquals": "docs/"
* },
* "Redirect": {
* "ReplaceKeyPrefixWith": ""
* }
* }]
* `,
* });
* ```
* ```python
* import pulumi
* import pulumi_aws as aws
* example = aws.s3.BucketWebsiteConfigurationV2("example",
* bucket=example_aws_s3_bucket["id"],
* index_document={
* "suffix": "index.html",
* },
* error_document={
* "key": "error.html",
* },
* routing_rule_details="""[{
* "Condition": {
* "KeyPrefixEquals": "docs/"
* },
* "Redirect": {
* "ReplaceKeyPrefixWith": ""
* }
* }]
* """)
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Aws = Pulumi.Aws;
* return await Deployment.RunAsync(() =>
* {
* var example = new Aws.S3.BucketWebsiteConfigurationV2("example", new()
* {
* Bucket = exampleAwsS3Bucket.Id,
* IndexDocument = new Aws.S3.Inputs.BucketWebsiteConfigurationV2IndexDocumentArgs
* {
* Suffix = "index.html",
* },
* ErrorDocument = new Aws.S3.Inputs.BucketWebsiteConfigurationV2ErrorDocumentArgs
* {
* Key = "error.html",
* },
* RoutingRuleDetails = @"[{
* ""Condition"": {
* ""KeyPrefixEquals"": ""docs/""
* },
* ""Redirect"": {
* ""ReplaceKeyPrefixWith"": """"
* }
* }]
* ",
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/s3"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _, err := s3.NewBucketWebsiteConfigurationV2(ctx, "example", &s3.BucketWebsiteConfigurationV2Args{
* Bucket: pulumi.Any(exampleAwsS3Bucket.Id),
* IndexDocument: &s3.BucketWebsiteConfigurationV2IndexDocumentArgs{
* Suffix: pulumi.String("index.html"),
* },
* ErrorDocument: &s3.BucketWebsiteConfigurationV2ErrorDocumentArgs{
* Key: pulumi.String("error.html"),
* },
* RoutingRuleDetails: pulumi.String(`[{
* "Condition": {
* "KeyPrefixEquals": "docs/"
* },
* "Redirect": {
* "ReplaceKeyPrefixWith": ""
* }
* }]
* `),
* })
* if err != nil {
* return err
* }
* return nil
* })
* }
* ```
* ```java
* package generated_program;
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.aws.s3.BucketWebsiteConfigurationV2;
* import com.pulumi.aws.s3.BucketWebsiteConfigurationV2Args;
* import com.pulumi.aws.s3.inputs.BucketWebsiteConfigurationV2IndexDocumentArgs;
* import com.pulumi.aws.s3.inputs.BucketWebsiteConfigurationV2ErrorDocumentArgs;
* import java.util.List;
* import java.util.ArrayList;
* import java.util.Map;
* import java.io.File;
* import java.nio.file.Files;
* import java.nio.file.Paths;
* public class App {
* public static void main(String[] args) {
* Pulumi.run(App::stack);
* }
* public static void stack(Context ctx) {
* var example = new BucketWebsiteConfigurationV2("example", BucketWebsiteConfigurationV2Args.builder()
* .bucket(exampleAwsS3Bucket.id())
* .indexDocument(BucketWebsiteConfigurationV2IndexDocumentArgs.builder()
* .suffix("index.html")
* .build())
* .errorDocument(BucketWebsiteConfigurationV2ErrorDocumentArgs.builder()
* .key("error.html")
* .build())
* .routingRuleDetails("""
* [{
* "Condition": {
* "KeyPrefixEquals": "docs/"
* },
* "Redirect": {
* "ReplaceKeyPrefixWith": ""
* }
* }]
* """)
* .build());
* }
* }
* ```
* ```yaml
* resources:
* example:
* type: aws:s3:BucketWebsiteConfigurationV2
* properties:
* bucket: ${exampleAwsS3Bucket.id}
* indexDocument:
* suffix: index.html
* errorDocument:
* key: error.html
* routingRuleDetails: |
* [{
* "Condition": {
* "KeyPrefixEquals": "docs/"
* },
* "Redirect": {
* "ReplaceKeyPrefixWith": ""
* }
* }]
* ```
*
* ## Import
* If the owner (account ID) of the source bucket differs from the account used to configure the AWS Provider, import using the `bucket` and `expected_bucket_owner` separated by a comma (`,`):
* __Using `pulumi import` to import__ S3 bucket website configuration using the `bucket` or using the `bucket` and `expected_bucket_owner` separated by a comma (`,`). For example:
* If the owner (account ID) of the source bucket is the same account used to configure the AWS Provider, import using the `bucket`:
* ```sh
* $ pulumi import aws:s3/bucketWebsiteConfigurationV2:BucketWebsiteConfigurationV2 example bucket-name
* ```
* If the owner (account ID) of the source bucket differs from the account used to configure the AWS Provider, import using the `bucket` and `expected_bucket_owner` separated by a comma (`,`):
* ```sh
* $ pulumi import aws:s3/bucketWebsiteConfigurationV2:BucketWebsiteConfigurationV2 example bucket-name,123456789012
* ```
*/
public class BucketWebsiteConfigurationV2 internal constructor(
override val javaResource: com.pulumi.aws.s3.BucketWebsiteConfigurationV2,
) : KotlinCustomResource(javaResource, BucketWebsiteConfigurationV2Mapper) {
/**
* Name of the bucket.
*/
public val bucket: Output
get() = javaResource.bucket().applyValue({ args0 -> args0 })
/**
* Name of the error document for the website. See below.
*/
public val errorDocument: Output?
get() = javaResource.errorDocument().applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 ->
bucketWebsiteConfigurationV2ErrorDocumentToKotlin(args0)
})
}).orElse(null)
})
/**
* Account ID of the expected bucket owner.
*/
public val expectedBucketOwner: Output?
get() = javaResource.expectedBucketOwner().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* Name of the index document for the website. See below.
*/
public val indexDocument: Output?
get() = javaResource.indexDocument().applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 ->
bucketWebsiteConfigurationV2IndexDocumentToKotlin(args0)
})
}).orElse(null)
})
/**
* Redirect behavior for every request to this bucket's website endpoint. See below. Conflicts with `error_document`, `index_document`, and `routing_rule`.
*/
public val redirectAllRequestsTo: Output?
get() = javaResource.redirectAllRequestsTo().applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 ->
bucketWebsiteConfigurationV2RedirectAllRequestsToToKotlin(args0)
})
}).orElse(null)
})
/**
* JSON array containing [routing rules](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-websiteconfiguration-routingrules.html)
* describing redirect behavior and when redirects are applied. Use this parameter when your routing rules contain empty String values (`""`) as seen in the example above.
*/
public val routingRuleDetails: Output
get() = javaResource.routingRuleDetails().applyValue({ args0 -> args0 })
/**
* List of rules that define when a redirect is applied and the redirect behavior. See below.
*/
public val routingRules: Output>
get() = javaResource.routingRules().applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 ->
bucketWebsiteConfigurationV2RoutingRuleToKotlin(args0)
})
})
})
/**
* Domain of the website endpoint. This is used to create Route 53 alias records.
*/
public val websiteDomain: Output
get() = javaResource.websiteDomain().applyValue({ args0 -> args0 })
/**
* Website endpoint.
*/
public val websiteEndpoint: Output
get() = javaResource.websiteEndpoint().applyValue({ args0 -> args0 })
}
public object BucketWebsiteConfigurationV2Mapper : ResourceMapper {
override fun supportsMappingOfType(javaResource: Resource): Boolean =
com.pulumi.aws.s3.BucketWebsiteConfigurationV2::class == javaResource::class
override fun map(javaResource: Resource): BucketWebsiteConfigurationV2 =
BucketWebsiteConfigurationV2(javaResource as com.pulumi.aws.s3.BucketWebsiteConfigurationV2)
}
/**
* @see [BucketWebsiteConfigurationV2].
* @param name The _unique_ name of the resulting resource.
* @param block Builder for [BucketWebsiteConfigurationV2].
*/
public suspend fun bucketWebsiteConfigurationV2(
name: String,
block: suspend BucketWebsiteConfigurationV2ResourceBuilder.() -> Unit,
): BucketWebsiteConfigurationV2 {
val builder = BucketWebsiteConfigurationV2ResourceBuilder()
builder.name(name)
block(builder)
return builder.build()
}
/**
* @see [BucketWebsiteConfigurationV2].
* @param name The _unique_ name of the resulting resource.
*/
public fun bucketWebsiteConfigurationV2(name: String): BucketWebsiteConfigurationV2 {
val builder = BucketWebsiteConfigurationV2ResourceBuilder()
builder.name(name)
return builder.build()
}