Skip to content

projectbadger/brocade-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Brocade FOS REST API interface in Go

A library for interfacing with Brocade FOS REST API.

The documentation is taken from the Broadcom Brocade FOS REST API documentation

WIP!

Not all of the models have been implemented yet and methods only provide read functions.

Using the models

The models are in individual packages in rest/running

Using the API

To use the REST API, you must instantiate a session and create a REST interface implementation with it. If the session is not sessionless, it is imperative to log out after use.

rest := rest.NewRESTJSONSessionless("localhost:8080", "/rest", "username", "password", http.DefaultClient)
ps, errs := rest.Running().FRU().GetPowerSupply()

To ensure proper login and logout, a helper session function can be used for non-sessionless login.

rest := rest.NewRESTJSONSession("localhost:8080", "/rest", "username", "password", http.DefaultClient)
err := rest.Session(func(session session.Session) error {
	ps, errs := rest.Running().FRU().GetPowerSupply()
	if errs != nil {
		return errs
	}
})

Subpackages