A Go library to pull data from a Sonatype Nexus instance.
go get
should see you through:
go get sbrubbles.org/go/nexus
And therefore import
:
package main
import (
"fmt"
"sbrubbles.org/go/nexus"
"sbrubbles.org/go/nexus/credentials"
"sbrubbles.org/go/nexus/search"
"reflect"
)
func main() {
n := nexus.New("http://nexus.somewhere.com", credentials.BasicAuth("username", "password"))
artifacts, err := n.Artifacts(
search.InRepository{
"shamalamadingdong",
search.ByKeyword("org.sbrubbles*")})
if err != nil {
fmt.Printf("%v: %v", reflect.TypeOf(err), err)
}
for _, a := range artifacts {
fmt.Println(a)
}
}
Nexus has a large REST API, but some information isn't readily available, requiring several API calls and some mashing up to produce.
And it was a good excuse to try Go out :)
MIT License. See LICENSE for the gory details.