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

com.pulumi.gcp.edgenetwork.kotlin.Network.kt Maven / Gradle / Ivy

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

package com.pulumi.gcp.edgenetwork.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.Map

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

    public var args: NetworkArgs = NetworkArgs()

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

/**
 * A Distributed Cloud Edge network, which provides L3 isolation within a zone.
 * To get more information about Network, see:
 * * [API documentation](https://cloud.google.com/distributed-cloud/edge/latest/docs/reference/network/rest/v1/projects.locations.zones.networks)
 * * How-to Guides
 *     * [Create and manage networks](https://cloud.google.com/distributed-cloud/edge/latest/docs/networks#api)
 * ## Example Usage
 * ### Edgenetwork Network
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const exampleNetwork = new gcp.edgenetwork.Network("example_network", {
 *     networkId: "example-network",
 *     location: "us-west1",
 *     zone: "",
 *     description: "Example network.",
 *     mtu: 9000,
 *     labels: {
 *         environment: "dev",
 *     },
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * example_network = gcp.edgenetwork.Network("example_network",
 *     network_id="example-network",
 *     location="us-west1",
 *     zone="",
 *     description="Example network.",
 *     mtu=9000,
 *     labels={
 *         "environment": "dev",
 *     })
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var exampleNetwork = new Gcp.EdgeNetwork.Network("example_network", new()
 *     {
 *         NetworkId = "example-network",
 *         Location = "us-west1",
 *         Zone = "",
 *         Description = "Example network.",
 *         Mtu = 9000,
 *         Labels =
 *         {
 *             { "environment", "dev" },
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/edgenetwork"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := edgenetwork.NewNetwork(ctx, "example_network", &edgenetwork.NetworkArgs{
 * 			NetworkId:   pulumi.String("example-network"),
 * 			Location:    pulumi.String("us-west1"),
 * 			Zone:        pulumi.String(""),
 * 			Description: pulumi.String("Example network."),
 * 			Mtu:         pulumi.Int(9000),
 * 			Labels: pulumi.StringMap{
 * 				"environment": pulumi.String("dev"),
 * 			},
 * 		})
 * 		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.edgenetwork.Network;
 * import com.pulumi.gcp.edgenetwork.NetworkArgs;
 * 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 exampleNetwork = new Network("exampleNetwork", NetworkArgs.builder()
 *             .networkId("example-network")
 *             .location("us-west1")
 *             .zone("")
 *             .description("Example network.")
 *             .mtu(9000)
 *             .labels(Map.of("environment", "dev"))
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   exampleNetwork:
 *     type: gcp:edgenetwork:Network
 *     name: example_network
 *     properties:
 *       networkId: example-network
 *       location: us-west1
 *       zone:
 *       description: Example network.
 *       mtu: 9000
 *       labels:
 *         environment: dev
 * ```
 * 
 * ## Import
 * Network can be imported using any of these accepted formats:
 * * `projects/{{project}}/locations/{{location}}/zones/{{zone}}/networks/{{network_id}}`
 * * `{{project}}/{{location}}/{{zone}}/{{network_id}}`
 * * `{{location}}/{{zone}}/{{network_id}}`
 * * `{{location}}/{{network_id}}`
 * * `{{name}}`
 * When using the `pulumi import` command, Network can be imported using one of the formats above. For example:
 * ```sh
 * $ pulumi import gcp:edgenetwork/network:Network default projects/{{project}}/locations/{{location}}/zones/{{zone}}/networks/{{network_id}}
 * ```
 * ```sh
 * $ pulumi import gcp:edgenetwork/network:Network default {{project}}/{{location}}/{{zone}}/{{network_id}}
 * ```
 * ```sh
 * $ pulumi import gcp:edgenetwork/network:Network default {{location}}/{{zone}}/{{network_id}}
 * ```
 * ```sh
 * $ pulumi import gcp:edgenetwork/network:Network default {{location}}/{{network_id}}
 * ```
 * ```sh
 * $ pulumi import gcp:edgenetwork/network:Network default {{name}}
 * ```
 */
public class Network internal constructor(
    override val javaResource: com.pulumi.gcp.edgenetwork.Network,
) : KotlinCustomResource(javaResource, NetworkMapper) {
    /**
     * The time when the subnet 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 })

    /**
     * A free-text description of the resource. Max length 1024 characters.
     */
    public val description: Output?
        get() = javaResource.description().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Labels associated with this 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 Google Cloud region to which the target Distributed Cloud Edge zone belongs.
     */
    public val location: Output
        get() = javaResource.location().applyValue({ args0 -> args0 })

    /**
     * IP (L3) MTU value of the network. Default value is `1500`. Possible values are: `1500`, `9000`.
     */
    public val mtu: Output?
        get() = javaResource.mtu().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * The canonical name of this resource, with format
     * `projects/{{project}}/locations/{{location}}/zones/{{zone}}/networks/{{network_id}}`
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * A unique ID that identifies this network.
     * - - -
     */
    public val networkId: Output
        get() = javaResource.networkId().applyValue({ args0 -> args0 })

    /**
     * The ID of the project in which the resource belongs.
     * If it is not provided, the provider project is used.
     */
    public val project: Output
        get() = javaResource.project().applyValue({ args0 -> args0 })

    /**
     * The time when the subnet was last 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 })

    /**
     * The name of the target Distributed Cloud Edge zone.
     */
    public val zone: Output
        get() = javaResource.zone().applyValue({ args0 -> args0 })
}

public object NetworkMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.gcp.edgenetwork.Network::class == javaResource::class

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy