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

com.pulumi.gcp.projects.kotlin.IAMCustomRoleArgs.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.projects.kotlin

import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.gcp.projects.IAMCustomRoleArgs.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

/**
 * Allows management of a customized Cloud IAM project role. For more information see
 * [the official documentation](https://cloud.google.com/iam/docs/understanding-custom-roles)
 * and
 * [API](https://cloud.google.com/iam/reference/rest/v1/projects.roles).
 * > **Warning:** Note that custom roles in GCP have the concept of a soft-delete. There are two issues that may arise
 *  from this and how roles are propagated. 1) creating a role may involve undeleting and then updating a role with the
 *  same name, possibly causing confusing behavior between undelete and update. 2) A deleted role is permanently deleted
 *  after 7 days, but it can take up to 30 more days (i.e. between 7 and 37 days after deletion) before the role name is
 *  made available again. This means a deleted role that has been deleted for more than 7 days cannot be changed at all
 *  by the provider, and new roles cannot share that name.
 * ## Example Usage
 * This snippet creates a customized IAM role.
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const my_custom_role = new gcp.projects.IAMCustomRole("my-custom-role", {
 *     roleId: "myCustomRole",
 *     title: "My Custom Role",
 *     description: "A description",
 *     permissions: [
 *         "iam.roles.list",
 *         "iam.roles.create",
 *         "iam.roles.delete",
 *     ],
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * my_custom_role = gcp.projects.IAMCustomRole("my-custom-role",
 *     role_id="myCustomRole",
 *     title="My Custom Role",
 *     description="A description",
 *     permissions=[
 *         "iam.roles.list",
 *         "iam.roles.create",
 *         "iam.roles.delete",
 *     ])
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var my_custom_role = new Gcp.Projects.IAMCustomRole("my-custom-role", new()
 *     {
 *         RoleId = "myCustomRole",
 *         Title = "My Custom Role",
 *         Description = "A description",
 *         Permissions = new[]
 *         {
 *             "iam.roles.list",
 *             "iam.roles.create",
 *             "iam.roles.delete",
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/projects"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := projects.NewIAMCustomRole(ctx, "my-custom-role", &projects.IAMCustomRoleArgs{
 * 			RoleId:      pulumi.String("myCustomRole"),
 * 			Title:       pulumi.String("My Custom Role"),
 * 			Description: pulumi.String("A description"),
 * 			Permissions: pulumi.StringArray{
 * 				pulumi.String("iam.roles.list"),
 * 				pulumi.String("iam.roles.create"),
 * 				pulumi.String("iam.roles.delete"),
 * 			},
 * 		})
 * 		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.projects.IAMCustomRole;
 * import com.pulumi.gcp.projects.IAMCustomRoleArgs;
 * 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 my_custom_role = new IAMCustomRole("my-custom-role", IAMCustomRoleArgs.builder()
 *             .roleId("myCustomRole")
 *             .title("My Custom Role")
 *             .description("A description")
 *             .permissions(
 *                 "iam.roles.list",
 *                 "iam.roles.create",
 *                 "iam.roles.delete")
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   my-custom-role:
 *     type: gcp:projects:IAMCustomRole
 *     properties:
 *       roleId: myCustomRole
 *       title: My Custom Role
 *       description: A description
 *       permissions:
 *         - iam.roles.list
 *         - iam.roles.create
 *         - iam.roles.delete
 * ```
 * 
 * ## Import
 * Custom Roles can be imported using any of these accepted formats:
 * * `projects/{{project}}/roles/{{role_id}}`
 * * `{{project}}/{{role_id}}`
 * * `{{role_id}}`
 * When using the `pulumi import` command, Custom Roles can be imported using one of the formats above. For example:
 * ```sh
 * $ pulumi import gcp:projects/iAMCustomRole:IAMCustomRole default projects/{{project}}/roles/{{role_id}}
 * ```
 * ```sh
 * $ pulumi import gcp:projects/iAMCustomRole:IAMCustomRole default {{project}}/{{role_id}}
 * ```
 * ```sh
 * $ pulumi import gcp:projects/iAMCustomRole:IAMCustomRole default {{role_id}}
 * ```
 * @property description A human-readable description for the role.
 * @property permissions The names of the permissions this role grants when bound in an IAM policy. At least one permission must be specified.
 * @property project The project that the custom role will be created in.
 * Defaults to the provider project configuration.
 * @property roleId The camel case role id to use for this role. Cannot contain `-` characters.
 * @property stage The current launch stage of the role.
 * Defaults to `GA`.
 * List of possible stages is [here](https://cloud.google.com/iam/reference/rest/v1/organizations.roles#Role.RoleLaunchStage).
 * @property title A human-readable title for the role.
 */
public data class IAMCustomRoleArgs(
    public val description: Output? = null,
    public val permissions: Output>? = null,
    public val project: Output? = null,
    public val roleId: Output? = null,
    public val stage: Output? = null,
    public val title: Output? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.gcp.projects.IAMCustomRoleArgs =
        com.pulumi.gcp.projects.IAMCustomRoleArgs.builder()
            .description(description?.applyValue({ args0 -> args0 }))
            .permissions(permissions?.applyValue({ args0 -> args0.map({ args0 -> args0 }) }))
            .project(project?.applyValue({ args0 -> args0 }))
            .roleId(roleId?.applyValue({ args0 -> args0 }))
            .stage(stage?.applyValue({ args0 -> args0 }))
            .title(title?.applyValue({ args0 -> args0 })).build()
}

/**
 * Builder for [IAMCustomRoleArgs].
 */
@PulumiTagMarker
public class IAMCustomRoleArgsBuilder internal constructor() {
    private var description: Output? = null

    private var permissions: Output>? = null

    private var project: Output? = null

    private var roleId: Output? = null

    private var stage: Output? = null

    private var title: Output? = null

    /**
     * @param value A human-readable description for the role.
     */
    @JvmName("tewaxytdfvplsmyh")
    public suspend fun description(`value`: Output) {
        this.description = value
    }

    /**
     * @param value The names of the permissions this role grants when bound in an IAM policy. At least one permission must be specified.
     */
    @JvmName("fjikfawngrcqgpts")
    public suspend fun permissions(`value`: Output>) {
        this.permissions = value
    }

    @JvmName("glvfsfiyuskmfhem")
    public suspend fun permissions(vararg values: Output) {
        this.permissions = Output.all(values.asList())
    }

    /**
     * @param values The names of the permissions this role grants when bound in an IAM policy. At least one permission must be specified.
     */
    @JvmName("qyomhqoedkvyaxeh")
    public suspend fun permissions(values: List>) {
        this.permissions = Output.all(values)
    }

    /**
     * @param value The project that the custom role will be created in.
     * Defaults to the provider project configuration.
     */
    @JvmName("tcoujdrbbjfajrqo")
    public suspend fun project(`value`: Output) {
        this.project = value
    }

    /**
     * @param value The camel case role id to use for this role. Cannot contain `-` characters.
     */
    @JvmName("mxhaeoswbjykocty")
    public suspend fun roleId(`value`: Output) {
        this.roleId = value
    }

    /**
     * @param value The current launch stage of the role.
     * Defaults to `GA`.
     * List of possible stages is [here](https://cloud.google.com/iam/reference/rest/v1/organizations.roles#Role.RoleLaunchStage).
     */
    @JvmName("ffeemejhcpndtruk")
    public suspend fun stage(`value`: Output) {
        this.stage = value
    }

    /**
     * @param value A human-readable title for the role.
     */
    @JvmName("yjlgcjthqjquumua")
    public suspend fun title(`value`: Output) {
        this.title = value
    }

    /**
     * @param value A human-readable description for the role.
     */
    @JvmName("umdgnypbuphomems")
    public suspend fun description(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.description = mapped
    }

    /**
     * @param value The names of the permissions this role grants when bound in an IAM policy. At least one permission must be specified.
     */
    @JvmName("yxlfgxhdxetkmuja")
    public suspend fun permissions(`value`: List?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.permissions = mapped
    }

    /**
     * @param values The names of the permissions this role grants when bound in an IAM policy. At least one permission must be specified.
     */
    @JvmName("iicvtqllujhoeroa")
    public suspend fun permissions(vararg values: String) {
        val toBeMapped = values.toList()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.permissions = mapped
    }

    /**
     * @param value The project that the custom role will be created in.
     * Defaults to the provider project configuration.
     */
    @JvmName("teduvorapdytiplq")
    public suspend fun project(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.project = mapped
    }

    /**
     * @param value The camel case role id to use for this role. Cannot contain `-` characters.
     */
    @JvmName("ppgggdwnoofgydam")
    public suspend fun roleId(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.roleId = mapped
    }

    /**
     * @param value The current launch stage of the role.
     * Defaults to `GA`.
     * List of possible stages is [here](https://cloud.google.com/iam/reference/rest/v1/organizations.roles#Role.RoleLaunchStage).
     */
    @JvmName("mwcnlycfyvgdaedb")
    public suspend fun stage(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.stage = mapped
    }

    /**
     * @param value A human-readable title for the role.
     */
    @JvmName("ihwgcocexdfugche")
    public suspend fun title(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.title = mapped
    }

    internal fun build(): IAMCustomRoleArgs = IAMCustomRoleArgs(
        description = description,
        permissions = permissions,
        project = project,
        roleId = roleId,
        stage = stage,
        title = title,
    )
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy