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

com.pulumi.aws.elasticache.kotlin.User.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: 6.57.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.aws.elasticache.kotlin

import com.pulumi.aws.elasticache.kotlin.outputs.UserAuthenticationMode
import com.pulumi.aws.elasticache.kotlin.outputs.UserAuthenticationMode.Companion.toKotlin
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.Deprecated
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.collections.Map

/**
 * Builder for [User].
 */
@PulumiTagMarker
public class UserResourceBuilder internal constructor() {
    public var name: String? = null

    public var args: UserArgs = UserArgs()

    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 UserArgsBuilder.() -> Unit) {
        val builder = UserArgsBuilder()
        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(): User {
        val builtJavaResource = com.pulumi.aws.elasticache.User(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return User(builtJavaResource)
    }
}

/**
 * Provides an ElastiCache user resource.
 * > **Note:** All arguments including the username and passwords will be stored in the raw state as plain-text.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as aws from "@pulumi/aws";
 * const test = new aws.elasticache.User("test", {
 *     userId: "testUserId",
 *     userName: "testUserName",
 *     accessString: "on ~app::* -@all +@read +@hash +@bitmap +@geo -setbit -bitfield -hset -hsetnx -hmset -hincrby -hincrbyfloat -hdel -bitop -geoadd -georadius -georadiusbymember",
 *     engine: "REDIS",
 *     passwords: ["password123456789"],
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_aws as aws
 * test = aws.elasticache.User("test",
 *     user_id="testUserId",
 *     user_name="testUserName",
 *     access_string="on ~app::* -@all +@read +@hash +@bitmap +@geo -setbit -bitfield -hset -hsetnx -hmset -hincrby -hincrbyfloat -hdel -bitop -geoadd -georadius -georadiusbymember",
 *     engine="REDIS",
 *     passwords=["password123456789"])
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Aws = Pulumi.Aws;
 * return await Deployment.RunAsync(() =>
 * {
 *     var test = new Aws.ElastiCache.User("test", new()
 *     {
 *         UserId = "testUserId",
 *         UserName = "testUserName",
 *         AccessString = "on ~app::* -@all +@read +@hash +@bitmap +@geo -setbit -bitfield -hset -hsetnx -hmset -hincrby -hincrbyfloat -hdel -bitop -geoadd -georadius -georadiusbymember",
 *         Engine = "REDIS",
 *         Passwords = new[]
 *         {
 *             "password123456789",
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/elasticache"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := elasticache.NewUser(ctx, "test", &elasticache.UserArgs{
 * 			UserId:       pulumi.String("testUserId"),
 * 			UserName:     pulumi.String("testUserName"),
 * 			AccessString: pulumi.String("on ~app::* -@all +@read +@hash +@bitmap +@geo -setbit -bitfield -hset -hsetnx -hmset -hincrby -hincrbyfloat -hdel -bitop -geoadd -georadius -georadiusbymember"),
 * 			Engine:       pulumi.String("REDIS"),
 * 			Passwords: pulumi.StringArray{
 * 				pulumi.String("password123456789"),
 * 			},
 * 		})
 * 		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.aws.elasticache.User;
 * import com.pulumi.aws.elasticache.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 test = new User("test", UserArgs.builder()
 *             .userId("testUserId")
 *             .userName("testUserName")
 *             .accessString("on ~app::* -@all +@read +@hash +@bitmap +@geo -setbit -bitfield -hset -hsetnx -hmset -hincrby -hincrbyfloat -hdel -bitop -geoadd -georadius -georadiusbymember")
 *             .engine("REDIS")
 *             .passwords("password123456789")
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   test:
 *     type: aws:elasticache:User
 *     properties:
 *       userId: testUserId
 *       userName: testUserName
 *       accessString: on ~app::* -@all +@read +@hash +@bitmap +@geo -setbit -bitfield -hset -hsetnx -hmset -hincrby -hincrbyfloat -hdel -bitop -geoadd -georadius -georadiusbymember
 *       engine: REDIS
 *       passwords:
 *         - password123456789
 * ```
 * 
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as aws from "@pulumi/aws";
 * const test = new aws.elasticache.User("test", {
 *     userId: "testUserId",
 *     userName: "testUserName",
 *     accessString: "on ~* +@all",
 *     engine: "REDIS",
 *     authenticationMode: {
 *         type: "iam",
 *     },
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_aws as aws
 * test = aws.elasticache.User("test",
 *     user_id="testUserId",
 *     user_name="testUserName",
 *     access_string="on ~* +@all",
 *     engine="REDIS",
 *     authentication_mode={
 *         "type": "iam",
 *     })
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Aws = Pulumi.Aws;
 * return await Deployment.RunAsync(() =>
 * {
 *     var test = new Aws.ElastiCache.User("test", new()
 *     {
 *         UserId = "testUserId",
 *         UserName = "testUserName",
 *         AccessString = "on ~* +@all",
 *         Engine = "REDIS",
 *         AuthenticationMode = new Aws.ElastiCache.Inputs.UserAuthenticationModeArgs
 *         {
 *             Type = "iam",
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/elasticache"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := elasticache.NewUser(ctx, "test", &elasticache.UserArgs{
 * 			UserId:       pulumi.String("testUserId"),
 * 			UserName:     pulumi.String("testUserName"),
 * 			AccessString: pulumi.String("on ~* +@all"),
 * 			Engine:       pulumi.String("REDIS"),
 * 			AuthenticationMode: &elasticache.UserAuthenticationModeArgs{
 * 				Type: pulumi.String("iam"),
 * 			},
 * 		})
 * 		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.aws.elasticache.User;
 * import com.pulumi.aws.elasticache.UserArgs;
 * import com.pulumi.aws.elasticache.inputs.UserAuthenticationModeArgs;
 * 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 test = new User("test", UserArgs.builder()
 *             .userId("testUserId")
 *             .userName("testUserName")
 *             .accessString("on ~* +@all")
 *             .engine("REDIS")
 *             .authenticationMode(UserAuthenticationModeArgs.builder()
 *                 .type("iam")
 *                 .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   test:
 *     type: aws:elasticache:User
 *     properties:
 *       userId: testUserId
 *       userName: testUserName
 *       accessString: on ~* +@all
 *       engine: REDIS
 *       authenticationMode:
 *         type: iam
 * ```
 * 
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as aws from "@pulumi/aws";
 * const test = new aws.elasticache.User("test", {
 *     userId: "testUserId",
 *     userName: "testUserName",
 *     accessString: "on ~* +@all",
 *     engine: "REDIS",
 *     authenticationMode: {
 *         type: "password",
 *         passwords: [
 *             "password1",
 *             "password2",
 *         ],
 *     },
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_aws as aws
 * test = aws.elasticache.User("test",
 *     user_id="testUserId",
 *     user_name="testUserName",
 *     access_string="on ~* +@all",
 *     engine="REDIS",
 *     authentication_mode={
 *         "type": "password",
 *         "passwords": [
 *             "password1",
 *             "password2",
 *         ],
 *     })
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Aws = Pulumi.Aws;
 * return await Deployment.RunAsync(() =>
 * {
 *     var test = new Aws.ElastiCache.User("test", new()
 *     {
 *         UserId = "testUserId",
 *         UserName = "testUserName",
 *         AccessString = "on ~* +@all",
 *         Engine = "REDIS",
 *         AuthenticationMode = new Aws.ElastiCache.Inputs.UserAuthenticationModeArgs
 *         {
 *             Type = "password",
 *             Passwords = new[]
 *             {
 *                 "password1",
 *                 "password2",
 *             },
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/elasticache"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := elasticache.NewUser(ctx, "test", &elasticache.UserArgs{
 * 			UserId:       pulumi.String("testUserId"),
 * 			UserName:     pulumi.String("testUserName"),
 * 			AccessString: pulumi.String("on ~* +@all"),
 * 			Engine:       pulumi.String("REDIS"),
 * 			AuthenticationMode: &elasticache.UserAuthenticationModeArgs{
 * 				Type: pulumi.String("password"),
 * 				Passwords: pulumi.StringArray{
 * 					pulumi.String("password1"),
 * 					pulumi.String("password2"),
 * 				},
 * 			},
 * 		})
 * 		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.aws.elasticache.User;
 * import com.pulumi.aws.elasticache.UserArgs;
 * import com.pulumi.aws.elasticache.inputs.UserAuthenticationModeArgs;
 * 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 test = new User("test", UserArgs.builder()
 *             .userId("testUserId")
 *             .userName("testUserName")
 *             .accessString("on ~* +@all")
 *             .engine("REDIS")
 *             .authenticationMode(UserAuthenticationModeArgs.builder()
 *                 .type("password")
 *                 .passwords(
 *                     "password1",
 *                     "password2")
 *                 .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   test:
 *     type: aws:elasticache:User
 *     properties:
 *       userId: testUserId
 *       userName: testUserName
 *       accessString: on ~* +@all
 *       engine: REDIS
 *       authenticationMode:
 *         type: password
 *         passwords:
 *           - password1
 *           - password2
 * ```
 * 
 * ## Import
 * Using `pulumi import`, import ElastiCache users using the `user_id`. For example:
 * ```sh
 * $ pulumi import aws:elasticache/user:User my_user userId1
 * ```
 */
public class User internal constructor(
    override val javaResource: com.pulumi.aws.elasticache.User,
) : KotlinCustomResource(javaResource, UserMapper) {
    /**
     * Access permissions string used for this user. See [Specifying Permissions Using an Access String](https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/Clusters.RBAC.html#Access-string) for more details.
     */
    public val accessString: Output
        get() = javaResource.accessString().applyValue({ args0 -> args0 })

    /**
     * The ARN of the created ElastiCache User.
     */
    public val arn: Output
        get() = javaResource.arn().applyValue({ args0 -> args0 })

    /**
     * Denotes the user's authentication properties. Detailed below.
     */
    public val authenticationMode: Output
        get() = javaResource.authenticationMode().applyValue({ args0 ->
            args0.let({ args0 ->
                toKotlin(args0)
            })
        })

    /**
     * The current supported value is `REDIS`.
     */
    public val engine: Output
        get() = javaResource.engine().applyValue({ args0 -> args0 })

    /**
     * Indicates a password is not required for this user.
     */
    public val noPasswordRequired: Output?
        get() = javaResource.noPasswordRequired().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Passwords used for this user. You can create up to two passwords for each user.
     */
    public val passwords: Output>?
        get() = javaResource.passwords().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0
                })
            }).orElse(null)
        })

    /**
     * A list of tags to be added to this resource. A tag is a key-value pair.
     */
    public val tags: Output>?
        get() = javaResource.tags().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.key.to(args0.value)
                }).toMap()
            }).orElse(null)
        })

    @Deprecated(
        message = """
  Please use `tags` instead.
  """,
    )
    public val tagsAll: Output>
        get() = javaResource.tagsAll().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.key.to(args0.value)
            }).toMap()
        })

    /**
     * The ID of the user.
     */
    public val userId: Output
        get() = javaResource.userId().applyValue({ args0 -> args0 })

    /**
     * The username of the user.
     * The following arguments are optional:
     */
    public val userName: Output
        get() = javaResource.userName().applyValue({ args0 -> args0 })
}

public object UserMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.aws.elasticache.User::class == javaResource::class

    override fun map(javaResource: Resource): User = User(
        javaResource as
            com.pulumi.aws.elasticache.User,
    )
}

/**
 * @see [User].
 * @param name The _unique_ name of the resulting resource.
 * @param block Builder for [User].
 */
public suspend fun user(name: String, block: suspend UserResourceBuilder.() -> Unit): User {
    val builder = UserResourceBuilder()
    builder.name(name)
    block(builder)
    return builder.build()
}

/**
 * @see [User].
 * @param name The _unique_ name of the resulting resource.
 */
public fun user(name: String): User {
    val builder = UserResourceBuilder()
    builder.name(name)
    return builder.build()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy