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

com.pulumi.cloudflare.kotlin.MtlsCertificate.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.

The newest version!
@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.String
import kotlin.Suppress
import kotlin.Unit

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

    public var args: MtlsCertificateArgs = MtlsCertificateArgs()

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

/**
 * Provides a Cloudflare mTLS certificate resource. These certificates may be used with mTLS enabled Cloudflare services.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as cloudflare from "@pulumi/cloudflare";
 * const example = new cloudflare.MtlsCertificate("example", {
 *     accountId: "f037e56e89293a057740de681ac9abbe",
 *     name: "example",
 *     certificates: `-----BEGIN CERTIFICATE-----
 * MIIDmDCCAoCgAwIBAgIUKTOAZNj...i4JhqeoTewsxndhDDE
 * -----END CERTIFICATE-----`,
 *     privateKey: `-----BEGIN PRIVATE KEY-----
 * MIIEvQIBADANBgkqhkiG9w0BAQE...1IS3EnQRrz6WMYA=
 * -----END PRIVATE KEY-----`,
 *     ca: true,
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_cloudflare as cloudflare
 * example = cloudflare.MtlsCertificate("example",
 *     account_id="f037e56e89293a057740de681ac9abbe",
 *     name="example",
 *     certificates="""-----BEGIN CERTIFICATE-----
 * MIIDmDCCAoCgAwIBAgIUKTOAZNj...i4JhqeoTewsxndhDDE
 * -----END CERTIFICATE-----""",
 *     private_key="""-----BEGIN PRIVATE KEY-----
 * MIIEvQIBADANBgkqhkiG9w0BAQE...1IS3EnQRrz6WMYA=
 * -----END PRIVATE KEY-----""",
 *     ca=True)
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Cloudflare = Pulumi.Cloudflare;
 * return await Deployment.RunAsync(() =>
 * {
 *     var example = new Cloudflare.MtlsCertificate("example", new()
 *     {
 *         AccountId = "f037e56e89293a057740de681ac9abbe",
 *         Name = "example",
 *         Certificates = @"-----BEGIN CERTIFICATE-----
 * MIIDmDCCAoCgAwIBAgIUKTOAZNj...i4JhqeoTewsxndhDDE
 * -----END CERTIFICATE-----",
 *         PrivateKey = @"-----BEGIN PRIVATE KEY-----
 * MIIEvQIBADANBgkqhkiG9w0BAQE...1IS3EnQRrz6WMYA=
 * -----END PRIVATE KEY-----",
 *         Ca = true,
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-cloudflare/sdk/v5/go/cloudflare"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := cloudflare.NewMtlsCertificate(ctx, "example", &cloudflare.MtlsCertificateArgs{
 * 			AccountId:    pulumi.String("f037e56e89293a057740de681ac9abbe"),
 * 			Name:         pulumi.String("example"),
 * 			Certificates: pulumi.String("-----BEGIN CERTIFICATE-----\nMIIDmDCCAoCgAwIBAgIUKTOAZNj...i4JhqeoTewsxndhDDE\n-----END CERTIFICATE-----"),
 * 			PrivateKey:   pulumi.String("-----BEGIN PRIVATE KEY-----\nMIIEvQIBADANBgkqhkiG9w0BAQE...1IS3EnQRrz6WMYA=\n-----END PRIVATE KEY-----"),
 * 			Ca:           pulumi.Bool(true),
 * 		})
 * 		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.cloudflare.MtlsCertificate;
 * import com.pulumi.cloudflare.MtlsCertificateArgs;
 * 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 MtlsCertificate("example", MtlsCertificateArgs.builder()
 *             .accountId("f037e56e89293a057740de681ac9abbe")
 *             .name("example")
 *             .certificates("""
 * -----BEGIN CERTIFICATE-----
 * MIIDmDCCAoCgAwIBAgIUKTOAZNj...i4JhqeoTewsxndhDDE
 * -----END CERTIFICATE-----            """)
 *             .privateKey("""
 * -----BEGIN PRIVATE KEY-----
 * MIIEvQIBADANBgkqhkiG9w0BAQE...1IS3EnQRrz6WMYA=
 * -----END PRIVATE KEY-----            """)
 *             .ca(true)
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: cloudflare:MtlsCertificate
 *     properties:
 *       accountId: f037e56e89293a057740de681ac9abbe
 *       name: example
 *       certificates: |-
 *         -----BEGIN CERTIFICATE-----
 *         MIIDmDCCAoCgAwIBAgIUKTOAZNj...i4JhqeoTewsxndhDDE
 *         -----END CERTIFICATE-----
 *       privateKey: |-
 *         -----BEGIN PRIVATE KEY-----
 *         MIIEvQIBADANBgkqhkiG9w0BAQE...1IS3EnQRrz6WMYA=
 *         -----END PRIVATE KEY-----
 *       ca: true
 * ```
 * 
 * ## Import
 * ```sh
 * $ pulumi import cloudflare:index/mtlsCertificate:MtlsCertificate example /
 * ```
 */
public class MtlsCertificate internal constructor(
    override val javaResource: com.pulumi.cloudflare.MtlsCertificate,
) : KotlinCustomResource(javaResource, MtlsCertificateMapper) {
    /**
     * The account identifier to target for the resource. **Modifying this attribute will force creation of a new resource.**
     */
    public val accountId: Output
        get() = javaResource.accountId().applyValue({ args0 -> args0 })

    /**
     * Whether this is a CA or leaf certificate. **Modifying this attribute will force creation of a new resource.**
     */
    public val ca: Output
        get() = javaResource.ca().applyValue({ args0 -> args0 })

    /**
     * Certificate you intend to use with mTLS-enabled services. **Modifying this attribute will force creation of a new resource.**
     */
    public val certificates: Output
        get() = javaResource.certificates().applyValue({ args0 -> args0 })

    /**
     * **Modifying this attribute will force creation of a new resource.**
     */
    public val expiresOn: Output
        get() = javaResource.expiresOn().applyValue({ args0 -> args0 })

    /**
     * **Modifying this attribute will force creation of a new resource.**
     */
    public val issuer: Output
        get() = javaResource.issuer().applyValue({ args0 -> args0 })

    /**
     * Optional unique name for the certificate. **Modifying this attribute will force creation of a new resource.**
     */
    public val name: Output?
        get() = javaResource.name().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * The certificate's private key. **Modifying this attribute will force creation of a new resource.**
     */
    public val privateKey: Output?
        get() = javaResource.privateKey().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * **Modifying this attribute will force creation of a new resource.**
     */
    public val serialNumber: Output
        get() = javaResource.serialNumber().applyValue({ args0 -> args0 })

    /**
     * **Modifying this attribute will force creation of a new resource.**
     */
    public val signature: Output
        get() = javaResource.signature().applyValue({ args0 -> args0 })

    /**
     * **Modifying this attribute will force creation of a new resource.**
     */
    public val uploadedOn: Output
        get() = javaResource.uploadedOn().applyValue({ args0 -> args0 })
}

public object MtlsCertificateMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.cloudflare.MtlsCertificate::class == javaResource::class

    override fun map(javaResource: Resource): MtlsCertificate = MtlsCertificate(
        javaResource as
            com.pulumi.cloudflare.MtlsCertificate,
    )
}

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy