com.pulumi.cloudflare.kotlin.ZoneLockdown.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.
The newest version!
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.cloudflare.kotlin
import com.pulumi.cloudflare.kotlin.outputs.ZoneLockdownConfiguration
import com.pulumi.cloudflare.kotlin.outputs.ZoneLockdownConfiguration.Companion.toKotlin
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 [ZoneLockdown].
*/
@PulumiTagMarker
public class ZoneLockdownResourceBuilder internal constructor() {
public var name: String? = null
public var args: ZoneLockdownArgs = ZoneLockdownArgs()
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 ZoneLockdownArgsBuilder.() -> Unit) {
val builder = ZoneLockdownArgsBuilder()
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(): ZoneLockdown {
val builtJavaResource = com.pulumi.cloudflare.ZoneLockdown(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return ZoneLockdown(builtJavaResource)
}
}
/**
* 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 /
* ```
*/
public class ZoneLockdown internal constructor(
override val javaResource: com.pulumi.cloudflare.ZoneLockdown,
) : KotlinCustomResource(javaResource, ZoneLockdownMapper) {
/**
* A list of IP addresses or IP ranges to match the request against specified in target, value pairs.
*/
public val configurations: Output>
get() = javaResource.configurations().applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 -> toKotlin(args0) })
})
})
/**
* A description about the lockdown entry. Typically used as a reminder or explanation for the lockdown.
*/
public val description: Output?
get() = javaResource.description().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* Boolean of whether this zone lockdown is currently paused. Defaults to `false`.
*/
public val paused: Output?
get() = javaResource.paused().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })
public val priority: Output?
get() = javaResource.priority().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })
/**
* A list of simple wildcard patterns to match requests against. The order of the urls is unimportant.
*/
public val urls: Output>
get() = javaResource.urls().applyValue({ args0 -> args0.map({ args0 -> args0 }) })
/**
* The zone identifier to target for the resource. **Modifying this attribute will force creation of a new resource.**
*/
public val zoneId: Output
get() = javaResource.zoneId().applyValue({ args0 -> args0 })
}
public object ZoneLockdownMapper : ResourceMapper {
override fun supportsMappingOfType(javaResource: Resource): Boolean =
com.pulumi.cloudflare.ZoneLockdown::class == javaResource::class
override fun map(javaResource: Resource): ZoneLockdown = ZoneLockdown(
javaResource as
com.pulumi.cloudflare.ZoneLockdown,
)
}
/**
* @see [ZoneLockdown].
* @param name The _unique_ name of the resulting resource.
* @param block Builder for [ZoneLockdown].
*/
public suspend fun zoneLockdown(
name: String,
block: suspend ZoneLockdownResourceBuilder.() -> Unit,
): ZoneLockdown {
val builder = ZoneLockdownResourceBuilder()
builder.name(name)
block(builder)
return builder.build()
}
/**
* @see [ZoneLockdown].
* @param name The _unique_ name of the resulting resource.
*/
public fun zoneLockdown(name: String): ZoneLockdown {
val builder = ZoneLockdownResourceBuilder()
builder.name(name)
return builder.build()
}