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

com.pulumi.gcp.certificatemanager.kotlin.TrustConfig.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.certificatemanager.kotlin

import com.pulumi.core.Output
import com.pulumi.gcp.certificatemanager.kotlin.outputs.TrustConfigTrustStore
import com.pulumi.gcp.certificatemanager.kotlin.outputs.TrustConfigTrustStore.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
import kotlin.collections.Map

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

    public var args: TrustConfigArgs = TrustConfigArgs()

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

/**
 * TrustConfig represents a resource that represents your Public Key Infrastructure (PKI) configuration in Certificate Manager for use in mutual TLS authentication scenarios.
 * To get more information about TrustConfig, see:
 * * [API documentation](https://cloud.google.com/certificate-manager/docs/reference/certificate-manager/rest/v1/projects.locations.trustConfigs/create)
 * * How-to Guides
 *     * [Official Documentation](https://cloud.google.com/certificate-manager/docs)
 * ## Example Usage
 * ### Certificate Manager Trust Config
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * import * as std from "@pulumi/std";
 * const _default = new gcp.certificatemanager.TrustConfig("default", {
 *     name: "trust-config",
 *     description: "sample description for the trust config",
 *     location: "us-central1",
 *     trustStores: [{
 *         trustAnchors: [{
 *             pemCertificate: std.file({
 *                 input: "test-fixtures/cert.pem",
 *             }).then(invoke => invoke.result),
 *         }],
 *         intermediateCas: [{
 *             pemCertificate: std.file({
 *                 input: "test-fixtures/cert.pem",
 *             }).then(invoke => invoke.result),
 *         }],
 *     }],
 *     labels: {
 *         foo: "bar",
 *     },
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * import pulumi_std as std
 * default = gcp.certificatemanager.TrustConfig("default",
 *     name="trust-config",
 *     description="sample description for the trust config",
 *     location="us-central1",
 *     trust_stores=[gcp.certificatemanager.TrustConfigTrustStoreArgs(
 *         trust_anchors=[gcp.certificatemanager.TrustConfigTrustStoreTrustAnchorArgs(
 *             pem_certificate=std.file(input="test-fixtures/cert.pem").result,
 *         )],
 *         intermediate_cas=[gcp.certificatemanager.TrustConfigTrustStoreIntermediateCaArgs(
 *             pem_certificate=std.file(input="test-fixtures/cert.pem").result,
 *         )],
 *     )],
 *     labels={
 *         "foo": "bar",
 *     })
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * using Std = Pulumi.Std;
 * return await Deployment.RunAsync(() =>
 * {
 *     var @default = new Gcp.CertificateManager.TrustConfig("default", new()
 *     {
 *         Name = "trust-config",
 *         Description = "sample description for the trust config",
 *         Location = "us-central1",
 *         TrustStores = new[]
 *         {
 *             new Gcp.CertificateManager.Inputs.TrustConfigTrustStoreArgs
 *             {
 *                 TrustAnchors = new[]
 *                 {
 *                     new Gcp.CertificateManager.Inputs.TrustConfigTrustStoreTrustAnchorArgs
 *                     {
 *                         PemCertificate = Std.File.Invoke(new()
 *                         {
 *                             Input = "test-fixtures/cert.pem",
 *                         }).Apply(invoke => invoke.Result),
 *                     },
 *                 },
 *                 IntermediateCas = new[]
 *                 {
 *                     new Gcp.CertificateManager.Inputs.TrustConfigTrustStoreIntermediateCaArgs
 *                     {
 *                         PemCertificate = Std.File.Invoke(new()
 *                         {
 *                             Input = "test-fixtures/cert.pem",
 *                         }).Apply(invoke => invoke.Result),
 *                     },
 *                 },
 *             },
 *         },
 *         Labels =
 *         {
 *             { "foo", "bar" },
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/certificatemanager"
 * 	"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: "test-fixtures/cert.pem",
 * 		}, nil)
 * 		if err != nil {
 * 			return err
 * 		}
 * 		invokeFile1, err := std.File(ctx, &std.FileArgs{
 * 			Input: "test-fixtures/cert.pem",
 * 		}, nil)
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = certificatemanager.NewTrustConfig(ctx, "default", &certificatemanager.TrustConfigArgs{
 * 			Name:        pulumi.String("trust-config"),
 * 			Description: pulumi.String("sample description for the trust config"),
 * 			Location:    pulumi.String("us-central1"),
 * 			TrustStores: certificatemanager.TrustConfigTrustStoreArray{
 * 				&certificatemanager.TrustConfigTrustStoreArgs{
 * 					TrustAnchors: certificatemanager.TrustConfigTrustStoreTrustAnchorArray{
 * 						&certificatemanager.TrustConfigTrustStoreTrustAnchorArgs{
 * 							PemCertificate: invokeFile.Result,
 * 						},
 * 					},
 * 					IntermediateCas: certificatemanager.TrustConfigTrustStoreIntermediateCaArray{
 * 						&certificatemanager.TrustConfigTrustStoreIntermediateCaArgs{
 * 							PemCertificate: invokeFile1.Result,
 * 						},
 * 					},
 * 				},
 * 			},
 * 			Labels: pulumi.StringMap{
 * 				"foo": pulumi.String("bar"),
 * 			},
 * 		})
 * 		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.certificatemanager.TrustConfig;
 * import com.pulumi.gcp.certificatemanager.TrustConfigArgs;
 * import com.pulumi.gcp.certificatemanager.inputs.TrustConfigTrustStoreArgs;
 * 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 default_ = new TrustConfig("default", TrustConfigArgs.builder()
 *             .name("trust-config")
 *             .description("sample description for the trust config")
 *             .location("us-central1")
 *             .trustStores(TrustConfigTrustStoreArgs.builder()
 *                 .trustAnchors(TrustConfigTrustStoreTrustAnchorArgs.builder()
 *                     .pemCertificate(StdFunctions.file(FileArgs.builder()
 *                         .input("test-fixtures/cert.pem")
 *                         .build()).result())
 *                     .build())
 *                 .intermediateCas(TrustConfigTrustStoreIntermediateCaArgs.builder()
 *                     .pemCertificate(StdFunctions.file(FileArgs.builder()
 *                         .input("test-fixtures/cert.pem")
 *                         .build()).result())
 *                     .build())
 *                 .build())
 *             .labels(Map.of("foo", "bar"))
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   default:
 *     type: gcp:certificatemanager:TrustConfig
 *     properties:
 *       name: trust-config
 *       description: sample description for the trust config
 *       location: us-central1
 *       trustStores:
 *         - trustAnchors:
 *             - pemCertificate:
 *                 fn::invoke:
 *                   Function: std:file
 *                   Arguments:
 *                     input: test-fixtures/cert.pem
 *                   Return: result
 *           intermediateCas:
 *             - pemCertificate:
 *                 fn::invoke:
 *                   Function: std:file
 *                   Arguments:
 *                     input: test-fixtures/cert.pem
 *                   Return: result
 *       labels:
 *         foo: bar
 * ```
 * 
 * ## Import
 * TrustConfig can be imported using any of these accepted formats:
 * * `projects/{{project}}/locations/{{location}}/trustConfigs/{{name}}`
 * * `{{project}}/{{location}}/{{name}}`
 * * `{{location}}/{{name}}`
 * When using the `pulumi import` command, TrustConfig can be imported using one of the formats above. For example:
 * ```sh
 * $ pulumi import gcp:certificatemanager/trustConfig:TrustConfig default projects/{{project}}/locations/{{location}}/trustConfigs/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:certificatemanager/trustConfig:TrustConfig default {{project}}/{{location}}/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:certificatemanager/trustConfig:TrustConfig default {{location}}/{{name}}
 * ```
 */
public class TrustConfig internal constructor(
    override val javaResource: com.pulumi.gcp.certificatemanager.TrustConfig,
) : KotlinCustomResource(javaResource, TrustConfigMapper) {
    /**
     * The creation timestamp of a TrustConfig.
     * 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 })

    /**
     * One or more paragraphs of text description of a trust config.
     */
    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()
        })

    /**
     * Set of label tags associated with the trust config.
     * **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)
        })

    /**
     * The trust config location.
     * - - -
     */
    public val location: Output
        get() = javaResource.location().applyValue({ args0 -> args0 })

    /**
     * A user-defined name of the trust config. Trust config names must be unique globally.
     */
    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()
        })

    /**
     * Set of trust stores to perform validation against.
     * This field is supported when TrustConfig is configured with Load Balancers, currently not supported for SPIFFE certificate validation.
     * Structure is documented below.
     */
    public val trustStores: Output>?
        get() = javaResource.trustStores().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.let({ args0 -> toKotlin(args0) })
                })
            }).orElse(null)
        })

    /**
     * The last update timestamp of a TrustConfig.
     * 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 updateTime: Output
        get() = javaResource.updateTime().applyValue({ args0 -> args0 })
}

public object TrustConfigMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.gcp.certificatemanager.TrustConfig::class == javaResource::class

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy