use of org.gitlab4j.api.GroupApi in project catma by forTEXT.
the class GitlabManagerRestricted method createRepository.
@Override
public CreateRepositoryResponse createRepository(String name, String path, String groupPath) throws IOException {
GroupApi groupApi = restrictedGitLabApi.getGroupApi();
ProjectApi projectApi = restrictedGitLabApi.getProjectApi();
try {
Group group = groupApi.getGroup(groupPath);
Namespace namespace = new Namespace();
namespace.setId(group.getId());
Project project = new Project();
project.setName(name);
project.setNamespace(namespace);
if (StringUtils.isNotEmpty(path)) {
project.setPath(path);
}
project = projectApi.createProject(project);
return new CreateRepositoryResponse(groupPath, project.getId(), GitlabUtils.rewriteGitLabServerUrl(project.getHttpUrlToRepo()));
} catch (GitLabApiException e) {
throw new IOException("Failed to create remote Git repository", e);
}
}
Aggregations