Skip to content
 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Nexus Client Integration Checks codecov GitHub go.mod Go version License: LGPL v3

AICURA: A Sonatype Nexus API in Go

aicura is a client library for Sonatype Nexus Manager v3 API written in GoLang.

How to Use

The most straightforward way to use this library is creating a new Client and make calls to the API through services:

import   "github.com/m88i/aicura/nexus"

(...)

// New client with default credentials
client := nexus.NewClient("http://localhost:8081").WithCredentials("admin", "admin123").Build()
user, err := client.UserService.GetUserByID("admin")
if err != nil {
    return err
}
print(user.Name)

Fake Client

To use this library in your unit tests, create an instance of a "fake" Client instead:

import   "github.com/m88i/aicura/nexus"

(...)

client := nexus.NewFakeClient()

// all interfaces remain the same
user, err := client.UserService.GetUserByID("admin")
if err != nil {
    return err
}
print(user.Name) //will print nothing since there's no user in the cache, call client.UserService.Add(user) first :)

The fake Client is backed up by hash maps, so all write and read operations will work like in real scenarios.

Development

To run a local Nexus Server 3.x container with Podman:

$ podman run --rm -it -p 8081:8081 -e INSTALL4J_ADD_VM_PARAMS="-Dnexus.security.randompassword=false" docker.io/sonatype/nexus3

Use Postman or even the web browser to play around with the Nexus REST API at http://localhost:8081 endpoint. The default credentials are admin/admin123.

About

A Sonatype Nexus OSS client library in Go

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages