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

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

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

    public var args: DeviceSettingsPolicyArgs = DeviceSettingsPolicyArgs()

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

/**
 * Provides a Cloudflare Device Settings Policy resource. Device policies configure settings applied to WARP devices.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as cloudflare from "@pulumi/cloudflare";
 * const developerWarpPolicy = new cloudflare.DeviceSettingsPolicy("developer_warp_policy", {
 *     accountId: "f037e56e89293a057740de681ac9abbe",
 *     name: "Developers WARP settings policy",
 *     description: "Developers WARP settings policy description",
 *     precedence: 10,
 *     match: "any(identity.groups.name[*] in {\"Developers\"})",
 *     "default": false,
 *     enabled: true,
 *     allowModeSwitch: true,
 *     allowUpdates: true,
 *     allowedToLeave: true,
 *     autoConnect: 0,
 *     captivePortal: 5,
 *     disableAutoFallback: true,
 *     supportUrl: "https://cloudflare.com",
 *     switchLocked: true,
 *     serviceModeV2Mode: "warp",
 *     serviceModeV2Port: 3000,
 *     excludeOfficeIps: false,
 *     tunnelProtocol: "wireguard",
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_cloudflare as cloudflare
 * developer_warp_policy = cloudflare.DeviceSettingsPolicy("developer_warp_policy",
 *     account_id="f037e56e89293a057740de681ac9abbe",
 *     name="Developers WARP settings policy",
 *     description="Developers WARP settings policy description",
 *     precedence=10,
 *     match="any(identity.groups.name[*] in {\"Developers\"})",
 *     default=False,
 *     enabled=True,
 *     allow_mode_switch=True,
 *     allow_updates=True,
 *     allowed_to_leave=True,
 *     auto_connect=0,
 *     captive_portal=5,
 *     disable_auto_fallback=True,
 *     support_url="https://cloudflare.com",
 *     switch_locked=True,
 *     service_mode_v2_mode="warp",
 *     service_mode_v2_port=3000,
 *     exclude_office_ips=False,
 *     tunnel_protocol="wireguard")
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Cloudflare = Pulumi.Cloudflare;
 * return await Deployment.RunAsync(() =>
 * {
 *     var developerWarpPolicy = new Cloudflare.DeviceSettingsPolicy("developer_warp_policy", new()
 *     {
 *         AccountId = "f037e56e89293a057740de681ac9abbe",
 *         Name = "Developers WARP settings policy",
 *         Description = "Developers WARP settings policy description",
 *         Precedence = 10,
 *         Match = "any(identity.groups.name[*] in {\"Developers\"})",
 *         Default = false,
 *         Enabled = true,
 *         AllowModeSwitch = true,
 *         AllowUpdates = true,
 *         AllowedToLeave = true,
 *         AutoConnect = 0,
 *         CaptivePortal = 5,
 *         DisableAutoFallback = true,
 *         SupportUrl = "https://cloudflare.com",
 *         SwitchLocked = true,
 *         ServiceModeV2Mode = "warp",
 *         ServiceModeV2Port = 3000,
 *         ExcludeOfficeIps = false,
 *         TunnelProtocol = "wireguard",
 *     });
 * });
 * ```
 * ```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.NewDeviceSettingsPolicy(ctx, "developer_warp_policy", &cloudflare.DeviceSettingsPolicyArgs{
 * 			AccountId:           pulumi.String("f037e56e89293a057740de681ac9abbe"),
 * 			Name:                pulumi.String("Developers WARP settings policy"),
 * 			Description:         pulumi.String("Developers WARP settings policy description"),
 * 			Precedence:          pulumi.Int(10),
 * 			Match:               pulumi.String("any(identity.groups.name[*] in {\"Developers\"})"),
 * 			Default:             pulumi.Bool(false),
 * 			Enabled:             pulumi.Bool(true),
 * 			AllowModeSwitch:     pulumi.Bool(true),
 * 			AllowUpdates:        pulumi.Bool(true),
 * 			AllowedToLeave:      pulumi.Bool(true),
 * 			AutoConnect:         pulumi.Int(0),
 * 			CaptivePortal:       pulumi.Int(5),
 * 			DisableAutoFallback: pulumi.Bool(true),
 * 			SupportUrl:          pulumi.String("https://cloudflare.com"),
 * 			SwitchLocked:        pulumi.Bool(true),
 * 			ServiceModeV2Mode:   pulumi.String("warp"),
 * 			ServiceModeV2Port:   pulumi.Int(3000),
 * 			ExcludeOfficeIps:    pulumi.Bool(false),
 * 			TunnelProtocol:      pulumi.String("wireguard"),
 * 		})
 * 		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.DeviceSettingsPolicy;
 * import com.pulumi.cloudflare.DeviceSettingsPolicyArgs;
 * 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 developerWarpPolicy = new DeviceSettingsPolicy("developerWarpPolicy", DeviceSettingsPolicyArgs.builder()
 *             .accountId("f037e56e89293a057740de681ac9abbe")
 *             .name("Developers WARP settings policy")
 *             .description("Developers WARP settings policy description")
 *             .precedence(10)
 *             .match("any(identity.groups.name[*] in {\"Developers\"})")
 *             .default_(false)
 *             .enabled(true)
 *             .allowModeSwitch(true)
 *             .allowUpdates(true)
 *             .allowedToLeave(true)
 *             .autoConnect(0)
 *             .captivePortal(5)
 *             .disableAutoFallback(true)
 *             .supportUrl("https://cloudflare.com")
 *             .switchLocked(true)
 *             .serviceModeV2Mode("warp")
 *             .serviceModeV2Port(3000)
 *             .excludeOfficeIps(false)
 *             .tunnelProtocol("wireguard")
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   developerWarpPolicy:
 *     type: cloudflare:DeviceSettingsPolicy
 *     name: developer_warp_policy
 *     properties:
 *       accountId: f037e56e89293a057740de681ac9abbe
 *       name: Developers WARP settings policy
 *       description: Developers WARP settings policy description
 *       precedence: 10
 *       match: any(identity.groups.name[*] in {"Developers"})
 *       default: false
 *       enabled: true
 *       allowModeSwitch: true
 *       allowUpdates: true
 *       allowedToLeave: true
 *       autoConnect: 0
 *       captivePortal: 5
 *       disableAutoFallback: true
 *       supportUrl: https://cloudflare.com
 *       switchLocked: true
 *       serviceModeV2Mode: warp
 *       serviceModeV2Port: 3000
 *       excludeOfficeIps: false
 *       tunnelProtocol: wireguard
 * ```
 * 
 * ## Import
 * For default device settings policies you must use "default" as the policy ID.
 * ```sh
 * $ pulumi import cloudflare:index/deviceSettingsPolicy:DeviceSettingsPolicy example /
 * ```
 */
public class DeviceSettingsPolicy internal constructor(
    override val javaResource: com.pulumi.cloudflare.DeviceSettingsPolicy,
) : KotlinCustomResource(javaResource, DeviceSettingsPolicyMapper) {
    /**
     * The account identifier to target for the resource.
     */
    public val accountId: Output
        get() = javaResource.accountId().applyValue({ args0 -> args0 })

    /**
     * Whether to allow mode switch for this policy.
     */
    public val allowModeSwitch: Output?
        get() = javaResource.allowModeSwitch().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Whether to allow updates under this policy.
     */
    public val allowUpdates: Output?
        get() = javaResource.allowUpdates().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Whether to allow devices to leave the organization. Defaults to `true`.
     */
    public val allowedToLeave: Output?
        get() = javaResource.allowedToLeave().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The amount of time in seconds to reconnect after having been disabled.
     */
    public val autoConnect: Output?
        get() = javaResource.autoConnect().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The captive portal value for this policy. Defaults to `180`.
     */
    public val captivePortal: Output?
        get() = javaResource.captivePortal().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Whether the policy refers to the default account policy.
     */
    public val default: Output?
        get() = javaResource.default_().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * Description of Policy.
     */
    public val description: Output
        get() = javaResource.description().applyValue({ args0 -> args0 })

    /**
     * Whether to disable auto fallback for this policy.
     */
    public val disableAutoFallback: Output?
        get() = javaResource.disableAutoFallback().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Whether the policy is enabled (cannot be set for default policies). Defaults to `true`.
     */
    public val enabled: Output?
        get() = javaResource.enabled().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * Whether to add Microsoft IPs to split tunnel exclusions.
     */
    public val excludeOfficeIps: Output?
        get() = javaResource.excludeOfficeIps().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Wirefilter expression to match a device against when evaluating whether this policy should take effect for that device.
     */
    public val match: Output?
        get() = javaResource.match().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

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

    /**
     * The precedence of the policy. Lower values indicate higher precedence.
     */
    public val precedence: Output?
        get() = javaResource.precedence().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The service mode. Available values: `1dot1`, `warp`, `proxy`, `posture_only`, `warp_tunnel_only`. Defaults to `warp`.
     */
    public val serviceModeV2Mode: Output?
        get() = javaResource.serviceModeV2Mode().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The port to use for the proxy service mode. Required when using `service_mode_v2_mode`.
     */
    public val serviceModeV2Port: Output?
        get() = javaResource.serviceModeV2Port().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The support URL that will be opened when sending feedback.
     */
    public val supportUrl: Output?
        get() = javaResource.supportUrl().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Enablement of the ZT client switch lock.
     */
    public val switchLocked: Output?
        get() = javaResource.switchLocked().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Determines which tunnel protocol to use. Available values: `""`, `wireguard`, `masque`. Defaults to `wireguard`.
     */
    public val tunnelProtocol: Output?
        get() = javaResource.tunnelProtocol().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })
}

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

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy