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

com.pulumi.digitalocean.kotlin.ReservedIpAssignmentArgs.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: 4.38.0.0
Show newest version
@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.ReservedIpAssignmentArgs.builder
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import kotlin.Int
import kotlin.String
import kotlin.Suppress
import kotlin.jvm.JvmName

/**
 * Provides a resource for assigning an existing DigitalOcean reserved IP to a Droplet. This
 * makes it easy to provision reserved IP addresses that are not tied to the lifecycle of your
 * Droplet.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as digitalocean from "@pulumi/digitalocean";
 * const example = new digitalocean.ReservedIp("example", {region: "nyc3"});
 * const exampleDroplet = new digitalocean.Droplet("example", {
 *     name: "baz",
 *     size: digitalocean.DropletSlug.DropletS1VCPU1GB,
 *     image: "ubuntu-22-04-x64",
 *     region: digitalocean.Region.NYC3,
 *     ipv6: true,
 *     privateNetworking: true,
 * });
 * const exampleReservedIpAssignment = new digitalocean.ReservedIpAssignment("example", {
 *     ipAddress: example.ipAddress,
 *     dropletId: exampleDroplet.id,
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_digitalocean as digitalocean
 * example = digitalocean.ReservedIp("example", region="nyc3")
 * example_droplet = digitalocean.Droplet("example",
 *     name="baz",
 *     size=digitalocean.DropletSlug.DROPLET_S1_VCPU1_GB,
 *     image="ubuntu-22-04-x64",
 *     region=digitalocean.Region.NYC3,
 *     ipv6=True,
 *     private_networking=True)
 * example_reserved_ip_assignment = digitalocean.ReservedIpAssignment("example",
 *     ip_address=example.ip_address,
 *     droplet_id=example_droplet.id)
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using DigitalOcean = Pulumi.DigitalOcean;
 * return await Deployment.RunAsync(() =>
 * {
 *     var example = new DigitalOcean.ReservedIp("example", new()
 *     {
 *         Region = "nyc3",
 *     });
 *     var exampleDroplet = new DigitalOcean.Droplet("example", new()
 *     {
 *         Name = "baz",
 *         Size = DigitalOcean.DropletSlug.DropletS1VCPU1GB,
 *         Image = "ubuntu-22-04-x64",
 *         Region = DigitalOcean.Region.NYC3,
 *         Ipv6 = true,
 *         PrivateNetworking = true,
 *     });
 *     var exampleReservedIpAssignment = new DigitalOcean.ReservedIpAssignment("example", new()
 *     {
 *         IpAddress = example.IpAddress,
 *         DropletId = exampleDroplet.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.NewReservedIp(ctx, "example", &digitalocean.ReservedIpArgs{
 * 			Region: pulumi.String("nyc3"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleDroplet, err := digitalocean.NewDroplet(ctx, "example", &digitalocean.DropletArgs{
 * 			Name:              pulumi.String("baz"),
 * 			Size:              pulumi.String(digitalocean.DropletSlugDropletS1VCPU1GB),
 * 			Image:             pulumi.String("ubuntu-22-04-x64"),
 * 			Region:            pulumi.String(digitalocean.RegionNYC3),
 * 			Ipv6:              pulumi.Bool(true),
 * 			PrivateNetworking: pulumi.Bool(true),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = digitalocean.NewReservedIpAssignment(ctx, "example", &digitalocean.ReservedIpAssignmentArgs{
 * 			IpAddress: example.IpAddress,
 * 			DropletId: exampleDroplet.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.ReservedIp;
 * import com.pulumi.digitalocean.ReservedIpArgs;
 * import com.pulumi.digitalocean.Droplet;
 * import com.pulumi.digitalocean.DropletArgs;
 * import com.pulumi.digitalocean.ReservedIpAssignment;
 * import com.pulumi.digitalocean.ReservedIpAssignmentArgs;
 * 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 ReservedIp("example", ReservedIpArgs.builder()
 *             .region("nyc3")
 *             .build());
 *         var exampleDroplet = new Droplet("exampleDroplet", DropletArgs.builder()
 *             .name("baz")
 *             .size("s-1vcpu-1gb")
 *             .image("ubuntu-22-04-x64")
 *             .region("nyc3")
 *             .ipv6(true)
 *             .privateNetworking(true)
 *             .build());
 *         var exampleReservedIpAssignment = new ReservedIpAssignment("exampleReservedIpAssignment", ReservedIpAssignmentArgs.builder()
 *             .ipAddress(example.ipAddress())
 *             .dropletId(exampleDroplet.id())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: digitalocean:ReservedIp
 *     properties:
 *       region: nyc3
 *   exampleDroplet:
 *     type: digitalocean:Droplet
 *     name: example
 *     properties:
 *       name: baz
 *       size: s-1vcpu-1gb
 *       image: ubuntu-22-04-x64
 *       region: nyc3
 *       ipv6: true
 *       privateNetworking: true
 *   exampleReservedIpAssignment:
 *     type: digitalocean:ReservedIpAssignment
 *     name: example
 *     properties:
 *       ipAddress: ${example.ipAddress}
 *       dropletId: ${exampleDroplet.id}
 * ```
 * 
 * ## Import
 * Reserved IP assignments can be imported using the reserved IP itself and the `id` of
 * the Droplet joined with a comma. For example:
 * ```sh
 * $ pulumi import digitalocean:index/reservedIpAssignment:ReservedIpAssignment foobar 192.0.2.1,123456
 * ```
 * @property dropletId The ID of Droplet that the reserved IP will be assigned to.
 * @property ipAddress The reserved IP to assign to the Droplet.
 */
public data class ReservedIpAssignmentArgs(
    public val dropletId: Output? = null,
    public val ipAddress: Output? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.digitalocean.ReservedIpAssignmentArgs =
        com.pulumi.digitalocean.ReservedIpAssignmentArgs.builder()
            .dropletId(dropletId?.applyValue({ args0 -> args0 }))
            .ipAddress(ipAddress?.applyValue({ args0 -> args0 })).build()
}

/**
 * Builder for [ReservedIpAssignmentArgs].
 */
@PulumiTagMarker
public class ReservedIpAssignmentArgsBuilder internal constructor() {
    private var dropletId: Output? = null

    private var ipAddress: Output? = null

    /**
     * @param value The ID of Droplet that the reserved IP will be assigned to.
     */
    @JvmName("ufqlcsfcxegoubvx")
    public suspend fun dropletId(`value`: Output) {
        this.dropletId = value
    }

    /**
     * @param value The reserved IP to assign to the Droplet.
     */
    @JvmName("mbyqhyrguyldlfgf")
    public suspend fun ipAddress(`value`: Output) {
        this.ipAddress = value
    }

    /**
     * @param value The ID of Droplet that the reserved IP will be assigned to.
     */
    @JvmName("myssaowrixulqgjl")
    public suspend fun dropletId(`value`: Int?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.dropletId = mapped
    }

    /**
     * @param value The reserved IP to assign to the Droplet.
     */
    @JvmName("uiuxymxpxpysuxwy")
    public suspend fun ipAddress(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.ipAddress = mapped
    }

    internal fun build(): ReservedIpAssignmentArgs = ReservedIpAssignmentArgs(
        dropletId = dropletId,
        ipAddress = ipAddress,
    )
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy