Skip to content

Commit

Permalink
add readme
Browse files Browse the repository at this point in the history
Signed-off-by: Artashes Balabekyan <balabekyanartashes@gmail.com>
  • Loading branch information
artashesbalabekyan committed Jun 28, 2023
1 parent 9719776 commit 9efaa9a
Showing 1 changed file with 60 additions and 0 deletions.
60 changes: 60 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# The OpenStack Barbican SDK fo Golang

## Usage

```go
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)
}
}

```

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

```

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

defer iterator.Close()

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

0 comments on commit 9efaa9a

Please sign in to comment.