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

com.pulumi.cloudflare.kotlin.ZeroTrustDlpProfile.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.ZeroTrustDlpProfileContextAwareness
import com.pulumi.cloudflare.kotlin.outputs.ZeroTrustDlpProfileEntry
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
import com.pulumi.cloudflare.kotlin.outputs.ZeroTrustDlpProfileContextAwareness.Companion.toKotlin as zeroTrustDlpProfileContextAwarenessToKotlin
import com.pulumi.cloudflare.kotlin.outputs.ZeroTrustDlpProfileEntry.Companion.toKotlin as zeroTrustDlpProfileEntryToKotlin

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

    public var args: ZeroTrustDlpProfileArgs = ZeroTrustDlpProfileArgs()

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

/**
 * Provides a Cloudflare DLP Profile resource. Data Loss Prevention profiles
 * are a set of entries that can be matched in HTTP bodies or files.
 * They are referenced in Zero Trust Gateway rules.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as cloudflare from "@pulumi/cloudflare";
 * // Predefined profile must be imported, cannot be created
 * const creds = new cloudflare.ZeroTrustDlpProfile("creds", {
 *     accountId: "f037e56e89293a057740de681ac9abbe",
 *     name: "Credentials and Secrets",
 *     type: "predefined",
 *     allowedMatchCount: 3,
 *     entries: [
 *         {
 *             enabled: true,
 *             name: "Amazon AWS Access Key ID",
 *             id: "d8fcfc9c-773c-405e-8426-21ecbb67ba93",
 *         },
 *         {
 *             enabled: false,
 *             id: "2c0e33e1-71da-40c8-aad3-32e674ad3d96",
 *             name: "Amazon AWS Secret Access Key",
 *         },
 *         {
 *             enabled: true,
 *             id: "4e92c006-3802-4dff-bbe1-8e1513b1c92a",
 *             name: "Microsoft Azure Client Secret",
 *         },
 *         {
 *             enabled: false,
 *             id: "5c713294-2375-4904-abcf-e4a15be4d592",
 *             name: "SSH Private Key",
 *         },
 *         {
 *             enabled: true,
 *             id: "6c6579e4-d832-42d5-905c-8e53340930f2",
 *             name: "Google GCP API Key",
 *         },
 *     ],
 * });
 * // Custom profile
 * const exampleCustom = new cloudflare.ZeroTrustDlpProfile("example_custom", {
 *     accountId: "f037e56e89293a057740de681ac9abbe",
 *     name: "Example Custom Profile",
 *     description: "A profile with example entries",
 *     type: "custom",
 *     allowedMatchCount: 0,
 *     entries: [
 *         {
 *             name: "Matches visa credit cards",
 *             enabled: true,
 *             pattern: {
 *                 regex: "4\\d{3}([-\\. ])?\\d{4}([-\\. ])?\\d{4}([-\\. ])?\\d{4}",
 *                 validation: "luhn",
 *             },
 *         },
 *         {
 *             name: "Matches diners club card",
 *             enabled: true,
 *             pattern: {
 *                 regex: "(?:0[0-5]|[68][0-9])[0-9]{11}",
 *                 validation: "luhn",
 *             },
 *         },
 *     ],
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_cloudflare as cloudflare
 * # Predefined profile must be imported, cannot be created
 * creds = cloudflare.ZeroTrustDlpProfile("creds",
 *     account_id="f037e56e89293a057740de681ac9abbe",
 *     name="Credentials and Secrets",
 *     type="predefined",
 *     allowed_match_count=3,
 *     entries=[
 *         {
 *             "enabled": True,
 *             "name": "Amazon AWS Access Key ID",
 *             "id": "d8fcfc9c-773c-405e-8426-21ecbb67ba93",
 *         },
 *         {
 *             "enabled": False,
 *             "id": "2c0e33e1-71da-40c8-aad3-32e674ad3d96",
 *             "name": "Amazon AWS Secret Access Key",
 *         },
 *         {
 *             "enabled": True,
 *             "id": "4e92c006-3802-4dff-bbe1-8e1513b1c92a",
 *             "name": "Microsoft Azure Client Secret",
 *         },
 *         {
 *             "enabled": False,
 *             "id": "5c713294-2375-4904-abcf-e4a15be4d592",
 *             "name": "SSH Private Key",
 *         },
 *         {
 *             "enabled": True,
 *             "id": "6c6579e4-d832-42d5-905c-8e53340930f2",
 *             "name": "Google GCP API Key",
 *         },
 *     ])
 * # Custom profile
 * example_custom = cloudflare.ZeroTrustDlpProfile("example_custom",
 *     account_id="f037e56e89293a057740de681ac9abbe",
 *     name="Example Custom Profile",
 *     description="A profile with example entries",
 *     type="custom",
 *     allowed_match_count=0,
 *     entries=[
 *         {
 *             "name": "Matches visa credit cards",
 *             "enabled": True,
 *             "pattern": {
 *                 "regex": "4\\d{3}([-\\. ])?\\d{4}([-\\. ])?\\d{4}([-\\. ])?\\d{4}",
 *                 "validation": "luhn",
 *             },
 *         },
 *         {
 *             "name": "Matches diners club card",
 *             "enabled": True,
 *             "pattern": {
 *                 "regex": "(?:0[0-5]|[68][0-9])[0-9]{11}",
 *                 "validation": "luhn",
 *             },
 *         },
 *     ])
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Cloudflare = Pulumi.Cloudflare;
 * return await Deployment.RunAsync(() =>
 * {
 *     // Predefined profile must be imported, cannot be created
 *     var creds = new Cloudflare.ZeroTrustDlpProfile("creds", new()
 *     {
 *         AccountId = "f037e56e89293a057740de681ac9abbe",
 *         Name = "Credentials and Secrets",
 *         Type = "predefined",
 *         AllowedMatchCount = 3,
 *         Entries = new[]
 *         {
 *             new Cloudflare.Inputs.ZeroTrustDlpProfileEntryArgs
 *             {
 *                 Enabled = true,
 *                 Name = "Amazon AWS Access Key ID",
 *                 Id = "d8fcfc9c-773c-405e-8426-21ecbb67ba93",
 *             },
 *             new Cloudflare.Inputs.ZeroTrustDlpProfileEntryArgs
 *             {
 *                 Enabled = false,
 *                 Id = "2c0e33e1-71da-40c8-aad3-32e674ad3d96",
 *                 Name = "Amazon AWS Secret Access Key",
 *             },
 *             new Cloudflare.Inputs.ZeroTrustDlpProfileEntryArgs
 *             {
 *                 Enabled = true,
 *                 Id = "4e92c006-3802-4dff-bbe1-8e1513b1c92a",
 *                 Name = "Microsoft Azure Client Secret",
 *             },
 *             new Cloudflare.Inputs.ZeroTrustDlpProfileEntryArgs
 *             {
 *                 Enabled = false,
 *                 Id = "5c713294-2375-4904-abcf-e4a15be4d592",
 *                 Name = "SSH Private Key",
 *             },
 *             new Cloudflare.Inputs.ZeroTrustDlpProfileEntryArgs
 *             {
 *                 Enabled = true,
 *                 Id = "6c6579e4-d832-42d5-905c-8e53340930f2",
 *                 Name = "Google GCP API Key",
 *             },
 *         },
 *     });
 *     // Custom profile
 *     var exampleCustom = new Cloudflare.ZeroTrustDlpProfile("example_custom", new()
 *     {
 *         AccountId = "f037e56e89293a057740de681ac9abbe",
 *         Name = "Example Custom Profile",
 *         Description = "A profile with example entries",
 *         Type = "custom",
 *         AllowedMatchCount = 0,
 *         Entries = new[]
 *         {
 *             new Cloudflare.Inputs.ZeroTrustDlpProfileEntryArgs
 *             {
 *                 Name = "Matches visa credit cards",
 *                 Enabled = true,
 *                 Pattern = new Cloudflare.Inputs.ZeroTrustDlpProfileEntryPatternArgs
 *                 {
 *                     Regex = "4\\d{3}([-\\. ])?\\d{4}([-\\. ])?\\d{4}([-\\. ])?\\d{4}",
 *                     Validation = "luhn",
 *                 },
 *             },
 *             new Cloudflare.Inputs.ZeroTrustDlpProfileEntryArgs
 *             {
 *                 Name = "Matches diners club card",
 *                 Enabled = true,
 *                 Pattern = new Cloudflare.Inputs.ZeroTrustDlpProfileEntryPatternArgs
 *                 {
 *                     Regex = "(?:0[0-5]|[68][0-9])[0-9]{11}",
 *                     Validation = "luhn",
 *                 },
 *             },
 *         },
 *     });
 * });
 * ```
 * ```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 {
 * 		// Predefined profile must be imported, cannot be created
 * 		_, err := cloudflare.NewZeroTrustDlpProfile(ctx, "creds", &cloudflare.ZeroTrustDlpProfileArgs{
 * 			AccountId:         pulumi.String("f037e56e89293a057740de681ac9abbe"),
 * 			Name:              pulumi.String("Credentials and Secrets"),
 * 			Type:              pulumi.String("predefined"),
 * 			AllowedMatchCount: pulumi.Int(3),
 * 			Entries: cloudflare.ZeroTrustDlpProfileEntryArray{
 * 				&cloudflare.ZeroTrustDlpProfileEntryArgs{
 * 					Enabled: pulumi.Bool(true),
 * 					Name:    pulumi.String("Amazon AWS Access Key ID"),
 * 					Id:      pulumi.String("d8fcfc9c-773c-405e-8426-21ecbb67ba93"),
 * 				},
 * 				&cloudflare.ZeroTrustDlpProfileEntryArgs{
 * 					Enabled: pulumi.Bool(false),
 * 					Id:      pulumi.String("2c0e33e1-71da-40c8-aad3-32e674ad3d96"),
 * 					Name:    pulumi.String("Amazon AWS Secret Access Key"),
 * 				},
 * 				&cloudflare.ZeroTrustDlpProfileEntryArgs{
 * 					Enabled: pulumi.Bool(true),
 * 					Id:      pulumi.String("4e92c006-3802-4dff-bbe1-8e1513b1c92a"),
 * 					Name:    pulumi.String("Microsoft Azure Client Secret"),
 * 				},
 * 				&cloudflare.ZeroTrustDlpProfileEntryArgs{
 * 					Enabled: pulumi.Bool(false),
 * 					Id:      pulumi.String("5c713294-2375-4904-abcf-e4a15be4d592"),
 * 					Name:    pulumi.String("SSH Private Key"),
 * 				},
 * 				&cloudflare.ZeroTrustDlpProfileEntryArgs{
 * 					Enabled: pulumi.Bool(true),
 * 					Id:      pulumi.String("6c6579e4-d832-42d5-905c-8e53340930f2"),
 * 					Name:    pulumi.String("Google GCP API Key"),
 * 				},
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		// Custom profile
 * 		_, err = cloudflare.NewZeroTrustDlpProfile(ctx, "example_custom", &cloudflare.ZeroTrustDlpProfileArgs{
 * 			AccountId:         pulumi.String("f037e56e89293a057740de681ac9abbe"),
 * 			Name:              pulumi.String("Example Custom Profile"),
 * 			Description:       pulumi.String("A profile with example entries"),
 * 			Type:              pulumi.String("custom"),
 * 			AllowedMatchCount: pulumi.Int(0),
 * 			Entries: cloudflare.ZeroTrustDlpProfileEntryArray{
 * 				&cloudflare.ZeroTrustDlpProfileEntryArgs{
 * 					Name:    pulumi.String("Matches visa credit cards"),
 * 					Enabled: pulumi.Bool(true),
 * 					Pattern: &cloudflare.ZeroTrustDlpProfileEntryPatternArgs{
 * 						Regex:      pulumi.String("4\\d{3}([-\\. ])?\\d{4}([-\\. ])?\\d{4}([-\\. ])?\\d{4}"),
 * 						Validation: pulumi.String("luhn"),
 * 					},
 * 				},
 * 				&cloudflare.ZeroTrustDlpProfileEntryArgs{
 * 					Name:    pulumi.String("Matches diners club card"),
 * 					Enabled: pulumi.Bool(true),
 * 					Pattern: &cloudflare.ZeroTrustDlpProfileEntryPatternArgs{
 * 						Regex:      pulumi.String("(?:0[0-5]|[68][0-9])[0-9]{11}"),
 * 						Validation: pulumi.String("luhn"),
 * 					},
 * 				},
 * 			},
 * 		})
 * 		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.ZeroTrustDlpProfile;
 * import com.pulumi.cloudflare.ZeroTrustDlpProfileArgs;
 * import com.pulumi.cloudflare.inputs.ZeroTrustDlpProfileEntryArgs;
 * import com.pulumi.cloudflare.inputs.ZeroTrustDlpProfileEntryPatternArgs;
 * 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) {
 *         // Predefined profile must be imported, cannot be created
 *         var creds = new ZeroTrustDlpProfile("creds", ZeroTrustDlpProfileArgs.builder()
 *             .accountId("f037e56e89293a057740de681ac9abbe")
 *             .name("Credentials and Secrets")
 *             .type("predefined")
 *             .allowedMatchCount(3)
 *             .entries(
 *                 ZeroTrustDlpProfileEntryArgs.builder()
 *                     .enabled(true)
 *                     .name("Amazon AWS Access Key ID")
 *                     .id("d8fcfc9c-773c-405e-8426-21ecbb67ba93")
 *                     .build(),
 *                 ZeroTrustDlpProfileEntryArgs.builder()
 *                     .enabled(false)
 *                     .id("2c0e33e1-71da-40c8-aad3-32e674ad3d96")
 *                     .name("Amazon AWS Secret Access Key")
 *                     .build(),
 *                 ZeroTrustDlpProfileEntryArgs.builder()
 *                     .enabled(true)
 *                     .id("4e92c006-3802-4dff-bbe1-8e1513b1c92a")
 *                     .name("Microsoft Azure Client Secret")
 *                     .build(),
 *                 ZeroTrustDlpProfileEntryArgs.builder()
 *                     .enabled(false)
 *                     .id("5c713294-2375-4904-abcf-e4a15be4d592")
 *                     .name("SSH Private Key")
 *                     .build(),
 *                 ZeroTrustDlpProfileEntryArgs.builder()
 *                     .enabled(true)
 *                     .id("6c6579e4-d832-42d5-905c-8e53340930f2")
 *                     .name("Google GCP API Key")
 *                     .build())
 *             .build());
 *         // Custom profile
 *         var exampleCustom = new ZeroTrustDlpProfile("exampleCustom", ZeroTrustDlpProfileArgs.builder()
 *             .accountId("f037e56e89293a057740de681ac9abbe")
 *             .name("Example Custom Profile")
 *             .description("A profile with example entries")
 *             .type("custom")
 *             .allowedMatchCount(0)
 *             .entries(
 *                 ZeroTrustDlpProfileEntryArgs.builder()
 *                     .name("Matches visa credit cards")
 *                     .enabled(true)
 *                     .pattern(ZeroTrustDlpProfileEntryPatternArgs.builder()
 *                         .regex("4\\d{3}([-\\. ])?\\d{4}([-\\. ])?\\d{4}([-\\. ])?\\d{4}")
 *                         .validation("luhn")
 *                         .build())
 *                     .build(),
 *                 ZeroTrustDlpProfileEntryArgs.builder()
 *                     .name("Matches diners club card")
 *                     .enabled(true)
 *                     .pattern(ZeroTrustDlpProfileEntryPatternArgs.builder()
 *                         .regex("(?:0[0-5]|[68][0-9])[0-9]{11}")
 *                         .validation("luhn")
 *                         .build())
 *                     .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   # Predefined profile must be imported, cannot be created
 *   creds:
 *     type: cloudflare:ZeroTrustDlpProfile
 *     properties:
 *       accountId: f037e56e89293a057740de681ac9abbe
 *       name: Credentials and Secrets
 *       type: predefined
 *       allowedMatchCount: 3
 *       entries:
 *         - enabled: true
 *           name: Amazon AWS Access Key ID
 *           id: d8fcfc9c-773c-405e-8426-21ecbb67ba93
 *         - enabled: false
 *           id: 2c0e33e1-71da-40c8-aad3-32e674ad3d96
 *           name: Amazon AWS Secret Access Key
 *         - enabled: true
 *           id: 4e92c006-3802-4dff-bbe1-8e1513b1c92a
 *           name: Microsoft Azure Client Secret
 *         - enabled: false
 *           id: 5c713294-2375-4904-abcf-e4a15be4d592
 *           name: SSH Private Key
 *         - enabled: true
 *           id: 6c6579e4-d832-42d5-905c-8e53340930f2
 *           name: Google GCP API Key
 *   # Custom profile
 *   exampleCustom:
 *     type: cloudflare:ZeroTrustDlpProfile
 *     name: example_custom
 *     properties:
 *       accountId: f037e56e89293a057740de681ac9abbe
 *       name: Example Custom Profile
 *       description: A profile with example entries
 *       type: custom
 *       allowedMatchCount: 0
 *       entries:
 *         - name: Matches visa credit cards
 *           enabled: true
 *           pattern:
 *             regex: 4\d{3}([-\. ])?\d{4}([-\. ])?\d{4}([-\. ])?\d{4}
 *             validation: luhn
 *         - name: Matches diners club card
 *           enabled: true
 *           pattern:
 *             regex: (?:0[0-5]|[68][0-9])[0-9]{11}
 *             validation: luhn
 * ```
 * 
 * ## Import
 * ```sh
 * $ pulumi import cloudflare:index/zeroTrustDlpProfile:ZeroTrustDlpProfile example /
 * ```
 */
public class ZeroTrustDlpProfile internal constructor(
    override val javaResource: com.pulumi.cloudflare.ZeroTrustDlpProfile,
) : KotlinCustomResource(javaResource, ZeroTrustDlpProfileMapper) {
    /**
     * The account identifier to target for the resource. **Modifying this attribute will force creation of a new resource.**
     */
    public val accountId: Output
        get() = javaResource.accountId().applyValue({ args0 -> args0 })

    /**
     * Related DLP policies will trigger when the match count exceeds the number set.
     */
    public val allowedMatchCount: Output
        get() = javaResource.allowedMatchCount().applyValue({ args0 -> args0 })

    /**
     * Scan the context of predefined entries to only return matches surrounded by keywords.
     */
    public val contextAwareness: Output
        get() = javaResource.contextAwareness().applyValue({ args0 ->
            args0.let({ args0 ->
                zeroTrustDlpProfileContextAwarenessToKotlin(args0)
            })
        })

    /**
     * Brief summary of the profile and its intended use.
     */
    public val description: Output?
        get() = javaResource.description().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * List of entries to apply to the profile.
     */
    public val entries: Output>
        get() = javaResource.entries().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    zeroTrustDlpProfileEntryToKotlin(args0)
                })
            })
        })

    /**
     * Name of the profile. **Modifying this attribute will force creation of a new resource.**
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * If true, scan images via OCR to determine if any text present matches filters.
     */
    public val ocrEnabled: Output?
        get() = javaResource.ocrEnabled().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The type of the profile. Available values: `custom`, `predefined`. **Modifying this attribute will force creation of a new resource.**
     */
    public val type: Output
        get() = javaResource.type().applyValue({ args0 -> args0 })
}

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

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy