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

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

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

package com.pulumi.aws.kms.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 [CustomKeyStore].
 */
@PulumiTagMarker
public class CustomKeyStoreResourceBuilder internal constructor() {
    public var name: String? = null

    public var args: CustomKeyStoreArgs = CustomKeyStoreArgs()

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

/**
 * Resource for managing an AWS KMS (Key Management) Custom Key Store.
 * ## Example Usage
 * ### Basic Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as aws from "@pulumi/aws";
 * import * as std from "@pulumi/std";
 * const test = new aws.kms.CustomKeyStore("test", {
 *     cloudHsmClusterId: cloudHsmClusterId,
 *     customKeyStoreName: "kms-custom-key-store-test",
 *     keyStorePassword: "noplaintextpasswords1",
 *     trustAnchorCertificate: std.file({
 *         input: "anchor-certificate.crt",
 *     }).then(invoke => invoke.result),
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_aws as aws
 * import pulumi_std as std
 * test = aws.kms.CustomKeyStore("test",
 *     cloud_hsm_cluster_id=cloud_hsm_cluster_id,
 *     custom_key_store_name="kms-custom-key-store-test",
 *     key_store_password="noplaintextpasswords1",
 *     trust_anchor_certificate=std.file(input="anchor-certificate.crt").result)
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Aws = Pulumi.Aws;
 * using Std = Pulumi.Std;
 * return await Deployment.RunAsync(() =>
 * {
 *     var test = new Aws.Kms.CustomKeyStore("test", new()
 *     {
 *         CloudHsmClusterId = cloudHsmClusterId,
 *         CustomKeyStoreName = "kms-custom-key-store-test",
 *         KeyStorePassword = "noplaintextpasswords1",
 *         TrustAnchorCertificate = Std.File.Invoke(new()
 *         {
 *             Input = "anchor-certificate.crt",
 *         }).Apply(invoke => invoke.Result),
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/kms"
 * 	"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 {
 * 		invokeFile, err := std.File(ctx, &std.FileArgs{
 * 			Input: "anchor-certificate.crt",
 * 		}, nil)
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = kms.NewCustomKeyStore(ctx, "test", &kms.CustomKeyStoreArgs{
 * 			CloudHsmClusterId:      pulumi.Any(cloudHsmClusterId),
 * 			CustomKeyStoreName:     pulumi.String("kms-custom-key-store-test"),
 * 			KeyStorePassword:       pulumi.String("noplaintextpasswords1"),
 * 			TrustAnchorCertificate: pulumi.String(invokeFile.Result),
 * 		})
 * 		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.CustomKeyStore;
 * import com.pulumi.aws.kms.CustomKeyStoreArgs;
 * 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 CustomKeyStore("test", CustomKeyStoreArgs.builder()
 *             .cloudHsmClusterId(cloudHsmClusterId)
 *             .customKeyStoreName("kms-custom-key-store-test")
 *             .keyStorePassword("noplaintextpasswords1")
 *             .trustAnchorCertificate(StdFunctions.file(FileArgs.builder()
 *                 .input("anchor-certificate.crt")
 *                 .build()).result())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   test:
 *     type: aws:kms:CustomKeyStore
 *     properties:
 *       cloudHsmClusterId: ${cloudHsmClusterId}
 *       customKeyStoreName: kms-custom-key-store-test
 *       keyStorePassword: noplaintextpasswords1
 *       trustAnchorCertificate:
 *         fn::invoke:
 *           Function: std:file
 *           Arguments:
 *             input: anchor-certificate.crt
 *           Return: result
 * ```
 * 
 * ## Import
 * Using `pulumi import`, import KMS (Key Management) Custom Key Store using the `id`. For example:
 * ```sh
 * $ pulumi import aws:kms/customKeyStore:CustomKeyStore example cks-5ebd4ef395a96288e
 * ```
 */
public class CustomKeyStore internal constructor(
    override val javaResource: com.pulumi.aws.kms.CustomKeyStore,
) : KotlinCustomResource(javaResource, CustomKeyStoreMapper) {
    /**
     * Cluster ID of CloudHSM.
     */
    public val cloudHsmClusterId: Output
        get() = javaResource.cloudHsmClusterId().applyValue({ args0 -> args0 })

    /**
     * Unique name for Custom Key Store.
     */
    public val customKeyStoreName: Output
        get() = javaResource.customKeyStoreName().applyValue({ args0 -> args0 })

    /**
     * Password for `kmsuser` on CloudHSM.
     */
    public val keyStorePassword: Output
        get() = javaResource.keyStorePassword().applyValue({ args0 -> args0 })

    /**
     * Customer certificate used for signing on CloudHSM.
     */
    public val trustAnchorCertificate: Output
        get() = javaResource.trustAnchorCertificate().applyValue({ args0 -> args0 })
}

public object CustomKeyStoreMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.aws.kms.CustomKeyStore::class == javaResource::class

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy