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.
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.gcp.storage.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
import kotlin.collections.List
/**
* Builder for [BucketACL].
*/
@PulumiTagMarker
public class BucketACLResourceBuilder internal constructor() {
public var name: String? = null
public var args: BucketACLArgs = BucketACLArgs()
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 BucketACLArgsBuilder.() -> Unit) {
val builder = BucketACLArgsBuilder()
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(): BucketACL {
val builtJavaResource = com.pulumi.gcp.storage.BucketACL(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return BucketACL(builtJavaResource)
}
}
/**
* Authoritatively manages a bucket's ACLs in Google cloud storage service (GCS). 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/bucketAccessControls).
* Bucket ACLs can be managed non authoritatively using the `storage_bucket_access_control` resource. Do not use these two resources in conjunction to manage the same bucket.
* Permissions can be granted either by ACLs or Cloud IAM policies. In general, permissions granted by Cloud IAM policies do not appear in ACLs, and permissions granted by ACLs do not appear in Cloud IAM policies. The only exception is for ACLs applied directly on a bucket and certain bucket-level Cloud IAM policies, as described in [Cloud IAM relation to ACLs](https://cloud.google.com/storage/docs/access-control/iam#acls).
* **NOTE** This resource will not remove the `project-owners-` entity from the `OWNER` role.
* ## Example Usage
* Example creating an ACL on a bucket 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_store_acl = new gcp.storage.BucketACL("image-store-acl", {
* bucket: image_store.name,
* 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_store_acl = gcp.storage.BucketACL("image-store-acl",
* bucket=image_store.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_store_acl = new Gcp.Storage.BucketACL("image-store-acl", new()
* {
* Bucket = image_store.Name,
* 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
* }
* _, err = storage.NewBucketACL(ctx, "image-store-acl", &storage.BucketACLArgs{
* Bucket: image_store.Name,
* 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.BucketACL;
* import com.pulumi.gcp.storage.BucketACLArgs;
* 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_store_acl = new BucketACL("image-store-acl", BucketACLArgs.builder()
* .bucket(image_store.name())
* .roleEntities(
* "OWNER:[email protected]",
* "READER:group-mygroup")
* .build());
* }
* }
* ```
* ```yaml
* resources:
* image-store:
* type: gcp:storage:Bucket
* properties:
* name: image-store-bucket
* location: EU
* image-store-acl:
* type: gcp:storage:BucketACL
* properties:
* bucket: ${["image-store"].name}
* roleEntities:
* - OWNER:[email protected]
* - READER:group-mygroup
* ```
*
* ## Import
* This resource does not support import.
*/
public class BucketACL internal constructor(
override val javaResource: com.pulumi.gcp.storage.BucketACL,
) : KotlinCustomResource(javaResource, BucketACLMapper) {
/**
* The name of the bucket it applies to.
* - - -
*/
public val bucket: Output
get() = javaResource.bucket().applyValue({ args0 -> args0 })
/**
* Configure this ACL to be the default ACL.
*/
public val defaultAcl: Output?
get() = javaResource.defaultAcl().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* The [canned GCS ACL](https://cloud.google.com/storage/docs/access-control/lists#predefined-acl) to apply. Must be set if `role_entity` is not.
*/
public val predefinedAcl: Output?
get() = javaResource.predefinedAcl().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* List of role/entity pairs in the form `ROLE:entity`. See [GCS Bucket ACL documentation](https://cloud.google.com/storage/docs/json_api/v1/bucketAccessControls) for more details. Must be set if `predefined_acl` is not.
*/
public val roleEntities: Output>
get() = javaResource.roleEntities().applyValue({ args0 -> args0.map({ args0 -> args0 }) })
}
public object BucketACLMapper : ResourceMapper {
override fun supportsMappingOfType(javaResource: Resource): Boolean =
com.pulumi.gcp.storage.BucketACL::class == javaResource::class
override fun map(javaResource: Resource): BucketACL = BucketACL(
javaResource as
com.pulumi.gcp.storage.BucketACL,
)
}
/**
* @see [BucketACL].
* @param name The _unique_ name of the resulting resource.
* @param block Builder for [BucketACL].
*/
public suspend fun bucketACL(name: String, block: suspend BucketACLResourceBuilder.() -> Unit): BucketACL {
val builder = BucketACLResourceBuilder()
builder.name(name)
block(builder)
return builder.build()
}
/**
* @see [BucketACL].
* @param name The _unique_ name of the resulting resource.
*/
public fun bucketACL(name: String): BucketACL {
val builder = BucketACLResourceBuilder()
builder.name(name)
return builder.build()
}