xelon-sdk-go is the official Xelon SDK for the Go programming language.
# X.Y.Z is the version you need
go get github.com/Xelon-AG/xelon-sdk-go@vX.Y.Z
# for non Go modules usage or latest version
go get github.com/Xelon-AG/xelon-sdk-goimport "github.com/Xelon-AG/xelon-sdk-go"Create a new Xelon client, then use the exposed services to access different parts of the Xelon API.
Currently, Bearer token is the only method of authenticating with the API. You can learn how to obtain it here. Then use your token to create a new client:
client := xelon.NewClient("my-secret-token")If you want to specify more parameters by client initialization, use
With... methods and pass via option pattern:
var opts []xelon.ClientOption
opts = append(opts, xelon.WithBaseURL(baseURL))
opts = append(opts, xelon.WithClientID(clientID))
opts = append(opts, xelon.WithUserAgent(userAgent))
client := xelon.NewClient("my-secret-token", opts...)List all ssh keys for the user.
func main() {
client := xelon.NewClient("my-secret-token")
// list all ssh keys for the authenticated user
ctx := context.Background()
sshKeys, _, err := client.SSHKeys.List(ctx)
}Upload a small local ISO directly to a cloud datastore.
file, err := os.Open("oemdrv.iso")
if err != nil {
// handle error
}
defer file.Close()
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute)
defer cancel()
iso, _, err := client.ISOs.Upload(ctx, &xelon.ISOUploadRequest{
CategoryID: 1,
CloudID: "cloud-123",
File: file,
Filename: file.Name(),
Name: "oemdrv",
})ISO uploads use a two-minute SDK fallback timeout. A caller-provided context
deadline overrides that fallback. When WithHTTPClient is used, the supplied
HTTP client owns timeout policy instead. The server documents a 20 MB maximum
for direct uploads; use URL-based ISOs.Create for larger installation media.
We love pull requests! Please see the contribution guidelines.
This SDK is distributed under the Apache-2.0 license, see LICENSE for more information.