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) FilePath() string
- func (c *Coordinates) FilterFileMap(fileMap map[string]crypto.Hash) map[string]crypto.Hash
- func (c *Coordinates) Location(repo *Repository) *Location
- func (c *Coordinates) SetClassifierExtensionBy(filename string) error
- func (c *Coordinates) String() string
- type Credentials
- type FileCoordinates
- 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, tweakIndexOf ...func(loc *Location, req *http.Request)) (io.ReadCloser, error)
- func (l *Location) IsFileSystem() bool
- func (l *Location) MarshalJSON() ([]byte, error)
- func (l *Location) String() string
- type PackageCoordinates
- func (c *PackageCoordinates) FileNamePrefix() string
- func (c *PackageCoordinates) GAV() string
- func (c *PackageCoordinates) GavLocation(repo *Repository) *Location
- func (c *PackageCoordinates) GavPath() string
- func (c *PackageCoordinates) GroupPath() string
- func (c *PackageCoordinates) Purl() string
- func (c *PackageCoordinates) 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 ioutils.DupReadCloser, creds Credentials, ...) (rerr error)
- func (r *Repository) Url() (string, error)
- type WithClassifier
- type WithExtension
- type WithMediaType
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
func WithOptionalMediaType ¶ added in v0.16.0
func WithOptionalMediaType(mt *string) CoordinateOption
type Coordinates ¶
type Coordinates struct { PackageCoordinates `json:",inline"` FileCoordinates `json:",inline"` }
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 its 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) 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) Location ¶
func (c *Coordinates) Location(repo *Repository) *Location
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 FileCoordinates ¶
type FileCoordinates struct { // Classifier of the Maven artifact. Classifier *string `json:"classifier,omitempty"` // Extension of the Maven artifact. Extension *string `json:"extension,omitempty"` // MediaType of the files. MediaType *string `json:"mediaType,omitempty"` }
func (*FileCoordinates) IsFile ¶
func (c *FileCoordinates) IsFile() bool
IsFile returns true if a dedicated single file is addressed.
func (*FileCoordinates) IsFileSet ¶
func (c *FileCoordinates) IsFileSet() bool
IsFileSet returns true if a file pattern is specified (and therefore, potentially multiple files are addressed).
func (*FileCoordinates) IsPackage ¶
func (c *FileCoordinates) IsPackage() bool
IsPackage returns true if the complete GAV content is addressed.
func (*FileCoordinates) MimeType ¶
func (c *FileCoordinates) MimeType() string
MimeType returns the MIME type of the Maven Coordinates based on the file extension. Default is application/x-tgz.
type Location ¶
type Location struct {
// contains filtered or unexported fields
}
func (*Location) AddExtension ¶
func (*Location) GetReader ¶
func (l *Location) GetReader(creds Credentials, tweakIndexOf ...func(loc *Location, req *http.Request)) (io.ReadCloser, error)
func (*Location) IsFileSystem ¶
func (*Location) MarshalJSON ¶
type PackageCoordinates ¶
type PackageCoordinates 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"` }
func (*PackageCoordinates) FileNamePrefix ¶
func (c *PackageCoordinates) FileNamePrefix() string
func (*PackageCoordinates) GAV ¶
func (c *PackageCoordinates) GAV() string
GAV returns the GAV coordinates of the Maven Coordinates.
func (*PackageCoordinates) GavLocation ¶
func (c *PackageCoordinates) GavLocation(repo *Repository) *Location
func (*PackageCoordinates) GavPath ¶
func (c *PackageCoordinates) GavPath() string
GavPath returns the Maven repository path.
func (*PackageCoordinates) GroupPath ¶
func (c *PackageCoordinates) GroupPath() string
GroupPath returns GroupId with `/` instead of `.`.
func (*PackageCoordinates) Purl ¶
func (c *PackageCoordinates) Purl() string
Purl returns the Package URL of the Maven Coordinates.
func (*PackageCoordinates) String ¶
func (c *PackageCoordinates) String() string
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 ioutils.DupReadCloser, 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)
type WithMediaType ¶ added in v0.16.0
type WithMediaType string
func (WithMediaType) ApplyTo ¶ added in v0.16.0
func (o WithMediaType) ApplyTo(c *Coordinates)