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

com.pulumi.gcp.networksecurity.kotlin.AddressGroup.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.networksecurity.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
import kotlin.collections.List
import kotlin.collections.Map

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

    public var args: AddressGroupArgs = AddressGroupArgs()

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

/**
 * AddressGroup is a resource that specifies how a collection of IP/DNS used in Firewall Policy.
 * To get more information about AddressGroup, see:
 * * [API documentation](https://cloud.google.com/traffic-director/docs/reference/network-security/rest/v1beta1/organizations.locations.addressGroups)
 * * How-to Guides
 *     * [Use AddressGroups](https://cloud.google.com/vpc/docs/use-address-groups-firewall-policies)
 * ## Example Usage
 * ### Network Security Address Groups Basic
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const _default = new gcp.networksecurity.AddressGroup("default", {
 *     name: "my-address-groups",
 *     parent: "projects/my-project-name",
 *     location: "us-central1",
 *     type: "IPV4",
 *     capacity: 100,
 *     items: ["208.80.154.224/32"],
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * default = gcp.networksecurity.AddressGroup("default",
 *     name="my-address-groups",
 *     parent="projects/my-project-name",
 *     location="us-central1",
 *     type="IPV4",
 *     capacity=100,
 *     items=["208.80.154.224/32"])
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var @default = new Gcp.NetworkSecurity.AddressGroup("default", new()
 *     {
 *         Name = "my-address-groups",
 *         Parent = "projects/my-project-name",
 *         Location = "us-central1",
 *         Type = "IPV4",
 *         Capacity = 100,
 *         Items = new[]
 *         {
 *             "208.80.154.224/32",
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/networksecurity"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := networksecurity.NewAddressGroup(ctx, "default", &networksecurity.AddressGroupArgs{
 * 			Name:     pulumi.String("my-address-groups"),
 * 			Parent:   pulumi.String("projects/my-project-name"),
 * 			Location: pulumi.String("us-central1"),
 * 			Type:     pulumi.String("IPV4"),
 * 			Capacity: pulumi.Int(100),
 * 			Items: pulumi.StringArray{
 * 				pulumi.String("208.80.154.224/32"),
 * 			},
 * 		})
 * 		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.networksecurity.AddressGroup;
 * import com.pulumi.gcp.networksecurity.AddressGroupArgs;
 * 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 AddressGroup("default", AddressGroupArgs.builder()
 *             .name("my-address-groups")
 *             .parent("projects/my-project-name")
 *             .location("us-central1")
 *             .type("IPV4")
 *             .capacity("100")
 *             .items("208.80.154.224/32")
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   default:
 *     type: gcp:networksecurity:AddressGroup
 *     properties:
 *       name: my-address-groups
 *       parent: projects/my-project-name
 *       location: us-central1
 *       type: IPV4
 *       capacity: '100'
 *       items:
 *         - 208.80.154.224/32
 * ```
 * 
 * ### Network Security Address Groups Organization Basic
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const _default = new gcp.networksecurity.AddressGroup("default", {
 *     name: "my-address-groups",
 *     parent: "organizations/123456789",
 *     location: "us-central1",
 *     type: "IPV4",
 *     capacity: 100,
 *     items: ["208.80.154.224/32"],
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * default = gcp.networksecurity.AddressGroup("default",
 *     name="my-address-groups",
 *     parent="organizations/123456789",
 *     location="us-central1",
 *     type="IPV4",
 *     capacity=100,
 *     items=["208.80.154.224/32"])
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var @default = new Gcp.NetworkSecurity.AddressGroup("default", new()
 *     {
 *         Name = "my-address-groups",
 *         Parent = "organizations/123456789",
 *         Location = "us-central1",
 *         Type = "IPV4",
 *         Capacity = 100,
 *         Items = new[]
 *         {
 *             "208.80.154.224/32",
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/networksecurity"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := networksecurity.NewAddressGroup(ctx, "default", &networksecurity.AddressGroupArgs{
 * 			Name:     pulumi.String("my-address-groups"),
 * 			Parent:   pulumi.String("organizations/123456789"),
 * 			Location: pulumi.String("us-central1"),
 * 			Type:     pulumi.String("IPV4"),
 * 			Capacity: pulumi.Int(100),
 * 			Items: pulumi.StringArray{
 * 				pulumi.String("208.80.154.224/32"),
 * 			},
 * 		})
 * 		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.networksecurity.AddressGroup;
 * import com.pulumi.gcp.networksecurity.AddressGroupArgs;
 * 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 AddressGroup("default", AddressGroupArgs.builder()
 *             .name("my-address-groups")
 *             .parent("organizations/123456789")
 *             .location("us-central1")
 *             .type("IPV4")
 *             .capacity("100")
 *             .items("208.80.154.224/32")
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   default:
 *     type: gcp:networksecurity:AddressGroup
 *     properties:
 *       name: my-address-groups
 *       parent: organizations/123456789
 *       location: us-central1
 *       type: IPV4
 *       capacity: '100'
 *       items:
 *         - 208.80.154.224/32
 * ```
 * 
 * ### Network Security Address Groups Advanced
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const _default = new gcp.networksecurity.AddressGroup("default", {
 *     name: "my-address-groups",
 *     parent: "projects/my-project-name",
 *     location: "us-central1",
 *     description: "my description",
 *     type: "IPV4",
 *     capacity: 100,
 *     items: ["208.80.154.224/32"],
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * default = gcp.networksecurity.AddressGroup("default",
 *     name="my-address-groups",
 *     parent="projects/my-project-name",
 *     location="us-central1",
 *     description="my description",
 *     type="IPV4",
 *     capacity=100,
 *     items=["208.80.154.224/32"])
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var @default = new Gcp.NetworkSecurity.AddressGroup("default", new()
 *     {
 *         Name = "my-address-groups",
 *         Parent = "projects/my-project-name",
 *         Location = "us-central1",
 *         Description = "my description",
 *         Type = "IPV4",
 *         Capacity = 100,
 *         Items = new[]
 *         {
 *             "208.80.154.224/32",
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/networksecurity"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := networksecurity.NewAddressGroup(ctx, "default", &networksecurity.AddressGroupArgs{
 * 			Name:        pulumi.String("my-address-groups"),
 * 			Parent:      pulumi.String("projects/my-project-name"),
 * 			Location:    pulumi.String("us-central1"),
 * 			Description: pulumi.String("my description"),
 * 			Type:        pulumi.String("IPV4"),
 * 			Capacity:    pulumi.Int(100),
 * 			Items: pulumi.StringArray{
 * 				pulumi.String("208.80.154.224/32"),
 * 			},
 * 		})
 * 		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.networksecurity.AddressGroup;
 * import com.pulumi.gcp.networksecurity.AddressGroupArgs;
 * 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 AddressGroup("default", AddressGroupArgs.builder()
 *             .name("my-address-groups")
 *             .parent("projects/my-project-name")
 *             .location("us-central1")
 *             .description("my description")
 *             .type("IPV4")
 *             .capacity("100")
 *             .items("208.80.154.224/32")
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   default:
 *     type: gcp:networksecurity:AddressGroup
 *     properties:
 *       name: my-address-groups
 *       parent: projects/my-project-name
 *       location: us-central1
 *       description: my description
 *       type: IPV4
 *       capacity: '100'
 *       items:
 *         - 208.80.154.224/32
 * ```
 * 
 * ## Import
 * AddressGroup can be imported using any of these accepted formats:
 * * `{{parent}}/locations/{{location}}/addressGroups/{{name}}`
 * When using the `pulumi import` command, AddressGroup can be imported using one of the formats above. For example:
 * ```sh
 * $ pulumi import gcp:networksecurity/addressGroup:AddressGroup default {{parent}}/locations/{{location}}/addressGroups/{{name}}
 * ```
 */
public class AddressGroup internal constructor(
    override val javaResource: com.pulumi.gcp.networksecurity.AddressGroup,
) : KotlinCustomResource(javaResource, AddressGroupMapper) {
    /**
     * Capacity of the Address Group.
     */
    public val capacity: Output
        get() = javaResource.capacity().applyValue({ args0 -> args0 })

    /**
     * The timestamp when the resource was created.
     * A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits.
     * Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z"
     */
    public val createTime: Output
        get() = javaResource.createTime().applyValue({ args0 -> args0 })

    /**
     * Free-text description of the resource.
     */
    public val description: Output?
        get() = javaResource.description().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services.
     */
    public val effectiveLabels: Output>
        get() = javaResource.effectiveLabels().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.key.to(args0.value)
            }).toMap()
        })

    /**
     * List of items.
     */
    public val items: Output>?
        get() = javaResource.items().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0
                })
            }).orElse(null)
        })

    /**
     * Set of label tags associated with the AddressGroup resource.
     * An object containing a list of "key": value pairs. Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.
     * **Note**: This field is non-authoritative, and will only manage the labels present in your configuration.
     * Please refer to the field `effective_labels` for all of the labels present on the resource.
     */
    public val labels: Output>?
        get() = javaResource.labels().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.key.to(args0.value)
                }).toMap()
            }).orElse(null)
        })

    /**
     * The location of the gateway security policy.
     * The default value is `global`.
     * - - -
     */
    public val location: Output
        get() = javaResource.location().applyValue({ args0 -> args0 })

    /**
     * Name of the AddressGroup resource.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * The name of the parent this address group belongs to. Format: organizations/{organization_id} or projects/{project_id}.
     */
    public val parent: Output?
        get() = javaResource.parent().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * The combination of labels configured directly on the resource
     * and default labels configured on the provider.
     */
    public val pulumiLabels: Output>
        get() = javaResource.pulumiLabels().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.key.to(args0.value)
            }).toMap()
        })

    /**
     * The type of the Address Group. Possible values are "IPV4" or "IPV6".
     * Possible values are: `IPV4`, `IPV6`.
     */
    public val type: Output
        get() = javaResource.type().applyValue({ args0 -> args0 })

    /**
     * The timestamp when the resource was updated.
     * A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits.
     * Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z".
     */
    public val updateTime: Output
        get() = javaResource.updateTime().applyValue({ args0 -> args0 })
}

public object AddressGroupMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.gcp.networksecurity.AddressGroup::class == javaResource::class

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy