All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.pulumi.gcp.firebase.kotlin.StorageBucket.kt Maven / Gradle / Ivy

@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.gcp.firebase.kotlin

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

/**
 * Builder for [StorageBucket].
 */
@PulumiTagMarker
public class StorageBucketResourceBuilder internal constructor() {
    public var name: String? = null

    public var args: StorageBucketArgs = StorageBucketArgs()

    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 StorageBucketArgsBuilder.() -> Unit) {
        val builder = StorageBucketArgsBuilder()
        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(): StorageBucket {
        val builtJavaResource = com.pulumi.gcp.firebase.StorageBucket(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return StorageBucket(builtJavaResource)
    }
}

/**
 * ## Example Usage
 * ### Firebasestorage Bucket Basic
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const _default = new gcp.storage.Bucket("default", {
 *     name: "test_bucket",
 *     location: "US",
 *     uniformBucketLevelAccess: true,
 * });
 * const defaultStorageBucket = new gcp.firebase.StorageBucket("default", {
 *     project: "my-project-name",
 *     bucketId: _default.id,
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * default = gcp.storage.Bucket("default",
 *     name="test_bucket",
 *     location="US",
 *     uniform_bucket_level_access=True)
 * default_storage_bucket = gcp.firebase.StorageBucket("default",
 *     project="my-project-name",
 *     bucket_id=default.id)
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var @default = new Gcp.Storage.Bucket("default", new()
 *     {
 *         Name = "test_bucket",
 *         Location = "US",
 *         UniformBucketLevelAccess = true,
 *     });
 *     var defaultStorageBucket = new Gcp.Firebase.StorageBucket("default", new()
 *     {
 *         Project = "my-project-name",
 *         BucketId = @default.Id,
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/firebase"
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/storage"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := storage.NewBucket(ctx, "default", &storage.BucketArgs{
 * 			Name:                     pulumi.String("test_bucket"),
 * 			Location:                 pulumi.String("US"),
 * 			UniformBucketLevelAccess: pulumi.Bool(true),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = firebase.NewStorageBucket(ctx, "default", &firebase.StorageBucketArgs{
 * 			Project:  pulumi.String("my-project-name"),
 * 			BucketId: _default.ID(),
 * 		})
 * 		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.gcp.storage.Bucket;
 * import com.pulumi.gcp.storage.BucketArgs;
 * import com.pulumi.gcp.firebase.StorageBucket;
 * import com.pulumi.gcp.firebase.StorageBucketArgs;
 * 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 default_ = new Bucket("default", BucketArgs.builder()
 *             .name("test_bucket")
 *             .location("US")
 *             .uniformBucketLevelAccess(true)
 *             .build());
 *         var defaultStorageBucket = new StorageBucket("defaultStorageBucket", StorageBucketArgs.builder()
 *             .project("my-project-name")
 *             .bucketId(default_.id())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   default:
 *     type: gcp:storage:Bucket
 *     properties:
 *       name: test_bucket
 *       location: US
 *       uniformBucketLevelAccess: true
 *   defaultStorageBucket:
 *     type: gcp:firebase:StorageBucket
 *     name: default
 *     properties:
 *       project: my-project-name
 *       bucketId: ${default.id}
 * ```
 * 
 * ## Import
 * Bucket can be imported using any of these accepted formats:
 * * `projects/{{project}}/buckets/{{bucket_id}}`
 * * `{{project}}/{{bucket_id}}`
 * * `{{bucket_id}}`
 * When using the `pulumi import` command, Bucket can be imported using one of the formats above. For example:
 * ```sh
 * $ pulumi import gcp:firebase/storageBucket:StorageBucket default projects/{{project}}/buckets/{{bucket_id}}
 * ```
 * ```sh
 * $ pulumi import gcp:firebase/storageBucket:StorageBucket default {{project}}/{{bucket_id}}
 * ```
 * ```sh
 * $ pulumi import gcp:firebase/storageBucket:StorageBucket default {{bucket_id}}
 * ```
 */
public class StorageBucket internal constructor(
    override val javaResource: com.pulumi.gcp.firebase.StorageBucket,
) : KotlinCustomResource(javaResource, StorageBucketMapper) {
    /**
     * Required. Immutable. The ID of the underlying Google Cloud Storage bucket
     */
    public val bucketId: Output?
        get() = javaResource.bucketId().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * Resource name of the bucket in the format projects/PROJECT_IDENTIFIER/buckets/BUCKET_ID
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * The ID of the project in which the resource belongs.
     * If it is not provided, the provider project is used.
     */
    public val project: Output
        get() = javaResource.project().applyValue({ args0 -> args0 })
}

public object StorageBucketMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.gcp.firebase.StorageBucket::class == javaResource::class

    override fun map(javaResource: Resource): StorageBucket = StorageBucket(
        javaResource as
            com.pulumi.gcp.firebase.StorageBucket,
    )
}

/**
 * @see [StorageBucket].
 * @param name The _unique_ name of the resulting resource.
 * @param block Builder for [StorageBucket].
 */
public suspend fun storageBucket(
    name: String,
    block: suspend StorageBucketResourceBuilder.() -> Unit,
): StorageBucket {
    val builder = StorageBucketResourceBuilder()
    builder.name(name)
    block(builder)
    return builder.build()
}

/**
 * @see [StorageBucket].
 * @param name The _unique_ name of the resulting resource.
 */
public fun storageBucket(name: String): StorageBucket {
    val builder = StorageBucketResourceBuilder()
    builder.name(name)
    return builder.build()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy