All Downloads are FREE. Search and download functionalities are using the official Maven repository.
Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
com.pulumi.digitalocean.kotlin.FloatingIp.kt Maven / Gradle / Ivy
@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 [FloatingIp].
*/
@PulumiTagMarker
public class FloatingIpResourceBuilder internal constructor() {
public var name: String? = null
public var args: FloatingIpArgs = FloatingIpArgs()
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 FloatingIpArgsBuilder.() -> Unit) {
val builder = FloatingIpArgsBuilder()
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(): FloatingIp {
val builtJavaResource = com.pulumi.digitalocean.FloatingIp(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return FloatingIp(builtJavaResource)
}
}
/**
* > **Deprecated:** DigitalOcean Floating IPs have been renamed reserved IPs. This resource will be removed in a future release. Please use `digitalocean.ReservedIp` instead.
* Provides a DigitalOcean Floating IP to represent a publicly-accessible static IP addresses that can be mapped to one of your Droplets.
* > **NOTE:** Floating IPs can be assigned to a Droplet either directly on the `digitalocean.FloatingIp` resource by setting a `droplet_id` or using the `digitalocean.FloatingIpAssignment` resource, but the two cannot be used together.
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as digitalocean from "@pulumi/digitalocean";
* const foobar = new digitalocean.Droplet("foobar", {
* name: "baz",
* size: digitalocean.DropletSlug.DropletS1VCPU1GB,
* image: "ubuntu-18-04-x64",
* region: digitalocean.Region.SGP1,
* ipv6: true,
* privateNetworking: true,
* });
* const foobarFloatingIp = new digitalocean.FloatingIp("foobar", {
* dropletId: foobar.id,
* region: foobar.region,
* });
* ```
* ```python
* import pulumi
* import pulumi_digitalocean as digitalocean
* foobar = digitalocean.Droplet("foobar",
* name="baz",
* size=digitalocean.DropletSlug.DROPLET_S1_VCPU1_GB,
* image="ubuntu-18-04-x64",
* region=digitalocean.Region.SGP1,
* ipv6=True,
* private_networking=True)
* foobar_floating_ip = digitalocean.FloatingIp("foobar",
* droplet_id=foobar.id,
* region=foobar.region)
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using DigitalOcean = Pulumi.DigitalOcean;
* return await Deployment.RunAsync(() =>
* {
* var foobar = new DigitalOcean.Droplet("foobar", new()
* {
* Name = "baz",
* Size = DigitalOcean.DropletSlug.DropletS1VCPU1GB,
* Image = "ubuntu-18-04-x64",
* Region = DigitalOcean.Region.SGP1,
* Ipv6 = true,
* PrivateNetworking = true,
* });
* var foobarFloatingIp = new DigitalOcean.FloatingIp("foobar", new()
* {
* DropletId = foobar.Id,
* Region = foobar.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 {
* foobar, err := digitalocean.NewDroplet(ctx, "foobar", &digitalocean.DropletArgs{
* Name: pulumi.String("baz"),
* Size: pulumi.String(digitalocean.DropletSlugDropletS1VCPU1GB),
* Image: pulumi.String("ubuntu-18-04-x64"),
* Region: pulumi.String(digitalocean.RegionSGP1),
* Ipv6: pulumi.Bool(true),
* PrivateNetworking: pulumi.Bool(true),
* })
* if err != nil {
* return err
* }
* _, err = digitalocean.NewFloatingIp(ctx, "foobar", &digitalocean.FloatingIpArgs{
* DropletId: foobar.ID(),
* Region: foobar.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.FloatingIp;
* import com.pulumi.digitalocean.FloatingIpArgs;
* 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 foobar = new Droplet("foobar", DropletArgs.builder()
* .name("baz")
* .size("s-1vcpu-1gb")
* .image("ubuntu-18-04-x64")
* .region("sgp1")
* .ipv6(true)
* .privateNetworking(true)
* .build());
* var foobarFloatingIp = new FloatingIp("foobarFloatingIp", FloatingIpArgs.builder()
* .dropletId(foobar.id())
* .region(foobar.region())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* foobar:
* type: digitalocean:Droplet
* properties:
* name: baz
* size: s-1vcpu-1gb
* image: ubuntu-18-04-x64
* region: sgp1
* ipv6: true
* privateNetworking: true
* foobarFloatingIp:
* type: digitalocean:FloatingIp
* name: foobar
* properties:
* dropletId: ${foobar.id}
* region: ${foobar.region}
* ```
*
* ## Import
* Floating IPs can be imported using the `ip`, e.g.
* ```sh
* $ pulumi import digitalocean:index/floatingIp:FloatingIp myip 192.168.0.1
* ```
*/
public class FloatingIp internal constructor(
override val javaResource: com.pulumi.digitalocean.FloatingIp,
) : KotlinCustomResource(javaResource, FloatingIpMapper) {
/**
* The ID of Droplet that the Floating IP will be assigned to.
*/
public val dropletId: Output?
get() = javaResource.dropletId().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })
/**
* The uniform resource name of the floating ip
*/
public val floatingIpUrn: Output
get() = javaResource.floatingIpUrn().applyValue({ args0 -> args0 })
/**
* The IP Address of the resource
*/
public val ipAddress: Output
get() = javaResource.ipAddress().applyValue({ args0 -> args0 })
/**
* The region that the Floating IP is reserved to.
*/
public val region: Output
get() = javaResource.region().applyValue({ args0 -> args0 })
}
public object FloatingIpMapper : ResourceMapper {
override fun supportsMappingOfType(javaResource: Resource): Boolean =
com.pulumi.digitalocean.FloatingIp::class == javaResource::class
override fun map(javaResource: Resource): FloatingIp = FloatingIp(
javaResource as
com.pulumi.digitalocean.FloatingIp,
)
}
/**
* @see [FloatingIp].
* @param name The _unique_ name of the resulting resource.
* @param block Builder for [FloatingIp].
*/
public suspend fun floatingIp(name: String, block: suspend FloatingIpResourceBuilder.() -> Unit): FloatingIp {
val builder = FloatingIpResourceBuilder()
builder.name(name)
block(builder)
return builder.build()
}
/**
* @see [FloatingIp].
* @param name The _unique_ name of the resulting resource.
*/
public fun floatingIp(name: String): FloatingIp {
val builder = FloatingIpResourceBuilder()
builder.name(name)
return builder.build()
}