Go SDK

The local Go SDK module is github.com/credvault/credvault-edge-go. It uses Go modules and provides typed resource structs for the main CredVault APIs.

Installation

Use the local source module provided by CredVault, or a private Git repository that contains that module path.

If the module is hosted in your Git provider, install it with:

Terminal
go get github.com/credvault/credvault-edge-go
What you should seeA completed package install with no dependency errors.

If your organization keeps the module in a private Git provider, make sure users have access to that repository before they run go get.

Connecting to CredVault

The SDK defaults to http://localhost:5000/api, which is only for local backend development. Production code must set the CredVault backend API URL on the client.

go
package main

import (
    "fmt"
    "os"

    credvault "github.com/credvault/credvault-edge-go"
)

func main() {
    client := credvault.New(os.Getenv("CREDVAULT_API_KEY"))
    client.Client.BaseURL = "https://<your-credvault-backend>/api"

    customers, err := client.Data.Query("customers", map[string]string{
        "status": "active",
    })
    if err != nil {
        panic(err)
    }

    fmt.Println(customers)
}

Working with Data

Go methods return a response and an error. Always check the error before using the response.

go
query := map[string]string{"status": "active"}
customers, err := client.Data.Query("customers", query)
if err != nil {
    panic(err)
}

fmt.Println(customers)

Available Resources

  • Auth for sign-in and sign-up
  • Data for clusters and collection data
  • Cie for datasets and predictions
  • Webhooks for event delivery
  • Functions for serverless functions
  • Triggers for collection events
  • Backups for backup and restore
  • Schema for schema and indexes
  • ApiKeys for API key management
  • Metrics for platform monitoring
  • Logs for activity and audit logs
  • Notifications for notifications; preference methods should be checked against /api-docs
  • Settings for account settings, but some methods still need backend route alignment
  • Robots for robot/device endpoints, but this area still needs route alignment before it is public-ready

Security

Load credentials from environment variables or a secrets manager. Do not hardcode keys in Go source files, compiled binaries, or example repositories.