com.pulumi.gcp.storage.kotlin.ObjectACLArgs.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pulumi-gcp-kotlin Show documentation
Show all versions of pulumi-gcp-kotlin Show documentation
Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.
@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.ObjectACLArgs.builder
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import kotlin.String
import kotlin.Suppress
import kotlin.collections.List
import kotlin.jvm.JvmName
/**
* Authoritatively manages the access control list (ACL) for an object in a Google
* Cloud Storage (GCS) bucket. Removing a `gcp.storage.ObjectACL` sets the
* acl to the `private` [predefined ACL](https://cloud.google.com/storage/docs/access-control#predefined-acl).
* For more information see
* [the official documentation](https://cloud.google.com/storage/docs/access-control/lists)
* and
* [API](https://cloud.google.com/storage/docs/json_api/v1/objectAccessControls).
* > Want fine-grained control over object ACLs? Use `gcp.storage.ObjectAccessControl` to control individual
* role entity pairs.
* ## Example Usage
* Create an object ACL with one owner and one reader.
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const image_store = new gcp.storage.Bucket("image-store", {
* name: "image-store-bucket",
* location: "EU",
* });
* const image = new gcp.storage.BucketObject("image", {
* name: "image1",
* bucket: image_store.name,
* source: new pulumi.asset.FileAsset("image1.jpg"),
* });
* const image_store_acl = new gcp.storage.ObjectACL("image-store-acl", {
* bucket: image_store.name,
* object: image.outputName,
* roleEntities: [
* "OWNER:[email protected]",
* "READER:group-mygroup",
* ],
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* image_store = gcp.storage.Bucket("image-store",
* name="image-store-bucket",
* location="EU")
* image = gcp.storage.BucketObject("image",
* name="image1",
* bucket=image_store.name,
* source=pulumi.FileAsset("image1.jpg"))
* image_store_acl = gcp.storage.ObjectACL("image-store-acl",
* bucket=image_store.name,
* object=image.output_name,
* role_entities=[
* "OWNER:[email protected]",
* "READER:group-mygroup",
* ])
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var image_store = new Gcp.Storage.Bucket("image-store", new()
* {
* Name = "image-store-bucket",
* Location = "EU",
* });
* var image = new Gcp.Storage.BucketObject("image", new()
* {
* Name = "image1",
* Bucket = image_store.Name,
* Source = new FileAsset("image1.jpg"),
* });
* var image_store_acl = new Gcp.Storage.ObjectACL("image-store-acl", new()
* {
* Bucket = image_store.Name,
* Object = image.OutputName,
* RoleEntities = new[]
* {
* "OWNER:[email protected]",
* "READER:group-mygroup",
* },
* });
* });
* ```
* ```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 {
* _, err := storage.NewBucket(ctx, "image-store", &storage.BucketArgs{
* Name: pulumi.String("image-store-bucket"),
* Location: pulumi.String("EU"),
* })
* if err != nil {
* return err
* }
* image, err := storage.NewBucketObject(ctx, "image", &storage.BucketObjectArgs{
* Name: pulumi.String("image1"),
* Bucket: image_store.Name,
* Source: pulumi.NewFileAsset("image1.jpg"),
* })
* if err != nil {
* return err
* }
* _, err = storage.NewObjectACL(ctx, "image-store-acl", &storage.ObjectACLArgs{
* Bucket: image_store.Name,
* Object: image.OutputName,
* RoleEntities: pulumi.StringArray{
* pulumi.String("OWNER:[email protected]"),
* pulumi.String("READER:group-mygroup"),
* },
* })
* 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.ObjectACL;
* import com.pulumi.gcp.storage.ObjectACLArgs;
* 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 image_store = new Bucket("image-store", BucketArgs.builder()
* .name("image-store-bucket")
* .location("EU")
* .build());
* var image = new BucketObject("image", BucketObjectArgs.builder()
* .name("image1")
* .bucket(image_store.name())
* .source(new FileAsset("image1.jpg"))
* .build());
* var image_store_acl = new ObjectACL("image-store-acl", ObjectACLArgs.builder()
* .bucket(image_store.name())
* .object(image.outputName())
* .roleEntities(
* "OWNER:[email protected]",
* "READER:group-mygroup")
* .build());
* }
* }
* ```
* ```yaml
* resources:
* image-store:
* type: gcp:storage:Bucket
* properties:
* name: image-store-bucket
* location: EU
* image:
* type: gcp:storage:BucketObject
* properties:
* name: image1
* bucket: ${["image-store"].name}
* source:
* fn::FileAsset: image1.jpg
* image-store-acl:
* type: gcp:storage:ObjectACL
* properties:
* bucket: ${["image-store"].name}
* object: ${image.outputName}
* roleEntities:
* - OWNER:[email protected]
* - READER:group-mygroup
* ```
*
* ## Import
* This resource does not support import.
* @property bucket The name of the bucket the object is stored in.
* @property object The name of the object to apply the acl to.
* - - -
* @property predefinedAcl The "canned" [predefined ACL](https://cloud.google.com/storage/docs/access-control#predefined-acl) to apply. Must be set if `role_entity` is not.
* @property roleEntities List of role/entity pairs in the form `ROLE:entity`. See [GCS Object ACL documentation](https://cloud.google.com/storage/docs/json_api/v1/objectAccessControls) for more details.
* Must be set if `predefined_acl` is not.
*/
public data class ObjectACLArgs(
public val bucket: Output? = null,
public val `object`: Output? = null,
public val predefinedAcl: Output? = null,
public val roleEntities: Output>? = null,
) : ConvertibleToJava {
override fun toJava(): com.pulumi.gcp.storage.ObjectACLArgs =
com.pulumi.gcp.storage.ObjectACLArgs.builder()
.bucket(bucket?.applyValue({ args0 -> args0 }))
.`object`(`object`?.applyValue({ args0 -> args0 }))
.predefinedAcl(predefinedAcl?.applyValue({ args0 -> args0 }))
.roleEntities(roleEntities?.applyValue({ args0 -> args0.map({ args0 -> args0 }) })).build()
}
/**
* Builder for [ObjectACLArgs].
*/
@PulumiTagMarker
public class ObjectACLArgsBuilder internal constructor() {
private var bucket: Output? = null
private var `object`: Output? = null
private var predefinedAcl: Output? = null
private var roleEntities: Output>? = null
/**
* @param value The name of the bucket the object is stored in.
*/
@JvmName("lkcaymeydntrwdyc")
public suspend fun bucket(`value`: Output) {
this.bucket = value
}
/**
* @param value The name of the object to apply the acl to.
* - - -
*/
@JvmName("bdfqmiqtbgqjljxj")
public suspend fun `object`(`value`: Output) {
this.`object` = value
}
/**
* @param value The "canned" [predefined ACL](https://cloud.google.com/storage/docs/access-control#predefined-acl) to apply. Must be set if `role_entity` is not.
*/
@JvmName("jxywpknwuarkamre")
public suspend fun predefinedAcl(`value`: Output) {
this.predefinedAcl = value
}
/**
* @param value List of role/entity pairs in the form `ROLE:entity`. See [GCS Object ACL documentation](https://cloud.google.com/storage/docs/json_api/v1/objectAccessControls) for more details.
* Must be set if `predefined_acl` is not.
*/
@JvmName("aiwtfkqsexcihsed")
public suspend fun roleEntities(`value`: Output>) {
this.roleEntities = value
}
@JvmName("tsnhastaftkhdpmg")
public suspend fun roleEntities(vararg values: Output) {
this.roleEntities = Output.all(values.asList())
}
/**
* @param values List of role/entity pairs in the form `ROLE:entity`. See [GCS Object ACL documentation](https://cloud.google.com/storage/docs/json_api/v1/objectAccessControls) for more details.
* Must be set if `predefined_acl` is not.
*/
@JvmName("lwtombhinxtuober")
public suspend fun roleEntities(values: List
© 2015 - 2024 Weber Informatics LLC | Privacy Policy