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

com.pulumi.gcp.netapp.kotlin.Kmsconfig.kt Maven / Gradle / Ivy

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

package com.pulumi.gcp.netapp.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
import kotlin.collections.Map

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

    public var args: KmsconfigArgs = KmsconfigArgs()

    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 KmsconfigArgsBuilder.() -> Unit) {
        val builder = KmsconfigArgsBuilder()
        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(): Kmsconfig {
        val builtJavaResource = com.pulumi.gcp.netapp.Kmsconfig(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return Kmsconfig(builtJavaResource)
    }
}

/**
 * NetApp Volumes always encrypts your data at rest using volume-specific keys.
 * A CMEK policy (customer-managed encryption key) warps such volume-specific keys in a key stored in Cloud Key Management Service (KMS).
 * To get more information about kmsconfig, see:
 * * [API documentation](https://cloud.google.com/netapp/volumes/docs/reference/rest/v1/projects.locations.kmsConfigs)
 * * How-to Guides
 *     * [Documentation](https://cloud.google.com/netapp/volumes/docs/configure-and-use/cmek/cmek-overview)
 * ## Example Usage
 * ### Kms Config Create
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const keyring = new gcp.kms.KeyRing("keyring", {
 *     name: "key-ring",
 *     location: "us-central1",
 * });
 * const cryptoKey = new gcp.kms.CryptoKey("crypto_key", {
 *     name: "crypto-name",
 *     keyRing: keyring.id,
 * });
 * const kmsConfig = new gcp.netapp.Kmsconfig("kmsConfig", {
 *     name: "kms-test",
 *     description: "this is a test description",
 *     cryptoKeyName: cryptoKey.id,
 *     location: "us-central1",
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * keyring = gcp.kms.KeyRing("keyring",
 *     name="key-ring",
 *     location="us-central1")
 * crypto_key = gcp.kms.CryptoKey("crypto_key",
 *     name="crypto-name",
 *     key_ring=keyring.id)
 * kms_config = gcp.netapp.Kmsconfig("kmsConfig",
 *     name="kms-test",
 *     description="this is a test description",
 *     crypto_key_name=crypto_key.id,
 *     location="us-central1")
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var keyring = new Gcp.Kms.KeyRing("keyring", new()
 *     {
 *         Name = "key-ring",
 *         Location = "us-central1",
 *     });
 *     var cryptoKey = new Gcp.Kms.CryptoKey("crypto_key", new()
 *     {
 *         Name = "crypto-name",
 *         KeyRing = keyring.Id,
 *     });
 *     var kmsConfig = new Gcp.Netapp.Kmsconfig("kmsConfig", new()
 *     {
 *         Name = "kms-test",
 *         Description = "this is a test description",
 *         CryptoKeyName = cryptoKey.Id,
 *         Location = "us-central1",
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/kms"
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/netapp"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		keyring, err := kms.NewKeyRing(ctx, "keyring", &kms.KeyRingArgs{
 * 			Name:     pulumi.String("key-ring"),
 * 			Location: pulumi.String("us-central1"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		cryptoKey, err := kms.NewCryptoKey(ctx, "crypto_key", &kms.CryptoKeyArgs{
 * 			Name:    pulumi.String("crypto-name"),
 * 			KeyRing: keyring.ID(),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = netapp.NewKmsconfig(ctx, "kmsConfig", &netapp.KmsconfigArgs{
 * 			Name:          pulumi.String("kms-test"),
 * 			Description:   pulumi.String("this is a test description"),
 * 			CryptoKeyName: cryptoKey.ID(),
 * 			Location:      pulumi.String("us-central1"),
 * 		})
 * 		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.gcp.kms.KeyRing;
 * import com.pulumi.gcp.kms.KeyRingArgs;
 * import com.pulumi.gcp.kms.CryptoKey;
 * import com.pulumi.gcp.kms.CryptoKeyArgs;
 * import com.pulumi.gcp.netapp.Kmsconfig;
 * import com.pulumi.gcp.netapp.KmsconfigArgs;
 * 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 keyring = new KeyRing("keyring", KeyRingArgs.builder()
 *             .name("key-ring")
 *             .location("us-central1")
 *             .build());
 *         var cryptoKey = new CryptoKey("cryptoKey", CryptoKeyArgs.builder()
 *             .name("crypto-name")
 *             .keyRing(keyring.id())
 *             .build());
 *         var kmsConfig = new Kmsconfig("kmsConfig", KmsconfigArgs.builder()
 *             .name("kms-test")
 *             .description("this is a test description")
 *             .cryptoKeyName(cryptoKey.id())
 *             .location("us-central1")
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   keyring:
 *     type: gcp:kms:KeyRing
 *     properties:
 *       name: key-ring
 *       location: us-central1
 *   cryptoKey:
 *     type: gcp:kms:CryptoKey
 *     name: crypto_key
 *     properties:
 *       name: crypto-name
 *       keyRing: ${keyring.id}
 *   kmsConfig:
 *     type: gcp:netapp:Kmsconfig
 *     properties:
 *       name: kms-test
 *       description: this is a test description
 *       cryptoKeyName: ${cryptoKey.id}
 *       location: us-central1
 * ```
 * 
 * ## Import
 * kmsconfig can be imported using any of these accepted formats:
 * * `projects/{{project}}/locations/{{location}}/kmsConfigs/{{name}}`
 * * `{{project}}/{{location}}/{{name}}`
 * * `{{location}}/{{name}}`
 * When using the `pulumi import` command, kmsconfig can be imported using one of the formats above. For example:
 * ```sh
 * $ pulumi import gcp:netapp/kmsconfig:Kmsconfig default projects/{{project}}/locations/{{location}}/kmsConfigs/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:netapp/kmsconfig:Kmsconfig default {{project}}/{{location}}/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:netapp/kmsconfig:Kmsconfig default {{location}}/{{name}}
 * ```
 */
public class Kmsconfig internal constructor(
    override val javaResource: com.pulumi.gcp.netapp.Kmsconfig,
) : KotlinCustomResource(javaResource, KmsconfigMapper) {
    /**
     * Resource name of the KMS key to use. Only regional keys are supported. Format: `projects/{{project}}/locations/{{location}}/keyRings/{{key_ring}}/cryptoKeys/{{key}}`.
     */
    public val cryptoKeyName: Output
        get() = javaResource.cryptoKeyName().applyValue({ args0 -> args0 })

    /**
     * Description for the CMEK policy.
     */
    public val description: Output?
        get() = javaResource.description().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services.
     */
    public val effectiveLabels: Output>
        get() = javaResource.effectiveLabels().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.key.to(args0.value)
            }).toMap()
        })

    /**
     * Access to the key needs to be granted. The instructions contain gcloud commands to run to grant access.
     * To make the policy work, a CMEK policy check is required, which verifies key access.
     */
    public val instructions: Output
        get() = javaResource.instructions().applyValue({ args0 -> args0 })

    /**
     * Labels as key value pairs. Example: `{ "owner": "Bob", "department": "finance", "purpose": "testing" }`.
     * **Note**: This field is non-authoritative, and will only manage the labels present in your configuration.
     * Please refer to the field `effective_labels` for all of the labels present on the resource.
     */
    public val labels: Output>?
        get() = javaResource.labels().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.key.to(args0.value)
                }).toMap()
            }).orElse(null)
        })

    /**
     * Name of the policy location. CMEK policies apply to the whole region.
     */
    public val location: Output
        get() = javaResource.location().applyValue({ args0 -> args0 })

    /**
     * Name of the CMEK policy.
     * - - -
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * The ID of the project in which the resource belongs.
     * If it is not provided, the provider project is used.
     */
    public val project: Output
        get() = javaResource.project().applyValue({ args0 -> args0 })

    /**
     * The combination of labels configured directly on the resource
     * and default labels configured on the provider.
     */
    public val pulumiLabels: Output>
        get() = javaResource.pulumiLabels().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.key.to(args0.value)
            }).toMap()
        })

    /**
     * The Service account which needs to have access to the  provided KMS key.
     */
    public val serviceAccount: Output
        get() = javaResource.serviceAccount().applyValue({ args0 -> args0 })
}

public object KmsconfigMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.gcp.netapp.Kmsconfig::class == javaResource::class

    override fun map(javaResource: Resource): Kmsconfig = Kmsconfig(
        javaResource as
            com.pulumi.gcp.netapp.Kmsconfig,
    )
}

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy