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

com.pulumi.cloudflare.kotlin.OriginCaCertificateArgs.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: 5.40.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.cloudflare.kotlin

import com.pulumi.cloudflare.OriginCaCertificateArgs.builder
import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import kotlin.Int
import kotlin.String
import kotlin.Suppress
import kotlin.collections.List
import kotlin.jvm.JvmName

/**
 * Provides a Cloudflare Origin CA certificate used to protect traffic to your origin without involving a third party Certificate Authority.
 * > Since v3.32.0
 *    all authentication schemes are supported for managing Origin CA certificates.
 *    Versions prior to v3.32.0 will still need to use `api_user_service_key`.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as cloudflare from "@pulumi/cloudflare";
 * import * as tls from "@pulumi/tls";
 * const example = new tls.index.PrivateKey("example", {algorithm: "RSA"});
 * const exampleCertRequest = new tls.index.CertRequest("example", {
 *     privateKeyPem: example.privateKeyPem,
 *     subject: [{
 *         commonName: "",
 *         organization: "Terraform Test",
 *     }],
 * });
 * const exampleOriginCaCertificate = new cloudflare.OriginCaCertificate("example", {
 *     csr: exampleCertRequest.certRequestPem,
 *     hostnames: ["example.com"],
 *     requestType: "origin-rsa",
 *     requestedValidity: 7,
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_cloudflare as cloudflare
 * import pulumi_tls as tls
 * example = tls.index.PrivateKey("example", algorithm=RSA)
 * example_cert_request = tls.index.CertRequest("example",
 *     private_key_pem=example.private_key_pem,
 *     subject=[{
 *         commonName: ,
 *         organization: Terraform Test,
 *     }])
 * example_origin_ca_certificate = cloudflare.OriginCaCertificate("example",
 *     csr=example_cert_request["certRequestPem"],
 *     hostnames=["example.com"],
 *     request_type="origin-rsa",
 *     requested_validity=7)
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Cloudflare = Pulumi.Cloudflare;
 * using Tls = Pulumi.Tls;
 * return await Deployment.RunAsync(() =>
 * {
 *     var example = new Tls.Index.PrivateKey("example", new()
 *     {
 *         Algorithm = "RSA",
 *     });
 *     var exampleCertRequest = new Tls.Index.CertRequest("example", new()
 *     {
 *         PrivateKeyPem = example.PrivateKeyPem,
 *         Subject = new[]
 *         {
 *             {
 *                 { "commonName", "" },
 *                 { "organization", "Terraform Test" },
 *             },
 *         },
 *     });
 *     var exampleOriginCaCertificate = new Cloudflare.OriginCaCertificate("example", new()
 *     {
 *         Csr = exampleCertRequest.CertRequestPem,
 *         Hostnames = new[]
 *         {
 *             "example.com",
 *         },
 *         RequestType = "origin-rsa",
 *         RequestedValidity = 7,
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-cloudflare/sdk/v5/go/cloudflare"
 * 	"github.com/pulumi/pulumi-tls/sdk/v4/go/tls"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		example, err := tls.NewPrivateKey(ctx, "example", &tls.PrivateKeyArgs{
 * 			Algorithm: "RSA",
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleCertRequest, err := tls.NewCertRequest(ctx, "example", &tls.CertRequestArgs{
 * 			PrivateKeyPem: example.PrivateKeyPem,
 * 			Subject: []map[string]interface{}{
 * 				map[string]interface{}{
 * 					"commonName":   "",
 * 					"organization": "Terraform Test",
 * 				},
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = cloudflare.NewOriginCaCertificate(ctx, "example", &cloudflare.OriginCaCertificateArgs{
 * 			Csr: exampleCertRequest.CertRequestPem,
 * 			Hostnames: pulumi.StringArray{
 * 				pulumi.String("example.com"),
 * 			},
 * 			RequestType:       pulumi.String("origin-rsa"),
 * 			RequestedValidity: pulumi.Int(7),
 * 		})
 * 		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.tls.privateKey;
 * import com.pulumi.tls.PrivateKeyArgs;
 * import com.pulumi.tls.certRequest;
 * import com.pulumi.tls.CertRequestArgs;
 * import com.pulumi.cloudflare.OriginCaCertificate;
 * import com.pulumi.cloudflare.OriginCaCertificateArgs;
 * 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 = new PrivateKey("example", PrivateKeyArgs.builder()
 *             .algorithm("RSA")
 *             .build());
 *         var exampleCertRequest = new CertRequest("exampleCertRequest", CertRequestArgs.builder()
 *             .privateKeyPem(example.privateKeyPem())
 *             .subject(%!v(PANIC=Format method: runtime error: invalid memory address or nil pointer dereference))
 *             .build());
 *         var exampleOriginCaCertificate = new OriginCaCertificate("exampleOriginCaCertificate", OriginCaCertificateArgs.builder()
 *             .csr(exampleCertRequest.certRequestPem())
 *             .hostnames("example.com")
 *             .requestType("origin-rsa")
 *             .requestedValidity(7)
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: tls:privateKey
 *     properties:
 *       algorithm: RSA
 *   exampleCertRequest:
 *     type: tls:certRequest
 *     name: example
 *     properties:
 *       privateKeyPem: ${example.privateKeyPem}
 *       subject:
 *         - commonName:
 *           organization: Terraform Test
 *   exampleOriginCaCertificate:
 *     type: cloudflare:OriginCaCertificate
 *     name: example
 *     properties:
 *       csr: ${exampleCertRequest.certRequestPem}
 *       hostnames:
 *         - example.com
 *       requestType: origin-rsa
 *       requestedValidity: 7
 * ```
 * 
 * ## Import
 * ```sh
 * $ pulumi import cloudflare:index/originCaCertificate:OriginCaCertificate example 
 * ```
 * @property csr The Certificate Signing Request. Must be newline-encoded. **Modifying this attribute will force creation of a new resource.**
 * @property hostnames A list of hostnames or wildcard names bound to the certificate. **Modifying this attribute will force creation of a new resource.**
 * @property minDaysForRenewal
 * @property requestType The signature type desired on the certificate. Available values: `origin-rsa`, `origin-ecc`, `keyless-certificate`. **Modifying this attribute will force creation of a new resource.**
 * @property requestedValidity The number of days for which the certificate should be valid. Available values: `7`, `30`, `90`, `365`, `730`, `1095`, `5475`. **Modifying this attribute will force creation of a new resource.**
 */
public data class OriginCaCertificateArgs(
    public val csr: Output? = null,
    public val hostnames: Output>? = null,
    public val minDaysForRenewal: Output? = null,
    public val requestType: Output? = null,
    public val requestedValidity: Output? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.cloudflare.OriginCaCertificateArgs =
        com.pulumi.cloudflare.OriginCaCertificateArgs.builder()
            .csr(csr?.applyValue({ args0 -> args0 }))
            .hostnames(hostnames?.applyValue({ args0 -> args0.map({ args0 -> args0 }) }))
            .minDaysForRenewal(minDaysForRenewal?.applyValue({ args0 -> args0 }))
            .requestType(requestType?.applyValue({ args0 -> args0 }))
            .requestedValidity(requestedValidity?.applyValue({ args0 -> args0 })).build()
}

/**
 * Builder for [OriginCaCertificateArgs].
 */
@PulumiTagMarker
public class OriginCaCertificateArgsBuilder internal constructor() {
    private var csr: Output? = null

    private var hostnames: Output>? = null

    private var minDaysForRenewal: Output? = null

    private var requestType: Output? = null

    private var requestedValidity: Output? = null

    /**
     * @param value The Certificate Signing Request. Must be newline-encoded. **Modifying this attribute will force creation of a new resource.**
     */
    @JvmName("bcpdvfwafkpmqkxj")
    public suspend fun csr(`value`: Output) {
        this.csr = value
    }

    /**
     * @param value A list of hostnames or wildcard names bound to the certificate. **Modifying this attribute will force creation of a new resource.**
     */
    @JvmName("kwfletknafadtaed")
    public suspend fun hostnames(`value`: Output>) {
        this.hostnames = value
    }

    @JvmName("pcwderkjkpydjobn")
    public suspend fun hostnames(vararg values: Output) {
        this.hostnames = Output.all(values.asList())
    }

    /**
     * @param values A list of hostnames or wildcard names bound to the certificate. **Modifying this attribute will force creation of a new resource.**
     */
    @JvmName("nbcrsghisviywaaj")
    public suspend fun hostnames(values: List>) {
        this.hostnames = Output.all(values)
    }

    /**
     * @param value
     */
    @JvmName("utulpxprkixyiyil")
    public suspend fun minDaysForRenewal(`value`: Output) {
        this.minDaysForRenewal = value
    }

    /**
     * @param value The signature type desired on the certificate. Available values: `origin-rsa`, `origin-ecc`, `keyless-certificate`. **Modifying this attribute will force creation of a new resource.**
     */
    @JvmName("mqdegybjngoajqbh")
    public suspend fun requestType(`value`: Output) {
        this.requestType = value
    }

    /**
     * @param value The number of days for which the certificate should be valid. Available values: `7`, `30`, `90`, `365`, `730`, `1095`, `5475`. **Modifying this attribute will force creation of a new resource.**
     */
    @JvmName("gqobbbypcrffwwcj")
    public suspend fun requestedValidity(`value`: Output) {
        this.requestedValidity = value
    }

    /**
     * @param value The Certificate Signing Request. Must be newline-encoded. **Modifying this attribute will force creation of a new resource.**
     */
    @JvmName("kcvboodnjdlrnebj")
    public suspend fun csr(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.csr = mapped
    }

    /**
     * @param value A list of hostnames or wildcard names bound to the certificate. **Modifying this attribute will force creation of a new resource.**
     */
    @JvmName("qvewmegwagpheyrc")
    public suspend fun hostnames(`value`: List?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.hostnames = mapped
    }

    /**
     * @param values A list of hostnames or wildcard names bound to the certificate. **Modifying this attribute will force creation of a new resource.**
     */
    @JvmName("wiqprfslaqgatyrl")
    public suspend fun hostnames(vararg values: String) {
        val toBeMapped = values.toList()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.hostnames = mapped
    }

    /**
     * @param value
     */
    @JvmName("lbdoknexmpjcynml")
    public suspend fun minDaysForRenewal(`value`: Int?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.minDaysForRenewal = mapped
    }

    /**
     * @param value The signature type desired on the certificate. Available values: `origin-rsa`, `origin-ecc`, `keyless-certificate`. **Modifying this attribute will force creation of a new resource.**
     */
    @JvmName("mqkvvndreprdgsrv")
    public suspend fun requestType(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.requestType = mapped
    }

    /**
     * @param value The number of days for which the certificate should be valid. Available values: `7`, `30`, `90`, `365`, `730`, `1095`, `5475`. **Modifying this attribute will force creation of a new resource.**
     */
    @JvmName("kdejebovllwtldlg")
    public suspend fun requestedValidity(`value`: Int?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.requestedValidity = mapped
    }

    internal fun build(): OriginCaCertificateArgs = OriginCaCertificateArgs(
        csr = csr,
        hostnames = hostnames,
        minDaysForRenewal = minDaysForRenewal,
        requestType = requestType,
        requestedValidity = requestedValidity,
    )
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy