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

com.pulumi.cloudflare.kotlin.DevicePostureRule.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.DevicePostureRuleInput
import com.pulumi.cloudflare.kotlin.outputs.DevicePostureRuleMatch
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.DevicePostureRuleInput.Companion.toKotlin as devicePostureRuleInputToKotlin
import com.pulumi.cloudflare.kotlin.outputs.DevicePostureRuleMatch.Companion.toKotlin as devicePostureRuleMatchToKotlin

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

    public var args: DevicePostureRuleArgs = DevicePostureRuleArgs()

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

/**
 * Provides a Cloudflare Device Posture Rule resource. Device posture rules configure security policies for device posture checks.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as cloudflare from "@pulumi/cloudflare";
 * const eaxmple = new cloudflare.DevicePostureRule("eaxmple", {
 *     accountId: "f037e56e89293a057740de681ac9abbe",
 *     name: "Corporate devices posture rule",
 *     type: "os_version",
 *     description: "Device posture rule for corporate devices.",
 *     schedule: "24h",
 *     expiration: "24h",
 *     matches: [{
 *         platform: "linux",
 *     }],
 *     inputs: [{
 *         id: corporateDevices.id,
 *         version: "1.0.0",
 *         operator: "<",
 *         osDistroName: "ubuntu",
 *         osDistroRevision: "1.0.0",
 *         osVersionExtra: "(a)",
 *     }],
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_cloudflare as cloudflare
 * eaxmple = cloudflare.DevicePostureRule("eaxmple",
 *     account_id="f037e56e89293a057740de681ac9abbe",
 *     name="Corporate devices posture rule",
 *     type="os_version",
 *     description="Device posture rule for corporate devices.",
 *     schedule="24h",
 *     expiration="24h",
 *     matches=[{
 *         "platform": "linux",
 *     }],
 *     inputs=[{
 *         "id": corporate_devices["id"],
 *         "version": "1.0.0",
 *         "operator": "<",
 *         "os_distro_name": "ubuntu",
 *         "os_distro_revision": "1.0.0",
 *         "os_version_extra": "(a)",
 *     }])
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Cloudflare = Pulumi.Cloudflare;
 * return await Deployment.RunAsync(() =>
 * {
 *     var eaxmple = new Cloudflare.DevicePostureRule("eaxmple", new()
 *     {
 *         AccountId = "f037e56e89293a057740de681ac9abbe",
 *         Name = "Corporate devices posture rule",
 *         Type = "os_version",
 *         Description = "Device posture rule for corporate devices.",
 *         Schedule = "24h",
 *         Expiration = "24h",
 *         Matches = new[]
 *         {
 *             new Cloudflare.Inputs.DevicePostureRuleMatchArgs
 *             {
 *                 Platform = "linux",
 *             },
 *         },
 *         Inputs = new[]
 *         {
 *             new Cloudflare.Inputs.DevicePostureRuleInputArgs
 *             {
 *                 Id = corporateDevices.Id,
 *                 Version = "1.0.0",
 *                 Operator = "<",
 *                 OsDistroName = "ubuntu",
 *                 OsDistroRevision = "1.0.0",
 *                 OsVersionExtra = "(a)",
 *             },
 *         },
 *     });
 * });
 * ```
 * ```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.NewDevicePostureRule(ctx, "eaxmple", &cloudflare.DevicePostureRuleArgs{
 * 			AccountId:   pulumi.String("f037e56e89293a057740de681ac9abbe"),
 * 			Name:        pulumi.String("Corporate devices posture rule"),
 * 			Type:        pulumi.String("os_version"),
 * 			Description: pulumi.String("Device posture rule for corporate devices."),
 * 			Schedule:    pulumi.String("24h"),
 * 			Expiration:  pulumi.String("24h"),
 * 			Matches: cloudflare.DevicePostureRuleMatchArray{
 * 				&cloudflare.DevicePostureRuleMatchArgs{
 * 					Platform: pulumi.String("linux"),
 * 				},
 * 			},
 * 			Inputs: cloudflare.DevicePostureRuleInputTypeArray{
 * 				&cloudflare.DevicePostureRuleInputTypeArgs{
 * 					Id:               pulumi.Any(corporateDevices.Id),
 * 					Version:          pulumi.String("1.0.0"),
 * 					Operator:         pulumi.String("<"),
 * 					OsDistroName:     pulumi.String("ubuntu"),
 * 					OsDistroRevision: pulumi.String("1.0.0"),
 * 					OsVersionExtra:   pulumi.String("(a)"),
 * 				},
 * 			},
 * 		})
 * 		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.DevicePostureRule;
 * import com.pulumi.cloudflare.DevicePostureRuleArgs;
 * import com.pulumi.cloudflare.inputs.DevicePostureRuleMatchArgs;
 * import com.pulumi.cloudflare.inputs.DevicePostureRuleInputArgs;
 * 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 eaxmple = new DevicePostureRule("eaxmple", DevicePostureRuleArgs.builder()
 *             .accountId("f037e56e89293a057740de681ac9abbe")
 *             .name("Corporate devices posture rule")
 *             .type("os_version")
 *             .description("Device posture rule for corporate devices.")
 *             .schedule("24h")
 *             .expiration("24h")
 *             .matches(DevicePostureRuleMatchArgs.builder()
 *                 .platform("linux")
 *                 .build())
 *             .inputs(DevicePostureRuleInputArgs.builder()
 *                 .id(corporateDevices.id())
 *                 .version("1.0.0")
 *                 .operator("<")
 *                 .osDistroName("ubuntu")
 *                 .osDistroRevision("1.0.0")
 *                 .osVersionExtra("(a)")
 *                 .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   eaxmple:
 *     type: cloudflare:DevicePostureRule
 *     properties:
 *       accountId: f037e56e89293a057740de681ac9abbe
 *       name: Corporate devices posture rule
 *       type: os_version
 *       description: Device posture rule for corporate devices.
 *       schedule: 24h
 *       expiration: 24h
 *       matches:
 *         - platform: linux
 *       inputs:
 *         - id: ${corporateDevices.id}
 *           version: 1.0.0
 *           operator: <
 *           osDistroName: ubuntu
 *           osDistroRevision: 1.0.0
 *           osVersionExtra: (a)
 * ```
 * 
 * ## Import
 * ```sh
 * $ pulumi import cloudflare:index/devicePostureRule:DevicePostureRule example /
 * ```
 */
public class DevicePostureRule internal constructor(
    override val javaResource: com.pulumi.cloudflare.DevicePostureRule,
) : KotlinCustomResource(javaResource, DevicePostureRuleMapper) {
    /**
     * The account identifier to target for the resource.
     */
    public val accountId: Output
        get() = javaResource.accountId().applyValue({ args0 -> args0 })

    public val description: Output?
        get() = javaResource.description().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Expire posture results after the specified amount of time. Must be in the format `1h` or `30m`. Valid units are `h` and `m`.
     */
    public val expiration: Output?
        get() = javaResource.expiration().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Required for all rule types except `warp`, `gateway`, and `tanium`.
     */
    public val inputs: Output>
        get() = javaResource.inputs().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    devicePostureRuleInputToKotlin(args0)
                })
            })
        })

    /**
     * The conditions that the client must match to run the rule.
     */
    public val matches: Output>?
        get() = javaResource.matches().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.let({ args0 -> devicePostureRuleMatchToKotlin(args0) })
                })
            }).orElse(null)
        })

    /**
     * Name of the device posture rule.
     */
    public val name: Output?
        get() = javaResource.name().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * Tells the client when to run the device posture check. Must be in the format `1h` or `30m`. Valid units are `h` and `m`.
     */
    public val schedule: Output?
        get() = javaResource.schedule().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * The device posture rule type. Available values: `serial_number`, `file`, `application`, `gateway`, `warp`, `domain_joined`, `os_version`, `disk_encryption`, `firewall`, `client_certificate`, `client_certificate_v2`, `workspace_one`, `unique_client_id`, `crowdstrike_s2s`, `sentinelone`, `kolide`, `tanium_s2s`, `intune`, `sentinelone_s2s`, `custom_s2s`.
     */
    public val type: Output
        get() = javaResource.type().applyValue({ args0 -> args0 })
}

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

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy