gonexus
gonexus copied to clipboard
Go API for provisioning and interacting with Sonatype's Nexus Repository Manager and Nexus IQ Server
gonexus
![CircleCI](https://circleci.com/gh/sonatype-nexus-community/gonexus.svg?style=svg)
Provides a go client library for connecting to, and interacting with, Sonatype Nexus applications such as Nexus Repository Manager and Nexus IQ Server.
Organization of this library
The library is broken into two packages. One for each application.
nexusrm
![nexusrm coverage nexusrm coverage](https://gocover.io/_badge/github.com/sonatype-nexus-community/gonexus/rm?0)
Create a connection to an instance of Nexus Repository Manager
// import "github.com/sonatype-nexus-community/gonexus/rm"
rm, err := nexusrm.New("http://localhost:8081", "username", "password")
if err != nil {
panic(err)
}
Supported RM Endpoints
Endpoint | Status | Min RM Version |
---|---|---|
Assets | :full_moon: | |
Blob Store | :new_moon: | 3.19 |
Components | :waning_gibbous_moon: | |
Content Selectors | :new_moon: | 3.19 |
:new_moon: | 3.19 | |
IQ Server | :new_moon: | 3.19 |
Licensing | :new_moon: | 3.19 |
Lifecycle | :new_moon: | |
Maintenance pro | :waning_crescent_moon: | |
Nodes pro | :new_moon: | |
Read-Only | :full_moon: | |
Repositories | :full_moon: | |
Routing Rules | :new_moon: | 3.17 |
Search | :waning_gibbous_moon: | |
Script | :full_moon: | |
Security Management | :new_moon: | 3.19 |
Staging pro | :waning_gibbous_moon: | |
Status | :full_moon: | |
Support | :full_moon: | |
Tagging pro | :waning_gibbous_moon: | |
Tasks | :new_moon: |
Supported Provisioning API
API | Status |
---|---|
Core | :new_moon: |
Security | :new_moon: |
Blob Store | :waning_gibbous_moon: |
Repository | :waning_gibbous_moon: |
Legend: :full_moon: complete :new_moon: untouched :waning_crescent_moon::last_quarter_moon::waning_gibbous_moon: partial support
nexusiq
![nexusiq coverage nexusiq coverage](https://gocover.io/_badge/github.com/sonatype-nexus-community/gonexus/iq?0)
Create a connection to an instance of Nexus IQ Server
// import "github.com/sonatype-nexus-community/gonexus/iq"
iq, err := nexusiq.New("http://localhost:8070", "username", "password")
if err != nil {
panic(err)
}
Supported IQ Endpoints
Endpoint | Status | Min IQ Version |
---|---|---|
Application | :full_moon: | |
Authorization Configuration | :full_moon: | r70 |
Component Details | :full_moon: | |
Component Evaluation | :full_moon: | |
Component Labels | :full_moon: | |
Component Remediation | :full_moon: | r64 |
Component Search | :full_moon: | |
Component Versions | :full_moon: | |
Component Waivers | :new_moon: | r76 |
Configuration | :new_moon: | r65 |
Data Retention Policy | :full_moon: | |
Organization | :full_moon: | |
Policy Violation | :full_moon: | |
Policy Waiver | :new_moon: | r71 |
Promote Scan | :new_moon: | |
Report-related | :full_moon: | |
Role | :full_moon: | r70 |
SAML | :new_moon: | r74 |
Source Control | :full_moon: | |
Success Metrics Data | :full_moon: | |
Users | :full_moon: | r70 |
User Token | :new_moon: | r76 |
Vulnerability Details | :new_moon: | r75 |
Webhooks | :full_moon: |
Legend: :full_moon: complete :new_moon: untouched :waning_crescent_moon::last_quarter_moon::waning_gibbous_moon: partial support
iqwebhooks
![nexusiq webhooks coverage nexusiq webhooks coverage](https://gocover.io/_badge/github.com/sonatype-nexus-community/gonexus/iq/iqwebhooks/?0)
The iq/iqwebhooks
subpackage provides structs for all of the event types along with helper functions.
Most notably it provides a function called Listen
which is an http.HandlerFunc
that can be used as an endpoint handler for a server functioning as a webhook listener.
The handler will place any webhook event it finds in a channel to be consumed at will.
An example of using the handler to listen for Application Evaluation events:
// import "github.com/sonatype-nexus-community/gonexus/iq/webhooks"
appEvals, _ := iqwebhooks.ApplicationEvaluationEvents()
go func() {
for _ = range appEvals:
log.Println("Received Application Evaluation event")
}
}()
http.HandleFunc("/ingest", iqwebhooks.Listen)
See the documentation for a full example showing other event types.
The Fine Print
It is worth noting that this is NOT SUPPORTED by Sonatype, and is a contribution of @HokieGeek plus us to the open source community (read: you!)
Remember:
- Use this contribution at the risk tolerance that you have
- Do NOT file Sonatype support tickets related to this
- DO file issues here on GitHub, so that the community can pitch in