Interface GitRepositoryClient
public interface GitRepositoryClient
Client for a git repository.
-
Method Summary
Modifier and TypeMethodDescriptiondefault voidclose()Closes any resources held by the client.createContent(GitCreateContentRequest request) Creates a file in the repository based on the given request.deleteContent(String filePath, String commitMessage, String branch) Deletes the file at the given path on the given branch.Retrieves the names of the branches.getCommits(String path, String branch) Retrieves the commits for the file at the given path on the given branch.getContentFromBranch(String path, String branch) Retrieves the content for the file at the given path on the given branch.getContentFromCommit(String path, String commitSha) Retrieves the content for the file at the given path from the given commit.getContentSha(String path, String branch) Retrieves the SHA of the file at the given path on the given branch.getFileNames(String directory, String branch) Retrieves the filenames in the given directory on the given branch.getTopLevelDirectoryNames(String branch) Retrieves the top level directory names which represent buckets.booleanboolean
-
Method Details
-
hasReadPermission
boolean hasReadPermission()- Returns:
- true if the client can read from the configured repository, false otherwise
-
hasWritePermission
boolean hasWritePermission()- Returns:
- true if the client can write from the configured repository, false otherwise
-
getBranches
Retrieves the names of the branches.- Returns:
- the set of branch names
- Throws:
IOException- if an I/O error occursorg.apache.nifi.registry.flow.FlowRegistryException- if a non-I/O error occurs
-
getTopLevelDirectoryNames
Set<String> getTopLevelDirectoryNames(String branch) throws IOException, org.apache.nifi.registry.flow.FlowRegistryException Retrieves the top level directory names which represent buckets.- Parameters:
branch- the branch to retrieve from- Returns:
- the set of directory names
- Throws:
IOException- if an I/O error occursorg.apache.nifi.registry.flow.FlowRegistryException- if a non-I/O error occurs
-
getFileNames
Set<String> getFileNames(String directory, String branch) throws IOException, org.apache.nifi.registry.flow.FlowRegistryException Retrieves the filenames in the given directory on the given branch.- Parameters:
directory- the directorybranch- the branch name- Returns:
- the set of filenames
- Throws:
IOException- if an I/O error occursorg.apache.nifi.registry.flow.FlowRegistryException- if a non-I/O error occurs
-
getCommits
List<GitCommit> getCommits(String path, String branch) throws IOException, org.apache.nifi.registry.flow.FlowRegistryException Retrieves the commits for the file at the given path on the given branch.- Parameters:
path- the path of the filebranch- the branch name- Returns:
- the list of commits
- Throws:
IOException- if an I/O error occursorg.apache.nifi.registry.flow.FlowRegistryException- if a non-I/O error occurs
-
getContentFromBranch
InputStream getContentFromBranch(String path, String branch) throws IOException, org.apache.nifi.registry.flow.FlowRegistryException Retrieves the content for the file at the given path on the given branch.- Parameters:
path- the path of the filebranch- the branch name- Returns:
- the input stream for the content
- Throws:
IOException- if an I/O error occursorg.apache.nifi.registry.flow.FlowRegistryException- if a non-I/O error occurs
-
getContentFromCommit
InputStream getContentFromCommit(String path, String commitSha) throws IOException, org.apache.nifi.registry.flow.FlowRegistryException Retrieves the content for the file at the given path from the given commit.- Parameters:
path- the path of the filecommitSha- the commit for the content- Returns:
- the input stream for the content
- Throws:
IOException- if an I/O error occursorg.apache.nifi.registry.flow.FlowRegistryException- if a non-I/O error occurs
-
getContentSha
Optional<String> getContentSha(String path, String branch) throws IOException, org.apache.nifi.registry.flow.FlowRegistryException Retrieves the SHA of the file at the given path on the given branch.- Parameters:
path- the path of the filebranch- the branch- Returns:
- the SHA of the content
- Throws:
IOException- if an I/O error occursorg.apache.nifi.registry.flow.FlowRegistryException- if a non-I/O error occurs
-
createContent
String createContent(GitCreateContentRequest request) throws IOException, org.apache.nifi.registry.flow.FlowRegistryException Creates a file in the repository based on the given request.- Parameters:
request- the request- Returns:
- the SHA of the commit that created the file
- Throws:
IOException- if an I/O error occursorg.apache.nifi.registry.flow.FlowRegistryException- if a non-I/O error occurs
-
deleteContent
InputStream deleteContent(String filePath, String commitMessage, String branch) throws org.apache.nifi.registry.flow.FlowRegistryException, IOException Deletes the file at the given path on the given branch. The caller of this method is responsible for closing the returned InputStream.- Parameters:
filePath- the path of the filecommitMessage- the commit messagebranch- the branch- Returns:
- the input stream to the deleted content
- Throws:
IOException- if an I/O error occursorg.apache.nifi.registry.flow.FlowRegistryException- if a non-I/O error occurs
-
close
Closes any resources held by the client.- Throws:
IOException- if an I/O error occurs closing the client
-