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

com.pulumi.gcp.serviceaccount.kotlin.AccountArgs.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.serviceaccount.kotlin

import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.gcp.serviceaccount.AccountArgs.builder
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import kotlin.Boolean
import kotlin.String
import kotlin.Suppress
import kotlin.jvm.JvmName

/**
 * Allows management of a Google Cloud service account.
 * * [API documentation](https://cloud.google.com/iam/reference/rest/v1/projects.serviceAccounts)
 * * How-to Guides
 *     * [Official Documentation](https://cloud.google.com/compute/docs/access/service-accounts)
 * > **Warning:**  If you delete and recreate a service account, you must reapply any IAM roles that it had before.
 * > Creation of service accounts is eventually consistent, and that can lead to
 * errors when you try to apply ACLs to service accounts immediately after
 * creation.
 * ## Example Usage
 * This snippet creates a service account in a project.
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const serviceAccount = new gcp.serviceaccount.Account("service_account", {
 *     accountId: "service-account-id",
 *     displayName: "Service Account",
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * service_account = gcp.serviceaccount.Account("service_account",
 *     account_id="service-account-id",
 *     display_name="Service Account")
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var serviceAccount = new Gcp.ServiceAccount.Account("service_account", new()
 *     {
 *         AccountId = "service-account-id",
 *         DisplayName = "Service Account",
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/serviceaccount"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := serviceaccount.NewAccount(ctx, "service_account", &serviceaccount.AccountArgs{
 * 			AccountId:   pulumi.String("service-account-id"),
 * 			DisplayName: pulumi.String("Service Account"),
 * 		})
 * 		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.serviceaccount.Account;
 * import com.pulumi.gcp.serviceaccount.AccountArgs;
 * 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 serviceAccount = new Account("serviceAccount", AccountArgs.builder()
 *             .accountId("service-account-id")
 *             .displayName("Service Account")
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   serviceAccount:
 *     type: gcp:serviceaccount:Account
 *     name: service_account
 *     properties:
 *       accountId: service-account-id
 *       displayName: Service Account
 * ```
 * 
 * ## Import
 * Service accounts can be imported using their URI, e.g.
 * * `projects/{{project_id}}/serviceAccounts/{{email}}`
 * When using the `pulumi import` command, service accounts can be imported using one of the formats above. For example:
 * ```sh
 * $ pulumi import gcp:serviceaccount/account:Account default projects/{{project_id}}/serviceAccounts/{{email}}
 * ```
 * @property accountId The account id that is used to generate the service
 * account email address and a stable unique id. It is unique within a project,
 * must be 6-30 characters long, and match the regular expression `a-z`
 * to comply with RFC1035. Changing this forces a new service account to be created.
 * @property createIgnoreAlreadyExists If set to true, skip service account creation if a service account with the same email already exists.
 * @property description A text description of the service account.
 * Must be less than or equal to 256 UTF-8 bytes.
 * @property disabled Whether a service account is disabled or not. Defaults to `false`. This field has no effect during creation.
 * Must be set after creation to disable a service account.
 * @property displayName The display name for the service account.
 * Can be updated without creating a new resource.
 * @property project The ID of the project that the service account will be created in.
 * Defaults to the provider project configuration.
 */
public data class AccountArgs(
    public val accountId: Output? = null,
    public val createIgnoreAlreadyExists: Output? = null,
    public val description: Output? = null,
    public val disabled: Output? = null,
    public val displayName: Output? = null,
    public val project: Output? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.gcp.serviceaccount.AccountArgs =
        com.pulumi.gcp.serviceaccount.AccountArgs.builder()
            .accountId(accountId?.applyValue({ args0 -> args0 }))
            .createIgnoreAlreadyExists(createIgnoreAlreadyExists?.applyValue({ args0 -> args0 }))
            .description(description?.applyValue({ args0 -> args0 }))
            .disabled(disabled?.applyValue({ args0 -> args0 }))
            .displayName(displayName?.applyValue({ args0 -> args0 }))
            .project(project?.applyValue({ args0 -> args0 })).build()
}

/**
 * Builder for [AccountArgs].
 */
@PulumiTagMarker
public class AccountArgsBuilder internal constructor() {
    private var accountId: Output? = null

    private var createIgnoreAlreadyExists: Output? = null

    private var description: Output? = null

    private var disabled: Output? = null

    private var displayName: Output? = null

    private var project: Output? = null

    /**
     * @param value The account id that is used to generate the service
     * account email address and a stable unique id. It is unique within a project,
     * must be 6-30 characters long, and match the regular expression `a-z`
     * to comply with RFC1035. Changing this forces a new service account to be created.
     */
    @JvmName("ugryncssgrshnfrx")
    public suspend fun accountId(`value`: Output) {
        this.accountId = value
    }

    /**
     * @param value If set to true, skip service account creation if a service account with the same email already exists.
     */
    @JvmName("dupdqcceaseateom")
    public suspend fun createIgnoreAlreadyExists(`value`: Output) {
        this.createIgnoreAlreadyExists = value
    }

    /**
     * @param value A text description of the service account.
     * Must be less than or equal to 256 UTF-8 bytes.
     */
    @JvmName("kcjipvijxsakvuxc")
    public suspend fun description(`value`: Output) {
        this.description = value
    }

    /**
     * @param value Whether a service account is disabled or not. Defaults to `false`. This field has no effect during creation.
     * Must be set after creation to disable a service account.
     */
    @JvmName("etrjwglddpguhpov")
    public suspend fun disabled(`value`: Output) {
        this.disabled = value
    }

    /**
     * @param value The display name for the service account.
     * Can be updated without creating a new resource.
     */
    @JvmName("bapijljedqwgnkrv")
    public suspend fun displayName(`value`: Output) {
        this.displayName = value
    }

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

    /**
     * @param value The account id that is used to generate the service
     * account email address and a stable unique id. It is unique within a project,
     * must be 6-30 characters long, and match the regular expression `a-z`
     * to comply with RFC1035. Changing this forces a new service account to be created.
     */
    @JvmName("ysfwapvkiavqbbvm")
    public suspend fun accountId(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.accountId = mapped
    }

    /**
     * @param value If set to true, skip service account creation if a service account with the same email already exists.
     */
    @JvmName("oluggrbddefyhrfn")
    public suspend fun createIgnoreAlreadyExists(`value`: Boolean?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.createIgnoreAlreadyExists = mapped
    }

    /**
     * @param value A text description of the service account.
     * Must be less than or equal to 256 UTF-8 bytes.
     */
    @JvmName("faopkxogleyrmkhk")
    public suspend fun description(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.description = mapped
    }

    /**
     * @param value Whether a service account is disabled or not. Defaults to `false`. This field has no effect during creation.
     * Must be set after creation to disable a service account.
     */
    @JvmName("rugdgcjratpcvjex")
    public suspend fun disabled(`value`: Boolean?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.disabled = mapped
    }

    /**
     * @param value The display name for the service account.
     * Can be updated without creating a new resource.
     */
    @JvmName("mpdqviktcyfxaocv")
    public suspend fun displayName(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.displayName = mapped
    }

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

    internal fun build(): AccountArgs = AccountArgs(
        accountId = accountId,
        createIgnoreAlreadyExists = createIgnoreAlreadyExists,
        description = description,
        disabled = disabled,
        displayName = displayName,
        project = project,
    )
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy