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

com.pulumi.cloudflare.kotlin.ZoneSettingsOverride.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.kotlin.outputs.ZoneSettingsOverrideInitialSetting
import com.pulumi.cloudflare.kotlin.outputs.ZoneSettingsOverrideSettings
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.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import com.pulumi.cloudflare.kotlin.outputs.ZoneSettingsOverrideInitialSetting.Companion.toKotlin as zoneSettingsOverrideInitialSettingToKotlin
import com.pulumi.cloudflare.kotlin.outputs.ZoneSettingsOverrideSettings.Companion.toKotlin as zoneSettingsOverrideSettingsToKotlin

/**
 * Builder for [ZoneSettingsOverride].
 */
@PulumiTagMarker
public class ZoneSettingsOverrideResourceBuilder internal constructor() {
    public var name: String? = null

    public var args: ZoneSettingsOverrideArgs = ZoneSettingsOverrideArgs()

    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 ZoneSettingsOverrideArgsBuilder.() -> Unit) {
        val builder = ZoneSettingsOverrideArgsBuilder()
        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(): ZoneSettingsOverride {
        val builtJavaResource = com.pulumi.cloudflare.ZoneSettingsOverride(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return ZoneSettingsOverride(builtJavaResource)
    }
}

/**
 * Provides a resource which customizes Cloudflare zone settings.
 * > You **should not** use this resource to manage every zone setting. This
 *   resource is only intended to override those which you do not want the default.
 *   Attempting to manage all settings will result in problems with the resource
 *   applying in a consistent manner.
 * ## Plan-Dependent Settings
 * Note that some settings are only available on certain plans. Setting an argument
 * for a feature that is not available on the plan configured for the zone will
 * result in an error:
 * ```
 * Error: invalid zone setting "\" (value: \) found - cannot be set as it is read only
 * ```
 * This is true even when setting the argument to its default value. These values
 * should either be omitted or set to `null` for zones with plans that don't
 * support the feature. See the [plan feature matrices](https://www.cloudflare.com/plans/) for details on
 * feature support by plan.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as cloudflare from "@pulumi/cloudflare";
 * const test = new cloudflare.ZoneSettingsOverride("test", {
 *     zoneId: "0da42c8d2132a9ddaf714f9e7c920711",
 *     settings: {
 *         brotli: "on",
 *         challengeTtl: 2700,
 *         securityLevel: "high",
 *         opportunisticEncryption: "on",
 *         automaticHttpsRewrites: "on",
 *         mirage: "on",
 *         waf: "on",
 *         minify: {
 *             css: "on",
 *             js: "off",
 *             html: "off",
 *         },
 *         securityHeader: {
 *             enabled: true,
 *         },
 *     },
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_cloudflare as cloudflare
 * test = cloudflare.ZoneSettingsOverride("test",
 *     zone_id="0da42c8d2132a9ddaf714f9e7c920711",
 *     settings={
 *         "brotli": "on",
 *         "challenge_ttl": 2700,
 *         "security_level": "high",
 *         "opportunistic_encryption": "on",
 *         "automatic_https_rewrites": "on",
 *         "mirage": "on",
 *         "waf": "on",
 *         "minify": {
 *             "css": "on",
 *             "js": "off",
 *             "html": "off",
 *         },
 *         "security_header": {
 *             "enabled": True,
 *         },
 *     })
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Cloudflare = Pulumi.Cloudflare;
 * return await Deployment.RunAsync(() =>
 * {
 *     var test = new Cloudflare.ZoneSettingsOverride("test", new()
 *     {
 *         ZoneId = "0da42c8d2132a9ddaf714f9e7c920711",
 *         Settings = new Cloudflare.Inputs.ZoneSettingsOverrideSettingsArgs
 *         {
 *             Brotli = "on",
 *             ChallengeTtl = 2700,
 *             SecurityLevel = "high",
 *             OpportunisticEncryption = "on",
 *             AutomaticHttpsRewrites = "on",
 *             Mirage = "on",
 *             Waf = "on",
 *             Minify = new Cloudflare.Inputs.ZoneSettingsOverrideSettingsMinifyArgs
 *             {
 *                 Css = "on",
 *                 Js = "off",
 *                 Html = "off",
 *             },
 *             SecurityHeader = new Cloudflare.Inputs.ZoneSettingsOverrideSettingsSecurityHeaderArgs
 *             {
 *                 Enabled = true,
 *             },
 *         },
 *     });
 * });
 * ```
 * ```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.NewZoneSettingsOverride(ctx, "test", &cloudflare.ZoneSettingsOverrideArgs{
 * 			ZoneId: pulumi.String("0da42c8d2132a9ddaf714f9e7c920711"),
 * 			Settings: &cloudflare.ZoneSettingsOverrideSettingsArgs{
 * 				Brotli:                  pulumi.String("on"),
 * 				ChallengeTtl:            pulumi.Int(2700),
 * 				SecurityLevel:           pulumi.String("high"),
 * 				OpportunisticEncryption: pulumi.String("on"),
 * 				AutomaticHttpsRewrites:  pulumi.String("on"),
 * 				Mirage:                  pulumi.String("on"),
 * 				Waf:                     pulumi.String("on"),
 * 				Minify: &cloudflare.ZoneSettingsOverrideSettingsMinifyArgs{
 * 					Css:  pulumi.String("on"),
 * 					Js:   pulumi.String("off"),
 * 					Html: pulumi.String("off"),
 * 				},
 * 				SecurityHeader: &cloudflare.ZoneSettingsOverrideSettingsSecurityHeaderArgs{
 * 					Enabled: pulumi.Bool(true),
 * 				},
 * 			},
 * 		})
 * 		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.ZoneSettingsOverride;
 * import com.pulumi.cloudflare.ZoneSettingsOverrideArgs;
 * import com.pulumi.cloudflare.inputs.ZoneSettingsOverrideSettingsArgs;
 * import com.pulumi.cloudflare.inputs.ZoneSettingsOverrideSettingsMinifyArgs;
 * import com.pulumi.cloudflare.inputs.ZoneSettingsOverrideSettingsSecurityHeaderArgs;
 * 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 test = new ZoneSettingsOverride("test", ZoneSettingsOverrideArgs.builder()
 *             .zoneId("0da42c8d2132a9ddaf714f9e7c920711")
 *             .settings(ZoneSettingsOverrideSettingsArgs.builder()
 *                 .brotli("on")
 *                 .challengeTtl(2700)
 *                 .securityLevel("high")
 *                 .opportunisticEncryption("on")
 *                 .automaticHttpsRewrites("on")
 *                 .mirage("on")
 *                 .waf("on")
 *                 .minify(ZoneSettingsOverrideSettingsMinifyArgs.builder()
 *                     .css("on")
 *                     .js("off")
 *                     .html("off")
 *                     .build())
 *                 .securityHeader(ZoneSettingsOverrideSettingsSecurityHeaderArgs.builder()
 *                     .enabled(true)
 *                     .build())
 *                 .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   test:
 *     type: cloudflare:ZoneSettingsOverride
 *     properties:
 *       zoneId: 0da42c8d2132a9ddaf714f9e7c920711
 *       settings:
 *         brotli: on
 *         challengeTtl: 2700
 *         securityLevel: high
 *         opportunisticEncryption: on
 *         automaticHttpsRewrites: on
 *         mirage: on
 *         waf: on
 *         minify:
 *           css: on
 *           js: off
 *           html: off
 *         securityHeader:
 *           enabled: true
 * ```
 * 
 */
public class ZoneSettingsOverride internal constructor(
    override val javaResource: com.pulumi.cloudflare.ZoneSettingsOverride,
) : KotlinCustomResource(javaResource, ZoneSettingsOverrideMapper) {
    public val initialSettings: Output>
        get() = javaResource.initialSettings().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> zoneSettingsOverrideInitialSettingToKotlin(args0) })
            })
        })

    public val initialSettingsReadAt: Output
        get() = javaResource.initialSettingsReadAt().applyValue({ args0 -> args0 })

    public val readonlySettings: Output>
        get() = javaResource.readonlySettings().applyValue({ args0 -> args0.map({ args0 -> args0 }) })

    public val settings: Output
        get() = javaResource.settings().applyValue({ args0 ->
            args0.let({ args0 ->
                zoneSettingsOverrideSettingsToKotlin(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 val zoneStatus: Output
        get() = javaResource.zoneStatus().applyValue({ args0 -> args0 })

    public val zoneType: Output
        get() = javaResource.zoneType().applyValue({ args0 -> args0 })
}

public object ZoneSettingsOverrideMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.cloudflare.ZoneSettingsOverride::class == javaResource::class

    override fun map(javaResource: Resource): ZoneSettingsOverride = ZoneSettingsOverride(
        javaResource
            as com.pulumi.cloudflare.ZoneSettingsOverride,
    )
}

/**
 * @see [ZoneSettingsOverride].
 * @param name The _unique_ name of the resulting resource.
 * @param block Builder for [ZoneSettingsOverride].
 */
public suspend fun zoneSettingsOverride(
    name: String,
    block: suspend ZoneSettingsOverrideResourceBuilder.() -> Unit,
): ZoneSettingsOverride {
    val builder = ZoneSettingsOverrideResourceBuilder()
    builder.name(name)
    block(builder)
    return builder.build()
}

/**
 * @see [ZoneSettingsOverride].
 * @param name The _unique_ name of the resulting resource.
 */
public fun zoneSettingsOverride(name: String): ZoneSettingsOverride {
    val builder = ZoneSettingsOverrideResourceBuilder()
    builder.name(name)
    return builder.build()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy