Install

Installing the Lattice SDK

To integrate with Lattice using the Lattice SDK, set up your credentials and environment endpoint as system variables, then install the SDK in a language, and protocol, of your choice. Lattice supports both gRPC and REST as first-class protocols:

Choosing a protocol

For more information on selecting the right protocol for your integration, see Choose a protocol.

Java
Python
Rust
TypeScript
gRPC

The gRPC examples in Lattice SDK documentation use Go, Python, and Rust.

If you’re using another language, you can choose from up to 16 languages and various plugins to get your Lattice SDK artifacts for gRPC.

Before you begin

Get the SDK for gRPC

Lattice provides a gRPC SDK in a variety of languages and plugins using the Lattice SDK Buf Schema Registry. The following steps show how to get the Lattice SDK for gRPC in Go, Python, and Rust:

1

Install the latest version of Go.

2

Create a new folder and initialize your project:

$go mod init lattice-sdk-go-example

This generates a go.mod file in the project directory.

3

Install the generated Lattice SDK gRPC stubs using the grpc/go plugin:

$go get buf.build/gen/go/anduril/lattice-sdk/grpc/go@v<latest-supported-version>

This installs the generated Lattice SDK gRPC stubs along with the required gRPC runtime dependencies and creates a go.sum file in the project directory.

4

Import Lattice and use the client:

main.go
1package main
2
3import (
4 "buf.build/gen/go/anduril/lattice-sdk/grpc/go/anduril/entitymanager/v1/entitymanagerv1grpc"
5)
6
7func main() {
8 client := entitymanagerv1grpc.NewEntityManagerAPIClient(conn)
9
10 response, err := client.GetEntity(ctx, &entitymanagerv1.GetEntityRequest{
11 EntityId: "<ENTITY_ID>",
12 })
13}

For additional information on using the Buf Schema Registry, refer to the Buf documentation.

Get the SDK for REST

Lattice provides a REST SDK in the following languages:

1

Download the latest version of Go.

2

Verify your installation:

$go version
3

Install the latest version of the Lattice SDK:

1go get github.com/anduril/lattice-sdk-go/v3
4

Import Lattice and use the client:

main.go
1package main
2
3import (
4 "os"
5 "fmt"
6 "github.com/anduril/lattice-sdk-go/v3/client"
7 "github.com/anduril/lattice-sdk-go/v3/option"
8)
9
10func main() {
11 latticeEndpoint := os.Getenv("LATTICE_ENDPOINT")
12 environmentToken := os.Getenv("ENVIRONMENT_TOKEN")
13
14 client := client.NewClient(
15 option.WithToken(environmentToken),
16 option.WithBaseURL(fmt.Sprintf("https://%s", latticeEndpoint)),
17 )
18
19 client.Entities.GetEntity(
20 context.TODO(),
21 "ENTITY_ID",
22 )
23}

What’s next?