Interface GitRepositoryClient


public interface GitRepositoryClient
Client for a git repository.
  • 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

      Set<String> getBranches() throws IOException, org.apache.nifi.registry.flow.FlowRegistryException
      Retrieves the names of the branches.
      Returns:
      the set of branch names
      Throws:
      IOException - if an I/O error occurs
      org.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 occurs
      org.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 directory
      branch - the branch name
      Returns:
      the set of filenames
      Throws:
      IOException - if an I/O error occurs
      org.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 file
      branch - the branch name
      Returns:
      the list of commits
      Throws:
      IOException - if an I/O error occurs
      org.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 file
      branch - the branch name
      Returns:
      the input stream for the content
      Throws:
      IOException - if an I/O error occurs
      org.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 file
      commitSha - the commit for the content
      Returns:
      the input stream for the content
      Throws:
      IOException - if an I/O error occurs
      org.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 file
      branch - the branch
      Returns:
      the SHA of the content
      Throws:
      IOException - if an I/O error occurs
      org.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 occurs
      org.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 file
      commitMessage - the commit message
      branch - the branch
      Returns:
      the input stream to the deleted content
      Throws:
      IOException - if an I/O error occurs
      org.apache.nifi.registry.flow.FlowRegistryException - if a non-I/O error occurs
    • close

      default void close() throws IOException
      Closes any resources held by the client.
      Throws:
      IOException - if an I/O error occurs closing the client