Documentation ¶
Index ¶
- Variables
- func HashExt(h crypto.Hash) string
- func IsResource(fileName string) bool
- type BasicAuthCredentials
- type Body
- type CoordinateOption
- type Coordinates
- func (c *Coordinates) Copy() *Coordinates
- func (c *Coordinates) FileName() string
- func (c *Coordinates) FileNamePrefix() string
- func (c *Coordinates) FilePath() string
- func (c *Coordinates) FilterFileMap(fileMap map[string]crypto.Hash) map[string]crypto.Hash
- func (c *Coordinates) GAV() string
- func (c *Coordinates) GavLocation(repo *Repository) *Location
- func (c *Coordinates) GavPath() string
- func (c *Coordinates) GroupPath() string
- func (c *Coordinates) Location(repo *Repository) *Location
- func (c *Coordinates) MimeType() string
- func (c *Coordinates) Purl() string
- func (c *Coordinates) SetClassifierExtensionBy(filename string) error
- func (c *Coordinates) String() string
- type Credentials
- type FileMeta
- type Location
- func (l *Location) AddExtension(ext string) *Location
- func (l *Location) AddPath(path string) *Location
- func (l *Location) GetHash(creds Credentials, hash crypto.Hash) (string, error)
- func (l *Location) GetReader(creds Credentials) (io.ReadCloser, error)
- func (l *Location) IsFileSystem() bool
- func (l *Location) MarshalJSON() ([]byte, error)
- func (l *Location) String() string
- type Repository
- func (r *Repository) Download(coords *Coordinates, creds Credentials, enforceVerification ...bool) (io.ReadCloser, error)
- func (r *Repository) GavFiles(coords *Coordinates, creds Credentials) (map[string]crypto.Hash, error)
- func (r *Repository) GetFileMeta(c *Coordinates, file string, hash crypto.Hash, creds Credentials) (*FileMeta, error)
- func (r *Repository) Upload(coords *Coordinates, reader io.ReadCloser, creds Credentials, ...) (rerr error)
- func (r *Repository) Url() (string, error)
- type WithClassifier
- type WithExtension
Constants ¶
This section is empty.
Variables ¶
var Log = logging.DynamicLogger(REALM)
var REALM = logging.DefineSubRealm("Maven repository", "maven")
Functions ¶
func HashExt ¶
HashExt returns the 'maven' hash extension for the given hash. Maven usually uses sha1, sha256, sha512, md5 instead of SHA-1, SHA-256, SHA-512, MD5.
func IsResource ¶
IsResource returns true if the filename is not a checksum or signature file.
Types ¶
type BasicAuthCredentials ¶
func (*BasicAuthCredentials) SetForRequest ¶
func (b *BasicAuthCredentials) SetForRequest(req *http.Request) error
type Body ¶
type Body struct { Repo string `json:"repo"` Path string `json:"path"` DownloadUri string `json:"downloadUri"` Uri string `json:"uri"` MimeType string `json:"mimeType"` Size string `json:"size"` Checksums map[string]string `json:"checksums"` }
Body is the response struct of a deployment from the MVN repository (JFrog Artifactory).
type CoordinateOption ¶
type CoordinateOption = optionutils.Option[*Coordinates]
func WithOptionalClassifier ¶
func WithOptionalClassifier(c *string) CoordinateOption
func WithOptionalExtension ¶
func WithOptionalExtension(e *string) CoordinateOption
type Coordinates ¶
type Coordinates struct { // GroupId of the Maven artifact. GroupId string `json:"groupId"` // ArtifactId of the Maven artifact. ArtifactId string `json:"artifactId"` // Version of the Maven artifact. Version string `json:"version"` // Classifier of the Maven artifact. Classifier *string `json:"classifier,omitempty"` // Extension of the Maven artifact. Extension *string `json:"extension,omitempty"` }
Coordinates holds the typical Maven coordinates groupId, artifactId, version. Optional also classifier and extension. https://maven.apache.org/ref/3.9.6/maven-core/artifact-handlers.html
func NewCoordinates ¶
func NewCoordinates(groupId, artifactId, version string, opts ...CoordinateOption) *Coordinates
func Parse ¶
func Parse(serializedArtifact string) (*Coordinates, error)
Parse creates a Coordinates from it's serialized form (see Coordinates.String).
func (*Coordinates) Copy ¶
func (c *Coordinates) Copy() *Coordinates
Copy creates a new Coordinates with the same values.
func (*Coordinates) FileName ¶
func (c *Coordinates) FileName() string
func (*Coordinates) FileNamePrefix ¶
func (c *Coordinates) FileNamePrefix() string
func (*Coordinates) FilePath ¶
func (c *Coordinates) FilePath() string
FilePath returns the Maven Coordinates's GAV-name with classifier and extension. Which is equal to the URL-path of the artifact in the repository. Default extension is jar.
func (*Coordinates) FilterFileMap ¶
func (*Coordinates) GAV ¶
func (c *Coordinates) GAV() string
GAV returns the GAV coordinates of the Maven Coordinates.
func (*Coordinates) GavLocation ¶
func (c *Coordinates) GavLocation(repo *Repository) *Location
func (*Coordinates) GavPath ¶
func (c *Coordinates) GavPath() string
GavPath returns the Maven repository path.
func (*Coordinates) GroupPath ¶
func (c *Coordinates) GroupPath() string
GroupPath returns GroupId with `/` instead of `.`.
func (*Coordinates) Location ¶
func (c *Coordinates) Location(repo *Repository) *Location
func (*Coordinates) MimeType ¶
func (c *Coordinates) MimeType() string
MimeType returns the MIME type of the Maven Coordinates based on the file extension. Default is application/x-tgz.
func (*Coordinates) Purl ¶
func (c *Coordinates) Purl() string
Purl returns the Package URL of the Maven Coordinates.
func (*Coordinates) SetClassifierExtensionBy ¶
func (c *Coordinates) SetClassifierExtensionBy(filename string) error
SetClassifierExtensionBy extracts the classifier and extension from the filename (without any path prefix).
func (*Coordinates) String ¶
func (c *Coordinates) String() string
String returns the Coordinates as a string (GroupId:ArtifactId:Version:WithClassifier:WithExtension).
type Credentials ¶
type Location ¶
type Location struct {
// contains filtered or unexported fields
}
func (*Location) AddExtension ¶
func (*Location) GetReader ¶
func (l *Location) GetReader(creds Credentials) (io.ReadCloser, error)
func (*Location) IsFileSystem ¶
func (*Location) MarshalJSON ¶
type Repository ¶
type Repository struct {
Location
}
func NewFileRepository ¶
func NewFileRepository(path string, fss ...vfs.FileSystem) *Repository
func NewUrlRepository ¶
func NewUrlRepository(repoUrl string, fss ...vfs.FileSystem) (*Repository, error)
func (*Repository) Download ¶
func (r *Repository) Download(coords *Coordinates, creds Credentials, enforceVerification ...bool) (io.ReadCloser, error)
func (*Repository) GavFiles ¶
func (r *Repository) GavFiles(coords *Coordinates, creds Credentials) (map[string]crypto.Hash, error)
func (*Repository) GetFileMeta ¶
func (r *Repository) GetFileMeta(c *Coordinates, file string, hash crypto.Hash, creds Credentials) (*FileMeta, error)
func (*Repository) Upload ¶
func (r *Repository) Upload(coords *Coordinates, reader io.ReadCloser, creds Credentials, hashes iotools.Hashes) (rerr error)
func (*Repository) Url ¶
func (r *Repository) Url() (string, error)
type WithClassifier ¶
type WithClassifier string
func (WithClassifier) ApplyTo ¶
func (o WithClassifier) ApplyTo(c *Coordinates)
type WithExtension ¶
type WithExtension string
func (WithExtension) ApplyTo ¶
func (o WithExtension) ApplyTo(c *Coordinates)