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

com.pulumi.cloudflare.kotlin.ZoneLockdownArgs.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.ZoneLockdownArgs.builder
import com.pulumi.cloudflare.kotlin.inputs.ZoneLockdownConfigurationArgs
import com.pulumi.cloudflare.kotlin.inputs.ZoneLockdownConfigurationArgsBuilder
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

/**
 * Provides a Cloudflare Zone Lockdown resource. Zone Lockdown allows
 * you to define one or more URLs (with wildcard matching on the domain
 * or path) that will only permit access if the request originates
 * from an IP address that matches a safelist of one or more IP
 * addresses and/or IP ranges.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as cloudflare from "@pulumi/cloudflare";
 * // Restrict access to these endpoints to requests from a known IP address range.
 * const example = new cloudflare.ZoneLockdown("example", {
 *     zoneId: "0da42c8d2132a9ddaf714f9e7c920711",
 *     paused: false,
 *     description: "Restrict access to these endpoints to requests from a known IP address range",
 *     urls: ["api.mysite.com/some/endpoint*"],
 *     configurations: [{
 *         target: "ip_range",
 *         value: "192.0.2.0/24",
 *     }],
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_cloudflare as cloudflare
 * # Restrict access to these endpoints to requests from a known IP address range.
 * example = cloudflare.ZoneLockdown("example",
 *     zone_id="0da42c8d2132a9ddaf714f9e7c920711",
 *     paused=False,
 *     description="Restrict access to these endpoints to requests from a known IP address range",
 *     urls=["api.mysite.com/some/endpoint*"],
 *     configurations=[{
 *         "target": "ip_range",
 *         "value": "192.0.2.0/24",
 *     }])
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Cloudflare = Pulumi.Cloudflare;
 * return await Deployment.RunAsync(() =>
 * {
 *     // Restrict access to these endpoints to requests from a known IP address range.
 *     var example = new Cloudflare.ZoneLockdown("example", new()
 *     {
 *         ZoneId = "0da42c8d2132a9ddaf714f9e7c920711",
 *         Paused = false,
 *         Description = "Restrict access to these endpoints to requests from a known IP address range",
 *         Urls = new[]
 *         {
 *             "api.mysite.com/some/endpoint*",
 *         },
 *         Configurations = new[]
 *         {
 *             new Cloudflare.Inputs.ZoneLockdownConfigurationArgs
 *             {
 *                 Target = "ip_range",
 *                 Value = "192.0.2.0/24",
 *             },
 *         },
 *     });
 * });
 * ```
 * ```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 {
 * 		// Restrict access to these endpoints to requests from a known IP address range.
 * 		_, err := cloudflare.NewZoneLockdown(ctx, "example", &cloudflare.ZoneLockdownArgs{
 * 			ZoneId:      pulumi.String("0da42c8d2132a9ddaf714f9e7c920711"),
 * 			Paused:      pulumi.Bool(false),
 * 			Description: pulumi.String("Restrict access to these endpoints to requests from a known IP address range"),
 * 			Urls: pulumi.StringArray{
 * 				pulumi.String("api.mysite.com/some/endpoint*"),
 * 			},
 * 			Configurations: cloudflare.ZoneLockdownConfigurationArray{
 * 				&cloudflare.ZoneLockdownConfigurationArgs{
 * 					Target: pulumi.String("ip_range"),
 * 					Value:  pulumi.String("192.0.2.0/24"),
 * 				},
 * 			},
 * 		})
 * 		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.ZoneLockdown;
 * import com.pulumi.cloudflare.ZoneLockdownArgs;
 * import com.pulumi.cloudflare.inputs.ZoneLockdownConfigurationArgs;
 * 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) {
 *         // Restrict access to these endpoints to requests from a known IP address range.
 *         var example = new ZoneLockdown("example", ZoneLockdownArgs.builder()
 *             .zoneId("0da42c8d2132a9ddaf714f9e7c920711")
 *             .paused("false")
 *             .description("Restrict access to these endpoints to requests from a known IP address range")
 *             .urls("api.mysite.com/some/endpoint*")
 *             .configurations(ZoneLockdownConfigurationArgs.builder()
 *                 .target("ip_range")
 *                 .value("192.0.2.0/24")
 *                 .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   # Restrict access to these endpoints to requests from a known IP address range.
 *   example:
 *     type: cloudflare:ZoneLockdown
 *     properties:
 *       zoneId: 0da42c8d2132a9ddaf714f9e7c920711
 *       paused: 'false'
 *       description: Restrict access to these endpoints to requests from a known IP address range
 *       urls:
 *         - api.mysite.com/some/endpoint*
 *       configurations:
 *         - target: ip_range
 *           value: 192.0.2.0/24
 * ```
 * 
 * ## Import
 * ```sh
 * $ pulumi import cloudflare:index/zoneLockdown:ZoneLockdown example /
 * ```
 * @property configurations A list of IP addresses or IP ranges to match the request against specified in target, value pairs.
 * @property description A description about the lockdown entry. Typically used as a reminder or explanation for the lockdown.
 * @property paused Boolean of whether this zone lockdown is currently paused. Defaults to `false`.
 * @property priority
 * @property urls A list of simple wildcard patterns to match requests against. The order of the urls is unimportant.
 * @property zoneId The zone identifier to target for the resource. **Modifying this attribute will force creation of a new resource.**
 */
public data class ZoneLockdownArgs(
    public val configurations: Output>? = null,
    public val description: Output? = null,
    public val paused: Output? = null,
    public val priority: Output? = null,
    public val urls: Output>? = null,
    public val zoneId: Output? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.cloudflare.ZoneLockdownArgs =
        com.pulumi.cloudflare.ZoneLockdownArgs.builder()
            .configurations(
                configurations?.applyValue({ args0 ->
                    args0.map({ args0 ->
                        args0.let({ args0 ->
                            args0.toJava()
                        })
                    })
                }),
            )
            .description(description?.applyValue({ args0 -> args0 }))
            .paused(paused?.applyValue({ args0 -> args0 }))
            .priority(priority?.applyValue({ args0 -> args0 }))
            .urls(urls?.applyValue({ args0 -> args0.map({ args0 -> args0 }) }))
            .zoneId(zoneId?.applyValue({ args0 -> args0 })).build()
}

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

    private var description: Output? = null

    private var paused: Output? = null

    private var priority: Output? = null

    private var urls: Output>? = null

    private var zoneId: Output? = null

    /**
     * @param value A list of IP addresses or IP ranges to match the request against specified in target, value pairs.
     */
    @JvmName("cpmkloadqsthryvk")
    public suspend fun configurations(`value`: Output>) {
        this.configurations = value
    }

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

    /**
     * @param values A list of IP addresses or IP ranges to match the request against specified in target, value pairs.
     */
    @JvmName("yruaofiseinopsam")
    public suspend fun configurations(values: List>) {
        this.configurations = Output.all(values)
    }

    /**
     * @param value A description about the lockdown entry. Typically used as a reminder or explanation for the lockdown.
     */
    @JvmName("awfotwjvbemiscsw")
    public suspend fun description(`value`: Output) {
        this.description = value
    }

    /**
     * @param value Boolean of whether this zone lockdown is currently paused. Defaults to `false`.
     */
    @JvmName("hlsvknygrcoilidl")
    public suspend fun paused(`value`: Output) {
        this.paused = value
    }

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

    /**
     * @param value A list of simple wildcard patterns to match requests against. The order of the urls is unimportant.
     */
    @JvmName("govoprsfcujhsctc")
    public suspend fun urls(`value`: Output>) {
        this.urls = value
    }

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

    /**
     * @param values A list of simple wildcard patterns to match requests against. The order of the urls is unimportant.
     */
    @JvmName("ertaseywkaiqyxnf")
    public suspend fun urls(values: List>) {
        this.urls = Output.all(values)
    }

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

    /**
     * @param value A list of IP addresses or IP ranges to match the request against specified in target, value pairs.
     */
    @JvmName("eecjqxqckvfdwypa")
    public suspend fun configurations(`value`: List?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.configurations = mapped
    }

    /**
     * @param argument A list of IP addresses or IP ranges to match the request against specified in target, value pairs.
     */
    @JvmName("oirarldjtihltgjx")
    public suspend fun configurations(argument: List Unit>) {
        val toBeMapped = argument.toList().map {
            ZoneLockdownConfigurationArgsBuilder().applySuspend {
                it()
            }.build()
        }
        val mapped = of(toBeMapped)
        this.configurations = mapped
    }

    /**
     * @param argument A list of IP addresses or IP ranges to match the request against specified in target, value pairs.
     */
    @JvmName("nomhsopyofcsophu")
    public suspend fun configurations(vararg argument: suspend ZoneLockdownConfigurationArgsBuilder.() -> Unit) {
        val toBeMapped = argument.toList().map {
            ZoneLockdownConfigurationArgsBuilder().applySuspend {
                it()
            }.build()
        }
        val mapped = of(toBeMapped)
        this.configurations = mapped
    }

    /**
     * @param argument A list of IP addresses or IP ranges to match the request against specified in target, value pairs.
     */
    @JvmName("divjyucanembhabm")
    public suspend fun configurations(argument: suspend ZoneLockdownConfigurationArgsBuilder.() -> Unit) {
        val toBeMapped = listOf(
            ZoneLockdownConfigurationArgsBuilder().applySuspend {
                argument()
            }.build(),
        )
        val mapped = of(toBeMapped)
        this.configurations = mapped
    }

    /**
     * @param values A list of IP addresses or IP ranges to match the request against specified in target, value pairs.
     */
    @JvmName("ywriejpsrbtcuvdi")
    public suspend fun configurations(vararg values: ZoneLockdownConfigurationArgs) {
        val toBeMapped = values.toList()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.configurations = mapped
    }

    /**
     * @param value A description about the lockdown entry. Typically used as a reminder or explanation for the lockdown.
     */
    @JvmName("hhyfktjquepvsofw")
    public suspend fun description(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.description = mapped
    }

    /**
     * @param value Boolean of whether this zone lockdown is currently paused. Defaults to `false`.
     */
    @JvmName("acppyeeqdedmlnje")
    public suspend fun paused(`value`: Boolean?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.paused = mapped
    }

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

    /**
     * @param value A list of simple wildcard patterns to match requests against. The order of the urls is unimportant.
     */
    @JvmName("cdtptjicsxpfrtwh")
    public suspend fun urls(`value`: List?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.urls = mapped
    }

    /**
     * @param values A list of simple wildcard patterns to match requests against. The order of the urls is unimportant.
     */
    @JvmName("olcaaoygjcyrjriq")
    public suspend fun urls(vararg values: String) {
        val toBeMapped = values.toList()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.urls = mapped
    }

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

    internal fun build(): ZoneLockdownArgs = ZoneLockdownArgs(
        configurations = configurations,
        description = description,
        paused = paused,
        priority = priority,
        urls = urls,
        zoneId = zoneId,
    )
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy