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

com.pulumi.aws.cognito.kotlin.UserInGroup.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.cognito.kotlin

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.String
import kotlin.Suppress
import kotlin.Unit

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

    public var args: UserInGroupArgs = UserInGroupArgs()

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

/**
 * Adds the specified user to the specified group.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as aws from "@pulumi/aws";
 * const example = new aws.cognito.UserPool("example", {
 *     name: "example",
 *     passwordPolicy: {
 *         temporaryPasswordValidityDays: 7,
 *         minimumLength: 6,
 *         requireUppercase: false,
 *         requireSymbols: false,
 *         requireNumbers: false,
 *     },
 * });
 * const exampleUser = new aws.cognito.User("example", {
 *     userPoolId: example.id,
 *     username: "example",
 * });
 * const exampleUserGroup = new aws.cognito.UserGroup("example", {
 *     userPoolId: example.id,
 *     name: "example",
 * });
 * const exampleUserInGroup = new aws.cognito.UserInGroup("example", {
 *     userPoolId: example.id,
 *     groupName: exampleUserGroup.name,
 *     username: exampleUser.username,
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_aws as aws
 * example = aws.cognito.UserPool("example",
 *     name="example",
 *     password_policy={
 *         "temporary_password_validity_days": 7,
 *         "minimum_length": 6,
 *         "require_uppercase": False,
 *         "require_symbols": False,
 *         "require_numbers": False,
 *     })
 * example_user = aws.cognito.User("example",
 *     user_pool_id=example.id,
 *     username="example")
 * example_user_group = aws.cognito.UserGroup("example",
 *     user_pool_id=example.id,
 *     name="example")
 * example_user_in_group = aws.cognito.UserInGroup("example",
 *     user_pool_id=example.id,
 *     group_name=example_user_group.name,
 *     username=example_user.username)
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Aws = Pulumi.Aws;
 * return await Deployment.RunAsync(() =>
 * {
 *     var example = new Aws.Cognito.UserPool("example", new()
 *     {
 *         Name = "example",
 *         PasswordPolicy = new Aws.Cognito.Inputs.UserPoolPasswordPolicyArgs
 *         {
 *             TemporaryPasswordValidityDays = 7,
 *             MinimumLength = 6,
 *             RequireUppercase = false,
 *             RequireSymbols = false,
 *             RequireNumbers = false,
 *         },
 *     });
 *     var exampleUser = new Aws.Cognito.User("example", new()
 *     {
 *         UserPoolId = example.Id,
 *         Username = "example",
 *     });
 *     var exampleUserGroup = new Aws.Cognito.UserGroup("example", new()
 *     {
 *         UserPoolId = example.Id,
 *         Name = "example",
 *     });
 *     var exampleUserInGroup = new Aws.Cognito.UserInGroup("example", new()
 *     {
 *         UserPoolId = example.Id,
 *         GroupName = exampleUserGroup.Name,
 *         Username = exampleUser.Username,
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/cognito"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		example, err := cognito.NewUserPool(ctx, "example", &cognito.UserPoolArgs{
 * 			Name: pulumi.String("example"),
 * 			PasswordPolicy: &cognito.UserPoolPasswordPolicyArgs{
 * 				TemporaryPasswordValidityDays: pulumi.Int(7),
 * 				MinimumLength:                 pulumi.Int(6),
 * 				RequireUppercase:              pulumi.Bool(false),
 * 				RequireSymbols:                pulumi.Bool(false),
 * 				RequireNumbers:                pulumi.Bool(false),
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleUser, err := cognito.NewUser(ctx, "example", &cognito.UserArgs{
 * 			UserPoolId: example.ID(),
 * 			Username:   pulumi.String("example"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleUserGroup, err := cognito.NewUserGroup(ctx, "example", &cognito.UserGroupArgs{
 * 			UserPoolId: example.ID(),
 * 			Name:       pulumi.String("example"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = cognito.NewUserInGroup(ctx, "example", &cognito.UserInGroupArgs{
 * 			UserPoolId: example.ID(),
 * 			GroupName:  exampleUserGroup.Name,
 * 			Username:   exampleUser.Username,
 * 		})
 * 		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.cognito.UserPool;
 * import com.pulumi.aws.cognito.UserPoolArgs;
 * import com.pulumi.aws.cognito.inputs.UserPoolPasswordPolicyArgs;
 * import com.pulumi.aws.cognito.User;
 * import com.pulumi.aws.cognito.UserArgs;
 * import com.pulumi.aws.cognito.UserGroup;
 * import com.pulumi.aws.cognito.UserGroupArgs;
 * import com.pulumi.aws.cognito.UserInGroup;
 * import com.pulumi.aws.cognito.UserInGroupArgs;
 * 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 example = new UserPool("example", UserPoolArgs.builder()
 *             .name("example")
 *             .passwordPolicy(UserPoolPasswordPolicyArgs.builder()
 *                 .temporaryPasswordValidityDays(7)
 *                 .minimumLength(6)
 *                 .requireUppercase(false)
 *                 .requireSymbols(false)
 *                 .requireNumbers(false)
 *                 .build())
 *             .build());
 *         var exampleUser = new User("exampleUser", UserArgs.builder()
 *             .userPoolId(example.id())
 *             .username("example")
 *             .build());
 *         var exampleUserGroup = new UserGroup("exampleUserGroup", UserGroupArgs.builder()
 *             .userPoolId(example.id())
 *             .name("example")
 *             .build());
 *         var exampleUserInGroup = new UserInGroup("exampleUserInGroup", UserInGroupArgs.builder()
 *             .userPoolId(example.id())
 *             .groupName(exampleUserGroup.name())
 *             .username(exampleUser.username())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: aws:cognito:UserPool
 *     properties:
 *       name: example
 *       passwordPolicy:
 *         temporaryPasswordValidityDays: 7
 *         minimumLength: 6
 *         requireUppercase: false
 *         requireSymbols: false
 *         requireNumbers: false
 *   exampleUser:
 *     type: aws:cognito:User
 *     name: example
 *     properties:
 *       userPoolId: ${example.id}
 *       username: example
 *   exampleUserGroup:
 *     type: aws:cognito:UserGroup
 *     name: example
 *     properties:
 *       userPoolId: ${example.id}
 *       name: example
 *   exampleUserInGroup:
 *     type: aws:cognito:UserInGroup
 *     name: example
 *     properties:
 *       userPoolId: ${example.id}
 *       groupName: ${exampleUserGroup.name}
 *       username: ${exampleUser.username}
 * ```
 * 
 */
public class UserInGroup internal constructor(
    override val javaResource: com.pulumi.aws.cognito.UserInGroup,
) : KotlinCustomResource(javaResource, UserInGroupMapper) {
    /**
     * The name of the group to which the user is to be added.
     */
    public val groupName: Output
        get() = javaResource.groupName().applyValue({ args0 -> args0 })

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

    /**
     * The username of the user to be added to the group.
     */
    public val username: Output
        get() = javaResource.username().applyValue({ args0 -> args0 })
}

public object UserInGroupMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.aws.cognito.UserInGroup::class == javaResource::class

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy