README ΒΆ
gonexus
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
Create a connection to an instance of Nexus Repository Manager
// import "github.com/eantonioli/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 | π | |
Blob Store | π | 3.19 |
Components | π | |
Content Selectors | π | 3.19 |
π | 3.19 | |
IQ Server | π | 3.19 |
Licensing | π | 3.19 |
Lifecycle | π | |
Maintenance pro | π | |
Nodes pro | π | |
Read-Only | π | |
Repositories | π | |
Routing Rules | π | 3.17 |
Search | π | |
Script | π | |
Security Management | π | 3.19 |
Staging pro | π | |
Status | π | |
Support | π | |
Tagging pro | π | |
Tasks | π |
Supported Provisioning API
API | Status |
---|---|
Core | π |
Security | π |
Blob Store | π |
Repository | π |
Legend: π complete π untouched πππ partial support
nexusiq
Create a connection to an instance of Nexus IQ Server
// import "github.com/eantonioli/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 | π | |
Authorization Configuration | π | r70 |
Component Details | π | |
Component Evaluation | π | |
Component Labels | π | |
Component Remediation | π | r64 |
Component Search | π | |
Component Versions | π | |
Component Waivers | π | r76 |
Configuration | π | r65 |
Data Retention Policy | π | |
Organization | π | |
Policy Violation | π | |
Policy Waiver | π | r71 |
Promote Scan | π | |
Report-related | π | |
Role | π | r70 |
SAML | π | r74 |
Source Control | π | |
Success Metrics Data | π | |
Users | π | r70 |
User Token | π | r76 |
Vulnerability Details | π | r75 |
Webhooks | π |
Legend: π complete π untouched πππ partial support
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/eantonioli/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
Documentation ΒΆ
Index ΒΆ
- type Client
- type DefaultClient
- func (s *DefaultClient) Del(endpoint string) (resp *http.Response, err error)
- func (s *DefaultClient) Do(request *http.Request) (body []byte, resp *http.Response, err error)
- func (s *DefaultClient) Get(endpoint string) ([]byte, *http.Response, error)
- func (s *DefaultClient) Info() ServerInfo
- func (s *DefaultClient) NewRequest(method, endpoint string, payload io.Reader) (request *http.Request, err error)
- func (s *DefaultClient) Post(endpoint string, payload io.Reader) ([]byte, *http.Response, error)
- func (s *DefaultClient) Put(endpoint string, payload io.Reader) ([]byte, *http.Response, error)
- func (s *DefaultClient) SetCertFile(certFile string)
- func (s *DefaultClient) SetDebug(enable bool)
- type SearchQueryBuilder
- type ServerInfo
Constants ΒΆ
This section is empty.
Variables ΒΆ
This section is empty.
Functions ΒΆ
This section is empty.
Types ΒΆ
type Client ΒΆ
type Client interface { NewRequest(method, endpoint string, payload io.Reader) (*http.Request, error) Do(request *http.Request) ([]byte, *http.Response, error) Get(endpoint string) ([]byte, *http.Response, error) Post(endpoint string, payload io.Reader) ([]byte, *http.Response, error) Put(endpoint string, payload io.Reader) ([]byte, *http.Response, error) Del(endpoint string) (*http.Response, error) Info() ServerInfo SetDebug(enable bool) SetCertFile(certFile string) }
Client is the interface which allows interacting with an IQ server
type DefaultClient ΒΆ
type DefaultClient struct { ServerInfo Debug bool }
DefaultClient provides an HTTP wrapper with optimized for communicating with a Nexus server
func (*DefaultClient) Del ΒΆ
func (s *DefaultClient) Del(endpoint string) (resp *http.Response, err error)
Del performs an HTTP DELETE against the indicated endpoint
func (*DefaultClient) Info ΒΆ
func (s *DefaultClient) Info() ServerInfo
Info return information about the Nexus server
func (*DefaultClient) NewRequest ΒΆ
func (s *DefaultClient) NewRequest(method, endpoint string, payload io.Reader) (request *http.Request, err error)
NewRequest created an http.Request object based on an endpoint and fills in basic auth
func (*DefaultClient) SetCertFile ΒΆ
func (s *DefaultClient) SetCertFile(certFile string)
SetCertFile sets the certificate to use for HTTP communication
func (*DefaultClient) SetDebug ΒΆ
func (s *DefaultClient) SetDebug(enable bool)
SetDebug will enable or disable debug output on HTTP communication
type SearchQueryBuilder ΒΆ
type SearchQueryBuilder interface {
Build() string
}
SearchQueryBuilder is the interface that a search builder should follow
type ServerInfo ΒΆ
type ServerInfo struct {
Host, Username, Password, CertFile string
}
ServerInfo contains the information needed to connect to a Nexus server
Directories ΒΆ
Path | Synopsis |
---|---|
Package nexusiq provides a number of functions that interact with the Nexus IQ REST API.
|
Package nexusiq provides a number of functions that interact with the Nexus IQ REST API. |
iqwebhooks
Package iqwebhooks provides structs for all of the Nexus IQ webhook events as well as an http.HandlerFunc which will take the http.Request and put any IQ webhook it finds on a channel.
|
Package iqwebhooks provides structs for all of the Nexus IQ webhook events as well as an http.HandlerFunc which will take the http.Request and put any IQ webhook it finds on a channel. |
Package nexusrm provides a number of functions that interact with the Nexus Repository Manager REST API.
|
Package nexusrm provides a number of functions that interact with the Nexus Repository Manager REST API. |