Go client for the Kasm Workspaces API, generated from the official OpenAPI spec.
go get github.com/kasmtech/go-sdk
import sdk "github.com/kasmtech/go-sdk"
kasm, err := sdk.New("https://kasm.example.com", sdk.APIKeyAuth{Key: key, Secret: secret})
img, err := kasm.Admin.Catalog.Images.Get(ctx, imageID)
for zone, err := range kasm.Admin.Infrastructure.Zones.All(ctx, sdk.GetZonesRequest{}) {
...
}Or use a profile kcli is set up with (kcli config init):
import "github.com/kasmtech/go-sdk/profile"
client, err := profile.Client("") // the active profile
client, err := profile.Client("staging")The package root is the public API. The client's fields follow kcli's
command tree (kcli admin catalog images get is
kasm.Admin.Catalog.Images.Get): path parameters are positional, a body is
its model, and query parameters are a *...Params struct, nil for none.
Paged lists also have All, an iter.Seq2 over every page. The methods and
the model types (services.gen.go, models.gen.go) are generated from the
spec, never hand-edited.
The rest is hand-written: one error type carrying RFC 9457 problem+json
fields (sdk.Error), checked with errors.Is against sdk.ErrNotFound,
ErrConflict, ErrValidation and the other status sentinels, with a typed
Problem for the problem types that add fields; sdk.ConnectionError for
failures before a response; a pluggable Authenticator (APIKeyAuth,
BearerAuth); Do, which sends any operation by path; and WithTrace,
which writes every exchange as a JSON line with credentials redacted.
profile/ reads kcli's config.toml and secret store (system keyring, or an
owner-only file), signs in for password profiles and caches the session
token as kcli does. kcli and its MCP server depend on the package root and
profile/.
internal/generated/ is produced by oapi-codegen and is never hand-edited.
The typed methods call it, and the model types are aliases of its types.
This package is generated from the Kasm Workspaces OpenAPI spec, in the same
run as the Python and TypeScript SDKs, and published here from Kasm's kcli
repository: one commit and one vX.Y.Z tag per release, and anything
changed here directly is overwritten by the next. kcli and the three SDKs
share a version number. They are 0.x: no compatibility promise until the
API surface settles.
Licensed under the Apache License 2.0.