Documentation ¶
Index ¶
- func IsAuthenticationError(err error) bool
- func IsNotFound(err error) bool
- func IsServerError(err error) bool
- func NewBool(bln bool) *bool
- func NewString(str string) *string
- type Authentication
- type CleanUp
- type Client
- type ClientBuilder
- func (b *ClientBuilder) APIVersion(version string) *ClientBuilder
- func (b *ClientBuilder) Build() *Client
- func (b *ClientBuilder) Verbose() *ClientBuilder
- func (b *ClientBuilder) WithCredentials(username, password string) *ClientBuilder
- func (b *ClientBuilder) WithHTTPClient(httpClient *http.Client) *ClientBuilder
- type ClientError
- type Connection
- type HTTPClient
- type Maven
- type MavenGroup
- type MavenGroupRepository
- type MavenGroupRepositoryService
- type MavenLayoutPolicy
- type MavenProxyRepository
- type MavenProxyRepositoryService
- type MavenVersionPolicy
- type NegativeCache
- type Proxy
- type Repository
- type RepositoryFormat
- type RepositoryType
- type ServerMessage
- type Storage
- type User
- type UserService
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsAuthenticationError ¶
IsAuthenticationError checks if the given error is related to authentication problems (403 or 401)
func IsNotFound ¶
IsNotFound checks if the given error is a Not Found error (404)
func IsServerError ¶
IsServerError checks if the given error is a server error (500)
Types ¶
type Authentication ¶
type Authentication struct { Type string `json:"type,omitempty"` Username string `json:"username,omitempty"` NtlmHost string `json:"ntlmHost,omitempty"` NtlmDomain string `json:"ntlmDomain,omitempty"` }
Authentication for a HTTPClient
type CleanUp ¶
type CleanUp struct {
PolicyNames []string `json:"policyNames,omitempty"`
}
CleanUp ...
type Client ¶
type Client struct { UserService UserService MavenProxyRepositoryService MavenProxyRepositoryService MavenGroupRepositoryService MavenGroupRepositoryService // contains filtered or unexported fields }
Client base structure for the Nexus Client
func NewDefaultClient ¶
NewDefaultClient creates a new raw, straight forward Nexus Client. For a more customizable client, use `NewClient` instead
func NewFakeClient ¶ added in v0.2.0
func NewFakeClient() *Client
NewFakeClient creates a mocked client for testing purposes. It's backed up by hashmaps, so if you insert a user for instance, you can list, update, or delete
func (*Client) ScriptsRequired ¶
ScriptsRequired checks if the target Nexus server has APIs capabilities without relying on Groovy scripts. This should be used if the caller is not sure if the server accepts the capabilities offered by this library, since for security reasons and to comply with Nexus Server default policy, it does not support Groovy scripts execution. If this function returns `true`, capabilities that otherwise requires Groovy scripts (like creating repos), won't work.
func (*Client) SetCredentials ¶ added in v0.2.0
SetCredentials sets the client username and password
func (*Client) SetPassword ¶ added in v0.2.0
SetPassword sets the client password
func (*Client) SetUsername ¶ added in v0.2.0
SetUsername sets the client username
type ClientBuilder ¶
type ClientBuilder struct {
*Client
}
ClientBuilder fluent API to build a new Nexus Client
func NewClient ¶
func NewClient(baseURL string) *ClientBuilder
NewClient creates a new Nexus `ClientBuilder` for client applications to start interacting with a Nexus Server
func (*ClientBuilder) APIVersion ¶
func (b *ClientBuilder) APIVersion(version string) *ClientBuilder
APIVersion sets the API version for the new Nexus Service API. Default to `beta`.
func (*ClientBuilder) Build ¶
func (b *ClientBuilder) Build() *Client
Build returns the new Nexus Client
func (*ClientBuilder) Verbose ¶
func (b *ClientBuilder) Verbose() *ClientBuilder
Verbose sets a higher logging level for the client
func (*ClientBuilder) WithCredentials ¶
func (b *ClientBuilder) WithCredentials(username, password string) *ClientBuilder
WithCredentials defines the credentials to be used on each request to the Nexus Server.
func (*ClientBuilder) WithHTTPClient ¶
func (b *ClientBuilder) WithHTTPClient(httpClient *http.Client) *ClientBuilder
WithHTTPClient defines a custom `http.Client` reference
type ClientError ¶
type ClientError struct { HTTPStatusCode int ServerMessages []ServerMessage RawData interface{} RequestBody interface{} // contains filtered or unexported fields }
ClientError describes a base structure for possible errors during Nexus Server REST API calls
type Connection ¶
type Connection struct { Retries *int `json:"retries,omitempty"` UserAgentSuffix *string `json:"userAgentSuffix,omitempty"` Timeout *int32 `json:"timeout,omitempty"` EnableCircularRedirects bool `json:"enableCircularRedirects,omitempty"` EnableCookies bool `json:"enableCookies,omitempty"` }
Connection for a HTTPClient
type HTTPClient ¶
type HTTPClient struct { AutoBlock bool `json:"autoBlock,omitempty"` Blocked *bool `json:"blocked,omitempty"` Connection *Connection `json:"connection,omitempty"` Authentication *Authentication `json:"authentication,omitempty"` }
HTTPClient details of how to connect to a Maven Proxy Repository
type Maven ¶
type Maven struct { VersionPolicy MavenVersionPolicy `json:"versionPolicy,omitempty"` LayoutPolicy MavenLayoutPolicy `json:"layoutPolicy,omitempty"` }
Maven ...
type MavenGroup ¶ added in v0.2.0
type MavenGroup struct {
MemberNames []string `json:"memberNames"`
}
MavenGroup describes a collection of Maven repositories in a given group
type MavenGroupRepository ¶ added in v0.2.0
type MavenGroupRepository struct { Repository `json:",inline"` Group MavenGroup `json:"group"` Storage Storage `json:"storage,omitempty"` }
MavenGroupRepository structure for Maven Group Repository
type MavenGroupRepositoryService ¶ added in v0.2.0
type MavenGroupRepositoryService interface { Update(repo MavenGroupRepository) error List() ([]MavenGroupRepository, error) GetRepoByName(name string) (*MavenGroupRepository, error) }
MavenGroupRepositoryService service to handle all Maven Proxy Repositories operations
type MavenLayoutPolicy ¶
type MavenLayoutPolicy string
MavenLayoutPolicy ...
const ( // LayoutPolicyStrict ... LayoutPolicyStrict MavenLayoutPolicy = "STRICT" // LayoutPolicyPermissive ... LayoutPolicyPermissive MavenLayoutPolicy = "PERMISSIVE" )
type MavenProxyRepository ¶
type MavenProxyRepository struct { Repository `json:",inline"` HTTPClient HTTPClient `json:"httpClient,omitempty"` Maven Maven `json:"maven,omitempty"` NegativeCache NegativeCache `json:"negativeCache,omitempty"` Proxy Proxy `json:"proxy,omitempty"` Storage Storage `json:"storage,omitempty"` CleanUp *CleanUp `json:"cleanup,omitempty"` RoutingRule string `json:"routingRule,omitempty"` }
MavenProxyRepository basic structure for a Maven Proxy Repository
type MavenProxyRepositoryService ¶
type MavenProxyRepositoryService interface { Add(repositories ...MavenProxyRepository) error List() ([]MavenProxyRepository, error) GetRepoByName(name string) (*MavenProxyRepository, error) }
MavenProxyRepositoryService service to handle all Maven Proxy Repositories operations
type MavenVersionPolicy ¶
type MavenVersionPolicy string
MavenVersionPolicy ...
const ( // VersionPolicyRelease ... VersionPolicyRelease MavenVersionPolicy = "RELEASE" // VersionPolicyMixed ... VersionPolicyMixed MavenVersionPolicy = "MIXED" // VersionPolicySnapshot ... VersionPolicySnapshot MavenVersionPolicy = "SNAPSHOT" )
type NegativeCache ¶
type NegativeCache struct { Enabled bool `json:"enabled,omitempty"` TimeToLive int32 `json:"timeToLive,omitempty"` }
NegativeCache ...
type Proxy ¶
type Proxy struct { ContentMaxAge int32 `json:"contentMaxAge,omitempty"` MetadataMaxAge int32 `json:"metadataMaxAge,omitempty"` RemoteURL string `json:"remoteUrl,omitempty"` }
Proxy ...
type Repository ¶
type Repository struct { Name string `json:"name,omitempty"` Format *RepositoryFormat `json:"format,omitempty"` Type *RepositoryType `json:"type,omitempty"` URL *string `json:"url,omitempty"` Online *bool `json:"online,omitempty"` }
Repository is the base structure for Nexus repositories
type RepositoryFormat ¶ added in v0.2.0
type RepositoryFormat string
RepositoryFormat describes supported API repositories format
const ( // RepositoryFormatMaven2 ... RepositoryFormatMaven2 RepositoryFormat = "maven2" )
func NewRepositoryFormat ¶ added in v0.2.0
func NewRepositoryFormat(format RepositoryFormat) *RepositoryFormat
NewRepositoryFormat easy access to a pointer for RepositoryFormat
type RepositoryType ¶
type RepositoryType string
RepositoryType ...
const ( // RepositoryTypeHosted ... RepositoryTypeHosted RepositoryType = "hosted" // RepositoryTypeProxy ... RepositoryTypeProxy RepositoryType = "proxy" // RepositoryTypeGroup ... RepositoryTypeGroup RepositoryType = "group" )
func NewRepositoryType ¶
func NewRepositoryType(rType RepositoryType) *RepositoryType
NewRepositoryType easy access to a pointer for RepositoryType
type ServerMessage ¶
type ServerMessage struct { ID string `json:"id,omitempty"` Message string `json:"message,omitempty"` }
ServerMessage describes a structure for a bad request error (4.x)
type Storage ¶
type Storage struct { StrictContentTypeValidation bool `json:"strictContentTypeValidation,omitempty"` BlobStoreName string `json:"blobStoreName,omitempty"` }
Storage ...
type User ¶
type User struct { UserID string `json:"userId"` FirstName string `json:"firstName,omitempty"` LastName string `json:"lastName,omitempty"` Email string `json:"emailAddress,omitempty"` Source string `json:"source,omitempty"` ReadOnly bool `json:"readOnly,omitempty"` Roles []string `json:"roles"` ExternalRoles []string `json:"externalRoles"` Status string `json:"status,omitempty"` Password string `json:"password,omitempty"` }
User represents a Nexus user