Skip to content

Commit

Permalink
u rest-services
Browse files Browse the repository at this point in the history
  • Loading branch information
snazy committed Aug 21, 2024
1 parent c0722ec commit 8da2755
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import jakarta.enterprise.context.RequestScoped;
import jakarta.inject.Inject;
import jakarta.ws.rs.Path;
import org.eclipse.microprofile.openapi.annotations.Operation;
import org.projectnessie.api.v1.http.HttpContentApi;
import org.projectnessie.error.NessieNotFoundException;
import org.projectnessie.model.Content;
Expand Down Expand Up @@ -55,13 +56,15 @@ private ContentService resource() {

@Override
@JsonView(Views.V1.class)
@Operation(operationId = "nessie.v1.getContent")
public Content getContent(ContentKey key, String ref, String hashOnRef)
throws NessieNotFoundException {
return resource().getContent(key, ref, hashOnRef, false, false).getContent();
}

@Override
@JsonView(Views.V1.class)
@Operation(operationId = "nessie.v1.getMultipleContents")
public GetMultipleContentsResponse getMultipleContents(
String ref, String hashOnRef, GetMultipleContentsRequest request)
throws NessieNotFoundException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import jakarta.enterprise.context.RequestScoped;
import jakarta.inject.Inject;
import jakarta.ws.rs.Path;
import org.eclipse.microprofile.openapi.annotations.Operation;
import org.projectnessie.api.v1.http.HttpDiffApi;
import org.projectnessie.api.v1.params.DiffParams;
import org.projectnessie.error.NessieNotFoundException;
Expand Down Expand Up @@ -58,6 +59,7 @@ private DiffService resource() {

@Override
@JsonView(Views.V1.class)
@Operation(operationId = "nessie.v1.getDiff")
public DiffResponse getDiff(DiffParams params) throws NessieNotFoundException {
ImmutableDiffResponse.Builder builder = DiffResponse.builder();
return resource()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import jakarta.inject.Inject;
import jakarta.validation.constraints.NotNull;
import jakarta.ws.rs.Path;
import org.eclipse.microprofile.openapi.annotations.Operation;
import org.projectnessie.api.v1.http.HttpNamespaceApi;
import org.projectnessie.api.v1.params.MultipleNamespacesParams;
import org.projectnessie.api.v1.params.NamespaceParams;
Expand Down Expand Up @@ -60,13 +61,15 @@ private NamespaceService resource() {

@Override
@JsonView(Views.V1.class)
@Operation(operationId = "nessie.v1.createNamespace")
public Namespace createNamespace(NamespaceParams params, Namespace namespace)
throws NessieNamespaceAlreadyExistsException, NessieReferenceNotFoundException {
return resource().createNamespace(params.getRefName(), namespace);
}

@Override
@JsonView(Views.V1.class)
@Operation(operationId = "nessie.v1.deleteNamespace")
public void deleteNamespace(@NotNull NamespaceParams params)
throws NessieReferenceNotFoundException,
NessieNamespaceNotEmptyException,
Expand All @@ -76,6 +79,7 @@ public void deleteNamespace(@NotNull NamespaceParams params)

@Override
@JsonView(Views.V1.class)
@Operation(operationId = "nessie.v1.getNamespace")
public Namespace getNamespace(@NotNull NamespaceParams params)
throws NessieNamespaceNotFoundException, NessieReferenceNotFoundException {
return resource()
Expand All @@ -84,6 +88,7 @@ public Namespace getNamespace(@NotNull NamespaceParams params)

@Override
@JsonView(Views.V1.class)
@Operation(operationId = "nessie.v1.getNamespaces")
public GetNamespacesResponse getNamespaces(@NotNull MultipleNamespacesParams params)
throws NessieReferenceNotFoundException {
return resource()
Expand All @@ -92,6 +97,7 @@ public GetNamespacesResponse getNamespaces(@NotNull MultipleNamespacesParams par

@Override
@JsonView(Views.V1.class)
@Operation(operationId = "nessie.v1.updateProperties")
public void updateProperties(NamespaceParams params, NamespaceUpdate namespaceUpdate)
throws NessieNamespaceNotFoundException, NessieReferenceNotFoundException {
resource()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import jakarta.enterprise.context.RequestScoped;
import jakarta.inject.Inject;
import jakarta.ws.rs.Path;
import org.eclipse.microprofile.openapi.annotations.Operation;
import org.projectnessie.api.v1.http.HttpTreeApi;
import org.projectnessie.api.v1.params.BaseMergeTransplant;
import org.projectnessie.api.v1.params.CommitLogParams;
Expand Down Expand Up @@ -75,6 +76,7 @@ private TreeService resource() {
}

@JsonView(Views.V1.class)
@Operation(operationId = "nessie.v1.getAllReferences")
@Override
public ReferencesResponse getAllReferences(ReferencesParams params) {
Integer maxRecords = params.maxRecords();
Expand Down Expand Up @@ -105,12 +107,14 @@ public void hasMore(String pagingToken) {
}

@JsonView(Views.V1.class)
@Operation(operationId = "nessie.v1.getDefaultBranch")
@Override
public Branch getDefaultBranch() throws NessieNotFoundException {
return resource().getDefaultBranch();
}

@JsonView(Views.V1.class)
@Operation(operationId = "nessie.v1.createReference")
@Override
public Reference createReference(String sourceRefName, Reference reference)
throws NessieNotFoundException, NessieConflictException {
Expand All @@ -120,12 +124,14 @@ public Reference createReference(String sourceRefName, Reference reference)
}

@JsonView(Views.V1.class)
@Operation(operationId = "nessie.v1.getReferenceByName")
@Override
public Reference getReferenceByName(GetReferenceParams params) throws NessieNotFoundException {
return resource().getReferenceByName(params.getRefName(), params.fetchOption());
}

@JsonView(Views.V1.class)
@Operation(operationId = "nessie.v1.getEntries")
@Override
public EntriesResponse getEntries(String refName, EntriesParams params)
throws NessieNotFoundException {
Expand Down Expand Up @@ -164,6 +170,7 @@ public void hasMore(String pagingToken) {
}

@JsonView(Views.V1.class)
@Operation(operationId = "nessie.v1.getCommitLog")
@Override
public LogResponse getCommitLog(String ref, CommitLogParams params)
throws NessieNotFoundException {
Expand Down Expand Up @@ -198,6 +205,7 @@ public void hasMore(String pagingToken) {
}

@JsonView(Views.V1.class)
@Operation(operationId = "nessie.v1.assignReference")
@Override
public void assignReference(
Reference.ReferenceType referenceType,
Expand All @@ -209,6 +217,7 @@ public void assignReference(
}

@JsonView(Views.V1.class)
@Operation(operationId = "nessie.v1.deleteReference")
@Override
public void deleteReference(
Reference.ReferenceType referenceType, String referenceName, String expectedHash)
Expand All @@ -217,6 +226,7 @@ public void deleteReference(
}

@JsonView(Views.V1.class)
@Operation(operationId = "nessie.v1.transplantCommitsIntoBranch")
@Override
public MergeResponse transplantCommitsIntoBranch(
String branchName, String expectedHash, String message, Transplant transplant)
Expand All @@ -237,6 +247,7 @@ public MergeResponse transplantCommitsIntoBranch(
}

@JsonView(Views.V1.class)
@Operation(operationId = "nessie.v1.mergeRefIntoBranch")
@Override
public MergeResponse mergeRefIntoBranch(String branchName, String expectedHash, Merge merge)
throws NessieNotFoundException, NessieConflictException {
Expand Down Expand Up @@ -267,6 +278,7 @@ private void validateKeepIndividual(
}

@JsonView(Views.V1.class)
@Operation(operationId = "nessie.v1.commitMultipleOperations")
@Override
public Branch commitMultipleOperations(
String branchName, String expectedHash, Operations operations)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
import org.eclipse.microprofile.openapi.annotations.Operation;
import org.projectnessie.api.v2.http.HttpConfigApi;
import org.projectnessie.error.NessieConflictException;
import org.projectnessie.model.ImmutableRepositoryConfigResponse;
Expand Down Expand Up @@ -59,6 +60,7 @@ public RestV2ConfigResource(

@Override
@JsonView(Views.V2.class)
@Operation(operationId = "nessie.v2.getConfig")
public NessieConfiguration getConfig() {
return config.getConfig();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import java.util.List;
import java.util.Locale;
import java.util.stream.Collectors;
import org.eclipse.microprofile.openapi.annotations.Operation;
import org.projectnessie.api.v2.http.HttpTreeApi;
import org.projectnessie.api.v2.params.CommitLogParams;
import org.projectnessie.api.v2.params.DiffParams;
Expand Down Expand Up @@ -125,6 +126,7 @@ private ContentService content() {
}

@JsonView(Views.V2.class)
@Operation(operationId = "nessie.v2.getAllReferences")
@Override
public ReferencesResponse getAllReferences(ReferencesParams params) {
Integer maxRecords = params.maxRecords();
Expand Down Expand Up @@ -155,6 +157,7 @@ public void hasMore(String pagingToken) {
}

@JsonView(Views.V2.class)
@Operation(operationId = "nessie.v2.createReference")
@Override
public SingleReferenceResponse createReference(String name, String type, Reference reference)
throws NessieNotFoundException, NessieConflictException {
Expand All @@ -174,6 +177,7 @@ public SingleReferenceResponse createReference(String name, String type, Referen
}

@JsonView(Views.V2.class)
@Operation(operationId = "nessie.v2.getReferenceByName")
@Override
public SingleReferenceResponse getReferenceByName(GetReferenceParams params)
throws NessieNotFoundException {
Expand All @@ -187,6 +191,7 @@ public SingleReferenceResponse getReferenceByName(GetReferenceParams params)
}

@JsonView(Views.V2.class)
@Operation(operationId = "nessie.v2.getReferenceHistory")
@Override
public ReferenceHistoryResponse getReferenceHistory(ReferenceHistoryParams params)
throws NessieNotFoundException {
Expand All @@ -198,6 +203,7 @@ public ReferenceHistoryResponse getReferenceHistory(ReferenceHistoryParams param
}

@JsonView(Views.V2.class)
@Operation(operationId = "nessie.v2.getEntries")
@Override
public EntriesResponse getEntries(String ref, EntriesParams params)
throws NessieNotFoundException {
Expand Down Expand Up @@ -237,6 +243,7 @@ public void hasMore(String pagingToken) {
}

@JsonView(Views.V2.class)
@Operation(operationId = "nessie.v2.getCommitLog")
@Override
public LogResponse getCommitLog(String ref, CommitLogParams params)
throws NessieNotFoundException {
Expand Down Expand Up @@ -272,6 +279,7 @@ public void hasMore(String pagingToken) {
}

@JsonView(Views.V2.class)
@Operation(operationId = "nessie.v2.getDiff")
@Override
public DiffResponse getDiff(DiffParams params) throws NessieNotFoundException {
Integer maxRecords = params.maxRecords();
Expand Down Expand Up @@ -312,6 +320,7 @@ public void hasMore(String pagingToken) {
}

@JsonView(Views.V2.class)
@Operation(operationId = "nessie.v2.assignReference")
@Override
public SingleReferenceResponse assignReference(String type, String ref, Reference assignTo)
throws NessieNotFoundException, NessieConflictException {
Expand All @@ -324,6 +333,7 @@ public SingleReferenceResponse assignReference(String type, String ref, Referenc
}

@JsonView(Views.V2.class)
@Operation(operationId = "nessie.v2.deleteReference")
@Override
public SingleReferenceResponse deleteReference(String type, String ref)
throws NessieConflictException, NessieNotFoundException {
Expand All @@ -342,6 +352,7 @@ private static Reference.ReferenceType parseReferenceType(String type) {
}

@JsonView(Views.V2.class)
@Operation(operationId = "nessie.v2.getContent")
@Override
public ContentResponse getContent(
ContentKey key, String ref, boolean withDocumentation, boolean forWrite)
Expand All @@ -353,6 +364,7 @@ public ContentResponse getContent(
}

@JsonView(Views.V2.class)
@Operation(operationId = "nessie.v2.getSeveralContents")
@Override
public GetMultipleContentsResponse getSeveralContents(
String ref, List<String> keys, boolean withDocumentation, boolean forWrite)
Expand All @@ -363,6 +375,7 @@ public GetMultipleContentsResponse getSeveralContents(
}

@JsonView(Views.V2.class)
@Operation(operationId = "nessie.v2.getMultipleContents")
@Override
public GetMultipleContentsResponse getMultipleContents(
String ref, GetMultipleContentsRequest request, boolean withDocumentation, boolean forWrite)
Expand All @@ -378,6 +391,7 @@ public GetMultipleContentsResponse getMultipleContents(
}

@JsonView(Views.V2.class)
@Operation(operationId = "nessie.v2.transplantCommitsIntoBranch")
@Override
public MergeResponse transplantCommitsIntoBranch(String branch, Transplant transplant)
throws NessieNotFoundException, NessieConflictException {
Expand All @@ -401,6 +415,7 @@ public MergeResponse transplantCommitsIntoBranch(String branch, Transplant trans
}

@JsonView(Views.V2.class)
@Operation(operationId = "nessie.v2.mergeRefIntoBranch")
@Override
public MergeResponse mergeRefIntoBranch(String branch, Merge merge)
throws NessieNotFoundException, NessieConflictException {
Expand Down Expand Up @@ -436,6 +451,7 @@ public MergeResponse mergeRefIntoBranch(String branch, Merge merge)
}

@JsonView(Views.V2.class)
@Operation(operationId = "nessie.v2.commitMultipleOperations")
@Override
public CommitResponse commitMultipleOperations(String branch, Operations operations)
throws NessieNotFoundException, NessieConflictException {
Expand Down

0 comments on commit 8da2755

Please sign in to comment.