Under api you can find our SDK to access Namespace Compute/Storage APIs.
The SDK also handles credential management for you:
- From a workstation, run
nsc login, and then runauth.LoadUsertoken() - From an instance run
auth.LoadWorkloadToken()(it uses a per-instance workload identity system) - Or to handle either, just do
auth.LoadDefaults()
And then use the resulting api.TokenSource with the APIs.
The Namespace Compute SDK can be found at api/compute.
It provides GRPC clients ready to use.
The public API definition can be found at buf.build/namespace.
The Namespace Storage SDK can be found at api/storage.
It provides GRPC clients ready to use.
Also, it provides convenience wrappers to simplify the upload/download of artifacts using the io.Reader API.
For large artifacts, storage/downloader supports parallel downloads, retries, and resuming partial downloads.
The public API definition can be found at buf.build/namespace.
api/github provides a client for GitHub runner profiles
(namespace.cloud.github.v1beta.ProfileService), and
api/network one for workspace egress policies
(namespace.cloud.network.v1beta.EgressPolicyService).
Both connect to https://global.namespaceapis.com by default (override with NSC_PUBLIC_GLOBAL_ENDPOINT).
api/apitest provides in-memory fakes of Namespace APIs for tests, currently
runner profiles and egress policies. They copy production's validation rules,
error codes and messages, defaults and normalization, and version semantics,
so code tested against them behaves the same way against Namespace.
srv, err := apitest.NewServer()
if err != nil { ... }
defer srv.Close()
cli, err := srv.GitHubClient(ctx) // or srv.NetworkClient(ctx)apitest.NewTLSServer listens on a localhost port, for callers running in
another process. See the package documentation for the configuration knobs
and what is not modeled.
Generated Go protobuf and gRPC packages are checked in under proto.
Regenerate them from a sibling checkout of namespacelabs/internal with:
./scripts/generate-protos.shSet NS_INTERNAL to use an internal checkout in another location.
This repository hosts a series of integration tools that can be used either standalone, or with Namespace's cloud.
fetch-gcp-secret: A self-contained binary that fetches a secret managed by GCP Secret Manager into a local file. It also supports Namespace's GCP workload federation.git-credential-nsc: A generic git credential helper that resolves short-lived credentials for the repository git is cloning from (ObtainGitCredentialsForRepository), supporting every host the SecretsService does (GitHub, Cursor Origin). Unlikegit-credential-nsc-github-credentials, it needs no--repositoryor--secret_idflags; install it with:(git only passes the repository path to helpers whengit config --global credential.helper "/path/git-credential-nsc" git config --global credential.useHttpPath true
useHttpPathis enabled; helper flags such as--debuggo before the action, e.g.git config --global credential.helper "/path/git-credential-nsc --debug"). Usegit-credential-nsc --version(or-v) to print its build's Git commit SHA;--debugalso prints the SHA to stderr duringgetoperations.git-credential-nsc-github-credentials: A git credential helper that issues GitHub-only short-term tokens for a fixed--repository/--secret_idpair viaObtainGitHubCredentials.