com.pulumi.gcp.storage.kotlin.DefaultObjectAccessControl.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.gcp.storage.kotlin.outputs.DefaultObjectAccessControlProjectTeam
import com.pulumi.gcp.storage.kotlin.outputs.DefaultObjectAccessControlProjectTeam.Companion.toKotlin
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.Int
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
/**
* Builder for [DefaultObjectAccessControl].
*/
@PulumiTagMarker
public class DefaultObjectAccessControlResourceBuilder internal constructor() {
public var name: String? = null
public var args: DefaultObjectAccessControlArgs = DefaultObjectAccessControlArgs()
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 DefaultObjectAccessControlArgsBuilder.() -> Unit) {
val builder = DefaultObjectAccessControlArgsBuilder()
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(): DefaultObjectAccessControl {
val builtJavaResource =
com.pulumi.gcp.storage.DefaultObjectAccessControl(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return DefaultObjectAccessControl(builtJavaResource)
}
}
/**
* The DefaultObjectAccessControls resources represent the Access Control
* Lists (ACLs) applied to a new object within a Google Cloud Storage bucket
* when no ACL was provided for that object. ACLs let you specify who has
* access to your bucket contents 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 DefaultObjectAccessControl, see:
* * [API documentation](https://cloud.google.com/storage/docs/json_api/v1/defaultObjectAccessControls)
* * How-to Guides
* * [Official Documentation](https://cloud.google.com/storage/docs/access-control/create-manage-lists)
* ## Example Usage
* ### Storage Default Object Access Control Public
*
* ```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.DefaultObjectAccessControl("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.DefaultObjectAccessControl("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.DefaultObjectAccessControl("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.NewDefaultObjectAccessControl(ctx, "public_rule", &storage.DefaultObjectAccessControlArgs{
* 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.DefaultObjectAccessControl;
* import com.pulumi.gcp.storage.DefaultObjectAccessControlArgs;
* 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 DefaultObjectAccessControl("publicRule", DefaultObjectAccessControlArgs.builder()
* .bucket(bucket.name())
* .role("READER")
* .entity("allUsers")
* .build());
* }
* }
* ```
* ```yaml
* resources:
* publicRule:
* type: gcp:storage:DefaultObjectAccessControl
* name: public_rule
* properties:
* bucket: ${bucket.name}
* role: READER
* entity: allUsers
* bucket:
* type: gcp:storage:Bucket
* properties:
* name: static-content-bucket
* location: US
* ```
*
* ## Import
* DefaultObjectAccessControl can be imported using any of these accepted formats:
* * `{{bucket}}/{{entity}}`
* When using the `pulumi import` command, DefaultObjectAccessControl can be imported using one of the formats above. For example:
* ```sh
* $ pulumi import gcp:storage/defaultObjectAccessControl:DefaultObjectAccessControl default {{bucket}}/{{entity}}
* ```
*/
public class DefaultObjectAccessControl internal constructor(
override val javaResource: com.pulumi.gcp.storage.DefaultObjectAccessControl,
) : KotlinCustomResource(javaResource, DefaultObjectAccessControlMapper) {
/**
* The name of the bucket.
*/
public val bucket: Output
get() = javaResource.bucket().applyValue({ args0 -> args0 })
/**
* The domain associated with the entity.
*/
public val domain: Output
get() = javaResource.domain().applyValue({ args0 -> args0 })
/**
* The email address associated with the entity.
*/
public val email: Output
get() = javaResource.email().applyValue({ args0 -> args0 })
/**
* 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
*/
public val entity: Output
get() = javaResource.entity().applyValue({ args0 -> args0 })
/**
* The ID for the entity
*/
public val entityId: Output
get() = javaResource.entityId().applyValue({ args0 -> args0 })
/**
* The content generation of the object, if applied to an object.
*/
public val generation: Output
get() = javaResource.generation().applyValue({ args0 -> args0 })
/**
* The name of the object, if applied to an object.
*/
public val `object`: Output?
get() = javaResource.`object`().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })
/**
* The project team associated with the entity
* Structure is documented below.
*/
public val projectTeams: Output>
get() = javaResource.projectTeams().applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 ->
toKotlin(args0)
})
})
})
/**
* The access permission for the entity.
* Possible values are: `OWNER`, `READER`.
* - - -
*/
public val role: Output
get() = javaResource.role().applyValue({ args0 -> args0 })
}
public object DefaultObjectAccessControlMapper : ResourceMapper {
override fun supportsMappingOfType(javaResource: Resource): Boolean =
com.pulumi.gcp.storage.DefaultObjectAccessControl::class == javaResource::class
override fun map(javaResource: Resource): DefaultObjectAccessControl =
DefaultObjectAccessControl(javaResource as com.pulumi.gcp.storage.DefaultObjectAccessControl)
}
/**
* @see [DefaultObjectAccessControl].
* @param name The _unique_ name of the resulting resource.
* @param block Builder for [DefaultObjectAccessControl].
*/
public suspend fun defaultObjectAccessControl(
name: String,
block: suspend DefaultObjectAccessControlResourceBuilder.() -> Unit,
): DefaultObjectAccessControl {
val builder = DefaultObjectAccessControlResourceBuilder()
builder.name(name)
block(builder)
return builder.build()
}
/**
* @see [DefaultObjectAccessControl].
* @param name The _unique_ name of the resulting resource.
*/
public fun defaultObjectAccessControl(name: String): DefaultObjectAccessControl {
val builder = DefaultObjectAccessControlResourceBuilder()
builder.name(name)
return builder.build()
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy