nexus

package module
v0.59.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 19, 2020 License: Apache-2.0 Imports: 10 Imported by: 3

README ΒΆ

gonexus DepShield Badge CircleCI

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 GoDoc nexusrm coverage

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 πŸŒ•
Blob Store πŸŒ‘ 3.19
Components πŸŒ–
Content Selectors πŸŒ‘ 3.19
Email πŸŒ‘ 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 GoDoc nexusiq coverage

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 πŸŒ•
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

iqwebhooks GoDoc nexusiq webhooks coverage

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

Documentation ΒΆ

Index ΒΆ

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) Do ΒΆ

func (s *DefaultClient) Do(request *http.Request) (body []byte, resp *http.Response, err error)

Do performs an http.Request and reads the body if StatusOK

func (*DefaultClient) Get ΒΆ

func (s *DefaultClient) Get(endpoint string) ([]byte, *http.Response, error)

Get performs an HTTP GET 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) Post ΒΆ

func (s *DefaultClient) Post(endpoint string, payload io.Reader) ([]byte, *http.Response, error)

Post performs an HTTP POST against the indicated endpoint

func (*DefaultClient) Put ΒΆ

func (s *DefaultClient) Put(endpoint string, payload io.Reader) ([]byte, *http.Response, error)

Put performs an HTTP PUT against the indicated endpoint

func (*DefaultClient) SetCertFile ΒΆ added in v0.59.0

func (s *DefaultClient) SetCertFile(certFile string)

SetCertFile sets the certificate to use for HTTP communication

func (*DefaultClient) SetDebug ΒΆ added in v0.58.3

func (s *DefaultClient) SetDebug(enable bool)

SetDebug will enable or disable debug output on HTTP communication

type SearchQueryBuilder ΒΆ added in v0.22.0

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
iq
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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL