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

com.pulumi.gcp.vmwareengine.kotlin.Subnet.kt Maven / Gradle / Ivy

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

package com.pulumi.gcp.vmwareengine.kotlin

import com.pulumi.core.Output
import com.pulumi.gcp.vmwareengine.kotlin.outputs.SubnetDhcpAddressRange
import com.pulumi.gcp.vmwareengine.kotlin.outputs.SubnetDhcpAddressRange.Companion.toKotlin
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

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

    public var args: SubnetArgs = SubnetArgs()

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

/**
 * Subnet in a private cloud. A Private Cloud contains two types of subnets: `management` subnets (such as vMotion) that
 * are read-only,and `userDefined`, which can also be updated. This resource should be used to read and update `userDefined`
 * subnets. To read `management` subnets, please utilize the subnet data source.
 * To get more information about Subnet, see:
 * * [API documentation](https://cloud.google.com/vmware-engine/docs/reference/rest/v1/projects.locations.privateClouds.subnets)
 * ## Example Usage
 * ### Vmware Engine Subnet User Defined
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const subnet_nw = new gcp.vmwareengine.Network("subnet-nw", {
 *     name: "pc-nw",
 *     location: "global",
 *     type: "STANDARD",
 *     description: "PC network description.",
 * });
 * const subnet_pc = new gcp.vmwareengine.PrivateCloud("subnet-pc", {
 *     location: "us-west1-a",
 *     name: "sample-pc",
 *     description: "Sample test PC.",
 *     networkConfig: {
 *         managementCidr: "192.168.50.0/24",
 *         vmwareEngineNetwork: subnet_nw.id,
 *     },
 *     managementCluster: {
 *         clusterId: "sample-mgmt-cluster",
 *         nodeTypeConfigs: [{
 *             nodeTypeId: "standard-72",
 *             nodeCount: 3,
 *         }],
 *     },
 * });
 * const vmw_engine_subnet = new gcp.vmwareengine.Subnet("vmw-engine-subnet", {
 *     name: "service-1",
 *     parent: subnet_pc.id,
 *     ipCidrRange: "192.168.100.0/26",
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * subnet_nw = gcp.vmwareengine.Network("subnet-nw",
 *     name="pc-nw",
 *     location="global",
 *     type="STANDARD",
 *     description="PC network description.")
 * subnet_pc = gcp.vmwareengine.PrivateCloud("subnet-pc",
 *     location="us-west1-a",
 *     name="sample-pc",
 *     description="Sample test PC.",
 *     network_config={
 *         "management_cidr": "192.168.50.0/24",
 *         "vmware_engine_network": subnet_nw.id,
 *     },
 *     management_cluster={
 *         "cluster_id": "sample-mgmt-cluster",
 *         "node_type_configs": [{
 *             "node_type_id": "standard-72",
 *             "node_count": 3,
 *         }],
 *     })
 * vmw_engine_subnet = gcp.vmwareengine.Subnet("vmw-engine-subnet",
 *     name="service-1",
 *     parent=subnet_pc.id,
 *     ip_cidr_range="192.168.100.0/26")
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var subnet_nw = new Gcp.VMwareEngine.Network("subnet-nw", new()
 *     {
 *         Name = "pc-nw",
 *         Location = "global",
 *         Type = "STANDARD",
 *         Description = "PC network description.",
 *     });
 *     var subnet_pc = new Gcp.VMwareEngine.PrivateCloud("subnet-pc", new()
 *     {
 *         Location = "us-west1-a",
 *         Name = "sample-pc",
 *         Description = "Sample test PC.",
 *         NetworkConfig = new Gcp.VMwareEngine.Inputs.PrivateCloudNetworkConfigArgs
 *         {
 *             ManagementCidr = "192.168.50.0/24",
 *             VmwareEngineNetwork = subnet_nw.Id,
 *         },
 *         ManagementCluster = new Gcp.VMwareEngine.Inputs.PrivateCloudManagementClusterArgs
 *         {
 *             ClusterId = "sample-mgmt-cluster",
 *             NodeTypeConfigs = new[]
 *             {
 *                 new Gcp.VMwareEngine.Inputs.PrivateCloudManagementClusterNodeTypeConfigArgs
 *                 {
 *                     NodeTypeId = "standard-72",
 *                     NodeCount = 3,
 *                 },
 *             },
 *         },
 *     });
 *     var vmw_engine_subnet = new Gcp.VMwareEngine.Subnet("vmw-engine-subnet", new()
 *     {
 *         Name = "service-1",
 *         Parent = subnet_pc.Id,
 *         IpCidrRange = "192.168.100.0/26",
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/vmwareengine"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := vmwareengine.NewNetwork(ctx, "subnet-nw", &vmwareengine.NetworkArgs{
 * 			Name:        pulumi.String("pc-nw"),
 * 			Location:    pulumi.String("global"),
 * 			Type:        pulumi.String("STANDARD"),
 * 			Description: pulumi.String("PC network description."),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = vmwareengine.NewPrivateCloud(ctx, "subnet-pc", &vmwareengine.PrivateCloudArgs{
 * 			Location:    pulumi.String("us-west1-a"),
 * 			Name:        pulumi.String("sample-pc"),
 * 			Description: pulumi.String("Sample test PC."),
 * 			NetworkConfig: &vmwareengine.PrivateCloudNetworkConfigArgs{
 * 				ManagementCidr:      pulumi.String("192.168.50.0/24"),
 * 				VmwareEngineNetwork: subnet_nw.ID(),
 * 			},
 * 			ManagementCluster: &vmwareengine.PrivateCloudManagementClusterArgs{
 * 				ClusterId: pulumi.String("sample-mgmt-cluster"),
 * 				NodeTypeConfigs: vmwareengine.PrivateCloudManagementClusterNodeTypeConfigArray{
 * 					&vmwareengine.PrivateCloudManagementClusterNodeTypeConfigArgs{
 * 						NodeTypeId: pulumi.String("standard-72"),
 * 						NodeCount:  pulumi.Int(3),
 * 					},
 * 				},
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = vmwareengine.NewSubnet(ctx, "vmw-engine-subnet", &vmwareengine.SubnetArgs{
 * 			Name:        pulumi.String("service-1"),
 * 			Parent:      subnet_pc.ID(),
 * 			IpCidrRange: pulumi.String("192.168.100.0/26"),
 * 		})
 * 		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.vmwareengine.Network;
 * import com.pulumi.gcp.vmwareengine.NetworkArgs;
 * import com.pulumi.gcp.vmwareengine.PrivateCloud;
 * import com.pulumi.gcp.vmwareengine.PrivateCloudArgs;
 * import com.pulumi.gcp.vmwareengine.inputs.PrivateCloudNetworkConfigArgs;
 * import com.pulumi.gcp.vmwareengine.inputs.PrivateCloudManagementClusterArgs;
 * import com.pulumi.gcp.vmwareengine.Subnet;
 * import com.pulumi.gcp.vmwareengine.SubnetArgs;
 * 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 subnet_nw = new Network("subnet-nw", NetworkArgs.builder()
 *             .name("pc-nw")
 *             .location("global")
 *             .type("STANDARD")
 *             .description("PC network description.")
 *             .build());
 *         var subnet_pc = new PrivateCloud("subnet-pc", PrivateCloudArgs.builder()
 *             .location("us-west1-a")
 *             .name("sample-pc")
 *             .description("Sample test PC.")
 *             .networkConfig(PrivateCloudNetworkConfigArgs.builder()
 *                 .managementCidr("192.168.50.0/24")
 *                 .vmwareEngineNetwork(subnet_nw.id())
 *                 .build())
 *             .managementCluster(PrivateCloudManagementClusterArgs.builder()
 *                 .clusterId("sample-mgmt-cluster")
 *                 .nodeTypeConfigs(PrivateCloudManagementClusterNodeTypeConfigArgs.builder()
 *                     .nodeTypeId("standard-72")
 *                     .nodeCount(3)
 *                     .build())
 *                 .build())
 *             .build());
 *         var vmw_engine_subnet = new Subnet("vmw-engine-subnet", SubnetArgs.builder()
 *             .name("service-1")
 *             .parent(subnet_pc.id())
 *             .ipCidrRange("192.168.100.0/26")
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   subnet-nw:
 *     type: gcp:vmwareengine:Network
 *     properties:
 *       name: pc-nw
 *       location: global
 *       type: STANDARD
 *       description: PC network description.
 *   subnet-pc:
 *     type: gcp:vmwareengine:PrivateCloud
 *     properties:
 *       location: us-west1-a
 *       name: sample-pc
 *       description: Sample test PC.
 *       networkConfig:
 *         managementCidr: 192.168.50.0/24
 *         vmwareEngineNetwork: ${["subnet-nw"].id}
 *       managementCluster:
 *         clusterId: sample-mgmt-cluster
 *         nodeTypeConfigs:
 *           - nodeTypeId: standard-72
 *             nodeCount: 3
 *   vmw-engine-subnet:
 *     type: gcp:vmwareengine:Subnet
 *     properties:
 *       name: service-1
 *       parent: ${["subnet-pc"].id}
 *       ipCidrRange: 192.168.100.0/26
 * ```
 * 
 * ## Import
 * Subnet can be imported using any of these accepted formats:
 * * `{{parent}}/subnets/{{name}}`
 * When using the `pulumi import` command, Subnet can be imported using one of the formats above. For example:
 * ```sh
 * $ pulumi import gcp:vmwareengine/subnet:Subnet default {{parent}}/subnets/{{name}}
 * ```
 */
public class Subnet internal constructor(
    override val javaResource: com.pulumi.gcp.vmwareengine.Subnet,
) : KotlinCustomResource(javaResource, SubnetMapper) {
    /**
     * Creation time of this resource.
     * 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 })

    /**
     * DHCP address ranges.
     * Structure is documented below.
     */
    public val dhcpAddressRanges: Output>
        get() = javaResource.dhcpAddressRanges().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> toKotlin(args0) })
            })
        })

    /**
     * The canonical identifier of the logical router that this subnet is attached to.
     */
    public val gatewayId: Output
        get() = javaResource.gatewayId().applyValue({ args0 -> args0 })

    /**
     * The IP address of the gateway of this subnet. Must fall within the IP prefix defined above.
     */
    public val gatewayIp: Output
        get() = javaResource.gatewayIp().applyValue({ args0 -> args0 })

    /**
     * The IP address range of the subnet in CIDR format.
     */
    public val ipCidrRange: Output
        get() = javaResource.ipCidrRange().applyValue({ args0 -> args0 })

    /**
     * The ID of the subnet. For userDefined subnets, this name should be in the format of "service-n",
     * where n ranges from 1 to 5.
     * - - -
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * The resource name of the private cloud to create a new subnet in.
     * Resource names are schemeless URIs that follow the conventions in https://cloud.google.com/apis/design/resource_names.
     * For example: projects/my-project/locations/us-west1-a/privateClouds/my-cloud
     */
    public val parent: Output
        get() = javaResource.parent().applyValue({ args0 -> args0 })

    /**
     * Whether the NSX-T configuration in the backend follows the standard configuration supported by Google Cloud.
     * If false, the subnet cannot be modified through Google Cloud, only through NSX-T directly.
     */
    public val standardConfig: Output
        get() = javaResource.standardConfig().applyValue({ args0 -> args0 })

    /**
     * State of the subnet.
     */
    public val state: Output
        get() = javaResource.state().applyValue({ args0 -> args0 })

    /**
     * The type of the subnet.
     */
    public val type: Output
        get() = javaResource.type().applyValue({ args0 -> args0 })

    /**
     * System-generated unique identifier for the resource.
     */
    public val uid: Output
        get() = javaResource.uid().applyValue({ args0 -> args0 })

    /**
     * Last updated time of this resource.
     * 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 })

    /**
     * VLAN ID of the VLAN on which the subnet is configured.
     */
    public val vlanId: Output
        get() = javaResource.vlanId().applyValue({ args0 -> args0 })
}

public object SubnetMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.gcp.vmwareengine.Subnet::class == javaResource::class

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy