Package org.apache.nifi.gitlab
Class GitLabRepositoryClient
java.lang.Object
org.apache.nifi.gitlab.GitLabRepositoryClient
- All Implemented Interfaces:
GitRepositoryClient
Implementation of
GitRepositoryClient for GitLab.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classprivate static interfaceFunctional interface for making a request to GitLab which may throw GitLabApiException.private static final recordHolder for information about the permissions of the provided token. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final booleanprivate final booleanprivate final Stringprivate final intprivate static final intprivate static final Stringprivate final org.gitlab4j.api.GitLabApiprivate static final org.slf4j.Loggerprivate final com.fasterxml.jackson.databind.ObjectMapperprivate static final Stringprivate static final Stringprivate final Stringprivate static final Stringprivate final intprivate final Stringprivate final Stringprivate final Stringprivate static final GitLabRepositoryClient.TokenInfoprivate static final String -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate -
Method Summary
Modifier and TypeMethodDescriptionbuilder()voidclose()private HttpURLConnectioncreateConnection(String subPath) createContent(GitCreateContentRequest request) private GitLabRepositoryClient.TokenInfocreateTokenInfo(PersonalAccessToken personalAccessToken) deleteContent(String filePath, String commitMessage, String branch) private <T> Texecute(GitLabRepositoryClient.GitLabRequest<T> action) getCommits(String path, String branch) getContentFromBranch(String path, String branch) getContentFromCommit(String path, String commitSha) getContentSha(String path, String branch) getFileNames(String directory, String branch) private Optional<PersonalAccessToken> private Optional<org.gitlab4j.api.models.Project> private StringgetResolvedPath(String path) private GitLabRepositoryClient.TokenInfogetTopLevelDirectoryNames(String branch) private booleanhasMinimumAccessLevel(org.gitlab4j.api.models.Project project, org.gitlab4j.api.models.AccessLevel accessLevel) booleanbooleanprivate booleanisDirectory(org.gitlab4j.api.models.TreeItem item) private booleanisFile(org.gitlab4j.api.models.TreeItem item) private PersonalAccessTokenprivate GitCommittoGitCommit(org.gitlab4j.api.models.Commit commit)
-
Field Details
-
LOGGER
private static final org.slf4j.Logger LOGGER -
PERSONAL_ACCESS_TOKENS_SELF_PATH
- See Also:
-
PRIVATE_TOKEN_HEADER
- See Also:
-
READ_API_SCOPE
- See Also:
-
WRITE_API_SCOPE
- See Also:
-
DIRECTORY_MODE
- See Also:
-
DEFAULT_ITEMS_PER_PAGE
private static final int DEFAULT_ITEMS_PER_PAGE- See Also:
-
UNKNOWN_TOKEN
-
objectMapper
private final com.fasterxml.jackson.databind.ObjectMapper objectMapper -
clientId
-
repoNamespace
-
repoName
-
repoPath
-
projectPath
-
connectTimeout
private final int connectTimeout -
readTimeout
private final int readTimeout -
gitLab
private final org.gitlab4j.api.GitLabApi gitLab -
canRead
private final boolean canRead -
canWrite
private final boolean canWrite
-
-
Constructor Details
-
GitLabRepositoryClient
private GitLabRepositoryClient(GitLabRepositoryClient.Builder builder) throws org.apache.nifi.registry.flow.FlowRegistryException - Throws:
org.apache.nifi.registry.flow.FlowRegistryException
-
-
Method Details
-
getRepoNamespace
-
getRepoName
-
hasReadPermission
public boolean hasReadPermission()- Specified by:
hasReadPermissionin interfaceGitRepositoryClient
-
hasWritePermission
public boolean hasWritePermission()- Specified by:
hasWritePermissionin interfaceGitRepositoryClient
-
getBranches
- Specified by:
getBranchesin interfaceGitRepositoryClient- Throws:
org.apache.nifi.registry.flow.FlowRegistryException
-
getTopLevelDirectoryNames
public Set<String> getTopLevelDirectoryNames(String branch) throws org.apache.nifi.registry.flow.FlowRegistryException - Specified by:
getTopLevelDirectoryNamesin interfaceGitRepositoryClient- Throws:
org.apache.nifi.registry.flow.FlowRegistryException
-
getFileNames
public Set<String> getFileNames(String directory, String branch) throws org.apache.nifi.registry.flow.FlowRegistryException - Specified by:
getFileNamesin interfaceGitRepositoryClient- Throws:
org.apache.nifi.registry.flow.FlowRegistryException
-
getCommits
public List<GitCommit> getCommits(String path, String branch) throws org.apache.nifi.registry.flow.FlowRegistryException - Specified by:
getCommitsin interfaceGitRepositoryClient- Throws:
org.apache.nifi.registry.flow.FlowRegistryException
-
getContentFromBranch
public InputStream getContentFromBranch(String path, String branch) throws org.apache.nifi.registry.flow.FlowRegistryException - Specified by:
getContentFromBranchin interfaceGitRepositoryClient- Throws:
org.apache.nifi.registry.flow.FlowRegistryException
-
getContentFromCommit
public InputStream getContentFromCommit(String path, String commitSha) throws org.apache.nifi.registry.flow.FlowRegistryException - Specified by:
getContentFromCommitin interfaceGitRepositoryClient- Throws:
org.apache.nifi.registry.flow.FlowRegistryException
-
getContentSha
public Optional<String> getContentSha(String path, String branch) throws org.apache.nifi.registry.flow.FlowRegistryException - Specified by:
getContentShain interfaceGitRepositoryClient- Throws:
org.apache.nifi.registry.flow.FlowRegistryException
-
createContent
public String createContent(GitCreateContentRequest request) throws org.apache.nifi.registry.flow.FlowRegistryException - Specified by:
createContentin interfaceGitRepositoryClient- Throws:
org.apache.nifi.registry.flow.FlowRegistryException
-
deleteContent
public InputStream deleteContent(String filePath, String commitMessage, String branch) throws org.apache.nifi.registry.flow.FlowRegistryException - Specified by:
deleteContentin interfaceGitRepositoryClient- Throws:
org.apache.nifi.registry.flow.FlowRegistryException
-
close
public void close()- Specified by:
closein interfaceGitRepositoryClient
-
getProject
private Optional<org.gitlab4j.api.models.Project> getProject() throws org.apache.nifi.registry.flow.FlowRegistryException- Throws:
org.apache.nifi.registry.flow.FlowRegistryException
-
hasMinimumAccessLevel
private boolean hasMinimumAccessLevel(org.gitlab4j.api.models.Project project, org.gitlab4j.api.models.AccessLevel accessLevel) -
getTokenInfo
-
createTokenInfo
-
getPersonalAccessToken
-
retrievePersonalAccessToken
private PersonalAccessToken retrievePersonalAccessToken() throws org.apache.nifi.registry.flow.FlowRegistryException- Throws:
org.apache.nifi.registry.flow.FlowRegistryException
-
createConnection
- Throws:
IOException
-
getResolvedPath
-
isDirectory
private boolean isDirectory(org.gitlab4j.api.models.TreeItem item) -
isFile
private boolean isFile(org.gitlab4j.api.models.TreeItem item) -
toGitCommit
-
execute
private <T> T execute(GitLabRepositoryClient.GitLabRequest<T> action) throws org.apache.nifi.registry.flow.FlowRegistryException - Throws:
org.apache.nifi.registry.flow.FlowRegistryException
-
builder
-