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

com.pulumi.gcp.compute.kotlin.SSLPolicy.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.compute.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.List

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

    public var args: SSLPolicyArgs = SSLPolicyArgs()

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

/**
 * Represents a SSL policy. SSL policies give you the ability to control the
 * features of SSL that your SSL proxy or HTTPS load balancer negotiates.
 * To get more information about SslPolicy, see:
 * * [API documentation](https://cloud.google.com/compute/docs/reference/rest/v1/sslPolicies)
 * * How-to Guides
 *     * [Using SSL Policies](https://cloud.google.com/compute/docs/load-balancing/ssl-policies)
 * ## Example Usage
 * ### Ssl Policy Basic
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const prod_ssl_policy = new gcp.compute.SSLPolicy("prod-ssl-policy", {
 *     name: "production-ssl-policy",
 *     profile: "MODERN",
 * });
 * const nonprod_ssl_policy = new gcp.compute.SSLPolicy("nonprod-ssl-policy", {
 *     name: "nonprod-ssl-policy",
 *     profile: "MODERN",
 *     minTlsVersion: "TLS_1_2",
 * });
 * const custom_ssl_policy = new gcp.compute.SSLPolicy("custom-ssl-policy", {
 *     name: "custom-ssl-policy",
 *     minTlsVersion: "TLS_1_2",
 *     profile: "CUSTOM",
 *     customFeatures: [
 *         "TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384",
 *         "TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384",
 *     ],
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * prod_ssl_policy = gcp.compute.SSLPolicy("prod-ssl-policy",
 *     name="production-ssl-policy",
 *     profile="MODERN")
 * nonprod_ssl_policy = gcp.compute.SSLPolicy("nonprod-ssl-policy",
 *     name="nonprod-ssl-policy",
 *     profile="MODERN",
 *     min_tls_version="TLS_1_2")
 * custom_ssl_policy = gcp.compute.SSLPolicy("custom-ssl-policy",
 *     name="custom-ssl-policy",
 *     min_tls_version="TLS_1_2",
 *     profile="CUSTOM",
 *     custom_features=[
 *         "TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384",
 *         "TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384",
 *     ])
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var prod_ssl_policy = new Gcp.Compute.SSLPolicy("prod-ssl-policy", new()
 *     {
 *         Name = "production-ssl-policy",
 *         Profile = "MODERN",
 *     });
 *     var nonprod_ssl_policy = new Gcp.Compute.SSLPolicy("nonprod-ssl-policy", new()
 *     {
 *         Name = "nonprod-ssl-policy",
 *         Profile = "MODERN",
 *         MinTlsVersion = "TLS_1_2",
 *     });
 *     var custom_ssl_policy = new Gcp.Compute.SSLPolicy("custom-ssl-policy", new()
 *     {
 *         Name = "custom-ssl-policy",
 *         MinTlsVersion = "TLS_1_2",
 *         Profile = "CUSTOM",
 *         CustomFeatures = new[]
 *         {
 *             "TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384",
 *             "TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384",
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/compute"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := compute.NewSSLPolicy(ctx, "prod-ssl-policy", &compute.SSLPolicyArgs{
 * 			Name:    pulumi.String("production-ssl-policy"),
 * 			Profile: pulumi.String("MODERN"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = compute.NewSSLPolicy(ctx, "nonprod-ssl-policy", &compute.SSLPolicyArgs{
 * 			Name:          pulumi.String("nonprod-ssl-policy"),
 * 			Profile:       pulumi.String("MODERN"),
 * 			MinTlsVersion: pulumi.String("TLS_1_2"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = compute.NewSSLPolicy(ctx, "custom-ssl-policy", &compute.SSLPolicyArgs{
 * 			Name:          pulumi.String("custom-ssl-policy"),
 * 			MinTlsVersion: pulumi.String("TLS_1_2"),
 * 			Profile:       pulumi.String("CUSTOM"),
 * 			CustomFeatures: pulumi.StringArray{
 * 				pulumi.String("TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384"),
 * 				pulumi.String("TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384"),
 * 			},
 * 		})
 * 		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.compute.SSLPolicy;
 * import com.pulumi.gcp.compute.SSLPolicyArgs;
 * 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 prod_ssl_policy = new SSLPolicy("prod-ssl-policy", SSLPolicyArgs.builder()
 *             .name("production-ssl-policy")
 *             .profile("MODERN")
 *             .build());
 *         var nonprod_ssl_policy = new SSLPolicy("nonprod-ssl-policy", SSLPolicyArgs.builder()
 *             .name("nonprod-ssl-policy")
 *             .profile("MODERN")
 *             .minTlsVersion("TLS_1_2")
 *             .build());
 *         var custom_ssl_policy = new SSLPolicy("custom-ssl-policy", SSLPolicyArgs.builder()
 *             .name("custom-ssl-policy")
 *             .minTlsVersion("TLS_1_2")
 *             .profile("CUSTOM")
 *             .customFeatures(
 *                 "TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384",
 *                 "TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384")
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   prod-ssl-policy:
 *     type: gcp:compute:SSLPolicy
 *     properties:
 *       name: production-ssl-policy
 *       profile: MODERN
 *   nonprod-ssl-policy:
 *     type: gcp:compute:SSLPolicy
 *     properties:
 *       name: nonprod-ssl-policy
 *       profile: MODERN
 *       minTlsVersion: TLS_1_2
 *   custom-ssl-policy:
 *     type: gcp:compute:SSLPolicy
 *     properties:
 *       name: custom-ssl-policy
 *       minTlsVersion: TLS_1_2
 *       profile: CUSTOM
 *       customFeatures:
 *         - TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384
 *         - TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
 * ```
 * 
 * ## Import
 * SslPolicy can be imported using any of these accepted formats:
 * * `projects/{{project}}/global/sslPolicies/{{name}}`
 * * `{{project}}/{{name}}`
 * * `{{name}}`
 * When using the `pulumi import` command, SslPolicy can be imported using one of the formats above. For example:
 * ```sh
 * $ pulumi import gcp:compute/sSLPolicy:SSLPolicy default projects/{{project}}/global/sslPolicies/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:compute/sSLPolicy:SSLPolicy default {{project}}/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:compute/sSLPolicy:SSLPolicy default {{name}}
 * ```
 */
public class SSLPolicy internal constructor(
    override val javaResource: com.pulumi.gcp.compute.SSLPolicy,
) : KotlinCustomResource(javaResource, SSLPolicyMapper) {
    /**
     * Creation timestamp in RFC3339 text format.
     */
    public val creationTimestamp: Output
        get() = javaResource.creationTimestamp().applyValue({ args0 -> args0 })

    /**
     * Profile specifies the set of SSL features that can be used by the
     * load balancer when negotiating SSL with clients. This can be one of
     * `COMPATIBLE`, `MODERN`, `RESTRICTED`, or `CUSTOM`. If using `CUSTOM`,
     * the set of SSL features to enable must be specified in the
     * `customFeatures` field.
     * See the [official documentation](https://cloud.google.com/compute/docs/load-balancing/ssl-policies#profilefeaturesupport)
     * for which ciphers are available to use. **Note**: this argument
     * *must* be present when using the `CUSTOM` profile. This argument
     * *must not* be present when using any other profile.
     */
    public val customFeatures: Output>?
        get() = javaResource.customFeatures().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 -> args0 })
            }).orElse(null)
        })

    /**
     * An optional description of this resource.
     */
    public val description: Output?
        get() = javaResource.description().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The list of features enabled in the SSL policy.
     */
    public val enabledFeatures: Output>
        get() = javaResource.enabledFeatures().applyValue({ args0 -> args0.map({ args0 -> args0 }) })

    /**
     * Fingerprint of this resource. A hash of the contents stored in this
     * object. This field is used in optimistic locking.
     */
    public val fingerprint: Output
        get() = javaResource.fingerprint().applyValue({ args0 -> args0 })

    /**
     * The minimum version of SSL protocol that can be used by the clients
     * to establish a connection with the load balancer.
     * Default value is `TLS_1_0`.
     * Possible values are: `TLS_1_0`, `TLS_1_1`, `TLS_1_2`.
     */
    public val minTlsVersion: Output?
        get() = javaResource.minTlsVersion().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Name of the resource. Provided by the client when the resource is
     * created. The name must be 1-63 characters long, and comply with
     * RFC1035. Specifically, the name must be 1-63 characters long and match
     * the regular expression `a-z?` which means the
     * first character must be a lowercase letter, and all following
     * characters must be a dash, lowercase letter, or digit, except the last
     * character, which cannot be a dash.
     * - - -
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * Profile specifies the set of SSL features that can be used by the
     * load balancer when negotiating SSL with clients. If using `CUSTOM`,
     * the set of SSL features to enable must be specified in the
     * `customFeatures` field.
     * See the [official documentation](https://cloud.google.com/compute/docs/load-balancing/ssl-policies#profilefeaturesupport)
     * for information on what cipher suites each profile provides. If
     * `CUSTOM` is used, the `custom_features` attribute **must be set**.
     * Default value is `COMPATIBLE`.
     * Possible values are: `COMPATIBLE`, `MODERN`, `RESTRICTED`, `CUSTOM`.
     */
    public val profile: Output?
        get() = javaResource.profile().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * 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 URI of the created resource.
     */
    public val selfLink: Output
        get() = javaResource.selfLink().applyValue({ args0 -> args0 })
}

public object SSLPolicyMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.gcp.compute.SSLPolicy::class == javaResource::class

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy