https://github.com/rigdev/rig-go-sdk
Go SDK for Rig.dev - The application platform for Kubernetes
https://github.com/rigdev/rig-go-sdk
go golang sdk
Last synced: 10 months ago
JSON representation
Go SDK for Rig.dev - The application platform for Kubernetes
- Host: GitHub
- URL: https://github.com/rigdev/rig-go-sdk
- Owner: rigdev
- License: apache-2.0
- Created: 2023-09-01T11:09:45.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-10-29T08:51:04.000Z (over 1 year ago)
- Last Synced: 2025-05-19T06:09:44.931Z (10 months ago)
- Topics: go, golang, sdk
- Language: Go
- Homepage: https://rig.dev
- Size: 58.6 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Rig Golang SDK
## Overview
Rig provides the tools, modules and infrastructure you need to develop and manage applications on Kubernetes. The Rig Golang SDK enables access to Rig services from privileged environments (such as servers or cloud) in Golang.
For more information, visit the [Rig Golang SDK setup guide](https://docs.rig.dev/sdks/golang).
## Installation
The Rig Golang SDK can be installed using the go install utility:
```
# Install the latest version:
go get github.com/rigdev/rig-go-sdk@latest
# Or install a specific version:
go get github.com/rigdev/rig-go-sdk@x.x.x
```
## Setup the Client
To setup the client use the `rig.NewClient` method:
```go
package main
import (
"context"
"fmt"
"log"
"connectrpc.com/connect"
rig "github.com/rigdev/rig-go-sdk"
"github.com/rigdev/rig-go-api/api/v1/user"
)
func main() {
client := rig.NewClient()
// you can now make requests to Rig
if _, err := client.User().Create(context.Background(), connect.NewRequest(&user.CreateRequest{
Initializers: []*user.Update{},
})); err != nil {
log.Fatal(err)
}
fmt.Println("success")
}
```
### Host
By default, the SDK will connect to `http://localhost:4747`. To change this, use the `rig.WithHost(...)` option:
```go
client := rig.NewClient(rig.WithHost("my-rig:4747"))
```
### Credentials
By default, the SDK will use the environment variables `RIG_CLIENT_ID` and `RIG_CLIENT_SECRET` to read the credentials. To explicitly set the credentials, use `rig.WithClientCredentials(...)` option:
```go
client := rig.NewClient(rig.WithClientCredentials(rig.ClientCredential{
ClientID: "your-client-id",
ClientSecret: "your-client-secret",
}))
```
## Documentation
- [Install Rig](https://docs.rig.dev/getting-started)
- [Setup Users](https://docs.rig.dev/users)
- [Deploy Capsules](https://docs.rig.dev/capsules)