Golang SDK

Octelium APIs are all developed over gRPC. Currently the Golang implementation is officially supported and as it is the primary programming language for developing Octelium itself. For example, most octeliumctl commands are nothing but wrappers over the Cluster's Core API (or service methods according to the gRPC nomenclature). The octelium-go library makes it easy for Golang-based applications to actually authenticate to the Cluster, mainly using an authentication token (read more about authentication token Credentials here), interact with its APIs, and also be able to access the Cluster's Services without having to worry about manually re-authentcating their Session before its access token expires.

Here is a simple example that uses octelium-go client to create a gRPC client that can access the Core API service methods to manage the different Core API resources such as User and ClusterConfig:

1
package main
2
3
import (
4
"context"
5
"fmt"
6
"os"
7
8
"github.com/octelium/octelium/apis/main/corev1"
9
"github.com/octelium/octelium/apis/main/metav1"
10
"github.com/octelium/octelium/octelium-go"
11
)
12
13
func main() {
14
if err := doMain(context.Background()); err != nil {
15
panic(err)
16
}
17
}
18
19
func doMain(ctx context.Context) error {
20
octeliumC, err := octelium.NewClient(ctx, &octelium.ClientConfig{
21
Domain: "example.com",
22
AuthenticationToken: os.Getenv("AUTH_TOKEN"),
23
})
24
if err != nil {
25
return err
26
}
27
28
defer octeliumC.Close()
29
30
grpcConn, err := octeliumC.GRPC().GetConn(ctx)
31
if err != nil {
32
return err
33
}
34
coreC := corev1.NewMainServiceClient(grpcConn)
35
{
36
37
usr, err := coreC.CreateUser(ctx, &corev1.User{
38
Metadata: &metav1.Metadata{
39
Name: "usr-01",
40
},
41
Spec: &corev1.User_Spec{
42
Type: corev1.User_Spec_HUMAN,
43
Email: "[email protected]",
44
},
45
})
46
if err != nil {
47
return err
48
}
49
50
userList, err := coreC.ListUser(ctx, &corev1.ListUserOptions{})
51
if err != nil {
52
return err
53
}
54
fmt.Printf("%+v\n", userList)
55
56
usr, err = coreC.GetUser(ctx, &metav1.GetOptions{
57
Name: usr.Metadata.Name,
58
})
59
if err != nil {
60
return err
61
}
62
63
_, err = coreC.DeleteUser(ctx, &metav1.DeleteOptions{
64
Uid: usr.Metadata.Uid,
65
})
66
if err != nil {
67
return err
68
}
69
}
70
71
{
72
cc, err := coreC.GetClusterConfig(ctx, &corev1.GetClusterConfigRequest{})
73
if err != nil {
74
return err
75
}
76
cc.Spec.Session = &corev1.ClusterConfig_Spec_Session{
77
Human: &corev1.ClusterConfig_Spec_Session_Human{
78
MaxPerUser: 16,
79
},
80
}
81
_, err = coreC.UpdateClusterConfig(ctx, cc)
82
if err != nil {
83
return err
84
}
85
}
86
87
return nil
88
}

You can also use the Octelium Golang client in your HTTP and gRPC clients to access the Cluster publicly exposed/BeyondCorp Services. You can discover more examples about using the GO SDK to access APIs and Kubernetes clusters here and here.

© 2025 octelium.comOctelium Labs, LLCAll rights reserved
Octelium and Octelium logo are trademarks of Octelium Labs, LLC.
WireGuard is a registered trademark of Jason A. Donenfeld