Class ArtifactoryClient
java.lang.Object
io.jenkins.plugins.jobcacher.artifactory.ArtifactoryClient
- All Implemented Interfaces:
AutoCloseable
-
Nested Class Summary
-
Field Summary
-
Constructor Summary
ConstructorDescriptionArtifactoryClient
(String serverUrl, String repository, com.cloudbees.plugins.credentials.common.UsernamePasswordCredentials credentials) -
Method Summary
Modifier and TypeMethodDescriptionReturn a new ArtifactoryConfig object for this clientvoid
close()
void
Copy an artifact from one path to another.void
deleteArtifact
(String targetPath) Delete an artifact or path from the repositorydownloadArtifact
(String targetPath) Download an artifact from the repositoryboolean
Check if a path is a fileboolean
Check if a path is a folderlong
lastUpdated
(String targetPath) Get the last updated time of a pathList the files in a foldervoid
Move an artifact from one path to another.long
Get the size of a pathvoid
uploadArtifact
(Path file, String targetPath) Upload an artifact to the repository
-
Field Details
-
LOGGER
public static final org.slf4j.Logger LOGGER
-
-
Constructor Details
-
ArtifactoryClient
-
ArtifactoryClient
-
-
Method Details
-
getConfig
-
uploadArtifact
Upload an artifact to the repository- Parameters:
file
- the file to uploadtargetPath
- the path to upload the file to- Throws:
IOException
- if the file cannot be uploaded
-
deleteArtifact
Delete an artifact or path from the repository- Parameters:
targetPath
- the path of the artifact to delete
-
move
Move an artifact from one path to another. Require Artifactory PRO- Parameters:
sourcePath
- the source pathtargetPath
- the target path
-
copy
Copy an artifact from one path to another. Require Artifactory PRO- Parameters:
sourcePath
- the source pathtargetPath
- the target path
-
downloadArtifact
Download an artifact from the repository- Parameters:
targetPath
- the path of the artifact to download- Returns:
- a pair of the closable client and the input stream of the artifact
- Throws:
IOException
- if the artifact cannot be downloaded
-
isFolder
Check if a path is a folder- Parameters:
targetPath
- the path to check- Returns:
- true if the path is a folder, false otherwise
- Throws:
IOException
- if the path cannot be checked
-
list
List the files in a folder- Parameters:
targetPath
- the path to list- Returns:
- the list of files in the folder
- Throws:
IOException
- if the files cannot be listed
-
isFile
Check if a path is a file- Parameters:
targetPath
- the path to check- Returns:
- true if the path is a file, false otherwise
- Throws:
IOException
- if the path cannot be checked
-
lastUpdated
Get the last updated time of a path- Parameters:
targetPath
- the path to check- Returns:
- the last updated time of the path
- Throws:
IOException
- if the last updated time cannot be checked
-
size
Get the size of a path- Parameters:
targetPath
- the path to check- Returns:
- the size of the path
- Throws:
IOException
- if the size cannot be checked
-
buildArtifactoryConfig
Return a new ArtifactoryConfig object for this client- Returns:
- the ArtifactoryConfig object
-
close
- Specified by:
close
in interfaceAutoCloseable
- Throws:
Exception
-