Flipt Go SDK
The Flipt Go SDK supports developing applications in Go against Flipt.
It also supports the ability to access the resource management APIs and other systems, such as authentication and metadata.
The SDK supports both Flipts gRPC
and HTTP
RPC APIs.
A majority of this client is generated directly from Flipt's protobuf
definitions.
The Flipt SDK Generator can be found locally within this repository.
Dependencies
Client / Server Version Compatibility
client ⌄ / server › | <= 1.19.* | >= 1.20.0 |
---|
0.1.* | ✓ | ✓* |
>= 0.2.* | ✗ | ✓ |
* Backwards compatible, but can only access the "default"
namespace.
Get the SDK
go get go.flipt.io/flipt/sdk/go
Construct and Authenticate the SDK
Constructing an SDK client is easy.
- Pick your transport of choice. Both
grpc
or http
are sub-packages with respective implementations. - Pass a constructed
Transport
implementation to sdk.New(...)
. - Optionally pass in a
sdk.ClientTokenProvider
to authenticate your RPC calls.
package main
import (
sdk "go.flipt.io/flipt/sdk/go"
sdkgrpc "go.flipt.io/flipt/sdk/go/grpc"
grpc "google.golang.org/grpc"
)
func main() {
token := sdk.StaticClientTokenProvider("a-flipt-client-token")
conn := grpc.Dial("localhost:9090")
transport := sdkgrpc.NewTransport(conn)
client := sdk.New(transport, sdk.WithClientTokenProvider(token))
}