package main
import(
"context"
"os"
latitudeshgosdk "github.com/latitudesh/latitudesh-go-sdk"
"log"
)
func main() {
ctx := context.Background()
s := latitudeshgosdk.New(
latitudeshgosdk.WithSecurity(os.Getenv("LATITUDESH_BEARER")),
)
res, err := s.Servers.Lock(ctx, "sv_pbV0DgjKq4AWz")
if err != nil {
log.Fatal(err)
}
if res.Server != nil {
// handle response
}
}{
"data": {
"id": "sv_pbV0DgjKq4AWz",
"type": "servers",
"attributes": {
"hostname": "Heavy Duty Concrete Chair",
"label": "946654NODEUT",
"price": 599,
"ipmi_status": "Normal",
"scheduled_deletion_at": null,
"status": "unknown",
"role": "Enclosure",
"primary_ipv4": "150.158.19.54",
"created_at": null,
"locked": true,
"team": {
"id": "team_zAoElw92Z1c36A13Vx9EF71RlMl",
"name": "467 Team",
"slug": "467-team",
"description": "467 Team",
"address": "Suite 277 939 Hermann Mall, Hongshire, NH 77247-8873",
"status": "verified",
"currency": {
"id": "cur_AW6Q2D9lqKLpr",
"code": "BRL",
"name": "Brazilian Real",
"currency_id": null
}
},
"project": {
"id": "proj_Gr47qloZdAg0m",
"name": "Heavy Duty Linen Bottle",
"slug": "heavy-duty-linen-bottle",
"description": "Awesome Copper Lamp",
"billing_type": "Normal",
"billing_method": "Normal",
"bandwidth_alert": false,
"environment": null,
"billing": {
"subscription_id": "sub_6rq7u7562p9hap",
"type": "Normal",
"method": "Normal"
},
"stats": {
"databases": 0,
"ip_addresses": 0,
"prefixes": 0,
"servers": 1,
"storages": 0,
"virtual_machines": 0,
"vlans": 0
}
},
"region": {
"city": "Frankfurt 132",
"country": "Germany 147",
"site": {
"id": "loc_Gr47ql4vqAg0m",
"name": "Frankfurt 132",
"slug": "FRA113",
"facility": "Frankfurt 132"
}
}
}
}
}Locks the server. A locked server cannot be deleted or modified and no actions can be performed on it.
package main
import(
"context"
"os"
latitudeshgosdk "github.com/latitudesh/latitudesh-go-sdk"
"log"
)
func main() {
ctx := context.Background()
s := latitudeshgosdk.New(
latitudeshgosdk.WithSecurity(os.Getenv("LATITUDESH_BEARER")),
)
res, err := s.Servers.Lock(ctx, "sv_pbV0DgjKq4AWz")
if err != nil {
log.Fatal(err)
}
if res.Server != nil {
// handle response
}
}{
"data": {
"id": "sv_pbV0DgjKq4AWz",
"type": "servers",
"attributes": {
"hostname": "Heavy Duty Concrete Chair",
"label": "946654NODEUT",
"price": 599,
"ipmi_status": "Normal",
"scheduled_deletion_at": null,
"status": "unknown",
"role": "Enclosure",
"primary_ipv4": "150.158.19.54",
"created_at": null,
"locked": true,
"team": {
"id": "team_zAoElw92Z1c36A13Vx9EF71RlMl",
"name": "467 Team",
"slug": "467-team",
"description": "467 Team",
"address": "Suite 277 939 Hermann Mall, Hongshire, NH 77247-8873",
"status": "verified",
"currency": {
"id": "cur_AW6Q2D9lqKLpr",
"code": "BRL",
"name": "Brazilian Real",
"currency_id": null
}
},
"project": {
"id": "proj_Gr47qloZdAg0m",
"name": "Heavy Duty Linen Bottle",
"slug": "heavy-duty-linen-bottle",
"description": "Awesome Copper Lamp",
"billing_type": "Normal",
"billing_method": "Normal",
"bandwidth_alert": false,
"environment": null,
"billing": {
"subscription_id": "sub_6rq7u7562p9hap",
"type": "Normal",
"method": "Normal"
},
"stats": {
"databases": 0,
"ip_addresses": 0,
"prefixes": 0,
"servers": 1,
"storages": 0,
"virtual_machines": 0,
"vlans": 0
}
},
"region": {
"city": "Frankfurt 132",
"country": "Germany 147",
"site": {
"id": "loc_Gr47ql4vqAg0m",
"name": "Frankfurt 132",
"slug": "FRA113",
"facility": "Frankfurt 132"
}
}
}
}
}Was this page helpful?