Remove System Management REST (#2761)

* the only non repository module using @PreAuthorize
* the only service for "sys admins" - it's a little bit out of scopes
* caches management is not supposed to be via REST
* delete tenant shall not be provided when we don't have create
* metrics shall be reported via metrics colectins services, or db

Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
This commit is contained in:
Avgustin Marinov
2025-10-17 10:45:11 +03:00
committed by GitHub
parent 4b3c3cc870
commit b10955f3eb
6 changed files with 0 additions and 310 deletions

View File

@@ -1,40 +0,0 @@
/**
* Copyright (c) 2015 Bosch Software Innovations GmbH and others
*
* 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.json.model.systemmanagement;
import java.util.Collection;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import lombok.Data;
import lombok.ToString;
/**
* Model representation of an Cache entry as json.
*/
@Data
@ToString
@JsonInclude(Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
public class MgmtSystemCache {
private final String name;
private final Collection<String> keys;
/**
* @param name the name of the cache
* @param cacheKeys the keys which contains in the cache
*/
public MgmtSystemCache(final String name, final Collection<String> cacheKeys) {
this.name = name;
this.keys = cacheKeys;
}
}

View File

@@ -1,40 +0,0 @@
/**
* Copyright (c) 2015 Bosch Software Innovations GmbH and others
*
* 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.json.model.systemmanagement;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import lombok.Data;
import lombok.experimental.Accessors;
/**
* Body for system statistics.
*/
@Data
@Accessors(chain = true)
@JsonInclude(Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
public class MgmtSystemStatisticsRest {
private long overallTargets;
private long overallArtifacts;
private long overallArtifactVolumeInBytes;
private long overallActions;
private long overallTenants;
private List<MgmtSystemTenantServiceUsage> tenantStats;
}

View File

@@ -1,42 +0,0 @@
/**
* Copyright (c) 2015 Bosch Software Innovations GmbH and others
*
* 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.json.model.systemmanagement;
import java.util.Map;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import lombok.Data;
import lombok.ToString;
import lombok.experimental.Accessors;
/**
* Response body for system usage report.
*/
@Data
@Accessors(chain = true)
@ToString
@JsonInclude(Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
public class MgmtSystemTenantServiceUsage {
private String tenantName;
private long targets;
private long artifacts;
private long actions;
private long overallArtifactVolumeInBytes;
private Map<String, String> usageData;
}

View File

@@ -1,64 +0,0 @@
/**
* Copyright (c) 2015 Bosch Software Innovations GmbH and others
*
* 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.rest.api;
import java.util.Collection;
import org.eclipse.hawkbit.mgmt.json.model.systemmanagement.MgmtSystemCache;
import org.eclipse.hawkbit.mgmt.json.model.systemmanagement.MgmtSystemStatisticsRest;
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;
import org.springframework.web.bind.annotation.PathVariable;
/**
* System management capabilities by REST.
*/
// no request mapping specified here to avoid CVE-2021-22044 in Feign client
public interface MgmtSystemManagementRestApi {
/**
* Deletes the tenant data of a given tenant. USE WITH CARE!
*
* @param tenant to delete
* @return HttpStatus.OK
*/
@DeleteMapping(value = MgmtRestConstants.SYSTEM_ADMIN_MAPPING + "/tenants/{tenant}")
ResponseEntity<Void> deleteTenant(@PathVariable("tenant") String tenant);
/**
* Collects and returns system usage statistics. It provides a system wide
* overview and tenant based stats.
*
* @return system usage statistics
*/
@GetMapping(value = MgmtRestConstants.SYSTEM_ADMIN_MAPPING + "/usage",
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
ResponseEntity<MgmtSystemStatisticsRest> getSystemUsageStats();
/**
* Returns a list of all caches.
*
* @return a list of caches for all tenants
*/
@GetMapping(value = MgmtRestConstants.SYSTEM_ADMIN_MAPPING + "/caches",
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
ResponseEntity<Collection<MgmtSystemCache>> getCaches();
/**
* Invalidates all caches for all tenants.
*
* @return a list of cache names which has been invalidated
*/
@DeleteMapping(value = MgmtRestConstants.SYSTEM_ADMIN_MAPPING + "/caches")
ResponseEntity<Collection<String>> invalidateCaches();
}