All Downloads are FREE. Search and download functionalities are using the official Maven repository.
Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
com.pulumi.gcp.compute.kotlin.FirewallPolicyAssociation.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.String
import kotlin.Suppress
import kotlin.Unit
/**
* Builder for [FirewallPolicyAssociation].
*/
@PulumiTagMarker
public class FirewallPolicyAssociationResourceBuilder internal constructor() {
public var name: String? = null
public var args: FirewallPolicyAssociationArgs = FirewallPolicyAssociationArgs()
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 FirewallPolicyAssociationArgsBuilder.() -> Unit) {
val builder = FirewallPolicyAssociationArgsBuilder()
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(): FirewallPolicyAssociation {
val builtJavaResource =
com.pulumi.gcp.compute.FirewallPolicyAssociation(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return FirewallPolicyAssociation(builtJavaResource)
}
}
/**
* Allows associating hierarchical firewall policies with the target where they are applied. This allows creating policies and rules in a different location than they are applied.
* For more information on applying hierarchical firewall policies see the [official documentation](https://cloud.google.com/vpc/docs/firewall-policies#managing_hierarchical_firewall_policy_resources)
* ## 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",
* });
* const defaultFirewallPolicyAssociation = new gcp.compute.FirewallPolicyAssociation("default", {
* firewallPolicy: _default.id,
* attachmentTarget: folder.name,
* name: "my-association",
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* default = gcp.compute.FirewallPolicy("default",
* parent="organizations/12345",
* short_name="my-policy",
* description="Example Resource")
* default_firewall_policy_association = gcp.compute.FirewallPolicyAssociation("default",
* firewall_policy=default.id,
* attachment_target=folder["name"],
* name="my-association")
* ```
* ```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",
* });
* var defaultFirewallPolicyAssociation = new Gcp.Compute.FirewallPolicyAssociation("default", new()
* {
* FirewallPolicy = @default.Id,
* AttachmentTarget = folder.Name,
* Name = "my-association",
* });
* });
* ```
* ```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
* }
* _, err = compute.NewFirewallPolicyAssociation(ctx, "default", &compute.FirewallPolicyAssociationArgs{
* FirewallPolicy: _default.ID(),
* AttachmentTarget: pulumi.Any(folder.Name),
* Name: pulumi.String("my-association"),
* })
* 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 com.pulumi.gcp.compute.FirewallPolicyAssociation;
* import com.pulumi.gcp.compute.FirewallPolicyAssociationArgs;
* 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());
* var defaultFirewallPolicyAssociation = new FirewallPolicyAssociation("defaultFirewallPolicyAssociation", FirewallPolicyAssociationArgs.builder()
* .firewallPolicy(default_.id())
* .attachmentTarget(folder.name())
* .name("my-association")
* .build());
* }
* }
* ```
* ```yaml
* resources:
* default:
* type: gcp:compute:FirewallPolicy
* properties:
* parent: organizations/12345
* shortName: my-policy
* description: Example Resource
* defaultFirewallPolicyAssociation:
* type: gcp:compute:FirewallPolicyAssociation
* name: default
* properties:
* firewallPolicy: ${default.id}
* attachmentTarget: ${folder.name}
* name: my-association
* ```
*
* ## Import
* FirewallPolicyAssociation can be imported using any of these accepted formats:
* * `locations/global/firewallPolicies/{{firewall_policy}}/associations/{{name}}`
* * `{{firewall_policy}}/{{name}}`
* When using the `pulumi import` command, FirewallPolicyAssociation can be imported using one of the formats above. For example:
* ```sh
* $ pulumi import gcp:compute/firewallPolicyAssociation:FirewallPolicyAssociation default locations/global/firewallPolicies/{{firewall_policy}}/associations/{{name}}
* ```
* ```sh
* $ pulumi import gcp:compute/firewallPolicyAssociation:FirewallPolicyAssociation default {{firewall_policy}}/{{name}}
* ```
*/
public class FirewallPolicyAssociation internal constructor(
override val javaResource: com.pulumi.gcp.compute.FirewallPolicyAssociation,
) : KotlinCustomResource(javaResource, FirewallPolicyAssociationMapper) {
/**
* 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 short name of the firewall policy of the association.
*/
public val shortName: Output
get() = javaResource.shortName().applyValue({ args0 -> args0 })
}
public object FirewallPolicyAssociationMapper : ResourceMapper {
override fun supportsMappingOfType(javaResource: Resource): Boolean =
com.pulumi.gcp.compute.FirewallPolicyAssociation::class == javaResource::class
override fun map(javaResource: Resource): FirewallPolicyAssociation =
FirewallPolicyAssociation(javaResource as com.pulumi.gcp.compute.FirewallPolicyAssociation)
}
/**
* @see [FirewallPolicyAssociation].
* @param name The _unique_ name of the resulting resource.
* @param block Builder for [FirewallPolicyAssociation].
*/
public suspend fun firewallPolicyAssociation(
name: String,
block: suspend FirewallPolicyAssociationResourceBuilder.() -> Unit,
): FirewallPolicyAssociation {
val builder = FirewallPolicyAssociationResourceBuilder()
builder.name(name)
block(builder)
return builder.build()
}
/**
* @see [FirewallPolicyAssociation].
* @param name The _unique_ name of the resulting resource.
*/
public fun firewallPolicyAssociation(name: String): FirewallPolicyAssociation {
val builder = FirewallPolicyAssociationResourceBuilder()
builder.name(name)
return builder.build()
}