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

com.pulumi.gcp.kms.kotlin.KeyRing.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: 8.10.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

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

    public var args: KeyRingArgs = KeyRingArgs()

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

/**
 * A `KeyRing` is a toplevel logical grouping of `CryptoKeys`.
 * > **Note:** KeyRings cannot be deleted from Google Cloud Platform.
 * Destroying a provider-managed KeyRing will remove it from state but
 * *will not delete the resource from the project.*
 * To get more information about KeyRing, see:
 * * [API documentation](https://cloud.google.com/kms/docs/reference/rest/v1/projects.locations.keyRings)
 * * How-to Guides
 *     * [Creating a key ring](https://cloud.google.com/kms/docs/creating-keys#create_a_key_ring)
 * ## Example Usage
 * ### Kms Key Ring Basic
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const example_keyring = new gcp.kms.KeyRing("example-keyring", {
 *     name: "keyring-example",
 *     location: "global",
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * example_keyring = gcp.kms.KeyRing("example-keyring",
 *     name="keyring-example",
 *     location="global")
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var example_keyring = new Gcp.Kms.KeyRing("example-keyring", new()
 *     {
 *         Name = "keyring-example",
 *         Location = "global",
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/kms"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := kms.NewKeyRing(ctx, "example-keyring", &kms.KeyRingArgs{
 * 			Name:     pulumi.String("keyring-example"),
 * 			Location: pulumi.String("global"),
 * 		})
 * 		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 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_keyring = new KeyRing("example-keyring", KeyRingArgs.builder()
 *             .name("keyring-example")
 *             .location("global")
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example-keyring:
 *     type: gcp:kms:KeyRing
 *     properties:
 *       name: keyring-example
 *       location: global
 * ```
 * 
 * ## Import
 * KeyRing can be imported using any of these accepted formats:
 * * `projects/{{project}}/locations/{{location}}/keyRings/{{name}}`
 * * `{{project}}/{{location}}/{{name}}`
 * * `{{location}}/{{name}}`
 * When using the `pulumi import` command, KeyRing can be imported using one of the formats above. For example:
 * ```sh
 * $ pulumi import gcp:kms/keyRing:KeyRing default projects/{{project}}/locations/{{location}}/keyRings/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:kms/keyRing:KeyRing default {{project}}/{{location}}/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:kms/keyRing:KeyRing default {{location}}/{{name}}
 * ```
 */
public class KeyRing internal constructor(
    override val javaResource: com.pulumi.gcp.kms.KeyRing,
) : KotlinCustomResource(javaResource, KeyRingMapper) {
    /**
     * The location for the KeyRing.
     * A full list of valid locations can be found by running `gcloud kms locations list`.
     * - - -
     */
    public val location: Output
        get() = javaResource.location().applyValue({ args0 -> args0 })

    /**
     * The resource name for the KeyRing.
     */
    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 })
}

public object KeyRingMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.gcp.kms.KeyRing::class == javaResource::class

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy