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

com.pulumi.cloudflare.kotlin.ZeroTrustGatewayPolicy.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.

The newest version!
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.cloudflare.kotlin

import com.pulumi.cloudflare.kotlin.outputs.ZeroTrustGatewayPolicyRuleSettings
import com.pulumi.cloudflare.kotlin.outputs.ZeroTrustGatewayPolicyRuleSettings.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 [ZeroTrustGatewayPolicy].
 */
@PulumiTagMarker
public class ZeroTrustGatewayPolicyResourceBuilder internal constructor() {
    public var name: String? = null

    public var args: ZeroTrustGatewayPolicyArgs = ZeroTrustGatewayPolicyArgs()

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

/**
 * Provides a Cloudflare Teams rule resource. Teams rules comprise secure web gateway policies.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as cloudflare from "@pulumi/cloudflare";
 * const example = new cloudflare.ZeroTrustGatewayPolicy("example", {
 *     accountId: "f037e56e89293a057740de681ac9abbe",
 *     name: "office",
 *     description: "desc",
 *     precedence: 1,
 *     action: "block",
 *     filters: ["http"],
 *     traffic: "http.request.uri == \"https://www.example.com/malicious\"",
 *     ruleSettings: {
 *         blockPageEnabled: true,
 *         blockPageReason: "access not permitted",
 *     },
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_cloudflare as cloudflare
 * example = cloudflare.ZeroTrustGatewayPolicy("example",
 *     account_id="f037e56e89293a057740de681ac9abbe",
 *     name="office",
 *     description="desc",
 *     precedence=1,
 *     action="block",
 *     filters=["http"],
 *     traffic="http.request.uri == \"https://www.example.com/malicious\"",
 *     rule_settings={
 *         "block_page_enabled": True,
 *         "block_page_reason": "access not permitted",
 *     })
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Cloudflare = Pulumi.Cloudflare;
 * return await Deployment.RunAsync(() =>
 * {
 *     var example = new Cloudflare.ZeroTrustGatewayPolicy("example", new()
 *     {
 *         AccountId = "f037e56e89293a057740de681ac9abbe",
 *         Name = "office",
 *         Description = "desc",
 *         Precedence = 1,
 *         Action = "block",
 *         Filters = new[]
 *         {
 *             "http",
 *         },
 *         Traffic = "http.request.uri == \"https://www.example.com/malicious\"",
 *         RuleSettings = new Cloudflare.Inputs.ZeroTrustGatewayPolicyRuleSettingsArgs
 *         {
 *             BlockPageEnabled = true,
 *             BlockPageReason = "access not permitted",
 *         },
 *     });
 * });
 * ```
 * ```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.NewZeroTrustGatewayPolicy(ctx, "example", &cloudflare.ZeroTrustGatewayPolicyArgs{
 * 			AccountId:   pulumi.String("f037e56e89293a057740de681ac9abbe"),
 * 			Name:        pulumi.String("office"),
 * 			Description: pulumi.String("desc"),
 * 			Precedence:  pulumi.Int(1),
 * 			Action:      pulumi.String("block"),
 * 			Filters: pulumi.StringArray{
 * 				pulumi.String("http"),
 * 			},
 * 			Traffic: pulumi.String("http.request.uri == \"https://www.example.com/malicious\""),
 * 			RuleSettings: &cloudflare.ZeroTrustGatewayPolicyRuleSettingsArgs{
 * 				BlockPageEnabled: pulumi.Bool(true),
 * 				BlockPageReason:  pulumi.String("access not permitted"),
 * 			},
 * 		})
 * 		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.ZeroTrustGatewayPolicy;
 * import com.pulumi.cloudflare.ZeroTrustGatewayPolicyArgs;
 * import com.pulumi.cloudflare.inputs.ZeroTrustGatewayPolicyRuleSettingsArgs;
 * 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 example = new ZeroTrustGatewayPolicy("example", ZeroTrustGatewayPolicyArgs.builder()
 *             .accountId("f037e56e89293a057740de681ac9abbe")
 *             .name("office")
 *             .description("desc")
 *             .precedence(1)
 *             .action("block")
 *             .filters("http")
 *             .traffic("http.request.uri == \"https://www.example.com/malicious\"")
 *             .ruleSettings(ZeroTrustGatewayPolicyRuleSettingsArgs.builder()
 *                 .blockPageEnabled(true)
 *                 .blockPageReason("access not permitted")
 *                 .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: cloudflare:ZeroTrustGatewayPolicy
 *     properties:
 *       accountId: f037e56e89293a057740de681ac9abbe
 *       name: office
 *       description: desc
 *       precedence: 1
 *       action: block
 *       filters:
 *         - http
 *       traffic: http.request.uri == "https://www.example.com/malicious"
 *       ruleSettings:
 *         blockPageEnabled: true
 *         blockPageReason: access not permitted
 * ```
 * 
 * ## Import
 * ```sh
 * $ pulumi import cloudflare:index/zeroTrustGatewayPolicy:ZeroTrustGatewayPolicy example /
 * ```
 */
public class ZeroTrustGatewayPolicy internal constructor(
    override val javaResource: com.pulumi.cloudflare.ZeroTrustGatewayPolicy,
) : KotlinCustomResource(javaResource, ZeroTrustGatewayPolicyMapper) {
    /**
     * The account identifier to target for the resource.
     */
    public val accountId: Output
        get() = javaResource.accountId().applyValue({ args0 -> args0 })

    /**
     * The action executed by matched teams rule. Available values: `allow`, `block`, `safesearch`, `ytrestricted`, `on`, `off`, `scan`, `noscan`, `isolate`, `noisolate`, `override`, `l4_override`, `egress`, `audit_ssh`, `resolve`.
     */
    public val action: Output
        get() = javaResource.action().applyValue({ args0 -> args0 })

    /**
     * The description of the teams rule.
     */
    public val description: Output
        get() = javaResource.description().applyValue({ args0 -> args0 })

    /**
     * The wirefilter expression to be used for device_posture check matching.
     */
    public val devicePosture: Output?
        get() = javaResource.devicePosture().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Indicator of rule enablement.
     */
    public val enabled: Output?
        get() = javaResource.enabled().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * The protocol or layer to evaluate the traffic and identity expressions.
     */
    public val filters: Output>?
        get() = javaResource.filters().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0
                })
            }).orElse(null)
        })

    /**
     * The wirefilter expression to be used for identity matching.
     */
    public val identity: Output?
        get() = javaResource.identity().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * The name of the teams rule.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * The evaluation precedence of the teams rule.
     */
    public val precedence: Output
        get() = javaResource.precedence().applyValue({ args0 -> args0 })

    /**
     * Additional rule settings.
     */
    public val ruleSettings: Output?
        get() = javaResource.ruleSettings().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    toKotlin(args0)
                })
            }).orElse(null)
        })

    /**
     * The wirefilter expression to be used for traffic matching.
     */
    public val traffic: Output?
        get() = javaResource.traffic().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

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

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

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy