![JAR search and dependency download from the Maven repository](/logo.png)
com.pulumi.digitalocean.kotlin.ReservedIp.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.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
/**
* Builder for [ReservedIp].
*/
@PulumiTagMarker
public class ReservedIpResourceBuilder internal constructor() {
public var name: String? = null
public var args: ReservedIpArgs = ReservedIpArgs()
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 ReservedIpArgsBuilder.() -> Unit) {
val builder = ReservedIpArgsBuilder()
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(): ReservedIp {
val builtJavaResource = com.pulumi.digitalocean.ReservedIp(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return ReservedIp(builtJavaResource)
}
}
/**
* Provides a DigitalOcean reserved IP to represent a publicly-accessible static IP addresses that can be mapped to one of your Droplets.
* > **NOTE:** Reserved IPs can be assigned to a Droplet either directly on the `digitalocean.ReservedIp` resource by setting a `droplet_id` or using the `digitalocean.ReservedIpAssignment` resource, but the two cannot be used together.
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as digitalocean from "@pulumi/digitalocean";
* const example = new digitalocean.Droplet("example", {
* name: "example",
* size: digitalocean.DropletSlug.DropletS1VCPU1GB,
* image: "ubuntu-22-04-x64",
* region: digitalocean.Region.NYC3,
* ipv6: true,
* privateNetworking: true,
* });
* const exampleReservedIp = new digitalocean.ReservedIp("example", {
* dropletId: example.id,
* region: example.region,
* });
* ```
* ```python
* import pulumi
* import pulumi_digitalocean as digitalocean
* example = digitalocean.Droplet("example",
* name="example",
* size=digitalocean.DropletSlug.DROPLET_S1_VCPU1_GB,
* image="ubuntu-22-04-x64",
* region=digitalocean.Region.NYC3,
* ipv6=True,
* private_networking=True)
* example_reserved_ip = digitalocean.ReservedIp("example",
* droplet_id=example.id,
* region=example.region)
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using DigitalOcean = Pulumi.DigitalOcean;
* return await Deployment.RunAsync(() =>
* {
* var example = new DigitalOcean.Droplet("example", new()
* {
* Name = "example",
* Size = DigitalOcean.DropletSlug.DropletS1VCPU1GB,
* Image = "ubuntu-22-04-x64",
* Region = DigitalOcean.Region.NYC3,
* Ipv6 = true,
* PrivateNetworking = true,
* });
* var exampleReservedIp = new DigitalOcean.ReservedIp("example", new()
* {
* DropletId = example.Id,
* Region = example.Region,
* });
* });
* ```
* ```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.NewDroplet(ctx, "example", &digitalocean.DropletArgs{
* Name: pulumi.String("example"),
* 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.NewReservedIp(ctx, "example", &digitalocean.ReservedIpArgs{
* DropletId: example.ID(),
* Region: example.Region,
* })
* 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.Droplet;
* import com.pulumi.digitalocean.DropletArgs;
* import com.pulumi.digitalocean.ReservedIp;
* import com.pulumi.digitalocean.ReservedIpArgs;
* 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 Droplet("example", DropletArgs.builder()
* .name("example")
* .size("s-1vcpu-1gb")
* .image("ubuntu-22-04-x64")
* .region("nyc3")
* .ipv6(true)
* .privateNetworking(true)
* .build());
* var exampleReservedIp = new ReservedIp("exampleReservedIp", ReservedIpArgs.builder()
* .dropletId(example.id())
* .region(example.region())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* example:
* type: digitalocean:Droplet
* properties:
* name: example
* size: s-1vcpu-1gb
* image: ubuntu-22-04-x64
* region: nyc3
* ipv6: true
* privateNetworking: true
* exampleReservedIp:
* type: digitalocean:ReservedIp
* name: example
* properties:
* dropletId: ${example.id}
* region: ${example.region}
* ```
*
* ## Import
* Reserved IPs can be imported using the `ip`, e.g.
* ```sh
* $ pulumi import digitalocean:index/reservedIp:ReservedIp myip 192.168.0.1
* ```
*/
public class ReservedIp internal constructor(
override val javaResource: com.pulumi.digitalocean.ReservedIp,
) : KotlinCustomResource(javaResource, ReservedIpMapper) {
/**
* The ID of Droplet that the reserved IP will be assigned to.
*/
public val dropletId: Output?
get() = javaResource.dropletId().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })
/**
* The IP Address of the resource
*/
public val ipAddress: Output
get() = javaResource.ipAddress().applyValue({ args0 -> args0 })
/**
* The region that the reserved IP is reserved to.
*/
public val region: Output
get() = javaResource.region().applyValue({ args0 -> args0 })
/**
* The uniform resource name of the reserved ip
*/
public val reservedIpUrn: Output
get() = javaResource.reservedIpUrn().applyValue({ args0 -> args0 })
}
public object ReservedIpMapper : ResourceMapper {
override fun supportsMappingOfType(javaResource: Resource): Boolean =
com.pulumi.digitalocean.ReservedIp::class == javaResource::class
override fun map(javaResource: Resource): ReservedIp = ReservedIp(
javaResource as
com.pulumi.digitalocean.ReservedIp,
)
}
/**
* @see [ReservedIp].
* @param name The _unique_ name of the resulting resource.
* @param block Builder for [ReservedIp].
*/
public suspend fun reservedIp(name: String, block: suspend ReservedIpResourceBuilder.() -> Unit): ReservedIp {
val builder = ReservedIpResourceBuilder()
builder.name(name)
block(builder)
return builder.build()
}
/**
* @see [ReservedIp].
* @param name The _unique_ name of the resulting resource.
*/
public fun reservedIp(name: String): ReservedIp {
val builder = ReservedIpResourceBuilder()
builder.name(name)
return builder.build()
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy