Refactor REST Constants (#2881)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
This commit is contained in:
@@ -86,6 +86,22 @@ import org.eclipse.hawkbit.mgmt.json.model.MgmtPollStatus;
|
||||
}""")
|
||||
public class MgmtTarget extends MgmtNamedEntity {
|
||||
|
||||
/**
|
||||
* The target URL mapping, href link for assigned target type.
|
||||
*/
|
||||
public static final String TARGET_TYPE = "targetType";
|
||||
/**
|
||||
* The target URL mapping, href link for autoConfirm state of a target.
|
||||
*/
|
||||
public static final String AUTO_CONFIRM = "autoConfirm";
|
||||
/**
|
||||
* The target URL mapping, href link for target actions.
|
||||
*/
|
||||
public static final String TARGET_V1_ACTIONS = "actions";
|
||||
/**
|
||||
* The target URL mapping, href link for canceled actions.
|
||||
*/
|
||||
public static final String TARGET_V1_ACTION_STATUS = "status";
|
||||
@JsonProperty(required = true)
|
||||
@Schema(description = "Controller ID", example = "123")
|
||||
private String controllerId;
|
||||
|
||||
@@ -48,6 +48,14 @@ import org.springframework.hateoas.RepresentationModel;
|
||||
}""")
|
||||
public class MgmtTargetAutoConfirm extends RepresentationModel<MgmtTargetAutoConfirm> {
|
||||
|
||||
/**
|
||||
* The target URL mapping, href link activate auto-confirm on a target.
|
||||
*/
|
||||
public static final String ACTIVATE = "activate";
|
||||
/**
|
||||
* The target URL mapping, href link deactivate auto-confirm on a target.
|
||||
*/
|
||||
public static final String DEACTIVATE = "deactivate";
|
||||
@NotNull
|
||||
@Schema(description = "Flag if auto confirm is active", example = "true")
|
||||
private boolean active;
|
||||
|
||||
@@ -10,9 +10,17 @@
|
||||
package org.eclipse.hawkbit.mgmt.rest.api;
|
||||
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.ACTION_ORDER;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_LIMIT;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_REPRESENTATION_MODE;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_REPRESENTATION_MODE_DEFAULT;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.DeleteResponses;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.GetIfExistResponses;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.GetResponses;
|
||||
import static org.springframework.hateoas.MediaTypes.HAL_JSON_VALUE;
|
||||
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -24,8 +32,6 @@ import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.eclipse.hawkbit.mgmt.json.model.PagedList;
|
||||
import org.eclipse.hawkbit.mgmt.json.model.action.MgmtAction;
|
||||
import org.eclipse.hawkbit.rest.OpenApi;
|
||||
import org.springframework.hateoas.MediaTypes;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@@ -37,11 +43,12 @@ import org.springframework.web.bind.annotation.RequestParam;
|
||||
* REST API providing (read-only) access to actions.
|
||||
*/
|
||||
// no request mapping specified here to avoid CVE-2021-22044 in Feign client
|
||||
@Tag(
|
||||
name = "Actions", description = "REST API providing (read-only) access to actions.",
|
||||
@Tag(name = "Actions", description = "REST API providing (read-only) access to actions.",
|
||||
extensions = @Extension(name = OpenApi.X_HAWKBIT, properties = @ExtensionProperty(name = "order", value = ACTION_ORDER)))
|
||||
public interface MgmtActionRestApi {
|
||||
|
||||
String ACTIONS_V1 = MgmtRestConstants.REST_V1 + "/actions";
|
||||
|
||||
/**
|
||||
* Handles the GET request of retrieving all actions.
|
||||
*
|
||||
@@ -56,33 +63,23 @@ public interface MgmtActionRestApi {
|
||||
*/
|
||||
@Operation(summary = "Return all actions", description = "Handles the GET request of retrieving all actions.")
|
||||
@GetIfExistResponses
|
||||
@GetMapping(value = MgmtRestConstants.ACTION_V1_REQUEST_MAPPING, produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = ACTIONS_V1, produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<PagedList<MgmtAction>> getActions(
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SEARCH, required = false)
|
||||
@Schema(description = """
|
||||
Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for
|
||||
available fields.""")
|
||||
@Schema(description = "Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for available fields.")
|
||||
String rsqlParam,
|
||||
@RequestParam(
|
||||
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET,
|
||||
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
||||
@RequestParam(value = REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
||||
@Schema(description = "The paging offset (default is 0)")
|
||||
int pagingOffsetParam,
|
||||
@RequestParam(
|
||||
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_LIMIT,
|
||||
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT)
|
||||
@RequestParam(value = REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT)
|
||||
@Schema(description = "The maximum number of entries in a page (default is 50)")
|
||||
int pagingLimitParam,
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SORTING, required = false)
|
||||
@Schema(description = """
|
||||
The query parameter sort allows to define the sort order for the result of a query. A sort criteria
|
||||
consists of the name of a field and the sort direction (ASC for ascending and DESC descending).
|
||||
The sequence of the sort criteria (multiple can be used) defines the sort order of the entities
|
||||
in the result.""")
|
||||
@Schema(description = "The query parameter sort allows to define the sort order for the result of a query. " +
|
||||
"A sort criteria consists of the name of a field and the sort direction (ASC for ascending and DESC descending)." +
|
||||
"The sequence of the sort criteria (multiple can be used) defines the sort order of the entities in the result.")
|
||||
String sortParam,
|
||||
@RequestParam(
|
||||
value = MgmtRestConstants.REQUEST_PARAMETER_REPRESENTATION_MODE,
|
||||
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_REPRESENTATION_MODE_DEFAULT)
|
||||
@RequestParam(value = REQUEST_PARAMETER_REPRESENTATION_MODE, defaultValue = REQUEST_PARAMETER_REPRESENTATION_MODE_DEFAULT)
|
||||
@Schema(description = """
|
||||
The representation mode. Can be "full" or "compact". Defaults to "compact"
|
||||
""")
|
||||
@@ -94,11 +91,9 @@ public interface MgmtActionRestApi {
|
||||
* @param actionId The ID of the requested action
|
||||
* @return the {@link MgmtAction}
|
||||
*/
|
||||
@Operation(summary = "Return action by id",
|
||||
description = "Handles the GET request of retrieving a single action by actionId.")
|
||||
@Operation(summary = "Return action by id", description = "Handles the GET request of retrieving a single action by actionId.")
|
||||
@GetResponses
|
||||
@GetMapping(value = MgmtRestConstants.ACTION_V1_REQUEST_MAPPING + "/{actionId}",
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = ACTIONS_V1 + "/{actionId}", produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<MgmtAction> getAction(@PathVariable("actionId") Long actionId);
|
||||
|
||||
/**
|
||||
@@ -109,7 +104,7 @@ public interface MgmtActionRestApi {
|
||||
*/
|
||||
@Operation(summary = "Delete a single action by id", description = "Handles the DELETE request for single action within Bosch IoT Rollouts. Required Permission: DELETE_REPOSITORY")
|
||||
@DeleteResponses
|
||||
@DeleteMapping(value = MgmtRestConstants.ACTION_V1_REQUEST_MAPPING + "/{actionId}")
|
||||
@DeleteMapping(value = ACTIONS_V1 + "/{actionId}")
|
||||
ResponseEntity<Void> deleteAction(@PathVariable("actionId") Long actionId);
|
||||
|
||||
/**
|
||||
@@ -121,12 +116,10 @@ public interface MgmtActionRestApi {
|
||||
*/
|
||||
@Operation(summary = "Delete multiple actions by list OR rsql filter", description = "Handles the DELETE request for multiple actions within Bosch IoT Rollouts. Either action id list OR rsql filter SHOULD be provided. Required Permission: DELETE_REPOSITORY")
|
||||
@DeleteResponses
|
||||
@DeleteMapping(value = MgmtRestConstants.ACTION_V1_REQUEST_MAPPING)
|
||||
@DeleteMapping(value = ACTIONS_V1)
|
||||
ResponseEntity<Void> deleteActions(
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SEARCH, required = false, defaultValue = "")
|
||||
@Schema(description = """
|
||||
Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for
|
||||
available fields.""")
|
||||
@Schema(description = "Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for available fields.")
|
||||
String rsqlParam,
|
||||
@Schema(description = "List of action ids to be deleted", requiredMode = Schema.RequiredMode.NOT_REQUIRED, example = "[253, 255]")
|
||||
@RequestBody(required = false)
|
||||
|
||||
@@ -11,33 +11,34 @@ package org.eclipse.hawkbit.mgmt.rest.api;
|
||||
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.BASIC_AUTH_ORDER;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.GetResponses;
|
||||
import static org.springframework.hateoas.MediaTypes.HAL_JSON_VALUE;
|
||||
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
|
||||
|
||||
import io.swagger.v3.oas.annotations.extensions.Extension;
|
||||
import io.swagger.v3.oas.annotations.extensions.ExtensionProperty;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.eclipse.hawkbit.mgmt.json.model.auth.MgmtUserInfo;
|
||||
import org.eclipse.hawkbit.rest.OpenApi;
|
||||
import org.springframework.hateoas.MediaTypes;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
|
||||
/**
|
||||
* Api for handling basic authentication user validation
|
||||
* REST API for handling basic authentication user validation
|
||||
*/
|
||||
@SuppressWarnings("squid:S1609")
|
||||
@Tag(
|
||||
name = "Basic Authentication", description = "API for basic authentication user validation.",
|
||||
@Tag(name = "Basic Authentication", description = "API for basic authentication user validation.",
|
||||
extensions = @Extension(name = OpenApi.X_HAWKBIT, properties = @ExtensionProperty(name = "order", value = BASIC_AUTH_ORDER)))
|
||||
// no request mapping specified here to avoid CVE-2021-22044 in Feign client
|
||||
public interface MgmtBasicAuthRestApi {
|
||||
|
||||
String USERINFO_V1 = MgmtRestConstants.REST_V1 + "/userinfo";
|
||||
|
||||
/**
|
||||
* Handles the GET request of basic auth.
|
||||
*
|
||||
* @return the userinfo with status OK.
|
||||
*/
|
||||
@GetResponses
|
||||
@GetMapping(value = MgmtRestConstants.AUTH_V1_REQUEST_MAPPING, produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = USERINFO_V1, produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<MgmtUserInfo> validateBasicAuth();
|
||||
}
|
||||
@@ -10,6 +10,10 @@
|
||||
package org.eclipse.hawkbit.mgmt.rest.api;
|
||||
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.DISTRIBUTION_SET_ORDER;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_LIMIT;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.DeleteResponses;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.GetIfExistResponses;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.GetResponses;
|
||||
@@ -19,6 +23,8 @@ import static org.eclipse.hawkbit.rest.ApiResponsesConstants.NOT_FOUND_404;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.PostCreateResponses;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.PutNoContentResponses;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.PutResponses;
|
||||
import static org.springframework.hateoas.MediaTypes.HAL_JSON_VALUE;
|
||||
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -49,8 +55,6 @@ import org.eclipse.hawkbit.mgmt.json.model.targetfilter.MgmtTargetFilterQuery;
|
||||
import org.eclipse.hawkbit.rest.ApiResponsesConstants.PostUpdateNoContentResponses;
|
||||
import org.eclipse.hawkbit.rest.ApiResponsesConstants.PostUpdateResponses;
|
||||
import org.eclipse.hawkbit.rest.OpenApi;
|
||||
import org.springframework.hateoas.MediaTypes;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@@ -61,14 +65,15 @@ import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
/**
|
||||
* REST Resource handling for DistributionSet CRUD operations.
|
||||
* REST API for DistributionSet CRUD operations.
|
||||
*/
|
||||
// no request mapping specified here to avoid CVE-2021-22044 in Feign client
|
||||
@Tag(
|
||||
name = "Distribution Sets", description = "REST Resource handling for DistributionSet CRUD operations.",
|
||||
@Tag(name = "Distribution Sets", description = "REST Resource handling for DistributionSet CRUD operations.",
|
||||
extensions = @Extension(name = OpenApi.X_HAWKBIT, properties = @ExtensionProperty(name = "order", value = DISTRIBUTION_SET_ORDER)))
|
||||
public interface MgmtDistributionSetRestApi {
|
||||
|
||||
String DISTRIBUTIONSETS_V1 = MgmtRestConstants.REST_V1 + "/distributionsets";
|
||||
|
||||
/**
|
||||
* Handles the GET request of retrieving all DistributionSets .
|
||||
*
|
||||
@@ -80,33 +85,24 @@ public interface MgmtDistributionSetRestApi {
|
||||
* @return a list of all set for a defined or default page request with status OK. The response is always paged. In any failure the
|
||||
* JsonResponseExceptionHandler is handling the response.
|
||||
*/
|
||||
@Operation(summary = "Return all Distribution Sets", description = "Handles the GET request of retrieving all " +
|
||||
"distribution sets. Required permission: READ_REPOSITORY")
|
||||
@Operation(summary = "Return all Distribution Sets",
|
||||
description = "Handles the GET request of retrieving all distribution sets. Required permission: READ_REPOSITORY")
|
||||
@GetIfExistResponses
|
||||
@GetMapping(value = MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING,
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = DISTRIBUTIONSETS_V1, produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<PagedList<MgmtDistributionSet>> getDistributionSets(
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SEARCH, required = false)
|
||||
@Schema(description = """
|
||||
Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for
|
||||
available fields.""")
|
||||
@Schema(description = "Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for available fields.")
|
||||
String rsqlParam,
|
||||
@RequestParam(
|
||||
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET,
|
||||
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
||||
@RequestParam(value = REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
||||
@Schema(description = "The paging offset (default is 0)")
|
||||
int pagingOffsetParam,
|
||||
@RequestParam(
|
||||
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_LIMIT,
|
||||
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT)
|
||||
@RequestParam(value = REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT)
|
||||
@Schema(description = "The maximum number of entries in a page (default is 50)")
|
||||
int pagingLimitParam,
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SORTING, required = false)
|
||||
@Schema(description = """
|
||||
The query parameter sort allows to define the sort order for the result of a query. A sort criteria
|
||||
consists of the name of a field and the sort direction (ASC for ascending and DESC descending).
|
||||
The sequence of the sort criteria (multiple can be used) defines the sort order of the entities
|
||||
in the result.""")
|
||||
@Schema(description = "The query parameter sort allows to define the sort order for the result of a query. " +
|
||||
"A sort criteria consists of the name of a field and the sort direction (ASC for ascending and DESC descending)." +
|
||||
"The sequence of the sort criteria (multiple can be used) defines the sort order of the entities in the result.")
|
||||
String sortParam);
|
||||
|
||||
/**
|
||||
@@ -115,11 +111,10 @@ public interface MgmtDistributionSetRestApi {
|
||||
* @param distributionSetId the ID of the set to retrieve
|
||||
* @return a single DistributionSet with status OK.
|
||||
*/
|
||||
@Operation(summary = "Return single Distribution Set", description = "Handles the GET request of retrieving a " +
|
||||
"single distribution set. Required permission: READ_REPOSITORY")
|
||||
@Operation(summary = "Return single Distribution Set",
|
||||
description = "Handles the GET request of retrieving a single distribution set. Required permission: READ_REPOSITORY")
|
||||
@GetResponses
|
||||
@GetMapping(value = MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/{distributionSetId}",
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = DISTRIBUTIONSETS_V1 + "/{distributionSetId}", produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<MgmtDistributionSet> getDistributionSet(@PathVariable("distributionSetId") Long distributionSetId);
|
||||
|
||||
/**
|
||||
@@ -133,9 +128,8 @@ public interface MgmtDistributionSetRestApi {
|
||||
"distribution sets within Hawkbit. The request body must always be a list of sets. " +
|
||||
"Required permission: CREATE_REPOSITORY")
|
||||
@PostCreateResponses
|
||||
@PostMapping(value = MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING,
|
||||
consumes = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE },
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@PostMapping(value = DISTRIBUTIONSETS_V1,
|
||||
consumes = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE }, produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<List<MgmtDistributionSet>> createDistributionSets(@RequestBody List<MgmtDistributionSetRequestBodyPost> sets);
|
||||
|
||||
/**
|
||||
@@ -144,10 +138,10 @@ public interface MgmtDistributionSetRestApi {
|
||||
* @param distributionSetId the ID of the DistributionSet to delete
|
||||
* @return status OK if delete as successful.
|
||||
*/
|
||||
@Operation(summary = "Delete Distribution Set by Id", description = "Handles the DELETE request for a single " +
|
||||
"Distribution Set. Required permission: DELETE_REPOSITORY")
|
||||
@Operation(summary = "Delete Distribution Set by Id",
|
||||
description = "Handles the DELETE request for a single Distribution Set. Required permission: DELETE_REPOSITORY")
|
||||
@DeleteResponses
|
||||
@DeleteMapping(value = MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/{distributionSetId}")
|
||||
@DeleteMapping(value = DISTRIBUTIONSETS_V1 + "/{distributionSetId}")
|
||||
ResponseEntity<Void> deleteDistributionSet(@PathVariable("distributionSetId") Long distributionSetId);
|
||||
|
||||
/**
|
||||
@@ -157,12 +151,11 @@ public interface MgmtDistributionSetRestApi {
|
||||
* @param toUpdate with the data that needs updating
|
||||
* @return status OK if update as successful with updated content.
|
||||
*/
|
||||
@Operation(summary = "Update Distribution Set", description = "Handles the UPDATE request for a single " +
|
||||
"Distribution Set. Required permission: UPDATE_REPOSITORY")
|
||||
@Operation(summary = "Update Distribution Set",
|
||||
description = "Handles the UPDATE request for a single Distribution Set. Required permission: UPDATE_REPOSITORY")
|
||||
@PutResponses
|
||||
@PutMapping(value = MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/{distributionSetId}",
|
||||
consumes = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE },
|
||||
produces = { MediaType.APPLICATION_JSON_VALUE, MediaTypes.HAL_JSON_VALUE })
|
||||
@PutMapping(value = DISTRIBUTIONSETS_V1 + "/{distributionSetId}",
|
||||
consumes = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE }, produces = { APPLICATION_JSON_VALUE, HAL_JSON_VALUE })
|
||||
ResponseEntity<MgmtDistributionSet> updateDistributionSet(
|
||||
@PathVariable("distributionSetId") Long distributionSetId,
|
||||
@RequestBody MgmtDistributionSetRequestBodyPut toUpdate);
|
||||
@@ -182,31 +175,23 @@ public interface MgmtDistributionSetRestApi {
|
||||
"request for retrieving assigned targets of a single distribution set. " +
|
||||
"Required permissions: READ_REPOSITORY and READ_TARGET")
|
||||
@GetResponses
|
||||
@GetMapping(value = MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/{distributionSetId}/assignedTargets",
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = DISTRIBUTIONSETS_V1 + "/{distributionSetId}/assignedTargets",
|
||||
produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<PagedList<MgmtTarget>> getAssignedTargets(
|
||||
@PathVariable("distributionSetId") Long distributionSetId,
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SEARCH, required = false)
|
||||
@Schema(description = """
|
||||
Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for
|
||||
available fields.""")
|
||||
@Schema(description = "Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for available fields.")
|
||||
String rsqlParam,
|
||||
@RequestParam(
|
||||
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET,
|
||||
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
||||
@RequestParam(value = REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
||||
@Schema(description = "The paging offset (default is 0)")
|
||||
int pagingOffsetParam,
|
||||
@RequestParam(
|
||||
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_LIMIT,
|
||||
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT)
|
||||
@RequestParam(value = REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT)
|
||||
@Schema(description = "The maximum number of entries in a page (default is 50)")
|
||||
int pagingLimitParam,
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SORTING, required = false)
|
||||
@Schema(description = """
|
||||
The query parameter sort allows to define the sort order for the result of a query. A sort criteria
|
||||
consists of the name of a field and the sort direction (ASC for ascending and DESC descending).
|
||||
The sequence of the sort criteria (multiple can be used) defines the sort order of the entities
|
||||
in the result.""")
|
||||
@Schema(description = "The query parameter sort allows to define the sort order for the result of a query. " +
|
||||
"A sort criteria consists of the name of a field and the sort direction (ASC for ascending and DESC descending)." +
|
||||
"The sequence of the sort criteria (multiple can be used) defines the sort order of the entities in the result.")
|
||||
String sortParam);
|
||||
|
||||
/**
|
||||
@@ -224,31 +209,23 @@ public interface MgmtDistributionSetRestApi {
|
||||
"request for retrieving installed targets of a single distribution set. " +
|
||||
"Required permissions: READ_REPOSITORY and READ_TARGET")
|
||||
@GetResponses
|
||||
@GetMapping(value = MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/{distributionSetId}/installedTargets",
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = DISTRIBUTIONSETS_V1 + "/{distributionSetId}/installedTargets",
|
||||
produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<PagedList<MgmtTarget>> getInstalledTargets(
|
||||
@PathVariable("distributionSetId") Long distributionSetId,
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SEARCH, required = false)
|
||||
@Schema(description = """
|
||||
Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for
|
||||
available fields.""")
|
||||
@Schema(description = "Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for available fields.")
|
||||
String rsqlParam,
|
||||
@RequestParam(
|
||||
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET,
|
||||
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
||||
@RequestParam(value = REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
||||
@Schema(description = "The paging offset (default is 0)")
|
||||
int pagingOffsetParam,
|
||||
@RequestParam(
|
||||
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_LIMIT,
|
||||
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT)
|
||||
@RequestParam(value = REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT)
|
||||
@Schema(description = "The maximum number of entries in a page (default is 50)")
|
||||
int pagingLimitParam,
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SORTING, required = false)
|
||||
@Schema(description = """
|
||||
The query parameter sort allows to define the sort order for the result of a query. A sort criteria
|
||||
consists of the name of a field and the sort direction (ASC for ascending and DESC descending).
|
||||
The sequence of the sort criteria (multiple can be used) defines the sort order of the entities
|
||||
in the result.""")
|
||||
@Schema(description = "The query parameter sort allows to define the sort order for the result of a query. " +
|
||||
"A sort criteria consists of the name of a field and the sort direction (ASC for ascending and DESC descending)." +
|
||||
"The sequence of the sort criteria (multiple can be used) defines the sort order of the entities in the result.")
|
||||
String sortParam);
|
||||
|
||||
/**
|
||||
@@ -266,31 +243,23 @@ public interface MgmtDistributionSetRestApi {
|
||||
description = "Handles the GET request for retrieving assigned target filter queries of a single " +
|
||||
"distribution set. Required permissions: READ_REPOSITORY and READ_TARGET")
|
||||
@GetResponses
|
||||
@GetMapping(value = MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/{distributionSetId}/autoAssignTargetFilters",
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = DISTRIBUTIONSETS_V1 + "/{distributionSetId}/autoAssignTargetFilters",
|
||||
produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<PagedList<MgmtTargetFilterQuery>> getAutoAssignTargetFilterQueries(
|
||||
@PathVariable("distributionSetId") Long distributionSetId,
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SEARCH, required = false)
|
||||
@Schema(description = """
|
||||
Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for
|
||||
available fields.""")
|
||||
@Schema(description = "Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for available fields.")
|
||||
String rsqlParam,
|
||||
@RequestParam(
|
||||
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET,
|
||||
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
||||
@RequestParam(value = REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
||||
@Schema(description = "The paging offset (default is 0)")
|
||||
int pagingOffsetParam,
|
||||
@RequestParam(
|
||||
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_LIMIT,
|
||||
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT)
|
||||
@RequestParam(value = REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT)
|
||||
@Schema(description = "The maximum number of entries in a page (default is 50)")
|
||||
int pagingLimitParam,
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SORTING, required = false)
|
||||
@Schema(description = """
|
||||
The query parameter sort allows to define the sort order for the result of a query. A sort criteria
|
||||
consists of the name of a field and the sort direction (ASC for ascending and DESC descending).
|
||||
The sequence of the sort criteria (multiple can be used) defines the sort order of the entities
|
||||
in the result.""")
|
||||
@Schema(description = "The query parameter sort allows to define the sort order for the result of a query. " +
|
||||
"A sort criteria consists of the name of a field and the sort direction (ASC for ascending and DESC descending)." +
|
||||
"The sequence of the sort criteria (multiple can be used) defines the sort order of the entities in the result.")
|
||||
String sortParam);
|
||||
|
||||
/**
|
||||
@@ -307,10 +276,8 @@ public interface MgmtDistributionSetRestApi {
|
||||
"target IDs. Non-existing targets are silently ignored resulting in a valid response. " +
|
||||
"Required permissions: READ_REPOSITORY and UPDATE_TARGET")
|
||||
@PostUpdateResponses
|
||||
@PostMapping(value = MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING
|
||||
+ "/{distributionSetId}/assignedTargets", consumes = { MediaTypes.HAL_JSON_VALUE,
|
||||
MediaType.APPLICATION_JSON_VALUE }, produces = { MediaTypes.HAL_JSON_VALUE,
|
||||
MediaType.APPLICATION_JSON_VALUE })
|
||||
@PostMapping(value = DISTRIBUTIONSETS_V1 + "/{distributionSetId}/assignedTargets",
|
||||
consumes = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE }, produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<MgmtTargetAssignmentResponseBody> createAssignedTarget(
|
||||
@PathVariable("distributionSetId") Long distributionSetId,
|
||||
@RequestBody List<MgmtTargetAssignmentRequestBody> assignments,
|
||||
@@ -329,8 +296,7 @@ public interface MgmtDistributionSetRestApi {
|
||||
@ApiResponse(responseCode = NOT_FOUND_404, description = "Distribution Set not found.",
|
||||
content = @Content(mediaType = "application/json", schema = @Schema(hidden = true)))
|
||||
})
|
||||
@PostMapping(value = MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/{distributionSetId}/metadata",
|
||||
consumes = { MediaType.APPLICATION_JSON_VALUE, MediaTypes.HAL_JSON_VALUE })
|
||||
@PostMapping(value = DISTRIBUTIONSETS_V1 + "/{distributionSetId}/metadata", consumes = { APPLICATION_JSON_VALUE, HAL_JSON_VALUE })
|
||||
ResponseEntity<Void> createMetadata(
|
||||
@PathVariable("distributionSetId") Long distributionSetId,
|
||||
@RequestBody List<MgmtMetadata> metadataRest);
|
||||
@@ -344,8 +310,7 @@ public interface MgmtDistributionSetRestApi {
|
||||
@Operation(summary = "Return meta data for Distribution Set", description = "Get a paged list of meta data for a " +
|
||||
"distribution set. Required permission: READ_REPOSITORY")
|
||||
@GetResponses
|
||||
@GetMapping(value = MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/{distributionSetId}/metadata",
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = DISTRIBUTIONSETS_V1 + "/{distributionSetId}/metadata", produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<PagedList<MgmtMetadata>> getMetadata(@PathVariable("distributionSetId") Long distributionSetId);
|
||||
|
||||
/**
|
||||
@@ -358,8 +323,7 @@ public interface MgmtDistributionSetRestApi {
|
||||
@Operation(summary = "Return single meta data value for a specific key of a Distribution Set",
|
||||
description = "Get a single meta data value for a meta data key. Required permission: READ_REPOSITORY")
|
||||
@GetResponses
|
||||
@GetMapping(value = MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/{distributionSetId}/metadata/{metadataKey}",
|
||||
produces = { MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = DISTRIBUTIONSETS_V1 + "/{distributionSetId}/metadata/{metadataKey}", produces = { APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<MgmtMetadata> getMetadataValue(
|
||||
@PathVariable("distributionSetId") Long distributionSetId,
|
||||
@PathVariable("metadataKey") String metadataKey);
|
||||
@@ -367,30 +331,30 @@ public interface MgmtDistributionSetRestApi {
|
||||
/**
|
||||
* Updates a single meta-data value of a distribution set.
|
||||
*
|
||||
* @param distributionSetId the ID of the distribution set to update the meta data entry
|
||||
* @param distributionSetId the ID of the distribution set to update the meta-data entry
|
||||
* @param metadataKey the key of the meta-data to update the value
|
||||
* @param metadata update body
|
||||
*/
|
||||
@Operation(summary = "Update single meta data value of a distribution set", description = "Update a single meta " +
|
||||
"data value for speficic key. Required permission: UPDATE_REPOSITORY")
|
||||
@Operation(summary = "Update single meta data value of a distribution set",
|
||||
description = "Update a single meta data value for speficic key. Required permission: UPDATE_REPOSITORY")
|
||||
@PutNoContentResponses
|
||||
@PutMapping(value = MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/{distributionSetId}/metadata/{metadataKey}",
|
||||
consumes = { MediaType.APPLICATION_JSON_VALUE, MediaTypes.HAL_JSON_VALUE })
|
||||
@PutMapping(value = DISTRIBUTIONSETS_V1 + "/{distributionSetId}/metadata/{metadataKey}",
|
||||
consumes = { APPLICATION_JSON_VALUE, HAL_JSON_VALUE })
|
||||
ResponseEntity<Void> updateMetadata(
|
||||
@PathVariable("distributionSetId") Long distributionSetId,
|
||||
@PathVariable("metadataKey") String metadataKey,
|
||||
@RequestBody MgmtMetadataBodyPut metadata);
|
||||
|
||||
/**
|
||||
* Deletes a single meta data entry from the distribution set.
|
||||
* Deletes a single meta-data entry from the distribution set.
|
||||
*
|
||||
* @param distributionSetId the ID of the distribution set to delete the meta data entry
|
||||
* @param metadataKey the key of the meta data to delete
|
||||
* @param distributionSetId the ID of the distribution set to delete the meta-data entry
|
||||
* @param metadataKey the key of the meta-data to delete
|
||||
*/
|
||||
@Operation(summary = "Delete a single meta data entry from the distribution set", description = "Delete a single " +
|
||||
"meta data. Required permission: UPDATE_REPOSITORY")
|
||||
@Operation(summary = "Delete a single meta data entry from the distribution set",
|
||||
description = "Delete a single meta data. Required permission: UPDATE_REPOSITORY")
|
||||
@DeleteResponses
|
||||
@DeleteMapping(value = MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/{distributionSetId}/metadata/{metadataKey}")
|
||||
@DeleteMapping(value = DISTRIBUTIONSETS_V1 + "/{distributionSetId}/metadata/{metadataKey}")
|
||||
ResponseEntity<Void> deleteMetadata(
|
||||
@PathVariable("distributionSetId") Long distributionSetId,
|
||||
@PathVariable("metadataKey") String metadataKey);
|
||||
@@ -408,11 +372,11 @@ public interface MgmtDistributionSetRestApi {
|
||||
""")
|
||||
@PostUpdateNoContentResponses
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(responseCode = LOCKED_423, description = "Software module is locked", content = @Content(mediaType = "application/json", schema = @Schema(hidden = true)))
|
||||
@ApiResponse(responseCode = LOCKED_423, description = "Software module is locked",
|
||||
content = @Content(mediaType = "application/json", schema = @Schema(hidden = true)))
|
||||
})
|
||||
@PostMapping(value = MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/{distributionSetId}/assignedSM",
|
||||
consumes = { MediaType.APPLICATION_JSON_VALUE, MediaTypes.HAL_JSON_VALUE },
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@PostMapping(value = DISTRIBUTIONSETS_V1 + "/{distributionSetId}/assignedSM",
|
||||
consumes = { APPLICATION_JSON_VALUE, HAL_JSON_VALUE }, produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<Void> assignSoftwareModules(
|
||||
@PathVariable("distributionSetId") Long distributionSetId,
|
||||
@RequestBody List<MgmtSoftwareModuleAssignment> softwareModuleIDs);
|
||||
@@ -428,9 +392,10 @@ public interface MgmtDistributionSetRestApi {
|
||||
description = "Delete an assignment. Required permission: UPDATE_REPOSITORY")
|
||||
@DeleteResponses
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(responseCode = LOCKED_423, description = "Distribution set is locked", content = @Content(mediaType = "application/json", schema = @Schema(hidden = true)))
|
||||
@ApiResponse(responseCode = LOCKED_423, description = "Distribution set is locked",
|
||||
content = @Content(mediaType = "application/json", schema = @Schema(hidden = true)))
|
||||
})
|
||||
@DeleteMapping(value = MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/{distributionSetId}/assignedSM/{softwareModuleId}")
|
||||
@DeleteMapping(value = DISTRIBUTIONSETS_V1 + "/{distributionSetId}/assignedSM/{softwareModuleId}")
|
||||
ResponseEntity<Void> deleteAssignSoftwareModules(
|
||||
@PathVariable("distributionSetId") Long distributionSetId,
|
||||
@PathVariable("softwareModuleId") Long softwareModuleId);
|
||||
@@ -447,29 +412,21 @@ public interface MgmtDistributionSetRestApi {
|
||||
* @return a list of the assigned software modules of a distribution set with status OK, if none is assigned than {@code null}
|
||||
*/
|
||||
@Operation(summary = "Return the assigned software modules of a specific distribution set",
|
||||
description = "Handles the GET request of retrieving a single distribution set. " +
|
||||
"Required permission: READ_REPOSITORY")
|
||||
description = "Handles the GET request of retrieving a single distribution set. Required permission: READ_REPOSITORY")
|
||||
@GetResponses
|
||||
@GetMapping(value = MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/{distributionSetId}/assignedSM",
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = DISTRIBUTIONSETS_V1 + "/{distributionSetId}/assignedSM", produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<PagedList<MgmtSoftwareModule>> getAssignedSoftwareModules(
|
||||
@PathVariable("distributionSetId") Long distributionSetId,
|
||||
@RequestParam(
|
||||
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET,
|
||||
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
||||
@RequestParam(value = REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
||||
@Schema(description = "The paging offset (default is 0)")
|
||||
int pagingOffsetParam,
|
||||
@RequestParam(
|
||||
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_LIMIT,
|
||||
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT)
|
||||
@RequestParam(value = REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT)
|
||||
@Schema(description = "The maximum number of entries in a page (default is 50)")
|
||||
int pagingLimitParam,
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SORTING, required = false)
|
||||
@Schema(description = """
|
||||
The query parameter sort allows to define the sort order for the result of a query. A sort criteria
|
||||
consists of the name of a field and the sort direction (ASC for ascending and DESC descending).
|
||||
The sequence of the sort criteria (multiple can be used) defines the sort order of the entities
|
||||
in the result.""")
|
||||
@Schema(description = "The query parameter sort allows to define the sort order for the result of a query. " +
|
||||
"A sort criteria consists of the name of a field and the sort direction (ASC for ascending and DESC descending)." +
|
||||
"The sequence of the sort criteria (multiple can be used) defines the sort order of the entities in the result.")
|
||||
String sortParam);
|
||||
|
||||
/**
|
||||
@@ -478,26 +435,25 @@ public interface MgmtDistributionSetRestApi {
|
||||
* @param distributionSetId the ID of the set to retrieve
|
||||
* @return a DistributionSetStatistics with status OK.
|
||||
*/
|
||||
@Operation(summary = "Return Rollouts count by status for Distribution Set", description = "Handles the GET " +
|
||||
"request of retrieving Rollouts count by Status for Distribution Set")
|
||||
@Operation(summary = "Return Rollouts count by status for Distribution Set",
|
||||
description = "Handles the GET request of retrieving Rollouts count by Status for Distribution Set")
|
||||
@GetResponses
|
||||
@GetMapping(value = MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/{distributionSetId}/statistics/rollouts",
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = DISTRIBUTIONSETS_V1 + "/{distributionSetId}/statistics/rollouts",
|
||||
produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<MgmtDistributionSetStatistics> getRolloutsCountByStatusForDistributionSet(
|
||||
@PathVariable("distributionSetId") Long distributionSetId);
|
||||
|
||||
/**
|
||||
* Handles the GET request of retrieving Actions count by Status
|
||||
* for Distribution Set.
|
||||
* Handles the GET request of retrieving Actions count by Status for Distribution Set.
|
||||
*
|
||||
* @param distributionSetId the ID of the set to retrieve
|
||||
* @return a DistributionSetStatistics with status OK.
|
||||
*/
|
||||
@Operation(summary = "Return Actions count by status for Distribution Set", description = "Handles the GET " +
|
||||
"request of retrieving Actions count by Status for Distribution Set")
|
||||
@Operation(summary = "Return Actions count by status for Distribution Set",
|
||||
description = "Handles the GET request of retrieving Actions count by Status for Distribution Set")
|
||||
@GetResponses
|
||||
@GetMapping(value = MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/{distributionSetId}/statistics/actions",
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = DISTRIBUTIONSETS_V1 + "/{distributionSetId}/statistics/actions",
|
||||
produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<MgmtDistributionSetStatistics> getActionsCountByStatusForDistributionSet(
|
||||
@PathVariable("distributionSetId") Long distributionSetId);
|
||||
|
||||
@@ -507,11 +463,11 @@ public interface MgmtDistributionSetRestApi {
|
||||
* @param distributionSetId the ID of the set to retrieve
|
||||
* @return a DistributionSetStatistics with status OK.
|
||||
*/
|
||||
@Operation(summary = "Return Auto Assignments count for Distribution Set", description = "Handles the GET " +
|
||||
"request of retrieving Auto Assignments count for Distribution Set")
|
||||
@Operation(summary = "Return Auto Assignments count for Distribution Set",
|
||||
description = "Handles the GET request of retrieving Auto Assignments count for Distribution Set")
|
||||
@GetResponses
|
||||
@GetMapping(value = MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/{distributionSetId}/statistics/autoassignments",
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = DISTRIBUTIONSETS_V1 + "/{distributionSetId}/statistics/autoassignments",
|
||||
produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<MgmtDistributionSetStatistics> getAutoAssignmentsCountForDistributionSet(
|
||||
@PathVariable("distributionSetId") Long distributionSetId);
|
||||
|
||||
@@ -522,11 +478,9 @@ public interface MgmtDistributionSetRestApi {
|
||||
* @return a DistributionSetStatistics with status OK.
|
||||
*/
|
||||
@Operation(summary = "Return Rollouts, Actions and Auto Assignments counts by Status for Distribution Set",
|
||||
description = "Handles the GET request of retrieving Rollouts, Actions and Auto Assignments counts by " +
|
||||
"Status for Distribution Set")
|
||||
description = "Handles the GET request of retrieving Rollouts, Actions and Auto Assignments counts by Status for Distribution Set")
|
||||
@GetResponses
|
||||
@GetMapping(value = MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/{distributionSetId}/statistics",
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = DISTRIBUTIONSETS_V1 + "/{distributionSetId}/statistics", produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<MgmtDistributionSetStatistics> getStatisticsForDistributionSet(@PathVariable("distributionSetId") Long distributionSetId);
|
||||
|
||||
/**
|
||||
@@ -544,13 +498,14 @@ public interface MgmtDistributionSetRestApi {
|
||||
""")
|
||||
@PostUpdateNoContentResponses
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(responseCode = METHOD_NOT_ALLOWED_405, description = "Software module is locked", content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))),
|
||||
@ApiResponse(responseCode = LOCKED_423, description = "Distribution set is locked", content = @Content(mediaType = "application/json", schema = @Schema(hidden = true)))
|
||||
@ApiResponse(responseCode = METHOD_NOT_ALLOWED_405, description = "Software module is locked",
|
||||
content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))),
|
||||
@ApiResponse(responseCode = LOCKED_423, description = "Distribution set is locked",
|
||||
content = @Content(mediaType = "application/json", schema = @Schema(hidden = true)))
|
||||
})
|
||||
@PostMapping(value = MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/{distributionSetId}/invalidate",
|
||||
consumes = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE },
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@PostMapping(value = DISTRIBUTIONSETS_V1 + "/{distributionSetId}/invalidate",
|
||||
consumes = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE }, produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<Void> invalidateDistributionSet(
|
||||
@PathVariable("distributionSetId") Long distributionSetId,
|
||||
@Valid @RequestBody MgmtInvalidateDistributionSetRequestBody invalidateRequestBody);
|
||||
}
|
||||
}
|
||||
@@ -10,12 +10,18 @@
|
||||
package org.eclipse.hawkbit.mgmt.rest.api;
|
||||
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.DISTRIBUTION_SET_TAG_ORDER;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_LIMIT;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.DeleteResponses;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.GetIfExistResponses;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.GetResponses;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.PostCreateNoContentResponses;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.PostCreateResponses;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.PutResponses;
|
||||
import static org.springframework.hateoas.MediaTypes.HAL_JSON_VALUE;
|
||||
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -30,8 +36,6 @@ import org.eclipse.hawkbit.mgmt.json.model.tag.MgmtTag;
|
||||
import org.eclipse.hawkbit.mgmt.json.model.tag.MgmtTagRequestBodyPut;
|
||||
import org.eclipse.hawkbit.rest.ApiResponsesConstants.PostUpdateNoContentResponses;
|
||||
import org.eclipse.hawkbit.rest.OpenApi;
|
||||
import org.springframework.hateoas.MediaTypes;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@@ -42,14 +46,16 @@ import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
/**
|
||||
* REST Resource handling for DistributionSetTag CRUD operations.
|
||||
* REST API for DistributionSetTag CRUD operations.
|
||||
*/
|
||||
// no request mapping specified here to avoid CVE-2021-22044 in Feign client
|
||||
@Tag(
|
||||
name = "Distribution Set Tags", description = "REST Resource handling for DistributionSetTag CRUD operations.",
|
||||
@Tag(name = "Distribution Set Tags", description = "REST Resource handling for DistributionSetTag CRUD operations.",
|
||||
extensions = @Extension(name = OpenApi.X_HAWKBIT, properties = @ExtensionProperty(name = "order", value = DISTRIBUTION_SET_TAG_ORDER)))
|
||||
public interface MgmtDistributionSetTagRestApi {
|
||||
|
||||
String DISTRIBUTIONSETTAGS_V1 = MgmtRestConstants.REST_V1 + "/distributionsettags";
|
||||
String DISTRIBUTIONSET_TAG_ID_ASSIGNED = "/{distributionsetTagId}/assigned";
|
||||
|
||||
/**
|
||||
* Handles the GET request of retrieving all DistributionSet tags.
|
||||
*
|
||||
@@ -61,33 +67,24 @@ public interface MgmtDistributionSetTagRestApi {
|
||||
* @return a list of all target tags for a defined or default page request with status OK. The response is always paged. In any failure the
|
||||
* JsonResponseExceptionHandler is handling the response.
|
||||
*/
|
||||
@Operation(summary = "Return all Distribution Set Tags", description = "Handles the GET request of retrieving " +
|
||||
"all distribution set tags.")
|
||||
@Operation(summary = "Return all Distribution Set Tags",
|
||||
description = "Handles the GET request of retrieving all distribution set tags.")
|
||||
@GetIfExistResponses
|
||||
@GetMapping(value = MgmtRestConstants.DISTRIBUTIONSET_TAG_V1_REQUEST_MAPPING,
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = DISTRIBUTIONSETTAGS_V1, produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<PagedList<MgmtTag>> getDistributionSetTags(
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SEARCH, required = false)
|
||||
@Schema(description = """
|
||||
Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for
|
||||
available fields.""")
|
||||
@Schema(description = "Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for available fields.")
|
||||
String rsqlParam,
|
||||
@RequestParam(
|
||||
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET,
|
||||
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
||||
@RequestParam(value = REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
||||
@Schema(description = "The paging offset (default is 0)")
|
||||
int pagingOffsetParam,
|
||||
@RequestParam(
|
||||
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_LIMIT,
|
||||
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT)
|
||||
@RequestParam(value = REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT)
|
||||
@Schema(description = "The maximum number of entries in a page (default is 50)")
|
||||
int pagingLimitParam,
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SORTING, required = false)
|
||||
@Schema(description = """
|
||||
The query parameter sort allows to define the sort order for the result of a query. A sort criteria
|
||||
consists of the name of a field and the sort direction (ASC for ascending and DESC descending).
|
||||
The sequence of the sort criteria (multiple can be used) defines the sort order of the entities
|
||||
in the result.""")
|
||||
@Schema(description = "The query parameter sort allows to define the sort order for the result of a query. " +
|
||||
"A sort criteria consists of the name of a field and the sort direction (ASC for ascending and DESC descending)." +
|
||||
"The sequence of the sort criteria (multiple can be used) defines the sort order of the entities in the result.")
|
||||
String sortParam);
|
||||
|
||||
/**
|
||||
@@ -99,8 +96,7 @@ public interface MgmtDistributionSetTagRestApi {
|
||||
@Operation(summary = "Return single Distribution Set Tag",
|
||||
description = "Handles the GET request of retrieving a single distribution set tag.")
|
||||
@GetResponses
|
||||
@GetMapping(value = MgmtRestConstants.DISTRIBUTIONSET_TAG_V1_REQUEST_MAPPING + "/{distributionsetTagId}",
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = DISTRIBUTIONSETTAGS_V1 + "/{distributionsetTagId}", produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<MgmtTag> getDistributionSetTag(@PathVariable("distributionsetTagId") Long distributionsetTagId);
|
||||
|
||||
/**
|
||||
@@ -113,9 +109,8 @@ public interface MgmtDistributionSetTagRestApi {
|
||||
@Operation(summary = "Creates new Distribution Set Tags", description = "Handles the POST request of creating " +
|
||||
"new distribution set tag. The request body must always be a list of distribution set tags.")
|
||||
@PostCreateResponses
|
||||
@PostMapping(value = MgmtRestConstants.DISTRIBUTIONSET_TAG_V1_REQUEST_MAPPING,
|
||||
consumes = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE },
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@PostMapping(value = DISTRIBUTIONSETTAGS_V1,
|
||||
consumes = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE }, produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<List<MgmtTag>> createDistributionSetTags(@RequestBody List<MgmtTagRequestBodyPut> tags);
|
||||
|
||||
/**
|
||||
@@ -128,9 +123,8 @@ public interface MgmtDistributionSetTagRestApi {
|
||||
@Operation(summary = "Update Distribution Set Tag",
|
||||
description = "Handles the PUT request of updating a distribution set tag.")
|
||||
@PutResponses
|
||||
@PutMapping(value = MgmtRestConstants.DISTRIBUTIONSET_TAG_V1_REQUEST_MAPPING + "/{distributionsetTagId}",
|
||||
consumes = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE },
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@PutMapping(value = DISTRIBUTIONSETTAGS_V1 + "/{distributionsetTagId}",
|
||||
consumes = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE }, produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<MgmtTag> updateDistributionSetTag(
|
||||
@PathVariable("distributionsetTagId") Long distributionsetTagId,
|
||||
@RequestBody MgmtTagRequestBodyPut restDSTagRest);
|
||||
@@ -144,7 +138,7 @@ public interface MgmtDistributionSetTagRestApi {
|
||||
@Operation(summary = "Delete a single distribution set tag",
|
||||
description = "Handles the DELETE request of deleting a single distribution set tag.")
|
||||
@DeleteResponses
|
||||
@DeleteMapping(value = MgmtRestConstants.DISTRIBUTIONSET_TAG_V1_REQUEST_MAPPING + "/{distributionsetTagId}")
|
||||
@DeleteMapping(value = DISTRIBUTIONSETTAGS_V1 + "/{distributionsetTagId}")
|
||||
ResponseEntity<Void> deleteDistributionSetTag(@PathVariable("distributionsetTagId") Long distributionsetTagId);
|
||||
|
||||
/**
|
||||
@@ -161,31 +155,22 @@ public interface MgmtDistributionSetTagRestApi {
|
||||
@Operation(summary = "Return all assigned distribution sets by given tag Id",
|
||||
description = "Handles the GET request of retrieving a list of assigned distributions.")
|
||||
@GetResponses
|
||||
@GetMapping(value = MgmtRestConstants.DISTRIBUTIONSET_TAG_V1_REQUEST_MAPPING + MgmtRestConstants.DISTRIBUTIONSET_TAG_ID_ASSIGNED,
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = DISTRIBUTIONSETTAGS_V1 + DISTRIBUTIONSET_TAG_ID_ASSIGNED, produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<PagedList<MgmtDistributionSet>> getAssignedDistributionSets(
|
||||
@PathVariable("distributionsetTagId") Long distributionsetTagId,
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SEARCH, required = false)
|
||||
@Schema(description = """
|
||||
Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for
|
||||
available fields.""")
|
||||
@Schema(description = "Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for available fields.")
|
||||
String rsqlParam,
|
||||
@RequestParam(
|
||||
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET,
|
||||
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
||||
@RequestParam(value = REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
||||
@Schema(description = "The paging offset (default is 0)")
|
||||
int pagingOffsetParam,
|
||||
@RequestParam(
|
||||
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_LIMIT,
|
||||
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT)
|
||||
@RequestParam(value = REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT)
|
||||
@Schema(description = "The maximum number of entries in a page (default is 50)")
|
||||
int pagingLimitParam,
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SORTING, required = false)
|
||||
@Schema(description = """
|
||||
The query parameter sort allows to define the sort order for the result of a query. A sort criteria
|
||||
consists of the name of a field and the sort direction (ASC for ascending and DESC descending).
|
||||
The sequence of the sort criteria (multiple can be used) defines the sort order of the entities
|
||||
in the result.""")
|
||||
@Schema(description = "The query parameter sort allows to define the sort order for the result of a query. " +
|
||||
"A sort criteria consists of the name of a field and the sort direction (ASC for ascending and DESC descending)." +
|
||||
"The sequence of the sort criteria (multiple can be used) defines the sort order of the entities in the result.")
|
||||
String sortParam);
|
||||
|
||||
/**
|
||||
@@ -198,7 +183,7 @@ public interface MgmtDistributionSetTagRestApi {
|
||||
@Operation(summary = "Assign distribution set to the given tag id",
|
||||
description = "Handles the POST request of distribution assignment. Already assigned distribution will be ignored.")
|
||||
@PostCreateNoContentResponses
|
||||
@PostMapping(value = MgmtRestConstants.DISTRIBUTIONSET_TAG_V1_REQUEST_MAPPING + MgmtRestConstants.DISTRIBUTIONSET_TAG_ID_ASSIGNED + "/{distributionsetId}")
|
||||
@PostMapping(value = DISTRIBUTIONSETTAGS_V1 + DISTRIBUTIONSET_TAG_ID_ASSIGNED + "/{distributionsetId}")
|
||||
ResponseEntity<Void> assignDistributionSet(
|
||||
@PathVariable("distributionsetTagId") Long distributionsetTagId,
|
||||
@PathVariable("distributionsetId") Long distributionsetId);
|
||||
@@ -213,9 +198,8 @@ public interface MgmtDistributionSetTagRestApi {
|
||||
@Operation(summary = "Assign distribution sets to the given tag id",
|
||||
description = "Handles the POST request of distribution assignment. Already assigned distribution will be ignored.")
|
||||
@PostUpdateNoContentResponses
|
||||
@PostMapping(value = MgmtRestConstants.DISTRIBUTIONSET_TAG_V1_REQUEST_MAPPING + MgmtRestConstants.DISTRIBUTIONSET_TAG_ID_ASSIGNED,
|
||||
consumes = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE },
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@PostMapping(value = DISTRIBUTIONSETTAGS_V1 + DISTRIBUTIONSET_TAG_ID_ASSIGNED,
|
||||
consumes = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE }, produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<Void> assignDistributionSets(
|
||||
@PathVariable("distributionsetTagId") Long distributionsetTagId,
|
||||
@RequestBody List<Long> distributionsetIds);
|
||||
@@ -230,8 +214,7 @@ public interface MgmtDistributionSetTagRestApi {
|
||||
@Operation(summary = "Unassign one distribution set from the given tag id",
|
||||
description = "Handles the DELETE request of unassign the given distribution.")
|
||||
@DeleteResponses
|
||||
@DeleteMapping(value = MgmtRestConstants.DISTRIBUTIONSET_TAG_V1_REQUEST_MAPPING +
|
||||
MgmtRestConstants.DISTRIBUTIONSET_TAG_ID_ASSIGNED + "/{distributionsetId}")
|
||||
@DeleteMapping(value = DISTRIBUTIONSETTAGS_V1 + DISTRIBUTIONSET_TAG_ID_ASSIGNED + "/{distributionsetId}")
|
||||
ResponseEntity<Void> unassignDistributionSet(
|
||||
@PathVariable("distributionsetTagId") Long distributionsetTagId,
|
||||
@PathVariable("distributionsetId") Long distributionsetId);
|
||||
@@ -246,8 +229,7 @@ public interface MgmtDistributionSetTagRestApi {
|
||||
@Operation(summary = "Unassign multiple distribution sets from the given tag id",
|
||||
description = "Handles the DELETE request of unassign the given distribution.")
|
||||
@DeleteResponses
|
||||
@DeleteMapping(value = MgmtRestConstants.DISTRIBUTIONSET_TAG_V1_REQUEST_MAPPING +
|
||||
MgmtRestConstants.DISTRIBUTIONSET_TAG_ID_ASSIGNED)
|
||||
@DeleteMapping(value = DISTRIBUTIONSETTAGS_V1 + DISTRIBUTIONSET_TAG_ID_ASSIGNED)
|
||||
ResponseEntity<Void> unassignDistributionSets(
|
||||
@PathVariable("distributionsetTagId") Long distributionsetTagId,
|
||||
@RequestBody List<Long> distributionsetIds);
|
||||
|
||||
@@ -10,6 +10,10 @@
|
||||
package org.eclipse.hawkbit.mgmt.rest.api;
|
||||
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.DISTRIBUTION_SET_TYPE_ORDER;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_LIMIT;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.DeleteResponses;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.GetIfExistResponses;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.GetResponses;
|
||||
@@ -17,6 +21,8 @@ import static org.eclipse.hawkbit.rest.ApiResponsesConstants.NOT_FOUND_404;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.PostCreateNoContentResponses;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.PostCreateResponses;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.PutResponses;
|
||||
import static org.springframework.hateoas.MediaTypes.HAL_JSON_VALUE;
|
||||
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -35,8 +41,6 @@ import org.eclipse.hawkbit.mgmt.json.model.distributionsettype.MgmtDistributionS
|
||||
import org.eclipse.hawkbit.mgmt.json.model.distributionsettype.MgmtDistributionSetTypeRequestBodyPut;
|
||||
import org.eclipse.hawkbit.mgmt.json.model.softwaremoduletype.MgmtSoftwareModuleType;
|
||||
import org.eclipse.hawkbit.rest.OpenApi;
|
||||
import org.springframework.hateoas.MediaTypes;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@@ -47,14 +51,17 @@ import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
/**
|
||||
* REST Resource handling for DistributionSetType CRUD operations.
|
||||
* REST API for DistributionSetType CRUD operations.
|
||||
*/
|
||||
// no request mapping specified here to avoid CVE-2021-22044 in Feign client
|
||||
@Tag(
|
||||
name = "Distribution Set Types", description = "REST Resource handling for DistributionSetType CRUD operations.",
|
||||
@Tag(name = "Distribution Set Types", description = "REST Resource handling for DistributionSetType CRUD operations.",
|
||||
extensions = @Extension(name = OpenApi.X_HAWKBIT, properties = @ExtensionProperty(name = "order", value = DISTRIBUTION_SET_TYPE_ORDER)))
|
||||
public interface MgmtDistributionSetTypeRestApi {
|
||||
|
||||
String DISTRIBUTIONSETTYPES_V1 = MgmtRestConstants.REST_V1 + "/distributionsettypes";
|
||||
String MANDATORYMODULETYPES = "mandatorymoduletypes";
|
||||
String OPTIONALMODULETYPES = "optionalmoduletypes";
|
||||
|
||||
/**
|
||||
* Handles the GET request of retrieving all DistributionSetTypes.
|
||||
*
|
||||
@@ -69,30 +76,21 @@ public interface MgmtDistributionSetTypeRestApi {
|
||||
@Operation(summary = "Return all Distribution Set Types", description = "Handles the GET request of " +
|
||||
"retrieving all distribution set types. Required Permission: READ_REPOSITORY")
|
||||
@GetIfExistResponses
|
||||
@GetMapping(value = MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_REQUEST_MAPPING,
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = DISTRIBUTIONSETTYPES_V1, produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<PagedList<MgmtDistributionSetType>> getDistributionSetTypes(
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SEARCH, required = false)
|
||||
@Schema(description = """
|
||||
Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for
|
||||
available fields.""")
|
||||
@Schema(description = "Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for available fields.")
|
||||
String rsqlParam,
|
||||
@RequestParam(
|
||||
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET,
|
||||
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
||||
@RequestParam(value = REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
||||
@Schema(description = "The paging offset (default is 0)")
|
||||
int pagingOffsetParam,
|
||||
@RequestParam(
|
||||
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_LIMIT,
|
||||
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT)
|
||||
@RequestParam(value = REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT)
|
||||
@Schema(description = "The maximum number of entries in a page (default is 50)")
|
||||
int pagingLimitParam,
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SORTING, required = false)
|
||||
@Schema(description = """
|
||||
The query parameter sort allows to define the sort order for the result of a query. A sort criteria
|
||||
consists of the name of a field and the sort direction (ASC for ascending and DESC descending).
|
||||
The sequence of the sort criteria (multiple can be used) defines the sort order of the entities
|
||||
in the result.""")
|
||||
@Schema(description = "The query parameter sort allows to define the sort order for the result of a query. " +
|
||||
"A sort criteria consists of the name of a field and the sort direction (ASC for ascending and DESC descending)." +
|
||||
"The sequence of the sort criteria (multiple can be used) defines the sort order of the entities in the result.")
|
||||
String sortParam);
|
||||
|
||||
/**
|
||||
@@ -104,8 +102,7 @@ public interface MgmtDistributionSetTypeRestApi {
|
||||
@Operation(summary = "Return single Distribution Set Type", description = "Handles the GET request of retrieving a " +
|
||||
"single distribution set type. Required Permission: READ_REPOSITORY")
|
||||
@GetResponses
|
||||
@GetMapping(value = MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_REQUEST_MAPPING + "/{distributionSetTypeId}",
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = DISTRIBUTIONSETTYPES_V1 + "/{distributionSetTypeId}", produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<MgmtDistributionSetType> getDistributionSetType(
|
||||
@PathVariable("distributionSetTypeId") Long distributionSetTypeId);
|
||||
|
||||
@@ -115,10 +112,10 @@ public interface MgmtDistributionSetTypeRestApi {
|
||||
* @param distributionSetTypeId the ID of the module to retrieve
|
||||
* @return status OK if delete is successful.
|
||||
*/
|
||||
@Operation(summary = "Delete Distribution Set Type by Id", description = "Handles the DELETE request for a single" +
|
||||
" distribution set type. Required Permission: DELETE_REPOSITORY")
|
||||
@Operation(summary = "Delete Distribution Set Type by Id",
|
||||
description = "Handles the DELETE request for a single distribution set type. Required Permission: DELETE_REPOSITORY")
|
||||
@DeleteResponses
|
||||
@DeleteMapping(value = MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_REQUEST_MAPPING + "/{distributionSetTypeId}")
|
||||
@DeleteMapping(value = DISTRIBUTIONSETTYPES_V1 + "/{distributionSetTypeId}")
|
||||
ResponseEntity<Void> deleteDistributionSetType(@PathVariable("distributionSetTypeId") Long distributionSetTypeId);
|
||||
|
||||
/**
|
||||
@@ -128,12 +125,11 @@ public interface MgmtDistributionSetTypeRestApi {
|
||||
* @param restDistributionSetType the DS type to be updated.
|
||||
* @return status OK if update is successful
|
||||
*/
|
||||
@Operation(summary = "Update Distribution Set Type", description = "Handles the PUT request for a single " +
|
||||
"distribution set type. Required Permission: UPDATE_REPOSITORY")
|
||||
@Operation(summary = "Update Distribution Set Type",
|
||||
description = "Handles the PUT request for a single distribution set type. Required Permission: UPDATE_REPOSITORY")
|
||||
@PutResponses
|
||||
@PutMapping(value = MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_REQUEST_MAPPING + "/{distributionSetTypeId}",
|
||||
consumes = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE },
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@PutMapping(value = DISTRIBUTIONSETTYPES_V1 + "/{distributionSetTypeId}",
|
||||
consumes = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE }, produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<MgmtDistributionSetType> updateDistributionSetType(
|
||||
@PathVariable("distributionSetTypeId") Long distributionSetTypeId,
|
||||
@RequestBody MgmtDistributionSetTypeRequestBodyPut restDistributionSetType);
|
||||
@@ -149,9 +145,8 @@ public interface MgmtDistributionSetTypeRestApi {
|
||||
"new distribution set types. The request body must always be a list of types. " +
|
||||
"Required Permission: CREATE_REPOSITORY")
|
||||
@PostCreateResponses
|
||||
@PostMapping(value = MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_REQUEST_MAPPING,
|
||||
consumes = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE },
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@PostMapping(value = DISTRIBUTIONSETTYPES_V1,
|
||||
consumes = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE }, produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<List<MgmtDistributionSetType>> createDistributionSetTypes(
|
||||
@RequestBody List<MgmtDistributionSetTypeRequestBodyPost> distributionSetTypes);
|
||||
|
||||
@@ -165,9 +160,8 @@ public interface MgmtDistributionSetTypeRestApi {
|
||||
description = "Handles the GET request of retrieving the list of mandatory software module types in that " +
|
||||
"distribution set type. Required Permission: READ_REPOSITORY")
|
||||
@GetResponses
|
||||
@GetMapping(value = MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_REQUEST_MAPPING + "/{distributionSetTypeId}/" +
|
||||
MgmtRestConstants.MANDATORYMODULETYPES,
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = DISTRIBUTIONSETTYPES_V1 + "/{distributionSetTypeId}/" + MANDATORYMODULETYPES,
|
||||
produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<List<MgmtSoftwareModuleType>> getMandatoryModules(
|
||||
@PathVariable("distributionSetTypeId") Long distributionSetTypeId);
|
||||
|
||||
@@ -183,9 +177,8 @@ public interface MgmtDistributionSetTypeRestApi {
|
||||
description = "Handles the GET request of retrieving the single mandatory software module type in that " +
|
||||
"distribution set type. Required Permission: READ_REPOSITORY")
|
||||
@GetResponses
|
||||
@GetMapping(value = MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_REQUEST_MAPPING + "/{distributionSetTypeId}/" +
|
||||
MgmtRestConstants.MANDATORYMODULETYPES + "/{softwareModuleTypeId}",
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = DISTRIBUTIONSETTYPES_V1 + "/{distributionSetTypeId}/" + MANDATORYMODULETYPES + "/{softwareModuleTypeId}",
|
||||
produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<MgmtSoftwareModuleType> getMandatoryModule(
|
||||
@PathVariable("distributionSetTypeId") Long distributionSetTypeId,
|
||||
@PathVariable("softwareModuleTypeId") Long softwareModuleTypeId);
|
||||
@@ -201,9 +194,8 @@ public interface MgmtDistributionSetTypeRestApi {
|
||||
description = "Handles the GET request of retrieving the single optional software module type in that " +
|
||||
"distribution set type. Required Permission: READ_REPOSITORY")
|
||||
@GetResponses
|
||||
@GetMapping(value = MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_REQUEST_MAPPING + "/{distributionSetTypeId}/" +
|
||||
MgmtRestConstants.OPTIONALMODULETYPES + "/{softwareModuleTypeId}",
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = DISTRIBUTIONSETTYPES_V1 + "/{distributionSetTypeId}/" + OPTIONALMODULETYPES + "/{softwareModuleTypeId}",
|
||||
produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<MgmtSoftwareModuleType> getOptionalModule(
|
||||
@PathVariable("distributionSetTypeId") Long distributionSetTypeId,
|
||||
@PathVariable("softwareModuleTypeId") Long softwareModuleTypeId);
|
||||
@@ -218,9 +210,8 @@ public interface MgmtDistributionSetTypeRestApi {
|
||||
description = "Handles the GET request of retrieving the list of optional software module types in that " +
|
||||
"distribution set type. Required Permission: READ_REPOSITORY")
|
||||
@GetResponses
|
||||
@GetMapping(value = MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_REQUEST_MAPPING + "/{distributionSetTypeId}/" +
|
||||
MgmtRestConstants.OPTIONALMODULETYPES,
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = DISTRIBUTIONSETTYPES_V1 + "/{distributionSetTypeId}/" + OPTIONALMODULETYPES,
|
||||
produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<List<MgmtSoftwareModuleType>> getOptionalModules(
|
||||
@PathVariable("distributionSetTypeId") Long distributionSetTypeId);
|
||||
|
||||
@@ -235,8 +226,7 @@ public interface MgmtDistributionSetTypeRestApi {
|
||||
description = "Handles the DELETE request for removing a software module type from a single " +
|
||||
"distribution set type. Required Permission: DELETE_REPOSITORY")
|
||||
@DeleteResponses
|
||||
@DeleteMapping(value = MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_REQUEST_MAPPING + "/{distributionSetTypeId}/" +
|
||||
MgmtRestConstants.MANDATORYMODULETYPES + "/{softwareModuleTypeId}")
|
||||
@DeleteMapping(value = DISTRIBUTIONSETTYPES_V1 + "/{distributionSetTypeId}/" + MANDATORYMODULETYPES + "/{softwareModuleTypeId}")
|
||||
ResponseEntity<Void> removeMandatoryModule(
|
||||
@PathVariable("distributionSetTypeId") Long distributionSetTypeId,
|
||||
@PathVariable("softwareModuleTypeId") Long softwareModuleTypeId);
|
||||
@@ -253,8 +243,7 @@ public interface MgmtDistributionSetTypeRestApi {
|
||||
"Note that a DS type cannot be changed after it has been used by a DS. " +
|
||||
"Required Permission: UPDATE_REPOSITORY and READ_REPOSITORY")
|
||||
@DeleteResponses
|
||||
@DeleteMapping(value = MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_REQUEST_MAPPING + "/{distributionSetTypeId}/" +
|
||||
MgmtRestConstants.OPTIONALMODULETYPES + "/{softwareModuleTypeId}")
|
||||
@DeleteMapping(value = DISTRIBUTIONSETTYPES_V1 + "/{distributionSetTypeId}/" + OPTIONALMODULETYPES + "/{softwareModuleTypeId}")
|
||||
ResponseEntity<Void> removeOptionalModule(
|
||||
@PathVariable("distributionSetTypeId") Long distributionSetTypeId,
|
||||
@PathVariable("softwareModuleTypeId") Long softwareModuleTypeId);
|
||||
@@ -275,9 +264,8 @@ public interface MgmtDistributionSetTypeRestApi {
|
||||
@ApiResponse(responseCode = NOT_FOUND_404, description = "Distribution Set Type not found.",
|
||||
content = @Content(mediaType = "application/json", schema = @Schema(hidden = true)))
|
||||
})
|
||||
@PostMapping(value = MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_REQUEST_MAPPING + "/{distributionSetTypeId}/" +
|
||||
MgmtRestConstants.MANDATORYMODULETYPES,
|
||||
consumes = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@PostMapping(value = DISTRIBUTIONSETTYPES_V1 + "/{distributionSetTypeId}/" + MANDATORYMODULETYPES,
|
||||
consumes = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<Void> addMandatoryModule(
|
||||
@PathVariable("distributionSetTypeId") Long distributionSetTypeId,
|
||||
@RequestBody MgmtId smtId);
|
||||
@@ -298,9 +286,8 @@ public interface MgmtDistributionSetTypeRestApi {
|
||||
@ApiResponse(responseCode = NOT_FOUND_404, description = "Distribution Set Type not found.",
|
||||
content = @Content(mediaType = "application/json", schema = @Schema(hidden = true)))
|
||||
})
|
||||
@PostMapping(value = MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_REQUEST_MAPPING + "/{distributionSetTypeId}/" +
|
||||
MgmtRestConstants.OPTIONALMODULETYPES,
|
||||
consumes = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@PostMapping(value = DISTRIBUTIONSETTYPES_V1 + "/{distributionSetTypeId}/" + OPTIONALMODULETYPES,
|
||||
consumes = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<Void> addOptionalModule(
|
||||
@PathVariable("distributionSetTypeId") Long distributionSetTypeId,
|
||||
@RequestBody MgmtId smtId);
|
||||
|
||||
@@ -29,7 +29,7 @@ import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
/**
|
||||
* API to download artifacts
|
||||
* REST API to download artifacts
|
||||
*/
|
||||
@FunctionalInterface
|
||||
@Tag(
|
||||
@@ -50,7 +50,7 @@ public interface MgmtDownloadArtifactRestApi {
|
||||
@ApiResponse(responseCode = INTERNAL_SERVER_ERROR_500, description = "Artifact download or decryption failed",
|
||||
content = @Content(mediaType = "application/json", schema = @Schema(hidden = true)))
|
||||
})
|
||||
@GetMapping(value = MgmtRestConstants.SOFTWAREMODULE_V1_REQUEST_MAPPING + "/{softwareModuleId}/artifacts/{artifactId}/download")
|
||||
@GetMapping(value = MgmtSoftwareModuleRestApi.SOFTWAREMODULES_V1 + "/{softwareModuleId}/artifacts/{artifactId}/download")
|
||||
@ResponseBody
|
||||
ResponseEntity<InputStream> downloadArtifact(
|
||||
@PathVariable("softwareModuleId") Long softwareModuleId,
|
||||
|
||||
@@ -18,7 +18,6 @@ import java.util.Optional;
|
||||
public enum MgmtRepresentationMode {
|
||||
|
||||
FULL("full"),
|
||||
|
||||
COMPACT("compact");
|
||||
|
||||
private final String mode;
|
||||
|
||||
@@ -18,158 +18,41 @@ import lombok.NoArgsConstructor;
|
||||
@NoArgsConstructor(access = AccessLevel.PRIVATE)
|
||||
public final class MgmtRestConstants {
|
||||
|
||||
/**
|
||||
* The base URL mapping of the rest resources.
|
||||
*/
|
||||
public static final String REST = "/rest";
|
||||
/**
|
||||
* API version definition. We are using only major versions.
|
||||
*/
|
||||
public static final String API_VERSION = "v1";
|
||||
public static final String API_VERSION_1 = "v1";
|
||||
/**
|
||||
* The base URL mapping of the SP rest resources.
|
||||
* The base URL mapping of the rest V1 resources.
|
||||
*/
|
||||
public static final String BASE_REST_MAPPING = "/rest";
|
||||
public static final String REST_V1 = REST + "/" + API_VERSION_1;
|
||||
|
||||
/**
|
||||
* The base URL mapping of the SP rest resources.
|
||||
* The request parameter for searching. The value of the search parameter must be in the FIQL syntax.
|
||||
*/
|
||||
public static final String BASE_V1_REQUEST_MAPPING = BASE_REST_MAPPING + "/v1";
|
||||
public static final String REQUEST_PARAMETER_SEARCH = "q";
|
||||
/**
|
||||
* The software module URL mapping rest resource.
|
||||
* The request parameter for specifying the representation mode. The value of this parameter can either be "full" or "compact".
|
||||
*/
|
||||
public static final String SOFTWAREMODULE_V1_REQUEST_MAPPING = BASE_V1_REQUEST_MAPPING + "/softwaremodules";
|
||||
public static final String REQUEST_PARAMETER_REPRESENTATION_MODE = "representation";
|
||||
/**
|
||||
* The target URL mapping rest resource.
|
||||
* The default representation mode.
|
||||
*/
|
||||
public static final String TARGET_V1_REQUEST_MAPPING = BASE_V1_REQUEST_MAPPING + "/targets";
|
||||
public static final String REQUEST_PARAMETER_REPRESENTATION_MODE_DEFAULT = "compact";
|
||||
/**
|
||||
* The tag URL mapping rest resource.
|
||||
*/
|
||||
public static final String TARGET_TAG_V1_REQUEST_MAPPING = BASE_V1_REQUEST_MAPPING + "/targettags";
|
||||
/**
|
||||
* The target type URL mapping rest resource.
|
||||
*/
|
||||
public static final String TARGETTYPE_V1_REQUEST_MAPPING = BASE_V1_REQUEST_MAPPING + "/targettypes";
|
||||
/**
|
||||
* The target group URL mapping rest resource.
|
||||
*/
|
||||
public static final String TARGET_GROUP_V1_REQUEST_MAPPING = BASE_V1_REQUEST_MAPPING + "/targetgroups";
|
||||
/**
|
||||
* The tag URL mapping rest resource.
|
||||
*/
|
||||
public static final String DISTRIBUTIONSET_TAG_V1_REQUEST_MAPPING = BASE_V1_REQUEST_MAPPING
|
||||
+ "/distributionsettags";
|
||||
/**
|
||||
* The target URL mapping rest resource.
|
||||
*/
|
||||
public static final String TARGET_FILTER_V1_REQUEST_MAPPING = BASE_V1_REQUEST_MAPPING + "/targetfilters";
|
||||
/**
|
||||
* The action URL mapping rest resource.
|
||||
*/
|
||||
public static final String ACTION_V1_REQUEST_MAPPING = BASE_V1_REQUEST_MAPPING + "/actions";
|
||||
/**
|
||||
* The software module type URL mapping rest resource.
|
||||
*/
|
||||
public static final String SOFTWAREMODULETYPE_V1_REQUEST_MAPPING = BASE_V1_REQUEST_MAPPING + "/softwaremoduletypes";
|
||||
/**
|
||||
* The distributon set base resource.
|
||||
*/
|
||||
public static final String DISTRIBUTIONSETTYPE_V1_REQUEST_MAPPING = BASE_V1_REQUEST_MAPPING
|
||||
+ "/distributionsettypes";
|
||||
/**
|
||||
* The software module URL mapping rest resource.
|
||||
*/
|
||||
public static final String DISTRIBUTIONSET_V1_REQUEST_MAPPING = BASE_V1_REQUEST_MAPPING + "/distributionsets";
|
||||
/**
|
||||
* The rollout URL mapping rest resource.
|
||||
*/
|
||||
public static final String ROLLOUT_V1_REQUEST_MAPPING = BASE_V1_REQUEST_MAPPING + "/rollouts";
|
||||
/**
|
||||
* The basic authentication validation mapping
|
||||
*/
|
||||
public static final String AUTH_V1_REQUEST_MAPPING = BASE_V1_REQUEST_MAPPING + "/userinfo";
|
||||
/**
|
||||
* String representation of
|
||||
* {@link #REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT_VALUE}.
|
||||
* String representation of {@link #REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT_VALUE}.
|
||||
*/
|
||||
public static final String REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT = "50";
|
||||
/**
|
||||
* The default limit parameter in case the limit parameter is not present in
|
||||
* the request.
|
||||
* The default limit parameter in case the limit parameter is not present in the request.
|
||||
*
|
||||
* @see #REQUEST_PARAMETER_PAGING_LIMIT
|
||||
*/
|
||||
public static final int REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT_VALUE = Integer
|
||||
.parseInt(REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT);
|
||||
/**
|
||||
* The base URL mapping for the spring acuator management context path.
|
||||
*/
|
||||
public static final String BASE_SYSTEM_MAPPING = "/system";
|
||||
public static final String SYSTEM_V1_REQUEST_MAPPING = BASE_V1_REQUEST_MAPPING + BASE_SYSTEM_MAPPING;
|
||||
/**
|
||||
* URL mapping for system admin operations.
|
||||
*/
|
||||
public static final String SYSTEM_ADMIN_MAPPING = BASE_SYSTEM_MAPPING + "/admin";
|
||||
/**
|
||||
* The target URL mapping, href link for assigned target type.
|
||||
*/
|
||||
public static final String TARGET_V1_ASSIGNED_TARGET_TYPE = "targetType";
|
||||
/**
|
||||
* The target URL mapping, href link for autoConfirm state of a target.
|
||||
*/
|
||||
public static final String TARGET_V1_AUTO_CONFIRM = "autoConfirm";
|
||||
/**
|
||||
* The target URL mapping, href link activate auto-confirm on a target.
|
||||
*/
|
||||
public static final String TARGET_V1_ACTIVATE_AUTO_CONFIRM = "activate";
|
||||
/**
|
||||
* The target URL mapping, href link deactivate auto-confirm on a target.
|
||||
*/
|
||||
public static final String TARGET_V1_DEACTIVATE_AUTO_CONFIRM = "deactivate";
|
||||
/**
|
||||
* The target URL mapping, href link for assigned distribution set.
|
||||
*/
|
||||
public static final String TARGET_V1_ASSIGNED_DISTRIBUTION_SET = "assignedDS";
|
||||
/**
|
||||
* The target URL mapping, href link for installed distribution set.
|
||||
*/
|
||||
public static final String TARGET_V1_INSTALLED_DISTRIBUTION_SET = "installedDS";
|
||||
/**
|
||||
* The target URL mapping, href link for target attributes.
|
||||
*/
|
||||
public static final String TARGET_V1_ATTRIBUTES = "attributes";
|
||||
/**
|
||||
* The target URL mapping, href link for target actions.
|
||||
*/
|
||||
public static final String TARGET_V1_ACTIONS = "actions";
|
||||
/**
|
||||
* The target URL mapping, href link for canceled actions.
|
||||
*/
|
||||
public static final String TARGET_V1_CANCELED_ACTION = "canceledaction";
|
||||
/**
|
||||
* The target URL mapping, href link for canceled actions.
|
||||
*/
|
||||
public static final String TARGET_V1_ACTION_STATUS = "status";
|
||||
/**
|
||||
* The target URL mapping, href link for a rollout.
|
||||
*/
|
||||
public static final String TARGET_V1_ROLLOUT = "rollout";
|
||||
/**
|
||||
* The target URL mapping rest resource.
|
||||
*/
|
||||
public static final String TARGET_TARGET_ID_TARGETTYPE = "/{targetId}/targettype";
|
||||
/**
|
||||
* The target type URL mapping rest resource.
|
||||
*/
|
||||
public static final String COMPATIBLEDISTRIBUTIONSETTYPES = "compatibledistributionsettypes";
|
||||
/**
|
||||
* The tag URL mapping rest resource.
|
||||
*/
|
||||
public static final String TARGET_TAG_ID_ASSIGNED = "/{targetTagId}/assigned";
|
||||
/**
|
||||
* The tag URL mapping rest resource.
|
||||
*/
|
||||
public static final String DISTRIBUTIONSET_TAG_ID_ASSIGNED = "/{distributionsetTagId}/assigned";
|
||||
/**
|
||||
* Target group URL mapping rest resource
|
||||
*/
|
||||
public static final String GROUP_ASSIGNED = "/{group}/assigned";
|
||||
public static final int REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT_VALUE = Integer.parseInt(REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT);
|
||||
/**
|
||||
* The default offset parameter in case the offset parameter is not present in the request.
|
||||
*
|
||||
@@ -195,48 +78,12 @@ public final class MgmtRestConstants {
|
||||
*/
|
||||
public static final String REQUEST_PARAMETER_PAGING_OFFSET = "offset";
|
||||
/**
|
||||
* The request parameter for sorting. The value of the sort parameter must be in the following pattern. Example:
|
||||
* http://www.bosch.com/iap/sp/rest/targets?sort=field_1:ASC,field_2:DESC,field_3:ASC
|
||||
* The request parameter for sorting. The value of the sort parameter must be in the following pattern.<br/>
|
||||
* Example: <code>https://www.foo.com/iap/sp/rest/targets?sort=field_1:ASC,field_2:DESC,field_3:ASC</code>
|
||||
*/
|
||||
public static final String REQUEST_PARAMETER_SORTING = "sort";
|
||||
/**
|
||||
* The request parameter for searching. The value of the search parameter must be in the FIQL syntax.
|
||||
*/
|
||||
public static final String REQUEST_PARAMETER_SEARCH = "q";
|
||||
/**
|
||||
* The request parameter for specifying the representation mode. The value of this parameter can either be "full" or "compact".
|
||||
*/
|
||||
public static final String REQUEST_PARAMETER_REPRESENTATION_MODE = "representation";
|
||||
/**
|
||||
* The default representation mode.
|
||||
*/
|
||||
public static final String REQUEST_PARAMETER_REPRESENTATION_MODE_DEFAULT = "compact";
|
||||
/**
|
||||
* Request parameter for async
|
||||
*/
|
||||
public static final String REQUEST_PARAMETER_ASYNC = "async";
|
||||
/**
|
||||
* The target URL mapping, href link for artifact download.
|
||||
*/
|
||||
public static final String SOFTWAREMODULE_V1_ARTIFACT = "artifacts";
|
||||
/**
|
||||
* The target URL mapping, href link for software module access.
|
||||
*/
|
||||
public static final String DISTRIBUTIONSET_V1_MODULE = "modules";
|
||||
/**
|
||||
* The target URL mapping, href link for type information.
|
||||
*/
|
||||
public static final String SOFTWAREMODULE_V1_TYPE = "type";
|
||||
public static final String OPTIONALMODULES = "optionalmodules";
|
||||
public static final String MANDATORYMODULES = "mandatorymodules";
|
||||
public static final String OPTIONALMODULETYPES = "optionalmoduletypes";
|
||||
public static final String MANDATORYMODULETYPES = "mandatorymoduletypes";
|
||||
/**
|
||||
* Request parameter if the artifact url handler should be used
|
||||
*/
|
||||
public static final String REQUEST_PARAMETER_USE_ARTIFACT_URL_HANDLER = "useartifacturlhandler";
|
||||
|
||||
// Orders
|
||||
// API Orders (used for sorting in OpenAPI doc / Swagger UI)
|
||||
public static final String TARGET_ORDER = "1000";
|
||||
public static final String TARGET_TAG_ORDER = "2000";
|
||||
public static final String TARGET_TYPE_ORDER = "3000";
|
||||
|
||||
@@ -9,6 +9,12 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.mgmt.rest.api;
|
||||
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_LIMIT;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_REPRESENTATION_MODE;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_REPRESENTATION_MODE_DEFAULT;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.ROLLOUT_ORDER;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.DeleteResponses;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.GetIfExistResponses;
|
||||
@@ -17,6 +23,8 @@ import static org.eclipse.hawkbit.rest.ApiResponsesConstants.NOT_FOUND_404;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.PostCreateNoContentResponses;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.PostCreateResponses;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.PutResponses;
|
||||
import static org.springframework.hateoas.MediaTypes.HAL_JSON_VALUE;
|
||||
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.extensions.Extension;
|
||||
@@ -34,8 +42,6 @@ import org.eclipse.hawkbit.mgmt.json.model.rolloutgroup.MgmtRolloutGroupResponse
|
||||
import org.eclipse.hawkbit.mgmt.json.model.target.MgmtTarget;
|
||||
import org.eclipse.hawkbit.rest.ApiResponsesConstants.PostUpdateNoContentResponses;
|
||||
import org.eclipse.hawkbit.rest.OpenApi;
|
||||
import org.springframework.hateoas.MediaTypes;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@@ -46,14 +52,15 @@ import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
/**
|
||||
* REST Resource handling rollout CRUD operations.
|
||||
* REST API for Rollout CRUD operations.
|
||||
*/
|
||||
// no request mapping specified here to avoid CVE-2021-22044 in Feign client
|
||||
@Tag(
|
||||
name = "Rollouts", description = "REST API for Rollout CRUD operations.",
|
||||
@Tag(name = "Rollouts", description = "REST API for Rollout CRUD operations.",
|
||||
extensions = @Extension(name = OpenApi.X_HAWKBIT, properties = @ExtensionProperty(name = "order", value = ROLLOUT_ORDER)))
|
||||
public interface MgmtRolloutRestApi {
|
||||
|
||||
String ROLLOUTS_V1 = MgmtRestConstants.REST_V1 + "/rollouts";
|
||||
|
||||
/**
|
||||
* Handles the GET request of retrieving all rollouts.
|
||||
*
|
||||
@@ -66,36 +73,26 @@ public interface MgmtRolloutRestApi {
|
||||
* @return a list of all rollouts for a defined or default page request with status OK. The response is always paged. In any failure the
|
||||
* JsonResponseExceptionHandler is handling the response.
|
||||
*/
|
||||
@Operation(summary = "Return all Rollouts", description = "Handles the GET request of retrieving all rollouts. " +
|
||||
"Required Permission: READ_ROLLOUT")
|
||||
@Operation(summary = "Return all Rollouts",
|
||||
description = "Handles the GET request of retrieving all rollouts. Required Permission: READ_ROLLOUT")
|
||||
@GetIfExistResponses
|
||||
@GetMapping(value = MgmtRestConstants.ROLLOUT_V1_REQUEST_MAPPING,
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = ROLLOUTS_V1, produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<PagedList<MgmtRolloutResponseBody>> getRollouts(
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SEARCH, required = false)
|
||||
@Schema(description = """
|
||||
Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for
|
||||
available fields.""")
|
||||
@Schema(description = "Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for available fields.")
|
||||
String rsqlParam,
|
||||
@RequestParam(
|
||||
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET,
|
||||
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
||||
@RequestParam(value = REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
||||
@Schema(description = "The paging offset (default is 0)")
|
||||
int pagingOffsetParam,
|
||||
@RequestParam(
|
||||
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_LIMIT,
|
||||
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT)
|
||||
@RequestParam(value = REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT)
|
||||
@Schema(description = "The maximum number of entries in a page (default is 50)")
|
||||
int pagingLimitParam,
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SORTING, required = false)
|
||||
@Schema(description = """
|
||||
The query parameter sort allows to define the sort order for the result of a query. A sort criteria
|
||||
consists of the name of a field and the sort direction (ASC for ascending and DESC descending).
|
||||
The sequence of the sort criteria (multiple can be used) defines the sort order of the entities
|
||||
in the result.""")
|
||||
@Schema(description = "The query parameter sort allows to define the sort order for the result of a query. " +
|
||||
"A sort criteria consists of the name of a field and the sort direction (ASC for ascending and DESC descending)." +
|
||||
"The sequence of the sort criteria (multiple can be used) defines the sort order of the entities in the result.")
|
||||
String sortParam,
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_REPRESENTATION_MODE,
|
||||
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_REPRESENTATION_MODE_DEFAULT)
|
||||
@RequestParam(value = REQUEST_PARAMETER_REPRESENTATION_MODE, defaultValue = REQUEST_PARAMETER_REPRESENTATION_MODE_DEFAULT)
|
||||
String representationModeParam);
|
||||
|
||||
/**
|
||||
@@ -104,11 +101,10 @@ public interface MgmtRolloutRestApi {
|
||||
* @param rolloutId the ID of the rollout to retrieve
|
||||
* @return a single rollout with status OK.
|
||||
*/
|
||||
@Operation(summary = "Return single Rollout", description = "Handles the GET request of retrieving a single " +
|
||||
"rollout. Required Permission: READ_ROLLOUT")
|
||||
@Operation(summary = "Return single Rollout",
|
||||
description = "Handles the GET request of retrieving a single rollout. Required Permission: READ_ROLLOUT")
|
||||
@GetResponses
|
||||
@GetMapping(value = MgmtRestConstants.ROLLOUT_V1_REQUEST_MAPPING + "/{rolloutId}",
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = ROLLOUTS_V1 + "/{rolloutId}", produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<MgmtRolloutResponseBody> getRollout(@PathVariable("rolloutId") Long rolloutId);
|
||||
|
||||
/**
|
||||
@@ -121,9 +117,8 @@ public interface MgmtRolloutRestApi {
|
||||
@Operation(summary = "Create a new Rollout",
|
||||
description = "Handles the POST request of creating new rollout. Required Permission: CREATE_ROLLOUT")
|
||||
@PostCreateResponses
|
||||
@PostMapping(value = MgmtRestConstants.ROLLOUT_V1_REQUEST_MAPPING,
|
||||
consumes = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE },
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@PostMapping(value = ROLLOUTS_V1,
|
||||
consumes = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE }, produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<MgmtRolloutResponseBody> create(
|
||||
@RequestBody MgmtRolloutRestRequestBodyPost rolloutRequestBody);
|
||||
|
||||
@@ -134,12 +129,11 @@ public interface MgmtRolloutRestApi {
|
||||
* @return In case rollout could successful updated the ResponseEntity with status code 200 with the successfully created rollout. In any
|
||||
* failure the JsonResponseExceptionHandler is handling the response.
|
||||
*/
|
||||
@Operation(summary = "Update Rollout", description = "Handles the UPDATE request for a single " +
|
||||
"Rollout. Required permission: UPDATE_ROLLOUT")
|
||||
@Operation(summary = "Update Rollout",
|
||||
description = "Handles the UPDATE request for a single Rollout. Required permission: UPDATE_ROLLOUT")
|
||||
@PutResponses
|
||||
@PutMapping(value = MgmtRestConstants.ROLLOUT_V1_REQUEST_MAPPING + "/{rolloutId}",
|
||||
consumes = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE },
|
||||
produces = { MediaType.APPLICATION_JSON_VALUE, MediaTypes.HAL_JSON_VALUE })
|
||||
@PutMapping(value = ROLLOUTS_V1 + "/{rolloutId}",
|
||||
consumes = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE }, produces = { APPLICATION_JSON_VALUE, HAL_JSON_VALUE })
|
||||
ResponseEntity<MgmtRolloutResponseBody> update(
|
||||
@PathVariable("rolloutId") Long rolloutId,
|
||||
@RequestBody MgmtRolloutRestRequestBodyPut rolloutUpdateBody);
|
||||
@@ -156,8 +150,7 @@ public interface MgmtRolloutRestApi {
|
||||
"workflow is enabled in system configuration and rollout is in state WAITING_FOR_APPROVAL. " +
|
||||
"Required Permission: APPROVE_ROLLOUT")
|
||||
@PostCreateNoContentResponses
|
||||
@PostMapping(value = MgmtRestConstants.ROLLOUT_V1_REQUEST_MAPPING + "/{rolloutId}/approve",
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@PostMapping(value = ROLLOUTS_V1 + "/{rolloutId}/approve", produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<Void> approve(
|
||||
@PathVariable("rolloutId") Long rolloutId,
|
||||
@RequestParam(value = "remark", required = false) String remark);
|
||||
@@ -173,8 +166,7 @@ public interface MgmtRolloutRestApi {
|
||||
"Only possible if approval workflow is enabled in system configuration and rollout is in state " +
|
||||
"WAITING_FOR_APPROVAL. Required Permission: APPROVE_ROLLOUT")
|
||||
@PostCreateNoContentResponses
|
||||
@PostMapping(value = MgmtRestConstants.ROLLOUT_V1_REQUEST_MAPPING + "/{rolloutId}/deny",
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@PostMapping(value = ROLLOUTS_V1 + "/{rolloutId}/deny", produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<Void> deny(
|
||||
@PathVariable("rolloutId") Long rolloutId,
|
||||
@RequestParam(value = "remark", required = false) String remark);
|
||||
@@ -185,11 +177,10 @@ public interface MgmtRolloutRestApi {
|
||||
* @param rolloutId the ID of the rollout to be started.
|
||||
* @return OK response (200) if rollout could be started. In case of any exception the corresponding errors occur.
|
||||
*/
|
||||
@Operation(summary = "Start a Rollout", description = "Handles the POST request of starting a created rollout. " +
|
||||
"Required Permission: HANDLE_ROLLOUT")
|
||||
@Operation(summary = "Start a Rollout",
|
||||
description = "Handles the POST request of starting a created rollout. Required Permission: HANDLE_ROLLOUT")
|
||||
@PostCreateNoContentResponses
|
||||
@PostMapping(value = MgmtRestConstants.ROLLOUT_V1_REQUEST_MAPPING + "/{rolloutId}/start",
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@PostMapping(value = ROLLOUTS_V1 + "/{rolloutId}/start", produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<Void> start(@PathVariable("rolloutId") Long rolloutId);
|
||||
|
||||
/**
|
||||
@@ -198,11 +189,10 @@ public interface MgmtRolloutRestApi {
|
||||
* @param rolloutId the ID of the rollout to be paused.
|
||||
* @return OK response (200) if rollout could be paused. In case of any exception the corresponding errors occur.
|
||||
*/
|
||||
@Operation(summary = "Pause a Rollout", description = "Handles the POST request of pausing a running rollout. " +
|
||||
"Required Permission: HANDLE_ROLLOUT")
|
||||
@Operation(summary = "Pause a Rollout",
|
||||
description = "Handles the POST request of pausing a running rollout. Required Permission: HANDLE_ROLLOUT")
|
||||
@PostCreateNoContentResponses
|
||||
@PostMapping(value = MgmtRestConstants.ROLLOUT_V1_REQUEST_MAPPING + "/{rolloutId}/pause",
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@PostMapping(value = ROLLOUTS_V1 + "/{rolloutId}/pause", produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<Void> pause(@PathVariable("rolloutId") Long rolloutId);
|
||||
|
||||
/**
|
||||
@@ -211,25 +201,22 @@ public interface MgmtRolloutRestApi {
|
||||
* @param rolloutId the ID of the rollout to be paused.
|
||||
* @return OK response (200) if rollout could be stopped. In case of any exception the corresponding errors occur.
|
||||
*/
|
||||
@Operation(summary = "Stop a Rollout", description = "Handles the POST request of stopping a running rollout. " +
|
||||
"Required Permission: HANDLE_ROLLOUT")
|
||||
@Operation(summary = "Stop a Rollout",
|
||||
description = "Handles the POST request of stopping a running rollout. Required Permission: HANDLE_ROLLOUT")
|
||||
@PostUpdateNoContentResponses
|
||||
@PostMapping(value = MgmtRestConstants.ROLLOUT_V1_REQUEST_MAPPING + "/{rolloutId}/stop",
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@PostMapping(value = ROLLOUTS_V1 + "/{rolloutId}/stop", produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<Void> stop(@PathVariable("rolloutId") Long rolloutId);
|
||||
|
||||
/**
|
||||
* Handles the DELETE request for deleting a rollout.
|
||||
*
|
||||
* @param rolloutId the ID of the rollout to be deleted.
|
||||
* @return OK response (200) if rollout could be deleted. In case of any
|
||||
* exception the corresponding errors occur.
|
||||
* @return OK response (200) if rollout could be deleted. In case of any exception the corresponding errors occur.
|
||||
*/
|
||||
@Operation(summary = "Delete a Rollout", description = "Handles the DELETE request of deleting a rollout. " +
|
||||
"Required Permission: DELETE_ROLLOUT")
|
||||
@DeleteResponses
|
||||
@DeleteMapping(value = MgmtRestConstants.ROLLOUT_V1_REQUEST_MAPPING + "/{rolloutId}",
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@DeleteMapping(value = ROLLOUTS_V1 + "/{rolloutId}", produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<Void> delete(@PathVariable("rolloutId") Long rolloutId);
|
||||
|
||||
/**
|
||||
@@ -241,8 +228,7 @@ public interface MgmtRolloutRestApi {
|
||||
@Operation(summary = "Resume a Rollout", description = "Handles the POST request of resuming a paused rollout. " +
|
||||
"Required Permission: HANDLE_ROLLOUT")
|
||||
@PostCreateNoContentResponses
|
||||
@PostMapping(value = MgmtRestConstants.ROLLOUT_V1_REQUEST_MAPPING + "/{rolloutId}/resume",
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@PostMapping(value = ROLLOUTS_V1 + "/{rolloutId}/resume", produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<Void> resume(@PathVariable("rolloutId") Long rolloutId);
|
||||
|
||||
/**
|
||||
@@ -257,37 +243,27 @@ public interface MgmtRolloutRestApi {
|
||||
* @return a list of all rollout groups referred to a rollout for a defined or default page request with status OK. The response is always
|
||||
* paged. In any failure the JsonResponseExceptionHandler is handling the response.
|
||||
*/
|
||||
@Operation(summary = "Return all rollout groups referred to a Rollout", description = "Handles the GET request of " +
|
||||
"retrieving all deploy groups of a specific rollout. Required Permission: READ_ROLLOUT")
|
||||
@Operation(summary = "Return all rollout groups referred to a Rollout",
|
||||
description = "Handles the GET request of retrieving all deploy groups of a specific rollout. Required Permission: READ_ROLLOUT")
|
||||
@GetResponses
|
||||
@GetMapping(value = MgmtRestConstants.ROLLOUT_V1_REQUEST_MAPPING + "/{rolloutId}/deploygroups",
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = ROLLOUTS_V1 + "/{rolloutId}/deploygroups", produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<PagedList<MgmtRolloutGroupResponseBody>> getRolloutGroups(
|
||||
@PathVariable("rolloutId") Long rolloutId,
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SEARCH, required = false)
|
||||
@Schema(description = """
|
||||
Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for
|
||||
available fields.""")
|
||||
@Schema(description = "Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for available fields.")
|
||||
String rsqlParam,
|
||||
@RequestParam(
|
||||
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET,
|
||||
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
||||
@RequestParam(value = REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
||||
@Schema(description = "The paging offset (default is 0)")
|
||||
int pagingOffsetParam,
|
||||
@RequestParam(
|
||||
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_LIMIT,
|
||||
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT)
|
||||
@RequestParam(value = REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT)
|
||||
@Schema(description = "The maximum number of entries in a page (default is 50)")
|
||||
int pagingLimitParam,
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SORTING, required = false)
|
||||
@Schema(description = """
|
||||
The query parameter sort allows to define the sort order for the result of a query. A sort criteria
|
||||
consists of the name of a field and the sort direction (ASC for ascending and DESC descending).
|
||||
The sequence of the sort criteria (multiple can be used) defines the sort order of the entities
|
||||
in the result.""")
|
||||
@Schema(description = "The query parameter sort allows to define the sort order for the result of a query. " +
|
||||
"A sort criteria consists of the name of a field and the sort direction (ASC for ascending and DESC descending)." +
|
||||
"The sequence of the sort criteria (multiple can be used) defines the sort order of the entities in the result.")
|
||||
String sortParam,
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_REPRESENTATION_MODE,
|
||||
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_REPRESENTATION_MODE_DEFAULT)
|
||||
@RequestParam(value = REQUEST_PARAMETER_REPRESENTATION_MODE, defaultValue = REQUEST_PARAMETER_REPRESENTATION_MODE_DEFAULT)
|
||||
String representationModeParam);
|
||||
|
||||
/**
|
||||
@@ -297,11 +273,10 @@ public interface MgmtRolloutRestApi {
|
||||
* @param groupId the groupId to retrieve the rollout group
|
||||
* @return the OK response containing the MgmtRolloutGroupResponseBody
|
||||
*/
|
||||
@Operation(summary = "Return single rollout group", description = "Handles the GET request of a single deploy " +
|
||||
"group of a specific rollout. Required Permission: READ_ROLLOUT")
|
||||
@Operation(summary = "Return single rollout group",
|
||||
description = "Handles the GET request of a single deploy group of a specific rollout. Required Permission: READ_ROLLOUT")
|
||||
@GetResponses
|
||||
@GetMapping(value = MgmtRestConstants.ROLLOUT_V1_REQUEST_MAPPING + "/{rolloutId}/deploygroups/{groupId}",
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = ROLLOUTS_V1 + "/{rolloutId}/deploygroups/{groupId}", produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<MgmtRolloutGroupResponseBody> getRolloutGroup(
|
||||
@PathVariable("rolloutId") Long rolloutId,
|
||||
@PathVariable("groupId") Long groupId);
|
||||
@@ -322,32 +297,23 @@ public interface MgmtRolloutRestApi {
|
||||
description = "Handles the GET request of retrieving all targets of a single deploy group of a specific " +
|
||||
"rollout. Required Permissions: READ_ROLLOUT, READ_TARGET.")
|
||||
@GetResponses
|
||||
@GetMapping(value = MgmtRestConstants.ROLLOUT_V1_REQUEST_MAPPING + "/{rolloutId}/deploygroups/{groupId}/targets",
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = ROLLOUTS_V1 + "/{rolloutId}/deploygroups/{groupId}/targets", produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<PagedList<MgmtTarget>> getRolloutGroupTargets(
|
||||
@PathVariable("rolloutId") Long rolloutId,
|
||||
@PathVariable("groupId") Long groupId,
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SEARCH, required = false)
|
||||
@Schema(description = """
|
||||
Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for
|
||||
available fields.""")
|
||||
@Schema(description = "Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for available fields.")
|
||||
String rsqlParam,
|
||||
@RequestParam(
|
||||
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET,
|
||||
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
||||
@RequestParam(value = REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
||||
@Schema(description = "The paging offset (default is 0)")
|
||||
int pagingOffsetParam,
|
||||
@RequestParam(
|
||||
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_LIMIT,
|
||||
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT)
|
||||
@RequestParam(value = REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT)
|
||||
@Schema(description = "The maximum number of entries in a page (default is 50)")
|
||||
int pagingLimitParam,
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SORTING, required = false)
|
||||
@Schema(description = """
|
||||
The query parameter sort allows to define the sort order for the result of a query. A sort criteria
|
||||
consists of the name of a field and the sort direction (ASC for ascending and DESC descending).
|
||||
The sequence of the sort criteria (multiple can be used) defines the sort order of the entities
|
||||
in the result.""")
|
||||
@Schema(description = "The query parameter sort allows to define the sort order for the result of a query. " +
|
||||
"A sort criteria consists of the name of a field and the sort direction (ASC for ascending and DESC descending)." +
|
||||
"The sequence of the sort criteria (multiple can be used) defines the sort order of the entities in the result.")
|
||||
String sortParam);
|
||||
|
||||
/**
|
||||
@@ -359,8 +325,7 @@ public interface MgmtRolloutRestApi {
|
||||
@Operation(summary = "Force trigger processing next group of a Rollout", description = "Handles the POST request " +
|
||||
"of triggering the next group of a rollout. Required Permission: UPDATE_ROLLOUT")
|
||||
@PostCreateNoContentResponses
|
||||
@PostMapping(value = MgmtRestConstants.ROLLOUT_V1_REQUEST_MAPPING + "/{rolloutId}/triggerNextGroup",
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@PostMapping(value = ROLLOUTS_V1 + "/{rolloutId}/triggerNextGroup", produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<Void> triggerNextGroup(@PathVariable("rolloutId") Long rolloutId);
|
||||
|
||||
/**
|
||||
@@ -376,7 +341,6 @@ public interface MgmtRolloutRestApi {
|
||||
@ApiResponse(responseCode = NOT_FOUND_404, description = "Rollout not found.",
|
||||
content = @Content(mediaType = "application/json", schema = @Schema(hidden = true)))
|
||||
})
|
||||
@PostMapping(value = MgmtRestConstants.ROLLOUT_V1_REQUEST_MAPPING + "/{rolloutId}/retry",
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@PostMapping(value = ROLLOUTS_V1 + "/{rolloutId}/retry", produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<MgmtRolloutResponseBody> retryRollout(@PathVariable("rolloutId") Long rolloutId);
|
||||
}
|
||||
@@ -9,6 +9,10 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.mgmt.rest.api;
|
||||
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_LIMIT;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.SOFTWARE_MODULE_ORDER;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.DeleteResponses;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.GONE_410;
|
||||
@@ -19,6 +23,9 @@ import static org.eclipse.hawkbit.rest.ApiResponsesConstants.LOCKED_423;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.NOT_FOUND_404;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.PostCreateResponses;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.PutResponses;
|
||||
import static org.springframework.hateoas.MediaTypes.HAL_JSON_VALUE;
|
||||
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
|
||||
import static org.springframework.http.MediaType.MULTIPART_FORM_DATA_VALUE;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -38,8 +45,6 @@ import org.eclipse.hawkbit.mgmt.json.model.softwaremodule.MgmtSoftwareModuleMeta
|
||||
import org.eclipse.hawkbit.mgmt.json.model.softwaremodule.MgmtSoftwareModuleRequestBodyPost;
|
||||
import org.eclipse.hawkbit.mgmt.json.model.softwaremodule.MgmtSoftwareModuleRequestBodyPut;
|
||||
import org.eclipse.hawkbit.rest.OpenApi;
|
||||
import org.springframework.hateoas.MediaTypes;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@@ -53,15 +58,16 @@ import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
/**
|
||||
* REST Resource handling for SoftwareModule and related Artifact CRUD
|
||||
* operations.
|
||||
* REST API for SoftwareModule and related Artifact CRUD operations.
|
||||
*/
|
||||
// no request mapping specified here to avoid CVE-2021-22044 in Feign client
|
||||
@Tag(
|
||||
name = "Software Modules", description = "REST API for SoftwareModule and related Artifact CRUD operations.",
|
||||
@Tag(name = "Software Modules", description = "REST API for SoftwareModule and related Artifact CRUD operations.",
|
||||
extensions = @Extension(name = OpenApi.X_HAWKBIT, properties = @ExtensionProperty(name = "order", value = SOFTWARE_MODULE_ORDER)))
|
||||
public interface MgmtSoftwareModuleRestApi {
|
||||
|
||||
String SOFTWAREMODULES_V1 = MgmtRestConstants.REST_V1 + "/softwaremodules";
|
||||
String REQUEST_PARAMETER_USE_ARTIFACT_URL_HANDLER = "useartifacturlhandler";
|
||||
|
||||
/**
|
||||
* Handles POST request for artifact upload.
|
||||
*
|
||||
@@ -83,10 +89,11 @@ public interface MgmtSoftwareModuleRestApi {
|
||||
content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))),
|
||||
@ApiResponse(responseCode = LOCKED_423, description = "Software module is locked",
|
||||
content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))),
|
||||
@ApiResponse(responseCode = INTERNAL_SERVER_ERROR_500, description = "Upload / store to storage or encryption failed", content = @Content(mediaType = "application/json", schema = @Schema(hidden = true)))
|
||||
@ApiResponse(responseCode = INTERNAL_SERVER_ERROR_500, description = "Upload / store to storage or encryption failed",
|
||||
content = @Content(mediaType = "application/json", schema = @Schema(hidden = true)))
|
||||
})
|
||||
@PostMapping(value = MgmtRestConstants.SOFTWAREMODULE_V1_REQUEST_MAPPING + "/{softwareModuleId}/artifacts",
|
||||
consumes = MediaType.MULTIPART_FORM_DATA_VALUE, produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@PostMapping(value = SOFTWAREMODULES_V1 + "/{softwareModuleId}/artifacts",
|
||||
consumes = MULTIPART_FORM_DATA_VALUE, produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<MgmtArtifact> uploadArtifact(
|
||||
@PathVariable("softwareModuleId") Long softwareModuleId,
|
||||
@RequestPart("file") MultipartFile file,
|
||||
@@ -107,14 +114,14 @@ public interface MgmtSoftwareModuleRestApi {
|
||||
"software module. Required Permission: READ_REPOSITORY")
|
||||
@GetResponses
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(responseCode = GONE_410, description = "Artifact binary no longer exists", content = @Content(mediaType = "application/json", schema = @Schema(hidden = true)))
|
||||
@ApiResponse(responseCode = GONE_410, description = "Artifact binary no longer exists",
|
||||
content = @Content(mediaType = "application/json", schema = @Schema(hidden = true)))
|
||||
})
|
||||
@GetMapping(value = MgmtRestConstants.SOFTWAREMODULE_V1_REQUEST_MAPPING + "/{softwareModuleId}/artifacts",
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = SOFTWAREMODULES_V1 + "/{softwareModuleId}/artifacts", produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<List<MgmtArtifact>> getArtifacts(
|
||||
@PathVariable("softwareModuleId") Long softwareModuleId,
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_REPRESENTATION_MODE, defaultValue = MgmtRestConstants.REQUEST_PARAMETER_REPRESENTATION_MODE_DEFAULT) String representationModeParam,
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_USE_ARTIFACT_URL_HANDLER, required = false) Boolean useArtifactUrlHandler);
|
||||
@RequestParam(value = REQUEST_PARAMETER_USE_ARTIFACT_URL_HANDLER, required = false) Boolean useArtifactUrlHandler);
|
||||
|
||||
/**
|
||||
* Handles the GET request of retrieving a single Artifact metadata request.
|
||||
@@ -123,18 +130,20 @@ public interface MgmtSoftwareModuleRestApi {
|
||||
* @param artifactId of the related artifact
|
||||
* @return responseEntity with status ok if successful
|
||||
*/
|
||||
@Operation(summary = "Return single Artifact metadata", description = "Handles the GET request of retrieving a single Artifact metadata request. Required Permission: READ_REPOSITORY")
|
||||
@Operation(summary = "Return single Artifact metadata",
|
||||
description = "Handles the GET request of retrieving a single Artifact metadata request. Required Permission: READ_REPOSITORY")
|
||||
@GetResponses
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(responseCode = GONE_410, description = "Artifact binary no longer exists", content = @Content(mediaType = "application/json", schema = @Schema(hidden = true)))
|
||||
@ApiResponse(responseCode = GONE_410, description = "Artifact binary no longer exists",
|
||||
content = @Content(mediaType = "application/json", schema = @Schema(hidden = true)))
|
||||
})
|
||||
@GetMapping(value = MgmtRestConstants.SOFTWAREMODULE_V1_REQUEST_MAPPING + "/{softwareModuleId}/artifacts/{artifactId}",
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = SOFTWAREMODULES_V1 + "/{softwareModuleId}/artifacts/{artifactId}",
|
||||
produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
@ResponseBody
|
||||
ResponseEntity<MgmtArtifact> getArtifact(
|
||||
@PathVariable("softwareModuleId") Long softwareModuleId,
|
||||
@PathVariable("artifactId") Long artifactId,
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_USE_ARTIFACT_URL_HANDLER, required = false) Boolean useArtifactUrlHandler);
|
||||
@RequestParam(value = REQUEST_PARAMETER_USE_ARTIFACT_URL_HANDLER, required = false) Boolean useArtifactUrlHandler);
|
||||
|
||||
/**
|
||||
* Handles the DELETE request for a single SoftwareModule.
|
||||
@@ -143,7 +152,8 @@ public interface MgmtSoftwareModuleRestApi {
|
||||
* @param artifactId of the artifact to be deleted
|
||||
* @return status OK if delete as successful.
|
||||
*/
|
||||
@Operation(summary = "Delete artifact by Id", description = "Handles the DELETE request for a single Artifact assigned to a SoftwareModule. Required Permission: DELETE_REPOSITORY")
|
||||
@Operation(summary = "Delete artifact by Id",
|
||||
description = "Handles the DELETE request for a single Artifact assigned to a SoftwareModule. Required Permission: DELETE_REPOSITORY")
|
||||
@DeleteResponses
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(responseCode = LOCKED_423, description = "Software module is locked",
|
||||
@@ -151,7 +161,7 @@ public interface MgmtSoftwareModuleRestApi {
|
||||
@ApiResponse(responseCode = INTERNAL_SERVER_ERROR_500, description = "Artifact delete failed with internal server error",
|
||||
content = @Content(mediaType = "application/json", schema = @Schema(hidden = true)))
|
||||
})
|
||||
@DeleteMapping(value = MgmtRestConstants.SOFTWAREMODULE_V1_REQUEST_MAPPING + "/{softwareModuleId}/artifacts/{artifactId}")
|
||||
@DeleteMapping(value = SOFTWAREMODULES_V1 + "/{softwareModuleId}/artifacts/{artifactId}")
|
||||
@ResponseBody
|
||||
ResponseEntity<Void> deleteArtifact(
|
||||
@PathVariable("softwareModuleId") Long softwareModuleId,
|
||||
@@ -168,32 +178,24 @@ public interface MgmtSoftwareModuleRestApi {
|
||||
* @return a list of all modules for a defined or default page request with status OK. The response is always paged. In any failure the
|
||||
* JsonResponseExceptionHandler is handling the response.
|
||||
*/
|
||||
@Operation(summary = "Return all Software modules", description = "Handles the GET request of retrieving all softwaremodules. Required Permission: READ_REPOSITORY")
|
||||
@Operation(summary = "Return all Software modules",
|
||||
description = "Handles the GET request of retrieving all softwaremodules. Required Permission: READ_REPOSITORY")
|
||||
@GetIfExistResponses
|
||||
@GetMapping(value = MgmtRestConstants.SOFTWAREMODULE_V1_REQUEST_MAPPING,
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = SOFTWAREMODULES_V1, produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<PagedList<MgmtSoftwareModule>> getSoftwareModules(
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SEARCH, required = false)
|
||||
@Schema(description = """
|
||||
Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for
|
||||
available fields.""")
|
||||
@Schema(description = "Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for available fields.")
|
||||
String rsqlParam,
|
||||
@RequestParam(
|
||||
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET,
|
||||
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
||||
@RequestParam(value = REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
||||
@Schema(description = "The paging offset (default is 0)")
|
||||
int pagingOffsetParam,
|
||||
@RequestParam(
|
||||
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_LIMIT,
|
||||
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT)
|
||||
@RequestParam(value = REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT)
|
||||
@Schema(description = "The maximum number of entries in a page (default is 50)")
|
||||
int pagingLimitParam,
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SORTING, required = false)
|
||||
@Schema(description = """
|
||||
The query parameter sort allows to define the sort order for the result of a query. A sort criteria
|
||||
consists of the name of a field and the sort direction (ASC for ascending and DESC descending).
|
||||
The sequence of the sort criteria (multiple can be used) defines the sort order of the entities
|
||||
in the result.""")
|
||||
@Schema(description = "The query parameter sort allows to define the sort order for the result of a query. " +
|
||||
"A sort criteria consists of the name of a field and the sort direction (ASC for ascending and DESC descending)." +
|
||||
"The sequence of the sort criteria (multiple can be used) defines the sort order of the entities in the result.")
|
||||
String sortParam);
|
||||
|
||||
/**
|
||||
@@ -204,8 +206,7 @@ public interface MgmtSoftwareModuleRestApi {
|
||||
*/
|
||||
@Operation(summary = "Return Software Module by id", description = "Handles the GET request of retrieving a single softwaremodule. Required Permission: READ_REPOSITORY")
|
||||
@GetResponses
|
||||
@GetMapping(value = MgmtRestConstants.SOFTWAREMODULE_V1_REQUEST_MAPPING + "/{softwareModuleId}",
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = SOFTWAREMODULES_V1 + "/{softwareModuleId}", produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<MgmtSoftwareModule> getSoftwareModule(@PathVariable("softwareModuleId") Long softwareModuleId);
|
||||
|
||||
/**
|
||||
@@ -215,15 +216,15 @@ public interface MgmtSoftwareModuleRestApi {
|
||||
* @return In case all modules could successful created the ResponseEntity with status code 201 - Created but without ResponseBody. In any
|
||||
* failure the JsonResponseExceptionHandler is handling the response.
|
||||
*/
|
||||
@Operation(summary = "Create Software Module(s)", description = "Handles the POST request of creating new software modules. The request body must always be a list of modules. Required Permission: CREATE_REPOSITORY")
|
||||
@Operation(summary = "Create Software Module(s)",
|
||||
description = "Handles the POST request of creating new software modules. The request body must always be a list of modules. Required Permission: CREATE_REPOSITORY")
|
||||
@PostCreateResponses
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(responseCode = INTERNAL_SERVER_ERROR_500, description = "Artifact encryption failed",
|
||||
content = @Content(mediaType = "application/json", schema = @Schema(hidden = true)))
|
||||
})
|
||||
@PostMapping(value = MgmtRestConstants.SOFTWAREMODULE_V1_REQUEST_MAPPING,
|
||||
consumes = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE },
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@PostMapping(value = SOFTWAREMODULES_V1,
|
||||
consumes = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE }, produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<List<MgmtSoftwareModule>> createSoftwareModules(@RequestBody List<MgmtSoftwareModuleRequestBodyPost> softwareModules);
|
||||
|
||||
/**
|
||||
@@ -233,11 +234,11 @@ public interface MgmtSoftwareModuleRestApi {
|
||||
* @param restSoftwareModule the modules to be updated.
|
||||
* @return status OK if update was successful
|
||||
*/
|
||||
@Operation(summary = "Update Software Module", description = "Handles the PUT request for a single softwaremodule within Hawkbit. Required Permission: UPDATE_REPOSITORY")
|
||||
@Operation(summary = "Update Software Module",
|
||||
description = "Handles the PUT request for a single softwaremodule within Hawkbit. Required Permission: UPDATE_REPOSITORY")
|
||||
@PutResponses
|
||||
@PutMapping(value = MgmtRestConstants.SOFTWAREMODULE_V1_REQUEST_MAPPING + "/{softwareModuleId}",
|
||||
consumes = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE },
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@PutMapping(value = SOFTWAREMODULES_V1 + "/{softwareModuleId}",
|
||||
consumes = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE }, produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<MgmtSoftwareModule> updateSoftwareModule(
|
||||
@PathVariable("softwareModuleId") Long softwareModuleId,
|
||||
@RequestBody MgmtSoftwareModuleRequestBodyPut restSoftwareModule);
|
||||
@@ -248,9 +249,10 @@ public interface MgmtSoftwareModuleRestApi {
|
||||
* @param softwareModuleId the ID of the module to retrieve
|
||||
* @return status OK if delete was successful.
|
||||
*/
|
||||
@Operation(summary = "Delete Software Module by Id", description = "Handles the DELETE request for a single softwaremodule within Hawkbit. Required Permission: DELETE_REPOSITORY")
|
||||
@Operation(summary = "Delete Software Module by Id",
|
||||
description = "Handles the DELETE request for a single softwaremodule within Hawkbit. Required Permission: DELETE_REPOSITORY")
|
||||
@DeleteResponses
|
||||
@DeleteMapping(value = MgmtRestConstants.SOFTWAREMODULE_V1_REQUEST_MAPPING + "/{softwareModuleId}")
|
||||
@DeleteMapping(value = SOFTWAREMODULES_V1 + "/{softwareModuleId}")
|
||||
ResponseEntity<Void> deleteSoftwareModule(@PathVariable("softwareModuleId") Long softwareModuleId);
|
||||
|
||||
/**
|
||||
@@ -260,14 +262,14 @@ public interface MgmtSoftwareModuleRestApi {
|
||||
* @param metadataRest the list of metadata entries to create
|
||||
* @return status created if post request is successful with the value of the created metadata
|
||||
*/
|
||||
@Operation(summary = "Creates a list of metadata for a specific Software Module", description = "Create a list of metadata entries Required Permission: UPDATE_REPOSITORY")
|
||||
@Operation(summary = "Creates a list of metadata for a specific Software Module",
|
||||
description = "Create a list of metadata entries Required Permission: UPDATE_REPOSITORY")
|
||||
@PostCreateResponses
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(responseCode = NOT_FOUND_404, description = "Software Module not found",
|
||||
content = @Content(mediaType = "application/json", schema = @Schema(hidden = true)))
|
||||
})
|
||||
@PostMapping(value = MgmtRestConstants.SOFTWAREMODULE_V1_REQUEST_MAPPING + "/{softwareModuleId}/metadata",
|
||||
consumes = { MediaType.APPLICATION_JSON_VALUE, MediaTypes.HAL_JSON_VALUE })
|
||||
@PostMapping(value = SOFTWAREMODULES_V1 + "/{softwareModuleId}/metadata", consumes = { APPLICATION_JSON_VALUE, HAL_JSON_VALUE })
|
||||
ResponseEntity<Void> createMetadata(@PathVariable("softwareModuleId") Long softwareModuleId,
|
||||
@RequestBody List<MgmtSoftwareModuleMetadata> metadataRest);
|
||||
|
||||
@@ -279,8 +281,7 @@ public interface MgmtSoftwareModuleRestApi {
|
||||
*/
|
||||
@Operation(summary = "Return metadata for a Software Module", description = "Get a paged list of metadata for a software module. Required Permission: READ_REPOSITORY")
|
||||
@GetResponses
|
||||
@GetMapping(value = MgmtRestConstants.SOFTWAREMODULE_V1_REQUEST_MAPPING + "/{softwareModuleId}/metadata",
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = SOFTWAREMODULES_V1 + "/{softwareModuleId}/metadata", produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<PagedList<MgmtSoftwareModuleMetadata>> getMetadata(@PathVariable("softwareModuleId") Long softwareModuleId);
|
||||
|
||||
/**
|
||||
@@ -290,10 +291,11 @@ public interface MgmtSoftwareModuleRestApi {
|
||||
* @param metadataKey the key of the metadata entry to retrieve the value from
|
||||
* @return status OK if get request is successful with the value of the metadata
|
||||
*/
|
||||
@Operation(summary = "Return single metadata value for a specific key of a Software Module", description = "Get a single metadata value for a metadata key. Required Permission: READ_REPOSITORY")
|
||||
@Operation(summary = "Return single metadata value for a specific key of a Software Module",
|
||||
description = "Get a single metadata value for a metadata key. Required Permission: READ_REPOSITORY")
|
||||
@GetResponses
|
||||
@GetMapping(value = MgmtRestConstants.SOFTWAREMODULE_V1_REQUEST_MAPPING + "/{softwareModuleId}/metadata/{metadataKey}",
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = SOFTWAREMODULES_V1 + "/{softwareModuleId}/metadata/{metadataKey}",
|
||||
produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<MgmtSoftwareModuleMetadata> getMetadataValue(
|
||||
@PathVariable("softwareModuleId") Long softwareModuleId,
|
||||
@PathVariable("metadataKey") String metadataKey);
|
||||
@@ -305,9 +307,10 @@ public interface MgmtSoftwareModuleRestApi {
|
||||
* @param metadataKey the key of the metadata to update the value
|
||||
* @param metadata body to update
|
||||
*/
|
||||
@Operation(summary = "Update a single metadata value of a Software Module", description = "Update a single metadata value for speficic key. Required Permission: UPDATE_REPOSITORY")
|
||||
@Operation(summary = "Update a single metadata value of a Software Module",
|
||||
description = "Update a single metadata value for specific key. Required Permission: UPDATE_REPOSITORY")
|
||||
@PutResponses
|
||||
@PutMapping(value = MgmtRestConstants.SOFTWAREMODULE_V1_REQUEST_MAPPING + "/{softwareModuleId}/metadata/{metadataKey}")
|
||||
@PutMapping(value = SOFTWAREMODULES_V1 + "/{softwareModuleId}/metadata/{metadataKey}")
|
||||
ResponseEntity<Void> updateMetadata(
|
||||
@PathVariable("softwareModuleId") Long softwareModuleId,
|
||||
@PathVariable("metadataKey") String metadataKey,
|
||||
@@ -319,9 +322,10 @@ public interface MgmtSoftwareModuleRestApi {
|
||||
* @param softwareModuleId the ID of the software module to delete the metadata entry
|
||||
* @param metadataKey the key of the metadata to delete
|
||||
*/
|
||||
@Operation(summary = "Delete single metadata entry from the software module", description = "Delete a single metadata. Required Permission: UPDATE_REPOSITORY")
|
||||
@Operation(summary = "Delete single metadata entry from the software module",
|
||||
description = "Delete a single metadata. Required Permission: UPDATE_REPOSITORY")
|
||||
@DeleteResponses
|
||||
@DeleteMapping(value = MgmtRestConstants.SOFTWAREMODULE_V1_REQUEST_MAPPING + "/{softwareModuleId}/metadata/{metadataKey}")
|
||||
@DeleteMapping(value = SOFTWAREMODULES_V1 + "/{softwareModuleId}/metadata/{metadataKey}")
|
||||
ResponseEntity<Void> deleteMetadata(@PathVariable("softwareModuleId") Long softwareModuleId,
|
||||
@PathVariable("metadataKey") String metadataKey);
|
||||
}
|
||||
@@ -9,6 +9,10 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.mgmt.rest.api;
|
||||
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_LIMIT;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.SOFTWARE_MODULE_TYPE_ORDER;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.DeleteResponses;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.GetIfExistResponses;
|
||||
@@ -44,15 +48,15 @@ import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
/**
|
||||
* REST Resource handling for SoftwareModule and related Artifact CRUD
|
||||
* operations.
|
||||
* REST API for SoftwareModule and related Artifact CRUD operations.
|
||||
*/
|
||||
// no request mapping specified here to avoid CVE-2021-22044 in Feign client
|
||||
@Tag(
|
||||
name = "Software Module Types", description = "REST API for SoftwareModuleTypes CRUD operations.",
|
||||
@Tag(name = "Software Module Types", description = "REST API for SoftwareModuleTypes CRUD operations.",
|
||||
extensions = @Extension(name = OpenApi.X_HAWKBIT, properties = @ExtensionProperty(name = "order", value = SOFTWARE_MODULE_TYPE_ORDER)))
|
||||
public interface MgmtSoftwareModuleTypeRestApi {
|
||||
|
||||
String SOFTWAREMODULETYPES_V1 = MgmtRestConstants.REST_V1 + "/softwaremoduletypes";
|
||||
|
||||
/**
|
||||
* Handles the GET request of retrieving all SoftwareModuleTypes .
|
||||
*
|
||||
@@ -67,30 +71,21 @@ public interface MgmtSoftwareModuleTypeRestApi {
|
||||
@Operation(summary = "Return all Software Module Types",
|
||||
description = "Handles the GET request of retrieving all software module types. Required Permission: READ_REPOSITORY")
|
||||
@GetIfExistResponses
|
||||
@GetMapping(value = MgmtRestConstants.SOFTWAREMODULETYPE_V1_REQUEST_MAPPING,
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = SOFTWAREMODULETYPES_V1, produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<PagedList<MgmtSoftwareModuleType>> getTypes(
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SEARCH, required = false)
|
||||
@Schema(description = """
|
||||
Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for
|
||||
available fields.""")
|
||||
@Schema(description = "Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for available fields.")
|
||||
String rsqlParam,
|
||||
@RequestParam(
|
||||
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET,
|
||||
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
||||
@RequestParam(value = REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
||||
@Schema(description = "The paging offset (default is 0)")
|
||||
int pagingOffsetParam,
|
||||
@RequestParam(
|
||||
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_LIMIT,
|
||||
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT)
|
||||
@RequestParam(value = REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT)
|
||||
@Schema(description = "The maximum number of entries in a page (default is 50)")
|
||||
int pagingLimitParam,
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SORTING, required = false)
|
||||
@Schema(description = """
|
||||
The query parameter sort allows to define the sort order for the result of a query. A sort criteria
|
||||
consists of the name of a field and the sort direction (ASC for ascending and DESC descending).
|
||||
The sequence of the sort criteria (multiple can be used) defines the sort order of the entities
|
||||
in the result.""")
|
||||
@Schema(description = "The query parameter sort allows to define the sort order for the result of a query. " +
|
||||
"A sort criteria consists of the name of a field and the sort direction (ASC for ascending and DESC descending)." +
|
||||
"The sequence of the sort criteria (multiple can be used) defines the sort order of the entities in the result.")
|
||||
String sortParam);
|
||||
|
||||
/**
|
||||
@@ -102,7 +97,7 @@ public interface MgmtSoftwareModuleTypeRestApi {
|
||||
@Operation(summary = "Return single Software Module Type",
|
||||
description = "Handles the GET request of retrieving a single software module type. Required Permission: READ_REPOSITORY")
|
||||
@GetResponses
|
||||
@GetMapping(value = MgmtRestConstants.SOFTWAREMODULETYPE_V1_REQUEST_MAPPING + "/{softwareModuleTypeId}",
|
||||
@GetMapping(value = SOFTWAREMODULETYPES_V1 + "/{softwareModuleTypeId}",
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<MgmtSoftwareModuleType> getSoftwareModuleType(
|
||||
@PathVariable("softwareModuleTypeId") Long softwareModuleTypeId);
|
||||
@@ -116,7 +111,7 @@ public interface MgmtSoftwareModuleTypeRestApi {
|
||||
@Operation(summary = "Delete Software Module Type by Id",
|
||||
description = "Handles the DELETE request for a single software module type. Required Permission: DELETE_REPOSITORY")
|
||||
@DeleteResponses
|
||||
@DeleteMapping(value = MgmtRestConstants.SOFTWAREMODULETYPE_V1_REQUEST_MAPPING + "/{softwareModuleTypeId}")
|
||||
@DeleteMapping(value = SOFTWAREMODULETYPES_V1 + "/{softwareModuleTypeId}")
|
||||
ResponseEntity<Void> deleteSoftwareModuleType(
|
||||
@PathVariable("softwareModuleTypeId") Long softwareModuleTypeId);
|
||||
|
||||
@@ -130,7 +125,7 @@ public interface MgmtSoftwareModuleTypeRestApi {
|
||||
@Operation(summary = "Update Software Module Type",
|
||||
description = "Handles the PUT request for a single software module type. Required Permission: UPDATE_REPOSITORY")
|
||||
@PutResponses
|
||||
@PutMapping(value = MgmtRestConstants.SOFTWAREMODULETYPE_V1_REQUEST_MAPPING + "/{softwareModuleTypeId}",
|
||||
@PutMapping(value = SOFTWAREMODULETYPES_V1 + "/{softwareModuleTypeId}",
|
||||
consumes = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE },
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<MgmtSoftwareModuleType> updateSoftwareModuleType(
|
||||
@@ -152,7 +147,7 @@ public interface MgmtSoftwareModuleTypeRestApi {
|
||||
@ApiResponse(responseCode = NOT_FOUND_404, description = "Software Module not found",
|
||||
content = @Content(mediaType = "application/json", schema = @Schema(hidden = true)))
|
||||
})
|
||||
@PostMapping(value = MgmtRestConstants.SOFTWAREMODULETYPE_V1_REQUEST_MAPPING,
|
||||
@PostMapping(value = SOFTWAREMODULETYPES_V1,
|
||||
consumes = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE },
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<List<MgmtSoftwareModuleType>> createSoftwareModuleTypes(
|
||||
|
||||
@@ -9,12 +9,20 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.mgmt.rest.api;
|
||||
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_LIMIT;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_REPRESENTATION_MODE;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_REPRESENTATION_MODE_DEFAULT;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.TARGET_FILTER_ORDER;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.DeleteResponses;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.GetIfExistResponses;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.GetResponses;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.PostCreateResponses;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.PutResponses;
|
||||
import static org.springframework.hateoas.MediaTypes.HAL_JSON_VALUE;
|
||||
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.extensions.Extension;
|
||||
@@ -28,8 +36,6 @@ import org.eclipse.hawkbit.mgmt.json.model.targetfilter.MgmtTargetFilterQuery;
|
||||
import org.eclipse.hawkbit.mgmt.json.model.targetfilter.MgmtTargetFilterQueryRequestBody;
|
||||
import org.eclipse.hawkbit.rest.ApiResponsesConstants.PostUpdateResponses;
|
||||
import org.eclipse.hawkbit.rest.OpenApi;
|
||||
import org.springframework.hateoas.MediaTypes;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@@ -40,14 +46,15 @@ import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
/**
|
||||
* Api for handling target operations.
|
||||
* REST API for target operations.
|
||||
*/
|
||||
// no request mapping specified here to avoid CVE-2021-22044 in Feign client
|
||||
@Tag(
|
||||
name = "Target Filter Queries", description = "REST API for Target Filter Queries CRUD operations.",
|
||||
@Tag(name = "Target Filter Queries", description = "REST API for Target Filter Queries CRUD operations.",
|
||||
extensions = @Extension(name = OpenApi.X_HAWKBIT, properties = @ExtensionProperty(name = "order", value = TARGET_FILTER_ORDER)))
|
||||
public interface MgmtTargetFilterQueryRestApi {
|
||||
|
||||
String TARGETFILTERS_V1 = MgmtRestConstants.REST_V1 + "/targetfilters";
|
||||
|
||||
/**
|
||||
* Handles the GET request of retrieving a single target filter.
|
||||
*
|
||||
@@ -55,11 +62,10 @@ public interface MgmtTargetFilterQueryRestApi {
|
||||
* @return a single target with status OK.
|
||||
*/
|
||||
|
||||
@Operation(summary = "Return target filter query by id", description = "Handles the GET request of retrieving a " +
|
||||
"single target filter query. Required permission: READ_TARGET")
|
||||
@Operation(summary = "Return target filter query by id",
|
||||
description = "Handles the GET request of retrieving a single target filter query. Required permission: READ_TARGET")
|
||||
@GetResponses
|
||||
@GetMapping(value = MgmtRestConstants.TARGET_FILTER_V1_REQUEST_MAPPING + "/{filterId}",
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = TARGETFILTERS_V1 + "/{filterId}", produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<MgmtTargetFilterQuery> getFilter(@PathVariable("filterId") Long filterId);
|
||||
|
||||
/**
|
||||
@@ -73,34 +79,27 @@ public interface MgmtTargetFilterQueryRestApi {
|
||||
* @return a list of all targets for a defined or default page reque status OK. The response is always paged. In any failure the
|
||||
* JsonResponseExceptionHandler is handling the response.
|
||||
*/
|
||||
@Operation(summary = "Return all target filter queries", description = "Handles the GET request of retrieving all target filter queries. Required permission: READ_TARGET")
|
||||
@Operation(summary = "Return all target filter queries",
|
||||
description = "Handles the GET request of retrieving all target filter queries. Required permission: READ_TARGET")
|
||||
@GetIfExistResponses
|
||||
@GetMapping(value = MgmtRestConstants.TARGET_FILTER_V1_REQUEST_MAPPING,
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = TARGETFILTERS_V1, produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<PagedList<MgmtTargetFilterQuery>> getFilters(
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SEARCH, required = false)
|
||||
@Schema(description = """
|
||||
Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for
|
||||
available fields.""")
|
||||
@Schema(description = "Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for available fields.")
|
||||
String rsqlParam,
|
||||
@RequestParam(
|
||||
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET,
|
||||
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
||||
@RequestParam(value = REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
||||
@Schema(description = "The paging offset (default is 0)")
|
||||
int pagingOffsetParam,
|
||||
@RequestParam(
|
||||
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_LIMIT,
|
||||
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT)
|
||||
@RequestParam(value = REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT)
|
||||
@Schema(description = "The maximum number of entries in a page (default is 50)")
|
||||
int pagingLimitParam,
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SORTING, required = false)
|
||||
@Schema(description = """
|
||||
The query parameter sort allows to define the sort order for the result of a query. A sort criteria
|
||||
consists of the name of a field and the sort direction (ASC for ascending and DESC descending).
|
||||
The sequence of the sort criteria (multiple can be used) defines the sort order of the entities
|
||||
in the result.""")
|
||||
@Schema(description = "The query parameter sort allows to define the sort order for the result of a query. " +
|
||||
"A sort criteria consists of the name of a field and the sort direction (ASC for ascending and DESC descending)." +
|
||||
"The sequence of the sort criteria (multiple can be used) defines the sort order of the entities in the result.")
|
||||
String sortParam,
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_REPRESENTATION_MODE, defaultValue = MgmtRestConstants.REQUEST_PARAMETER_REPRESENTATION_MODE_DEFAULT) String representationModeParam);
|
||||
@RequestParam(value = REQUEST_PARAMETER_REPRESENTATION_MODE, defaultValue = REQUEST_PARAMETER_REPRESENTATION_MODE_DEFAULT)
|
||||
String representationModeParam);
|
||||
|
||||
/**
|
||||
* Handles the POST request of creating new target filters. The request body must always be a list of target filters.
|
||||
@@ -109,11 +108,11 @@ public interface MgmtTargetFilterQueryRestApi {
|
||||
* @return In case all filters were successfully created the ResponseEntity with status code 201 with a list of successfully created entities
|
||||
* is returned. In any failure the JsonResponseExceptionHandler is handling the response.
|
||||
*/
|
||||
@Operation(summary = "Create target filter", description = "Handles the POST request to create a new target filter query. Required permission: CREATE_TARGET")
|
||||
@Operation(summary = "Create target filter",
|
||||
description = "Handles the POST request to create a new target filter query. Required permission: CREATE_TARGET")
|
||||
@PostCreateResponses
|
||||
@PostMapping(value = MgmtRestConstants.TARGET_FILTER_V1_REQUEST_MAPPING,
|
||||
consumes = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE },
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@PostMapping(value = TARGETFILTERS_V1,
|
||||
consumes = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE }, produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<MgmtTargetFilterQuery> createFilter(
|
||||
@RequestBody MgmtTargetFilterQueryRequestBody filter);
|
||||
|
||||
@@ -128,9 +127,8 @@ public interface MgmtTargetFilterQueryRestApi {
|
||||
*/
|
||||
@Operation(summary = "Updates target filter query by id", description = "Handles the PUT request of updating a target filter query. Required permission: UPDATE_TARGET")
|
||||
@PutResponses
|
||||
@PutMapping(value = MgmtRestConstants.TARGET_FILTER_V1_REQUEST_MAPPING + "/{filterId}", consumes = {
|
||||
MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE }, produces = { MediaTypes.HAL_JSON_VALUE,
|
||||
MediaType.APPLICATION_JSON_VALUE })
|
||||
@PutMapping(value = TARGETFILTERS_V1 + "/{filterId}",
|
||||
consumes = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE }, produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<MgmtTargetFilterQuery> updateFilter(
|
||||
@PathVariable("filterId") Long filterId,
|
||||
@RequestBody MgmtTargetFilterQueryRequestBody targetFilterRest);
|
||||
@@ -144,8 +142,7 @@ public interface MgmtTargetFilterQueryRestApi {
|
||||
*/
|
||||
@Operation(summary = "Delete target filter by id", description = "Handles the DELETE request of deleting a target filter query. Required permission: DELETE_TARGET")
|
||||
@DeleteResponses
|
||||
@DeleteMapping(value = MgmtRestConstants.TARGET_FILTER_V1_REQUEST_MAPPING + "/{filterId}",
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@DeleteMapping(value = TARGETFILTERS_V1 + "/{filterId}", produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<Void> deleteFilter(@PathVariable("filterId") Long filterId);
|
||||
|
||||
/**
|
||||
@@ -156,8 +153,7 @@ public interface MgmtTargetFilterQueryRestApi {
|
||||
*/
|
||||
@Operation(summary = "Return distribution set for auto assignment of a specific target filter", description = "Handles the GET request of retrieving the auto assign distribution set. Required permission: READ_TARGET")
|
||||
@GetIfExistResponses
|
||||
@GetMapping(value = MgmtRestConstants.TARGET_FILTER_V1_REQUEST_MAPPING + "/{filterId}/autoAssignDS",
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = TARGETFILTERS_V1 + "/{filterId}/autoAssignDS", produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<MgmtDistributionSet> getAssignedDistributionSet(@PathVariable("filterId") Long filterId);
|
||||
|
||||
/**
|
||||
@@ -171,9 +167,8 @@ public interface MgmtTargetFilterQueryRestApi {
|
||||
description = "Handles the POST request of setting the auto assign distribution set for a target filter " +
|
||||
"query. Required permissions: UPDATE_TARGET and READ_REPOSITORY")
|
||||
@PostUpdateResponses
|
||||
@PostMapping(value = MgmtRestConstants.TARGET_FILTER_V1_REQUEST_MAPPING + "/{filterId}/autoAssignDS",
|
||||
consumes = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE },
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@PostMapping(value = TARGETFILTERS_V1 + "/{filterId}/autoAssignDS",
|
||||
consumes = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE }, produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<MgmtTargetFilterQuery> postAssignedDistributionSet(
|
||||
@PathVariable("filterId") Long filterId,
|
||||
@RequestBody MgmtDistributionSetAutoAssignment autoAssignRequest);
|
||||
@@ -188,6 +183,6 @@ public interface MgmtTargetFilterQueryRestApi {
|
||||
description = "Removes the auto assign distribution set from the target filter query. " +
|
||||
"Required permission: UPDATE_TARGET")
|
||||
@DeleteResponses
|
||||
@DeleteMapping(value = MgmtRestConstants.TARGET_FILTER_V1_REQUEST_MAPPING + "/{filterId}/autoAssignDS")
|
||||
@DeleteMapping(value = TARGETFILTERS_V1 + "/{filterId}/autoAssignDS")
|
||||
ResponseEntity<Void> deleteAssignedDistributionSet(@PathVariable("filterId") Long filterId);
|
||||
}
|
||||
@@ -9,10 +9,16 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.mgmt.rest.api;
|
||||
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_LIMIT;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.TARGET_GROUP_ORDER;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.DeleteResponses;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.GetIfExistResponses;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.PutNoContentResponses;
|
||||
import static org.springframework.hateoas.MediaTypes.HAL_JSON_VALUE;
|
||||
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -24,8 +30,6 @@ import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.eclipse.hawkbit.mgmt.json.model.PagedList;
|
||||
import org.eclipse.hawkbit.mgmt.json.model.target.MgmtTarget;
|
||||
import org.eclipse.hawkbit.rest.OpenApi;
|
||||
import org.springframework.hateoas.MediaTypes;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@@ -34,11 +38,12 @@ import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
@Tag(
|
||||
name = "Target Groups", description = "REST API for Target Groups operations.",
|
||||
@Tag(name = "Target Groups", description = "REST API for Target Groups operations.",
|
||||
extensions = @Extension(name = OpenApi.X_HAWKBIT, properties = @ExtensionProperty(name = "order", value = TARGET_GROUP_ORDER)))
|
||||
public interface MgmtTargetGroupRestApi {
|
||||
|
||||
String TARGETGROUPS_V1 = MgmtRestConstants.REST_V1 + "/targetgroups";
|
||||
|
||||
/**
|
||||
* Handles the GET request of retrieving a list of assigned targets for a specific group. Complex grouping (subgroups) not supported here.
|
||||
* For complex grouping use the analogical resource with query parameter for target group.
|
||||
@@ -55,28 +60,21 @@ public interface MgmtTargetGroupRestApi {
|
||||
description = "Handles the GET request of retrieving a list of assigned targets for a specific group. Complex grouping (subgroups) not supported here." +
|
||||
"For complex grouping use the analogical resource with query parameter for target group.")
|
||||
@GetIfExistResponses
|
||||
@GetMapping(value = MgmtRestConstants.TARGET_GROUP_V1_REQUEST_MAPPING + MgmtRestConstants.GROUP_ASSIGNED,
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = TARGETGROUPS_V1 + "/{group}/assigned", produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<PagedList<MgmtTarget>> getAssignedTargets(
|
||||
@PathVariable
|
||||
@Schema(description = "The target group of the targets")
|
||||
String group,
|
||||
@RequestParam(
|
||||
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET,
|
||||
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
||||
@RequestParam(value = REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
||||
@Schema(description = "The paging offset (default is 0)")
|
||||
int pagingOffsetParam,
|
||||
@RequestParam(
|
||||
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_LIMIT,
|
||||
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT)
|
||||
@RequestParam(value = REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT)
|
||||
@Schema(description = "The maximum number of entries in a page (default is 50)")
|
||||
int pagingLimitParam,
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SORTING, required = false)
|
||||
@Schema(description = """
|
||||
The query parameter sort allows to define the sort order for the result of a query. A sort criteria
|
||||
consists of the name of a field and the sort direction (ASC for ascending and DESC descending).
|
||||
The sequence of the sort criteria (multiple can be used) defines the sort order of the entities
|
||||
in the result.""")
|
||||
@Schema(description = "The query parameter sort allows to define the sort order for the result of a query. " +
|
||||
"A sort criteria consists of the name of a field and the sort direction (ASC for ascending and DESC descending)." +
|
||||
"The sequence of the sort criteria (multiple can be used) defines the sort order of the entities in the result.")
|
||||
String sortParam
|
||||
);
|
||||
|
||||
@@ -97,7 +95,7 @@ public interface MgmtTargetGroupRestApi {
|
||||
description = "Handles the GET request of retrieving a list of assigned targets for a specific group. Complex grouping (subgroups) is supported here." +
|
||||
"Search could be for specific group, complex group e.g Parent/Child or also for groups including its subgroups")
|
||||
@GetIfExistResponses
|
||||
@GetMapping(value = MgmtRestConstants.TARGET_GROUP_V1_REQUEST_MAPPING + "/assigned")
|
||||
@GetMapping(value = TARGETGROUPS_V1 + "/assigned")
|
||||
ResponseEntity<PagedList<MgmtTarget>> getAssignedTargetsWithSubgroups(
|
||||
@RequestParam(value = "group")
|
||||
@Schema(description = "Target Group or Filter based on target groups. ")
|
||||
@@ -105,22 +103,16 @@ public interface MgmtTargetGroupRestApi {
|
||||
@RequestParam(value = "subgroups", defaultValue = "false")
|
||||
@Schema(description = " Possibility to search for subgroups with wildcard or not - e.g. ParentGroup/*")
|
||||
boolean subgroups,
|
||||
@RequestParam(
|
||||
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET,
|
||||
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
||||
@RequestParam(value = REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
||||
@Schema(description = "The paging offset (default is 0)")
|
||||
int pagingOffsetParam,
|
||||
@RequestParam(
|
||||
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_LIMIT,
|
||||
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT)
|
||||
@RequestParam(value = REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT)
|
||||
@Schema(description = "The maximum number of entries in a page (default is 50)")
|
||||
int pagingLimitParam,
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SORTING, required = false)
|
||||
@Schema(description = """
|
||||
The query parameter sort allows to define the sort order for the result of a query. A sort criteria
|
||||
consists of the name of a field and the sort direction (ASC for ascending and DESC descending).
|
||||
The sequence of the sort criteria (multiple can be used) defines the sort order of the entities
|
||||
in the result.""")
|
||||
@Schema(description = "The query parameter sort allows to define the sort order for the result of a query. " +
|
||||
"A sort criteria consists of the name of a field and the sort direction (ASC for ascending and DESC descending)." +
|
||||
"The sequence of the sort criteria (multiple can be used) defines the sort order of the entities in the result.")
|
||||
String sortParam
|
||||
);
|
||||
|
||||
@@ -136,7 +128,7 @@ public interface MgmtTargetGroupRestApi {
|
||||
description = "Handles the POST request of target assignment. Already assigned target will be ignored. " +
|
||||
"For complex groups use analogical method with query parameters.")
|
||||
@PutNoContentResponses
|
||||
@PutMapping(value = MgmtRestConstants.TARGET_GROUP_V1_REQUEST_MAPPING + "/assigned")
|
||||
@PutMapping(value = TARGETGROUPS_V1 + "/assigned")
|
||||
ResponseEntity<Void> assignTargetsToGroupWithSubgroups(
|
||||
@RequestParam("group")
|
||||
@Schema(description = "The target group to be set. Sub-grouping is allowed here - '/' could be used for subgroups") String group,
|
||||
@@ -154,7 +146,7 @@ public interface MgmtTargetGroupRestApi {
|
||||
description = "Handles the PUT request of target assignment." +
|
||||
"Subgroups are NOT allowed here - e.g. Parent/Child")
|
||||
@PutNoContentResponses
|
||||
@PutMapping(value = MgmtRestConstants.TARGET_GROUP_V1_REQUEST_MAPPING + MgmtRestConstants.GROUP_ASSIGNED)
|
||||
@PutMapping(value = TARGETGROUPS_V1 + "/{group}/assigned")
|
||||
ResponseEntity<Void> assignTargetsToGroup(
|
||||
@PathVariable(value = "group")
|
||||
@Schema(description = "The target group to be set. Sub-grouping not allowed here, for sub-grouping use the analogical method with query parameter.")
|
||||
@@ -173,17 +165,14 @@ public interface MgmtTargetGroupRestApi {
|
||||
*
|
||||
*/
|
||||
@Operation(summary = "Assign target(s) to given group by rsql",
|
||||
description = "Handles the PUT request of target group assignment." +
|
||||
"Subgroups are NOT allowed here - e.g. Parent/Child")
|
||||
description = "Handles the PUT request of target group assignment. Subgroups are NOT allowed here - e.g. Parent/Child")
|
||||
@PutNoContentResponses
|
||||
@PutMapping(value = MgmtRestConstants.TARGET_GROUP_V1_REQUEST_MAPPING + "/{group}")
|
||||
@PutMapping(value = TARGETGROUPS_V1 + "/{group}")
|
||||
ResponseEntity<Void> assignTargetsToGroupWithRsql(
|
||||
@PathVariable
|
||||
String group,
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SEARCH)
|
||||
@Schema(description = """
|
||||
Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for
|
||||
available fields.""")
|
||||
@Schema(description = "Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for available fields.")
|
||||
String rsql
|
||||
);
|
||||
|
||||
@@ -195,7 +184,7 @@ public interface MgmtTargetGroupRestApi {
|
||||
@Operation(summary = "Unassign targets from their target groups",
|
||||
description = "Handles the DELETE request to unassign the given target(s).")
|
||||
@DeleteResponses
|
||||
@DeleteMapping(value = MgmtRestConstants.TARGET_GROUP_V1_REQUEST_MAPPING + "/assigned")
|
||||
@DeleteMapping(value = TARGETGROUPS_V1 + "/assigned")
|
||||
ResponseEntity<Void> unassignTargetsFromGroup(
|
||||
@RequestBody(required = false)
|
||||
@Schema(description = "List of controller ids to be unassigned from their groups", example = "[\"controllerId1\", \"controllerId2\"]")
|
||||
@@ -210,12 +199,10 @@ public interface MgmtTargetGroupRestApi {
|
||||
@Operation(summary = "Unassign targets from their target groups by filter",
|
||||
description = "Handles the DELETE request to unassign targets by RSQL filter.")
|
||||
@DeleteResponses
|
||||
@DeleteMapping(value = MgmtRestConstants.TARGET_GROUP_V1_REQUEST_MAPPING)
|
||||
@DeleteMapping(value = TARGETGROUPS_V1)
|
||||
ResponseEntity<Void> unassignTargetsFromGroupByRsql(
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SEARCH, required = false)
|
||||
@Schema(description = """
|
||||
Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for
|
||||
available fields.""")
|
||||
@Schema(description = "Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for available fields.")
|
||||
String rsql
|
||||
);
|
||||
|
||||
@@ -226,8 +213,7 @@ public interface MgmtTargetGroupRestApi {
|
||||
@Operation(summary = "Return all assigned target groups",
|
||||
description = "Handles the GET request of retrieving a list of all target groups.")
|
||||
@GetIfExistResponses
|
||||
@GetMapping(value = MgmtRestConstants.TARGET_GROUP_V1_REQUEST_MAPPING,
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = TARGETGROUPS_V1, produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<List<String>> getTargetGroups();
|
||||
|
||||
/**
|
||||
@@ -240,14 +226,12 @@ public interface MgmtTargetGroupRestApi {
|
||||
description = "Assign targets matching a rsql filter to a provided target group" +
|
||||
"Subgroups are allowed - e.g. Parent/Child")
|
||||
@PutNoContentResponses
|
||||
@PutMapping(value = MgmtRestConstants.TARGET_GROUP_V1_REQUEST_MAPPING)
|
||||
@PutMapping(value = TARGETGROUPS_V1)
|
||||
ResponseEntity<Void> assignTargetsToGroup(
|
||||
@RequestParam(name = "group")
|
||||
@Schema(description = "The target group to be set. Sub-grouping is allowed here - '/' could be used for subgroups")
|
||||
String group,
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SEARCH)
|
||||
@Schema(description = """
|
||||
Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for
|
||||
available fields.""")
|
||||
@Schema(description = "Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for available fields.")
|
||||
String rsqlParam);
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,10 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.mgmt.rest.api;
|
||||
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_LIMIT;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.TARGET_ORDER;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.DeleteResponses;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.GONE_410;
|
||||
@@ -19,6 +23,8 @@ import static org.eclipse.hawkbit.rest.ApiResponsesConstants.NOT_FOUND_404;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.PostCreateResponses;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.PutNoContentResponses;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.PutResponses;
|
||||
import static org.springframework.hateoas.MediaTypes.HAL_JSON_VALUE;
|
||||
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -52,8 +58,6 @@ import org.eclipse.hawkbit.mgmt.json.model.target.MgmtTargetRequestBody;
|
||||
import org.eclipse.hawkbit.rest.ApiResponsesConstants.PostUpdateNoContentResponses;
|
||||
import org.eclipse.hawkbit.rest.ApiResponsesConstants.PostUpdateResponses;
|
||||
import org.eclipse.hawkbit.rest.OpenApi;
|
||||
import org.springframework.hateoas.MediaTypes;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@@ -72,6 +76,9 @@ import org.springframework.web.bind.annotation.RequestParam;
|
||||
extensions = @Extension(name = OpenApi.X_HAWKBIT, properties = @ExtensionProperty(name = "order", value = TARGET_ORDER)))
|
||||
public interface MgmtTargetRestApi {
|
||||
|
||||
String TARGETS_V1 = MgmtRestConstants.REST_V1 + "/targets";
|
||||
String TARGET_ID_TARGETTYPE = "/{targetId}/targettype";
|
||||
|
||||
/**
|
||||
* Handles the GET request of retrieving a single target.
|
||||
*
|
||||
@@ -81,8 +88,7 @@ public interface MgmtTargetRestApi {
|
||||
@Operation(summary = "Return target by id", description = "Handles the GET request of retrieving a single target. " +
|
||||
"Required Permission: READ_TARGET.")
|
||||
@GetResponses
|
||||
@GetMapping(value = MgmtRestConstants.TARGET_V1_REQUEST_MAPPING + "/{targetId}",
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = TARGETS_V1 + "/{targetId}", produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<MgmtTarget> getTarget(@PathVariable("targetId") String targetId);
|
||||
|
||||
/**
|
||||
@@ -98,30 +104,21 @@ public interface MgmtTargetRestApi {
|
||||
*/
|
||||
@Operation(summary = "Return all targets", description = "Handles the GET request of retrieving all targets. Required permission: READ_TARGET")
|
||||
@GetIfExistResponses
|
||||
@GetMapping(value = MgmtRestConstants.TARGET_V1_REQUEST_MAPPING,
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = TARGETS_V1, produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<PagedList<MgmtTarget>> getTargets(
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SEARCH, required = false)
|
||||
@Schema(description = """
|
||||
Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for
|
||||
available fields.""")
|
||||
@Schema(description = "Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for available fields.")
|
||||
String rsqlParam,
|
||||
@RequestParam(
|
||||
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET,
|
||||
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
||||
@RequestParam(value = REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
||||
@Schema(description = "The paging offset (default is 0)")
|
||||
int pagingOffsetParam,
|
||||
@RequestParam(
|
||||
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_LIMIT,
|
||||
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT)
|
||||
@RequestParam(value = REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT)
|
||||
@Schema(description = "The maximum number of entries in a page (default is 50)")
|
||||
int pagingLimitParam,
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SORTING, required = false)
|
||||
@Schema(description = """
|
||||
The query parameter sort allows to define the sort order for the result of a query. A sort criteria
|
||||
consists of the name of a field and the sort direction (ASC for ascending and DESC descending).
|
||||
The sequence of the sort criteria (multiple can be used) defines the sort order of the entities
|
||||
in the result.""")
|
||||
@Schema(description = "The query parameter sort allows to define the sort order for the result of a query. " +
|
||||
"A sort criteria consists of the name of a field and the sort direction (ASC for ascending and DESC descending)." +
|
||||
"The sequence of the sort criteria (multiple can be used) defines the sort order of the entities in the result.")
|
||||
String sortParam);
|
||||
|
||||
/**
|
||||
@@ -133,9 +130,8 @@ public interface MgmtTargetRestApi {
|
||||
*/
|
||||
@Operation(summary = "Create target(s)", description = "Handles the POST request of creating new targets. The request body must always be a list of targets. Required Permission: CREATE_TARGET")
|
||||
@PostCreateResponses
|
||||
@PostMapping(value = MgmtRestConstants.TARGET_V1_REQUEST_MAPPING,
|
||||
consumes = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE },
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@PostMapping(value = TARGETS_V1,
|
||||
consumes = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE }, produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<List<MgmtTarget>> createTargets(@RequestBody List<MgmtTargetRequestBody> targets);
|
||||
|
||||
/**
|
||||
@@ -149,9 +145,8 @@ public interface MgmtTargetRestApi {
|
||||
*/
|
||||
@Operation(summary = "Update target by id", description = "Handles the PUT request of updating a target. Required Permission: UPDATE_TARGET")
|
||||
@PutResponses
|
||||
@PutMapping(value = MgmtRestConstants.TARGET_V1_REQUEST_MAPPING + "/{targetId}",
|
||||
consumes = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE },
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@PutMapping(value = TARGETS_V1 + "/{targetId}",
|
||||
consumes = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE }, produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<MgmtTarget> updateTarget(
|
||||
@PathVariable("targetId") String targetId,
|
||||
@RequestBody MgmtTargetRequestBody targetRest);
|
||||
@@ -165,7 +160,7 @@ public interface MgmtTargetRestApi {
|
||||
*/
|
||||
@Operation(summary = "Delete target by id", description = "Handles the DELETE request of deleting a single target. Required Permission: DELETE_TARGET")
|
||||
@DeleteResponses
|
||||
@DeleteMapping(value = MgmtRestConstants.TARGET_V1_REQUEST_MAPPING + "/{targetId}")
|
||||
@DeleteMapping(value = TARGETS_V1 + "/{targetId}")
|
||||
ResponseEntity<Void> deleteTarget(@PathVariable("targetId") String targetId);
|
||||
|
||||
/**
|
||||
@@ -177,7 +172,7 @@ public interface MgmtTargetRestApi {
|
||||
*/
|
||||
@Operation(summary = "Unassign target type from target.", description = "Remove the target type from a target. The target type will be set to null. Required permission: UPDATE_TARGET")
|
||||
@DeleteResponses
|
||||
@DeleteMapping(value = MgmtRestConstants.TARGET_V1_REQUEST_MAPPING + MgmtRestConstants.TARGET_TARGET_ID_TARGETTYPE)
|
||||
@DeleteMapping(value = TARGETS_V1 + TARGET_ID_TARGETTYPE)
|
||||
ResponseEntity<Void> unassignTargetType(@PathVariable("targetId") String targetId);
|
||||
|
||||
/**
|
||||
@@ -190,8 +185,7 @@ public interface MgmtTargetRestApi {
|
||||
*/
|
||||
@Operation(summary = "Assign target type to a target", description = "Assign or update the target type of a target. Required permission: UPDATE_TARGET")
|
||||
@PostUpdateNoContentResponses
|
||||
@PostMapping(value = MgmtRestConstants.TARGET_V1_REQUEST_MAPPING + MgmtRestConstants.TARGET_TARGET_ID_TARGETTYPE,
|
||||
consumes = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@PostMapping(value = TARGETS_V1 + TARGET_ID_TARGETTYPE, consumes = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<Void> assignTargetType(@PathVariable("targetId") String targetId, @RequestBody MgmtId targetTypeId);
|
||||
|
||||
/**
|
||||
@@ -202,8 +196,7 @@ public interface MgmtTargetRestApi {
|
||||
*/
|
||||
@Operation(summary = "Return attributes of a specific target", description = "Handles the GET request of retrieving the attributes of a specific target. Reponse is a key/value list. Required Permission: READ_TARGET")
|
||||
@GetResponses
|
||||
@GetMapping(value = MgmtRestConstants.TARGET_V1_REQUEST_MAPPING + "/{targetId}/attributes",
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = TARGETS_V1 + "/{targetId}/attributes", produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<MgmtTargetAttributes> getAttributes(@PathVariable("targetId") String targetId);
|
||||
|
||||
/**
|
||||
@@ -220,31 +213,22 @@ public interface MgmtTargetRestApi {
|
||||
*/
|
||||
@Operation(summary = "Return actions for a specific target", description = "Handles the GET request of retrieving the full action history of a specific target. Required Permission: READ_TARGET")
|
||||
@GetResponses
|
||||
@GetMapping(value = MgmtRestConstants.TARGET_V1_REQUEST_MAPPING + "/{targetId}/actions",
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = TARGETS_V1 + "/{targetId}/actions", produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<PagedList<MgmtAction>> getActionHistory(
|
||||
@PathVariable("targetId") String targetId,
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SEARCH, required = false)
|
||||
@Schema(description = """
|
||||
Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for
|
||||
available fields.""")
|
||||
@Schema(description = "Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for available fields.")
|
||||
String rsqlParam,
|
||||
@RequestParam(
|
||||
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET,
|
||||
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
||||
@RequestParam(value = REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
||||
@Schema(description = "The paging offset (default is 0)")
|
||||
int pagingOffsetParam,
|
||||
@RequestParam(
|
||||
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_LIMIT,
|
||||
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT)
|
||||
@RequestParam(value = REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT)
|
||||
@Schema(description = "The maximum number of entries in a page (default is 50)")
|
||||
int pagingLimitParam,
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SORTING, required = false)
|
||||
@Schema(description = """
|
||||
The query parameter sort allows to define the sort order for the result of a query. A sort criteria
|
||||
consists of the name of a field and the sort direction (ASC for ascending and DESC descending).
|
||||
The sequence of the sort criteria (multiple can be used) defines the sort order of the entities
|
||||
in the result.""")
|
||||
@Schema(description = "The query parameter sort allows to define the sort order for the result of a query. " +
|
||||
"A sort criteria consists of the name of a field and the sort direction (ASC for ascending and DESC descending)." +
|
||||
"The sequence of the sort criteria (multiple can be used) defines the sort order of the entities in the result.")
|
||||
String sortParam);
|
||||
|
||||
/**
|
||||
@@ -258,8 +242,7 @@ public interface MgmtTargetRestApi {
|
||||
*/
|
||||
@Operation(summary = "Deletes all actions for the provided target EXCEPT the latest N actions OR by provided action IDs list.", description = "Deletes/Purges the action history of the target except the last N actions OR deletes only the actions in the provided action ids list. Required Permission: DELETE_REPOSITORY")
|
||||
@DeleteResponses
|
||||
@DeleteMapping(value = MgmtRestConstants.TARGET_V1_REQUEST_MAPPING + "/{targetId}/actions",
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@DeleteMapping(value = TARGETS_V1 + "/{targetId}/actions", produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<Void> deleteActionsForTarget(
|
||||
@PathVariable("targetId") String targetId,
|
||||
@RequestParam(name = "keepLast", required = false, defaultValue = "-1") int keepLast,
|
||||
@@ -273,10 +256,10 @@ public interface MgmtTargetRestApi {
|
||||
* @param actionId to load
|
||||
* @return the action
|
||||
*/
|
||||
@Operation(summary = "Return action by id of a specific target", description = "Handles the GET request of retrieving a specific action on a specific target. Required Permission: READ_TARGET")
|
||||
@Operation(summary = "Return action by id of a specific target",
|
||||
description = "Handles the GET request of retrieving a specific action on a specific target. Required Permission: READ_TARGET")
|
||||
@GetResponses
|
||||
@GetMapping(value = MgmtRestConstants.TARGET_V1_REQUEST_MAPPING + "/{targetId}/actions/{actionId}",
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = TARGETS_V1 + "/{targetId}/actions/{actionId}", produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<MgmtAction> getAction(
|
||||
@PathVariable("targetId") String targetId,
|
||||
@PathVariable("actionId") Long actionId);
|
||||
@@ -289,12 +272,14 @@ public interface MgmtTargetRestApi {
|
||||
* @param force optional parameter, which indicates a force cancel
|
||||
* @return status no content in case cancellation was successful
|
||||
*/
|
||||
@Operation(summary = "Cancel action for a specific target", description = "Cancels an active action, only active actions can be deleted. Required Permission: UPDATE_TARGET")
|
||||
@Operation(summary = "Cancel action for a specific target",
|
||||
description = "Cancels an active action, only active actions can be deleted. Required Permission: UPDATE_TARGET")
|
||||
@DeleteResponses
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(responseCode = METHOD_NOT_ALLOWED_405, description = "Software module is locked", content = @Content(mediaType = "application/json", schema = @Schema(hidden = true)))
|
||||
@ApiResponse(responseCode = METHOD_NOT_ALLOWED_405, description = "Software module is locked",
|
||||
content = @Content(mediaType = "application/json", schema = @Schema(hidden = true)))
|
||||
})
|
||||
@DeleteMapping(value = MgmtRestConstants.TARGET_V1_REQUEST_MAPPING + "/{targetId}/actions/{actionId}")
|
||||
@DeleteMapping(value = TARGETS_V1 + "/{targetId}/actions/{actionId}")
|
||||
ResponseEntity<Void> cancelAction(
|
||||
@PathVariable("targetId") String targetId,
|
||||
@PathVariable("actionId") Long actionId,
|
||||
@@ -310,9 +295,8 @@ public interface MgmtTargetRestApi {
|
||||
*/
|
||||
@Operation(summary = "Switch an action from soft to forced", description = "Handles the PUT request to switch an action from soft to forced. Required Permission: UPDATE_TARGET.")
|
||||
@PutResponses
|
||||
@PutMapping(value = MgmtRestConstants.TARGET_V1_REQUEST_MAPPING + "/{targetId}/actions/{actionId}",
|
||||
consumes = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE },
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@PutMapping(value = TARGETS_V1 + "/{targetId}/actions/{actionId}",
|
||||
consumes = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE }, produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<MgmtAction> updateAction(
|
||||
@PathVariable("targetId") String targetId,
|
||||
@PathVariable("actionId") Long actionId,
|
||||
@@ -332,9 +316,9 @@ public interface MgmtTargetRestApi {
|
||||
@ApiResponse(responseCode = GONE_410, description = "Action is not active anymore.",
|
||||
content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))),
|
||||
})
|
||||
@PutMapping(value = MgmtRestConstants.TARGET_V1_REQUEST_MAPPING + "/{targetId}/actions/{actionId}/confirmation",
|
||||
consumes = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE },
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@PutMapping(value = TARGETS_V1 + "/{targetId}/actions/{actionId}/confirmation",
|
||||
consumes = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE },
|
||||
produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<Void> updateActionConfirmation(
|
||||
@PathVariable("targetId") String targetId,
|
||||
@PathVariable("actionId") Long actionId,
|
||||
@@ -352,16 +336,20 @@ public interface MgmtTargetRestApi {
|
||||
* @return a list of all ActionStatus for a defined or default page request with status OK. The response is always paged. In any failure the
|
||||
* JsonResponseExceptionHandler is handling the response.
|
||||
*/
|
||||
@Operation(summary = "Return status of a specific action on a specific target", description = "Handles the GET request of retrieving a specific action on a specific target. Required Permission: READ_TARGET")
|
||||
@Operation(summary = "Return status of a specific action on a specific target",
|
||||
description = "Handles the GET request of retrieving a specific action on a specific target. Required Permission: READ_TARGET")
|
||||
@GetResponses
|
||||
@GetMapping(value = MgmtRestConstants.TARGET_V1_REQUEST_MAPPING + "/{targetId}/actions/{actionId}/status",
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = TARGETS_V1 + "/{targetId}/actions/{actionId}/status",
|
||||
produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<PagedList<MgmtActionStatus>> getActionStatusList(
|
||||
@PathVariable("targetId") String targetId,
|
||||
@PathVariable("actionId") Long actionId,
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET) int pagingOffsetParam,
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT) int pagingLimitParam,
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SORTING, required = false) String sortParam);
|
||||
@RequestParam(value = REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
||||
int pagingOffsetParam,
|
||||
@RequestParam(value = REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT)
|
||||
int pagingLimitParam,
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SORTING, required = false)
|
||||
String sortParam);
|
||||
|
||||
/**
|
||||
* Handles the GET request of retrieving the assigned distribution set of a specific target.
|
||||
@@ -371,8 +359,7 @@ public interface MgmtTargetRestApi {
|
||||
*/
|
||||
@Operation(summary = "Return the assigned distribution set of a specific target", description = "Handles the GET request of retrieving the assigned distribution set of an specific target. Required Permission: READ_TARGET")
|
||||
@GetResponses
|
||||
@GetMapping(value = MgmtRestConstants.TARGET_V1_REQUEST_MAPPING + "/{targetId}/assignedDS",
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = TARGETS_V1 + "/{targetId}/assignedDS", produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<MgmtDistributionSet> getAssignedDistributionSet(@PathVariable("targetId") String targetId);
|
||||
|
||||
/**
|
||||
@@ -386,9 +373,8 @@ public interface MgmtTargetRestApi {
|
||||
*/
|
||||
@Operation(summary = "Assigns a distribution set to a specific target", description = "Handles the POST request for assigning a distribution set to a specific target. Required Permission: READ_REPOSITORY and UPDATE_TARGET")
|
||||
@PostUpdateResponses
|
||||
@PostMapping(value = MgmtRestConstants.TARGET_V1_REQUEST_MAPPING + "/{targetId}/assignedDS",
|
||||
consumes = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE },
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@PostMapping(value = TARGETS_V1 + "/{targetId}/assignedDS",
|
||||
consumes = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE }, produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<MgmtTargetAssignmentResponseBody> postAssignedDistributionSet(
|
||||
@PathVariable("targetId") String targetId,
|
||||
@RequestBody @Valid MgmtDistributionSetAssignments dsAssignments,
|
||||
@@ -408,8 +394,7 @@ public interface MgmtTargetRestApi {
|
||||
*/
|
||||
@Operation(summary = "Return installed distribution set of a specific target", description = "Handles the GET request of retrieving the installed distribution set of an specific target. Required Permission: READ_TARGET")
|
||||
@GetResponses
|
||||
@GetMapping(value = MgmtRestConstants.TARGET_V1_REQUEST_MAPPING + "/{targetId}/installedDS",
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = TARGETS_V1 + "/{targetId}/installedDS", produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<MgmtDistributionSet> getInstalledDistributionSet(@PathVariable("targetId") String targetId);
|
||||
|
||||
/**
|
||||
@@ -419,8 +404,7 @@ public interface MgmtTargetRestApi {
|
||||
*/
|
||||
@Operation(summary = "Return tags for specific target", description = "Get a paged list of tags for a target. Required permission: READ_REPOSITORY")
|
||||
@GetResponses
|
||||
@GetMapping(value = MgmtRestConstants.TARGET_V1_REQUEST_MAPPING + "/{targetId}/tags",
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = TARGETS_V1 + "/{targetId}/tags", produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<List<MgmtTag>> getTags(@PathVariable("targetId") String targetId);
|
||||
|
||||
/**
|
||||
@@ -432,10 +416,11 @@ public interface MgmtTargetRestApi {
|
||||
@Operation(summary = "Create a list of metadata for a specific target", description = "Create a list of metadata entries Required permissions: READ_REPOSITORY and UPDATE_TARGET")
|
||||
@PostCreateResponses
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(responseCode = NOT_FOUND_404, description = "Target not found", content = @Content(mediaType = "application/json", schema = @Schema(hidden = true)))
|
||||
@ApiResponse(responseCode = NOT_FOUND_404, description = "Target not found",
|
||||
content = @Content(mediaType = "application/json", schema = @Schema(hidden = true)))
|
||||
})
|
||||
@PostMapping(value = MgmtRestConstants.TARGET_V1_REQUEST_MAPPING + "/{targetId}/metadata",
|
||||
consumes = { MediaType.APPLICATION_JSON_VALUE, MediaTypes.HAL_JSON_VALUE })
|
||||
@PostMapping(value = TARGETS_V1 + "/{targetId}/metadata",
|
||||
consumes = { APPLICATION_JSON_VALUE, HAL_JSON_VALUE })
|
||||
ResponseEntity<Void> createMetadata(@PathVariable("targetId") String targetId, @RequestBody List<MgmtMetadata> metadataRest);
|
||||
|
||||
/**
|
||||
@@ -446,8 +431,7 @@ public interface MgmtTargetRestApi {
|
||||
*/
|
||||
@Operation(summary = "Return metadata for specific target", description = "Get a paged list of metadata for a target. Required permission: READ_REPOSITORY")
|
||||
@GetResponses
|
||||
@GetMapping(value = MgmtRestConstants.TARGET_V1_REQUEST_MAPPING + "/{targetId}/metadata",
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = TARGETS_V1 + "/{targetId}/metadata", produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<PagedList<MgmtMetadata>> getMetadata(@PathVariable("targetId") String targetId);
|
||||
|
||||
/**
|
||||
@@ -457,10 +441,10 @@ public interface MgmtTargetRestApi {
|
||||
* @param metadataKey the key of the metadata entry to retrieve the value from
|
||||
* @return status OK if get request is successful with the value of the metadata
|
||||
*/
|
||||
@Operation(summary = "Return single metadata value for a specific key of a target", description = "Get a single metadata value for a metadata key. Required permission: READ_REPOSITORY")
|
||||
@Operation(summary = "Return single metadata value for a specific key of a target",
|
||||
description = "Get a single metadata value for a metadata key. Required permission: READ_REPOSITORY")
|
||||
@GetResponses
|
||||
@GetMapping(value = MgmtRestConstants.TARGET_V1_REQUEST_MAPPING + "/{targetId}/metadata/{metadataKey}",
|
||||
produces = { MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = TARGETS_V1 + "/{targetId}/metadata/{metadataKey}", produces = { APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<MgmtMetadata> getMetadataValue(
|
||||
@PathVariable("targetId") String targetId,
|
||||
@PathVariable("metadataKey") String metadataKey);
|
||||
@@ -472,9 +456,10 @@ public interface MgmtTargetRestApi {
|
||||
* @param metadataKey the key of the metadata to update the value
|
||||
* @param metadata update body
|
||||
*/
|
||||
@Operation(summary = "Updates a single metadata value of a target", description = "Update a single metadata value for speficic key. Required permission: UPDATE_REPOSITORY")
|
||||
@Operation(summary = "Updates a single metadata value of a target",
|
||||
description = "Update a single metadata value for speficic key. Required permission: UPDATE_REPOSITORY")
|
||||
@PutNoContentResponses
|
||||
@PutMapping(value = MgmtRestConstants.TARGET_V1_REQUEST_MAPPING + "/{targetId}/metadata/{metadataKey}")
|
||||
@PutMapping(value = TARGETS_V1 + "/{targetId}/metadata/{metadataKey}")
|
||||
ResponseEntity<Void> updateMetadata(
|
||||
@PathVariable("targetId") String targetId,
|
||||
@PathVariable("metadataKey") String metadataKey,
|
||||
@@ -489,7 +474,7 @@ public interface MgmtTargetRestApi {
|
||||
*/
|
||||
@Operation(summary = "Deletes a single metadata entry from a target", description = "Delete a single metadata. Required permission: UPDATE_REPOSITORY")
|
||||
@DeleteResponses
|
||||
@DeleteMapping(value = MgmtRestConstants.TARGET_V1_REQUEST_MAPPING + "/{targetId}/metadata/{metadataKey}")
|
||||
@DeleteMapping(value = TARGETS_V1 + "/{targetId}/metadata/{metadataKey}")
|
||||
ResponseEntity<Void> deleteMetadata(
|
||||
@PathVariable("targetId") String targetId,
|
||||
@PathVariable("metadataKey") String metadataKey);
|
||||
@@ -502,8 +487,7 @@ public interface MgmtTargetRestApi {
|
||||
*/
|
||||
@Operation(summary = "Return the current auto-confitm state for a specific target", description = "Handles the GET request to check the current auto-confirmation state of a target. Required Permission: READ_TARGET")
|
||||
@GetResponses
|
||||
@GetMapping(value = MgmtRestConstants.TARGET_V1_REQUEST_MAPPING + "/{targetId}/autoConfirm",
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = TARGETS_V1 + "/{targetId}/autoConfirm", produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<MgmtTargetAutoConfirm> getAutoConfirmStatus(
|
||||
@PathVariable("targetId") String targetId);
|
||||
|
||||
@@ -516,7 +500,7 @@ public interface MgmtTargetRestApi {
|
||||
*/
|
||||
@Operation(summary = "Activate auto-confirm on a specific target", description = "Handles the POST request to activate auto-confirmation for a specific target. As a result all current active as well as future actions will automatically be confirmed by mentioning the initiator as triggered person. Actions will be automatically confirmed, as long as auto-confirmation is active. Required Permission: UPDATE_TARGET")
|
||||
@PostUpdateNoContentResponses
|
||||
@PostMapping(value = MgmtRestConstants.TARGET_V1_REQUEST_MAPPING + "/{targetId}/autoConfirm/activate")
|
||||
@PostMapping(value = TARGETS_V1 + "/{targetId}/autoConfirm/activate")
|
||||
ResponseEntity<Void> activateAutoConfirm(
|
||||
@PathVariable("targetId") String targetId,
|
||||
@RequestBody(required = false) MgmtTargetAutoConfirmUpdate update);
|
||||
@@ -529,7 +513,7 @@ public interface MgmtTargetRestApi {
|
||||
*/
|
||||
@Operation(summary = "Deactivate auto-confirm on a specific target", description = "Handles the POST request to deactivate auto-confirmation for a specific target. All active actions will remain unchanged while all future actions need to be confirmed, before processing with the deployment. Required Permission: UPDATE_TARGET")
|
||||
@PostUpdateNoContentResponses
|
||||
@PostMapping(value = MgmtRestConstants.TARGET_V1_REQUEST_MAPPING + "/{targetId}/autoConfirm/deactivate")
|
||||
@PostMapping(value = TARGETS_V1 + "/{targetId}/autoConfirm/deactivate")
|
||||
ResponseEntity<Void> deactivateAutoConfirm(
|
||||
@PathVariable("targetId") String targetId);
|
||||
}
|
||||
@@ -9,13 +9,18 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.mgmt.rest.api;
|
||||
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_LIMIT;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.TARGET_TAG_ORDER;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.TARGET_TAG_V1_REQUEST_MAPPING;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.DeleteResponses;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.GetIfExistResponses;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.GetResponses;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.PostCreateResponses;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.PutResponses;
|
||||
import static org.springframework.hateoas.MediaTypes.HAL_JSON_VALUE;
|
||||
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -30,8 +35,6 @@ import org.eclipse.hawkbit.mgmt.json.model.tag.MgmtTagRequestBodyPut;
|
||||
import org.eclipse.hawkbit.mgmt.json.model.target.MgmtTarget;
|
||||
import org.eclipse.hawkbit.rest.ApiResponsesConstants.PostUpdateNoContentResponses;
|
||||
import org.eclipse.hawkbit.rest.OpenApi;
|
||||
import org.springframework.hateoas.MediaTypes;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@@ -50,6 +53,9 @@ import org.springframework.web.bind.annotation.RequestParam;
|
||||
extensions = @Extension(name = OpenApi.X_HAWKBIT, properties = @ExtensionProperty(name = "order", value = TARGET_TAG_ORDER)))
|
||||
public interface MgmtTargetTagRestApi {
|
||||
|
||||
String TARGETTAGS_V1 = MgmtRestConstants.REST_V1 + "/targettags";
|
||||
String TARGET_TAG_ID_ASSIGNED = "/{targetTagId}/assigned";
|
||||
|
||||
/**
|
||||
* Handles the GET request of retrieving all target tags.
|
||||
*
|
||||
@@ -61,33 +67,23 @@ public interface MgmtTargetTagRestApi {
|
||||
* @return a list of all target tags for a defined or default page request with status OK. The response is always paged. In any failure the
|
||||
* JsonResponseExceptionHandler is handling the response.
|
||||
*/
|
||||
@Operation(summary = "Return all target tags",
|
||||
description = "Handles the GET request of retrieving all target tags.")
|
||||
@Operation(summary = "Return all target tags", description = "Handles the GET request of retrieving all target tags.")
|
||||
@GetIfExistResponses
|
||||
@GetMapping(value = TARGET_TAG_V1_REQUEST_MAPPING,
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = TARGETTAGS_V1, produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<PagedList<MgmtTag>> getTargetTags(
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SEARCH, required = false)
|
||||
@Schema(description = """
|
||||
Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for
|
||||
available fields.""")
|
||||
@Schema(description = "Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for available fields.")
|
||||
String rsqlParam,
|
||||
@RequestParam(
|
||||
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET,
|
||||
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
||||
@RequestParam(value = REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
||||
@Schema(description = "The paging offset (default is 0)")
|
||||
int pagingOffsetParam,
|
||||
@RequestParam(
|
||||
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_LIMIT,
|
||||
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT)
|
||||
@RequestParam(value = REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT)
|
||||
@Schema(description = "The maximum number of entries in a page (default is 50)")
|
||||
int pagingLimitParam,
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SORTING, required = false)
|
||||
@Schema(description = """
|
||||
The query parameter sort allows to define the sort order for the result of a query. A sort criteria
|
||||
consists of the name of a field and the sort direction (ASC for ascending and DESC descending).
|
||||
The sequence of the sort criteria (multiple can be used) defines the sort order of the entities
|
||||
in the result.""")
|
||||
@Schema(description = "The query parameter sort allows to define the sort order for the result of a query. " +
|
||||
"A sort criteria consists of the name of a field and the sort direction (ASC for ascending and DESC descending)." +
|
||||
"The sequence of the sort criteria (multiple can be used) defines the sort order of the entities in the result.")
|
||||
String sortParam);
|
||||
|
||||
/**
|
||||
@@ -96,11 +92,9 @@ public interface MgmtTargetTagRestApi {
|
||||
* @param targetTagId the ID of the target tag to retrieve
|
||||
* @return a single target tag with status OK.
|
||||
*/
|
||||
@Operation(summary = "Return target tag by id",
|
||||
description = "Handles the GET request of retrieving a single target tag.")
|
||||
@Operation(summary = "Return target tag by id", description = "Handles the GET request of retrieving a single target tag.")
|
||||
@GetResponses
|
||||
@GetMapping(value = TARGET_TAG_V1_REQUEST_MAPPING + "/{targetTagId}",
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = TARGETTAGS_V1 + "/{targetTagId}", produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<MgmtTag> getTargetTag(@PathVariable("targetTagId") Long targetTagId);
|
||||
|
||||
/**
|
||||
@@ -113,9 +107,8 @@ public interface MgmtTargetTagRestApi {
|
||||
@Operation(summary = "Create target tag(s)", description = "Handles the POST request of creating new target tag. " +
|
||||
"The request body must always be a list of target tags.")
|
||||
@PostCreateResponses
|
||||
@PostMapping(value = TARGET_TAG_V1_REQUEST_MAPPING,
|
||||
consumes = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE },
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@PostMapping(value = TARGETTAGS_V1,
|
||||
consumes = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE }, produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<List<MgmtTag>> createTargetTags(@RequestBody List<MgmtTagRequestBodyPut> tags);
|
||||
|
||||
/**
|
||||
@@ -127,9 +120,8 @@ public interface MgmtTargetTagRestApi {
|
||||
*/
|
||||
@Operation(summary = "Update target tag by id", description = "Handles the PUT request of updating a target tag.")
|
||||
@PutResponses
|
||||
@PutMapping(value = TARGET_TAG_V1_REQUEST_MAPPING + "/{targetTagId}",
|
||||
consumes = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE },
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@PutMapping(value = TARGETTAGS_V1 + "/{targetTagId}",
|
||||
consumes = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE }, produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<MgmtTag> updateTargetTag(
|
||||
@PathVariable("targetTagId") Long targetTagId,
|
||||
@RequestBody MgmtTagRequestBodyPut restTargetTagRest);
|
||||
@@ -140,10 +132,9 @@ public interface MgmtTargetTagRestApi {
|
||||
* @param targetTagId the ID of the target tag
|
||||
* @return status OK if delete as successfully.
|
||||
*/
|
||||
@Operation(summary = "Delete target tag by id",
|
||||
description = "Handles the DELETE request of deleting a single target tag.")
|
||||
@Operation(summary = "Delete target tag by id", description = "Handles the DELETE request of deleting a single target tag.")
|
||||
@DeleteResponses
|
||||
@DeleteMapping(value = TARGET_TAG_V1_REQUEST_MAPPING + "/{targetTagId}")
|
||||
@DeleteMapping(value = TARGETTAGS_V1 + "/{targetTagId}")
|
||||
ResponseEntity<Void> deleteTargetTag(@PathVariable("targetTagId") Long targetTagId);
|
||||
|
||||
/**
|
||||
@@ -160,31 +151,22 @@ public interface MgmtTargetTagRestApi {
|
||||
@Operation(summary = "Return assigned targets for tag",
|
||||
description = "Handles the GET request of retrieving a list of assigned targets.")
|
||||
@GetResponses
|
||||
@GetMapping(value = TARGET_TAG_V1_REQUEST_MAPPING + MgmtRestConstants.TARGET_TAG_ID_ASSIGNED,
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = TARGETTAGS_V1 + TARGET_TAG_ID_ASSIGNED, produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<PagedList<MgmtTarget>> getAssignedTargets(
|
||||
@PathVariable("targetTagId") Long targetTagId,
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SEARCH, required = false)
|
||||
@Schema(description = """
|
||||
Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for
|
||||
available fields.""")
|
||||
@Schema(description = "Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for available fields.")
|
||||
String rsqlParam,
|
||||
@RequestParam(
|
||||
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET,
|
||||
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
||||
@RequestParam(value = REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
||||
@Schema(description = "The paging offset (default is 0)")
|
||||
int pagingOffsetParam,
|
||||
@RequestParam(
|
||||
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_LIMIT,
|
||||
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT)
|
||||
@RequestParam(value = REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT)
|
||||
@Schema(description = "The maximum number of entries in a page (default is 50)")
|
||||
int pagingLimitParam,
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SORTING, required = false)
|
||||
@Schema(description = """
|
||||
The query parameter sort allows to define the sort order for the result of a query. A sort criteria
|
||||
consists of the name of a field and the sort direction (ASC for ascending and DESC descending).
|
||||
The sequence of the sort criteria (multiple can be used) defines the sort order of the entities
|
||||
in the result.""")
|
||||
@Schema(description = "The query parameter sort allows to define the sort order for the result of a query. " +
|
||||
"A sort criteria consists of the name of a field and the sort direction (ASC for ascending and DESC descending)." +
|
||||
"The sequence of the sort criteria (multiple can be used) defines the sort order of the entities in the result.")
|
||||
String sortParam);
|
||||
|
||||
/**
|
||||
@@ -197,7 +179,7 @@ public interface MgmtTargetTagRestApi {
|
||||
@Operation(summary = "Assign target(s) to given tagId",
|
||||
description = "Handles the POST request of target assignment. Already assigned target will be ignored.")
|
||||
@PostUpdateNoContentResponses
|
||||
@PostMapping(value = TARGET_TAG_V1_REQUEST_MAPPING + MgmtRestConstants.TARGET_TAG_ID_ASSIGNED + "/{controllerId}")
|
||||
@PostMapping(value = TARGETTAGS_V1 + TARGET_TAG_ID_ASSIGNED + "/{controllerId}")
|
||||
ResponseEntity<Void> assignTarget(
|
||||
@PathVariable("targetTagId") Long targetTagId,
|
||||
@PathVariable("controllerId") String controllerId);
|
||||
@@ -212,9 +194,7 @@ public interface MgmtTargetTagRestApi {
|
||||
@Operation(summary = "Assign target(s) to given tagId",
|
||||
description = "Handles the POST request of target assignment. Already assigned target will be ignored.")
|
||||
@PostUpdateNoContentResponses
|
||||
@PostMapping(
|
||||
value = TARGET_TAG_V1_REQUEST_MAPPING + MgmtRestConstants.TARGET_TAG_ID_ASSIGNED,
|
||||
consumes = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@PostMapping(value = TARGETTAGS_V1 + TARGET_TAG_ID_ASSIGNED, consumes = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<Void> assignTargets(
|
||||
@PathVariable("targetTagId") Long targetTagId,
|
||||
@Schema(description = "List of controller ids to be assigned", example = "[\"controllerId1\", \"controllerId2\"]")
|
||||
@@ -228,11 +208,9 @@ public interface MgmtTargetTagRestApi {
|
||||
* @param controllerId the ID of the target to unassign
|
||||
* @return http status code
|
||||
*/
|
||||
@Operation(summary = "Unassign target from a given tagId",
|
||||
description = "Handles the DELETE request to unassign the given target.")
|
||||
@Operation(summary = "Unassign target from a given tagId", description = "Handles the DELETE request to unassign the given target.")
|
||||
@DeleteResponses
|
||||
@DeleteMapping(value = TARGET_TAG_V1_REQUEST_MAPPING +
|
||||
MgmtRestConstants.TARGET_TAG_ID_ASSIGNED + "/{controllerId}")
|
||||
@DeleteMapping(value = TARGETTAGS_V1 + TARGET_TAG_ID_ASSIGNED + "/{controllerId}")
|
||||
ResponseEntity<Void> unassignTarget(
|
||||
@PathVariable("targetTagId") Long targetTagId,
|
||||
@PathVariable("controllerId") String controllerId);
|
||||
@@ -244,11 +222,9 @@ public interface MgmtTargetTagRestApi {
|
||||
* @param controllerId the ID of the target to unassign
|
||||
* @return http status code
|
||||
*/
|
||||
@Operation(summary = "Unassign targets from a given tagId",
|
||||
description = "Handles the DELETE request to unassign the given targets.")
|
||||
@Operation(summary = "Unassign targets from a given tagId", description = "Handles the DELETE request to unassign the given targets.")
|
||||
@DeleteResponses
|
||||
@DeleteMapping(value = TARGET_TAG_V1_REQUEST_MAPPING + MgmtRestConstants.TARGET_TAG_ID_ASSIGNED,
|
||||
consumes = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@DeleteMapping(value = TARGETTAGS_V1 + TARGET_TAG_ID_ASSIGNED, consumes = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<Void> unassignTargets(
|
||||
@PathVariable("targetTagId") Long targetTagId,
|
||||
@RequestParam(value = "onNotFoundPolicy", required = false, defaultValue = "FAIL") OnNotFoundPolicy onNotFoundPolicy,
|
||||
|
||||
@@ -9,6 +9,10 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.mgmt.rest.api;
|
||||
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_LIMIT;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.TARGET_TYPE_ORDER;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.DeleteResponses;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.GetIfExistResponses;
|
||||
@@ -16,6 +20,8 @@ import static org.eclipse.hawkbit.rest.ApiResponsesConstants.GetResponses;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.NOT_FOUND_404;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.PostCreateResponses;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.PutResponses;
|
||||
import static org.springframework.hateoas.MediaTypes.HAL_JSON_VALUE;
|
||||
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -35,8 +41,6 @@ import org.eclipse.hawkbit.mgmt.json.model.targettype.MgmtTargetTypeRequestBodyP
|
||||
import org.eclipse.hawkbit.mgmt.json.model.targettype.MgmtTargetTypeRequestBodyPut;
|
||||
import org.eclipse.hawkbit.rest.ApiResponsesConstants.PostUpdateNoContentResponses;
|
||||
import org.eclipse.hawkbit.rest.OpenApi;
|
||||
import org.springframework.hateoas.MediaTypes;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@@ -55,6 +59,9 @@ import org.springframework.web.bind.annotation.RequestParam;
|
||||
extensions = @Extension(name = OpenApi.X_HAWKBIT, properties = @ExtensionProperty(name = "order", value = TARGET_TYPE_ORDER)))
|
||||
public interface MgmtTargetTypeRestApi {
|
||||
|
||||
String TARGETTYPES_V1 = MgmtRestConstants.REST_V1 + "/targettypes";
|
||||
String COMPATIBLEDISTRIBUTIONSETTYPES = "compatibledistributionsettypes";
|
||||
|
||||
/**
|
||||
* Handles the GET request of retrieving all TargetTypes.
|
||||
*
|
||||
@@ -68,30 +75,21 @@ public interface MgmtTargetTypeRestApi {
|
||||
*/
|
||||
@Operation(summary = "Return all target types", description = "Handles the GET request of retrieving all target types.")
|
||||
@GetIfExistResponses
|
||||
@GetMapping(value = MgmtRestConstants.TARGETTYPE_V1_REQUEST_MAPPING,
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = TARGETTYPES_V1, produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<PagedList<MgmtTargetType>> getTargetTypes(
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SEARCH, required = false)
|
||||
@Schema(description = """
|
||||
Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for
|
||||
available fields.""")
|
||||
@Schema(description = "Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for available fields.")
|
||||
String rsqlParam,
|
||||
@RequestParam(
|
||||
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET,
|
||||
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
||||
@RequestParam(value = REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
||||
@Schema(description = "The paging offset (default is 0)")
|
||||
int pagingOffsetParam,
|
||||
@RequestParam(
|
||||
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_LIMIT,
|
||||
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT)
|
||||
@RequestParam(value = REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT)
|
||||
@Schema(description = "The maximum number of entries in a page (default is 50)")
|
||||
int pagingLimitParam,
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SORTING, required = false)
|
||||
@Schema(description = """
|
||||
The query parameter sort allows to define the sort order for the result of a query. A sort criteria
|
||||
consists of the name of a field and the sort direction (ASC for ascending and DESC descending).
|
||||
The sequence of the sort criteria (multiple can be used) defines the sort order of the entities
|
||||
in the result.""")
|
||||
@Schema(description = "The query parameter sort allows to define the sort order for the result of a query. " +
|
||||
"A sort criteria consists of the name of a field and the sort direction (ASC for ascending and DESC descending)." +
|
||||
"The sequence of the sort criteria (multiple can be used) defines the sort order of the entities in the result.")
|
||||
String sortParam);
|
||||
|
||||
/**
|
||||
@@ -100,11 +98,9 @@ public interface MgmtTargetTypeRestApi {
|
||||
* @param targetTypeId the ID of the target type to retrieve
|
||||
* @return a single target type with status OK.
|
||||
*/
|
||||
@Operation(summary = "Return target type by id",
|
||||
description = "Handles the GET request of retrieving a single target type")
|
||||
@Operation(summary = "Return target type by id", description = "Handles the GET request of retrieving a single target type")
|
||||
@GetResponses
|
||||
@GetMapping(value = MgmtRestConstants.TARGETTYPE_V1_REQUEST_MAPPING + "/{targetTypeId}",
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = TARGETTYPES_V1 + "/{targetTypeId}", produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<MgmtTargetType> getTargetType(@PathVariable("targetTypeId") Long targetTypeId);
|
||||
|
||||
/**
|
||||
@@ -116,7 +112,7 @@ public interface MgmtTargetTypeRestApi {
|
||||
@Operation(summary = "Delete target type by id",
|
||||
description = "Handles the DELETE request for a single target type. Required Permission: DELETE_TARGET")
|
||||
@DeleteResponses
|
||||
@DeleteMapping(value = MgmtRestConstants.TARGETTYPE_V1_REQUEST_MAPPING + "/{targetTypeId}")
|
||||
@DeleteMapping(value = TARGETTYPES_V1 + "/{targetTypeId}")
|
||||
ResponseEntity<Void> deleteTargetType(@PathVariable("targetTypeId") Long targetTypeId);
|
||||
|
||||
/**
|
||||
@@ -129,9 +125,8 @@ public interface MgmtTargetTypeRestApi {
|
||||
@Operation(summary = "Update target type by id",
|
||||
description = "Handles the PUT request for a single target type. Required Permission: UPDATE_TARGET")
|
||||
@PutResponses
|
||||
@PutMapping(value = MgmtRestConstants.TARGETTYPE_V1_REQUEST_MAPPING + "/{targetTypeId}",
|
||||
consumes = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE },
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@PutMapping(value = TARGETTYPES_V1 + "/{targetTypeId}",
|
||||
consumes = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE }, produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<MgmtTargetType> updateTargetType(
|
||||
@PathVariable("targetTypeId") Long targetTypeId,
|
||||
@RequestBody MgmtTargetTypeRequestBodyPut restTargetType);
|
||||
@@ -143,16 +138,16 @@ public interface MgmtTargetTypeRestApi {
|
||||
* @return In case all target types could be successfully created the ResponseEntity with status code 201 - Created but without
|
||||
* ResponseBody. In any failure the JsonResponseExceptionHandler is handling the response.
|
||||
*/
|
||||
@Operation(summary = "Create target types", description = "Handles the POST request for creating new target " +
|
||||
"types. The request body must always be a list of types. Required Permission: CREATE_TARGET")
|
||||
@Operation(summary = "Create target types",
|
||||
description = "Handles the POST request for creating new target types. The request body must always be a list of types. " +
|
||||
"Required Permission: CREATE_TARGET")
|
||||
@PostCreateResponses
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(responseCode = NOT_FOUND_404, description = "Target type not found.",
|
||||
content = @Content(mediaType = "application/json", schema = @Schema(hidden = true)))
|
||||
})
|
||||
@PostMapping(value = MgmtRestConstants.TARGETTYPE_V1_REQUEST_MAPPING,
|
||||
consumes = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE },
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@PostMapping(value = TARGETTYPES_V1,
|
||||
consumes = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE }, produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<List<MgmtTargetType>> createTargetTypes(@RequestBody List<MgmtTargetTypeRequestBodyPost> targetTypes);
|
||||
|
||||
/**
|
||||
@@ -165,8 +160,8 @@ public interface MgmtTargetTypeRestApi {
|
||||
"of retrieving the list of compatible distribution set types in that target type. " +
|
||||
"Required Permission: READ_TARGET, READ_REPOSITORY")
|
||||
@GetResponses
|
||||
@GetMapping(value = MgmtRestConstants.TARGETTYPE_V1_REQUEST_MAPPING + "/{targetTypeId}/" + MgmtRestConstants.COMPATIBLEDISTRIBUTIONSETTYPES,
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = TARGETTYPES_V1 + "/{targetTypeId}/" + COMPATIBLEDISTRIBUTIONSETTYPES,
|
||||
produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<List<MgmtDistributionSetType>> getCompatibleDistributionSets(@PathVariable("targetTypeId") Long targetTypeId);
|
||||
|
||||
/**
|
||||
@@ -180,8 +175,7 @@ public interface MgmtTargetTypeRestApi {
|
||||
description = "Handles the DELETE request for removing a distribution set type from a single target type. " +
|
||||
"Required Permission: UPDATE_TARGET and READ_REPOSITORY")
|
||||
@DeleteResponses
|
||||
@DeleteMapping(value = MgmtRestConstants.TARGETTYPE_V1_REQUEST_MAPPING + "/{targetTypeId}/" +
|
||||
MgmtRestConstants.COMPATIBLEDISTRIBUTIONSETTYPES + "/{distributionSetTypeId}")
|
||||
@DeleteMapping(value = TARGETTYPES_V1 + "/{targetTypeId}/" + COMPATIBLEDISTRIBUTIONSETTYPES + "/{distributionSetTypeId}")
|
||||
ResponseEntity<Void> removeCompatibleDistributionSet(
|
||||
@PathVariable("targetTypeId") Long targetTypeId,
|
||||
@PathVariable("distributionSetTypeId") Long distributionSetTypeId);
|
||||
@@ -197,8 +191,8 @@ public interface MgmtTargetTypeRestApi {
|
||||
description = "Handles the POST request for adding compatible distribution set types to a target type. " +
|
||||
"Required Permission: UPDATE_TARGET and READ_REPOSITORY")
|
||||
@PostUpdateNoContentResponses
|
||||
@PostMapping(value = MgmtRestConstants.TARGETTYPE_V1_REQUEST_MAPPING + "/{targetTypeId}/" + MgmtRestConstants.COMPATIBLEDISTRIBUTIONSETTYPES,
|
||||
consumes = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@PostMapping(value = TARGETTYPES_V1 + "/{targetTypeId}/" + COMPATIBLEDISTRIBUTIONSETTYPES,
|
||||
consumes = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<Void> addCompatibleDistributionSets(
|
||||
@PathVariable("targetTypeId") Long targetTypeId,
|
||||
@RequestBody List<MgmtDistributionSetTypeAssignment> distributionSetTypeIds);
|
||||
|
||||
@@ -14,6 +14,8 @@ import static org.eclipse.hawkbit.rest.ApiResponsesConstants.DeleteResponses;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.GetIfExistResponses;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.GetResponses;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.PutResponses;
|
||||
import static org.springframework.hateoas.MediaTypes.HAL_JSON_VALUE;
|
||||
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@@ -24,9 +26,7 @@ import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.eclipse.hawkbit.mgmt.json.model.system.MgmtSystemTenantConfigurationValue;
|
||||
import org.eclipse.hawkbit.mgmt.json.model.system.MgmtSystemTenantConfigurationValueRequest;
|
||||
import org.eclipse.hawkbit.rest.OpenApi;
|
||||
import org.springframework.hateoas.MediaTypes;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@@ -44,16 +44,17 @@ import org.springframework.web.bind.annotation.ResponseStatus;
|
||||
extensions = @Extension(name = OpenApi.X_HAWKBIT, properties = @ExtensionProperty(name = "order", value = TENANT_ORDER)))
|
||||
public interface MgmtTenantManagementRestApi {
|
||||
|
||||
String SYSTEM_V1 = MgmtRestConstants.REST_V1 + "/system";
|
||||
|
||||
/**
|
||||
* Handles the GET request for receiving all tenant specific configuration values.
|
||||
*
|
||||
* @return a map of all configuration values.
|
||||
*/
|
||||
@Operation(summary = "Return all tenant specific configuration values", description = "The GET request returns " +
|
||||
"a list of all possible configuration keys for the tenant. Required Permission: READ_TENANT_CONFIGURATION")
|
||||
@Operation(summary = "Return all tenant specific configuration values",
|
||||
description = "The GET request returns a list of all possible configuration keys for the tenant. Required Permission: READ_TENANT_CONFIGURATION")
|
||||
@GetIfExistResponses
|
||||
@GetMapping(value = MgmtRestConstants.SYSTEM_V1_REQUEST_MAPPING + "/configs",
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = SYSTEM_V1 + "/configs", produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<Map<String, MgmtSystemTenantConfigurationValue>> getTenantConfiguration();
|
||||
|
||||
/**
|
||||
@@ -67,8 +68,7 @@ public interface MgmtTenantManagementRestApi {
|
||||
"configuration value of a specific configuration key for the tenant. " +
|
||||
"Required Permission: READ_TENANT_CONFIGURATION")
|
||||
@GetResponses
|
||||
@GetMapping(value = MgmtRestConstants.SYSTEM_V1_REQUEST_MAPPING + "/configs/{keyName}",
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = SYSTEM_V1 + "/configs/{keyName}", produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<MgmtSystemTenantConfigurationValue> getTenantConfigurationValue(@PathVariable("keyName") String keyName);
|
||||
|
||||
/**
|
||||
@@ -77,13 +77,12 @@ public interface MgmtTenantManagementRestApi {
|
||||
* @param keyName the name of the configuration key
|
||||
* @param configurationValueRest the new value for the configuration
|
||||
*/
|
||||
@Operation(summary = "Update a tenant specific configuration value.", description = "The PUT request changes a " +
|
||||
"configuration value of a specific configuration key for the tenant. " +
|
||||
"Required Permission: TENANT_CONFIGURATION")
|
||||
@Operation(summary = "Update a tenant specific configuration value.",
|
||||
description = "The PUT request changes a configuration value of a specific configuration key for the tenant. " +
|
||||
"Required Permission: TENANT_CONFIGURATION")
|
||||
@PutResponses
|
||||
@PutMapping(value = MgmtRestConstants.SYSTEM_V1_REQUEST_MAPPING + "/configs/{keyName}",
|
||||
consumes = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE },
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@PutMapping(value = SYSTEM_V1 + "/configs/{keyName}",
|
||||
consumes = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE }, produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
@ResponseStatus(HttpStatus.NO_CONTENT)
|
||||
void updateTenantConfigurationValue(
|
||||
@PathVariable("keyName") String keyName,
|
||||
@@ -94,12 +93,11 @@ public interface MgmtTenantManagementRestApi {
|
||||
*
|
||||
* @param configurationValueMap a Map of name - value pairs for the configurations
|
||||
*/
|
||||
@Operation(summary = "Batch update of tenant configuration.", description = "The PUT request updates the whole " +
|
||||
"configuration for the tenant. Required Permission: TENANT_CONFIGURATION")
|
||||
@Operation(summary = "Batch update of tenant configuration.",
|
||||
description = "The PUT request updates the whole configuration for the tenant. Required Permission: TENANT_CONFIGURATION")
|
||||
@PutResponses
|
||||
@PutMapping(value = MgmtRestConstants.SYSTEM_V1_REQUEST_MAPPING + "/configs",
|
||||
consumes = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE },
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@PutMapping(value = SYSTEM_V1 + "/configs",
|
||||
consumes = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE }, produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
@ResponseStatus(HttpStatus.NO_CONTENT)
|
||||
void updateTenantConfiguration(@RequestBody Map<String, Object> configurationValueMap);
|
||||
|
||||
@@ -108,12 +106,11 @@ public interface MgmtTenantManagementRestApi {
|
||||
*
|
||||
* @param keyName the Name of the configuration key
|
||||
*/
|
||||
@Operation(summary = "Delete a tenant specific configuration value", description = "The DELETE request removes a " +
|
||||
"tenant specific configuration value for the tenant. Afterwards the global default value is used. " +
|
||||
"Required Permission: TENANT_CONFIGURATION")
|
||||
@Operation(summary = "Delete a tenant specific configuration value",
|
||||
description = "The DELETE request removes a tenant specific configuration value for the tenant. " +
|
||||
"Afterwards the global default value is used. Required Permission: TENANT_CONFIGURATION")
|
||||
@DeleteResponses
|
||||
@DeleteMapping(value = MgmtRestConstants.SYSTEM_V1_REQUEST_MAPPING + "/configs/{keyName}",
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@DeleteMapping(value = SYSTEM_V1 + "/configs/{keyName}", produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
@ResponseStatus(HttpStatus.NO_CONTENT)
|
||||
void deleteTenantConfigurationValue(@PathVariable("keyName") String keyName);
|
||||
}
|
||||
Reference in New Issue
Block a user