com.pulumi.cloudflare.kotlin.PageRuleArgs.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.
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.cloudflare.kotlin
import com.pulumi.cloudflare.PageRuleArgs.builder
import com.pulumi.cloudflare.kotlin.inputs.PageRuleActionsArgs
import com.pulumi.cloudflare.kotlin.inputs.PageRuleActionsArgsBuilder
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.Int
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.jvm.JvmName
/**
* Provides a Cloudflare page rule resource.
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as cloudflare from "@pulumi/cloudflare";
* // Add a page rule to the domain
* const foobar = new cloudflare.PageRule("foobar", {
* zoneId: cloudflareZoneId,
* target: `sub.${cloudflareZone}/page`,
* priority: 1,
* actions: {
* ssl: "flexible",
* emailObfuscation: "on",
* minifies: [{
* html: "off",
* css: "on",
* js: "on",
* }],
* },
* });
* ```
* ```python
* import pulumi
* import pulumi_cloudflare as cloudflare
* # Add a page rule to the domain
* foobar = cloudflare.PageRule("foobar",
* zone_id=cloudflare_zone_id,
* target=f"sub.{cloudflare_zone}/page",
* priority=1,
* actions={
* "ssl": "flexible",
* "email_obfuscation": "on",
* "minifies": [{
* "html": "off",
* "css": "on",
* "js": "on",
* }],
* })
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Cloudflare = Pulumi.Cloudflare;
* return await Deployment.RunAsync(() =>
* {
* // Add a page rule to the domain
* var foobar = new Cloudflare.PageRule("foobar", new()
* {
* ZoneId = cloudflareZoneId,
* Target = $"sub.{cloudflareZone}/page",
* Priority = 1,
* Actions = new Cloudflare.Inputs.PageRuleActionsArgs
* {
* Ssl = "flexible",
* EmailObfuscation = "on",
* Minifies = new[]
* {
* new Cloudflare.Inputs.PageRuleActionsMinifyArgs
* {
* Html = "off",
* Css = "on",
* Js = "on",
* },
* },
* },
* });
* });
* ```
* ```go
* package main
* import (
* "fmt"
* "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 page rule to the domain
* _, err := cloudflare.NewPageRule(ctx, "foobar", &cloudflare.PageRuleArgs{
* ZoneId: pulumi.Any(cloudflareZoneId),
* Target: pulumi.Sprintf("sub.%v/page", cloudflareZone),
* Priority: pulumi.Int(1),
* Actions: &cloudflare.PageRuleActionsArgs{
* Ssl: pulumi.String("flexible"),
* EmailObfuscation: pulumi.String("on"),
* Minifies: cloudflare.PageRuleActionsMinifyArray{
* &cloudflare.PageRuleActionsMinifyArgs{
* Html: pulumi.String("off"),
* Css: pulumi.String("on"),
* Js: pulumi.String("on"),
* },
* },
* },
* })
* 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.PageRule;
* import com.pulumi.cloudflare.PageRuleArgs;
* import com.pulumi.cloudflare.inputs.PageRuleActionsArgs;
* 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 page rule to the domain
* var foobar = new PageRule("foobar", PageRuleArgs.builder()
* .zoneId(cloudflareZoneId)
* .target(String.format("sub.%s/page", cloudflareZone))
* .priority(1)
* .actions(PageRuleActionsArgs.builder()
* .ssl("flexible")
* .emailObfuscation("on")
* .minifies(PageRuleActionsMinifyArgs.builder()
* .html("off")
* .css("on")
* .js("on")
* .build())
* .build())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* # Add a page rule to the domain
* foobar:
* type: cloudflare:PageRule
* properties:
* zoneId: ${cloudflareZoneId}
* target: sub.${cloudflareZone}/page
* priority: 1
* actions:
* ssl: flexible
* emailObfuscation: on
* minifies:
* - html: off
* css: on
* js: on
* ```
*
* ## Import
* Page rules can be imported using a composite ID formed of zone ID and page rule ID, e.g.
* ```sh
* $ pulumi import cloudflare:index/pageRule:PageRule default d41d8cd98f00b204e9800998ecf8427e/ch8374ftwdghsif43
* ```
* @property actions The actions taken by the page rule, options given below.
* @property priority The priority of the page rule among others for this target, the higher the number the higher the priority as per [API documentation](https://api.cloudflare.com/#page-rules-for-a-zone-create-page-rule).
* @property status Whether the page rule is active or disabled.
* @property target The URL pattern to target with the page rule.
* @property zoneId The DNS zone ID to which the page rule should be added.
*/
public data class PageRuleArgs(
public val actions: Output? = null,
public val priority: Output? = null,
public val status: Output? = null,
public val target: Output? = null,
public val zoneId: Output? = null,
) : ConvertibleToJava {
override fun toJava(): com.pulumi.cloudflare.PageRuleArgs =
com.pulumi.cloudflare.PageRuleArgs.builder()
.actions(actions?.applyValue({ args0 -> args0.let({ args0 -> args0.toJava() }) }))
.priority(priority?.applyValue({ args0 -> args0 }))
.status(status?.applyValue({ args0 -> args0 }))
.target(target?.applyValue({ args0 -> args0 }))
.zoneId(zoneId?.applyValue({ args0 -> args0 })).build()
}
/**
* Builder for [PageRuleArgs].
*/
@PulumiTagMarker
public class PageRuleArgsBuilder internal constructor() {
private var actions: Output? = null
private var priority: Output? = null
private var status: Output? = null
private var target: Output? = null
private var zoneId: Output? = null
/**
* @param value The actions taken by the page rule, options given below.
*/
@JvmName("ooxwuidaqixxrqsk")
public suspend fun actions(`value`: Output) {
this.actions = value
}
/**
* @param value The priority of the page rule among others for this target, the higher the number the higher the priority as per [API documentation](https://api.cloudflare.com/#page-rules-for-a-zone-create-page-rule).
*/
@JvmName("oplsnrutufutbrnj")
public suspend fun priority(`value`: Output) {
this.priority = value
}
/**
* @param value Whether the page rule is active or disabled.
*/
@JvmName("jlxdfoucgmivtwtk")
public suspend fun status(`value`: Output) {
this.status = value
}
/**
* @param value The URL pattern to target with the page rule.
*/
@JvmName("eqmfgskficppcpmq")
public suspend fun target(`value`: Output) {
this.target = value
}
/**
* @param value The DNS zone ID to which the page rule should be added.
*/
@JvmName("xvlrlttpmxytaxwt")
public suspend fun zoneId(`value`: Output) {
this.zoneId = value
}
/**
* @param value The actions taken by the page rule, options given below.
*/
@JvmName("oiocfadvrxmepfsd")
public suspend fun actions(`value`: PageRuleActionsArgs?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.actions = mapped
}
/**
* @param argument The actions taken by the page rule, options given below.
*/
@JvmName("wwxsamarxvppcsko")
public suspend fun actions(argument: suspend PageRuleActionsArgsBuilder.() -> Unit) {
val toBeMapped = PageRuleActionsArgsBuilder().applySuspend { argument() }.build()
val mapped = of(toBeMapped)
this.actions = mapped
}
/**
* @param value The priority of the page rule among others for this target, the higher the number the higher the priority as per [API documentation](https://api.cloudflare.com/#page-rules-for-a-zone-create-page-rule).
*/
@JvmName("eiqhybeqhukyfeyv")
public suspend fun priority(`value`: Int?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.priority = mapped
}
/**
* @param value Whether the page rule is active or disabled.
*/
@JvmName("upjvthsahwkdaxra")
public suspend fun status(`value`: String?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.status = mapped
}
/**
* @param value The URL pattern to target with the page rule.
*/
@JvmName("bbtiwjixleblasgg")
public suspend fun target(`value`: String?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.target = mapped
}
/**
* @param value The DNS zone ID to which the page rule should be added.
*/
@JvmName("adeyggwuxwsdrpyy")
public suspend fun zoneId(`value`: String?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.zoneId = mapped
}
internal fun build(): PageRuleArgs = PageRuleArgs(
actions = actions,
priority = priority,
status = status,
target = target,
zoneId = zoneId,
)
}