Skip to content

selectel/secretsmanager-go

Repository files navigation

secretsmanager-go: Go SDK for Secrets Manager API

Go.dev reference Go Report Card codecov

Note

Secrets Manager SDK implements the Secrets Manager API facilitating the tasks of storing, managing and revoking secrets/certificates.

Documentation

Important

The Go library documentation is available at go.dev.

Getting started

Install

go get github.com/selectel/secretsmanager-go

Authentication

To work with Selectel API:

Usage

Important

At the moment you need to pass a Valid Keystone Token to use it.

package main

import (
	"context"
	"log"
	"fmt"

	"github.com/selectel/secretsmanager-go"
)

// Setting Up your project KeystoneToken
const KeystoneToken = "gAAAAAB..."

func main() {
	// Setting Up Client
	cl, err := secretsmanager.New(
		secretsmanager.WithAuthOpts(&secretsmanager.AuthOpts{KeystoneToken: KeystoneToken}),
	)
	if err != nil {
		log.Fatal(err)
	}
	
	// Prepare an empty context, for future requests.
	ctx := context.Background()

	sc, err := cl.Secrets.List(ctx)
	if err != nil {
		    log.Fatal(err)
	}
	fmt.Printf("Retrived secrets: %+v\n", sc)
	// ...
}

Additional info

Note

More examples available in 📁 examples section.

For advanced topics and guides 📁 docs section.