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

com.pulumi.aws.kms.kotlin.AliasArgs.kt Maven / Gradle / Ivy

@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.aws.kms.kotlin

import com.pulumi.aws.kms.AliasArgs.builder
import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import kotlin.String
import kotlin.Suppress
import kotlin.jvm.JvmName

/**
 * Provides an alias for a KMS customer master key. AWS Console enforces 1-to-1 mapping between aliases & keys,
 * but API (hence this provider too) allows you to create as many aliases as
 * the [account limits](http://docs.aws.amazon.com/kms/latest/developerguide/limits.html) allow you.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as aws from "@pulumi/aws";
 * const a = new aws.kms.Key("a", {});
 * const aAlias = new aws.kms.Alias("a", {
 *     name: "alias/my-key-alias",
 *     targetKeyId: a.keyId,
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_aws as aws
 * a = aws.kms.Key("a")
 * a_alias = aws.kms.Alias("a",
 *     name="alias/my-key-alias",
 *     target_key_id=a.key_id)
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Aws = Pulumi.Aws;
 * return await Deployment.RunAsync(() =>
 * {
 *     var a = new Aws.Kms.Key("a");
 *     var aAlias = new Aws.Kms.Alias("a", new()
 *     {
 *         Name = "alias/my-key-alias",
 *         TargetKeyId = a.KeyId,
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/kms"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		a, err := kms.NewKey(ctx, "a", nil)
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = kms.NewAlias(ctx, "a", &kms.AliasArgs{
 * 			Name:        pulumi.String("alias/my-key-alias"),
 * 			TargetKeyId: a.KeyId,
 * 		})
 * 		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.kms.Key;
 * import com.pulumi.aws.kms.Alias;
 * import com.pulumi.aws.kms.AliasArgs;
 * 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 a = new Key("a");
 *         var aAlias = new Alias("aAlias", AliasArgs.builder()
 *             .name("alias/my-key-alias")
 *             .targetKeyId(a.keyId())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   a:
 *     type: aws:kms:Key
 *   aAlias:
 *     type: aws:kms:Alias
 *     name: a
 *     properties:
 *       name: alias/my-key-alias
 *       targetKeyId: ${a.keyId}
 * ```
 * 
 * ## Import
 * Using `pulumi import`, import KMS aliases using the `name`. For example:
 * ```sh
 * $ pulumi import aws:kms/alias:Alias a alias/my-key-alias
 * ```
 * @property name The display name of the alias. The name must start with the word "alias" followed by a forward slash (alias/)
 * @property namePrefix Creates an unique alias beginning with the specified prefix.
 * The name must start with the word "alias" followed by a forward slash (alias/).  Conflicts with `name`.
 * @property targetKeyId Identifier for the key for which the alias is for, can be either an ARN or key_id.
 */
public data class AliasArgs(
    public val name: Output? = null,
    public val namePrefix: Output? = null,
    public val targetKeyId: Output? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.aws.kms.AliasArgs = com.pulumi.aws.kms.AliasArgs.builder()
        .name(name?.applyValue({ args0 -> args0 }))
        .namePrefix(namePrefix?.applyValue({ args0 -> args0 }))
        .targetKeyId(targetKeyId?.applyValue({ args0 -> args0 })).build()
}

/**
 * Builder for [AliasArgs].
 */
@PulumiTagMarker
public class AliasArgsBuilder internal constructor() {
    private var name: Output? = null

    private var namePrefix: Output? = null

    private var targetKeyId: Output? = null

    /**
     * @param value The display name of the alias. The name must start with the word "alias" followed by a forward slash (alias/)
     */
    @JvmName("xfrtelrqxfluuqxq")
    public suspend fun name(`value`: Output) {
        this.name = value
    }

    /**
     * @param value Creates an unique alias beginning with the specified prefix.
     * The name must start with the word "alias" followed by a forward slash (alias/).  Conflicts with `name`.
     */
    @JvmName("bbtjbesqrcrbxdje")
    public suspend fun namePrefix(`value`: Output) {
        this.namePrefix = value
    }

    /**
     * @param value Identifier for the key for which the alias is for, can be either an ARN or key_id.
     */
    @JvmName("uljsgfgydcuxtvjb")
    public suspend fun targetKeyId(`value`: Output) {
        this.targetKeyId = value
    }

    /**
     * @param value The display name of the alias. The name must start with the word "alias" followed by a forward slash (alias/)
     */
    @JvmName("gheiuvmuufrwtsru")
    public suspend fun name(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.name = mapped
    }

    /**
     * @param value Creates an unique alias beginning with the specified prefix.
     * The name must start with the word "alias" followed by a forward slash (alias/).  Conflicts with `name`.
     */
    @JvmName("uicmntupooahcynr")
    public suspend fun namePrefix(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.namePrefix = mapped
    }

    /**
     * @param value Identifier for the key for which the alias is for, can be either an ARN or key_id.
     */
    @JvmName("ujjkcrttthwgeyva")
    public suspend fun targetKeyId(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.targetKeyId = mapped
    }

    internal fun build(): AliasArgs = AliasArgs(
        name = name,
        namePrefix = namePrefix,
        targetKeyId = targetKeyId,
    )
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy