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

com.pulumi.gcp.compute.kotlin.RegionNetworkFirewallPolicyAssociation.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: 8.10.0.0
Show newest version
@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.String
import kotlin.Suppress
import kotlin.Unit

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

    public var args: RegionNetworkFirewallPolicyAssociationArgs =
        RegionNetworkFirewallPolicyAssociationArgs()

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

/**
 * The Compute NetworkFirewallPolicyAssociation resource
 * ## Example Usage
 * ### Regional
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const basicRegionalNetworkFirewallPolicy = new gcp.compute.RegionNetworkFirewallPolicy("basic_regional_network_firewall_policy", {
 *     name: "policy",
 *     project: "my-project-name",
 *     description: "Sample global network firewall policy",
 *     region: "us-west1",
 * });
 * const basicNetwork = new gcp.compute.Network("basic_network", {name: "network"});
 * const primary = new gcp.compute.RegionNetworkFirewallPolicyAssociation("primary", {
 *     name: "association",
 *     attachmentTarget: basicNetwork.id,
 *     firewallPolicy: basicRegionalNetworkFirewallPolicy.name,
 *     project: "my-project-name",
 *     region: "us-west1",
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * basic_regional_network_firewall_policy = gcp.compute.RegionNetworkFirewallPolicy("basic_regional_network_firewall_policy",
 *     name="policy",
 *     project="my-project-name",
 *     description="Sample global network firewall policy",
 *     region="us-west1")
 * basic_network = gcp.compute.Network("basic_network", name="network")
 * primary = gcp.compute.RegionNetworkFirewallPolicyAssociation("primary",
 *     name="association",
 *     attachment_target=basic_network.id,
 *     firewall_policy=basic_regional_network_firewall_policy.name,
 *     project="my-project-name",
 *     region="us-west1")
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var basicRegionalNetworkFirewallPolicy = new Gcp.Compute.RegionNetworkFirewallPolicy("basic_regional_network_firewall_policy", new()
 *     {
 *         Name = "policy",
 *         Project = "my-project-name",
 *         Description = "Sample global network firewall policy",
 *         Region = "us-west1",
 *     });
 *     var basicNetwork = new Gcp.Compute.Network("basic_network", new()
 *     {
 *         Name = "network",
 *     });
 *     var primary = new Gcp.Compute.RegionNetworkFirewallPolicyAssociation("primary", new()
 *     {
 *         Name = "association",
 *         AttachmentTarget = basicNetwork.Id,
 *         FirewallPolicy = basicRegionalNetworkFirewallPolicy.Name,
 *         Project = "my-project-name",
 *         Region = "us-west1",
 *     });
 * });
 * ```
 * ```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 {
 * 		basicRegionalNetworkFirewallPolicy, err := compute.NewRegionNetworkFirewallPolicy(ctx, "basic_regional_network_firewall_policy", &compute.RegionNetworkFirewallPolicyArgs{
 * 			Name:        pulumi.String("policy"),
 * 			Project:     pulumi.String("my-project-name"),
 * 			Description: pulumi.String("Sample global network firewall policy"),
 * 			Region:      pulumi.String("us-west1"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		basicNetwork, err := compute.NewNetwork(ctx, "basic_network", &compute.NetworkArgs{
 * 			Name: pulumi.String("network"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = compute.NewRegionNetworkFirewallPolicyAssociation(ctx, "primary", &compute.RegionNetworkFirewallPolicyAssociationArgs{
 * 			Name:             pulumi.String("association"),
 * 			AttachmentTarget: basicNetwork.ID(),
 * 			FirewallPolicy:   basicRegionalNetworkFirewallPolicy.Name,
 * 			Project:          pulumi.String("my-project-name"),
 * 			Region:           pulumi.String("us-west1"),
 * 		})
 * 		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.RegionNetworkFirewallPolicy;
 * import com.pulumi.gcp.compute.RegionNetworkFirewallPolicyArgs;
 * import com.pulumi.gcp.compute.Network;
 * import com.pulumi.gcp.compute.NetworkArgs;
 * import com.pulumi.gcp.compute.RegionNetworkFirewallPolicyAssociation;
 * import com.pulumi.gcp.compute.RegionNetworkFirewallPolicyAssociationArgs;
 * 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 basicRegionalNetworkFirewallPolicy = new RegionNetworkFirewallPolicy("basicRegionalNetworkFirewallPolicy", RegionNetworkFirewallPolicyArgs.builder()
 *             .name("policy")
 *             .project("my-project-name")
 *             .description("Sample global network firewall policy")
 *             .region("us-west1")
 *             .build());
 *         var basicNetwork = new Network("basicNetwork", NetworkArgs.builder()
 *             .name("network")
 *             .build());
 *         var primary = new RegionNetworkFirewallPolicyAssociation("primary", RegionNetworkFirewallPolicyAssociationArgs.builder()
 *             .name("association")
 *             .attachmentTarget(basicNetwork.id())
 *             .firewallPolicy(basicRegionalNetworkFirewallPolicy.name())
 *             .project("my-project-name")
 *             .region("us-west1")
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   basicRegionalNetworkFirewallPolicy:
 *     type: gcp:compute:RegionNetworkFirewallPolicy
 *     name: basic_regional_network_firewall_policy
 *     properties:
 *       name: policy
 *       project: my-project-name
 *       description: Sample global network firewall policy
 *       region: us-west1
 *   basicNetwork:
 *     type: gcp:compute:Network
 *     name: basic_network
 *     properties:
 *       name: network
 *   primary:
 *     type: gcp:compute:RegionNetworkFirewallPolicyAssociation
 *     properties:
 *       name: association
 *       attachmentTarget: ${basicNetwork.id}
 *       firewallPolicy: ${basicRegionalNetworkFirewallPolicy.name}
 *       project: my-project-name
 *       region: us-west1
 * ```
 * 
 * ## Import
 * NetworkFirewallPolicyAssociation can be imported using any of these accepted formats:
 * * `projects/{{project}}/regions/{{region}}/firewallPolicies/{{firewall_policy}}/associations/{{name}}`
 * * `{{project}}/{{region}}/{{firewall_policy}}/{{name}}`
 * When using the `pulumi import` command, NetworkFirewallPolicyAssociation can be imported using one of the formats above. For example:
 * ```sh
 * $ pulumi import gcp:compute/regionNetworkFirewallPolicyAssociation:RegionNetworkFirewallPolicyAssociation default projects/{{project}}/regions/{{region}}/firewallPolicies/{{firewall_policy}}/associations/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:compute/regionNetworkFirewallPolicyAssociation:RegionNetworkFirewallPolicyAssociation default {{project}}/{{region}}/{{firewall_policy}}/{{name}}
 * ```
 */
public class RegionNetworkFirewallPolicyAssociation internal constructor(
    override val javaResource: com.pulumi.gcp.compute.RegionNetworkFirewallPolicyAssociation,
) : KotlinCustomResource(javaResource, RegionNetworkFirewallPolicyAssociationMapper) {
    /**
     * The target that the firewall policy is attached to.
     */
    public val attachmentTarget: Output
        get() = javaResource.attachmentTarget().applyValue({ args0 -> args0 })

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

    /**
     * The name for an association.
     * - - -
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * The project for the resource
     */
    public val project: Output
        get() = javaResource.project().applyValue({ args0 -> args0 })

    /**
     * The location of this resource.
     */
    public val region: Output
        get() = javaResource.region().applyValue({ args0 -> args0 })

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

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

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy