Order rest APIs in openapi doc (#2438)

Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
This commit is contained in:
Avgustin Marinov
2025-06-09 15:41:09 +03:00
committed by GitHub
parent 09a3d3e0c6
commit 6840025ec1
20 changed files with 182 additions and 50 deletions

View File

@@ -9,7 +9,11 @@
*/
package org.eclipse.hawkbit.mgmt.rest.api;
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.ACTION_ORDER;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.extensions.Extension;
import io.swagger.v3.oas.annotations.extensions.ExtensionProperty;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
@@ -17,6 +21,7 @@ import io.swagger.v3.oas.annotations.responses.ApiResponses;
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.OpenApiConfiguration;
import org.eclipse.hawkbit.rest.json.model.ExceptionInfo;
import org.springframework.hateoas.MediaTypes;
import org.springframework.http.MediaType;
@@ -29,7 +34,9 @@ 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 = OpenApiConfiguration.X_HAWKBIT, properties = @ExtensionProperty(name = "order", value = ACTION_ORDER)))
public interface MgmtActionRestApi {
/**

View File

@@ -9,8 +9,13 @@
*/
package org.eclipse.hawkbit.mgmt.rest.api;
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.BASIC_AUTH_ORDER;
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.OpenApiConfiguration;
import org.springframework.hateoas.MediaTypes;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
@@ -20,7 +25,9 @@ import org.springframework.web.bind.annotation.GetMapping;
* Api for handling basic auth user validation
*/
@SuppressWarnings("squid:S1609")
@Tag(name = "Basic Authentication", description = "API for basic auth user validation.")
@Tag(
name = "Basic Authentication", description = "API for basic auth user validation.",
extensions = @Extension(name = OpenApiConfiguration.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 {
@@ -31,4 +38,4 @@ public interface MgmtBasicAuthRestApi {
*/
@GetMapping(value = MgmtRestConstants.AUTH_V1_REQUEST_MAPPING, produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
ResponseEntity<MgmtUserInfo> validateBasicAuth();
}
}

View File

@@ -9,11 +9,15 @@
*/
package org.eclipse.hawkbit.mgmt.rest.api;
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.DISTRIBUTION_SET_ORDER;
import java.util.List;
import jakarta.validation.Valid;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.extensions.Extension;
import io.swagger.v3.oas.annotations.extensions.ExtensionProperty;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
@@ -33,6 +37,7 @@ import org.eclipse.hawkbit.mgmt.json.model.softwaremodule.MgmtSoftwareModule;
import org.eclipse.hawkbit.mgmt.json.model.softwaremodule.MgmtSoftwareModuleAssignment;
import org.eclipse.hawkbit.mgmt.json.model.target.MgmtTarget;
import org.eclipse.hawkbit.mgmt.json.model.targetfilter.MgmtTargetFilterQuery;
import org.eclipse.hawkbit.rest.OpenApiConfiguration;
import org.eclipse.hawkbit.rest.json.model.ExceptionInfo;
import org.springframework.hateoas.MediaTypes;
import org.springframework.http.HttpStatus;
@@ -51,7 +56,9 @@ import org.springframework.web.bind.annotation.ResponseStatus;
* REST Resource handling 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 = OpenApiConfiguration.X_HAWKBIT, properties = @ExtensionProperty(name = "order", value = DISTRIBUTION_SET_ORDER)))
public interface MgmtDistributionSetRestApi {
/**

View File

@@ -9,9 +9,13 @@
*/
package org.eclipse.hawkbit.mgmt.rest.api;
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.DISTRIBUTION_SET_TAG_ORDER;
import java.util.List;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.extensions.Extension;
import io.swagger.v3.oas.annotations.extensions.ExtensionProperty;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
@@ -21,6 +25,7 @@ import org.eclipse.hawkbit.mgmt.json.model.PagedList;
import org.eclipse.hawkbit.mgmt.json.model.distributionset.MgmtDistributionSet;
import org.eclipse.hawkbit.mgmt.json.model.tag.MgmtTag;
import org.eclipse.hawkbit.mgmt.json.model.tag.MgmtTagRequestBodyPut;
import org.eclipse.hawkbit.rest.OpenApiConfiguration;
import org.eclipse.hawkbit.rest.json.model.ExceptionInfo;
import org.springframework.hateoas.MediaTypes;
import org.springframework.http.MediaType;
@@ -37,7 +42,9 @@ import org.springframework.web.bind.annotation.RequestParam;
* REST Resource handling 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 = OpenApiConfiguration.X_HAWKBIT, properties = @ExtensionProperty(name = "order", value = DISTRIBUTION_SET_TAG_ORDER)))
public interface MgmtDistributionSetTagRestApi {
/**

View File

@@ -9,9 +9,13 @@
*/
package org.eclipse.hawkbit.mgmt.rest.api;
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.DISTRIBUTION_SET_TYPE_ORDER;
import java.util.List;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.extensions.Extension;
import io.swagger.v3.oas.annotations.extensions.ExtensionProperty;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
@@ -23,6 +27,7 @@ import org.eclipse.hawkbit.mgmt.json.model.distributionsettype.MgmtDistributionS
import org.eclipse.hawkbit.mgmt.json.model.distributionsettype.MgmtDistributionSetTypeRequestBodyPost;
import org.eclipse.hawkbit.mgmt.json.model.distributionsettype.MgmtDistributionSetTypeRequestBodyPut;
import org.eclipse.hawkbit.mgmt.json.model.softwaremoduletype.MgmtSoftwareModuleType;
import org.eclipse.hawkbit.rest.OpenApiConfiguration;
import org.eclipse.hawkbit.rest.json.model.ExceptionInfo;
import org.springframework.hateoas.MediaTypes;
import org.springframework.http.MediaType;
@@ -39,7 +44,9 @@ import org.springframework.web.bind.annotation.RequestParam;
* REST Resource handling 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 = OpenApiConfiguration.X_HAWKBIT, properties = @ExtensionProperty(name = "order", value = DISTRIBUTION_SET_TYPE_ORDER)))
public interface MgmtDistributionSetTypeRestApi {
/**

View File

@@ -9,9 +9,14 @@
*/
package org.eclipse.hawkbit.mgmt.rest.api;
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.DOWNLOAD_ARTIFACT_ORDER;
import java.io.InputStream;
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.rest.OpenApiConfiguration;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
@@ -21,7 +26,9 @@ import org.springframework.web.bind.annotation.ResponseBody;
* API to download artifacts
*/
@FunctionalInterface
@Tag(name = "Download artifact", description = "API to download artifacts.")
@Tag(
name = "Download artifact", description = "API to download artifacts.",
extensions = @Extension(name = OpenApiConfiguration.X_HAWKBIT, properties = @ExtensionProperty(name = "order", value = DOWNLOAD_ARTIFACT_ORDER)))
// no request mapping specified here to avoid CVE-2021-22044 in Feign client
public interface MgmtDownloadArtifactRestApi {

View File

@@ -227,4 +227,20 @@ public final class MgmtRestConstants {
* Request parameter if the artifact url handler should be used
*/
public static final String REQUEST_PARAMETER_USE_ARTIFACT_URL_HANDLER = "useartifacturlhandler";
// Orders
public static final String TARGET_ORDER = "1000";
public static final String TARGET_TAG_ORDER = "2000";
public static final String TARGET_TYPE_ORDER = "3000";
public static final String TARGET_FILTER_ORDER = "4000";
public static final String ACTION_ORDER = "5000";
public static final String ROLLOUT_ORDER = "6000";
public static final String DISTRIBUTION_SET_ORDER = "7000";
public static final String DISTRIBUTION_SET_TYPE_ORDER = "8000";
public static final String DISTRIBUTION_SET_TAG_ORDER = "9000";
public static final String SOFTWARE_MODULE_ORDER = "10000";
public static final String SOFTWARE_MODULE_TYPE_ORDER = "11000";
public static final String TENANT_ORDER = "100000";
public static final String BASIC_AUTH_ORDER = "200000";
public static final String DOWNLOAD_ARTIFACT_ORDER = "1000000";
}

View File

@@ -9,7 +9,11 @@
*/
package org.eclipse.hawkbit.mgmt.rest.api;
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.ROLLOUT_ORDER;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.extensions.Extension;
import io.swagger.v3.oas.annotations.extensions.ExtensionProperty;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
@@ -21,6 +25,7 @@ import org.eclipse.hawkbit.mgmt.json.model.rollout.MgmtRolloutRestRequestBodyPos
import org.eclipse.hawkbit.mgmt.json.model.rollout.MgmtRolloutRestRequestBodyPut;
import org.eclipse.hawkbit.mgmt.json.model.rolloutgroup.MgmtRolloutGroupResponseBody;
import org.eclipse.hawkbit.mgmt.json.model.target.MgmtTarget;
import org.eclipse.hawkbit.rest.OpenApiConfiguration;
import org.eclipse.hawkbit.rest.json.model.ExceptionInfo;
import org.springframework.hateoas.MediaTypes;
import org.springframework.http.MediaType;
@@ -37,7 +42,9 @@ import org.springframework.web.bind.annotation.RequestParam;
* REST Resource handling 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 = OpenApiConfiguration.X_HAWKBIT, properties = @ExtensionProperty(name = "order", value = ROLLOUT_ORDER)))
public interface MgmtRolloutRestApi {
/**

View File

@@ -9,9 +9,13 @@
*/
package org.eclipse.hawkbit.mgmt.rest.api;
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.SOFTWARE_MODULE_ORDER;
import java.util.List;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.extensions.Extension;
import io.swagger.v3.oas.annotations.extensions.ExtensionProperty;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
@@ -24,6 +28,7 @@ import org.eclipse.hawkbit.mgmt.json.model.softwaremodule.MgmtSoftwareModuleMeta
import org.eclipse.hawkbit.mgmt.json.model.softwaremodule.MgmtSoftwareModuleMetadataBodyPut;
import org.eclipse.hawkbit.mgmt.json.model.softwaremodule.MgmtSoftwareModuleRequestBodyPost;
import org.eclipse.hawkbit.mgmt.json.model.softwaremodule.MgmtSoftwareModuleRequestBodyPut;
import org.eclipse.hawkbit.rest.OpenApiConfiguration;
import org.eclipse.hawkbit.rest.json.model.ExceptionInfo;
import org.springframework.hateoas.MediaTypes;
import org.springframework.http.HttpStatus;
@@ -46,7 +51,9 @@ import org.springframework.web.multipart.MultipartFile;
* 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 = OpenApiConfiguration.X_HAWKBIT, properties = @ExtensionProperty(name = "order", value = SOFTWARE_MODULE_ORDER)))
public interface MgmtSoftwareModuleRestApi {
/**

View File

@@ -9,9 +9,13 @@
*/
package org.eclipse.hawkbit.mgmt.rest.api;
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.SOFTWARE_MODULE_TYPE_ORDER;
import java.util.List;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.extensions.Extension;
import io.swagger.v3.oas.annotations.extensions.ExtensionProperty;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
@@ -21,6 +25,7 @@ import org.eclipse.hawkbit.mgmt.json.model.PagedList;
import org.eclipse.hawkbit.mgmt.json.model.softwaremoduletype.MgmtSoftwareModuleType;
import org.eclipse.hawkbit.mgmt.json.model.softwaremoduletype.MgmtSoftwareModuleTypeRequestBodyPost;
import org.eclipse.hawkbit.mgmt.json.model.softwaremoduletype.MgmtSoftwareModuleTypeRequestBodyPut;
import org.eclipse.hawkbit.rest.OpenApiConfiguration;
import org.eclipse.hawkbit.rest.json.model.ExceptionInfo;
import org.springframework.hateoas.MediaTypes;
import org.springframework.http.MediaType;
@@ -38,7 +43,9 @@ import org.springframework.web.bind.annotation.RequestParam;
* 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 = OpenApiConfiguration.X_HAWKBIT, properties = @ExtensionProperty(name = "order", value = SOFTWARE_MODULE_TYPE_ORDER)))
public interface MgmtSoftwareModuleTypeRestApi {
/**

View File

@@ -9,7 +9,11 @@
*/
package org.eclipse.hawkbit.mgmt.rest.api;
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.TARGET_FILTER_ORDER;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.extensions.Extension;
import io.swagger.v3.oas.annotations.extensions.ExtensionProperty;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
@@ -20,6 +24,7 @@ import org.eclipse.hawkbit.mgmt.json.model.distributionset.MgmtDistributionSet;
import org.eclipse.hawkbit.mgmt.json.model.targetfilter.MgmtDistributionSetAutoAssignment;
import org.eclipse.hawkbit.mgmt.json.model.targetfilter.MgmtTargetFilterQuery;
import org.eclipse.hawkbit.mgmt.json.model.targetfilter.MgmtTargetFilterQueryRequestBody;
import org.eclipse.hawkbit.rest.OpenApiConfiguration;
import org.eclipse.hawkbit.rest.json.model.ExceptionInfo;
import org.springframework.hateoas.MediaTypes;
import org.springframework.http.MediaType;
@@ -36,7 +41,9 @@ import org.springframework.web.bind.annotation.RequestParam;
* Api for handling 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 = OpenApiConfiguration.X_HAWKBIT, properties = @ExtensionProperty(name = "order", value = TARGET_FILTER_ORDER)))
public interface MgmtTargetFilterQueryRestApi {
/**

View File

@@ -9,11 +9,15 @@
*/
package org.eclipse.hawkbit.mgmt.rest.api;
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.TARGET_ORDER;
import java.util.List;
import jakarta.validation.Valid;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.extensions.Extension;
import io.swagger.v3.oas.annotations.extensions.ExtensionProperty;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
@@ -36,6 +40,7 @@ import org.eclipse.hawkbit.mgmt.json.model.target.MgmtTargetAttributes;
import org.eclipse.hawkbit.mgmt.json.model.target.MgmtTargetAutoConfirm;
import org.eclipse.hawkbit.mgmt.json.model.target.MgmtTargetAutoConfirmUpdate;
import org.eclipse.hawkbit.mgmt.json.model.target.MgmtTargetRequestBody;
import org.eclipse.hawkbit.rest.OpenApiConfiguration;
import org.eclipse.hawkbit.rest.json.model.ExceptionInfo;
import org.springframework.hateoas.MediaTypes;
import org.springframework.http.HttpStatus;
@@ -54,7 +59,9 @@ import org.springframework.web.bind.annotation.ResponseStatus;
* API for handling target operations.
*/
// no request mapping specified here to avoid CVE-2021-22044 in Feign client
@Tag(name = "Targets", description = "REST API for Target CRUD operations.")
@Tag(
name = "Targets", description = "REST API for Target CRUD operations.",
extensions = @Extension(name = OpenApiConfiguration.X_HAWKBIT, properties = @ExtensionProperty(name = "order", value = TARGET_ORDER)))
public interface MgmtTargetRestApi {
/**

View File

@@ -9,9 +9,13 @@
*/
package org.eclipse.hawkbit.mgmt.rest.api;
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.TARGET_TAG_ORDER;
import java.util.List;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.extensions.Extension;
import io.swagger.v3.oas.annotations.extensions.ExtensionProperty;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
@@ -21,6 +25,7 @@ import org.eclipse.hawkbit.mgmt.json.model.PagedList;
import org.eclipse.hawkbit.mgmt.json.model.tag.MgmtTag;
import org.eclipse.hawkbit.mgmt.json.model.tag.MgmtTagRequestBodyPut;
import org.eclipse.hawkbit.mgmt.json.model.target.MgmtTarget;
import org.eclipse.hawkbit.rest.OpenApiConfiguration;
import org.eclipse.hawkbit.rest.json.model.ExceptionInfo;
import org.springframework.hateoas.MediaTypes;
import org.springframework.http.MediaType;
@@ -37,7 +42,9 @@ import org.springframework.web.bind.annotation.RequestParam;
* REST Resource handling for TargetTag CRUD operations.
*/
// no request mapping specified here to avoid CVE-2021-22044 in Feign client
@Tag(name = "Target Tags", description = "REST API for Target Tag CRUD operations.")
@Tag(
name = "Target Tags", description = "REST API for Target Tag CRUD operations.",
extensions = @Extension(name = OpenApiConfiguration.X_HAWKBIT, properties = @ExtensionProperty(name = "order", value = TARGET_TAG_ORDER)))
public interface MgmtTargetTagRestApi {
/**

View File

@@ -9,9 +9,13 @@
*/
package org.eclipse.hawkbit.mgmt.rest.api;
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.TARGET_TYPE_ORDER;
import java.util.List;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.extensions.Extension;
import io.swagger.v3.oas.annotations.extensions.ExtensionProperty;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
@@ -23,6 +27,7 @@ import org.eclipse.hawkbit.mgmt.json.model.distributionsettype.MgmtDistributionS
import org.eclipse.hawkbit.mgmt.json.model.targettype.MgmtTargetType;
import org.eclipse.hawkbit.mgmt.json.model.targettype.MgmtTargetTypeRequestBodyPost;
import org.eclipse.hawkbit.mgmt.json.model.targettype.MgmtTargetTypeRequestBodyPut;
import org.eclipse.hawkbit.rest.OpenApiConfiguration;
import org.eclipse.hawkbit.rest.json.model.ExceptionInfo;
import org.springframework.hateoas.MediaTypes;
import org.springframework.http.MediaType;
@@ -39,7 +44,9 @@ import org.springframework.web.bind.annotation.RequestParam;
* REST Resource handling for TargetType CRUD operations.
*/
// no request mapping specified here to avoid CVE-2021-22044 in Feign client
@Tag(name = "Target Types", description = "REST API for Target Type CRUD operations.")
@Tag(
name = "Target Types", description = "REST API for Target Type CRUD operations.",
extensions = @Extension(name = OpenApiConfiguration.X_HAWKBIT, properties = @ExtensionProperty(name = "order", value = TARGET_TYPE_ORDER)))
public interface MgmtTargetTypeRestApi {
/**

View File

@@ -9,11 +9,15 @@
*/
package org.eclipse.hawkbit.mgmt.rest.api;
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.TENANT_ORDER;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.extensions.Extension;
import io.swagger.v3.oas.annotations.extensions.ExtensionProperty;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
@@ -21,6 +25,7 @@ import io.swagger.v3.oas.annotations.responses.ApiResponses;
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.OpenApiConfiguration;
import org.eclipse.hawkbit.rest.json.model.ExceptionInfo;
import org.springframework.hateoas.MediaTypes;
import org.springframework.http.MediaType;
@@ -35,7 +40,9 @@ import org.springframework.web.bind.annotation.RequestBody;
* REST Resource for handling tenant specific configuration operations.
*/
// no request mapping specified here to avoid CVE-2021-22044 in Feign client
@Tag(name = "System Configuration", description = "REST API for handling tenant specific configuration operations.")
@Tag(
name = "System Configuration", description = "REST API for handling tenant specific configuration operations.",
extensions = @Extension(name = OpenApiConfiguration.X_HAWKBIT, properties = @ExtensionProperty(name = "order", value = TENANT_ORDER)))
public interface MgmtTenantManagementRestApi {
/**

View File

@@ -1,13 +0,0 @@
/**
* Copyright (c) 2025 Contributors to the Eclipse Foundation
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.eclipse.hawkbit.mgmt;
public class sdfs {
}

View File

@@ -9,11 +9,17 @@
*/
package org.eclipse.hawkbit.mgmt.rest.resource;
import java.util.List;
import io.swagger.v3.oas.models.info.Info;
import io.swagger.v3.oas.models.security.SecurityRequirement;
import io.swagger.v3.oas.models.security.SecurityScheme;
import io.swagger.v3.oas.models.servers.Server;
import io.swagger.v3.oas.models.servers.ServerVariable;
import io.swagger.v3.oas.models.servers.ServerVariables;
import org.eclipse.hawkbit.rest.OpenApiConfiguration;
import org.springdoc.core.models.GroupedOpenApi;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@@ -30,11 +36,11 @@ public class MgmtOpenApiConfiguration {
value = "hawkbit.server.openapi.mgmt.enabled",
havingValue = "true",
matchIfMissing = true)
public GroupedOpenApi mgmtApi() {
public GroupedOpenApi mgmtApi(@Value("${hawkbit.server.openapi.mgmt.tenant-endpoint.enabled:false}") final boolean tenantEndpointEnabled) {
return GroupedOpenApi
.builder()
.group("Management API")
.pathsToMatch("/rest/v*/**", "/{tenant}/rest/v*/**")
.pathsToMatch(tenantEndpointEnabled ? new String[] { "/rest/v*/**", "/{tenant}/rest/v*/**" } : new String[] { "/rest/v*/**" })
.addOpenApiCustomizer(openApi ->
openApi
.info(new Info()
@@ -43,6 +49,13 @@ public class MgmtOpenApiConfiguration {
The Management API provides access to the management features of the hawkBit.
It allows for managing devices, deployments, and other.
"""))
.servers(tenantEndpointEnabled
? List.of(
new Server()
.url("/{tenant}/")
.variables(new ServerVariables().addServerVariable("tenant", tenantSeverVariable())),
new Server().url("/"))
: List.of(new Server().url("/")))
.addSecurityItem(new SecurityRequirement()
.addList(BASIC_AUTH_SEC_SCHEME_NAME)
.addList(BEARER_AUTH_SEC_SCHEME_NAME))
@@ -52,14 +65,16 @@ public class MgmtOpenApiConfiguration {
.addSecuritySchemes(BASIC_AUTH_SEC_SCHEME_NAME,
new SecurityScheme()
.name(BASIC_AUTH_SEC_SCHEME_NAME)
.description(BASIC_AUTH_SEC_SCHEME_NAME + " Authentication")
.description(
BASIC_AUTH_SEC_SCHEME_NAME + " Authentication")
.type(SecurityScheme.Type.HTTP)
.in(SecurityScheme.In.HEADER)
.scheme("basic"))
.addSecuritySchemes(BEARER_AUTH_SEC_SCHEME_NAME,
new SecurityScheme()
.name(BEARER_AUTH_SEC_SCHEME_NAME)
.description(BEARER_AUTH_SEC_SCHEME_NAME + " Authentication")
.description(
BEARER_AUTH_SEC_SCHEME_NAME + " Authentication")
.type(SecurityScheme.Type.HTTP)
.in(SecurityScheme.In.HEADER)
.bearerFormat("JWT")
@@ -67,4 +82,11 @@ public class MgmtOpenApiConfiguration {
.tags(OpenApiConfiguration.sort(openApi.getTags())))
.build();
}
private static ServerVariable tenantSeverVariable() {
final ServerVariable tenantServerVariable = new ServerVariable();
tenantServerVariable.setDescription("Tenant identifier");
tenantServerVariable.setDefault("DEFAULT");
return tenantServerVariable;
}
}

View File

@@ -48,13 +48,6 @@ spring.rabbitmq.port=5672
#hawkbit.server.security.cors.enabled=true
#hawkbit.server.security.cors.allowedOrigins=http://localhost
# Swagger Configuration
springdoc.api-docs.version=openapi_3_0
springdoc.show-oauth2-endpoints=true
springdoc.show-login-endpoint=true
springdoc.packages-to-scan=org.eclipse.hawkbit.mgmt
springdoc.paths-to-exclude=/system/**
# Disable discovery client of spring-cloud-commons
spring.cloud.discovery.enabled=false
# Enable communication between services
@@ -69,4 +62,14 @@ spring.cloud.stream.bindings.springCloudBusInput.group=mgmt-server
# To use protostuff (for instance fot improved performance) you shall uncomment
# the following two lines and add io.protostuff:protostuff-core and io.protostuff:protostuff-runtime to dependencies
#spring.cloud.stream.bindings.springCloudBusInput.content-type=application/binary+protostuff
#spring.cloud.stream.bindings.springCloudBusOutput.content-type=application/binary+protostuff
#spring.cloud.stream.bindings.springCloudBusOutput.content-type=application/binary+protostuff
# Swagger Configuration / https://springdoc.org/v2/#properties
springdoc.api-docs.version=openapi_3_0
springdoc.show-oauth2-endpoints=true
springdoc.show-login-endpoint=true
springdoc.packages-to-scan=org.eclipse.hawkbit.mgmt
springdoc.paths-to-exclude=/system/**
springdoc.swagger-ui.enabled=true
springdoc.swagger-ui.csrf.enabled=true
springdoc.swagger-ui.doc-expansion=none