com.pulumi.gcp.compute.kotlin.NetworkFirewallPolicyAssociation.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pulumi-gcp-kotlin Show documentation
Show all versions of pulumi-gcp-kotlin Show documentation
Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.
@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 [NetworkFirewallPolicyAssociation].
*/
@PulumiTagMarker
public class NetworkFirewallPolicyAssociationResourceBuilder internal constructor() {
public var name: String? = null
public var args: NetworkFirewallPolicyAssociationArgs = NetworkFirewallPolicyAssociationArgs()
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 NetworkFirewallPolicyAssociationArgsBuilder.() -> Unit) {
val builder = NetworkFirewallPolicyAssociationArgsBuilder()
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(): NetworkFirewallPolicyAssociation {
val builtJavaResource =
com.pulumi.gcp.compute.NetworkFirewallPolicyAssociation(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return NetworkFirewallPolicyAssociation(builtJavaResource)
}
}
/**
* The Compute NetworkFirewallPolicyAssociation resource
* ## Example Usage
* ### Global
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const networkFirewallPolicy = new gcp.compute.NetworkFirewallPolicy("network_firewall_policy", {
* name: "policy",
* project: "my-project-name",
* description: "Sample global network firewall policy",
* });
* const network = new gcp.compute.Network("network", {name: "network"});
* const primary = new gcp.compute.NetworkFirewallPolicyAssociation("primary", {
* name: "association",
* attachmentTarget: network.id,
* firewallPolicy: networkFirewallPolicy.name,
* project: "my-project-name",
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* network_firewall_policy = gcp.compute.NetworkFirewallPolicy("network_firewall_policy",
* name="policy",
* project="my-project-name",
* description="Sample global network firewall policy")
* network = gcp.compute.Network("network", name="network")
* primary = gcp.compute.NetworkFirewallPolicyAssociation("primary",
* name="association",
* attachment_target=network.id,
* firewall_policy=network_firewall_policy.name,
* project="my-project-name")
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var networkFirewallPolicy = new Gcp.Compute.NetworkFirewallPolicy("network_firewall_policy", new()
* {
* Name = "policy",
* Project = "my-project-name",
* Description = "Sample global network firewall policy",
* });
* var network = new Gcp.Compute.Network("network", new()
* {
* Name = "network",
* });
* var primary = new Gcp.Compute.NetworkFirewallPolicyAssociation("primary", new()
* {
* Name = "association",
* AttachmentTarget = network.Id,
* FirewallPolicy = networkFirewallPolicy.Name,
* Project = "my-project-name",
* });
* });
* ```
* ```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 {
* networkFirewallPolicy, err := compute.NewNetworkFirewallPolicy(ctx, "network_firewall_policy", &compute.NetworkFirewallPolicyArgs{
* Name: pulumi.String("policy"),
* Project: pulumi.String("my-project-name"),
* Description: pulumi.String("Sample global network firewall policy"),
* })
* if err != nil {
* return err
* }
* network, err := compute.NewNetwork(ctx, "network", &compute.NetworkArgs{
* Name: pulumi.String("network"),
* })
* if err != nil {
* return err
* }
* _, err = compute.NewNetworkFirewallPolicyAssociation(ctx, "primary", &compute.NetworkFirewallPolicyAssociationArgs{
* Name: pulumi.String("association"),
* AttachmentTarget: network.ID(),
* FirewallPolicy: networkFirewallPolicy.Name,
* Project: pulumi.String("my-project-name"),
* })
* 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.NetworkFirewallPolicy;
* import com.pulumi.gcp.compute.NetworkFirewallPolicyArgs;
* import com.pulumi.gcp.compute.Network;
* import com.pulumi.gcp.compute.NetworkArgs;
* import com.pulumi.gcp.compute.NetworkFirewallPolicyAssociation;
* import com.pulumi.gcp.compute.NetworkFirewallPolicyAssociationArgs;
* 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 networkFirewallPolicy = new NetworkFirewallPolicy("networkFirewallPolicy", NetworkFirewallPolicyArgs.builder()
* .name("policy")
* .project("my-project-name")
* .description("Sample global network firewall policy")
* .build());
* var network = new Network("network", NetworkArgs.builder()
* .name("network")
* .build());
* var primary = new NetworkFirewallPolicyAssociation("primary", NetworkFirewallPolicyAssociationArgs.builder()
* .name("association")
* .attachmentTarget(network.id())
* .firewallPolicy(networkFirewallPolicy.name())
* .project("my-project-name")
* .build());
* }
* }
* ```
* ```yaml
* resources:
* networkFirewallPolicy:
* type: gcp:compute:NetworkFirewallPolicy
* name: network_firewall_policy
* properties:
* name: policy
* project: my-project-name
* description: Sample global network firewall policy
* network:
* type: gcp:compute:Network
* properties:
* name: network
* primary:
* type: gcp:compute:NetworkFirewallPolicyAssociation
* properties:
* name: association
* attachmentTarget: ${network.id}
* firewallPolicy: ${networkFirewallPolicy.name}
* project: my-project-name
* ```
*
* ## Import
* NetworkFirewallPolicyAssociation can be imported using any of these accepted formats:
* * `projects/{{project}}/global/firewallPolicies/{{firewall_policy}}/associations/{{name}}`
* * `{{project}}/{{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/networkFirewallPolicyAssociation:NetworkFirewallPolicyAssociation default projects/{{project}}/global/firewallPolicies/{{firewall_policy}}/associations/{{name}}
* ```
* ```sh
* $ pulumi import gcp:compute/networkFirewallPolicyAssociation:NetworkFirewallPolicyAssociation default {{project}}/{{firewall_policy}}/{{name}}
* ```
*/
public class NetworkFirewallPolicyAssociation internal constructor(
override val javaResource: com.pulumi.gcp.compute.NetworkFirewallPolicyAssociation,
) : KotlinCustomResource(javaResource, NetworkFirewallPolicyAssociationMapper) {
/**
* 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 short name of the firewall policy of the association.
*/
public val shortName: Output
get() = javaResource.shortName().applyValue({ args0 -> args0 })
}
public object NetworkFirewallPolicyAssociationMapper :
ResourceMapper {
override fun supportsMappingOfType(javaResource: Resource): Boolean =
com.pulumi.gcp.compute.NetworkFirewallPolicyAssociation::class == javaResource::class
override fun map(javaResource: Resource): NetworkFirewallPolicyAssociation =
NetworkFirewallPolicyAssociation(
javaResource as
com.pulumi.gcp.compute.NetworkFirewallPolicyAssociation,
)
}
/**
* @see [NetworkFirewallPolicyAssociation].
* @param name The _unique_ name of the resulting resource.
* @param block Builder for [NetworkFirewallPolicyAssociation].
*/
public suspend fun networkFirewallPolicyAssociation(
name: String,
block: suspend NetworkFirewallPolicyAssociationResourceBuilder.() -> Unit,
): NetworkFirewallPolicyAssociation {
val builder = NetworkFirewallPolicyAssociationResourceBuilder()
builder.name(name)
block(builder)
return builder.build()
}
/**
* @see [NetworkFirewallPolicyAssociation].
* @param name The _unique_ name of the resulting resource.
*/
public fun networkFirewallPolicyAssociation(name: String): NetworkFirewallPolicyAssociation {
val builder = NetworkFirewallPolicyAssociationResourceBuilder()
builder.name(name)
return builder.build()
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy