Skip to content

SDKs

Typed SDKs for Go, Python, Node.js, and PHP.

Language Status
Go Preview
Python Preview
Node.js Preview
PHP Preview

Download

Tarballs and SHA-256 checksums on sdk.kernstack.com (latest/ channel).

Language sdk.tar sdk.tar.sha256
Go go/latest/sdk.tar go/latest/sdk.tar.sha256
Python python/latest/sdk.tar python/latest/sdk.tar.sha256
Node.js nodejs/latest/sdk.tar nodejs/latest/sdk.tar.sha256
PHP php/latest/sdk.tar php/latest/sdk.tar.sha256

Vendor with the CLI

kernstack init, kernstack add function, and kernstack add worker download SDKs into .kernstack/sdk-<lang>-v1/ (version from sdk_version_* in .kernstack/config). Keep .kernstack/ out of git.

Initialize a client

Build an access key set (key ID, secret, zone) and pass it to a service client. Inside deployed functions and workers, read it from KERNSTACK_ACCESS_KEY_ID, KERNSTACK_ACCESS_KEY_SECRET, and KERNSTACK_DZONE instead of hardcoding keys.

Go

import (
    "github.com/coding-berlin/kernstack-sdk-go/common/auth_sdk/auth_sdk_accesskey"
    "github.com/coding-berlin/kernstack-sdk-go/sdk_tables/sdk_client_tables"
)

aks, err := auth_sdk_accesskey.GetDefaultAccessKeySet()
if err != nil {
    panic(err)
}
client := sdk_client_tables.NewClient(sdk_client_tables.TablesClientConfig{
    DZone:        aks.DZone,
    AccessKeySet: &aks,
})

Python

from kernstack_sdk import TablesClient, TablesClientConfig, DZone, new_access_key_set

access_key_set = new_access_key_set("ks_abc123", "ks_secret_xyz", DZone.PREVIEW_2)

client = TablesClient(TablesClientConfig(
    dzone=DZone.PREVIEW_2,
    access_key_set=access_key_set,
))

Node.js

const { TablesClient, TablesClientConfig, DZone, newAccessKeySet } = require('kernstack-sdk');

const accessKeySet = newAccessKeySet('ks_abc123', 'ks_secret_xyz', DZone.PREVIEW_2);

const client = new TablesClient(new TablesClientConfig({
    dzone: DZone.PREVIEW_2,
    accessKeySet,
}));

PHP

use Kernstack\Common\DZone;
use Kernstack\Tables\TablesClient;
use Kernstack\Tables\TablesClientConfig;
use function Kernstack\Common\newAccessKeySet;

$accessKeySet = newAccessKeySet('ks_abc123', 'ks_secret_xyz', DZone::PREVIEW_2);

$client = new TablesClient(new TablesClientConfig(DZone::PREVIEW_2, $accessKeySet));