com.pulumi.cloudflare.kotlin.OriginCaCertificate.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pulumi-cloudflare-kotlin Show documentation
Show all versions of pulumi-cloudflare-kotlin Show documentation
Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.cloudflare.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.Int
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
/**
* Builder for [OriginCaCertificate].
*/
@PulumiTagMarker
public class OriginCaCertificateResourceBuilder internal constructor() {
public var name: String? = null
public var args: OriginCaCertificateArgs = OriginCaCertificateArgs()
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 OriginCaCertificateArgsBuilder.() -> Unit) {
val builder = OriginCaCertificateArgsBuilder()
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(): OriginCaCertificate {
val builtJavaResource = com.pulumi.cloudflare.OriginCaCertificate(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return OriginCaCertificate(builtJavaResource)
}
}
/**
* 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
* ```
*/
public class OriginCaCertificate internal constructor(
override val javaResource: com.pulumi.cloudflare.OriginCaCertificate,
) : KotlinCustomResource(javaResource, OriginCaCertificateMapper) {
/**
* The Origin CA certificate.
*/
public val certificate: Output
get() = javaResource.certificate().applyValue({ args0 -> args0 })
/**
* The Certificate Signing Request. Must be newline-encoded. **Modifying this attribute will force creation of a new resource.**
*/
public val csr: Output
get() = javaResource.csr().applyValue({ args0 -> args0 })
/**
* The datetime when the certificate will expire.
*/
public val expiresOn: Output
get() = javaResource.expiresOn().applyValue({ args0 -> args0 })
/**
* A list of hostnames or wildcard names bound to the certificate. **Modifying this attribute will force creation of a new resource.**
*/
public val hostnames: Output>
get() = javaResource.hostnames().applyValue({ args0 -> args0.map({ args0 -> args0 }) })
public val minDaysForRenewal: Output?
get() = javaResource.minDaysForRenewal().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* 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.**
*/
public val requestType: Output
get() = javaResource.requestType().applyValue({ args0 -> args0 })
/**
* 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 val requestedValidity: Output
get() = javaResource.requestedValidity().applyValue({ args0 -> args0 })
}
public object OriginCaCertificateMapper : ResourceMapper {
override fun supportsMappingOfType(javaResource: Resource): Boolean =
com.pulumi.cloudflare.OriginCaCertificate::class == javaResource::class
override fun map(javaResource: Resource): OriginCaCertificate = OriginCaCertificate(
javaResource
as com.pulumi.cloudflare.OriginCaCertificate,
)
}
/**
* @see [OriginCaCertificate].
* @param name The _unique_ name of the resulting resource.
* @param block Builder for [OriginCaCertificate].
*/
public suspend fun originCaCertificate(
name: String,
block: suspend OriginCaCertificateResourceBuilder.() -> Unit,
): OriginCaCertificate {
val builder = OriginCaCertificateResourceBuilder()
builder.name(name)
block(builder)
return builder.build()
}
/**
* @see [OriginCaCertificate].
* @param name The _unique_ name of the resulting resource.
*/
public fun originCaCertificate(name: String): OriginCaCertificate {
val builder = OriginCaCertificateResourceBuilder()
builder.name(name)
return builder.build()
}