/go-cyberark

A Go wrapper for the CyberArk Vault API

Primary LanguageGoMIT LicenseMIT

go-cyberark

A Go wrapper for the CyberArk Vault API

Build Status License Godoc Go Report Card

Table of Contents

Introduction

go-cyberark is a client library to talk to the CyberArk Vault API. Note that this library is purpose-built for my specific use case, and may not cover your use case. Contributions welcome -- see Contributing below.

Installation

You must have a working Go installation. To install, type:

$ go get -u github.com/hoop33/go-cyberark

You then import the library with this import path:

import cyberark "github.com/hoop33/cyberark"

Usage

To use go-cyberark, create a client, get one of its services, and call its Do() function.

Note that the only service currently offered is GetPassword.

Example:

client, err := cyberark.NewClient(
  cyberark.SetHost("cyberark.example.com"),
)
if err != nil {
  log.Fatal(err.Error())
}

ret, err := client.GetPassword().
  AppID("my_app_id").
  Safe("my_safe").
  Object("LDAP").
  Do()
if err != nil {
  log.Fatal(err.Error())
}

if ret.ErrorCode != "" {
  log.Fatal(ret.ErrorCode)
}

log.Println(ret.UserName)
log.Println(ret.Content)

Look in the examples folder for examples you can run.

Contributing

Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms. See CODE_OF_CONDUCT file.

Contributions are welcome! Please open pull requests with code that passes all the checks. See Building for more information.

Building

You must have a working Go development environment. The included Makefile is used for building. To get started, run:

$ make deps

This will install necessary dependencies. You should have to do this only once, or when you upgrade Go.

To run tests and build, run:

$ make

To get coverage reports, run:

$ make coverage

This will open a browser with the coverage reports.

Credits

Also, a hat tip to Oliver Elihard and his elastic project. I borrowed heavily from this project's approach, architecture, and code. Any faults are my own.

Disclaimer

go-cyberark is not affiliated with, nor endorsed by, CyberArk Software Ltd.

License

Copyright © 2017 Rob Warner

Licensed under the MIT License