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.UserData.CreateNew(ctx, operations.PostUserDataUserDataRequestBody{
Data: operations.PostUserDataUserDataData{
Type: operations.PostUserDataUserDataTypeUserData,
Attributes: &operations.PostUserDataUserDataAttributes{
Description: "User Data description",
Project: latitudeshgosdk.Pointer("proj_AW6Q2D9lqKLpr"),
Content: "I2Nsb3VkLWNvbmZpZwpydW5jbWQ6CiAtIFsgdG91Y2gsICAvaG9tZS91YnVudHUvdGVzdCBd",
},
},
})
if err != nil {
log.Fatal(err)
}
if res.UserData != nil {
// handle response
}
}{
"data": {
"id": "ud_GKN4ydzgqVob3",
"type": "user_data",
"attributes": {
"description": "User Data description",
"content": "I2Nsb3VkLWNvbmZpZwpydW5jbWQ6CiAtIFsgdG91Y2gsICAvaG9tZS91YnVudHUvdGVzdCBd",
"created_at": "2025-07-16T18:37:12+00:00",
"updated_at": "2025-07-16T18:37:12+00:00",
"decoded_content": "#cloud-config\nruncmd:\n - [ touch, /home/ubuntu/test ]"
}
},
"meta": {}
}Allows you to create User Data in a team, which can be used to perform custom setup on your servers after deploy and reinstall.
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.UserData.CreateNew(ctx, operations.PostUserDataUserDataRequestBody{
Data: operations.PostUserDataUserDataData{
Type: operations.PostUserDataUserDataTypeUserData,
Attributes: &operations.PostUserDataUserDataAttributes{
Description: "User Data description",
Project: latitudeshgosdk.Pointer("proj_AW6Q2D9lqKLpr"),
Content: "I2Nsb3VkLWNvbmZpZwpydW5jbWQ6CiAtIFsgdG91Y2gsICAvaG9tZS91YnVudHUvdGVzdCBd",
},
},
})
if err != nil {
log.Fatal(err)
}
if res.UserData != nil {
// handle response
}
}{
"data": {
"id": "ud_GKN4ydzgqVob3",
"type": "user_data",
"attributes": {
"description": "User Data description",
"content": "I2Nsb3VkLWNvbmZpZwpydW5jbWQ6CiAtIFsgdG91Y2gsICAvaG9tZS91YnVudHUvdGVzdCBd",
"created_at": "2025-07-16T18:37:12+00:00",
"updated_at": "2025-07-16T18:37:12+00:00",
"decoded_content": "#cloud-config\nruncmd:\n - [ touch, /home/ubuntu/test ]"
}
},
"meta": {}
}Show child attributes
Was this page helpful?