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

com.pulumi.cloudflare.kotlin.EmailRoutingRuleArgs.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.EmailRoutingRuleArgs.builder
import com.pulumi.cloudflare.kotlin.inputs.EmailRoutingRuleActionArgs
import com.pulumi.cloudflare.kotlin.inputs.EmailRoutingRuleActionArgsBuilder
import com.pulumi.cloudflare.kotlin.inputs.EmailRoutingRuleMatcherArgs
import com.pulumi.cloudflare.kotlin.inputs.EmailRoutingRuleMatcherArgsBuilder
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.Int
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.jvm.JvmName

/**
 * The [Email Routing Rule](https://developers.cloudflare.com/email-routing/setup/email-routing-addresses/#email-rule-actions) resource allows you to create and manage email routing rules for a zone.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as cloudflare from "@pulumi/cloudflare";
 * const main = new cloudflare.EmailRoutingRule("main", {
 *     zoneId: "0da42c8d2132a9ddaf714f9e7c920711",
 *     name: "terraform rule",
 *     enabled: true,
 *     matchers: [{
 *         type: "literal",
 *         field: "to",
 *         value: "[email protected]",
 *     }],
 *     actions: [{
 *         type: "forward",
 *         values: ["destinationaddress@example.net"],
 *     }],
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_cloudflare as cloudflare
 * main = cloudflare.EmailRoutingRule("main",
 *     zone_id="0da42c8d2132a9ddaf714f9e7c920711",
 *     name="terraform rule",
 *     enabled=True,
 *     matchers=[{
 *         "type": "literal",
 *         "field": "to",
 *         "value": "[email protected]",
 *     }],
 *     actions=[{
 *         "type": "forward",
 *         "values": ["destinationaddress@example.net"],
 *     }])
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Cloudflare = Pulumi.Cloudflare;
 * return await Deployment.RunAsync(() =>
 * {
 *     var main = new Cloudflare.EmailRoutingRule("main", new()
 *     {
 *         ZoneId = "0da42c8d2132a9ddaf714f9e7c920711",
 *         Name = "terraform rule",
 *         Enabled = true,
 *         Matchers = new[]
 *         {
 *             new Cloudflare.Inputs.EmailRoutingRuleMatcherArgs
 *             {
 *                 Type = "literal",
 *                 Field = "to",
 *                 Value = "[email protected]",
 *             },
 *         },
 *         Actions = new[]
 *         {
 *             new Cloudflare.Inputs.EmailRoutingRuleActionArgs
 *             {
 *                 Type = "forward",
 *                 Values = new[]
 *                 {
 *                     "[email protected]",
 *                 },
 *             },
 *         },
 *     });
 * });
 * ```
 * ```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.NewEmailRoutingRule(ctx, "main", &cloudflare.EmailRoutingRuleArgs{
 * 			ZoneId:  pulumi.String("0da42c8d2132a9ddaf714f9e7c920711"),
 * 			Name:    pulumi.String("terraform rule"),
 * 			Enabled: pulumi.Bool(true),
 * 			Matchers: cloudflare.EmailRoutingRuleMatcherArray{
 * 				&cloudflare.EmailRoutingRuleMatcherArgs{
 * 					Type:  pulumi.String("literal"),
 * 					Field: pulumi.String("to"),
 * 					Value: pulumi.String("[email protected]"),
 * 				},
 * 			},
 * 			Actions: cloudflare.EmailRoutingRuleActionArray{
 * 				&cloudflare.EmailRoutingRuleActionArgs{
 * 					Type: pulumi.String("forward"),
 * 					Values: pulumi.StringArray{
 * 						pulumi.String("[email protected]"),
 * 					},
 * 				},
 * 			},
 * 		})
 * 		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.EmailRoutingRule;
 * import com.pulumi.cloudflare.EmailRoutingRuleArgs;
 * import com.pulumi.cloudflare.inputs.EmailRoutingRuleMatcherArgs;
 * import com.pulumi.cloudflare.inputs.EmailRoutingRuleActionArgs;
 * 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 main = new EmailRoutingRule("main", EmailRoutingRuleArgs.builder()
 *             .zoneId("0da42c8d2132a9ddaf714f9e7c920711")
 *             .name("terraform rule")
 *             .enabled(true)
 *             .matchers(EmailRoutingRuleMatcherArgs.builder()
 *                 .type("literal")
 *                 .field("to")
 *                 .value("[email protected]")
 *                 .build())
 *             .actions(EmailRoutingRuleActionArgs.builder()
 *                 .type("forward")
 *                 .values("[email protected]")
 *                 .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   main:
 *     type: cloudflare:EmailRoutingRule
 *     properties:
 *       zoneId: 0da42c8d2132a9ddaf714f9e7c920711
 *       name: terraform rule
 *       enabled: true
 *       matchers:
 *         - type: literal
 *           field: to
 *           value: [email protected]
 *       actions:
 *         - type: forward
 *           values:
 *             - [email protected]
 * ```
 * 
 * ## Import
 * ```sh
 * $ pulumi import cloudflare:index/emailRoutingRule:EmailRoutingRule example /
 * ```
 * @property actions Actions to take when a match is found.
 * @property enabled Whether the email routing rule is enabled.
 * @property matchers Matching patterns to forward to your actions.
 * @property name Routing rule name.
 * @property priority The priority of the email routing rule.
 * @property zoneId The zone identifier to target for the resource.
 */
public data class EmailRoutingRuleArgs(
    public val actions: Output>? = null,
    public val enabled: Output? = null,
    public val matchers: Output>? = null,
    public val name: Output? = null,
    public val priority: Output? = null,
    public val zoneId: Output? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.cloudflare.EmailRoutingRuleArgs =
        com.pulumi.cloudflare.EmailRoutingRuleArgs.builder()
            .actions(
                actions?.applyValue({ args0 ->
                    args0.map({ args0 ->
                        args0.let({ args0 ->
                            args0.toJava()
                        })
                    })
                }),
            )
            .enabled(enabled?.applyValue({ args0 -> args0 }))
            .matchers(
                matchers?.applyValue({ args0 ->
                    args0.map({ args0 ->
                        args0.let({ args0 ->
                            args0.toJava()
                        })
                    })
                }),
            )
            .name(name?.applyValue({ args0 -> args0 }))
            .priority(priority?.applyValue({ args0 -> args0 }))
            .zoneId(zoneId?.applyValue({ args0 -> args0 })).build()
}

/**
 * Builder for [EmailRoutingRuleArgs].
 */
@PulumiTagMarker
public class EmailRoutingRuleArgsBuilder internal constructor() {
    private var actions: Output>? = null

    private var enabled: Output? = null

    private var matchers: Output>? = null

    private var name: Output? = null

    private var priority: Output? = null

    private var zoneId: Output? = null

    /**
     * @param value Actions to take when a match is found.
     */
    @JvmName("vcxqwmihshfltvto")
    public suspend fun actions(`value`: Output>) {
        this.actions = value
    }

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

    /**
     * @param values Actions to take when a match is found.
     */
    @JvmName("iugxmpyhepihrcws")
    public suspend fun actions(values: List>) {
        this.actions = Output.all(values)
    }

    /**
     * @param value Whether the email routing rule is enabled.
     */
    @JvmName("nfhywsgkicnjorti")
    public suspend fun enabled(`value`: Output) {
        this.enabled = value
    }

    /**
     * @param value Matching patterns to forward to your actions.
     */
    @JvmName("vngbqwfsaijafyrj")
    public suspend fun matchers(`value`: Output>) {
        this.matchers = value
    }

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

    /**
     * @param values Matching patterns to forward to your actions.
     */
    @JvmName("khxwxnvsypaskroc")
    public suspend fun matchers(values: List>) {
        this.matchers = Output.all(values)
    }

    /**
     * @param value Routing rule name.
     */
    @JvmName("ptinmxwdsvcvunat")
    public suspend fun name(`value`: Output) {
        this.name = value
    }

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

    /**
     * @param value The zone identifier to target for the resource.
     */
    @JvmName("fwrqmodbuivjnuyn")
    public suspend fun zoneId(`value`: Output) {
        this.zoneId = value
    }

    /**
     * @param value Actions to take when a match is found.
     */
    @JvmName("ipoiqgbwkxcsjhxt")
    public suspend fun actions(`value`: List?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.actions = mapped
    }

    /**
     * @param argument Actions to take when a match is found.
     */
    @JvmName("rdhbcyhptecpumkm")
    public suspend fun actions(argument: List Unit>) {
        val toBeMapped = argument.toList().map {
            EmailRoutingRuleActionArgsBuilder().applySuspend {
                it()
            }.build()
        }
        val mapped = of(toBeMapped)
        this.actions = mapped
    }

    /**
     * @param argument Actions to take when a match is found.
     */
    @JvmName("ojtgguqrajebulup")
    public suspend fun actions(vararg argument: suspend EmailRoutingRuleActionArgsBuilder.() -> Unit) {
        val toBeMapped = argument.toList().map {
            EmailRoutingRuleActionArgsBuilder().applySuspend {
                it()
            }.build()
        }
        val mapped = of(toBeMapped)
        this.actions = mapped
    }

    /**
     * @param argument Actions to take when a match is found.
     */
    @JvmName("uaasurhvrvvlphwc")
    public suspend fun actions(argument: suspend EmailRoutingRuleActionArgsBuilder.() -> Unit) {
        val toBeMapped = listOf(EmailRoutingRuleActionArgsBuilder().applySuspend { argument() }.build())
        val mapped = of(toBeMapped)
        this.actions = mapped
    }

    /**
     * @param values Actions to take when a match is found.
     */
    @JvmName("yreyjjuvrujlcxqm")
    public suspend fun actions(vararg values: EmailRoutingRuleActionArgs) {
        val toBeMapped = values.toList()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.actions = mapped
    }

    /**
     * @param value Whether the email routing rule is enabled.
     */
    @JvmName("jvkyhpiygascdwcp")
    public suspend fun enabled(`value`: Boolean?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.enabled = mapped
    }

    /**
     * @param value Matching patterns to forward to your actions.
     */
    @JvmName("viglknrxpjqalthb")
    public suspend fun matchers(`value`: List?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.matchers = mapped
    }

    /**
     * @param argument Matching patterns to forward to your actions.
     */
    @JvmName("aqwmdglxveegppwy")
    public suspend fun matchers(argument: List Unit>) {
        val toBeMapped = argument.toList().map {
            EmailRoutingRuleMatcherArgsBuilder().applySuspend {
                it()
            }.build()
        }
        val mapped = of(toBeMapped)
        this.matchers = mapped
    }

    /**
     * @param argument Matching patterns to forward to your actions.
     */
    @JvmName("hqgyesitmpessyec")
    public suspend fun matchers(vararg argument: suspend EmailRoutingRuleMatcherArgsBuilder.() -> Unit) {
        val toBeMapped = argument.toList().map {
            EmailRoutingRuleMatcherArgsBuilder().applySuspend {
                it()
            }.build()
        }
        val mapped = of(toBeMapped)
        this.matchers = mapped
    }

    /**
     * @param argument Matching patterns to forward to your actions.
     */
    @JvmName("oaawwijykwllivnk")
    public suspend fun matchers(argument: suspend EmailRoutingRuleMatcherArgsBuilder.() -> Unit) {
        val toBeMapped = listOf(
            EmailRoutingRuleMatcherArgsBuilder().applySuspend {
                argument()
            }.build(),
        )
        val mapped = of(toBeMapped)
        this.matchers = mapped
    }

    /**
     * @param values Matching patterns to forward to your actions.
     */
    @JvmName("kodjipfvguefltha")
    public suspend fun matchers(vararg values: EmailRoutingRuleMatcherArgs) {
        val toBeMapped = values.toList()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.matchers = mapped
    }

    /**
     * @param value Routing rule name.
     */
    @JvmName("ejfwofjvluvhqctf")
    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 email routing rule.
     */
    @JvmName("odheuropdiogiund")
    public suspend fun priority(`value`: Int?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.priority = mapped
    }

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

    internal fun build(): EmailRoutingRuleArgs = EmailRoutingRuleArgs(
        actions = actions,
        enabled = enabled,
        matchers = matchers,
        name = name,
        priority = priority,
        zoneId = zoneId,
    )
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy