Please wait. This can take some minutes ...
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.
com.pulumi.gcp.sql.kotlin.UserArgs.kt Maven / Gradle / Ivy
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.gcp.sql.kotlin
import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.gcp.sql.UserArgs.builder
import com.pulumi.gcp.sql.kotlin.inputs.UserPasswordPolicyArgs
import com.pulumi.gcp.sql.kotlin.inputs.UserPasswordPolicyArgsBuilder
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.applySuspend
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.jvm.JvmName
/**
* Creates a new Google SQL User on a Google SQL User Instance. For more information, see the [official documentation](https://cloud.google.com/sql/), or the [JSON API](https://cloud.google.com/sql/docs/admin-api/v1beta4/users).
* ## Example Usage
* Example creating a SQL User.
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* import * as random from "@pulumi/random";
* const dbNameSuffix = new random.RandomId("db_name_suffix", {byteLength: 4});
* const main = new gcp.sql.DatabaseInstance("main", {
* name: pulumi.interpolate`main-instance-${dbNameSuffix.hex}`,
* databaseVersion: "MYSQL_5_7",
* settings: {
* tier: "db-f1-micro",
* },
* });
* const users = new gcp.sql.User("users", {
* name: "me",
* instance: main.name,
* host: "me.com",
* password: "changeme",
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* import pulumi_random as random
* db_name_suffix = random.RandomId("db_name_suffix", byte_length=4)
* main = gcp.sql.DatabaseInstance("main",
* name=db_name_suffix.hex.apply(lambda hex: f"main-instance-{hex}"),
* database_version="MYSQL_5_7",
* settings={
* "tier": "db-f1-micro",
* })
* users = gcp.sql.User("users",
* name="me",
* instance=main.name,
* host="me.com",
* password="changeme")
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* using Random = Pulumi.Random;
* return await Deployment.RunAsync(() =>
* {
* var dbNameSuffix = new Random.RandomId("db_name_suffix", new()
* {
* ByteLength = 4,
* });
* var main = new Gcp.Sql.DatabaseInstance("main", new()
* {
* Name = dbNameSuffix.Hex.Apply(hex => $"main-instance-{hex}"),
* DatabaseVersion = "MYSQL_5_7",
* Settings = new Gcp.Sql.Inputs.DatabaseInstanceSettingsArgs
* {
* Tier = "db-f1-micro",
* },
* });
* var users = new Gcp.Sql.User("users", new()
* {
* Name = "me",
* Instance = main.Name,
* Host = "me.com",
* Password = "changeme",
* });
* });
* ```
* ```go
* package main
* import (
* "fmt"
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/sql"
* "github.com/pulumi/pulumi-random/sdk/v4/go/random"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* dbNameSuffix, err := random.NewRandomId(ctx, "db_name_suffix", &random.RandomIdArgs{
* ByteLength: pulumi.Int(4),
* })
* if err != nil {
* return err
* }
* main, err := sql.NewDatabaseInstance(ctx, "main", &sql.DatabaseInstanceArgs{
* Name: dbNameSuffix.Hex.ApplyT(func(hex string) (string, error) {
* return fmt.Sprintf("main-instance-%v", hex), nil
* }).(pulumi.StringOutput),
* DatabaseVersion: pulumi.String("MYSQL_5_7"),
* Settings: &sql.DatabaseInstanceSettingsArgs{
* Tier: pulumi.String("db-f1-micro"),
* },
* })
* if err != nil {
* return err
* }
* _, err = sql.NewUser(ctx, "users", &sql.UserArgs{
* Name: pulumi.String("me"),
* Instance: main.Name,
* Host: pulumi.String("me.com"),
* Password: pulumi.String("changeme"),
* })
* 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.random.RandomId;
* import com.pulumi.random.RandomIdArgs;
* import com.pulumi.gcp.sql.DatabaseInstance;
* import com.pulumi.gcp.sql.DatabaseInstanceArgs;
* import com.pulumi.gcp.sql.inputs.DatabaseInstanceSettingsArgs;
* import com.pulumi.gcp.sql.User;
* import com.pulumi.gcp.sql.UserArgs;
* 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 dbNameSuffix = new RandomId("dbNameSuffix", RandomIdArgs.builder()
* .byteLength(4)
* .build());
* var main = new DatabaseInstance("main", DatabaseInstanceArgs.builder()
* .name(dbNameSuffix.hex().applyValue(hex -> String.format("main-instance-%s", hex)))
* .databaseVersion("MYSQL_5_7")
* .settings(DatabaseInstanceSettingsArgs.builder()
* .tier("db-f1-micro")
* .build())
* .build());
* var users = new User("users", UserArgs.builder()
* .name("me")
* .instance(main.name())
* .host("me.com")
* .password("changeme")
* .build());
* }
* }
* ```
* ```yaml
* resources:
* dbNameSuffix:
* type: random:RandomId
* name: db_name_suffix
* properties:
* byteLength: 4
* main:
* type: gcp:sql:DatabaseInstance
* properties:
* name: main-instance-${dbNameSuffix.hex}
* databaseVersion: MYSQL_5_7
* settings:
* tier: db-f1-micro
* users:
* type: gcp:sql:User
* properties:
* name: me
* instance: ${main.name}
* host: me.com
* password: changeme
* ```
*
* Example using [Cloud SQL IAM database authentication](https://cloud.google.com/sql/docs/mysql/authentication).
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* import * as random from "@pulumi/random";
* import * as std from "@pulumi/std";
* const dbNameSuffix = new random.RandomId("db_name_suffix", {byteLength: 4});
* const main = new gcp.sql.DatabaseInstance("main", {
* name: pulumi.interpolate`main-instance-${dbNameSuffix.hex}`,
* databaseVersion: "POSTGRES_15",
* settings: {
* tier: "db-f1-micro",
* databaseFlags: [{
* name: "cloudsql_iam_authentication",
* value: "on",
* }],
* },
* });
* const iamUser = new gcp.sql.User("iam_user", {
* name: "[email protected] ",
* instance: main.name,
* type: "CLOUD_IAM_USER",
* });
* const iamServiceAccountUser = new gcp.sql.User("iam_service_account_user", {
* name: std.trimsuffix({
* input: serviceAccount.email,
* suffix: ".gserviceaccount.com",
* }).then(invoke => invoke.result),
* instance: main.name,
* type: "CLOUD_IAM_SERVICE_ACCOUNT",
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* import pulumi_random as random
* import pulumi_std as std
* db_name_suffix = random.RandomId("db_name_suffix", byte_length=4)
* main = gcp.sql.DatabaseInstance("main",
* name=db_name_suffix.hex.apply(lambda hex: f"main-instance-{hex}"),
* database_version="POSTGRES_15",
* settings={
* "tier": "db-f1-micro",
* "database_flags": [{
* "name": "cloudsql_iam_authentication",
* "value": "on",
* }],
* })
* iam_user = gcp.sql.User("iam_user",
* name="[email protected] ",
* instance=main.name,
* type="CLOUD_IAM_USER")
* iam_service_account_user = gcp.sql.User("iam_service_account_user",
* name=std.trimsuffix(input=service_account["email"],
* suffix=".gserviceaccount.com").result,
* instance=main.name,
* type="CLOUD_IAM_SERVICE_ACCOUNT")
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* using Random = Pulumi.Random;
* using Std = Pulumi.Std;
* return await Deployment.RunAsync(() =>
* {
* var dbNameSuffix = new Random.RandomId("db_name_suffix", new()
* {
* ByteLength = 4,
* });
* var main = new Gcp.Sql.DatabaseInstance("main", new()
* {
* Name = dbNameSuffix.Hex.Apply(hex => $"main-instance-{hex}"),
* DatabaseVersion = "POSTGRES_15",
* Settings = new Gcp.Sql.Inputs.DatabaseInstanceSettingsArgs
* {
* Tier = "db-f1-micro",
* DatabaseFlags = new[]
* {
* new Gcp.Sql.Inputs.DatabaseInstanceSettingsDatabaseFlagArgs
* {
* Name = "cloudsql_iam_authentication",
* Value = "on",
* },
* },
* },
* });
* var iamUser = new Gcp.Sql.User("iam_user", new()
* {
* Name = "[email protected] ",
* Instance = main.Name,
* Type = "CLOUD_IAM_USER",
* });
* var iamServiceAccountUser = new Gcp.Sql.User("iam_service_account_user", new()
* {
* Name = Std.Trimsuffix.Invoke(new()
* {
* Input = serviceAccount.Email,
* Suffix = ".gserviceaccount.com",
* }).Apply(invoke => invoke.Result),
* Instance = main.Name,
* Type = "CLOUD_IAM_SERVICE_ACCOUNT",
* });
* });
* ```
* ```go
* package main
* import (
* "fmt"
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/sql"
* "github.com/pulumi/pulumi-random/sdk/v4/go/random"
* "github.com/pulumi/pulumi-std/sdk/go/std"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* dbNameSuffix, err := random.NewRandomId(ctx, "db_name_suffix", &random.RandomIdArgs{
* ByteLength: pulumi.Int(4),
* })
* if err != nil {
* return err
* }
* main, err := sql.NewDatabaseInstance(ctx, "main", &sql.DatabaseInstanceArgs{
* Name: dbNameSuffix.Hex.ApplyT(func(hex string) (string, error) {
* return fmt.Sprintf("main-instance-%v", hex), nil
* }).(pulumi.StringOutput),
* DatabaseVersion: pulumi.String("POSTGRES_15"),
* Settings: &sql.DatabaseInstanceSettingsArgs{
* Tier: pulumi.String("db-f1-micro"),
* DatabaseFlags: sql.DatabaseInstanceSettingsDatabaseFlagArray{
* &sql.DatabaseInstanceSettingsDatabaseFlagArgs{
* Name: pulumi.String("cloudsql_iam_authentication"),
* Value: pulumi.String("on"),
* },
* },
* },
* })
* if err != nil {
* return err
* }
* _, err = sql.NewUser(ctx, "iam_user", &sql.UserArgs{
* Name: pulumi.String("[email protected] "),
* Instance: main.Name,
* Type: pulumi.String("CLOUD_IAM_USER"),
* })
* if err != nil {
* return err
* }
* invokeTrimsuffix, err := std.Trimsuffix(ctx, &std.TrimsuffixArgs{
* Input: serviceAccount.Email,
* Suffix: ".gserviceaccount.com",
* }, nil)
* if err != nil {
* return err
* }
* _, err = sql.NewUser(ctx, "iam_service_account_user", &sql.UserArgs{
* Name: pulumi.String(invokeTrimsuffix.Result),
* Instance: main.Name,
* Type: pulumi.String("CLOUD_IAM_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.random.RandomId;
* import com.pulumi.random.RandomIdArgs;
* import com.pulumi.gcp.sql.DatabaseInstance;
* import com.pulumi.gcp.sql.DatabaseInstanceArgs;
* import com.pulumi.gcp.sql.inputs.DatabaseInstanceSettingsArgs;
* import com.pulumi.gcp.sql.User;
* import com.pulumi.gcp.sql.UserArgs;
* 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 dbNameSuffix = new RandomId("dbNameSuffix", RandomIdArgs.builder()
* .byteLength(4)
* .build());
* var main = new DatabaseInstance("main", DatabaseInstanceArgs.builder()
* .name(dbNameSuffix.hex().applyValue(hex -> String.format("main-instance-%s", hex)))
* .databaseVersion("POSTGRES_15")
* .settings(DatabaseInstanceSettingsArgs.builder()
* .tier("db-f1-micro")
* .databaseFlags(DatabaseInstanceSettingsDatabaseFlagArgs.builder()
* .name("cloudsql_iam_authentication")
* .value("on")
* .build())
* .build())
* .build());
* var iamUser = new User("iamUser", UserArgs.builder()
* .name("[email protected] ")
* .instance(main.name())
* .type("CLOUD_IAM_USER")
* .build());
* var iamServiceAccountUser = new User("iamServiceAccountUser", UserArgs.builder()
* .name(StdFunctions.trimsuffix(TrimsuffixArgs.builder()
* .input(serviceAccount.email())
* .suffix(".gserviceaccount.com")
* .build()).result())
* .instance(main.name())
* .type("CLOUD_IAM_SERVICE_ACCOUNT")
* .build());
* }
* }
* ```
* ```yaml
* resources:
* dbNameSuffix:
* type: random:RandomId
* name: db_name_suffix
* properties:
* byteLength: 4
* main:
* type: gcp:sql:DatabaseInstance
* properties:
* name: main-instance-${dbNameSuffix.hex}
* databaseVersion: POSTGRES_15
* settings:
* tier: db-f1-micro
* databaseFlags:
* - name: cloudsql_iam_authentication
* value: on
* iamUser:
* type: gcp:sql:User
* name: iam_user
* properties:
* name: [email protected]
* instance: ${main.name}
* type: CLOUD_IAM_USER
* iamServiceAccountUser:
* type: gcp:sql:User
* name: iam_service_account_user
* properties:
* name:
* fn::invoke:
* Function: std:trimsuffix
* Arguments:
* input: ${serviceAccount.email}
* suffix: .gserviceaccount.com
* Return: result
* instance: ${main.name}
* type: CLOUD_IAM_SERVICE_ACCOUNT
* ```
*
* Example using [Cloud SQL IAM Group authentication](https://cloud.google.com/sql/docs/mysql/iam-authentication#iam-group-auth).
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* import * as random from "@pulumi/random";
* const dbNameSuffix = new random.RandomId("db_name_suffix", {byteLength: 4});
* const main = new gcp.sql.DatabaseInstance("main", {
* name: pulumi.interpolate`main-instance-${dbNameSuffix.hex}`,
* databaseVersion: "MYSQL_8_0",
* settings: {
* tier: "db-f1-micro",
* databaseFlags: [{
* name: "cloudsql_iam_authentication",
* value: "on",
* }],
* },
* });
* const iamGroupUser = new gcp.sql.User("iam_group_user", {
* name: "[email protected] ",
* instance: main.name,
* type: "CLOUD_IAM_GROUP",
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* import pulumi_random as random
* db_name_suffix = random.RandomId("db_name_suffix", byte_length=4)
* main = gcp.sql.DatabaseInstance("main",
* name=db_name_suffix.hex.apply(lambda hex: f"main-instance-{hex}"),
* database_version="MYSQL_8_0",
* settings={
* "tier": "db-f1-micro",
* "database_flags": [{
* "name": "cloudsql_iam_authentication",
* "value": "on",
* }],
* })
* iam_group_user = gcp.sql.User("iam_group_user",
* name="[email protected] ",
* instance=main.name,
* type="CLOUD_IAM_GROUP")
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* using Random = Pulumi.Random;
* return await Deployment.RunAsync(() =>
* {
* var dbNameSuffix = new Random.RandomId("db_name_suffix", new()
* {
* ByteLength = 4,
* });
* var main = new Gcp.Sql.DatabaseInstance("main", new()
* {
* Name = dbNameSuffix.Hex.Apply(hex => $"main-instance-{hex}"),
* DatabaseVersion = "MYSQL_8_0",
* Settings = new Gcp.Sql.Inputs.DatabaseInstanceSettingsArgs
* {
* Tier = "db-f1-micro",
* DatabaseFlags = new[]
* {
* new Gcp.Sql.Inputs.DatabaseInstanceSettingsDatabaseFlagArgs
* {
* Name = "cloudsql_iam_authentication",
* Value = "on",
* },
* },
* },
* });
* var iamGroupUser = new Gcp.Sql.User("iam_group_user", new()
* {
* Name = "[email protected] ",
* Instance = main.Name,
* Type = "CLOUD_IAM_GROUP",
* });
* });
* ```
* ```go
* package main
* import (
* "fmt"
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/sql"
* "github.com/pulumi/pulumi-random/sdk/v4/go/random"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* dbNameSuffix, err := random.NewRandomId(ctx, "db_name_suffix", &random.RandomIdArgs{
* ByteLength: pulumi.Int(4),
* })
* if err != nil {
* return err
* }
* main, err := sql.NewDatabaseInstance(ctx, "main", &sql.DatabaseInstanceArgs{
* Name: dbNameSuffix.Hex.ApplyT(func(hex string) (string, error) {
* return fmt.Sprintf("main-instance-%v", hex), nil
* }).(pulumi.StringOutput),
* DatabaseVersion: pulumi.String("MYSQL_8_0"),
* Settings: &sql.DatabaseInstanceSettingsArgs{
* Tier: pulumi.String("db-f1-micro"),
* DatabaseFlags: sql.DatabaseInstanceSettingsDatabaseFlagArray{
* &sql.DatabaseInstanceSettingsDatabaseFlagArgs{
* Name: pulumi.String("cloudsql_iam_authentication"),
* Value: pulumi.String("on"),
* },
* },
* },
* })
* if err != nil {
* return err
* }
* _, err = sql.NewUser(ctx, "iam_group_user", &sql.UserArgs{
* Name: pulumi.String("[email protected] "),
* Instance: main.Name,
* Type: pulumi.String("CLOUD_IAM_GROUP"),
* })
* 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.random.RandomId;
* import com.pulumi.random.RandomIdArgs;
* import com.pulumi.gcp.sql.DatabaseInstance;
* import com.pulumi.gcp.sql.DatabaseInstanceArgs;
* import com.pulumi.gcp.sql.inputs.DatabaseInstanceSettingsArgs;
* import com.pulumi.gcp.sql.User;
* import com.pulumi.gcp.sql.UserArgs;
* 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 dbNameSuffix = new RandomId("dbNameSuffix", RandomIdArgs.builder()
* .byteLength(4)
* .build());
* var main = new DatabaseInstance("main", DatabaseInstanceArgs.builder()
* .name(dbNameSuffix.hex().applyValue(hex -> String.format("main-instance-%s", hex)))
* .databaseVersion("MYSQL_8_0")
* .settings(DatabaseInstanceSettingsArgs.builder()
* .tier("db-f1-micro")
* .databaseFlags(DatabaseInstanceSettingsDatabaseFlagArgs.builder()
* .name("cloudsql_iam_authentication")
* .value("on")
* .build())
* .build())
* .build());
* var iamGroupUser = new User("iamGroupUser", UserArgs.builder()
* .name("[email protected] ")
* .instance(main.name())
* .type("CLOUD_IAM_GROUP")
* .build());
* }
* }
* ```
* ```yaml
* resources:
* dbNameSuffix:
* type: random:RandomId
* name: db_name_suffix
* properties:
* byteLength: 4
* main:
* type: gcp:sql:DatabaseInstance
* properties:
* name: main-instance-${dbNameSuffix.hex}
* databaseVersion: MYSQL_8_0
* settings:
* tier: db-f1-micro
* databaseFlags:
* - name: cloudsql_iam_authentication
* value: on
* iamGroupUser:
* type: gcp:sql:User
* name: iam_group_user
* properties:
* name: [email protected]
* instance: ${main.name}
* type: CLOUD_IAM_GROUP
* ```
*
* ## Import
* SQL users for MySQL databases can be imported using the `project`, `instance`, `host` and `name`, e.g.
* * `{{project_id}}/{{instance}}/{{host}}/{{name}}`
* SQL users for PostgreSQL databases can be imported using the `project`, `instance` and `name`, e.g.
* * `{{project_id}}/{{instance}}/{{name}}`
* When using the `pulumi import` command, NAME_HERE can be imported using one of the formats above. For example:
* MySQL database
* ```sh
* $ pulumi import gcp:sql/user:User default {{project_id}}/{{instance}}/{{host}}/{{name}}
* ```
* PostgreSQL database
* ```sh
* $ pulumi import gcp:sql/user:User default {{project_id}}/{{instance}}/{{name}}
* ```
* @property deletionPolicy The deletion policy for the user.
* Setting `ABANDON` allows the resource to be abandoned rather than deleted. This is useful
* for Postgres, where users cannot be deleted from the API if they have been granted SQL roles.
* Possible values are: `ABANDON`.
* - - -
* @property host The host the user can connect from. This is only supported
* for BUILT_IN users in MySQL instances. Don't set this field for PostgreSQL and SQL Server instances.
* Can be an IP address. Changing this forces a new resource to be created.
* @property instance The name of the Cloud SQL instance. Changing this
* forces a new resource to be created.
* @property name The name of the user. Changing this forces a new resource
* to be created.
* @property password The password for the user. Can be updated. For Postgres
* instances this is a Required field, unless type is set to either CLOUD_IAM_USER
* or CLOUD_IAM_SERVICE_ACCOUNT. Don't set this field for CLOUD_IAM_USER
* and CLOUD_IAM_SERVICE_ACCOUNT user types for any Cloud SQL instance.
* @property passwordPolicy
* @property project The ID of the project in which the resource belongs. If it
* is not provided, the provider project is used.
* @property type The user type. It determines the method to authenticate the
* user during login. The default is the database's built-in user type. Flags
* include "BUILT_IN", "CLOUD_IAM_USER", and "CLOUD_IAM_SERVICE_ACCOUNT" for both
* [Postgres](https://cloud.google.com/sql/docs/postgres/admin-api/rest/v1beta4/users#sqlusertype) and [MySQL](https://cloud.google.com/sql/docs/mysql/admin-api/rest/v1beta4/users#sqlusertype).
* MySQL also includes "CLOUD_IAM_GROUP", "CLOUD_IAM_GROUP_USER" and "CLOUD_IAM_GROUP_SERVICE_ACCOUNT".
*/
public data class UserArgs(
public val deletionPolicy: Output? = null,
public val host: Output? = null,
public val instance: Output? = null,
public val name: Output? = null,
public val password: Output? = null,
public val passwordPolicy: Output? = null,
public val project: Output? = null,
public val type: Output? = null,
) : ConvertibleToJava {
override fun toJava(): com.pulumi.gcp.sql.UserArgs = com.pulumi.gcp.sql.UserArgs.builder()
.deletionPolicy(deletionPolicy?.applyValue({ args0 -> args0 }))
.host(host?.applyValue({ args0 -> args0 }))
.instance(instance?.applyValue({ args0 -> args0 }))
.name(name?.applyValue({ args0 -> args0 }))
.password(password?.applyValue({ args0 -> args0 }))
.passwordPolicy(passwordPolicy?.applyValue({ args0 -> args0.let({ args0 -> args0.toJava() }) }))
.project(project?.applyValue({ args0 -> args0 }))
.type(type?.applyValue({ args0 -> args0 })).build()
}
/**
* Builder for [UserArgs].
*/
@PulumiTagMarker
public class UserArgsBuilder internal constructor() {
private var deletionPolicy: Output? = null
private var host: Output? = null
private var instance: Output? = null
private var name: Output? = null
private var password: Output? = null
private var passwordPolicy: Output? = null
private var project: Output? = null
private var type: Output? = null
/**
* @param value The deletion policy for the user.
* Setting `ABANDON` allows the resource to be abandoned rather than deleted. This is useful
* for Postgres, where users cannot be deleted from the API if they have been granted SQL roles.
* Possible values are: `ABANDON`.
* - - -
*/
@JvmName("jsuxxyqayomjupmu")
public suspend fun deletionPolicy(`value`: Output) {
this.deletionPolicy = value
}
/**
* @param value The host the user can connect from. This is only supported
* for BUILT_IN users in MySQL instances. Don't set this field for PostgreSQL and SQL Server instances.
* Can be an IP address. Changing this forces a new resource to be created.
*/
@JvmName("ylqoxlbqcmsnjqfq")
public suspend fun host(`value`: Output) {
this.host = value
}
/**
* @param value The name of the Cloud SQL instance. Changing this
* forces a new resource to be created.
*/
@JvmName("jogcebuoxmycodpa")
public suspend fun instance(`value`: Output) {
this.instance = value
}
/**
* @param value The name of the user. Changing this forces a new resource
* to be created.
*/
@JvmName("hfyibociaxheffxx")
public suspend fun name(`value`: Output) {
this.name = value
}
/**
* @param value The password for the user. Can be updated. For Postgres
* instances this is a Required field, unless type is set to either CLOUD_IAM_USER
* or CLOUD_IAM_SERVICE_ACCOUNT. Don't set this field for CLOUD_IAM_USER
* and CLOUD_IAM_SERVICE_ACCOUNT user types for any Cloud SQL instance.
*/
@JvmName("ganuncjbesnnkhcn")
public suspend fun password(`value`: Output) {
this.password = value
}
/**
* @param value
*/
@JvmName("ftiqvxpihhslsvrs")
public suspend fun passwordPolicy(`value`: Output) {
this.passwordPolicy = value
}
/**
* @param value The ID of the project in which the resource belongs. If it
* is not provided, the provider project is used.
*/
@JvmName("hyahgnamevsqsvfx")
public suspend fun project(`value`: Output) {
this.project = value
}
/**
* @param value The user type. It determines the method to authenticate the
* user during login. The default is the database's built-in user type. Flags
* include "BUILT_IN", "CLOUD_IAM_USER", and "CLOUD_IAM_SERVICE_ACCOUNT" for both
* [Postgres](https://cloud.google.com/sql/docs/postgres/admin-api/rest/v1beta4/users#sqlusertype) and [MySQL](https://cloud.google.com/sql/docs/mysql/admin-api/rest/v1beta4/users#sqlusertype).
* MySQL also includes "CLOUD_IAM_GROUP", "CLOUD_IAM_GROUP_USER" and "CLOUD_IAM_GROUP_SERVICE_ACCOUNT".
*/
@JvmName("pbkvqfbcpnydqgej")
public suspend fun type(`value`: Output) {
this.type = value
}
/**
* @param value The deletion policy for the user.
* Setting `ABANDON` allows the resource to be abandoned rather than deleted. This is useful
* for Postgres, where users cannot be deleted from the API if they have been granted SQL roles.
* Possible values are: `ABANDON`.
* - - -
*/
@JvmName("lobasvwtvqtiskgf")
public suspend fun deletionPolicy(`value`: String?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.deletionPolicy = mapped
}
/**
* @param value The host the user can connect from. This is only supported
* for BUILT_IN users in MySQL instances. Don't set this field for PostgreSQL and SQL Server instances.
* Can be an IP address. Changing this forces a new resource to be created.
*/
@JvmName("tmkytvjlyeifwkrd")
public suspend fun host(`value`: String?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.host = mapped
}
/**
* @param value The name of the Cloud SQL instance. Changing this
* forces a new resource to be created.
*/
@JvmName("shwlpbkpiwaqgnnh")
public suspend fun instance(`value`: String?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.instance = mapped
}
/**
* @param value The name of the user. Changing this forces a new resource
* to be created.
*/
@JvmName("cbsaubdsvioabsnf")
public suspend fun name(`value`: String?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.name = mapped
}
/**
* @param value The password for the user. Can be updated. For Postgres
* instances this is a Required field, unless type is set to either CLOUD_IAM_USER
* or CLOUD_IAM_SERVICE_ACCOUNT. Don't set this field for CLOUD_IAM_USER
* and CLOUD_IAM_SERVICE_ACCOUNT user types for any Cloud SQL instance.
*/
@JvmName("mynfwdeuwoqnteyv")
public suspend fun password(`value`: String?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.password = mapped
}
/**
* @param value
*/
@JvmName("oouysdrdaxoxhecr")
public suspend fun passwordPolicy(`value`: UserPasswordPolicyArgs?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.passwordPolicy = mapped
}
/**
* @param argument
*/
@JvmName("mrnimlsprwllpvxl")
public suspend fun passwordPolicy(argument: suspend UserPasswordPolicyArgsBuilder.() -> Unit) {
val toBeMapped = UserPasswordPolicyArgsBuilder().applySuspend { argument() }.build()
val mapped = of(toBeMapped)
this.passwordPolicy = mapped
}
/**
* @param value The ID of the project in which the resource belongs. If it
* is not provided, the provider project is used.
*/
@JvmName("jxmtixbbojdbobhk")
public suspend fun project(`value`: String?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.project = mapped
}
/**
* @param value The user type. It determines the method to authenticate the
* user during login. The default is the database's built-in user type. Flags
* include "BUILT_IN", "CLOUD_IAM_USER", and "CLOUD_IAM_SERVICE_ACCOUNT" for both
* [Postgres](https://cloud.google.com/sql/docs/postgres/admin-api/rest/v1beta4/users#sqlusertype) and [MySQL](https://cloud.google.com/sql/docs/mysql/admin-api/rest/v1beta4/users#sqlusertype).
* MySQL also includes "CLOUD_IAM_GROUP", "CLOUD_IAM_GROUP_USER" and "CLOUD_IAM_GROUP_SERVICE_ACCOUNT".
*/
@JvmName("kfciuiovpyovysrk")
public suspend fun type(`value`: String?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.type = mapped
}
internal fun build(): UserArgs = UserArgs(
deletionPolicy = deletionPolicy,
host = host,
instance = instance,
name = name,
password = password,
passwordPolicy = passwordPolicy,
project = project,
type = type,
)
}