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

com.pulumi.cloudflare.kotlin.RecordArgs.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.RecordArgs.builder
import com.pulumi.cloudflare.kotlin.inputs.RecordDataArgs
import com.pulumi.cloudflare.kotlin.inputs.RecordDataArgsBuilder
import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.applySuspend
import kotlin.Boolean
import kotlin.Deprecated
import kotlin.Int
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.jvm.JvmName

/**
 * Provides a Cloudflare record resource.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as cloudflare from "@pulumi/cloudflare";
 * // Add a record to the domain
 * const example = new cloudflare.Record("example", {
 *     zoneId: cloudflareZoneId,
 *     name: "terraform",
 *     content: "192.0.2.1",
 *     type: "A",
 *     ttl: 3600,
 * });
 * // Add a record requiring a data map
 * const _sipTls = new cloudflare.Record("_sip_tls", {
 *     zoneId: cloudflareZoneId,
 *     name: "_sip._tls",
 *     type: "SRV",
 *     data: {
 *         service: "_sip",
 *         proto: "_tls",
 *         name: "terraform-srv",
 *         priority: 0,
 *         weight: 0,
 *         port: 443,
 *         target: "example.com",
 *     },
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_cloudflare as cloudflare
 * # Add a record to the domain
 * example = cloudflare.Record("example",
 *     zone_id=cloudflare_zone_id,
 *     name="terraform",
 *     content="192.0.2.1",
 *     type="A",
 *     ttl=3600)
 * # Add a record requiring a data map
 * _sip_tls = cloudflare.Record("_sip_tls",
 *     zone_id=cloudflare_zone_id,
 *     name="_sip._tls",
 *     type="SRV",
 *     data={
 *         "service": "_sip",
 *         "proto": "_tls",
 *         "name": "terraform-srv",
 *         "priority": 0,
 *         "weight": 0,
 *         "port": 443,
 *         "target": "example.com",
 *     })
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Cloudflare = Pulumi.Cloudflare;
 * return await Deployment.RunAsync(() =>
 * {
 *     // Add a record to the domain
 *     var example = new Cloudflare.Record("example", new()
 *     {
 *         ZoneId = cloudflareZoneId,
 *         Name = "terraform",
 *         Content = "192.0.2.1",
 *         Type = "A",
 *         Ttl = 3600,
 *     });
 *     // Add a record requiring a data map
 *     var _sipTls = new Cloudflare.Record("_sip_tls", new()
 *     {
 *         ZoneId = cloudflareZoneId,
 *         Name = "_sip._tls",
 *         Type = "SRV",
 *         Data = new Cloudflare.Inputs.RecordDataArgs
 *         {
 *             Service = "_sip",
 *             Proto = "_tls",
 *             Name = "terraform-srv",
 *             Priority = 0,
 *             Weight = 0,
 *             Port = 443,
 *             Target = "example.com",
 *         },
 *     });
 * });
 * ```
 * ```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 {
 * 		// Add a record to the domain
 * 		_, err := cloudflare.NewRecord(ctx, "example", &cloudflare.RecordArgs{
 * 			ZoneId:  pulumi.Any(cloudflareZoneId),
 * 			Name:    pulumi.String("terraform"),
 * 			Content: pulumi.String("192.0.2.1"),
 * 			Type:    pulumi.String("A"),
 * 			Ttl:     pulumi.Int(3600),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		// Add a record requiring a data map
 * 		_, err = cloudflare.NewRecord(ctx, "_sip_tls", &cloudflare.RecordArgs{
 * 			ZoneId: pulumi.Any(cloudflareZoneId),
 * 			Name:   pulumi.String("_sip._tls"),
 * 			Type:   pulumi.String("SRV"),
 * 			Data: &cloudflare.RecordDataArgs{
 * 				Service:  pulumi.String("_sip"),
 * 				Proto:    pulumi.String("_tls"),
 * 				Name:     pulumi.String("terraform-srv"),
 * 				Priority: pulumi.Int(0),
 * 				Weight:   pulumi.Int(0),
 * 				Port:     pulumi.Int(443),
 * 				Target:   pulumi.String("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.cloudflare.Record;
 * import com.pulumi.cloudflare.RecordArgs;
 * import com.pulumi.cloudflare.inputs.RecordDataArgs;
 * 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) {
 *         // Add a record to the domain
 *         var example = new Record("example", RecordArgs.builder()
 *             .zoneId(cloudflareZoneId)
 *             .name("terraform")
 *             .content("192.0.2.1")
 *             .type("A")
 *             .ttl(3600)
 *             .build());
 *         // Add a record requiring a data map
 *         var _sipTls = new Record("_sipTls", RecordArgs.builder()
 *             .zoneId(cloudflareZoneId)
 *             .name("_sip._tls")
 *             .type("SRV")
 *             .data(RecordDataArgs.builder()
 *                 .service("_sip")
 *                 .proto("_tls")
 *                 .name("terraform-srv")
 *                 .priority(0)
 *                 .weight(0)
 *                 .port(443)
 *                 .target("example.com")
 *                 .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   # Add a record to the domain
 *   example:
 *     type: cloudflare:Record
 *     properties:
 *       zoneId: ${cloudflareZoneId}
 *       name: terraform
 *       content: 192.0.2.1
 *       type: A
 *       ttl: 3600
 *   # Add a record requiring a data map
 *   _sipTls:
 *     type: cloudflare:Record
 *     name: _sip_tls
 *     properties:
 *       zoneId: ${cloudflareZoneId}
 *       name: _sip._tls
 *       type: SRV
 *       data:
 *         service: _sip
 *         proto: _tls
 *         name: terraform-srv
 *         priority: 0
 *         weight: 0
 *         port: 443
 *         target: example.com
 * ```
 * 
 * ## Import
 * ```sh
 * $ pulumi import cloudflare:index/record:Record example /
 * ```
 * @property allowOverwrite
 * @property comment Comments or notes about the DNS record. This field has no effect on DNS responses.
 * @property content The content of the record. Must provide only one of `data`, `content`, `value`.
 * @property data Map of attributes that constitute the record value. Must provide only one of `data`, `content`, `value`.
 * @property name The name of the record. **Modifying this attribute will force creation of a new resource.**
 * @property priority The priority of the record.
 * @property proxied Whether the record gets Cloudflare's origin protection.
 * @property tags Custom tags for the DNS record.
 * @property ttl The TTL of the record.
 * @property type The type of the record. Available values: `A`, `AAAA`, `CAA`, `CNAME`, `TXT`, `SRV`, `LOC`, `MX`, `NS`, `SPF`, `CERT`, `DNSKEY`, `DS`, `NAPTR`, `SMIMEA`, `SSHFP`, `TLSA`, `URI`, `PTR`, `HTTPS`, `SVCB`. **Modifying this attribute will force creation of a new resource.**
 * @property value The value of the record. Must provide only one of `data`, `content`, `value`.
 * @property zoneId The zone identifier to target for the resource. **Modifying this attribute will force creation of a new resource.**
 */
public data class RecordArgs(
    public val allowOverwrite: Output? = null,
    public val comment: Output? = null,
    public val content: Output? = null,
    public val `data`: Output? = null,
    public val name: Output? = null,
    public val priority: Output? = null,
    public val proxied: Output? = null,
    public val tags: Output>? = null,
    public val ttl: Output? = null,
    public val type: Output? = null,
    @Deprecated(
        message = """
  `value` is deprecated in favour of `content` and will be removed in the next major release.
  """,
    )
    public val `value`: Output? = null,
    public val zoneId: Output? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.cloudflare.RecordArgs =
        com.pulumi.cloudflare.RecordArgs.builder()
            .allowOverwrite(allowOverwrite?.applyValue({ args0 -> args0 }))
            .comment(comment?.applyValue({ args0 -> args0 }))
            .content(content?.applyValue({ args0 -> args0 }))
            .`data`(`data`?.applyValue({ args0 -> args0.let({ args0 -> args0.toJava() }) }))
            .name(name?.applyValue({ args0 -> args0 }))
            .priority(priority?.applyValue({ args0 -> args0 }))
            .proxied(proxied?.applyValue({ args0 -> args0 }))
            .tags(tags?.applyValue({ args0 -> args0.map({ args0 -> args0 }) }))
            .ttl(ttl?.applyValue({ args0 -> args0 }))
            .type(type?.applyValue({ args0 -> args0 }))
            .`value`(`value`?.applyValue({ args0 -> args0 }))
            .zoneId(zoneId?.applyValue({ args0 -> args0 })).build()
}

/**
 * Builder for [RecordArgs].
 */
@PulumiTagMarker
public class RecordArgsBuilder internal constructor() {
    private var allowOverwrite: Output? = null

    private var comment: Output? = null

    private var content: Output? = null

    private var `data`: Output? = null

    private var name: Output? = null

    private var priority: Output? = null

    private var proxied: Output? = null

    private var tags: Output>? = null

    private var ttl: Output? = null

    private var type: Output? = null

    private var `value`: Output? = null

    private var zoneId: Output? = null

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

    /**
     * @param value Comments or notes about the DNS record. This field has no effect on DNS responses.
     */
    @JvmName("hfhgdfvlxonbwmbv")
    public suspend fun comment(`value`: Output) {
        this.comment = value
    }

    /**
     * @param value The content of the record. Must provide only one of `data`, `content`, `value`.
     */
    @JvmName("fxomtivjsoddaybb")
    public suspend fun content(`value`: Output) {
        this.content = value
    }

    /**
     * @param value Map of attributes that constitute the record value. Must provide only one of `data`, `content`, `value`.
     */
    @JvmName("lfdtbnbvwmvgdsip")
    public suspend fun `data`(`value`: Output) {
        this.`data` = value
    }

    /**
     * @param value The name of the record. **Modifying this attribute will force creation of a new resource.**
     */
    @JvmName("gejobgugurltqjad")
    public suspend fun name(`value`: Output) {
        this.name = value
    }

    /**
     * @param value The priority of the record.
     */
    @JvmName("ojjsgdfluhpptjnx")
    public suspend fun priority(`value`: Output) {
        this.priority = value
    }

    /**
     * @param value Whether the record gets Cloudflare's origin protection.
     */
    @JvmName("hiychgakpjrsuqch")
    public suspend fun proxied(`value`: Output) {
        this.proxied = value
    }

    /**
     * @param value Custom tags for the DNS record.
     */
    @JvmName("tuiydoojgopcvmes")
    public suspend fun tags(`value`: Output>) {
        this.tags = value
    }

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

    /**
     * @param values Custom tags for the DNS record.
     */
    @JvmName("drupuqbxlwrugrcf")
    public suspend fun tags(values: List>) {
        this.tags = Output.all(values)
    }

    /**
     * @param value The TTL of the record.
     */
    @JvmName("flsatakporbsyvst")
    public suspend fun ttl(`value`: Output) {
        this.ttl = value
    }

    /**
     * @param value The type of the record. Available values: `A`, `AAAA`, `CAA`, `CNAME`, `TXT`, `SRV`, `LOC`, `MX`, `NS`, `SPF`, `CERT`, `DNSKEY`, `DS`, `NAPTR`, `SMIMEA`, `SSHFP`, `TLSA`, `URI`, `PTR`, `HTTPS`, `SVCB`. **Modifying this attribute will force creation of a new resource.**
     */
    @JvmName("yjmltsqflqkqcofr")
    public suspend fun type(`value`: Output) {
        this.type = value
    }

    /**
     * @param value The value of the record. Must provide only one of `data`, `content`, `value`.
     */
    @Deprecated(
        message = """
  `value` is deprecated in favour of `content` and will be removed in the next major release.
  """,
    )
    @JvmName("hbcfcicjbmshegdc")
    public suspend fun `value`(`value`: Output) {
        this.`value` = value
    }

    /**
     * @param value The zone identifier to target for the resource. **Modifying this attribute will force creation of a new resource.**
     */
    @JvmName("lovxvielwbcltugb")
    public suspend fun zoneId(`value`: Output) {
        this.zoneId = value
    }

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

    /**
     * @param value Comments or notes about the DNS record. This field has no effect on DNS responses.
     */
    @JvmName("liphumcvpikkalle")
    public suspend fun comment(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.comment = mapped
    }

    /**
     * @param value The content of the record. Must provide only one of `data`, `content`, `value`.
     */
    @JvmName("iuhgxdexsxjpherq")
    public suspend fun content(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.content = mapped
    }

    /**
     * @param value Map of attributes that constitute the record value. Must provide only one of `data`, `content`, `value`.
     */
    @JvmName("uinjxqhljsfmtmob")
    public suspend fun `data`(`value`: RecordDataArgs?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.`data` = mapped
    }

    /**
     * @param argument Map of attributes that constitute the record value. Must provide only one of `data`, `content`, `value`.
     */
    @JvmName("legtwbwsvpufmxrl")
    public suspend fun `data`(argument: suspend RecordDataArgsBuilder.() -> Unit) {
        val toBeMapped = RecordDataArgsBuilder().applySuspend { argument() }.build()
        val mapped = of(toBeMapped)
        this.`data` = mapped
    }

    /**
     * @param value The name of the record. **Modifying this attribute will force creation of a new resource.**
     */
    @JvmName("awpobqfynxtrksdi")
    public suspend fun name(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.name = mapped
    }

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

    /**
     * @param value Whether the record gets Cloudflare's origin protection.
     */
    @JvmName("ndhvdpiuujdsendr")
    public suspend fun proxied(`value`: Boolean?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.proxied = mapped
    }

    /**
     * @param value Custom tags for the DNS record.
     */
    @JvmName("cecdwmybquwcpxhl")
    public suspend fun tags(`value`: List?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.tags = mapped
    }

    /**
     * @param values Custom tags for the DNS record.
     */
    @JvmName("dwgftoeqgoabhygv")
    public suspend fun tags(vararg values: String) {
        val toBeMapped = values.toList()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.tags = mapped
    }

    /**
     * @param value The TTL of the record.
     */
    @JvmName("krhkxijkqilhhesx")
    public suspend fun ttl(`value`: Int?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.ttl = mapped
    }

    /**
     * @param value The type of the record. Available values: `A`, `AAAA`, `CAA`, `CNAME`, `TXT`, `SRV`, `LOC`, `MX`, `NS`, `SPF`, `CERT`, `DNSKEY`, `DS`, `NAPTR`, `SMIMEA`, `SSHFP`, `TLSA`, `URI`, `PTR`, `HTTPS`, `SVCB`. **Modifying this attribute will force creation of a new resource.**
     */
    @JvmName("nlmcktpghextduef")
    public suspend fun type(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.type = mapped
    }

    /**
     * @param value The value of the record. Must provide only one of `data`, `content`, `value`.
     */
    @Deprecated(
        message = """
  `value` is deprecated in favour of `content` and will be removed in the next major release.
  """,
    )
    @JvmName("qhpdugiefuexcbey")
    public suspend fun `value`(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.`value` = mapped
    }

    /**
     * @param value The zone identifier to target for the resource. **Modifying this attribute will force creation of a new resource.**
     */
    @JvmName("xprtuwmdottgoqia")
    public suspend fun zoneId(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.zoneId = mapped
    }

    internal fun build(): RecordArgs = RecordArgs(
        allowOverwrite = allowOverwrite,
        comment = comment,
        content = content,
        `data` = `data`,
        name = name,
        priority = priority,
        proxied = proxied,
        tags = tags,
        ttl = ttl,
        type = type,
        `value` = `value`,
        zoneId = zoneId,
    )
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy