Giter Site home page Giter Site logo

vault-client's Introduction

Build Status Coverage Status Go Report Card

vault-client

Vault client is a client that can:

  • read
  • write
  • create a new policy
  • create a token (associated to a policy) in Vault.

Launch

    import vaultClient "github.com/cloudtrust/vault-client/client"
	var vClient vaultClient.Client
	{
		var err error
		vClient, err = vaultClient.NewClient(vaultToken, vaultURL)
		if err != nil {
			panic(err)
		}
	}

Configuration

Vault needs to be set up. The vaultToken used should allow the vault client to perform all his operations.

Usage - examples

The methods of this client follow the syntax of the client provided by Vault.

read

secret, errRead = vClient.Read(pathKey, token)

The vault client reads the information stored on pathKey in Vault.

write

_, errWrite = vClient.Write(pathKey, map[string]interface{}{"key": keyValue}, token)

The vault client writes on the path pathKey the key/value "key": keyValue.

create policy

err = vClient.CreatePolicy(pathPolicy, "writekey", policyName)

In order to create a policy, the vault client needs to specify the path of the policy, the name of the policy and the role of that policy. In this example, a policy that gives the right to write a key in Vault is created.

The existing roles are writekey, readkey, createkey, exportkey, encrypt and decrypt. These correspond to the functionality needed by github.com/cloudtrust/vault-bridge .

By default, the ttl of the policy is of 1 hour.

create token

token, errToken = vClient.CreateToken(policyName)

The vault client creates a Vault token associated to the policy with the name policyName.

vault-client's People

Contributors

johandroz avatar bsoniam avatar

Watchers

 avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.