Skip to main content
POST
/
elastic_ips
Go (SDK)
package main

import(
	"context"
	"os"
	latitudeshgosdk "github.com/latitudesh/latitudesh-go-sdk"
	"github.com/latitudesh/latitudesh-go-sdk/models/components"
	"log"
)

func main() {
    ctx := context.Background()

    s := latitudeshgosdk.New(
        latitudeshgosdk.WithSecurity(os.Getenv("LATITUDESH_BEARER")),
    )

    res, err := s.ElasticIPs.CreateElasticIP(ctx, components.CreateElasticIP{
        Data: components.CreateElasticIPData{
            Type: components.CreateElasticIPTypeElasticIps,
            Attributes: components.CreateElasticIPAttributes{
                ProjectID: "proj_AoW6vRnwkvLn0",
                ServerID: "sv_2GmAlJ6BXlK1a",
            },
        },
    })
    if err != nil {
        log.Fatal(err)
    }
    if res.ElasticIP != nil {
        // handle response
    }
}
{
  "data": {
    "id": null,
    "type": "elastic_ips",
    "attributes": {
      "address": "177.54.156.7",
      "status": "provisioning",
      "project": {
        "id": "proj_AoW6vRnwkvLn0",
        "name": "My Project",
        "slug": "my-project"
      }
    }
  }
}

Authorizations

Authorization
string
header
required

Body

data
object
required

Response

Accepted

data
object
meta
object