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

com.pulumi.gcp.storage.kotlin.BucketAccessControlArgs.kt Maven / Gradle / Ivy

Go to download

Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.

There is a newer version: 8.10.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.gcp.storage.kotlin

import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.gcp.storage.BucketAccessControlArgs.builder
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import kotlin.String
import kotlin.Suppress
import kotlin.jvm.JvmName

/**
 * Bucket ACLs can be managed authoritatively using the
 * `storage_bucket_acl` resource. Do not use these two resources in conjunction to manage the same bucket.
 * The BucketAccessControls resource manages the Access Control List
 * (ACLs) for a single entity/role pairing on a bucket. ACLs let you specify who
 * has access to your data and to what extent.
 * There are three roles that can be assigned to an entity:
 * READERs can get the bucket, though no acl property will be returned, and
 * list the bucket's objects.  WRITERs are READERs, and they can insert
 * objects into the bucket and delete the bucket's objects.  OWNERs are
 * WRITERs, and they can get the acl property of a bucket, update a bucket,
 * and call all BucketAccessControls methods on the bucket.  For more
 * information, see Access Control, with the caveat that this API uses
 * READER, WRITER, and OWNER instead of READ, WRITE, and FULL_CONTROL.
 * To get more information about BucketAccessControl, see:
 * * [API documentation](https://cloud.google.com/storage/docs/json_api/v1/bucketAccessControls)
 * * How-to Guides
 *     * [Official Documentation](https://cloud.google.com/storage/docs/access-control/lists)
 * ## Example Usage
 * ### Storage Bucket Access Control Public Bucket
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const bucket = new gcp.storage.Bucket("bucket", {
 *     name: "static-content-bucket",
 *     location: "US",
 * });
 * const publicRule = new gcp.storage.BucketAccessControl("public_rule", {
 *     bucket: bucket.name,
 *     role: "READER",
 *     entity: "allUsers",
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * bucket = gcp.storage.Bucket("bucket",
 *     name="static-content-bucket",
 *     location="US")
 * public_rule = gcp.storage.BucketAccessControl("public_rule",
 *     bucket=bucket.name,
 *     role="READER",
 *     entity="allUsers")
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var bucket = new Gcp.Storage.Bucket("bucket", new()
 *     {
 *         Name = "static-content-bucket",
 *         Location = "US",
 *     });
 *     var publicRule = new Gcp.Storage.BucketAccessControl("public_rule", new()
 *     {
 *         Bucket = bucket.Name,
 *         Role = "READER",
 *         Entity = "allUsers",
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"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 {
 * 		bucket, err := storage.NewBucket(ctx, "bucket", &storage.BucketArgs{
 * 			Name:     pulumi.String("static-content-bucket"),
 * 			Location: pulumi.String("US"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = storage.NewBucketAccessControl(ctx, "public_rule", &storage.BucketAccessControlArgs{
 * 			Bucket: bucket.Name,
 * 			Role:   pulumi.String("READER"),
 * 			Entity: pulumi.String("allUsers"),
 * 		})
 * 		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.storage.BucketAccessControl;
 * import com.pulumi.gcp.storage.BucketAccessControlArgs;
 * 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 bucket = new Bucket("bucket", BucketArgs.builder()
 *             .name("static-content-bucket")
 *             .location("US")
 *             .build());
 *         var publicRule = new BucketAccessControl("publicRule", BucketAccessControlArgs.builder()
 *             .bucket(bucket.name())
 *             .role("READER")
 *             .entity("allUsers")
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   publicRule:
 *     type: gcp:storage:BucketAccessControl
 *     name: public_rule
 *     properties:
 *       bucket: ${bucket.name}
 *       role: READER
 *       entity: allUsers
 *   bucket:
 *     type: gcp:storage:Bucket
 *     properties:
 *       name: static-content-bucket
 *       location: US
 * ```
 * 
 * ## Import
 * BucketAccessControl can be imported using any of these accepted formats:
 * * `{{bucket}}/{{entity}}`
 * When using the `pulumi import` command, BucketAccessControl can be imported using one of the formats above. For example:
 * ```sh
 * $ pulumi import gcp:storage/bucketAccessControl:BucketAccessControl default {{bucket}}/{{entity}}
 * ```
 * @property bucket The name of the bucket.
 * @property entity The entity holding the permission, in one of the following forms:
 * user-userId
 * user-email
 * group-groupId
 * group-email
 * domain-domain
 * project-team-projectId
 * allUsers
 * allAuthenticatedUsers
 * Examples:
 * The user [email protected] would be [email protected].
 * The group [email protected] would be
 * [email protected].
 * To refer to all members of the Google Apps for Business domain
 * example.com, the entity would be domain-example.com.
 * - - -
 * @property role The access permission for the entity.
 * Possible values are: `OWNER`, `READER`, `WRITER`.
 */
public data class BucketAccessControlArgs(
    public val bucket: Output? = null,
    public val entity: Output? = null,
    public val role: Output? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.gcp.storage.BucketAccessControlArgs =
        com.pulumi.gcp.storage.BucketAccessControlArgs.builder()
            .bucket(bucket?.applyValue({ args0 -> args0 }))
            .entity(entity?.applyValue({ args0 -> args0 }))
            .role(role?.applyValue({ args0 -> args0 })).build()
}

/**
 * Builder for [BucketAccessControlArgs].
 */
@PulumiTagMarker
public class BucketAccessControlArgsBuilder internal constructor() {
    private var bucket: Output? = null

    private var entity: Output? = null

    private var role: Output? = null

    /**
     * @param value The name of the bucket.
     */
    @JvmName("ivqiskmwwioaxtlr")
    public suspend fun bucket(`value`: Output) {
        this.bucket = value
    }

    /**
     * @param value The entity holding the permission, in one of the following forms:
     * user-userId
     * user-email
     * group-groupId
     * group-email
     * domain-domain
     * project-team-projectId
     * allUsers
     * allAuthenticatedUsers
     * Examples:
     * The user [email protected] would be [email protected].
     * The group [email protected] would be
     * [email protected].
     * To refer to all members of the Google Apps for Business domain
     * example.com, the entity would be domain-example.com.
     * - - -
     */
    @JvmName("tvkowlrdpkdrejnb")
    public suspend fun entity(`value`: Output) {
        this.entity = value
    }

    /**
     * @param value The access permission for the entity.
     * Possible values are: `OWNER`, `READER`, `WRITER`.
     */
    @JvmName("iewqwjqjrbstecpe")
    public suspend fun role(`value`: Output) {
        this.role = value
    }

    /**
     * @param value The name of the bucket.
     */
    @JvmName("xyesjwvserpqxgen")
    public suspend fun bucket(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.bucket = mapped
    }

    /**
     * @param value The entity holding the permission, in one of the following forms:
     * user-userId
     * user-email
     * group-groupId
     * group-email
     * domain-domain
     * project-team-projectId
     * allUsers
     * allAuthenticatedUsers
     * Examples:
     * The user [email protected] would be [email protected].
     * The group [email protected] would be
     * [email protected].
     * To refer to all members of the Google Apps for Business domain
     * example.com, the entity would be domain-example.com.
     * - - -
     */
    @JvmName("kjstrkuupamswraa")
    public suspend fun entity(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.entity = mapped
    }

    /**
     * @param value The access permission for the entity.
     * Possible values are: `OWNER`, `READER`, `WRITER`.
     */
    @JvmName("isovjvfskmeauwqg")
    public suspend fun role(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.role = mapped
    }

    internal fun build(): BucketAccessControlArgs = BucketAccessControlArgs(
        bucket = bucket,
        entity = entity,
        role = role,
    )
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy