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

com.pulumi.azure.paloalto.kotlin.LocalRulestackRule.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: 6.15.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.azure.paloalto.kotlin

import com.pulumi.azure.paloalto.kotlin.outputs.LocalRulestackRuleCategory
import com.pulumi.azure.paloalto.kotlin.outputs.LocalRulestackRuleDestination
import com.pulumi.azure.paloalto.kotlin.outputs.LocalRulestackRuleSource
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 kotlin.collections.Map
import com.pulumi.azure.paloalto.kotlin.outputs.LocalRulestackRuleCategory.Companion.toKotlin as localRulestackRuleCategoryToKotlin
import com.pulumi.azure.paloalto.kotlin.outputs.LocalRulestackRuleDestination.Companion.toKotlin as localRulestackRuleDestinationToKotlin
import com.pulumi.azure.paloalto.kotlin.outputs.LocalRulestackRuleSource.Companion.toKotlin as localRulestackRuleSourceToKotlin

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

    public var args: LocalRulestackRuleArgs = LocalRulestackRuleArgs()

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

/**
 * Manages a Palo Alto Local Rulestack Rule.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 * const example = new azure.core.ResourceGroup("example", {
 *     name: "rg-example",
 *     location: "West Europe",
 * });
 * const exampleLocalRulestack = new azure.paloalto.LocalRulestack("example", {
 *     name: "lrs-example",
 *     resourceGroupName: example.name,
 *     location: example.location,
 * });
 * const exampleLocalRulestackRule = new azure.paloalto.LocalRulestackRule("example", {
 *     name: "example-rule",
 *     rulestackId: exampleLocalRulestack.id,
 *     priority: 1000,
 *     action: "Allow",
 *     protocol: "application-default",
 *     applications: ["any"],
 *     source: {
 *         cidrs: ["10.0.0.0/8"],
 *     },
 *     destination: {
 *         cidrs: ["192.168.16.0/24"],
 *     },
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * example = azure.core.ResourceGroup("example",
 *     name="rg-example",
 *     location="West Europe")
 * example_local_rulestack = azure.paloalto.LocalRulestack("example",
 *     name="lrs-example",
 *     resource_group_name=example.name,
 *     location=example.location)
 * example_local_rulestack_rule = azure.paloalto.LocalRulestackRule("example",
 *     name="example-rule",
 *     rulestack_id=example_local_rulestack.id,
 *     priority=1000,
 *     action="Allow",
 *     protocol="application-default",
 *     applications=["any"],
 *     source={
 *         "cidrs": ["10.0.0.0/8"],
 *     },
 *     destination={
 *         "cidrs": ["192.168.16.0/24"],
 *     })
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Azure = Pulumi.Azure;
 * return await Deployment.RunAsync(() =>
 * {
 *     var example = new Azure.Core.ResourceGroup("example", new()
 *     {
 *         Name = "rg-example",
 *         Location = "West Europe",
 *     });
 *     var exampleLocalRulestack = new Azure.PaloAlto.LocalRulestack("example", new()
 *     {
 *         Name = "lrs-example",
 *         ResourceGroupName = example.Name,
 *         Location = example.Location,
 *     });
 *     var exampleLocalRulestackRule = new Azure.PaloAlto.LocalRulestackRule("example", new()
 *     {
 *         Name = "example-rule",
 *         RulestackId = exampleLocalRulestack.Id,
 *         Priority = 1000,
 *         Action = "Allow",
 *         Protocol = "application-default",
 *         Applications = new[]
 *         {
 *             "any",
 *         },
 *         Source = new Azure.PaloAlto.Inputs.LocalRulestackRuleSourceArgs
 *         {
 *             Cidrs = new[]
 *             {
 *                 "10.0.0.0/8",
 *             },
 *         },
 *         Destination = new Azure.PaloAlto.Inputs.LocalRulestackRuleDestinationArgs
 *         {
 *             Cidrs = new[]
 *             {
 *                 "192.168.16.0/24",
 *             },
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/paloalto"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		example, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
 * 			Name:     pulumi.String("rg-example"),
 * 			Location: pulumi.String("West Europe"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleLocalRulestack, err := paloalto.NewLocalRulestack(ctx, "example", &paloalto.LocalRulestackArgs{
 * 			Name:              pulumi.String("lrs-example"),
 * 			ResourceGroupName: example.Name,
 * 			Location:          example.Location,
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = paloalto.NewLocalRulestackRule(ctx, "example", &paloalto.LocalRulestackRuleArgs{
 * 			Name:        pulumi.String("example-rule"),
 * 			RulestackId: exampleLocalRulestack.ID(),
 * 			Priority:    pulumi.Int(1000),
 * 			Action:      pulumi.String("Allow"),
 * 			Protocol:    pulumi.String("application-default"),
 * 			Applications: pulumi.StringArray{
 * 				pulumi.String("any"),
 * 			},
 * 			Source: &paloalto.LocalRulestackRuleSourceArgs{
 * 				Cidrs: pulumi.StringArray{
 * 					pulumi.String("10.0.0.0/8"),
 * 				},
 * 			},
 * 			Destination: &paloalto.LocalRulestackRuleDestinationArgs{
 * 				Cidrs: pulumi.StringArray{
 * 					pulumi.String("192.168.16.0/24"),
 * 				},
 * 			},
 * 		})
 * 		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.azure.core.ResourceGroup;
 * import com.pulumi.azure.core.ResourceGroupArgs;
 * import com.pulumi.azure.paloalto.LocalRulestack;
 * import com.pulumi.azure.paloalto.LocalRulestackArgs;
 * import com.pulumi.azure.paloalto.LocalRulestackRule;
 * import com.pulumi.azure.paloalto.LocalRulestackRuleArgs;
 * import com.pulumi.azure.paloalto.inputs.LocalRulestackRuleSourceArgs;
 * import com.pulumi.azure.paloalto.inputs.LocalRulestackRuleDestinationArgs;
 * 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 ResourceGroup("example", ResourceGroupArgs.builder()
 *             .name("rg-example")
 *             .location("West Europe")
 *             .build());
 *         var exampleLocalRulestack = new LocalRulestack("exampleLocalRulestack", LocalRulestackArgs.builder()
 *             .name("lrs-example")
 *             .resourceGroupName(example.name())
 *             .location(example.location())
 *             .build());
 *         var exampleLocalRulestackRule = new LocalRulestackRule("exampleLocalRulestackRule", LocalRulestackRuleArgs.builder()
 *             .name("example-rule")
 *             .rulestackId(exampleLocalRulestack.id())
 *             .priority(1000)
 *             .action("Allow")
 *             .protocol("application-default")
 *             .applications("any")
 *             .source(LocalRulestackRuleSourceArgs.builder()
 *                 .cidrs("10.0.0.0/8")
 *                 .build())
 *             .destination(LocalRulestackRuleDestinationArgs.builder()
 *                 .cidrs("192.168.16.0/24")
 *                 .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: azure:core:ResourceGroup
 *     properties:
 *       name: rg-example
 *       location: West Europe
 *   exampleLocalRulestack:
 *     type: azure:paloalto:LocalRulestack
 *     name: example
 *     properties:
 *       name: lrs-example
 *       resourceGroupName: ${example.name}
 *       location: ${example.location}
 *   exampleLocalRulestackRule:
 *     type: azure:paloalto:LocalRulestackRule
 *     name: example
 *     properties:
 *       name: example-rule
 *       rulestackId: ${exampleLocalRulestack.id}
 *       priority: 1000
 *       action: Allow
 *       protocol: application-default
 *       applications:
 *         - any
 *       source:
 *         cidrs:
 *           - 10.0.0.0/8
 *       destination:
 *         cidrs:
 *           - 192.168.16.0/24
 * ```
 * 
 * ## Import
 * Palo Alto Local Rulestack Rules can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:paloalto/localRulestackRule:LocalRulestackRule example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/myLocalRulestack/localRules/myRule1
 * ```
 */
public class LocalRulestackRule internal constructor(
    override val javaResource: com.pulumi.azure.paloalto.LocalRulestackRule,
) : KotlinCustomResource(javaResource, LocalRulestackRuleMapper) {
    /**
     * The action to take on the rule being triggered. Possible values are `Allow`, `DenyResetBoth`, `DenyResetServer` and `DenySilent`.
     */
    public val action: Output
        get() = javaResource.action().applyValue({ args0 -> args0 })

    /**
     * Specifies a list of Applications.
     */
    public val applications: Output>
        get() = javaResource.applications().applyValue({ args0 -> args0.map({ args0 -> args0 }) })

    /**
     * The comment for Audit purposes.
     */
    public val auditComment: Output?
        get() = javaResource.auditComment().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * A `category` block as defined below.
     */
    public val category: Output?
        get() = javaResource.category().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    localRulestackRuleCategoryToKotlin(args0)
                })
            }).orElse(null)
        })

    /**
     * The type of Decryption to perform on the rule. Possible values include `SSLInboundInspection`, `SSLOutboundInspection`, and `None`. Defaults to `None`.
     */
    public val decryptionRuleType: Output?
        get() = javaResource.decryptionRuleType().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The description for the rule.
     */
    public val description: Output?
        get() = javaResource.description().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * One or more `destination` blocks as defined below.
     */
    public val destination: Output
        get() = javaResource.destination().applyValue({ args0 ->
            args0.let({ args0 ->
                localRulestackRuleDestinationToKotlin(args0)
            })
        })

    /**
     * Should this Rule be enabled? Defaults to `true`.
     */
    public val enabled: Output?
        get() = javaResource.enabled().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * The ID of the certificate for inbound inspection. Only valid when `decryption_rule_type` is set to `SSLInboundInspection`.
     */
    public val inspectionCertificateId: Output?
        get() = javaResource.inspectionCertificateId().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Should Logging be enabled? Defaults to `false`.
     */
    public val loggingEnabled: Output?
        get() = javaResource.loggingEnabled().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The name which should be used for this Palo Alto Local Rulestack Rule.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * Should the inverse of the Destination configuration be used. Defaults to `false`.
     */
    public val negateDestination: Output?
        get() = javaResource.negateDestination().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Should the inverse of the Source configuration be used. Defaults to `false`.
     */
    public val negateSource: Output?
        get() = javaResource.negateSource().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The Priority of this rule. Rules are executed in numerical order. Changing this forces a new Palo Alto Local Rulestack Rule to be created.
     * > **NOTE:** This is the primary identifier of a rule, as such it is not possible to change the Priority of a rule once created.
     */
    public val priority: Output
        get() = javaResource.priority().applyValue({ args0 -> args0 })

    /**
     * The Protocol and port to use in the form `[protocol]:[port_number]` e.g. `TCP:8080` or `UDP:53`. Conflicts with `protocol_ports`. Defaults to `application-default`.
     * > **NOTE** In 4.0 or later versions, the default of `protocol` will no longer be set by provider, exactly one of `protocol` and `protocol_ports` must be specified. You need to explicitly specify `protocol="application-default"` to keep the the current default of the `protocol`.
     */
    public val protocol: Output?
        get() = javaResource.protocol().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * Specifies a list of Protocol:Port entries. E.g. `[ "TCP:80", "UDP:5431" ]`. Conflicts with `protocol`.
     */
    public val protocolPorts: Output>?
        get() = javaResource.protocolPorts().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 -> args0 })
            }).orElse(null)
        })

    /**
     * The ID of the Local Rulestack in which to create this Rule. Changing this forces a new Palo Alto Local Rulestack Rule to be created.
     */
    public val rulestackId: Output
        get() = javaResource.rulestackId().applyValue({ args0 -> args0 })

    /**
     * One or more `source` blocks as defined below.
     */
    public val source: Output
        get() = javaResource.source().applyValue({ args0 ->
            args0.let({ args0 ->
                localRulestackRuleSourceToKotlin(args0)
            })
        })

    /**
     * A mapping of tags which should be assigned to the Palo Alto Local Rulestack Rule.
     */
    public val tags: Output>?
        get() = javaResource.tags().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.key.to(args0.value)
                }).toMap()
            }).orElse(null)
        })
}

public object LocalRulestackRuleMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.azure.paloalto.LocalRulestackRule::class == javaResource::class

    override fun map(javaResource: Resource): LocalRulestackRule = LocalRulestackRule(
        javaResource as
            com.pulumi.azure.paloalto.LocalRulestackRule,
    )
}

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy