Remove and Rename modules
Signed-off-by: SirWayne <dennis.melzer@bosch-si.com>
This commit is contained in:
@@ -0,0 +1,86 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
|
||||
*
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
|
||||
package org.eclipse.hawkbit.mgmt.json.model.system;
|
||||
|
||||
import org.springframework.hateoas.ResourceSupport;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude.Include;
|
||||
|
||||
/**
|
||||
* A json annotated rest model for a tenant configuration value to RESTful API
|
||||
* representation.
|
||||
*
|
||||
*/
|
||||
@JsonInclude(Include.NON_NULL)
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class MgmtSystemTenantConfigurationValue extends ResourceSupport {
|
||||
|
||||
@JsonInclude(Include.ALWAYS)
|
||||
private Object value;
|
||||
|
||||
@JsonInclude(Include.ALWAYS)
|
||||
private boolean isGlobal = true;
|
||||
|
||||
private Long lastModifiedAt;
|
||||
private String lastModifiedBy;
|
||||
private Long createdAt;
|
||||
private String createdBy;
|
||||
|
||||
public Object getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(final Object value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public boolean isGlobal() {
|
||||
return isGlobal;
|
||||
}
|
||||
|
||||
public void setGlobal(final boolean isGlobal) {
|
||||
this.isGlobal = isGlobal;
|
||||
}
|
||||
|
||||
public Long getLastModifiedAt() {
|
||||
return lastModifiedAt;
|
||||
}
|
||||
|
||||
public void setLastModifiedAt(final Long lastModifiedAt) {
|
||||
this.lastModifiedAt = lastModifiedAt;
|
||||
}
|
||||
|
||||
public String getLastModifiedBy() {
|
||||
return lastModifiedBy;
|
||||
}
|
||||
|
||||
public void setLastModifiedBy(final String lastModifiedBy) {
|
||||
this.lastModifiedBy = lastModifiedBy;
|
||||
}
|
||||
|
||||
public Long getCreatedAt() {
|
||||
return createdAt;
|
||||
}
|
||||
|
||||
public void setCreatedAt(final Long createdAt) {
|
||||
this.createdAt = createdAt;
|
||||
}
|
||||
|
||||
public String getCreatedBy() {
|
||||
return createdBy;
|
||||
}
|
||||
|
||||
public void setCreatedBy(final String createdBy) {
|
||||
this.createdBy = createdBy;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
|
||||
*
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.mgmt.json.model.system;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude.Include;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
/**
|
||||
* A json annotated rest model for System Configuration for PUT.
|
||||
*/
|
||||
@JsonInclude(Include.NON_NULL)
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class MgmtSystemTenantConfigurationValueRequest {
|
||||
|
||||
@JsonProperty(required = true)
|
||||
private Object value;
|
||||
|
||||
/**
|
||||
*
|
||||
* @return the value of the MgmtSystemTenantConfigurationValueRequest
|
||||
*/
|
||||
public Object getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the MgmtSystemTenantConfigurationValueRequest
|
||||
*
|
||||
* @param value
|
||||
*/
|
||||
public void setValue(final Object value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
|
||||
*
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
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;
|
||||
|
||||
/**
|
||||
* Model representation of an Cache entry as json.
|
||||
*
|
||||
*/
|
||||
@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;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the name
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the keys
|
||||
*/
|
||||
public Collection<String> getKeys() {
|
||||
return keys;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see java.lang.Object#toString()
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MgmtSystemCache [name=" + name + ", keys=" + keys + "]";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
|
||||
*
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
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;
|
||||
|
||||
/**
|
||||
* Body for system statistics.
|
||||
*
|
||||
*/
|
||||
@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;
|
||||
|
||||
public long getOverallTargets() {
|
||||
return overallTargets;
|
||||
}
|
||||
|
||||
public MgmtSystemStatisticsRest setOverallTargets(final long overallTargets) {
|
||||
this.overallTargets = overallTargets;
|
||||
return this;
|
||||
}
|
||||
|
||||
public long getOverallArtifacts() {
|
||||
return overallArtifacts;
|
||||
}
|
||||
|
||||
public MgmtSystemStatisticsRest setOverallArtifacts(final long overallArtifacts) {
|
||||
this.overallArtifacts = overallArtifacts;
|
||||
return this;
|
||||
}
|
||||
|
||||
public long getOverallArtifactVolumeInBytes() {
|
||||
return overallArtifactVolumeInBytes;
|
||||
}
|
||||
|
||||
public MgmtSystemStatisticsRest setOverallArtifactVolumeInBytes(final long overallArtifactVolumeInBytes) {
|
||||
this.overallArtifactVolumeInBytes = overallArtifactVolumeInBytes;
|
||||
return this;
|
||||
}
|
||||
|
||||
public long getOverallActions() {
|
||||
return overallActions;
|
||||
}
|
||||
|
||||
public MgmtSystemStatisticsRest setOverallActions(final long overallActions) {
|
||||
this.overallActions = overallActions;
|
||||
return this;
|
||||
}
|
||||
|
||||
public long getOverallTenants() {
|
||||
return overallTenants;
|
||||
}
|
||||
|
||||
public MgmtSystemStatisticsRest setOverallTenants(final long overallTenants) {
|
||||
this.overallTenants = overallTenants;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void setTenantStats(final List<MgmtSystemTenantServiceUsage> tenantStats) {
|
||||
this.tenantStats = tenantStats;
|
||||
}
|
||||
|
||||
public List<MgmtSystemTenantServiceUsage> getTenantStats() {
|
||||
return tenantStats;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
|
||||
*
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.mgmt.json.model.systemmanagement;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude.Include;
|
||||
|
||||
/**
|
||||
* Response body for system usage report.
|
||||
*
|
||||
*/
|
||||
@JsonInclude(Include.NON_NULL)
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class MgmtSystemTenantServiceUsage {
|
||||
|
||||
private final String tenantName;
|
||||
private long targets;
|
||||
private long artifacts;
|
||||
private long actions;
|
||||
private long overallArtifactVolumeInBytes;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param tenantName
|
||||
*/
|
||||
public MgmtSystemTenantServiceUsage(final String tenantName) {
|
||||
super();
|
||||
this.tenantName = tenantName;
|
||||
}
|
||||
|
||||
public long getTargets() {
|
||||
return targets;
|
||||
}
|
||||
|
||||
public void setTargets(final long targets) {
|
||||
this.targets = targets;
|
||||
}
|
||||
|
||||
public long getArtifacts() {
|
||||
return artifacts;
|
||||
}
|
||||
|
||||
public void setArtifacts(final long artifacts) {
|
||||
this.artifacts = artifacts;
|
||||
}
|
||||
|
||||
public long getActions() {
|
||||
return actions;
|
||||
}
|
||||
|
||||
public void setActions(final long actions) {
|
||||
this.actions = actions;
|
||||
}
|
||||
|
||||
public long getOverallArtifactVolumeInBytes() {
|
||||
return overallArtifactVolumeInBytes;
|
||||
}
|
||||
|
||||
public void setOverallArtifactVolumeInBytes(final long overallArtifactVolumeInBytes) {
|
||||
this.overallArtifactVolumeInBytes = overallArtifactVolumeInBytes;
|
||||
}
|
||||
|
||||
public String getTenantName() {
|
||||
return tenantName;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -11,8 +11,6 @@ package org.eclipse.hawkbit.mgmt.rest.api;
|
||||
/**
|
||||
* Constants for RESTful API.
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
public final class MgmtRestConstants {
|
||||
|
||||
@@ -46,8 +44,21 @@ public final class MgmtRestConstants {
|
||||
public static final String SOFTWAREMODULE_V1_REQUEST_MAPPING = BASE_V1_REQUEST_MAPPING + "/softwaremodules";
|
||||
|
||||
public static final String DOWNLOAD_ID_V1_REQUEST_MAPPING_BASE = "/api/" + API_VERSION + "/downloadserver/";
|
||||
|
||||
public static final String DOWNLOAD_ID_V1_REQUEST_MAPPING = "downloadId/{downloadId}";
|
||||
|
||||
/**
|
||||
* The base URL mapping for the spring acuator management context path.
|
||||
*/
|
||||
public static final String BASE_SYSTEM_MAPPING = "/system";
|
||||
|
||||
/**
|
||||
* URL mapping for system admin operations.
|
||||
*/
|
||||
public static final String SYSTEM_ADMIN_MAPPING = BASE_SYSTEM_MAPPING + "/admin";
|
||||
|
||||
public static final String SYSTEM_V1_REQUEST_MAPPING = BASE_V1_REQUEST_MAPPING + BASE_SYSTEM_MAPPING;
|
||||
|
||||
/**
|
||||
* The target URL mapping, href link for assigned distribution set.
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
|
||||
*
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
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.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
|
||||
/**
|
||||
* {@link SystemManagement} capabilities by REST.
|
||||
*
|
||||
*/
|
||||
@RequestMapping(MgmtRestConstants.SYSTEM_ADMIN_MAPPING)
|
||||
public interface MgmtSystemManagementRestApi {
|
||||
|
||||
/**
|
||||
* Deletes the tenant data of a given tenant. USE WITH CARE!
|
||||
*
|
||||
* @param tenant
|
||||
* to delete
|
||||
* @return HttpStatus.OK
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.DELETE, value = "/tenants/{tenant}")
|
||||
ResponseEntity<Void> deleteTenant(@PathVariable("tenant") final String tenant);
|
||||
|
||||
/**
|
||||
* Collects and returns system usage statistics. It provides a system wide
|
||||
* overview and tenant based stats.
|
||||
*
|
||||
* @return system usage statistics
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.GET, value = "/usage", produces = { "application/hal+json",
|
||||
MediaType.APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<MgmtSystemStatisticsRest> getSystemUsageStats();
|
||||
|
||||
/**
|
||||
* Returns a list of all caches.
|
||||
*
|
||||
* @return a list of caches for all tenants
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.GET, value = "/caches")
|
||||
ResponseEntity<Collection<MgmtSystemCache>> getCaches();
|
||||
|
||||
/**
|
||||
* Invalidates all caches for all tenants.
|
||||
*
|
||||
* @return a list of cache names which has been invalidated
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.DELETE, value = "/caches")
|
||||
ResponseEntity<Collection<String>> invalidateCaches();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
|
||||
*
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.mgmt.rest.api;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.hawkbit.mgmt.json.model.system.MgmtSystemTenantConfigurationValue;
|
||||
import org.eclipse.hawkbit.mgmt.json.model.system.MgmtSystemTenantConfigurationValueRequest;
|
||||
import org.springframework.hateoas.ResourceSupport;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
|
||||
/**
|
||||
* REST Resource handling tenant specific configuration operations.
|
||||
*
|
||||
*
|
||||
*/
|
||||
@RequestMapping(MgmtRestConstants.SYSTEM_V1_REQUEST_MAPPING)
|
||||
public interface MgmtSystemRestApi {
|
||||
|
||||
@RequestMapping(method = RequestMethod.GET, produces = { "application/hal+json", MediaType.APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<ResourceSupport> getSystem();
|
||||
|
||||
/**
|
||||
* @return a Map of all configuration values.
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.GET, value = "/configs", produces = { "application/hal+json",
|
||||
MediaType.APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<Map<String, MgmtSystemTenantConfigurationValue>> getSystemConfiguration();
|
||||
|
||||
/**
|
||||
* Handles the DELETE request of deleting a tenant specific configuration
|
||||
* value within SP.
|
||||
*
|
||||
* @param keyName
|
||||
* the Name of the configuration key
|
||||
* @return If the given configuration value exists and could be deleted Http
|
||||
* OK. In any failure the JsonResponseExceptionHandler is handling
|
||||
* the response.
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.DELETE, value = "/configs/{keyName}", produces = { "application/hal+json",
|
||||
MediaType.APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<Void> deleteConfigurationValue(@PathVariable("keyName") final String keyName);
|
||||
|
||||
/**
|
||||
* Handles the GET request of deleting a tenant specific configuration value
|
||||
* within SP.
|
||||
*
|
||||
* @param keyName
|
||||
* the Name of the configuration key
|
||||
* @return If the given configuration value exists and could be get Http OK.
|
||||
* In any failure the JsonResponseExceptionHandler is handling the
|
||||
* response.
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.GET, value = "/configs/{keyName}", produces = { "application/hal+json",
|
||||
MediaType.APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<MgmtSystemTenantConfigurationValue> getConfigurationValue(
|
||||
@PathVariable("keyName") final String keyName);
|
||||
|
||||
/**
|
||||
* Handles the GET request of deleting a tenant specific configuration value
|
||||
* within SP.
|
||||
*
|
||||
* @param keyName
|
||||
* the Name of the configuration key
|
||||
* @param configurationValueRest
|
||||
* the new value for the configuration
|
||||
* @return If the given configuration value exists and could be get Http OK.
|
||||
* In any failure the JsonResponseExceptionHandler is handling the
|
||||
* response.
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.PUT, value = "/configs/{keyName}", consumes = { "application/hal+json",
|
||||
MediaType.APPLICATION_JSON_VALUE }, produces = { "application/hal+json", MediaType.APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<MgmtSystemTenantConfigurationValue> updateConfigurationValue(
|
||||
@PathVariable("keyName") final String keyName,
|
||||
@RequestBody final MgmtSystemTenantConfigurationValueRequest configurationValueRest);
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user