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.digitalocean.kotlin.SpacesBucket.kt Maven / Gradle / Ivy
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.digitalocean.kotlin
import com.pulumi.core.Output
import com.pulumi.digitalocean.kotlin.outputs.SpacesBucketCorsRule
import com.pulumi.digitalocean.kotlin.outputs.SpacesBucketLifecycleRule
import com.pulumi.digitalocean.kotlin.outputs.SpacesBucketVersioning
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.Deprecated
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import com.pulumi.digitalocean.kotlin.outputs.SpacesBucketCorsRule.Companion.toKotlin as spacesBucketCorsRuleToKotlin
import com.pulumi.digitalocean.kotlin.outputs.SpacesBucketLifecycleRule.Companion.toKotlin as spacesBucketLifecycleRuleToKotlin
import com.pulumi.digitalocean.kotlin.outputs.SpacesBucketVersioning.Companion.toKotlin as spacesBucketVersioningToKotlin
/**
* Builder for [SpacesBucket].
*/
@PulumiTagMarker
public class SpacesBucketResourceBuilder internal constructor() {
public var name: String? = null
public var args: SpacesBucketArgs = SpacesBucketArgs()
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 SpacesBucketArgsBuilder.() -> Unit) {
val builder = SpacesBucketArgsBuilder()
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(): SpacesBucket {
val builtJavaResource = com.pulumi.digitalocean.SpacesBucket(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return SpacesBucket(builtJavaResource)
}
}
/**
* Provides a bucket resource for Spaces, DigitalOcean's object storage product.
* The [Spaces API](https://docs.digitalocean.com/reference/api/spaces-api/) was
* designed to be interoperable with Amazon's AWS S3 API. This allows users to
* interact with the service while using the tools they already know. Spaces
* mirrors S3's authentication framework and requests to Spaces require a key pair
* similar to Amazon's Access ID and Secret Key.
* The authentication requirement can be met by either setting the
* `SPACES_ACCESS_KEY_ID` and `SPACES_SECRET_ACCESS_KEY` environment variables or
* the provider's `spaces_access_id` and `spaces_secret_key` arguments to the
* access ID and secret you generate via the DigitalOcean control panel. For
* example:
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as digitalocean from "@pulumi/digitalocean";
* const static_assets = new digitalocean.SpacesBucket("static-assets", {});
* ```
* ```python
* import pulumi
* import pulumi_digitalocean as digitalocean
* static_assets = digitalocean.SpacesBucket("static-assets")
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using DigitalOcean = Pulumi.DigitalOcean;
* return await Deployment.RunAsync(() =>
* {
* var static_assets = new DigitalOcean.SpacesBucket("static-assets");
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-digitalocean/sdk/v4/go/digitalocean"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _, err := digitalocean.NewSpacesBucket(ctx, "static-assets", nil)
* 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.digitalocean.SpacesBucket;
* 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 static_assets = new SpacesBucket("static-assets");
* }
* }
* ```
* ```yaml
* resources:
* static-assets:
* type: digitalocean:SpacesBucket
* ```
*
* For more information, See [An Introduction to DigitalOcean Spaces](https://www.digitalocean.com/community/tutorials/an-introduction-to-digitalocean-spaces)
* ## Example Usage
* ### Create a New Bucket
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as digitalocean from "@pulumi/digitalocean";
* const foobar = new digitalocean.SpacesBucket("foobar", {
* name: "foobar",
* region: digitalocean.Region.NYC3,
* });
* ```
* ```python
* import pulumi
* import pulumi_digitalocean as digitalocean
* foobar = digitalocean.SpacesBucket("foobar",
* name="foobar",
* region=digitalocean.Region.NYC3)
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using DigitalOcean = Pulumi.DigitalOcean;
* return await Deployment.RunAsync(() =>
* {
* var foobar = new DigitalOcean.SpacesBucket("foobar", new()
* {
* Name = "foobar",
* Region = DigitalOcean.Region.NYC3,
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-digitalocean/sdk/v4/go/digitalocean"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _, err := digitalocean.NewSpacesBucket(ctx, "foobar", &digitalocean.SpacesBucketArgs{
* Name: pulumi.String("foobar"),
* Region: pulumi.String(digitalocean.RegionNYC3),
* })
* 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.digitalocean.SpacesBucket;
* import com.pulumi.digitalocean.SpacesBucketArgs;
* 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 foobar = new SpacesBucket("foobar", SpacesBucketArgs.builder()
* .name("foobar")
* .region("nyc3")
* .build());
* }
* }
* ```
* ```yaml
* resources:
* foobar:
* type: digitalocean:SpacesBucket
* properties:
* name: foobar
* region: nyc3
* ```
*
* ### Create a New Bucket With CORS Rules
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as digitalocean from "@pulumi/digitalocean";
* const foobar = new digitalocean.SpacesBucket("foobar", {
* name: "foobar",
* region: digitalocean.Region.NYC3,
* corsRules: [
* {
* allowedHeaders: ["*"],
* allowedMethods: ["GET"],
* allowedOrigins: ["*"],
* maxAgeSeconds: 3000,
* },
* {
* allowedHeaders: ["*"],
* allowedMethods: [
* "PUT",
* "POST",
* "DELETE",
* ],
* allowedOrigins: ["https://www.example.com"],
* maxAgeSeconds: 3000,
* },
* ],
* });
* ```
* ```python
* import pulumi
* import pulumi_digitalocean as digitalocean
* foobar = digitalocean.SpacesBucket("foobar",
* name="foobar",
* region=digitalocean.Region.NYC3,
* cors_rules=[
* {
* "allowed_headers": ["*"],
* "allowed_methods": ["GET"],
* "allowed_origins": ["*"],
* "max_age_seconds": 3000,
* },
* {
* "allowed_headers": ["*"],
* "allowed_methods": [
* "PUT",
* "POST",
* "DELETE",
* ],
* "allowed_origins": ["https://www.example.com"],
* "max_age_seconds": 3000,
* },
* ])
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using DigitalOcean = Pulumi.DigitalOcean;
* return await Deployment.RunAsync(() =>
* {
* var foobar = new DigitalOcean.SpacesBucket("foobar", new()
* {
* Name = "foobar",
* Region = DigitalOcean.Region.NYC3,
* CorsRules = new[]
* {
* new DigitalOcean.Inputs.SpacesBucketCorsRuleArgs
* {
* AllowedHeaders = new[]
* {
* "*",
* },
* AllowedMethods = new[]
* {
* "GET",
* },
* AllowedOrigins = new[]
* {
* "*",
* },
* MaxAgeSeconds = 3000,
* },
* new DigitalOcean.Inputs.SpacesBucketCorsRuleArgs
* {
* AllowedHeaders = new[]
* {
* "*",
* },
* AllowedMethods = new[]
* {
* "PUT",
* "POST",
* "DELETE",
* },
* AllowedOrigins = new[]
* {
* "https://www.example.com",
* },
* MaxAgeSeconds = 3000,
* },
* },
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-digitalocean/sdk/v4/go/digitalocean"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _, err := digitalocean.NewSpacesBucket(ctx, "foobar", &digitalocean.SpacesBucketArgs{
* Name: pulumi.String("foobar"),
* Region: pulumi.String(digitalocean.RegionNYC3),
* CorsRules: digitalocean.SpacesBucketCorsRuleArray{
* &digitalocean.SpacesBucketCorsRuleArgs{
* AllowedHeaders: pulumi.StringArray{
* pulumi.String("*"),
* },
* AllowedMethods: pulumi.StringArray{
* pulumi.String("GET"),
* },
* AllowedOrigins: pulumi.StringArray{
* pulumi.String("*"),
* },
* MaxAgeSeconds: pulumi.Int(3000),
* },
* &digitalocean.SpacesBucketCorsRuleArgs{
* AllowedHeaders: pulumi.StringArray{
* pulumi.String("*"),
* },
* AllowedMethods: pulumi.StringArray{
* pulumi.String("PUT"),
* pulumi.String("POST"),
* pulumi.String("DELETE"),
* },
* AllowedOrigins: pulumi.StringArray{
* pulumi.String("https://www.example.com"),
* },
* MaxAgeSeconds: pulumi.Int(3000),
* },
* },
* })
* 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.digitalocean.SpacesBucket;
* import com.pulumi.digitalocean.SpacesBucketArgs;
* import com.pulumi.digitalocean.inputs.SpacesBucketCorsRuleArgs;
* 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 foobar = new SpacesBucket("foobar", SpacesBucketArgs.builder()
* .name("foobar")
* .region("nyc3")
* .corsRules(
* SpacesBucketCorsRuleArgs.builder()
* .allowedHeaders("*")
* .allowedMethods("GET")
* .allowedOrigins("*")
* .maxAgeSeconds(3000)
* .build(),
* SpacesBucketCorsRuleArgs.builder()
* .allowedHeaders("*")
* .allowedMethods(
* "PUT",
* "POST",
* "DELETE")
* .allowedOrigins("https://www.example.com")
* .maxAgeSeconds(3000)
* .build())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* foobar:
* type: digitalocean:SpacesBucket
* properties:
* name: foobar
* region: nyc3
* corsRules:
* - allowedHeaders:
* - '*'
* allowedMethods:
* - GET
* allowedOrigins:
* - '*'
* maxAgeSeconds: 3000
* - allowedHeaders:
* - '*'
* allowedMethods:
* - PUT
* - POST
* - DELETE
* allowedOrigins:
* - https://www.example.com
* maxAgeSeconds: 3000
* ```
*
* ## Import
* Buckets can be imported using the `region` and `name` attributes (delimited by a comma):
* ```sh
* $ pulumi import digitalocean:index/spacesBucket:SpacesBucket foobar `region`,`name`
* ```
*/
public class SpacesBucket internal constructor(
override val javaResource: com.pulumi.digitalocean.SpacesBucket,
) : KotlinCustomResource(javaResource, SpacesBucketMapper) {
/**
* Canned ACL applied on bucket creation (`private` or `public-read`)
*/
public val acl: Output?
get() = javaResource.acl().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })
/**
* The FQDN of the bucket (e.g. bucket-name.nyc3.digitaloceanspaces.com)
*/
public val bucketDomainName: Output
get() = javaResource.bucketDomainName().applyValue({ args0 -> args0 })
/**
* The uniform resource name for the bucket
*/
public val bucketUrn: Output
get() = javaResource.bucketUrn().applyValue({ args0 -> args0 })
/**
* A rule of Cross-Origin Resource Sharing (documented below).
*/
@Deprecated(
message = """
Terraform will only perform drift detection if a configuration value is provided. Use the resource
`digitalocean.SpacesBucketCorsConfiguration` instead.
""",
)
public val corsRules: Output>?
get() = javaResource.corsRules().applyValue({ args0 ->
args0.map({ args0 ->
args0.map({ args0 ->
args0.let({ args0 -> spacesBucketCorsRuleToKotlin(args0) })
})
}).orElse(null)
})
/**
* The FQDN of the bucket without the bucket name (e.g. nyc3.digitaloceanspaces.com)
*/
public val endpoint: Output
get() = javaResource.endpoint().applyValue({ args0 -> args0 })
/**
* Unless `true`, the bucket will only be destroyed if empty (Defaults to `false`)
*/
public val forceDestroy: Output?
get() = javaResource.forceDestroy().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* A configuration of object lifecycle management (documented below).
*/
public val lifecycleRules: Output>?
get() = javaResource.lifecycleRules().applyValue({ args0 ->
args0.map({ args0 ->
args0.map({ args0 ->
args0.let({ args0 ->
spacesBucketLifecycleRuleToKotlin(args0)
})
})
}).orElse(null)
})
/**
* The name of the bucket
*/
public val name: Output
get() = javaResource.name().applyValue({ args0 -> args0 })
/**
* The region where the bucket resides (Defaults to `nyc3`)
*/
public val region: Output?
get() = javaResource.region().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })
/**
* A state of versioning (documented below)
*/
public val versioning: Output?
get() = javaResource.versioning().applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 ->
spacesBucketVersioningToKotlin(args0)
})
}).orElse(null)
})
}
public object SpacesBucketMapper : ResourceMapper {
override fun supportsMappingOfType(javaResource: Resource): Boolean =
com.pulumi.digitalocean.SpacesBucket::class == javaResource::class
override fun map(javaResource: Resource): SpacesBucket = SpacesBucket(
javaResource as
com.pulumi.digitalocean.SpacesBucket,
)
}
/**
* @see [SpacesBucket].
* @param name The _unique_ name of the resulting resource.
* @param block Builder for [SpacesBucket].
*/
public suspend fun spacesBucket(
name: String,
block: suspend SpacesBucketResourceBuilder.() -> Unit,
): SpacesBucket {
val builder = SpacesBucketResourceBuilder()
builder.name(name)
block(builder)
return builder.build()
}
/**
* @see [SpacesBucket].
* @param name The _unique_ name of the resulting resource.
*/
public fun spacesBucket(name: String): SpacesBucket {
val builder = SpacesBucketResourceBuilder()
builder.name(name)
return builder.build()
}