hybris/gogobosh

Name: gogobosh

Owner: hybris GmbH

Description: Golang client library for applications wanting to talk to a BOSH/MicroBOSH or bosh-lite http://bosh.cloudfoundry.org

Created: 2016-08-22 21:03:42.0

Updated: 2016-08-22 21:14:30.0

Pushed: 2016-08-22 21:14:30.0

Homepage: null

Size: 35

Language: Go

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Go Go BOSH - BOSH client API for golang applications

This project is a golang library for applications wanting to talk to a BOSH/MicroBOSH or bosh-lite.

API

The following client functions are available, as a subset of the full BOSH Director API.

API compatibility

Note: Development is currently being done against bosh-lite v147.

The BOSH Core team nor its Product Managers do not claim that a BOSH director has a public API; and they want to make changes to the API in the future. It will may be tricky for golang apps to support different BOSH APIs. We'll figure this out as we go.

The best way to describe the API support in this library is to document what version of bosh-lite is being tested against, the date that it was published. Hopefully bosh-lite is always approximately parallel (via rebasing) in its API with the main BOSH project; and the same timestamps can map to the continuously delivered releases of BOSH & its RubyGems.

Trying to write a client library for an API without any versioning strategy could get messy for client applications. Please write your own integration tests that work against running BOSHes that you'll use in production.

If you are using this library, or the Ruby library within the bosh_cli rubygem, or talking directly with the BOSH director API - please announce yourself on the bosh-users google group and/or to the PM of BOSH. This way they can be aware of who many be affected by API changes.

Install
et github.com/cloudfoundry-community/gogobosh
Documentation

The documentation is published to https://godoc.org/github.com/cloudfoundry-community/gogobosh.

Also, view the documentation locally with:

c -goroot=$GOPATH github.com/cloudfoundry-community/gogobosh
Use

There is an extensive example application showing usage of many of the read-only functions.

As a short getting started guide:

age main

rt (
ithub.com/cloudfoundry-community/gogobosh"
ithub.com/cloudfoundry-community/gogobosh/api"
ithub.com/cloudfoundry-community/gogobosh/net"
ithub.com/cloudfoundry-community/gogobosh/utils"
mt"
lag"


 main() {
ils.Logger = utils.NewLogger()

rget := flag.String("target", "https://192.168.50.4:25555", "BOSH director host")
ername := flag.String("username", "admin", "Login with username")
ssword := flag.String("password", "admin", "Login with password")
ag.Parse()

rector := gogobosh.NewDirector(*target, *username, *password)
po := api.NewBoshDirectorRepository(&director, net.NewDirectorGateway())

fo, apiResponse := repo.GetInfo()
 apiResponse.IsNotSuccessful() {
fmt.Println("Could not fetch BOSH info")
return


t.Println("Director")
t.Printf("  Name       %s\n", info.Name)
t.Printf("  URL        %s\n", info.URL)
t.Printf("  Version    %s\n", info.Version)
t.Printf("  User       %s\n", info.User)
t.Printf("  UUID       %s\n", info.UUID)
t.Printf("  CPI        %s\n", info.CPI)

You can automatically detect the current director target, and username/password, from the BOSH CLI's ~/.bosh_config file as well (see example/current_target.go)

age main

rt (
ithub.com/cloudfoundry-community/gogobosh"
ithub.com/cloudfoundry-community/gogobosh/local"


 main() {
nfigPath, err := local.DefaultBoshConfigPath()
nfig, err := local.LoadBoshConfig(configPath)
rget, username, password, err := config.CurrentBoshTarget()
rector := gogobosh.NewDirector(target, username, password)
Tests

Tests are all local currently; and do not test against a running bosh or bosh-lite. I'd like to at least do integration tests against a bosh-lite in future.


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.