|
| 1 | +/* |
| 2 | + * Copyright (c) 2024 Metaform Systems, Inc. |
| 3 | + * |
| 4 | + * This program and the accompanying materials are made available under the |
| 5 | + * terms of the Apache License, Version 2.0 which is available at |
| 6 | + * https://www.apache.org/licenses/LICENSE-2.0 |
| 7 | + * |
| 8 | + * SPDX-License-Identifier: Apache-2.0 |
| 9 | + * |
| 10 | + * Contributors: |
| 11 | + * Metaform Systems, Inc. - initial API and implementation |
| 12 | + * |
| 13 | + */ |
| 14 | + |
| 15 | +package org.eclipse.edc.virtualized.connector.controlplane.api.management.participantcontext.v4; |
| 16 | + |
| 17 | +import io.swagger.v3.oas.annotations.OpenAPIDefinition; |
| 18 | +import io.swagger.v3.oas.annotations.Operation; |
| 19 | +import io.swagger.v3.oas.annotations.Parameter; |
| 20 | +import io.swagger.v3.oas.annotations.info.Info; |
| 21 | +import io.swagger.v3.oas.annotations.media.ArraySchema; |
| 22 | +import io.swagger.v3.oas.annotations.media.Content; |
| 23 | +import io.swagger.v3.oas.annotations.media.Schema; |
| 24 | +import io.swagger.v3.oas.annotations.parameters.RequestBody; |
| 25 | +import io.swagger.v3.oas.annotations.responses.ApiResponse; |
| 26 | +import io.swagger.v3.oas.annotations.tags.Tag; |
| 27 | +import jakarta.json.JsonArray; |
| 28 | +import jakarta.json.JsonObject; |
| 29 | +import jakarta.ws.rs.core.SecurityContext; |
| 30 | +import org.eclipse.edc.api.management.schema.ManagementApiJsonSchema; |
| 31 | + |
| 32 | +@OpenAPIDefinition(info = @Info(title = "ParticipantContext Management API", version = "v4alpha")) |
| 33 | +@Tag(name = "Participant Context v4alpha") |
| 34 | +public interface ParticipantContextApiV4 { |
| 35 | + |
| 36 | + @Operation(description = "Creates a new ParticipantContext object.", |
| 37 | + requestBody = @RequestBody(content = @Content(schema = @Schema(ref = ManagementApiJsonSchema.V4.PARTICIPANT_CONTEXT), mediaType = "application/json")), |
| 38 | + responses = { |
| 39 | + @ApiResponse(responseCode = "201", description = "The ParticipantContext was created successfully, its API token is returned in the response body.", |
| 40 | + content = @Content(schema = @Schema(ref = ManagementApiJsonSchema.V4.ID_RESPONSE))), |
| 41 | + @ApiResponse(responseCode = "400", description = "Request body was malformed, or the request could not be processed", |
| 42 | + content = @Content(array = @ArraySchema(schema = @Schema(ref = ManagementApiJsonSchema.V4.API_ERROR)), mediaType = "application/json")), |
| 43 | + @ApiResponse(responseCode = "401", description = "The request could not be completed, because either the authentication was missing or was not valid.", |
| 44 | + content = @Content(array = @ArraySchema(schema = @Schema(ref = ManagementApiJsonSchema.V4.API_ERROR)), mediaType = "application/json")), |
| 45 | + @ApiResponse(responseCode = "409", description = "Can't create the ParticipantContext, because a object with the same ID already exists", |
| 46 | + content = @Content(array = @ArraySchema(schema = @Schema(ref = ManagementApiJsonSchema.V4.API_ERROR)), mediaType = "application/json")) |
| 47 | + } |
| 48 | + ) |
| 49 | + JsonObject createParticipantV4(JsonObject participantContext); |
| 50 | + |
| 51 | + @Operation(description = "Gets ParticipantContexts by ID.", |
| 52 | + responses = { |
| 53 | + @ApiResponse(responseCode = "200", description = "The list of ParticipantContexts.", |
| 54 | + content = @Content(schema = @Schema(ref = ManagementApiJsonSchema.V4.PARTICIPANT_CONTEXT))), |
| 55 | + @ApiResponse(responseCode = "400", description = "Request body was malformed, or the request could not be processed", |
| 56 | + content = @Content(array = @ArraySchema(schema = @Schema(ref = ManagementApiJsonSchema.V4.API_ERROR)), mediaType = "application/json")), |
| 57 | + @ApiResponse(responseCode = "401", description = "The request could not be completed, because either the authentication was missing or was not valid.", |
| 58 | + content = @Content(array = @ArraySchema(schema = @Schema(ref = ManagementApiJsonSchema.V4.API_ERROR)), mediaType = "application/json")), |
| 59 | + @ApiResponse(responseCode = "404", description = "A ParticipantContext with the given ID does not exist.", |
| 60 | + content = @Content(array = @ArraySchema(schema = @Schema(ref = ManagementApiJsonSchema.V4.API_ERROR)), mediaType = "application/json")) |
| 61 | + } |
| 62 | + ) |
| 63 | + JsonObject getParticipantV4(String participantContextId, SecurityContext securityContext); |
| 64 | + |
| 65 | + @Operation(description = "Updates a ParticipantContext object.", |
| 66 | + requestBody = @RequestBody(content = @Content(schema = @Schema(ref = ManagementApiJsonSchema.V4.PARTICIPANT_CONTEXT), mediaType = "application/json")), |
| 67 | + responses = { |
| 68 | + @ApiResponse(responseCode = "204", description = "The ParticipantContext was updated successfully."), |
| 69 | + @ApiResponse(responseCode = "400", description = "Request body was malformed, or the request could not be processed", |
| 70 | + content = @Content(array = @ArraySchema(schema = @Schema(ref = ManagementApiJsonSchema.V4.API_ERROR)), mediaType = "application/json")), |
| 71 | + @ApiResponse(responseCode = "401", description = "The request could not be completed, because either the authentication was missing or was not valid.", |
| 72 | + content = @Content(array = @ArraySchema(schema = @Schema(ref = ManagementApiJsonSchema.V4.API_ERROR)), mediaType = "application/json")), |
| 73 | + @ApiResponse(responseCode = "409", description = "Can't create the ParticipantContext, because a object with the same ID already exists", |
| 74 | + content = @Content(array = @ArraySchema(schema = @Schema(ref = ManagementApiJsonSchema.V4.API_ERROR)), mediaType = "application/json")) |
| 75 | + } |
| 76 | + ) |
| 77 | + void updateParticipantV4(String id, JsonObject manifest); |
| 78 | + |
| 79 | + @Operation(description = "Delete a ParticipantContext.", |
| 80 | + responses = { |
| 81 | + @ApiResponse(responseCode = "204", description = "The ParticipantContext was deleted successfully"), |
| 82 | + @ApiResponse(responseCode = "400", description = "Request body was malformed, or the request could not be processed", |
| 83 | + content = @Content(array = @ArraySchema(schema = @Schema(ref = ManagementApiJsonSchema.V4.API_ERROR)), mediaType = "application/json")), |
| 84 | + @ApiResponse(responseCode = "401", description = "The request could not be completed, because either the authentication was missing or was not valid.", |
| 85 | + content = @Content(array = @ArraySchema(schema = @Schema(ref = ManagementApiJsonSchema.V4.API_ERROR)), mediaType = "application/json")), |
| 86 | + @ApiResponse(responseCode = "404", description = "A ParticipantContext with the given ID does not exist.", |
| 87 | + content = @Content(array = @ArraySchema(schema = @Schema(ref = ManagementApiJsonSchema.V4.API_ERROR)), mediaType = "application/json")) |
| 88 | + } |
| 89 | + ) |
| 90 | + void deleteParticipantV4(String participantContextId); |
| 91 | + |
| 92 | + @Operation(description = "Get all DID documents across all Participant Contexts. Requires elevated access.", |
| 93 | + parameters = { |
| 94 | + @Parameter(name = "offset", description = "the paging offset. defaults to 0"), |
| 95 | + @Parameter(name = "limit", description = "the page size. defaults to 50")}, |
| 96 | + responses = { |
| 97 | + @ApiResponse(responseCode = "200", description = "The list of ParticipantContexts.", |
| 98 | + content = @Content(array = @ArraySchema(schema = @Schema(ref = ManagementApiJsonSchema.V4.PARTICIPANT_CONTEXT)))), |
| 99 | + @ApiResponse(responseCode = "401", description = "The request could not be completed, because either the authentication was missing or was not valid.", |
| 100 | + content = @Content(array = @ArraySchema(schema = @Schema(ref = ManagementApiJsonSchema.V4.API_ERROR)), mediaType = "application/json")), |
| 101 | + @ApiResponse(responseCode = "400", description = "The query was malformed or was not understood by the server.", |
| 102 | + content = @Content(array = @ArraySchema(schema = @Schema(ref = ManagementApiJsonSchema.V4.API_ERROR)), mediaType = "application/json")), |
| 103 | + } |
| 104 | + ) |
| 105 | + JsonArray getAllParticipantsV4(Integer offset, Integer limit); |
| 106 | +} |
0 commit comments