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

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

package com.pulumi.gcp.networksecurity.kotlin

import com.pulumi.core.Output
import com.pulumi.gcp.networksecurity.kotlin.outputs.ClientTlsPolicyClientCertificate
import com.pulumi.gcp.networksecurity.kotlin.outputs.ClientTlsPolicyServerValidationCa
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
import com.pulumi.gcp.networksecurity.kotlin.outputs.ClientTlsPolicyClientCertificate.Companion.toKotlin as clientTlsPolicyClientCertificateToKotlin
import com.pulumi.gcp.networksecurity.kotlin.outputs.ClientTlsPolicyServerValidationCa.Companion.toKotlin as clientTlsPolicyServerValidationCaToKotlin

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

    public var args: ClientTlsPolicyArgs = ClientTlsPolicyArgs()

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

/**
 * ## Example Usage
 * ### Network Security Client Tls Policy Basic
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const _default = new gcp.networksecurity.ClientTlsPolicy("default", {
 *     name: "my-client-tls-policy",
 *     labels: {
 *         foo: "bar",
 *     },
 *     description: "my description",
 *     sni: "secure.example.com",
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * default = gcp.networksecurity.ClientTlsPolicy("default",
 *     name="my-client-tls-policy",
 *     labels={
 *         "foo": "bar",
 *     },
 *     description="my description",
 *     sni="secure.example.com")
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var @default = new Gcp.NetworkSecurity.ClientTlsPolicy("default", new()
 *     {
 *         Name = "my-client-tls-policy",
 *         Labels =
 *         {
 *             { "foo", "bar" },
 *         },
 *         Description = "my description",
 *         Sni = "secure.example.com",
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/networksecurity"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := networksecurity.NewClientTlsPolicy(ctx, "default", &networksecurity.ClientTlsPolicyArgs{
 * 			Name: pulumi.String("my-client-tls-policy"),
 * 			Labels: pulumi.StringMap{
 * 				"foo": pulumi.String("bar"),
 * 			},
 * 			Description: pulumi.String("my description"),
 * 			Sni:         pulumi.String("secure.example.com"),
 * 		})
 * 		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.networksecurity.ClientTlsPolicy;
 * import com.pulumi.gcp.networksecurity.ClientTlsPolicyArgs;
 * 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 ClientTlsPolicy("default", ClientTlsPolicyArgs.builder()
 *             .name("my-client-tls-policy")
 *             .labels(Map.of("foo", "bar"))
 *             .description("my description")
 *             .sni("secure.example.com")
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   default:
 *     type: gcp:networksecurity:ClientTlsPolicy
 *     properties:
 *       name: my-client-tls-policy
 *       labels:
 *         foo: bar
 *       description: my description
 *       sni: secure.example.com
 * ```
 * 
 * ### Network Security Client Tls Policy Advanced
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const _default = new gcp.networksecurity.ClientTlsPolicy("default", {
 *     name: "my-client-tls-policy",
 *     labels: {
 *         foo: "bar",
 *     },
 *     description: "my description",
 *     clientCertificate: {
 *         certificateProviderInstance: {
 *             pluginInstance: "google_cloud_private_spiffe",
 *         },
 *     },
 *     serverValidationCas: [
 *         {
 *             grpcEndpoint: {
 *                 targetUri: "unix:mypath",
 *             },
 *         },
 *         {
 *             grpcEndpoint: {
 *                 targetUri: "unix:mypath1",
 *             },
 *         },
 *     ],
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * default = gcp.networksecurity.ClientTlsPolicy("default",
 *     name="my-client-tls-policy",
 *     labels={
 *         "foo": "bar",
 *     },
 *     description="my description",
 *     client_certificate=gcp.networksecurity.ClientTlsPolicyClientCertificateArgs(
 *         certificate_provider_instance=gcp.networksecurity.ClientTlsPolicyClientCertificateCertificateProviderInstanceArgs(
 *             plugin_instance="google_cloud_private_spiffe",
 *         ),
 *     ),
 *     server_validation_cas=[
 *         gcp.networksecurity.ClientTlsPolicyServerValidationCaArgs(
 *             grpc_endpoint=gcp.networksecurity.ClientTlsPolicyServerValidationCaGrpcEndpointArgs(
 *                 target_uri="unix:mypath",
 *             ),
 *         ),
 *         gcp.networksecurity.ClientTlsPolicyServerValidationCaArgs(
 *             grpc_endpoint=gcp.networksecurity.ClientTlsPolicyServerValidationCaGrpcEndpointArgs(
 *                 target_uri="unix:mypath1",
 *             ),
 *         ),
 *     ])
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var @default = new Gcp.NetworkSecurity.ClientTlsPolicy("default", new()
 *     {
 *         Name = "my-client-tls-policy",
 *         Labels =
 *         {
 *             { "foo", "bar" },
 *         },
 *         Description = "my description",
 *         ClientCertificate = new Gcp.NetworkSecurity.Inputs.ClientTlsPolicyClientCertificateArgs
 *         {
 *             CertificateProviderInstance = new Gcp.NetworkSecurity.Inputs.ClientTlsPolicyClientCertificateCertificateProviderInstanceArgs
 *             {
 *                 PluginInstance = "google_cloud_private_spiffe",
 *             },
 *         },
 *         ServerValidationCas = new[]
 *         {
 *             new Gcp.NetworkSecurity.Inputs.ClientTlsPolicyServerValidationCaArgs
 *             {
 *                 GrpcEndpoint = new Gcp.NetworkSecurity.Inputs.ClientTlsPolicyServerValidationCaGrpcEndpointArgs
 *                 {
 *                     TargetUri = "unix:mypath",
 *                 },
 *             },
 *             new Gcp.NetworkSecurity.Inputs.ClientTlsPolicyServerValidationCaArgs
 *             {
 *                 GrpcEndpoint = new Gcp.NetworkSecurity.Inputs.ClientTlsPolicyServerValidationCaGrpcEndpointArgs
 *                 {
 *                     TargetUri = "unix:mypath1",
 *                 },
 *             },
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/networksecurity"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := networksecurity.NewClientTlsPolicy(ctx, "default", &networksecurity.ClientTlsPolicyArgs{
 * 			Name: pulumi.String("my-client-tls-policy"),
 * 			Labels: pulumi.StringMap{
 * 				"foo": pulumi.String("bar"),
 * 			},
 * 			Description: pulumi.String("my description"),
 * 			ClientCertificate: &networksecurity.ClientTlsPolicyClientCertificateArgs{
 * 				CertificateProviderInstance: &networksecurity.ClientTlsPolicyClientCertificateCertificateProviderInstanceArgs{
 * 					PluginInstance: pulumi.String("google_cloud_private_spiffe"),
 * 				},
 * 			},
 * 			ServerValidationCas: networksecurity.ClientTlsPolicyServerValidationCaArray{
 * 				&networksecurity.ClientTlsPolicyServerValidationCaArgs{
 * 					GrpcEndpoint: &networksecurity.ClientTlsPolicyServerValidationCaGrpcEndpointArgs{
 * 						TargetUri: pulumi.String("unix:mypath"),
 * 					},
 * 				},
 * 				&networksecurity.ClientTlsPolicyServerValidationCaArgs{
 * 					GrpcEndpoint: &networksecurity.ClientTlsPolicyServerValidationCaGrpcEndpointArgs{
 * 						TargetUri: pulumi.String("unix:mypath1"),
 * 					},
 * 				},
 * 			},
 * 		})
 * 		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.networksecurity.ClientTlsPolicy;
 * import com.pulumi.gcp.networksecurity.ClientTlsPolicyArgs;
 * import com.pulumi.gcp.networksecurity.inputs.ClientTlsPolicyClientCertificateArgs;
 * import com.pulumi.gcp.networksecurity.inputs.ClientTlsPolicyClientCertificateCertificateProviderInstanceArgs;
 * import com.pulumi.gcp.networksecurity.inputs.ClientTlsPolicyServerValidationCaArgs;
 * import com.pulumi.gcp.networksecurity.inputs.ClientTlsPolicyServerValidationCaGrpcEndpointArgs;
 * 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 ClientTlsPolicy("default", ClientTlsPolicyArgs.builder()
 *             .name("my-client-tls-policy")
 *             .labels(Map.of("foo", "bar"))
 *             .description("my description")
 *             .clientCertificate(ClientTlsPolicyClientCertificateArgs.builder()
 *                 .certificateProviderInstance(ClientTlsPolicyClientCertificateCertificateProviderInstanceArgs.builder()
 *                     .pluginInstance("google_cloud_private_spiffe")
 *                     .build())
 *                 .build())
 *             .serverValidationCas(
 *                 ClientTlsPolicyServerValidationCaArgs.builder()
 *                     .grpcEndpoint(ClientTlsPolicyServerValidationCaGrpcEndpointArgs.builder()
 *                         .targetUri("unix:mypath")
 *                         .build())
 *                     .build(),
 *                 ClientTlsPolicyServerValidationCaArgs.builder()
 *                     .grpcEndpoint(ClientTlsPolicyServerValidationCaGrpcEndpointArgs.builder()
 *                         .targetUri("unix:mypath1")
 *                         .build())
 *                     .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   default:
 *     type: gcp:networksecurity:ClientTlsPolicy
 *     properties:
 *       name: my-client-tls-policy
 *       labels:
 *         foo: bar
 *       description: my description
 *       clientCertificate:
 *         certificateProviderInstance:
 *           pluginInstance: google_cloud_private_spiffe
 *       serverValidationCas:
 *         - grpcEndpoint:
 *             targetUri: unix:mypath
 *         - grpcEndpoint:
 *             targetUri: unix:mypath1
 * ```
 * 
 * ## Import
 * ClientTlsPolicy can be imported using any of these accepted formats:
 * * `projects/{{project}}/locations/{{location}}/clientTlsPolicies/{{name}}`
 * * `{{project}}/{{location}}/{{name}}`
 * * `{{location}}/{{name}}`
 * When using the `pulumi import` command, ClientTlsPolicy can be imported using one of the formats above. For example:
 * ```sh
 * $ pulumi import gcp:networksecurity/clientTlsPolicy:ClientTlsPolicy default projects/{{project}}/locations/{{location}}/clientTlsPolicies/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:networksecurity/clientTlsPolicy:ClientTlsPolicy default {{project}}/{{location}}/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:networksecurity/clientTlsPolicy:ClientTlsPolicy default {{location}}/{{name}}
 * ```
 */
public class ClientTlsPolicy internal constructor(
    override val javaResource: com.pulumi.gcp.networksecurity.ClientTlsPolicy,
) : KotlinCustomResource(javaResource, ClientTlsPolicyMapper) {
    /**
     * Defines a mechanism to provision client identity (public and private keys) for peer to peer authentication. The presence of this dictates mTLS.
     * Structure is documented below.
     */
    public val clientCertificate: Output?
        get() = javaResource.clientCertificate().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> clientTlsPolicyClientCertificateToKotlin(args0) })
            }).orElse(null)
        })

    /**
     * Time the ClientTlsPolicy was created in UTC.
     */
    public val createTime: Output
        get() = javaResource.createTime().applyValue({ args0 -> args0 })

    /**
     * A free-text description of the resource. Max length 1024 characters.
     */
    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 ClientTlsPolicy resource.
     * **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 location of the client tls policy.
     * The default value is `global`.
     */
    public val location: Output?
        get() = javaResource.location().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * Name of the ClientTlsPolicy resource.
     * - - -
     */
    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()
        })

    /**
     * Defines the mechanism to obtain the Certificate Authority certificate to validate the server certificate. If empty, client does not validate the server certificate.
     * Structure is documented below.
     */
    public val serverValidationCas: Output>?
        get() = javaResource.serverValidationCas().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.let({ args0 ->
                        clientTlsPolicyServerValidationCaToKotlin(args0)
                    })
                })
            }).orElse(null)
        })

    /**
     * Server Name Indication string to present to the server during TLS handshake. E.g: "secure.example.com".
     */
    public val sni: Output?
        get() = javaResource.sni().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * Time the ClientTlsPolicy was updated in UTC.
     */
    public val updateTime: Output
        get() = javaResource.updateTime().applyValue({ args0 -> args0 })
}

public object ClientTlsPolicyMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.gcp.networksecurity.ClientTlsPolicy::class == javaResource::class

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

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy