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

com.pulumi.gcp.kms.kotlin.EkmConnection.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.gcp.kms.kotlin.outputs.EkmConnectionServiceResolver
import com.pulumi.gcp.kms.kotlin.outputs.EkmConnectionServiceResolver.Companion.toKotlin
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.List

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

    public var args: EkmConnectionArgs = EkmConnectionArgs()

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

/**
 * `Ekm Connections` are used to control the connection settings for an `EXTERNAL_VPC` CryptoKey.
 * It is used to connect customer's external key manager to Google Cloud EKM.
 * > **Note:** Ekm Connections cannot be deleted from Google Cloud Platform.
 * To get more information about EkmConnection, see:
 * * [API documentation](https://cloud.google.com/kms/docs/reference/rest/v1/projects.locations.ekmConnections)
 * * How-to Guides
 *     * [Creating a Ekm Connection](https://cloud.google.com/kms/docs/create-ekm-connection)
 * ## Example Usage
 * ### Kms Ekm Connection Basic
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const example_ekmconnection = new gcp.kms.EkmConnection("example-ekmconnection", {
 *     name: "ekmconnection_example",
 *     location: "us-central1",
 *     keyManagementMode: "MANUAL",
 *     serviceResolvers: [{
 *         serviceDirectoryService: "projects/project_id/locations/us-central1/namespaces/namespace_name/services/service_name",
 *         hostname: "example-ekm.goog",
 *         serverCertificates: [{
 *             rawDer: "==HAwIBCCAr6gAwIBAgIUWR+EV4lqiV7Ql12VY==",
 *         }],
 *     }],
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * example_ekmconnection = gcp.kms.EkmConnection("example-ekmconnection",
 *     name="ekmconnection_example",
 *     location="us-central1",
 *     key_management_mode="MANUAL",
 *     service_resolvers=[gcp.kms.EkmConnectionServiceResolverArgs(
 *         service_directory_service="projects/project_id/locations/us-central1/namespaces/namespace_name/services/service_name",
 *         hostname="example-ekm.goog",
 *         server_certificates=[gcp.kms.EkmConnectionServiceResolverServerCertificateArgs(
 *             raw_der="==HAwIBCCAr6gAwIBAgIUWR+EV4lqiV7Ql12VY==",
 *         )],
 *     )])
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var example_ekmconnection = new Gcp.Kms.EkmConnection("example-ekmconnection", new()
 *     {
 *         Name = "ekmconnection_example",
 *         Location = "us-central1",
 *         KeyManagementMode = "MANUAL",
 *         ServiceResolvers = new[]
 *         {
 *             new Gcp.Kms.Inputs.EkmConnectionServiceResolverArgs
 *             {
 *                 ServiceDirectoryService = "projects/project_id/locations/us-central1/namespaces/namespace_name/services/service_name",
 *                 Hostname = "example-ekm.goog",
 *                 ServerCertificates = new[]
 *                 {
 *                     new Gcp.Kms.Inputs.EkmConnectionServiceResolverServerCertificateArgs
 *                     {
 *                         RawDer = "==HAwIBCCAr6gAwIBAgIUWR+EV4lqiV7Ql12VY==",
 *                     },
 *                 },
 *             },
 *         },
 *     });
 * });
 * ```
 * ```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.NewEkmConnection(ctx, "example-ekmconnection", &kms.EkmConnectionArgs{
 * 			Name:              pulumi.String("ekmconnection_example"),
 * 			Location:          pulumi.String("us-central1"),
 * 			KeyManagementMode: pulumi.String("MANUAL"),
 * 			ServiceResolvers: kms.EkmConnectionServiceResolverArray{
 * 				&kms.EkmConnectionServiceResolverArgs{
 * 					ServiceDirectoryService: pulumi.String("projects/project_id/locations/us-central1/namespaces/namespace_name/services/service_name"),
 * 					Hostname:                pulumi.String("example-ekm.goog"),
 * 					ServerCertificates: kms.EkmConnectionServiceResolverServerCertificateArray{
 * 						&kms.EkmConnectionServiceResolverServerCertificateArgs{
 * 							RawDer: pulumi.String("==HAwIBCCAr6gAwIBAgIUWR+EV4lqiV7Ql12VY=="),
 * 						},
 * 					},
 * 				},
 * 			},
 * 		})
 * 		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.EkmConnection;
 * import com.pulumi.gcp.kms.EkmConnectionArgs;
 * import com.pulumi.gcp.kms.inputs.EkmConnectionServiceResolverArgs;
 * 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_ekmconnection = new EkmConnection("example-ekmconnection", EkmConnectionArgs.builder()
 *             .name("ekmconnection_example")
 *             .location("us-central1")
 *             .keyManagementMode("MANUAL")
 *             .serviceResolvers(EkmConnectionServiceResolverArgs.builder()
 *                 .serviceDirectoryService("projects/project_id/locations/us-central1/namespaces/namespace_name/services/service_name")
 *                 .hostname("example-ekm.goog")
 *                 .serverCertificates(EkmConnectionServiceResolverServerCertificateArgs.builder()
 *                     .rawDer("==HAwIBCCAr6gAwIBAgIUWR+EV4lqiV7Ql12VY==")
 *                     .build())
 *                 .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example-ekmconnection:
 *     type: gcp:kms:EkmConnection
 *     properties:
 *       name: ekmconnection_example
 *       location: us-central1
 *       keyManagementMode: MANUAL
 *       serviceResolvers:
 *         - serviceDirectoryService: projects/project_id/locations/us-central1/namespaces/namespace_name/services/service_name
 *           hostname: example-ekm.goog
 *           serverCertificates:
 *             - rawDer: ==HAwIBCCAr6gAwIBAgIUWR+EV4lqiV7Ql12VY==
 * ```
 * 
 * ## Import
 * EkmConnection can be imported using any of these accepted formats:
 * * `projects/{{project}}/locations/{{location}}/ekmConnections/{{name}}`
 * * `{{project}}/{{location}}/{{name}}`
 * * `{{location}}/{{name}}`
 * When using the `pulumi import` command, EkmConnection can be imported using one of the formats above. For example:
 * ```sh
 * $ pulumi import gcp:kms/ekmConnection:EkmConnection default projects/{{project}}/locations/{{location}}/ekmConnections/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:kms/ekmConnection:EkmConnection default {{project}}/{{location}}/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:kms/ekmConnection:EkmConnection default {{location}}/{{name}}
 * ```
 */
public class EkmConnection internal constructor(
    override val javaResource: com.pulumi.gcp.kms.EkmConnection,
) : KotlinCustomResource(javaResource, EkmConnectionMapper) {
    /**
     * Output only. The time at which the EkmConnection was created.
     * A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z".
     */
    public val createTime: Output
        get() = javaResource.createTime().applyValue({ args0 -> args0 })

    /**
     * Optional. Identifies the EKM Crypto Space that this EkmConnection maps to. Note: This field is required if
     * KeyManagementMode is CLOUD_KMS.
     */
    public val cryptoSpacePath: Output
        get() = javaResource.cryptoSpacePath().applyValue({ args0 -> args0 })

    /**
     * Optional. Etag of the currently stored EkmConnection.
     */
    public val etag: Output
        get() = javaResource.etag().applyValue({ args0 -> args0 })

    /**
     * Optional. Describes who can perform control plane operations on the EKM. If unset, this defaults to MANUAL Default
     * value: "MANUAL" Possible values: ["MANUAL", "CLOUD_KMS"]
     */
    public val keyManagementMode: Output?
        get() = javaResource.keyManagementMode().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The location for the EkmConnection.
     * 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 EkmConnection.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    public val project: Output
        get() = javaResource.project().applyValue({ args0 -> args0 })

    /**
     * A list of ServiceResolvers where the EKM can be reached. There should be one ServiceResolver per EKM replica. Currently, only a single ServiceResolver is supported
     * Structure is documented below.
     */
    public val serviceResolvers: Output>
        get() = javaResource.serviceResolvers().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> toKotlin(args0) })
            })
        })
}

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

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy