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

com.pulumi.gcp.storage.kotlin.ObjectAccessControlArgs.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.12.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.ObjectAccessControlArgs.builder
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import kotlin.String
import kotlin.Suppress
import kotlin.jvm.JvmName

/**
 * The ObjectAccessControls resources represent the Access Control Lists
 * (ACLs) for objects within Google Cloud Storage. ACLs let you specify
 * who has access to your data and to what extent.
 * There are two roles that can be assigned to an entity:
 * READERs can get an object, though the acl property will not be revealed.
 * OWNERs are READERs, and they can get the acl property, update an object,
 * and call all objectAccessControls methods on the object. The owner of an
 * object is always an OWNER.
 * For more information, see Access Control, with the caveat that this API
 * uses READER and OWNER instead of READ and FULL_CONTROL.
 * To get more information about ObjectAccessControl, see:
 * * [API documentation](https://cloud.google.com/storage/docs/json_api/v1/objectAccessControls)
 * * How-to Guides
 *     * [Official Documentation](https://cloud.google.com/storage/docs/access-control/create-manage-lists)
 * ## Example Usage
 * ### Storage Object Access Control Public Object
 * 
 * ```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 object = new gcp.storage.BucketObject("object", {
 *     name: "public-object",
 *     bucket: bucket.name,
 *     source: new pulumi.asset.FileAsset("../static/img/header-logo.png"),
 * });
 * const publicRule = new gcp.storage.ObjectAccessControl("public_rule", {
 *     object: object.outputName,
 *     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")
 * object = gcp.storage.BucketObject("object",
 *     name="public-object",
 *     bucket=bucket.name,
 *     source=pulumi.FileAsset("../static/img/header-logo.png"))
 * public_rule = gcp.storage.ObjectAccessControl("public_rule",
 *     object=object.output_name,
 *     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 @object = new Gcp.Storage.BucketObject("object", new()
 *     {
 *         Name = "public-object",
 *         Bucket = bucket.Name,
 *         Source = new FileAsset("../static/img/header-logo.png"),
 *     });
 *     var publicRule = new Gcp.Storage.ObjectAccessControl("public_rule", new()
 *     {
 *         Object = @object.OutputName,
 *         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
 * 		}
 * 		object, err := storage.NewBucketObject(ctx, "object", &storage.BucketObjectArgs{
 * 			Name:   pulumi.String("public-object"),
 * 			Bucket: bucket.Name,
 * 			Source: pulumi.NewFileAsset("../static/img/header-logo.png"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = storage.NewObjectAccessControl(ctx, "public_rule", &storage.ObjectAccessControlArgs{
 * 			Object: object.OutputName,
 * 			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.BucketObject;
 * import com.pulumi.gcp.storage.BucketObjectArgs;
 * import com.pulumi.gcp.storage.ObjectAccessControl;
 * import com.pulumi.gcp.storage.ObjectAccessControlArgs;
 * import com.pulumi.asset.FileAsset;
 * 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 object = new BucketObject("object", BucketObjectArgs.builder()
 *             .name("public-object")
 *             .bucket(bucket.name())
 *             .source(new FileAsset("../static/img/header-logo.png"))
 *             .build());
 *         var publicRule = new ObjectAccessControl("publicRule", ObjectAccessControlArgs.builder()
 *             .object(object.outputName())
 *             .bucket(bucket.name())
 *             .role("READER")
 *             .entity("allUsers")
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   publicRule:
 *     type: gcp:storage:ObjectAccessControl
 *     name: public_rule
 *     properties:
 *       object: ${object.outputName}
 *       bucket: ${bucket.name}
 *       role: READER
 *       entity: allUsers
 *   bucket:
 *     type: gcp:storage:Bucket
 *     properties:
 *       name: static-content-bucket
 *       location: US
 *   object:
 *     type: gcp:storage:BucketObject
 *     properties:
 *       name: public-object
 *       bucket: ${bucket.name}
 *       source:
 *         fn::FileAsset: ../static/img/header-logo.png
 * ```
 * 
 * ## Import
 * ObjectAccessControl can be imported using any of these accepted formats:
 * * `{{bucket}}/{{object}}/{{entity}}`
 * When using the `pulumi import` command, ObjectAccessControl can be imported using one of the formats above. For example:
 * ```sh
 * $ pulumi import gcp:storage/objectAccessControl:ObjectAccessControl default {{bucket}}/{{object}}/{{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}} (such as "[email protected]")
 * * group-{{groupId}}
 * * group-{{email}} (such as "[email protected]")
 * * domain-{{domain}} (such as "domain-example.com")
 * * project-team-{{projectId}}
 * * allUsers
 * * allAuthenticatedUsers
 * @property object The name of the object to apply the access control to.
 * @property role The access permission for the entity.
 * Possible values are: `OWNER`, `READER`.
 * - - -
 */
public data class ObjectAccessControlArgs(
    public val bucket: Output? = null,
    public val entity: Output? = null,
    public val `object`: Output? = null,
    public val role: Output? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.gcp.storage.ObjectAccessControlArgs =
        com.pulumi.gcp.storage.ObjectAccessControlArgs.builder()
            .bucket(bucket?.applyValue({ args0 -> args0 }))
            .entity(entity?.applyValue({ args0 -> args0 }))
            .`object`(`object`?.applyValue({ args0 -> args0 }))
            .role(role?.applyValue({ args0 -> args0 })).build()
}

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

    private var entity: Output? = null

    private var `object`: Output? = null

    private var role: Output? = null

    /**
     * @param value The name of the bucket.
     */
    @JvmName("hakwhyrukkymxrkw")
    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}} (such as "[email protected]")
     * * group-{{groupId}}
     * * group-{{email}} (such as "[email protected]")
     * * domain-{{domain}} (such as "domain-example.com")
     * * project-team-{{projectId}}
     * * allUsers
     * * allAuthenticatedUsers
     */
    @JvmName("qhnoycxfwedtegfr")
    public suspend fun entity(`value`: Output) {
        this.entity = value
    }

    /**
     * @param value The name of the object to apply the access control to.
     */
    @JvmName("fbamuoixqujfohix")
    public suspend fun `object`(`value`: Output) {
        this.`object` = value
    }

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

    /**
     * @param value The name of the bucket.
     */
    @JvmName("qiqqvtkekkyqfxqx")
    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}} (such as "[email protected]")
     * * group-{{groupId}}
     * * group-{{email}} (such as "[email protected]")
     * * domain-{{domain}} (such as "domain-example.com")
     * * project-team-{{projectId}}
     * * allUsers
     * * allAuthenticatedUsers
     */
    @JvmName("vufhdcmnowgctkge")
    public suspend fun entity(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.entity = mapped
    }

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

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

    internal fun build(): ObjectAccessControlArgs = ObjectAccessControlArgs(
        bucket = bucket,
        entity = entity,
        `object` = `object`,
        role = role,
    )
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy