com.pulumi.digitalocean.kotlin.VpcArgs.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pulumi-digitalocean-kotlin Show documentation
Show all versions of pulumi-digitalocean-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.digitalocean.kotlin
import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.digitalocean.VpcArgs.builder
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import kotlin.String
import kotlin.Suppress
import kotlin.jvm.JvmName
/**
* Provides a [DigitalOcean VPC](https://docs.digitalocean.com/reference/api/api-reference/#tag/VPCs) resource.
* VPCs are virtual networks containing resources that can communicate with each
* other in full isolation, using private IP addresses.
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as digitalocean from "@pulumi/digitalocean";
* const example = new digitalocean.Vpc("example", {
* name: "example-project-network",
* region: "nyc3",
* ipRange: "10.10.10.0/24",
* });
* ```
* ```python
* import pulumi
* import pulumi_digitalocean as digitalocean
* example = digitalocean.Vpc("example",
* name="example-project-network",
* region="nyc3",
* ip_range="10.10.10.0/24")
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using DigitalOcean = Pulumi.DigitalOcean;
* return await Deployment.RunAsync(() =>
* {
* var example = new DigitalOcean.Vpc("example", new()
* {
* Name = "example-project-network",
* Region = "nyc3",
* IpRange = "10.10.10.0/24",
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-digitalocean/sdk/v4/go/digitalocean"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _, err := digitalocean.NewVpc(ctx, "example", &digitalocean.VpcArgs{
* Name: pulumi.String("example-project-network"),
* Region: pulumi.String("nyc3"),
* IpRange: pulumi.String("10.10.10.0/24"),
* })
* 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.digitalocean.Vpc;
* import com.pulumi.digitalocean.VpcArgs;
* 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 example = new Vpc("example", VpcArgs.builder()
* .name("example-project-network")
* .region("nyc3")
* .ipRange("10.10.10.0/24")
* .build());
* }
* }
* ```
* ```yaml
* resources:
* example:
* type: digitalocean:Vpc
* properties:
* name: example-project-network
* region: nyc3
* ipRange: 10.10.10.0/24
* ```
*
* ### Resource Assignment
* `digitalocean.Droplet`, `digitalocean.KubernetesCluster`,
* `digitalocean_load_balancer`, and `digitalocean.DatabaseCluster` resources
* may be assigned to a VPC by referencing its `id`. For example:
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as digitalocean from "@pulumi/digitalocean";
* const example = new digitalocean.Vpc("example", {
* name: "example-project-network",
* region: "nyc3",
* });
* const exampleDroplet = new digitalocean.Droplet("example", {
* name: "example-01",
* size: digitalocean.DropletSlug.DropletS1VCPU1GB,
* image: "ubuntu-18-04-x64",
* region: digitalocean.Region.NYC3,
* vpcUuid: example.id,
* });
* ```
* ```python
* import pulumi
* import pulumi_digitalocean as digitalocean
* example = digitalocean.Vpc("example",
* name="example-project-network",
* region="nyc3")
* example_droplet = digitalocean.Droplet("example",
* name="example-01",
* size=digitalocean.DropletSlug.DROPLET_S1_VCPU1_GB,
* image="ubuntu-18-04-x64",
* region=digitalocean.Region.NYC3,
* vpc_uuid=example.id)
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using DigitalOcean = Pulumi.DigitalOcean;
* return await Deployment.RunAsync(() =>
* {
* var example = new DigitalOcean.Vpc("example", new()
* {
* Name = "example-project-network",
* Region = "nyc3",
* });
* var exampleDroplet = new DigitalOcean.Droplet("example", new()
* {
* Name = "example-01",
* Size = DigitalOcean.DropletSlug.DropletS1VCPU1GB,
* Image = "ubuntu-18-04-x64",
* Region = DigitalOcean.Region.NYC3,
* VpcUuid = example.Id,
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-digitalocean/sdk/v4/go/digitalocean"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* example, err := digitalocean.NewVpc(ctx, "example", &digitalocean.VpcArgs{
* Name: pulumi.String("example-project-network"),
* Region: pulumi.String("nyc3"),
* })
* if err != nil {
* return err
* }
* _, err = digitalocean.NewDroplet(ctx, "example", &digitalocean.DropletArgs{
* Name: pulumi.String("example-01"),
* Size: pulumi.String(digitalocean.DropletSlugDropletS1VCPU1GB),
* Image: pulumi.String("ubuntu-18-04-x64"),
* Region: pulumi.String(digitalocean.RegionNYC3),
* VpcUuid: example.ID(),
* })
* 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.digitalocean.Vpc;
* import com.pulumi.digitalocean.VpcArgs;
* import com.pulumi.digitalocean.Droplet;
* import com.pulumi.digitalocean.DropletArgs;
* 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 example = new Vpc("example", VpcArgs.builder()
* .name("example-project-network")
* .region("nyc3")
* .build());
* var exampleDroplet = new Droplet("exampleDroplet", DropletArgs.builder()
* .name("example-01")
* .size("s-1vcpu-1gb")
* .image("ubuntu-18-04-x64")
* .region("nyc3")
* .vpcUuid(example.id())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* example:
* type: digitalocean:Vpc
* properties:
* name: example-project-network
* region: nyc3
* exampleDroplet:
* type: digitalocean:Droplet
* name: example
* properties:
* name: example-01
* size: s-1vcpu-1gb
* image: ubuntu-18-04-x64
* region: nyc3
* vpcUuid: ${example.id}
* ```
*
* ## Import
* A VPC can be imported using its `id`, e.g.
* ```sh
* $ pulumi import digitalocean:index/vpc:Vpc example 506f78a4-e098-11e5-ad9f-000f53306ae1
* ```
* @property description A free-form text field up to a limit of 255 characters to describe the VPC.
* @property ipRange The range of IP addresses for the VPC in CIDR notation. Network ranges cannot overlap with other networks in the same account and must be in range of private addresses as defined in RFC1918. It may not be larger than `/16` or smaller than `/24`.
* @property name A name for the VPC. Must be unique and contain alphanumeric characters, dashes, and periods only.
* @property region The DigitalOcean region slug for the VPC's location.
*/
public data class VpcArgs(
public val description: Output? = null,
public val ipRange: Output? = null,
public val name: Output? = null,
public val region: Output? = null,
) : ConvertibleToJava {
override fun toJava(): com.pulumi.digitalocean.VpcArgs = com.pulumi.digitalocean.VpcArgs.builder()
.description(description?.applyValue({ args0 -> args0 }))
.ipRange(ipRange?.applyValue({ args0 -> args0 }))
.name(name?.applyValue({ args0 -> args0 }))
.region(region?.applyValue({ args0 -> args0 })).build()
}
/**
* Builder for [VpcArgs].
*/
@PulumiTagMarker
public class VpcArgsBuilder internal constructor() {
private var description: Output? = null
private var ipRange: Output? = null
private var name: Output? = null
private var region: Output? = null
/**
* @param value A free-form text field up to a limit of 255 characters to describe the VPC.
*/
@JvmName("yroovorhciwpbpam")
public suspend fun description(`value`: Output) {
this.description = value
}
/**
* @param value The range of IP addresses for the VPC in CIDR notation. Network ranges cannot overlap with other networks in the same account and must be in range of private addresses as defined in RFC1918. It may not be larger than `/16` or smaller than `/24`.
*/
@JvmName("wgrrtnfnwrcdgggd")
public suspend fun ipRange(`value`: Output) {
this.ipRange = value
}
/**
* @param value A name for the VPC. Must be unique and contain alphanumeric characters, dashes, and periods only.
*/
@JvmName("kyvyhasnwwlglddb")
public suspend fun name(`value`: Output) {
this.name = value
}
/**
* @param value The DigitalOcean region slug for the VPC's location.
*/
@JvmName("rofpkedbmddcnqmn")
public suspend fun region(`value`: Output) {
this.region = value
}
/**
* @param value A free-form text field up to a limit of 255 characters to describe the VPC.
*/
@JvmName("bvbjretfjugmtqhq")
public suspend fun description(`value`: String?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.description = mapped
}
/**
* @param value The range of IP addresses for the VPC in CIDR notation. Network ranges cannot overlap with other networks in the same account and must be in range of private addresses as defined in RFC1918. It may not be larger than `/16` or smaller than `/24`.
*/
@JvmName("ocqrbyvypiskhodp")
public suspend fun ipRange(`value`: String?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.ipRange = mapped
}
/**
* @param value A name for the VPC. Must be unique and contain alphanumeric characters, dashes, and periods only.
*/
@JvmName("khmolqsgakyrmpuh")
public suspend fun name(`value`: String?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.name = mapped
}
/**
* @param value The DigitalOcean region slug for the VPC's location.
*/
@JvmName("hbtjfvuocvypfdjj")
public suspend fun region(`value`: String?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.region = mapped
}
internal fun build(): VpcArgs = VpcArgs(
description = description,
ipRange = ipRange,
name = name,
region = region,
)
}