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

com.pulumi.gcp.compute.kotlin.FirewallPolicy.kt Maven / Gradle / Ivy

@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.gcp.compute.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 [FirewallPolicy].
 */
@PulumiTagMarker
public class FirewallPolicyResourceBuilder internal constructor() {
    public var name: String? = null

    public var args: FirewallPolicyArgs = FirewallPolicyArgs()

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

/**
 * Hierarchical firewall policy rules let you create and enforce a consistent firewall policy across your organization. Rules can explicitly allow or deny connections or delegate evaluation to lower level policies. Policies can be created within organizations or folders.
 * This resource should be generally be used with `gcp.compute.FirewallPolicyAssociation` and `gcp.compute.FirewallPolicyRule`
 * For more information see the [official documentation](https://cloud.google.com/vpc/docs/firewall-policies)
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const _default = new gcp.compute.FirewallPolicy("default", {
 *     parent: "organizations/12345",
 *     shortName: "my-policy",
 *     description: "Example Resource",
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * default = gcp.compute.FirewallPolicy("default",
 *     parent="organizations/12345",
 *     short_name="my-policy",
 *     description="Example Resource")
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var @default = new Gcp.Compute.FirewallPolicy("default", new()
 *     {
 *         Parent = "organizations/12345",
 *         ShortName = "my-policy",
 *         Description = "Example Resource",
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/compute"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := compute.NewFirewallPolicy(ctx, "default", &compute.FirewallPolicyArgs{
 * 			Parent:      pulumi.String("organizations/12345"),
 * 			ShortName:   pulumi.String("my-policy"),
 * 			Description: pulumi.String("Example Resource"),
 * 		})
 * 		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.gcp.compute.FirewallPolicy;
 * import com.pulumi.gcp.compute.FirewallPolicyArgs;
 * 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 default_ = new FirewallPolicy("default", FirewallPolicyArgs.builder()
 *             .parent("organizations/12345")
 *             .shortName("my-policy")
 *             .description("Example Resource")
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   default:
 *     type: gcp:compute:FirewallPolicy
 *     properties:
 *       parent: organizations/12345
 *       shortName: my-policy
 *       description: Example Resource
 * ```
 * 
 * ## Import
 * FirewallPolicy can be imported using any of these accepted formats:
 * ```sh
 * $ pulumi import gcp:compute/firewallPolicy:FirewallPolicy default locations/global/firewallPolicies/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:compute/firewallPolicy:FirewallPolicy default {{name}}
 * ```
 */
public class FirewallPolicy internal constructor(
    override val javaResource: com.pulumi.gcp.compute.FirewallPolicy,
) : KotlinCustomResource(javaResource, FirewallPolicyMapper) {
    /**
     * Creation timestamp in RFC3339 text format.
     */
    public val creationTimestamp: Output
        get() = javaResource.creationTimestamp().applyValue({ args0 -> args0 })

    /**
     * An optional description of this resource. Provide this property when you create the resource.
     */
    public val description: Output?
        get() = javaResource.description().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Fingerprint of the resource. This field is used internally during updates of this resource.
     */
    public val fingerprint: Output
        get() = javaResource.fingerprint().applyValue({ args0 -> args0 })

    /**
     * The unique identifier for the resource. This identifier is defined by the server.
     */
    public val firewallPolicyId: Output
        get() = javaResource.firewallPolicyId().applyValue({ args0 -> args0 })

    /**
     * Name of the resource. It is a numeric ID allocated by GCP which uniquely identifies the Firewall Policy.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

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

    /**
     * Total count of all firewall policy rule tuples. A firewall policy can not exceed a set number of tuples.
     */
    public val ruleTupleCount: Output
        get() = javaResource.ruleTupleCount().applyValue({ args0 -> args0 })

    /**
     * Server-defined URL for the resource.
     */
    public val selfLink: Output
        get() = javaResource.selfLink().applyValue({ args0 -> args0 })

    /**
     * Server-defined URL for this resource with the resource id.
     */
    public val selfLinkWithId: Output
        get() = javaResource.selfLinkWithId().applyValue({ args0 -> args0 })

    /**
     * User-provided name of the Organization firewall policy. The name should be unique in the organization in which the firewall policy is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression a-z? which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash.
     * - - -
     */
    public val shortName: Output
        get() = javaResource.shortName().applyValue({ args0 -> args0 })
}

public object FirewallPolicyMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.gcp.compute.FirewallPolicy::class == javaResource::class

    override fun map(javaResource: Resource): FirewallPolicy = FirewallPolicy(
        javaResource as
            com.pulumi.gcp.compute.FirewallPolicy,
    )
}

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy