utils

package
v1.40.1 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2024 License: Apache-2.0 Imports: 36 Imported by: 87

Documentation

Index

Constants

View Source
const (
	ArtifactorySymlink   = "symlink.dest"
	SymlinkSha1          = "symlink.destsha1"
	LatestBuildNumberKey = "LATEST"
)
View Source
const (
	SizeKib int64 = 1 << 10
	SizeMiB int64 = 1 << 20
	SizeGiB int64 = 1 << 30
	SizeTiB int64 = 1 << 40
)
View Source
const (

	// Sizes and limits constants
	MaxMultipartUploadFileSize = SizeTiB * 5
)

Variables

This section is empty.

Functions

func AddAuthHeaders

func AddAuthHeaders(headers map[string]string, artifactoryDetails auth.ServiceDetails)

func AddChecksumHeaders

func AddChecksumHeaders(headers map[string]string, fileDetails *fileutils.FileDetails)

func AddHeader

func AddHeader(headerName, headerValue string, headers *map[string]string)

func AddSigningKeyNameHeader added in v1.31.0

func AddSigningKeyNameHeader(keyName string, headers *map[string]string)

func BuildQueryFromSpecFile added in v0.9.0

func BuildQueryFromSpecFile(specFile *CommonParams, requiredArtifactProps RequiredArtifactProps) string

Creates an aql query from a spec file.

func ConvertArtifactsDetailsToBuildInfoArtifacts added in v0.20.1

func ConvertArtifactsDetailsToBuildInfoArtifacts(artifactsDetailsReader *content.ContentReader) ([]buildinfo.Artifact, error)

func ConvertArtifactsDetailsToBuildInfoDependencies added in v0.20.1

func ConvertArtifactsDetailsToBuildInfoDependencies(artifactsDetailsReader *content.ContentReader) ([]buildinfo.Dependency, error)

func CreateAqlBodyForSpecWithPattern added in v0.9.0

func CreateAqlBodyForSpecWithPattern(params *CommonParams) (string, error)

Returns an AQL body string to search file in Artifactory by pattern, according the specified arguments requirements.

func CreateAqlQueryForBuildInfoJson added in v1.34.5

func CreateAqlQueryForBuildInfoJson(project, buildName, buildNumber, timestamp string) string

noinspection GoUnusedExportedFunction

func CreateAqlQueryForLatestCreated added in v0.26.1

func CreateAqlQueryForLatestCreated(repo, path string) string

func CreateAqlQueryForPypi added in v0.5.3

func CreateAqlQueryForPypi(repo, file string) string

func CreateAqlQueryForYarn added in v1.10.0

func CreateAqlQueryForYarn(npmName, npmVersion string) string

noinspection GoUnusedExportedFunction

func DisableAccelBuffering added in v0.5.6

func DisableAccelBuffering(headers *map[string]string)

func DisableTransitiveSearchIfNotAllowed added in v0.21.3

func DisableTransitiveSearchIfNotAllowed(params *CommonParams, artifactoryVersion *version.Version)

func ExecAql

func ExecAql(aqlQuery string, flags CommonConf) (io.ReadCloser, error)

func ExecAqlSaveToFile added in v0.13.0

func ExecAqlSaveToFile(aqlQuery string, flags CommonConf) (reader *content.ContentReader, err error)

func FilterBottomChainResults

func FilterBottomChainResults(readerRecord SearchBasedContentItem, reader *content.ContentReader) (resultReader *content.ContentReader, err error)

func FilterCandidateToBeDeleted added in v0.13.0

func FilterCandidateToBeDeleted(deleteCandidates *content.ContentReader, resultWriter *content.ContentWriter, candidateType string) ([]*content.ContentReader, error)

func FilterResultsByBuild added in v0.13.0

func FilterResultsByBuild(specFile *CommonParams, flags CommonConf, requiredArtifactProps RequiredArtifactProps, reader *content.ContentReader) (*content.ContentReader, error)

Filter the results by build, if no build found or items to filter, nil will be returned.

func FilterTopChainResults

func FilterTopChainResults(readerRecord SearchBasedContentItem, reader *content.ContentReader) (resultReader *content.ContentReader, err error)

Reduce the amount of items by saving only the shortest item path for each unique path e.g.: a | a/b | c | e/f -> a | c | e/f

func GetBuildInfo added in v0.20.1

func GetBuildInfo(buildName, buildNumber, projectKey string, flags CommonConf) (pbi *buildinfo.PublishedBuildInfo, found bool, err error)

func GetBuildInfoRepositoryByProject added in v1.31.0

func GetBuildInfoRepositoryByProject(projectKey string) string

func GetBuildNameAndNumberFromArtifactory added in v0.3.1

func GetBuildNameAndNumberFromArtifactory(buildName, buildNumber, projectKey string, flags CommonConf) (string, string, error)

func GetBuildNameAndNumberFromBuildIdentifier added in v1.38.0

func GetBuildNameAndNumberFromBuildIdentifier(buildIdentifier, projectKey string, flags CommonConf) (string, string, error)

This method parses buildIdentifier. buildIdentifier should be from the format "buildName/buildNumber". If no buildNumber provided LATEST will be downloaded. If buildName or buildNumber contains "/" (slash) it should be escaped by "\" (backslash). Result examples of parsing: "aaa/123" > "aaa"-"123", "aaa" > "aaa"-"LATEST", "aaa\\/aaa" > "aaa/aaa"-"LATEST", "aaa/12\\/3" > "aaa"-"12/3".

func GetLatestBuildNumberFromArtifactory added in v1.31.0

func GetLatestBuildNumberFromArtifactory(buildName, projectKey string, flags CommonConf) (buildNumber string, err error)

func GetProjectQueryParam added in v0.20.1

func GetProjectQueryParam(projectKey string) string

func GetTestResourcesPath added in v1.5.0

func GetTestResourcesPath() string

func HasPrefix added in v1.26.0

func HasPrefix(paths []string, prefix string) bool

Returns true if one or more paths has a value of 'prefix' as a prefix

func IsSubPath

func IsSubPath(paths []string, index int, separator string) bool

paths - Sorted array. index - Index of the current path which we want to check if it a prefix of any of the other previous paths. separator - File separator. Returns true paths[index] is a prefix of any of the paths[i] where i<index, otherwise returns false.

func IsWildcardPattern

func IsWildcardPattern(pattern string) bool

func LogSearchResults

func LogSearchResults(numOfArtifacts int)

func ParseNameAndVersion added in v1.5.0

func ParseNameAndVersion(identifier string, useLatestPolicy bool) (string, string, error)

For builds (useLatestPolicy = true) - Parse build name and number. The build number can be LATEST if absent. For release bundles - Parse bundle name and version. For module - Parse module name and number.

func ReduceBottomChainDirResult added in v0.13.0

func ReduceBottomChainDirResult(readerRecord SearchBasedContentItem, searchResults *content.ContentReader) (*content.ContentReader, error)

func ReduceDirResult

func ReduceDirResult(readerRecord SearchBasedContentItem, searchResults *content.ContentReader, ascendingOrder bool, resultsFilter AqlSearchResultItemFilter) (reader *content.ContentReader, err error)

Reduce Dir results by using the resultsFilter.

func ReduceTopChainDirResult added in v0.13.0

func ReduceTopChainDirResult(readerRecord SearchBasedContentItem, searchResults *content.ContentReader) (*content.ContentReader, error)

func SearchBySpecWithAql added in v0.2.0

func SearchBySpecWithAql(specFile *CommonParams, flags CommonConf, requiredArtifactProps RequiredArtifactProps) (reader *content.ContentReader, err error)

Use this function when running Aql with pattern

func SearchBySpecWithBuild added in v0.2.0

func SearchBySpecWithBuild(specFile *CommonParams, flags CommonConf) (readerContent *content.ContentReader, err error)

Use this function when searching by build without pattern or aql. Collect build artifacts and build dependencies separately, then merge the results into one reader.

func SearchBySpecWithPattern added in v0.2.0

func SearchBySpecWithPattern(specFile *CommonParams, flags CommonConf, requiredArtifactProps RequiredArtifactProps) (*content.ContentReader, error)

Perform search by pattern.

func SetContentType

func SetContentType(contentType string, headers *map[string]string)

func SumIntArray added in v0.9.0

func SumIntArray(arr []int) int

func UploadFile

func UploadFile(localPath, url, logMsgPrefix string, artifactoryDetails *auth.ServiceDetails, details *fileutils.FileDetails,
	httpClientsDetails httputils.HttpClientDetails, client *jfroghttpclient.JfrogHttpClient, includeChecksums bool,
	progress clientio.ProgressMgr) (*http.Response, []byte, error)

func UploadFileFromReader added in v0.20.1

func UploadFileFromReader(reader io.Reader, url string, artifactoryDetails *auth.ServiceDetails, details *fileutils.FileDetails,
	httpClientsDetails httputils.HttpClientDetails, client *jfroghttpclient.JfrogHttpClient) (*http.Response, []byte, error)

func WildcardToDirsPath

func WildcardToDirsPath(deletePattern, searchResult string) (string, error)

func WriteCandidateDirsToBeDeleted added in v0.13.0

func WriteCandidateDirsToBeDeleted(candidateDirsReaders []*content.ContentReader, filesNotToBeDeleteReader *content.ContentReader, resultWriter *content.ContentWriter) (err error)

Write all the dirs to be deleted into 'resultWriter'. However, skip dirs with files(s) that should not be deleted. In order to accomplish this, we check if the dirs are a prefix of any artifact, witch means the folder contains the artifact and should not be deleted. Optimization: In order not to scan for each dir the entire artifact reader and see if it is a prefix or not, we rely on the fact that the dirs and artifacts are sorted. We have two sorted readers in ascending order, we will start scanning from the beginning of the lists and compare whether the folder is a prefix of the current artifact, in case this is true the dir should not be deleted and we can move on to the next dir, otherwise we have to continue to the next dir or artifact. To know this, we will choose to move on with the lexicographic largest between the two.

candidateDirsReaders - Sorted list of dirs to be deleted. filesNotToBeDeleteReader - Sorted files that should not be deleted. resultWriter - The filtered list of dirs to be deleted.

Types

type Aql

type Aql struct {
	ItemsFind string `json:"items.find"`
}

func (*Aql) UnmarshalJSON

func (aql *Aql) UnmarshalJSON(value []byte) error

type AqlSearchResult

type AqlSearchResult struct {
	Results []ResultItem
}

type ArtifactDetails added in v0.20.1

type ArtifactDetails struct {
	// Path of the artifact in Artifactory
	ArtifactoryPath string             `json:"artifactoryPath,omitempty"`
	Checksums       buildinfo.Checksum `json:"checksums,omitempty"`
}

func (*ArtifactDetails) ToBuildInfoArtifact added in v0.20.1

func (ad *ArtifactDetails) ToBuildInfoArtifact() (buildinfo.Artifact, error)

func (*ArtifactDetails) ToBuildInfoDependency added in v0.20.1

func (ad *ArtifactDetails) ToBuildInfoDependency() buildinfo.Dependency

type BinariesSummary added in v1.15.0

type BinariesSummary struct {
	BinariesCount  string `json:"binariesCount,omitempty"`
	BinariesSize   string `json:"binariesSize,omitempty"`
	ArtifactsSize  string `json:"artifactsSize,omitempty"`
	Optimization   string `json:"optimization,omitempty"`
	ItemsCount     string `json:"itemsCount,omitempty"`
	ArtifactsCount string `json:"artifactsCount,omitempty"`
}

type Build added in v0.20.1

type Build struct {
	BuildName   string `json:"buildName"`
	BuildNumber string `json:"buildNumber"`
}

type BundleReleaseNotes added in v1.5.0

type BundleReleaseNotes struct {
	Content string `json:"content"`
	Syntax  string `json:"syntax"`
}

type CommonConf

type CommonConf interface {
	GetArtifactoryDetails() auth.ServiceDetails
	GetJfrogHttpClient() *jfroghttpclient.JfrogHttpClient
}

func NewCommonConfImpl added in v0.21.0

func NewCommonConfImpl(artDetails auth.ServiceDetails) (CommonConf, error)

type CommonConfImpl

type CommonConfImpl struct {
	// contains filtered or unexported fields
}

func (*CommonConfImpl) GetArtifactoryDetails

func (flags *CommonConfImpl) GetArtifactoryDetails() auth.ServiceDetails

func (*CommonConfImpl) GetJfrogHttpClient

func (flags *CommonConfImpl) GetJfrogHttpClient() *jfroghttpclient.JfrogHttpClient

type CommonParams added in v1.0.1

type CommonParams struct {
	Aql              Aql
	PathMapping      PathMapping
	Pattern          string
	Exclusions       []string
	Target           string
	Props            string
	TargetProps      *Properties
	ExcludeProps     string
	SortOrder        string
	SortBy           []string
	Offset           int
	Limit            int
	Build            string
	Project          string
	ExcludeArtifacts bool
	IncludeDeps      bool
	Bundle           string
	Recursive        bool
	IncludeDirs      bool
	Regexp           bool
	Ant              bool
	ArchiveEntries   string
	Transitive       bool
	Include          []string
}

func (*CommonParams) GetAql added in v1.0.1

func (params *CommonParams) GetAql() Aql

func (CommonParams) GetArchiveEntries added in v1.0.1

func (params CommonParams) GetArchiveEntries() string

func (*CommonParams) GetBuild added in v1.0.1

func (params *CommonParams) GetBuild() string

func (*CommonParams) GetBundle added in v1.0.1

func (params *CommonParams) GetBundle() string

func (*CommonParams) GetExcludeProps added in v1.0.1

func (params *CommonParams) GetExcludeProps() string

func (*CommonParams) GetExclusions added in v1.0.1

func (params *CommonParams) GetExclusions() []string

func (*CommonParams) GetLimit added in v1.0.1

func (params *CommonParams) GetLimit() int

func (*CommonParams) GetOffset added in v1.0.1

func (params *CommonParams) GetOffset() int

func (*CommonParams) GetPattern added in v1.0.1

func (params *CommonParams) GetPattern() string

func (*CommonParams) GetPatternType added in v1.0.1

func (params *CommonParams) GetPatternType() clientutils.PatternType

func (*CommonParams) GetProject added in v1.2.0

func (params *CommonParams) GetProject() string

func (*CommonParams) GetProps added in v1.0.1

func (params *CommonParams) GetProps() string

func (*CommonParams) GetSortBy added in v1.0.1

func (params *CommonParams) GetSortBy() []string

func (*CommonParams) GetSortOrder added in v1.0.1

func (params *CommonParams) GetSortOrder() string

func (CommonParams) GetSpecType added in v1.0.1

func (params CommonParams) GetSpecType() (specType SpecType)

func (*CommonParams) GetTarget added in v1.0.1

func (params *CommonParams) GetTarget() string

func (*CommonParams) GetTargetProps added in v1.0.1

func (params *CommonParams) GetTargetProps() *Properties

func (*CommonParams) IsExplode added in v1.0.1

func (params *CommonParams) IsExplode() bool

func (CommonParams) IsIncludeDirs added in v1.0.1

func (params CommonParams) IsIncludeDirs() bool

func (*CommonParams) IsRecursive added in v1.0.1

func (params *CommonParams) IsRecursive() bool

func (*CommonParams) SetArchiveEntries added in v1.0.1

func (params *CommonParams) SetArchiveEntries(archiveEntries string)

func (*CommonParams) SetExcludeProps added in v1.0.1

func (params *CommonParams) SetExcludeProps(excludeProps string)

func (*CommonParams) SetPattern added in v1.0.1

func (params *CommonParams) SetPattern(pattern string)

func (*CommonParams) SetProps added in v1.0.1

func (params *CommonParams) SetProps(props string)

func (*CommonParams) SetTarget added in v1.0.1

func (params *CommonParams) SetTarget(target string)

func (*CommonParams) SetTargetProps added in v1.0.1

func (params *CommonParams) SetTargetProps(targetProps *Properties)

type FileGetter

type FileGetter interface {
	GetAql() Aql
	GetPattern() string
	SetPattern(pattern string)
	GetExclusions() []string
	GetTarget() string
	SetTarget(target string)
	IsExplode() bool
	GetProps() string
	GetSortOrder() string
	GetSortBy() []string
	GetOffset() int
	GetLimit() int
	GetBuild() string
	GetProject() string
	GetBundle() string
	GetSpecType() (specType SpecType)
	IsRecursive() bool
	IsIncludeDirs() bool
	GetArchiveEntries() string
	SetArchiveEntries(archiveEntries string)
	GetPatternType() clientutils.PatternType
}

type FileInfo

type FileInfo struct {
	Uri          string `json:"uri,omitempty"`
	DownloadUri  string `json:"downloadUri,omitempty"`
	Repo         string `json:"repo,omitempty"`
	Path         string `json:"path,omitempty"`
	RemoteUrl    string `json:"remoteUrl,omitempty"`
	Created      string `json:"created,omitempty"`
	CreatedBy    string `json:"createdBy,omitempty"`
	LastModified string `json:"lastModified,omitempty"`
	ModifiedBy   string `json:"modifiedBy,omitempty"`
	LastUpdated  string `json:"lastUpdated,omitempty"`
	Size         string `json:"size,omitempty"`
	MimeType     string `json:"mimeType,omitempty"`
	Checksums    struct {
		Sha1   string `json:"sha1,omitempty"`
		Sha256 string `json:"sha256,omitempty"`
		Md5    string `json:"md5,omitempty"`
	} `json:"checksums,omitempty"`
}

type FileListFile added in v1.15.0

type FileListFile struct {
	Uri                string             `json:"uri,omitempty"`
	Size               json.Number        `json:"size,omitempty"`
	LastModified       string             `json:"lastModified,omitempty"`
	Folder             bool               `json:"folder,omitempty"`
	Sha1               string             `json:"sha1,omitempty"`
	Sha2               string             `json:"sha2,omitempty"`
	MetadataTimestamps MetadataTimestamps `json:"mdTimestamps,omitempty"`
}

type FileListParams added in v1.15.0

type FileListParams struct {
	Deep               bool
	Depth              int
	ListFolders        bool
	MetadataTimestamps bool
	IncludeRootPath    bool
}

func NewFileListParams added in v1.15.0

func NewFileListParams() FileListParams

type FileListResponse added in v1.15.0

type FileListResponse struct {
	Uri     string         `json:"uri,omitempty"`
	Created string         `json:"created,omitempty"`
	Files   []FileListFile `json:"files,omitempty"`
}

type FileStoreSummary added in v1.15.0

type FileStoreSummary struct {
	StorageType      string `json:"storageType,omitempty"`
	StorageDirectory string `json:"storageDirectory,omitempty"`
	TotalSpace       string `json:"totalSpace,omitempty"`
	UsedSpace        string `json:"usedSpace,omitempty"`
	FreeSpace        string `json:"freeSpace,omitempty"`
}

type FolderInfo added in v1.15.0

type FolderInfo struct {
	Uri          string               `json:"uri,omitempty"`
	Repo         string               `json:"repo,omitempty"`
	Path         string               `json:"path,omitempty"`
	Created      string               `json:"created,omitempty"`
	CreatedBy    string               `json:"createdBy,omitempty"`
	LastModified string               `json:"lastModified,omitempty"`
	ModifiedBy   string               `json:"modifiedBy,omitempty"`
	LastUpdated  string               `json:"lastUpdated,omitempty"`
	Children     []FolderInfoChildren `json:"children,omitempty"`
}

type FolderInfoChildren added in v1.15.0

type FolderInfoChildren struct {
	Uri    string `json:"uri,omitempty"`
	Folder bool   `json:"folder,omitempty"`
}

type GetReplicationBody added in v1.10.0

type GetReplicationBody struct {
	ProxyRef string `json:"proxyRef"`
	// contains filtered or unexported fields
}

type ItemProperties added in v1.15.0

type ItemProperties struct {
	Properties map[string][]string `json:"properties,omitempty"`
	Uri        string              `json:"uri,omitempty"`
}

type MetadataTimestamps added in v1.15.0

type MetadataTimestamps struct {
	Properties string `json:"properties,omitempty"`
}

type MultipartUpload added in v1.38.0

type MultipartUpload struct {
	// contains filtered or unexported fields
}

func NewMultipartUpload added in v1.38.0

func NewMultipartUpload(client *jfroghttpclient.JfrogHttpClient, httpClientsDetails *httputils.HttpClientDetails, artifactoryUrl string) *MultipartUpload

func (*MultipartUpload) IsSupported added in v1.38.0

func (mu *MultipartUpload) IsSupported(serviceDetails auth.ServiceDetails) (supported bool, err error)

func (*MultipartUpload) UploadFileConcurrently added in v1.38.0

func (mu *MultipartUpload) UploadFileConcurrently(localPath, targetPath string, fileSize int64, sha1 string, progress ioutils.ProgressMgr, splitCount int) (err error)

type OperationSummary added in v0.20.1

type OperationSummary struct {
	// A ContentReader of FileTransferDetails structs
	TransferDetailsReader *content.ContentReader
	// A ContentReader of ArtifactDetails structs
	ArtifactsDetailsReader *content.ContentReader
	TotalSucceeded         int
	TotalFailed            int
}

func (*OperationSummary) Close added in v0.20.1

func (cs *OperationSummary) Close() error

type PathMapping added in v1.35.0

type PathMapping struct {
	Input  string `json:"input"`
	Output string `json:"output"`
}

type Properties

type Properties struct {
	// contains filtered or unexported fields
}

func MergeProperties added in v0.20.2

func MergeProperties(properties []*Properties) *Properties

Merges multiple Properties structs into one and removes duplicate values

func NewProperties added in v0.20.2

func NewProperties() *Properties

func ParseProperties

func ParseProperties(propStr string) (*Properties, error)

Parsing properties string to Properties struct.

func (*Properties) AddProperty added in v0.20.2

func (props *Properties) AddProperty(key, value string)

func (*Properties) KeysLen added in v0.20.2

func (props *Properties) KeysLen() int

func (*Properties) ParseAndAddProperties added in v0.20.2

func (props *Properties) ParseAndAddProperties(propStr string) error

func (*Properties) ToEncodedString

func (props *Properties) ToEncodedString(concatValues bool) string

Creates a string of the properties, ready to use in a URL. If concatValues is true, then the values of each property are concatenated together separated by a comma. For example: key=val1,val2,... Otherwise, each value of the property will be written with its key separately. For example: key=val1;key=val2;...

func (*Properties) ToHeadersMap

func (props *Properties) ToHeadersMap() map[string]string

func (*Properties) ToMap added in v0.19.0

func (props *Properties) ToMap() map[string][]string

Convert properties from Slice to map

type Property

type Property struct {
	Key   string
	Value string
}

type RbGpgValidator added in v1.5.0

type RbGpgValidator struct {
	// contains filtered or unexported fields
}

func NewRbGpgValidator added in v1.5.0

func NewRbGpgValidator() *RbGpgValidator

func (*RbGpgValidator) ArtifactsMap added in v1.5.0

func (r *RbGpgValidator) ArtifactsMap() map[string]string

func (*RbGpgValidator) SetAtrifactoryDetails added in v1.5.0

func (r *RbGpgValidator) SetAtrifactoryDetails(artDetails *auth.ServiceDetails) *RbGpgValidator

func (*RbGpgValidator) SetClient added in v1.5.0

func (*RbGpgValidator) SetPublicKey added in v1.5.0

func (r *RbGpgValidator) SetPublicKey(path string) *RbGpgValidator

func (*RbGpgValidator) SetRbName added in v1.5.0

func (r *RbGpgValidator) SetRbName(rbName string) *RbGpgValidator

func (*RbGpgValidator) SetRbVersion added in v1.5.0

func (r *RbGpgValidator) SetRbVersion(rbVersion string) *RbGpgValidator

func (*RbGpgValidator) Validate added in v1.5.0

func (r *RbGpgValidator) Validate() error

Validate gets a signed release bundle from Artifactory, validates the signature with the public gpg key and saves the release bundle's artifacts in a map

func (*RbGpgValidator) VerifyArtifact added in v1.5.0

func (r *RbGpgValidator) VerifyArtifact(artifactPath, sha256 string) error

type ReleaseArtifact added in v1.5.0

type ReleaseArtifact struct {
	RepoPath      string `json:"repo_path"`
	Checksum      string `json:"checksum"`
	DownloadToken string `json:"download_token"`
}

type ReleaseBundleModel added in v1.5.0

type ReleaseBundleModel struct {
	Id           string              `json:"id"`
	Name         string              `json:"name"`
	Version      string              `json:"version"`
	Created      string              `json:"created"`
	Description  string              `json:"description"`
	Artifacts    []*ReleaseArtifact  `json:"artifacts"`
	ReleaseNotes *BundleReleaseNotes `json:"release_notes"`
	Signature    string              `json:"signature"`
	Type         string              `json:"type"`
}

func (*ReleaseBundleModel) GetOrCalculateId added in v1.5.0

func (rbm *ReleaseBundleModel) GetOrCalculateId() string

func (*ReleaseBundleModel) Valid added in v1.5.0

func (rbm *ReleaseBundleModel) Valid() error

type ReplicationParams added in v0.9.0

type ReplicationParams struct {
	Username string
	Password string
	Url      string
	CronExp  string
	// Source replication repository.
	RepoKey                string
	Proxy                  string
	EnableEventReplication bool
	SocketTimeoutMillis    int
	Enabled                bool
	SyncDeletes            bool
	SyncProperties         bool
	SyncStatistics         bool
	// Deprecated
	PathPrefix               string
	IncludePathPrefixPattern string
}

func CreateReplicationParams added in v1.10.0

func CreateReplicationParams(body GetReplicationBody) *ReplicationParams

type RepoPathFile added in v0.5.0

type RepoPathFile struct {
	// contains filtered or unexported fields
}

We need to translate the provided download pattern to an AQL query. In Artifactory, for each artifact the name and path of the artifact are saved separately. We therefore need to build an AQL query that covers all possible repositories, paths and names the provided pattern can include. For example, the pattern repo/a/* can include the two following file: repo/a/file1.tgz and also repo/a/b/file2.tgz To achieve that, this function parses the pattern by splitting it by its * characters. The end result is a list of RepoPathFile structs. Each struct represent a possible repository, path and file name triple to be included in AQL query with an "or" relationship.

type RepositorySummary added in v1.15.0

type RepositorySummary struct {
	RepoKey          string      `json:"repoKey,omitempty"`
	RepoType         string      `json:"repoType,omitempty"`
	FoldersCount     json.Number `json:"foldersCount,omitempty"`
	FilesCount       json.Number `json:"filesCount,omitempty"`
	UsedSpace        string      `json:"usedSpace,omitempty"`
	UsedSpaceInBytes json.Number `json:"usedSpaceInBytes,omitempty"`
	ItemsCount       json.Number `json:"itemsCount,omitempty"`
	PackageType      string      `json:"packageType,omitempty"`
	ProjectKey       string      `json:"projectKey,omitempty"`
	Percentage       string      `json:"percentage,omitempty"`
}

type RequiredArtifactProps

type RequiredArtifactProps int
const (
	ALL RequiredArtifactProps = iota
	SYMLINK
	NONE
)

This enum defines which properties are required in the result of the aql. For example, when performing a copy/move command - the props are not needed, so we set RequiredArtifactProps to NONE.

type Result added in v0.9.0

type Result struct {
	SuccessCount []int
	TotalCount   []int
}

func NewResult added in v0.9.0

func NewResult(threads int) *Result

type ResultItem

type ResultItem struct {
	Repo        string     `json:"repo,omitempty"`
	Path        string     `json:"path,omitempty"`
	Name        string     `json:"name,omitempty"`
	Created     string     `json:"created,omitempty"`
	Modified    string     `json:"modified,omitempty"`
	Updated     string     `json:"updated,omitempty"`
	CreatedBy   string     `json:"created_by,omitempty"`
	ModifiedBy  string     `json:"modified_by,omitempty"`
	Type        string     `json:"type,omitempty"`
	Actual_Md5  string     `json:"actual_md5,omitempty"`
	Actual_Sha1 string     `json:"actual_sha1,omitempty"`
	Sha256      string     `json:"sha256,omitempty"`
	Depth       int        `json:"depth,omitempty"`
	Size        int64      `json:"size,omitempty"`
	OriginalMd5 string     `json:"original_md5,omitempty"`
	Properties  []Property `json:"properties,omitempty"`
	Stats       []Stat     `json:"stats,omitempty"`
}

func (ResultItem) GetItemRelativeLocation added in v0.13.2

func (item ResultItem) GetItemRelativeLocation() string

Returns "item.Repo/item.Path/".

func (ResultItem) GetItemRelativePath

func (item ResultItem) GetItemRelativePath() string

func (ResultItem) GetName added in v0.17.0

func (item ResultItem) GetName() string

func (*ResultItem) GetProperty added in v0.17.5

func (item *ResultItem) GetProperty(key string) string

func (ResultItem) GetSortKey added in v0.17.0

func (item ResultItem) GetSortKey() string

func (ResultItem) GetType added in v0.17.0

func (item ResultItem) GetType() string

func (*ResultItem) ToArtifact

func (item *ResultItem) ToArtifact() buildinfo.Artifact

func (*ResultItem) ToDependency

func (item *ResultItem) ToDependency() buildinfo.Dependency

type SearchBasedContentItem added in v0.17.0

type SearchBasedContentItem interface {
	content.SortableContentItem
	GetItemRelativePath() string
	GetName() string
	GetType() string
}

Implement this interface to allow creating 'content.ContentReader' items which can be used with 'searchutils' functions.

type SpecType

type SpecType string
const (
	WILDCARD SpecType = "wildcard"
	AQL      SpecType = "aql"
	BUILD    SpecType = "build"
)

type Stat added in v1.15.0

type Stat struct {
	Downloaded      string      `json:"downloaded,omitempty"`
	Downloads       json.Number `json:"downloads,omitempty"`
	DownloadedBy    string      `json:"downloaded_by,omitempty"`
	RemoteDownloads json.Number `json:"remote_downloads,omitempty"`
}

type StorageInfo added in v1.15.0

type StorageInfo struct {
	BinariesSummary         `json:"binariesSummary,omitempty"`
	RepositoriesSummaryList []RepositorySummary `json:"repositoriesSummaryList,omitempty"`
	FileStoreSummary        `json:"fileStoreSummary,omitempty"`
}

func (*StorageInfo) FindRepositoryWithKey added in v1.20.0

func (si *StorageInfo) FindRepositoryWithKey(key string) (*RepositorySummary, error)

type UpdateReplicationBody added in v1.10.0

type UpdateReplicationBody struct {
	Proxy string `json:"proxy"`
	// contains filtered or unexported fields
}

func CreateUpdateReplicationBody added in v1.10.0

func CreateUpdateReplicationBody(params ReplicationParams) *UpdateReplicationBody

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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