gobarbicansdk

package module
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 2, 2023 License: MIT Imports: 4 Imported by: 0

README

The OpenStack Barbican SDK for Golang

Usage

import (
	"context"
	"fmt"

	barbican "github.com/artashesbalabekyan/barbican-sdk-go"
	"github.com/artashesbalabekyan/barbican-sdk-go/xhttp"
)

func main() {
	ctx := context.Background()

	config := &xhttp.Config{
		Endpoint: "https://<endpoint>",
		Login: xhttp.Credentials{
			ProjectDomain:  "default",
			ProjectName:    "<project_name>",
			AuthUrl:        "https://<auth_url>",
			Username:       "<userName>",
			Password:       "<password>",
			UserDomainName: "Default",
		},
	}

	client, err := barbican.NewConnection(ctx, config)
	if err != nil {
		panic(err)
	}
}

err := client.Create(ctx, "my-key", []byte("my-value"))
if err != nil {
    panic(err)
}

iterator, err := client.ListSecrets(ctx)
if err != nil {
    panic(err)
}

defer iterator.Close()

for {
    name, ok := iterator.Next()
    if !ok {
        break
    }
    fmt.Println(name)
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewConnection

func NewConnection(ctx context.Context, config *xhttp.Config) (client.Conn, error)

func NewFakeConnection added in v1.2.0

func NewFakeConnection(ctx context.Context, fakeData map[string][]byte) (client.Conn, error)

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL