package main
import(
"context"
"os"
latitudeshgosdk "github.com/latitudesh/latitudesh-go-sdk"
"github.com/latitudesh/latitudesh-go-sdk/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := latitudeshgosdk.New(
latitudeshgosdk.WithSecurity(os.Getenv("LATITUDESH_BEARER")),
)
res, err := s.Servers.Create(ctx, operations.CreateServerServersRequestBody{
Data: &operations.CreateServerServersData{
Type: operations.CreateServerServersTypeServers,
Attributes: &operations.CreateServerServersAttributes{
Project: latitudeshgosdk.Pointer("proj_A05EdQ50dvKYQ"),
Plan: operations.CreateServerPlanC2SmallX86.ToPointer(),
Site: operations.CreateServerSiteAsh.ToPointer(),
OperatingSystem: operations.CreateServerOperatingSystemUbuntu2204X64Lts.ToPointer(),
Hostname: latitudeshgosdk.Pointer("BRC1"),
},
},
})
if err != nil {
log.Fatal(err)
}
if res.Server != nil {
// handle response
}
}{
"data": {
"type": "servers",
"id": "sv_KXgRdRyoOv9k5",
"attributes": {
"hostname": "BRC1",
"label": "868155NODEVO",
"role": "Bare Metal",
"status": "off",
"primary_ipv4": "29.227.250.123",
"primary_ipv6": "f5:1442:770b:d762:7b55:1583:8420:630b",
"specs": {
"cpu": "Xeon E-2186G CPU @ 3.80GHz (6 cores)",
"disk": "500 GB SSD",
"ram": "32 GB",
"nic": ""
},
"plan": {
"id": "plan_VE1Wd3aXDXnZJ",
"name": "c2.small.x86",
"slug": "c2-small-x86",
"billing": "hourly"
},
"interfaces": [
{
"role": "ipmi",
"name": "IPMI",
"mac_address": "00:11:22:33:44:55",
"description": "IPMI Interface"
},
{
"role": "internal",
"name": "PXE",
"mac_address": "66:77:88:99:aa:bb",
"description": "PXE Interface"
}
]
}
},
"meta": {}
}package main
import(
"context"
"os"
latitudeshgosdk "github.com/latitudesh/latitudesh-go-sdk"
"github.com/latitudesh/latitudesh-go-sdk/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := latitudeshgosdk.New(
latitudeshgosdk.WithSecurity(os.Getenv("LATITUDESH_BEARER")),
)
res, err := s.Servers.Create(ctx, operations.CreateServerServersRequestBody{
Data: &operations.CreateServerServersData{
Type: operations.CreateServerServersTypeServers,
Attributes: &operations.CreateServerServersAttributes{
Project: latitudeshgosdk.Pointer("proj_A05EdQ50dvKYQ"),
Plan: operations.CreateServerPlanC2SmallX86.ToPointer(),
Site: operations.CreateServerSiteAsh.ToPointer(),
OperatingSystem: operations.CreateServerOperatingSystemUbuntu2204X64Lts.ToPointer(),
Hostname: latitudeshgosdk.Pointer("BRC1"),
},
},
})
if err != nil {
log.Fatal(err)
}
if res.Server != nil {
// handle response
}
}{
"data": {
"type": "servers",
"id": "sv_KXgRdRyoOv9k5",
"attributes": {
"hostname": "BRC1",
"label": "868155NODEVO",
"role": "Bare Metal",
"status": "off",
"primary_ipv4": "29.227.250.123",
"primary_ipv6": "f5:1442:770b:d762:7b55:1583:8420:630b",
"specs": {
"cpu": "Xeon E-2186G CPU @ 3.80GHz (6 cores)",
"disk": "500 GB SSD",
"ram": "32 GB",
"nic": ""
},
"plan": {
"id": "plan_VE1Wd3aXDXnZJ",
"name": "c2.small.x86",
"slug": "c2-small-x86",
"billing": "hourly"
},
"interfaces": [
{
"role": "ipmi",
"name": "IPMI",
"mac_address": "00:11:22:33:44:55",
"description": "IPMI Interface"
},
{
"role": "internal",
"name": "PXE",
"mac_address": "66:77:88:99:aa:bb",
"description": "PXE Interface"
}
]
}
},
"meta": {}
}Show child attributes
Was this page helpful?