Merge branch 'master' into feature_dmf_disable
This commit is contained in:
@@ -93,7 +93,7 @@ public class SimulationController {
|
|||||||
gatewayToken));
|
gatewayToken));
|
||||||
}
|
}
|
||||||
|
|
||||||
return ResponseEntity.ok("Updated " + amount + " DMF connected targets!");
|
return ResponseEntity.ok("Updated " + amount + " " + protocol + " connected targets!");
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isDmfDisabled() {
|
private boolean isDmfDisabled() {
|
||||||
|
|||||||
@@ -32,7 +32,14 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.cloud</groupId>
|
<groupId>org.springframework.cloud</groupId>
|
||||||
<artifactId>spring-cloud-netflix-core</artifactId>
|
<artifactId>spring-cloud-netflix-core</artifactId>
|
||||||
<version>1.0.7.RELEASE</version>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-commons</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-context</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.slf4j</groupId>
|
<groupId>org.slf4j</groupId>
|
||||||
|
|||||||
@@ -10,12 +10,14 @@ package org.eclipse.hawkbit.feign.core.client;
|
|||||||
|
|
||||||
import java.lang.annotation.Annotation;
|
import java.lang.annotation.Annotation;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.cloud.netflix.feign.support.SpringMvcContract;
|
import org.springframework.cloud.netflix.feign.support.SpringMvcContract;
|
||||||
|
|
||||||
import feign.MethodMetadata;
|
import feign.MethodMetadata;
|
||||||
|
import feign.Param;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Own implementation of the {@link SpringMvcContract} which catches the
|
* Own implementation of the {@link SpringMvcContract} which catches the
|
||||||
@@ -38,6 +40,10 @@ public class IgnoreMultipleConsumersProducersSpringMvcContract extends SpringMvc
|
|||||||
// multiple consumers and produces, see
|
// multiple consumers and produces, see
|
||||||
// https://github.com/spring-cloud/spring-cloud-netflix/issues/808
|
// https://github.com/spring-cloud/spring-cloud-netflix/issues/808
|
||||||
LOGGER.trace(e.getMessage(), e);
|
LOGGER.trace(e.getMessage(), e);
|
||||||
|
|
||||||
|
// This line from super is mandatory to avoid that access to the
|
||||||
|
// expander causes a nullpointer.
|
||||||
|
data.indexToExpander(new LinkedHashMap<Integer, Param.Expander>());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,18 +20,6 @@
|
|||||||
|
|
||||||
<name>hawkBit-example :: DDI Feign Client</name>
|
<name>hawkBit-example :: DDI Feign Client</name>
|
||||||
|
|
||||||
<dependencyManagement>
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.cloud</groupId>
|
|
||||||
<artifactId>spring-cloud-netflix</artifactId>
|
|
||||||
<version>1.0.7.RELEASE</version>
|
|
||||||
<type>pom</type>
|
|
||||||
<scope>import</scope>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
</dependencyManagement>
|
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.eclipse.hawkbit</groupId>
|
<groupId>org.eclipse.hawkbit</groupId>
|
||||||
|
|||||||
@@ -9,13 +9,12 @@
|
|||||||
package org.eclipse.hawkbit.mgmt.client.resource;
|
package org.eclipse.hawkbit.mgmt.client.resource;
|
||||||
|
|
||||||
import org.eclipse.hawkbit.mgmt.rest.api.MgmtDistributionSetRestApi;
|
import org.eclipse.hawkbit.mgmt.rest.api.MgmtDistributionSetRestApi;
|
||||||
import org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants;
|
|
||||||
import org.springframework.cloud.netflix.feign.FeignClient;
|
import org.springframework.cloud.netflix.feign.FeignClient;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Client binding for the DistributionSet resource of the management API.
|
* Client binding for the DistributionSet resource of the management API.
|
||||||
*/
|
*/
|
||||||
@FeignClient(url = "${hawkbit.url:localhost:8080}" + MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING)
|
@FeignClient(name = "MgmtDistributionSetClient", url = "${hawkbit.url:localhost:8080}")
|
||||||
public interface MgmtDistributionSetClientResource extends MgmtDistributionSetRestApi {
|
public interface MgmtDistributionSetClientResource extends MgmtDistributionSetRestApi {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,12 +9,11 @@
|
|||||||
package org.eclipse.hawkbit.mgmt.client.resource;
|
package org.eclipse.hawkbit.mgmt.client.resource;
|
||||||
|
|
||||||
import org.eclipse.hawkbit.mgmt.rest.api.MgmtDistributionSetTagRestApi;
|
import org.eclipse.hawkbit.mgmt.rest.api.MgmtDistributionSetTagRestApi;
|
||||||
import org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants;
|
|
||||||
import org.springframework.cloud.netflix.feign.FeignClient;
|
import org.springframework.cloud.netflix.feign.FeignClient;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Client binding for the DistributionSetTag resource of the management API.
|
* Client binding for the DistributionSetTag resource of the management API.
|
||||||
*/
|
*/
|
||||||
@FeignClient(url = "${hawkbit.url:localhost:8080}" + MgmtRestConstants.DISTRIBUTIONSET_TAG_V1_REQUEST_MAPPING)
|
@FeignClient(name = "MgmtDistributionSetTagClient", url = "${hawkbit.url:localhost:8080}")
|
||||||
public interface MgmtDistributionSetTagClientResource extends MgmtDistributionSetTagRestApi {
|
public interface MgmtDistributionSetTagClientResource extends MgmtDistributionSetTagRestApi {
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,14 +9,13 @@
|
|||||||
package org.eclipse.hawkbit.mgmt.client.resource;
|
package org.eclipse.hawkbit.mgmt.client.resource;
|
||||||
|
|
||||||
import org.eclipse.hawkbit.mgmt.rest.api.MgmtDistributionSetTypeRestApi;
|
import org.eclipse.hawkbit.mgmt.rest.api.MgmtDistributionSetTypeRestApi;
|
||||||
import org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants;
|
|
||||||
import org.springframework.cloud.netflix.feign.FeignClient;
|
import org.springframework.cloud.netflix.feign.FeignClient;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Client binding for the DistributionSetType resource of the management API.
|
* Client binding for the DistributionSetType resource of the management API.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@FeignClient(url = "${hawkbit.url:localhost:8080}" + MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_REQUEST_MAPPING)
|
@FeignClient(name = "MgmtDistributionSetTypeClient", url = "${hawkbit.url:localhost:8080}")
|
||||||
public interface MgmtDistributionSetTypeClientResource extends MgmtDistributionSetTypeRestApi {
|
public interface MgmtDistributionSetTypeClientResource extends MgmtDistributionSetTypeRestApi {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,14 +9,13 @@
|
|||||||
package org.eclipse.hawkbit.mgmt.client.resource;
|
package org.eclipse.hawkbit.mgmt.client.resource;
|
||||||
|
|
||||||
import org.eclipse.hawkbit.mgmt.rest.api.MgmtDownloadArtifactRestApi;
|
import org.eclipse.hawkbit.mgmt.rest.api.MgmtDownloadArtifactRestApi;
|
||||||
import org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants;
|
|
||||||
import org.springframework.cloud.netflix.feign.FeignClient;
|
import org.springframework.cloud.netflix.feign.FeignClient;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A feign-client interface declaration which allows to build a feign-client
|
* A feign-client interface declaration which allows to build a feign-client
|
||||||
* stub.
|
* stub.
|
||||||
*/
|
*/
|
||||||
@FeignClient(url = "${hawkbit.url:localhost:8080}" + MgmtRestConstants.SOFTWAREMODULE_V1_REQUEST_MAPPING)
|
@FeignClient(name = "MgmtDownloadArtifactClient", url = "${hawkbit.url:localhost:8080}")
|
||||||
public interface MgmtDownloadArtifactClientResource extends MgmtDownloadArtifactRestApi {
|
public interface MgmtDownloadArtifactClientResource extends MgmtDownloadArtifactRestApi {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,12 +9,11 @@
|
|||||||
package org.eclipse.hawkbit.mgmt.client.resource;
|
package org.eclipse.hawkbit.mgmt.client.resource;
|
||||||
|
|
||||||
import org.eclipse.hawkbit.mgmt.rest.api.MgmtDownloadRestApi;
|
import org.eclipse.hawkbit.mgmt.rest.api.MgmtDownloadRestApi;
|
||||||
import org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants;
|
|
||||||
import org.springframework.cloud.netflix.feign.FeignClient;
|
import org.springframework.cloud.netflix.feign.FeignClient;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@FeignClient(url = "${hawkbit.url:localhost:8080}" + MgmtRestConstants.DOWNLOAD_ID_V1_REQUEST_MAPPING_BASE)
|
@FeignClient(name = "MgmtDownloadClient", url = "${hawkbit.url:localhost:8080}")
|
||||||
public interface MgmtDownloadClientResource extends MgmtDownloadRestApi {
|
public interface MgmtDownloadClientResource extends MgmtDownloadRestApi {
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,13 +8,12 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.mgmt.client.resource;
|
package org.eclipse.hawkbit.mgmt.client.resource;
|
||||||
|
|
||||||
import org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants;
|
|
||||||
import org.eclipse.hawkbit.mgmt.rest.api.MgmtRolloutRestApi;
|
import org.eclipse.hawkbit.mgmt.rest.api.MgmtRolloutRestApi;
|
||||||
import org.springframework.cloud.netflix.feign.FeignClient;
|
import org.springframework.cloud.netflix.feign.FeignClient;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Client binding for the Rollout resource of the management API.
|
* Client binding for the Rollout resource of the management API.
|
||||||
*/
|
*/
|
||||||
@FeignClient(url = "${hawkbit.url:localhost:8080}" + MgmtRestConstants.ROLLOUT_V1_REQUEST_MAPPING)
|
@FeignClient(name = "MgmtRolloutClient", url = "${hawkbit.url:localhost:8080}")
|
||||||
public interface MgmtRolloutClientResource extends MgmtRolloutRestApi {
|
public interface MgmtRolloutClientResource extends MgmtRolloutRestApi {
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,6 @@
|
|||||||
package org.eclipse.hawkbit.mgmt.client.resource;
|
package org.eclipse.hawkbit.mgmt.client.resource;
|
||||||
|
|
||||||
import org.eclipse.hawkbit.mgmt.json.model.artifact.MgmtArtifact;
|
import org.eclipse.hawkbit.mgmt.json.model.artifact.MgmtArtifact;
|
||||||
import org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants;
|
|
||||||
import org.eclipse.hawkbit.mgmt.rest.api.MgmtSoftwareModuleRestApi;
|
import org.eclipse.hawkbit.mgmt.rest.api.MgmtSoftwareModuleRestApi;
|
||||||
import org.springframework.cloud.netflix.feign.FeignClient;
|
import org.springframework.cloud.netflix.feign.FeignClient;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
@@ -24,7 +23,7 @@ import feign.Param;
|
|||||||
/**
|
/**
|
||||||
* Client binding for the SoftwareModule resource of the management API.
|
* Client binding for the SoftwareModule resource of the management API.
|
||||||
*/
|
*/
|
||||||
@FeignClient(url = "${hawkbit.url:localhost:8080}" + MgmtRestConstants.SOFTWAREMODULE_V1_REQUEST_MAPPING)
|
@FeignClient(name = "MgmtSoftwareModuleClient", url = "${hawkbit.url:localhost:8080}")
|
||||||
public interface MgmtSoftwareModuleClientResource extends MgmtSoftwareModuleRestApi {
|
public interface MgmtSoftwareModuleClientResource extends MgmtSoftwareModuleRestApi {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -8,13 +8,12 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.mgmt.client.resource;
|
package org.eclipse.hawkbit.mgmt.client.resource;
|
||||||
|
|
||||||
import org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants;
|
|
||||||
import org.eclipse.hawkbit.mgmt.rest.api.MgmtSoftwareModuleTypeRestApi;
|
import org.eclipse.hawkbit.mgmt.rest.api.MgmtSoftwareModuleTypeRestApi;
|
||||||
import org.springframework.cloud.netflix.feign.FeignClient;
|
import org.springframework.cloud.netflix.feign.FeignClient;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Client binding for the SoftwareModuleType resource of the management API.
|
* Client binding for the SoftwareModuleType resource of the management API.
|
||||||
*/
|
*/
|
||||||
@FeignClient(url = "${hawkbit.url:localhost:8080}" + MgmtRestConstants.SOFTWAREMODULETYPE_V1_REQUEST_MAPPING)
|
@FeignClient(name = "MgmtSoftwareModuleTypeClient", url = "${hawkbit.url:localhost:8080}")
|
||||||
public interface MgmtSoftwareModuleTypeClientResource extends MgmtSoftwareModuleTypeRestApi {
|
public interface MgmtSoftwareModuleTypeClientResource extends MgmtSoftwareModuleTypeRestApi {
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.mgmt.client.resource;
|
package org.eclipse.hawkbit.mgmt.client.resource;
|
||||||
|
|
||||||
import org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants;
|
|
||||||
import org.eclipse.hawkbit.mgmt.rest.api.MgmtSystemRestApi;
|
import org.eclipse.hawkbit.mgmt.rest.api.MgmtSystemRestApi;
|
||||||
import org.springframework.cloud.netflix.feign.FeignClient;
|
import org.springframework.cloud.netflix.feign.FeignClient;
|
||||||
|
|
||||||
@@ -16,6 +15,6 @@ import org.springframework.cloud.netflix.feign.FeignClient;
|
|||||||
* Client binding for the {@link MgmtSystemRestApi}.
|
* Client binding for the {@link MgmtSystemRestApi}.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@FeignClient(url = "${hawkbit.url:localhost:8080}" + MgmtRestConstants.SYSTEM_V1_REQUEST_MAPPING)
|
@FeignClient(name = "MgmtSystemClient", url = "${hawkbit.url:localhost:8080}")
|
||||||
public interface MgmtSystemClientResource extends MgmtSystemRestApi {
|
public interface MgmtSystemClientResource extends MgmtSystemRestApi {
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.mgmt.client.resource;
|
package org.eclipse.hawkbit.mgmt.client.resource;
|
||||||
|
|
||||||
import org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants;
|
|
||||||
import org.eclipse.hawkbit.mgmt.rest.api.MgmtSystemManagementRestApi;
|
import org.eclipse.hawkbit.mgmt.rest.api.MgmtSystemManagementRestApi;
|
||||||
import org.springframework.cloud.netflix.feign.FeignClient;
|
import org.springframework.cloud.netflix.feign.FeignClient;
|
||||||
|
|
||||||
@@ -16,7 +15,7 @@ import org.springframework.cloud.netflix.feign.FeignClient;
|
|||||||
* Client binding for the {@link MgmtSystemManagementRestApi}.
|
* Client binding for the {@link MgmtSystemManagementRestApi}.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@FeignClient(url = "${hawkbit.url:localhost:8080}" + MgmtRestConstants.SYSTEM_ADMIN_MAPPING)
|
@FeignClient(name = "MgmtSystemManagementClient", url = "${hawkbit.url:localhost:8080}")
|
||||||
public interface MgmtSystemManagementClientResource extends MgmtSystemManagementRestApi {
|
public interface MgmtSystemManagementClientResource extends MgmtSystemManagementRestApi {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,13 +8,12 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.mgmt.client.resource;
|
package org.eclipse.hawkbit.mgmt.client.resource;
|
||||||
|
|
||||||
import org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants;
|
|
||||||
import org.eclipse.hawkbit.mgmt.rest.api.MgmtTargetRestApi;
|
import org.eclipse.hawkbit.mgmt.rest.api.MgmtTargetRestApi;
|
||||||
import org.springframework.cloud.netflix.feign.FeignClient;
|
import org.springframework.cloud.netflix.feign.FeignClient;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Client binding for the Target resource of the management API.
|
* Client binding for the Target resource of the management API.
|
||||||
*/
|
*/
|
||||||
@FeignClient(url = "${hawkbit.url:localhost:8080}" + MgmtRestConstants.TARGET_V1_REQUEST_MAPPING)
|
@FeignClient(name = "MgmtTargetClient", url = "${hawkbit.url:localhost:8080}")
|
||||||
public interface MgmtTargetClientResource extends MgmtTargetRestApi {
|
public interface MgmtTargetClientResource extends MgmtTargetRestApi {
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,13 +8,12 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.mgmt.client.resource;
|
package org.eclipse.hawkbit.mgmt.client.resource;
|
||||||
|
|
||||||
import org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants;
|
|
||||||
import org.eclipse.hawkbit.mgmt.rest.api.MgmtTargetTagRestApi;
|
import org.eclipse.hawkbit.mgmt.rest.api.MgmtTargetTagRestApi;
|
||||||
import org.springframework.cloud.netflix.feign.FeignClient;
|
import org.springframework.cloud.netflix.feign.FeignClient;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Client binding for the TargetTag resource of the management API.
|
* Client binding for the TargetTag resource of the management API.
|
||||||
*/
|
*/
|
||||||
@FeignClient(url = "${hawkbit.url:localhost:8080}" + MgmtRestConstants.TARGET_TAG_V1_REQUEST_MAPPING)
|
@FeignClient(name = "MgmtTargetTagClient", url = "${hawkbit.url:localhost:8080}")
|
||||||
public interface MgmtTargetTagClientResource extends MgmtTargetTagRestApi {
|
public interface MgmtTargetTagClientResource extends MgmtTargetTagRestApi {
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,40 +42,12 @@
|
|||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
<dependencyManagement>
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.cloud</groupId>
|
|
||||||
<artifactId>spring-cloud-netflix</artifactId>
|
|
||||||
<version>1.0.7.RELEASE</version>
|
|
||||||
<type>pom</type>
|
|
||||||
<scope>import</scope>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
</dependencyManagement>
|
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.eclipse.hawkbit</groupId>
|
<groupId>org.eclipse.hawkbit</groupId>
|
||||||
<artifactId>hawkbit-example-mgmt-feign-client</artifactId>
|
<artifactId>hawkbit-example-mgmt-feign-client</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>com.netflix.feign</groupId>
|
|
||||||
<artifactId>feign-core</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.netflix.feign</groupId>
|
|
||||||
<artifactId>feign-jackson</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.fasterxml.jackson.core</groupId>
|
|
||||||
<artifactId>jackson-databind</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<artifactId>hibernate-validator</artifactId>
|
|
||||||
<groupId>org.hibernate</groupId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter</artifactId>
|
<artifactId>spring-boot-starter</artifactId>
|
||||||
|
|||||||
@@ -17,9 +17,8 @@ import org.eclipse.hawkbit.mgmt.client.resource.MgmtTargetClientResource;
|
|||||||
import org.eclipse.hawkbit.mgmt.client.scenarios.ConfigurableScenario;
|
import org.eclipse.hawkbit.mgmt.client.scenarios.ConfigurableScenario;
|
||||||
import org.eclipse.hawkbit.mgmt.client.scenarios.CreateStartedRolloutExample;
|
import org.eclipse.hawkbit.mgmt.client.scenarios.CreateStartedRolloutExample;
|
||||||
import org.eclipse.hawkbit.mgmt.client.scenarios.upload.FeignMultipartEncoder;
|
import org.eclipse.hawkbit.mgmt.client.scenarios.upload.FeignMultipartEncoder;
|
||||||
import org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Qualifier;
|
import org.springframework.boot.Banner.Mode;
|
||||||
import org.springframework.boot.CommandLineRunner;
|
import org.springframework.boot.CommandLineRunner;
|
||||||
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
@@ -49,9 +48,6 @@ import feign.slf4j.Slf4jLogger;
|
|||||||
@Import(FeignClientConfiguration.class)
|
@Import(FeignClientConfiguration.class)
|
||||||
public class Application implements CommandLineRunner {
|
public class Application implements CommandLineRunner {
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private ClientConfigurationProperties configuration;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ConfigurableScenario configuredScenario;
|
private ConfigurableScenario configuredScenario;
|
||||||
|
|
||||||
@@ -59,7 +55,7 @@ public class Application implements CommandLineRunner {
|
|||||||
private CreateStartedRolloutExample gettingStartedRolloutScenario;
|
private CreateStartedRolloutExample gettingStartedRolloutScenario;
|
||||||
|
|
||||||
public static void main(final String[] args) {
|
public static void main(final String[] args) {
|
||||||
new SpringApplicationBuilder().showBanner(false).sources(Application.class).run(args);
|
new SpringApplicationBuilder().bannerMode(Mode.OFF).sources(Application.class).run(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -74,18 +70,18 @@ public class Application implements CommandLineRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public BasicAuthRequestInterceptor basicAuthRequestInterceptor() {
|
public BasicAuthRequestInterceptor basicAuthRequestInterceptor(final ClientConfigurationProperties configuration) {
|
||||||
return new BasicAuthRequestInterceptor(configuration.getUsername(), configuration.getPassword());
|
return new BasicAuthRequestInterceptor(configuration.getUsername(), configuration.getPassword());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public ConfigurableScenario configurableScenario(final MgmtDistributionSetClientResource distributionSetResource,
|
public ConfigurableScenario configurableScenario(final MgmtDistributionSetClientResource distributionSetResource,
|
||||||
@Qualifier("mgmtSoftwareModuleClientResource") final MgmtSoftwareModuleClientResource softwareModuleResource,
|
final MgmtSoftwareModuleClientResource softwareModuleResource,
|
||||||
@Qualifier("uploadSoftwareModule") final MgmtSoftwareModuleClientResource uploadSoftwareModule,
|
|
||||||
final MgmtTargetClientResource targetResource, final MgmtRolloutClientResource rolloutResource,
|
final MgmtTargetClientResource targetResource, final MgmtRolloutClientResource rolloutResource,
|
||||||
final ClientConfigurationProperties clientConfigurationProperties) {
|
final ClientConfigurationProperties clientConfigurationProperties) {
|
||||||
return new ConfigurableScenario(distributionSetResource, softwareModuleResource, uploadSoftwareModule,
|
return new ConfigurableScenario(distributionSetResource, softwareModuleResource,
|
||||||
targetResource, rolloutResource, clientConfigurationProperties);
|
uploadSoftwareModule(clientConfigurationProperties), targetResource, rolloutResource,
|
||||||
|
clientConfigurationProperties);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
@@ -94,23 +90,21 @@ public class Application implements CommandLineRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public Logger.Level feignLoggerLevel() {
|
public MgmtSoftwareModuleClientResource uploadSoftwareModule(final ClientConfigurationProperties configuration) {
|
||||||
return Logger.Level.FULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Bean
|
|
||||||
public MgmtSoftwareModuleClientResource uploadSoftwareModule() {
|
|
||||||
final ObjectMapper mapper = new ObjectMapper()
|
final ObjectMapper mapper = new ObjectMapper()
|
||||||
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)
|
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)
|
||||||
.registerModule(new Jackson2HalModule());
|
.registerModule(new Jackson2HalModule());
|
||||||
|
|
||||||
return Feign.builder().contract(new IgnoreMultipleConsumersProducersSpringMvcContract())
|
return Feign.builder().contract(new IgnoreMultipleConsumersProducersSpringMvcContract())
|
||||||
.requestInterceptor(
|
.requestInterceptor(
|
||||||
new BasicAuthRequestInterceptor(configuration.getUsername(), configuration.getPassword()))
|
new BasicAuthRequestInterceptor(configuration.getUsername(), configuration.getPassword()))
|
||||||
.logger(new Slf4jLogger()).encoder(new FeignMultipartEncoder())
|
.logger(new Slf4jLogger()).encoder(new FeignMultipartEncoder())
|
||||||
.decoder(new ResponseEntityDecoder(new JacksonDecoder(mapper)))
|
.decoder(new ResponseEntityDecoder(new JacksonDecoder(mapper)))
|
||||||
.target(MgmtSoftwareModuleClientResource.class,
|
.target(MgmtSoftwareModuleClientResource.class, configuration.getUrl());
|
||||||
configuration.getUrl() + MgmtRestConstants.SOFTWAREMODULE_V1_REQUEST_MAPPING);
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public Logger.Level feignLoggerLevel() {
|
||||||
|
return Logger.Level.FULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean containsArg(final String containsArg, final String... args) {
|
private static boolean containsArg(final String containsArg, final String... args) {
|
||||||
|
|||||||
@@ -31,7 +31,6 @@ import org.eclipse.hawkbit.mgmt.json.model.softwaremodule.MgmtSoftwareModule;
|
|||||||
import org.eclipse.hawkbit.mgmt.json.model.target.MgmtTarget;
|
import org.eclipse.hawkbit.mgmt.json.model.target.MgmtTarget;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Qualifier;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -50,18 +49,18 @@ public class ConfigurableScenario {
|
|||||||
|
|
||||||
private final MgmtSoftwareModuleClientResource softwareModuleResource;
|
private final MgmtSoftwareModuleClientResource softwareModuleResource;
|
||||||
|
|
||||||
private final MgmtSoftwareModuleClientResource uploadSoftwareModule;
|
|
||||||
|
|
||||||
private final MgmtTargetClientResource targetResource;
|
private final MgmtTargetClientResource targetResource;
|
||||||
|
|
||||||
private final MgmtRolloutClientResource rolloutResource;
|
private final MgmtRolloutClientResource rolloutResource;
|
||||||
|
|
||||||
private final ClientConfigurationProperties clientConfigurationProperties;
|
private final ClientConfigurationProperties clientConfigurationProperties;
|
||||||
|
|
||||||
|
private final MgmtSoftwareModuleClientResource uploadSoftwareModule;
|
||||||
|
|
||||||
public ConfigurableScenario(final MgmtDistributionSetClientResource distributionSetResource,
|
public ConfigurableScenario(final MgmtDistributionSetClientResource distributionSetResource,
|
||||||
@Qualifier("mgmtSoftwareModuleClientResource") final MgmtSoftwareModuleClientResource softwareModuleResource,
|
final MgmtSoftwareModuleClientResource softwareModuleResource,
|
||||||
@Qualifier("uploadSoftwareModule") final MgmtSoftwareModuleClientResource uploadSoftwareModule,
|
final MgmtSoftwareModuleClientResource uploadSoftwareModule, final MgmtTargetClientResource targetResource,
|
||||||
final MgmtTargetClientResource targetResource, final MgmtRolloutClientResource rolloutResource,
|
final MgmtRolloutClientResource rolloutResource,
|
||||||
final ClientConfigurationProperties clientConfigurationProperties) {
|
final ClientConfigurationProperties clientConfigurationProperties) {
|
||||||
this.distributionSetResource = distributionSetResource;
|
this.distributionSetResource = distributionSetResource;
|
||||||
this.softwareModuleResource = softwareModuleResource;
|
this.softwareModuleResource = softwareModuleResource;
|
||||||
@@ -191,7 +190,7 @@ public class ConfigurableScenario {
|
|||||||
.type("application").buildAsList(scenario.getAppModulesPerDistributionSet()))
|
.type("application").buildAsList(scenario.getAppModulesPerDistributionSet()))
|
||||||
.getBody());
|
.getBody());
|
||||||
|
|
||||||
for (int x = 0; x < scenario.getArtifactsPerSM(); x++) {
|
for (int iArtifact = 0; iArtifact < scenario.getArtifactsPerSM(); iArtifact++) {
|
||||||
modules.forEach(module -> {
|
modules.forEach(module -> {
|
||||||
final ArtifactFile file = new ArtifactFile("dummyfile.dummy", null, "multipart/form-data", artifact);
|
final ArtifactFile file = new ArtifactFile("dummyfile.dummy", null, "multipart/form-data", artifact);
|
||||||
uploadSoftwareModule.uploadArtifact(module.getModuleId(), file, null, null, null);
|
uploadSoftwareModule.uploadArtifact(module.getModuleId(), file, null, null, null);
|
||||||
@@ -201,21 +200,6 @@ public class ConfigurableScenario {
|
|||||||
return modules;
|
return modules;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static byte[] generateArtifact(final Scenario scenario) {
|
|
||||||
|
|
||||||
// Exception squid:S2245 - not used for cryptographic function
|
|
||||||
@SuppressWarnings("squid:S2245")
|
|
||||||
final Random random = new Random();
|
|
||||||
|
|
||||||
// create byte array
|
|
||||||
final byte[] nbyte = new byte[parseSize(scenario.getArtifactSize())];
|
|
||||||
|
|
||||||
// put the next byte in the array
|
|
||||||
random.nextBytes(nbyte);
|
|
||||||
|
|
||||||
return nbyte;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void createTargets(final Scenario scenario) {
|
private void createTargets(final Scenario scenario) {
|
||||||
LOGGER.info("Creating {} targets", scenario.getTargets());
|
LOGGER.info("Creating {} targets", scenario.getTargets());
|
||||||
|
|
||||||
@@ -239,4 +223,19 @@ public class ConfigurableScenario {
|
|||||||
}
|
}
|
||||||
return Integer.valueOf(size);
|
return Integer.valueOf(size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static byte[] generateArtifact(final Scenario scenario) {
|
||||||
|
|
||||||
|
// Exception squid:S2245 - not used for cryptographic function
|
||||||
|
@SuppressWarnings("squid:S2245")
|
||||||
|
final Random random = new Random();
|
||||||
|
|
||||||
|
// create byte array
|
||||||
|
final byte[] nbyte = new byte[parseSize(scenario.getArtifactSize())];
|
||||||
|
|
||||||
|
// put the next byte in the array
|
||||||
|
random.nextBytes(nbyte);
|
||||||
|
|
||||||
|
return nbyte;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,6 @@ import org.eclipse.hawkbit.mgmt.json.model.rollout.MgmtRolloutResponseBody;
|
|||||||
import org.eclipse.hawkbit.mgmt.json.model.softwaremodule.MgmtSoftwareModule;
|
import org.eclipse.hawkbit.mgmt.json.model.softwaremodule.MgmtSoftwareModule;
|
||||||
import org.eclipse.hawkbit.mgmt.json.model.softwaremoduletype.MgmtSoftwareModuleType;
|
import org.eclipse.hawkbit.mgmt.json.model.softwaremoduletype.MgmtSoftwareModuleType;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Qualifier;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Example for creating and starting a Rollout.
|
* Example for creating and starting a Rollout.
|
||||||
@@ -46,7 +45,6 @@ public class CreateStartedRolloutExample {
|
|||||||
private MgmtDistributionSetClientResource distributionSetResource;
|
private MgmtDistributionSetClientResource distributionSetResource;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
@Qualifier("mgmtSoftwareModuleClientResource")
|
|
||||||
private MgmtSoftwareModuleClientResource softwareModuleResource;
|
private MgmtSoftwareModuleClientResource softwareModuleResource;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
|||||||
@@ -8,7 +8,8 @@
|
|||||||
http://www.eclipse.org/legal/epl-v10.html
|
http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
|
||||||
-->
|
-->
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
<parent>
|
<parent>
|
||||||
@@ -28,33 +29,21 @@
|
|||||||
<module>hawkbit-example-ddi-feign-client</module>
|
<module>hawkbit-example-ddi-feign-client</module>
|
||||||
<module>hawkbit-example-mgmt-feign-client</module>
|
<module>hawkbit-example-mgmt-feign-client</module>
|
||||||
<module>hawkbit-example-mgmt-simulator</module>
|
<module>hawkbit-example-mgmt-simulator</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
|
|
||||||
<properties>
|
|
||||||
<feign.version>8.14.2</feign.version>
|
|
||||||
</properties>
|
|
||||||
|
|
||||||
<dependencyManagement>
|
<dependencyManagement>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.netflix.feign</groupId>
|
<groupId>org.springframework.cloud</groupId>
|
||||||
<artifactId>feign-core</artifactId>
|
<artifactId>spring-cloud-dependencies</artifactId>
|
||||||
<!-- need to overwrite for the interface inheritance feature of feign-core -->
|
<version>Brixton.SR5</version>
|
||||||
<!-- <version>8.16.0</version> -->
|
<type>pom</type>
|
||||||
<version>${feign.version}</version>
|
<scope>import</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.netflix.feign</groupId>
|
<groupId>com.netflix.feign</groupId>
|
||||||
<artifactId>feign-jackson</artifactId>
|
<artifactId>feign-jackson</artifactId>
|
||||||
<!-- need to overwrite for the interface inheritance feature of feign-core -->
|
<version>8.16.2</version>
|
||||||
<!-- <version>8.16.0</version> -->
|
|
||||||
<version>${feign.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.netflix.feign</groupId>
|
|
||||||
<artifactId>feign-slf4j</artifactId>
|
|
||||||
<version>${feign.version}</version>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</dependencyManagement>
|
</dependencyManagement>
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ import org.springframework.http.HttpStatus;
|
|||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
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.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMethod;
|
import org.springframework.web.bind.annotation.RequestMethod;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
@@ -150,7 +149,7 @@ public interface DdiRootControllerRestApi {
|
|||||||
*/
|
*/
|
||||||
@RequestMapping(value = "/{targetid}/" + DdiRestConstants.DEPLOYMENT_BASE_ACTION + "/{actionId}/"
|
@RequestMapping(value = "/{targetid}/" + DdiRestConstants.DEPLOYMENT_BASE_ACTION + "/{actionId}/"
|
||||||
+ DdiRestConstants.FEEDBACK, method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
|
+ DdiRestConstants.FEEDBACK, method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||||
ResponseEntity<Void> postBasedeploymentActionFeedback(@Valid @RequestBody final DdiActionFeedback feedback,
|
ResponseEntity<Void> postBasedeploymentActionFeedback(@Valid final DdiActionFeedback feedback,
|
||||||
@PathVariable("targetid") final String targetid, @PathVariable("actionId") @NotEmpty final Long actionId);
|
@PathVariable("targetid") final String targetid, @PathVariable("actionId") @NotEmpty final Long actionId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -167,7 +166,7 @@ public interface DdiRootControllerRestApi {
|
|||||||
*/
|
*/
|
||||||
@RequestMapping(value = "/{targetid}/"
|
@RequestMapping(value = "/{targetid}/"
|
||||||
+ DdiRestConstants.CONFIG_DATA_ACTION, method = RequestMethod.PUT, consumes = MediaType.APPLICATION_JSON_VALUE)
|
+ DdiRestConstants.CONFIG_DATA_ACTION, method = RequestMethod.PUT, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||||
ResponseEntity<Void> putConfigData(@Valid @RequestBody final DdiConfigData configData,
|
ResponseEntity<Void> putConfigData(@Valid final DdiConfigData configData,
|
||||||
@PathVariable("targetid") final String targetid);
|
@PathVariable("targetid") final String targetid);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -205,7 +204,7 @@ public interface DdiRootControllerRestApi {
|
|||||||
|
|
||||||
@RequestMapping(value = "/{targetid}/" + DdiRestConstants.CANCEL_ACTION + "/{actionId}/"
|
@RequestMapping(value = "/{targetid}/" + DdiRestConstants.CANCEL_ACTION + "/{actionId}/"
|
||||||
+ DdiRestConstants.FEEDBACK, method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
|
+ DdiRestConstants.FEEDBACK, method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||||
ResponseEntity<Void> postCancelActionFeedback(@Valid @RequestBody final DdiActionFeedback feedback,
|
ResponseEntity<Void> postCancelActionFeedback(@Valid final DdiActionFeedback feedback,
|
||||||
@PathVariable("targetid") @NotEmpty final String targetid,
|
@PathVariable("targetid") @NotEmpty final String targetid,
|
||||||
@PathVariable("actionId") @NotEmpty final Long actionId);
|
@PathVariable("actionId") @NotEmpty final Long actionId);
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import static org.springframework.hateoas.mvc.ControllerLinkBuilder.methodOn;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
@@ -29,7 +30,6 @@ import org.eclipse.hawkbit.ddi.json.model.DdiControllerBase;
|
|||||||
import org.eclipse.hawkbit.ddi.json.model.DdiPolling;
|
import org.eclipse.hawkbit.ddi.json.model.DdiPolling;
|
||||||
import org.eclipse.hawkbit.ddi.rest.api.DdiRestConstants;
|
import org.eclipse.hawkbit.ddi.rest.api.DdiRestConstants;
|
||||||
import org.eclipse.hawkbit.repository.model.Action;
|
import org.eclipse.hawkbit.repository.model.Action;
|
||||||
import org.eclipse.hawkbit.repository.model.Action.Status;
|
|
||||||
import org.eclipse.hawkbit.repository.model.LocalArtifact;
|
import org.eclipse.hawkbit.repository.model.LocalArtifact;
|
||||||
import org.eclipse.hawkbit.repository.model.Target;
|
import org.eclipse.hawkbit.repository.model.Target;
|
||||||
import org.eclipse.hawkbit.tenancy.TenantAware;
|
import org.eclipse.hawkbit.tenancy.TenantAware;
|
||||||
@@ -108,30 +108,25 @@ public final class DataConversionHelper {
|
|||||||
return file;
|
return file;
|
||||||
}
|
}
|
||||||
|
|
||||||
static DdiControllerBase fromTarget(final Target target, final List<Action> actions,
|
static DdiControllerBase fromTarget(final Target target, final Optional<Action> action,
|
||||||
final String defaultControllerPollTime, final TenantAware tenantAware) {
|
final String defaultControllerPollTime, final TenantAware tenantAware) {
|
||||||
final DdiControllerBase result = new DdiControllerBase(
|
final DdiControllerBase result = new DdiControllerBase(
|
||||||
new DdiConfig(new DdiPolling(defaultControllerPollTime)));
|
new DdiConfig(new DdiPolling(defaultControllerPollTime)));
|
||||||
|
|
||||||
boolean addedUpdate = false;
|
if (action.isPresent()) {
|
||||||
boolean addedCancel = false;
|
if (action.get().isCancelingOrCanceled()) {
|
||||||
final long countCancelingActions = actions.stream().filter(a -> a.getStatus() == Status.CANCELING).count();
|
result.add(linkTo(methodOn(DdiRootController.class, tenantAware.getCurrentTenant())
|
||||||
for (final Action action : actions) {
|
.getControllerCancelAction(target.getControllerId(), action.get().getId()))
|
||||||
if (countCancelingActions <= 0 && !action.isCancelingOrCanceled() && !addedUpdate) {
|
.withRel(DdiRestConstants.CANCEL_ACTION));
|
||||||
|
} else {
|
||||||
// we need to add the hashcode here of the actionWithStatus
|
// we need to add the hashcode here of the actionWithStatus
|
||||||
// because the action might
|
// because the action might
|
||||||
// have changed from 'soft' to 'forced' type and we need to
|
// have changed from 'soft' to 'forced' type and we need to
|
||||||
// change the payload of the
|
// change the payload of the
|
||||||
// response because of eTags.
|
// response because of eTags.
|
||||||
result.add(linkTo(methodOn(DdiRootController.class, tenantAware.getCurrentTenant())
|
result.add(linkTo(methodOn(DdiRootController.class, tenantAware.getCurrentTenant())
|
||||||
.getControllerBasedeploymentAction(target.getControllerId(), action.getId(),
|
.getControllerBasedeploymentAction(target.getControllerId(), action.get().getId(),
|
||||||
calculateEtag(action))).withRel(DdiRestConstants.DEPLOYMENT_BASE_ACTION));
|
calculateEtag(action.get()))).withRel(DdiRestConstants.DEPLOYMENT_BASE_ACTION));
|
||||||
addedUpdate = true;
|
|
||||||
} else if (action.isCancelingOrCanceled() && !addedCancel) {
|
|
||||||
result.add(linkTo(methodOn(DdiRootController.class, tenantAware.getCurrentTenant())
|
|
||||||
.getControllerCancelAction(target.getControllerId(), action.getId()))
|
|
||||||
.withRel(DdiRestConstants.CANCEL_ACTION));
|
|
||||||
addedCancel = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -130,7 +130,7 @@ public class DdiRootController implements DdiRootControllerRestApi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
DataConversionHelper.fromTarget(target, controllerManagement.findActionByTargetAndActive(target),
|
DataConversionHelper.fromTarget(target, controllerManagement.findOldestActiveActionByTarget(target),
|
||||||
controllerManagement.getPollingTime(), tenantAware),
|
controllerManagement.getPollingTime(), tenantAware),
|
||||||
HttpStatus.OK);
|
HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import java.net.URISyntaxException;
|
|||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import org.apache.commons.lang3.ArrayUtils;
|
import org.apache.commons.lang3.ArrayUtils;
|
||||||
@@ -32,6 +33,7 @@ import org.eclipse.hawkbit.dmf.json.model.ArtifactHash;
|
|||||||
import org.eclipse.hawkbit.dmf.json.model.DownloadResponse;
|
import org.eclipse.hawkbit.dmf.json.model.DownloadResponse;
|
||||||
import org.eclipse.hawkbit.dmf.json.model.TenantSecurityToken;
|
import org.eclipse.hawkbit.dmf.json.model.TenantSecurityToken;
|
||||||
import org.eclipse.hawkbit.dmf.json.model.TenantSecurityToken.FileResource;
|
import org.eclipse.hawkbit.dmf.json.model.TenantSecurityToken.FileResource;
|
||||||
|
import org.eclipse.hawkbit.eventbus.event.CancelTargetAssignmentEvent;
|
||||||
import org.eclipse.hawkbit.im.authentication.SpPermission.SpringEvalExpressions;
|
import org.eclipse.hawkbit.im.authentication.SpPermission.SpringEvalExpressions;
|
||||||
import org.eclipse.hawkbit.im.authentication.TenantAwareAuthenticationDetails;
|
import org.eclipse.hawkbit.im.authentication.TenantAwareAuthenticationDetails;
|
||||||
import org.eclipse.hawkbit.repository.ArtifactManagement;
|
import org.eclipse.hawkbit.repository.ArtifactManagement;
|
||||||
@@ -41,7 +43,7 @@ import org.eclipse.hawkbit.repository.RepositoryConstants;
|
|||||||
import org.eclipse.hawkbit.repository.eventbus.event.TargetAssignDistributionSetEvent;
|
import org.eclipse.hawkbit.repository.eventbus.event.TargetAssignDistributionSetEvent;
|
||||||
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
|
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
|
||||||
import org.eclipse.hawkbit.repository.exception.TenantNotExistException;
|
import org.eclipse.hawkbit.repository.exception.TenantNotExistException;
|
||||||
import org.eclipse.hawkbit.repository.exception.ToManyStatusEntriesException;
|
import org.eclipse.hawkbit.repository.exception.TooManyStatusEntriesException;
|
||||||
import org.eclipse.hawkbit.repository.model.Action;
|
import org.eclipse.hawkbit.repository.model.Action;
|
||||||
import org.eclipse.hawkbit.repository.model.Action.Status;
|
import org.eclipse.hawkbit.repository.model.Action.Status;
|
||||||
import org.eclipse.hawkbit.repository.model.ActionStatus;
|
import org.eclipse.hawkbit.repository.model.ActionStatus;
|
||||||
@@ -155,7 +157,7 @@ public class AmqpMessageHandlerService extends BaseAmqpService {
|
|||||||
return handleAuthentifiactionMessage(message);
|
return handleAuthentifiactionMessage(message);
|
||||||
} catch (final IllegalArgumentException ex) {
|
} catch (final IllegalArgumentException ex) {
|
||||||
throw new AmqpRejectAndDontRequeueException("Invalid message!", ex);
|
throw new AmqpRejectAndDontRequeueException("Invalid message!", ex);
|
||||||
} catch (final TenantNotExistException | ToManyStatusEntriesException e) {
|
} catch (final TenantNotExistException | TooManyStatusEntriesException e) {
|
||||||
throw new AmqpRejectAndDontRequeueException(e);
|
throw new AmqpRejectAndDontRequeueException(e);
|
||||||
} finally {
|
} finally {
|
||||||
SecurityContextHolder.setContext(oldContext);
|
SecurityContextHolder.setContext(oldContext);
|
||||||
@@ -196,8 +198,8 @@ public class AmqpMessageHandlerService extends BaseAmqpService {
|
|||||||
}
|
}
|
||||||
} catch (final IllegalArgumentException ex) {
|
} catch (final IllegalArgumentException ex) {
|
||||||
throw new AmqpRejectAndDontRequeueException("Invalid message!", ex);
|
throw new AmqpRejectAndDontRequeueException("Invalid message!", ex);
|
||||||
} catch (final TenantNotExistException teex) {
|
} catch (final TenantNotExistException | TooManyStatusEntriesException e) {
|
||||||
throw new AmqpRejectAndDontRequeueException(teex);
|
throw new AmqpRejectAndDontRequeueException(e);
|
||||||
} finally {
|
} finally {
|
||||||
SecurityContextHolder.setContext(oldContext);
|
SecurityContextHolder.setContext(oldContext);
|
||||||
}
|
}
|
||||||
@@ -344,18 +346,24 @@ public class AmqpMessageHandlerService extends BaseAmqpService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void lookIfUpdateAvailable(final Target target) {
|
private void lookIfUpdateAvailable(final Target target) {
|
||||||
final List<Action> actions = controllerManagement.findActionByTargetAndActive(target);
|
final Optional<Action> action = controllerManagement.findOldestActiveActionByTarget(target);
|
||||||
if (actions.isEmpty()) {
|
if (!action.isPresent()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// action are ordered by ASC
|
|
||||||
final Action action = actions.get(0);
|
if (action.get().isCancelingOrCanceled()) {
|
||||||
final DistributionSet distributionSet = action.getDistributionSet();
|
amqpMessageDispatcherService.targetCancelAssignmentToDistributionSet(
|
||||||
|
new CancelTargetAssignmentEvent(target.getOptLockRevision(), target.getTenant(),
|
||||||
|
target.getControllerId(), action.get().getId(), target.getTargetInfo().getAddress()));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final DistributionSet distributionSet = action.get().getDistributionSet();
|
||||||
final List<SoftwareModule> softwareModuleList = controllerManagement
|
final List<SoftwareModule> softwareModuleList = controllerManagement
|
||||||
.findSoftwareModulesByDistributionSet(distributionSet);
|
.findSoftwareModulesByDistributionSet(distributionSet);
|
||||||
final String targetSecurityToken = systemSecurityContext.runAsSystem(() -> target.getSecurityToken());
|
final String targetSecurityToken = systemSecurityContext.runAsSystem(() -> target.getSecurityToken());
|
||||||
amqpMessageDispatcherService.targetAssignDistributionSet(new TargetAssignDistributionSetEvent(
|
amqpMessageDispatcherService.targetAssignDistributionSet(new TargetAssignDistributionSetEvent(
|
||||||
target.getOptLockRevision(), target.getTenant(), target.getControllerId(), action.getId(),
|
target.getOptLockRevision(), target.getTenant(), target.getControllerId(), action.get().getId(),
|
||||||
softwareModuleList, target.getTargetInfo().getAddress(), targetSecurityToken));
|
softwareModuleList, target.getTargetInfo().getAddress(), targetSecurityToken));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import java.net.URI;
|
|||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
import org.eclipse.hawkbit.api.HostnameResolver;
|
import org.eclipse.hawkbit.api.HostnameResolver;
|
||||||
import org.eclipse.hawkbit.artifact.repository.ArtifactRepository;
|
import org.eclipse.hawkbit.artifact.repository.ArtifactRepository;
|
||||||
@@ -155,6 +156,7 @@ public class AmqpMessageHandlerServiceTest {
|
|||||||
final ArgumentCaptor<URI> uriCaptor = ArgumentCaptor.forClass(URI.class);
|
final ArgumentCaptor<URI> uriCaptor = ArgumentCaptor.forClass(URI.class);
|
||||||
when(controllerManagementMock.findOrRegisterTargetIfItDoesNotexist(targetIdCaptor.capture(),
|
when(controllerManagementMock.findOrRegisterTargetIfItDoesNotexist(targetIdCaptor.capture(),
|
||||||
uriCaptor.capture())).thenReturn(null);
|
uriCaptor.capture())).thenReturn(null);
|
||||||
|
when(controllerManagementMock.findOldestActiveActionByTarget(Matchers.any())).thenReturn(Optional.empty());
|
||||||
|
|
||||||
amqpMessageHandlerService.onMessage(message, MessageType.THING_CREATED.name(), TENANT, "vHost");
|
amqpMessageHandlerService.onMessage(message, MessageType.THING_CREATED.name(), TENANT, "vHost");
|
||||||
|
|
||||||
@@ -362,9 +364,8 @@ public class AmqpMessageHandlerServiceTest {
|
|||||||
when(controllerManagementMock.addUpdateActionStatus(Matchers.any())).thenReturn(action);
|
when(controllerManagementMock.addUpdateActionStatus(Matchers.any())).thenReturn(action);
|
||||||
when(entityFactoryMock.generateActionStatus()).thenReturn(new JpaActionStatus());
|
when(entityFactoryMock.generateActionStatus()).thenReturn(new JpaActionStatus());
|
||||||
// for the test the same action can be used
|
// for the test the same action can be used
|
||||||
final List<Action> actionList = new ArrayList<>();
|
when(controllerManagementMock.findOldestActiveActionByTarget(Matchers.any()))
|
||||||
actionList.add(action);
|
.thenReturn(Optional.of(action));
|
||||||
when(controllerManagementMock.findActionByTargetAndActive(Matchers.any())).thenReturn(actionList);
|
|
||||||
|
|
||||||
final List<SoftwareModule> softwareModuleList = createSoftwareModuleList();
|
final List<SoftwareModule> softwareModuleList = createSoftwareModuleList();
|
||||||
when(controllerManagementMock.findSoftwareModulesByDistributionSet(Matchers.any()))
|
when(controllerManagementMock.findSoftwareModulesByDistributionSet(Matchers.any()))
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ import org.eclipse.hawkbit.mgmt.json.model.target.MgmtTarget;
|
|||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
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.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMethod;
|
import org.springframework.web.bind.annotation.RequestMethod;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
@@ -88,7 +87,7 @@ public interface MgmtDistributionSetRestApi {
|
|||||||
@RequestMapping(method = RequestMethod.POST, consumes = { MediaType.APPLICATION_JSON_VALUE,
|
@RequestMapping(method = RequestMethod.POST, consumes = { MediaType.APPLICATION_JSON_VALUE,
|
||||||
"application/hal+json" }, produces = { "application/hal+json", MediaType.APPLICATION_JSON_VALUE })
|
"application/hal+json" }, produces = { "application/hal+json", MediaType.APPLICATION_JSON_VALUE })
|
||||||
ResponseEntity<List<MgmtDistributionSet>> createDistributionSets(
|
ResponseEntity<List<MgmtDistributionSet>> createDistributionSets(
|
||||||
@RequestBody final List<MgmtDistributionSetRequestBodyPost> sets);
|
final List<MgmtDistributionSetRequestBodyPost> sets);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles the DELETE request for a single DistributionSet .
|
* Handles the DELETE request for a single DistributionSet .
|
||||||
@@ -116,7 +115,7 @@ public interface MgmtDistributionSetRestApi {
|
|||||||
MediaType.APPLICATION_JSON_VALUE }, produces = { MediaType.APPLICATION_JSON_VALUE, "application/hal+json" })
|
MediaType.APPLICATION_JSON_VALUE }, produces = { MediaType.APPLICATION_JSON_VALUE, "application/hal+json" })
|
||||||
ResponseEntity<MgmtDistributionSet> updateDistributionSet(
|
ResponseEntity<MgmtDistributionSet> updateDistributionSet(
|
||||||
@PathVariable("distributionSetId") final Long distributionSetId,
|
@PathVariable("distributionSetId") final Long distributionSetId,
|
||||||
@RequestBody final MgmtDistributionSetRequestBodyPut toUpdate);
|
final MgmtDistributionSetRequestBodyPut toUpdate);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles the GET request of retrieving assigned targets to a specific
|
* Handles the GET request of retrieving assigned targets to a specific
|
||||||
@@ -198,7 +197,7 @@ public interface MgmtDistributionSetRestApi {
|
|||||||
MediaType.APPLICATION_JSON_VALUE }, produces = { MediaType.APPLICATION_JSON_VALUE, "application/hal+json" })
|
MediaType.APPLICATION_JSON_VALUE }, produces = { MediaType.APPLICATION_JSON_VALUE, "application/hal+json" })
|
||||||
ResponseEntity<MgmtTargetAssignmentResponseBody> createAssignedTarget(
|
ResponseEntity<MgmtTargetAssignmentResponseBody> createAssignedTarget(
|
||||||
@PathVariable("distributionSetId") final Long distributionSetId,
|
@PathVariable("distributionSetId") final Long distributionSetId,
|
||||||
@RequestBody final List<MgmtTargetAssignmentRequestBody> targetIds);
|
final List<MgmtTargetAssignmentRequestBody> targetIds);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets a paged list of meta data for a distribution set.
|
* Gets a paged list of meta data for a distribution set.
|
||||||
@@ -256,7 +255,7 @@ public interface MgmtDistributionSetRestApi {
|
|||||||
@RequestMapping(method = RequestMethod.PUT, value = "/{distributionSetId}/metadata/{metadataKey}", produces = {
|
@RequestMapping(method = RequestMethod.PUT, value = "/{distributionSetId}/metadata/{metadataKey}", produces = {
|
||||||
MediaType.APPLICATION_JSON_VALUE, "application/hal+json" })
|
MediaType.APPLICATION_JSON_VALUE, "application/hal+json" })
|
||||||
ResponseEntity<MgmtMetadata> updateMetadata(@PathVariable("distributionSetId") final Long distributionSetId,
|
ResponseEntity<MgmtMetadata> updateMetadata(@PathVariable("distributionSetId") final Long distributionSetId,
|
||||||
@PathVariable("metadataKey") final String metadataKey, @RequestBody final MgmtMetadata metadata);
|
@PathVariable("metadataKey") final String metadataKey, final MgmtMetadata metadata);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deletes a single meta data entry from the distribution set.
|
* Deletes a single meta data entry from the distribution set.
|
||||||
@@ -285,7 +284,7 @@ public interface MgmtDistributionSetRestApi {
|
|||||||
MediaType.APPLICATION_JSON_VALUE,
|
MediaType.APPLICATION_JSON_VALUE,
|
||||||
"application/hal+json" }, produces = { MediaType.APPLICATION_JSON_VALUE, "application/hal+json" })
|
"application/hal+json" }, produces = { MediaType.APPLICATION_JSON_VALUE, "application/hal+json" })
|
||||||
ResponseEntity<List<MgmtMetadata>> createMetadata(@PathVariable("distributionSetId") final Long distributionSetId,
|
ResponseEntity<List<MgmtMetadata>> createMetadata(@PathVariable("distributionSetId") final Long distributionSetId,
|
||||||
@RequestBody final List<MgmtMetadata> metadataRest);
|
final List<MgmtMetadata> metadataRest);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Assigns a list of software modules to a distribution set.
|
* Assigns a list of software modules to a distribution set.
|
||||||
@@ -301,7 +300,7 @@ public interface MgmtDistributionSetRestApi {
|
|||||||
MediaType.APPLICATION_JSON_VALUE,
|
MediaType.APPLICATION_JSON_VALUE,
|
||||||
"application/hal+json" }, produces = { "application/hal+json", MediaType.APPLICATION_JSON_VALUE })
|
"application/hal+json" }, produces = { "application/hal+json", MediaType.APPLICATION_JSON_VALUE })
|
||||||
ResponseEntity<Void> assignSoftwareModules(@PathVariable("distributionSetId") final Long distributionSetId,
|
ResponseEntity<Void> assignSoftwareModules(@PathVariable("distributionSetId") final Long distributionSetId,
|
||||||
@RequestBody final List<MgmtSoftwareModuleAssigment> softwareModuleIDs);
|
final List<MgmtSoftwareModuleAssigment> softwareModuleIDs);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deletes the assignment of the software module form the distribution set.
|
* Deletes the assignment of the software module form the distribution set.
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ import org.eclipse.hawkbit.mgmt.json.model.tag.MgmtTagRequestBodyPut;
|
|||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
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.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMethod;
|
import org.springframework.web.bind.annotation.RequestMethod;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
@@ -82,7 +81,7 @@ public interface MgmtDistributionSetTagRestApi {
|
|||||||
*/
|
*/
|
||||||
@RequestMapping(method = RequestMethod.POST, consumes = { "application/hal+json",
|
@RequestMapping(method = RequestMethod.POST, consumes = { "application/hal+json",
|
||||||
MediaType.APPLICATION_JSON_VALUE }, produces = { "application/hal+json", MediaType.APPLICATION_JSON_VALUE })
|
MediaType.APPLICATION_JSON_VALUE }, produces = { "application/hal+json", MediaType.APPLICATION_JSON_VALUE })
|
||||||
ResponseEntity<List<MgmtTag>> createDistributionSetTags(@RequestBody final List<MgmtTagRequestBodyPut> tags);
|
ResponseEntity<List<MgmtTag>> createDistributionSetTags(final List<MgmtTagRequestBodyPut> tags);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -99,7 +98,7 @@ public interface MgmtDistributionSetTagRestApi {
|
|||||||
MediaType.APPLICATION_JSON_VALUE }, produces = { "application/hal+json", MediaType.APPLICATION_JSON_VALUE })
|
MediaType.APPLICATION_JSON_VALUE }, produces = { "application/hal+json", MediaType.APPLICATION_JSON_VALUE })
|
||||||
ResponseEntity<MgmtTag> updateDistributionSetTag(
|
ResponseEntity<MgmtTag> updateDistributionSetTag(
|
||||||
@PathVariable("distributionsetTagId") final Long distributionsetTagId,
|
@PathVariable("distributionsetTagId") final Long distributionsetTagId,
|
||||||
@RequestBody final MgmtTagRequestBodyPut restDSTagRest);
|
final MgmtTagRequestBodyPut restDSTagRest);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles the DELETE request for a single distribution set tag.
|
* Handles the DELETE request for a single distribution set tag.
|
||||||
@@ -142,7 +141,7 @@ public interface MgmtDistributionSetTagRestApi {
|
|||||||
+ "/toggleTagAssignment")
|
+ "/toggleTagAssignment")
|
||||||
ResponseEntity<MgmtDistributionSetTagAssigmentResult> toggleTagAssignment(
|
ResponseEntity<MgmtDistributionSetTagAssigmentResult> toggleTagAssignment(
|
||||||
@PathVariable("distributionsetTagId") final Long distributionsetTagId,
|
@PathVariable("distributionsetTagId") final Long distributionsetTagId,
|
||||||
@RequestBody final List<MgmtAssignedDistributionSetRequestBody> assignedDSRequestBodies);
|
final List<MgmtAssignedDistributionSetRequestBody> assignedDSRequestBodies);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles the POST request to assign distribution sets to the given tag id.
|
* Handles the POST request to assign distribution sets to the given tag id.
|
||||||
@@ -157,7 +156,7 @@ public interface MgmtDistributionSetTagRestApi {
|
|||||||
@RequestMapping(method = RequestMethod.POST, value = MgmtRestConstants.DISTRIBUTIONSET_REQUEST_MAPPING)
|
@RequestMapping(method = RequestMethod.POST, value = MgmtRestConstants.DISTRIBUTIONSET_REQUEST_MAPPING)
|
||||||
ResponseEntity<List<MgmtDistributionSet>> assignDistributionSets(
|
ResponseEntity<List<MgmtDistributionSet>> assignDistributionSets(
|
||||||
@PathVariable("distributionsetTagId") final Long distributionsetTagId,
|
@PathVariable("distributionsetTagId") final Long distributionsetTagId,
|
||||||
@RequestBody final List<MgmtAssignedDistributionSetRequestBody> assignedDSRequestBodies);
|
final List<MgmtAssignedDistributionSetRequestBody> assignedDSRequestBodies);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles the DELETE request to unassign all distribution set from the
|
* Handles the DELETE request to unassign all distribution set from the
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ import org.eclipse.hawkbit.mgmt.json.model.softwaremoduletype.MgmtSoftwareModule
|
|||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
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.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMethod;
|
import org.springframework.web.bind.annotation.RequestMethod;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
@@ -99,7 +98,7 @@ public interface MgmtDistributionSetTypeRestApi {
|
|||||||
MediaType.APPLICATION_JSON_VALUE }, produces = { "application/hal+json", MediaType.APPLICATION_JSON_VALUE })
|
MediaType.APPLICATION_JSON_VALUE }, produces = { "application/hal+json", MediaType.APPLICATION_JSON_VALUE })
|
||||||
ResponseEntity<MgmtDistributionSetType> updateDistributionSetType(
|
ResponseEntity<MgmtDistributionSetType> updateDistributionSetType(
|
||||||
@PathVariable("distributionSetTypeId") final Long distributionSetTypeId,
|
@PathVariable("distributionSetTypeId") final Long distributionSetTypeId,
|
||||||
@RequestBody final MgmtDistributionSetTypeRequestBodyPut restDistributionSetType);
|
final MgmtDistributionSetTypeRequestBodyPut restDistributionSetType);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles the POST request of creating new DistributionSetTypes. The
|
* Handles the POST request of creating new DistributionSetTypes. The
|
||||||
@@ -115,7 +114,7 @@ public interface MgmtDistributionSetTypeRestApi {
|
|||||||
@RequestMapping(method = RequestMethod.POST, consumes = { "application/hal+json",
|
@RequestMapping(method = RequestMethod.POST, consumes = { "application/hal+json",
|
||||||
MediaType.APPLICATION_JSON_VALUE }, produces = { "application/hal+json", MediaType.APPLICATION_JSON_VALUE })
|
MediaType.APPLICATION_JSON_VALUE }, produces = { "application/hal+json", MediaType.APPLICATION_JSON_VALUE })
|
||||||
ResponseEntity<List<MgmtDistributionSetType>> createDistributionSetTypes(
|
ResponseEntity<List<MgmtDistributionSetType>> createDistributionSetTypes(
|
||||||
@RequestBody final List<MgmtDistributionSetTypeRequestBodyPost> distributionSetTypes);
|
final List<MgmtDistributionSetTypeRequestBodyPost> distributionSetTypes);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles the GET request of retrieving the list of mandatory software
|
* Handles the GET request of retrieving the list of mandatory software
|
||||||
@@ -229,7 +228,7 @@ public interface MgmtDistributionSetTypeRestApi {
|
|||||||
MediaType.APPLICATION_JSON_VALUE }, produces = { "application/hal+json",
|
MediaType.APPLICATION_JSON_VALUE }, produces = { "application/hal+json",
|
||||||
MediaType.APPLICATION_JSON_VALUE })
|
MediaType.APPLICATION_JSON_VALUE })
|
||||||
ResponseEntity<Void> addMandatoryModule(@PathVariable("distributionSetTypeId") final Long distributionSetTypeId,
|
ResponseEntity<Void> addMandatoryModule(@PathVariable("distributionSetTypeId") final Long distributionSetTypeId,
|
||||||
@RequestBody final MgmtId smtId);
|
final MgmtId smtId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles the POST request for adding an optional software module type to a
|
* Handles the POST request for adding an optional software module type to a
|
||||||
@@ -247,6 +246,6 @@ public interface MgmtDistributionSetTypeRestApi {
|
|||||||
MediaType.APPLICATION_JSON_VALUE }, produces = { "application/hal+json",
|
MediaType.APPLICATION_JSON_VALUE }, produces = { "application/hal+json",
|
||||||
MediaType.APPLICATION_JSON_VALUE })
|
MediaType.APPLICATION_JSON_VALUE })
|
||||||
ResponseEntity<Void> addOptionalModule(@PathVariable("distributionSetTypeId") final Long distributionSetTypeId,
|
ResponseEntity<Void> addOptionalModule(@PathVariable("distributionSetTypeId") final Long distributionSetTypeId,
|
||||||
@RequestBody final MgmtId smtId);
|
final MgmtId smtId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ import org.eclipse.hawkbit.mgmt.json.model.target.MgmtTarget;
|
|||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
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.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMethod;
|
import org.springframework.web.bind.annotation.RequestMethod;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
@@ -77,7 +76,7 @@ public interface MgmtRolloutRestApi {
|
|||||||
*/
|
*/
|
||||||
@RequestMapping(method = RequestMethod.POST, consumes = { "application/hal+json",
|
@RequestMapping(method = RequestMethod.POST, consumes = { "application/hal+json",
|
||||||
MediaType.APPLICATION_JSON_VALUE }, produces = { "application/hal+json", MediaType.APPLICATION_JSON_VALUE })
|
MediaType.APPLICATION_JSON_VALUE }, produces = { "application/hal+json", MediaType.APPLICATION_JSON_VALUE })
|
||||||
ResponseEntity<MgmtRolloutResponseBody> create(@RequestBody final MgmtRolloutRestRequestBody rolloutRequestBody);
|
ResponseEntity<MgmtRolloutResponseBody> create(final MgmtRolloutRestRequestBody rolloutRequestBody);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles the POST request for starting a rollout.
|
* Handles the POST request for starting a rollout.
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ import org.eclipse.hawkbit.mgmt.json.model.softwaremodule.MgmtSoftwareModuleRequ
|
|||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
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.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMethod;
|
import org.springframework.web.bind.annotation.RequestMethod;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
@@ -162,7 +161,7 @@ public interface MgmtSoftwareModuleRestApi {
|
|||||||
@RequestMapping(method = RequestMethod.POST, consumes = { "application/hal+json",
|
@RequestMapping(method = RequestMethod.POST, consumes = { "application/hal+json",
|
||||||
MediaType.APPLICATION_JSON_VALUE }, produces = { "application/hal+json", MediaType.APPLICATION_JSON_VALUE })
|
MediaType.APPLICATION_JSON_VALUE }, produces = { "application/hal+json", MediaType.APPLICATION_JSON_VALUE })
|
||||||
ResponseEntity<List<MgmtSoftwareModule>> createSoftwareModules(
|
ResponseEntity<List<MgmtSoftwareModule>> createSoftwareModules(
|
||||||
@RequestBody final List<MgmtSoftwareModuleRequestBodyPost> softwareModules);
|
final List<MgmtSoftwareModuleRequestBodyPost> softwareModules);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles the PUT request of updating a software module.
|
* Handles the PUT request of updating a software module.
|
||||||
@@ -177,7 +176,7 @@ public interface MgmtSoftwareModuleRestApi {
|
|||||||
MediaType.APPLICATION_JSON_VALUE }, produces = { "application/hal+json", MediaType.APPLICATION_JSON_VALUE })
|
MediaType.APPLICATION_JSON_VALUE }, produces = { "application/hal+json", MediaType.APPLICATION_JSON_VALUE })
|
||||||
ResponseEntity<MgmtSoftwareModule> updateSoftwareModule(
|
ResponseEntity<MgmtSoftwareModule> updateSoftwareModule(
|
||||||
@PathVariable("softwareModuleId") final Long softwareModuleId,
|
@PathVariable("softwareModuleId") final Long softwareModuleId,
|
||||||
@RequestBody final MgmtSoftwareModuleRequestBodyPut restSoftwareModule);
|
final MgmtSoftwareModuleRequestBodyPut restSoftwareModule);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles the DELETE request for a single software module.
|
* Handles the DELETE request for a single software module.
|
||||||
@@ -246,7 +245,7 @@ public interface MgmtSoftwareModuleRestApi {
|
|||||||
@RequestMapping(method = RequestMethod.PUT, value = "/{softwareModuleId}/metadata/{metadataKey}", produces = {
|
@RequestMapping(method = RequestMethod.PUT, value = "/{softwareModuleId}/metadata/{metadataKey}", produces = {
|
||||||
MediaType.APPLICATION_JSON_VALUE, "application/hal+json" })
|
MediaType.APPLICATION_JSON_VALUE, "application/hal+json" })
|
||||||
ResponseEntity<MgmtMetadata> updateMetadata(@PathVariable("softwareModuleId") final Long softwareModuleId,
|
ResponseEntity<MgmtMetadata> updateMetadata(@PathVariable("softwareModuleId") final Long softwareModuleId,
|
||||||
@PathVariable("metadataKey") final String metadataKey, @RequestBody final MgmtMetadata metadata);
|
@PathVariable("metadataKey") final String metadataKey, final MgmtMetadata metadata);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deletes a single meta data entry from the software module.
|
* Deletes a single meta data entry from the software module.
|
||||||
@@ -275,6 +274,6 @@ public interface MgmtSoftwareModuleRestApi {
|
|||||||
MediaType.APPLICATION_JSON_VALUE,
|
MediaType.APPLICATION_JSON_VALUE,
|
||||||
"application/hal+json" }, produces = { MediaType.APPLICATION_JSON_VALUE, "application/hal+json" })
|
"application/hal+json" }, produces = { MediaType.APPLICATION_JSON_VALUE, "application/hal+json" })
|
||||||
ResponseEntity<List<MgmtMetadata>> createMetadata(@PathVariable("softwareModuleId") final Long softwareModuleId,
|
ResponseEntity<List<MgmtMetadata>> createMetadata(@PathVariable("softwareModuleId") final Long softwareModuleId,
|
||||||
@RequestBody final List<MgmtMetadata> metadataRest);
|
final List<MgmtMetadata> metadataRest);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ import org.eclipse.hawkbit.mgmt.json.model.softwaremoduletype.MgmtSoftwareModule
|
|||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
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.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMethod;
|
import org.springframework.web.bind.annotation.RequestMethod;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
@@ -94,7 +93,7 @@ public interface MgmtSoftwareModuleTypeRestApi {
|
|||||||
MediaType.APPLICATION_JSON_VALUE }, produces = { "application/hal+json", MediaType.APPLICATION_JSON_VALUE })
|
MediaType.APPLICATION_JSON_VALUE }, produces = { "application/hal+json", MediaType.APPLICATION_JSON_VALUE })
|
||||||
ResponseEntity<MgmtSoftwareModuleType> updateSoftwareModuleType(
|
ResponseEntity<MgmtSoftwareModuleType> updateSoftwareModuleType(
|
||||||
@PathVariable("softwareModuleTypeId") final Long softwareModuleTypeId,
|
@PathVariable("softwareModuleTypeId") final Long softwareModuleTypeId,
|
||||||
@RequestBody final MgmtSoftwareModuleTypeRequestBodyPut restSoftwareModuleType);
|
final MgmtSoftwareModuleTypeRequestBodyPut restSoftwareModuleType);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles the POST request of creating new SoftwareModuleTypes. The request
|
* Handles the POST request of creating new SoftwareModuleTypes. The request
|
||||||
@@ -110,6 +109,6 @@ public interface MgmtSoftwareModuleTypeRestApi {
|
|||||||
@RequestMapping(method = RequestMethod.POST, consumes = { "application/hal+json",
|
@RequestMapping(method = RequestMethod.POST, consumes = { "application/hal+json",
|
||||||
MediaType.APPLICATION_JSON_VALUE }, produces = { "application/hal+json", MediaType.APPLICATION_JSON_VALUE })
|
MediaType.APPLICATION_JSON_VALUE }, produces = { "application/hal+json", MediaType.APPLICATION_JSON_VALUE })
|
||||||
ResponseEntity<List<MgmtSoftwareModuleType>> createSoftwareModuleTypes(
|
ResponseEntity<List<MgmtSoftwareModuleType>> createSoftwareModuleTypes(
|
||||||
@RequestBody final List<MgmtSoftwareModuleTypeRequestBodyPost> softwareModuleTypes);
|
final List<MgmtSoftwareModuleTypeRequestBodyPost> softwareModuleTypes);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ import org.springframework.hateoas.ResourceSupport;
|
|||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
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.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMethod;
|
import org.springframework.web.bind.annotation.RequestMethod;
|
||||||
|
|
||||||
@@ -83,6 +82,6 @@ public interface MgmtSystemRestApi {
|
|||||||
MediaType.APPLICATION_JSON_VALUE }, produces = { "application/hal+json", MediaType.APPLICATION_JSON_VALUE })
|
MediaType.APPLICATION_JSON_VALUE }, produces = { "application/hal+json", MediaType.APPLICATION_JSON_VALUE })
|
||||||
ResponseEntity<MgmtSystemTenantConfigurationValue> updateConfigurationValue(
|
ResponseEntity<MgmtSystemTenantConfigurationValue> updateConfigurationValue(
|
||||||
@PathVariable("keyName") final String keyName,
|
@PathVariable("keyName") final String keyName,
|
||||||
@RequestBody final MgmtSystemTenantConfigurationValueRequest configurationValueRest);
|
final MgmtSystemTenantConfigurationValueRequest configurationValueRest);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ import org.eclipse.hawkbit.mgmt.json.model.target.MgmtTargetRequestBody;
|
|||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
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.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMethod;
|
import org.springframework.web.bind.annotation.RequestMethod;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
@@ -84,7 +83,7 @@ public interface MgmtTargetRestApi {
|
|||||||
*/
|
*/
|
||||||
@RequestMapping(method = RequestMethod.POST, consumes = { "application/hal+json",
|
@RequestMapping(method = RequestMethod.POST, consumes = { "application/hal+json",
|
||||||
MediaType.APPLICATION_JSON_VALUE }, produces = { "application/hal+json", MediaType.APPLICATION_JSON_VALUE })
|
MediaType.APPLICATION_JSON_VALUE }, produces = { "application/hal+json", MediaType.APPLICATION_JSON_VALUE })
|
||||||
ResponseEntity<List<MgmtTarget>> createTargets(@RequestBody final List<MgmtTargetRequestBody> targets);
|
ResponseEntity<List<MgmtTarget>> createTargets(final List<MgmtTargetRequestBody> targets);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles the PUT request of updating a target. The ID is within the URL
|
* Handles the PUT request of updating a target. The ID is within the URL
|
||||||
@@ -103,7 +102,7 @@ public interface MgmtTargetRestApi {
|
|||||||
@RequestMapping(method = RequestMethod.PUT, value = "/{controllerId}", consumes = { "application/hal+json",
|
@RequestMapping(method = RequestMethod.PUT, value = "/{controllerId}", consumes = { "application/hal+json",
|
||||||
MediaType.APPLICATION_JSON_VALUE }, produces = { "application/hal+json", MediaType.APPLICATION_JSON_VALUE })
|
MediaType.APPLICATION_JSON_VALUE }, produces = { "application/hal+json", MediaType.APPLICATION_JSON_VALUE })
|
||||||
ResponseEntity<MgmtTarget> updateTarget(@PathVariable("controllerId") final String controllerId,
|
ResponseEntity<MgmtTarget> updateTarget(@PathVariable("controllerId") final String controllerId,
|
||||||
@RequestBody final MgmtTargetRequestBody targetRest);
|
final MgmtTargetRequestBody targetRest);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles the DELETE request of deleting a target.
|
* Handles the DELETE request of deleting a target.
|
||||||
@@ -247,7 +246,7 @@ public interface MgmtTargetRestApi {
|
|||||||
"application/hal+json",
|
"application/hal+json",
|
||||||
MediaType.APPLICATION_JSON_VALUE }, produces = { "application/hal+json", MediaType.APPLICATION_JSON_VALUE })
|
MediaType.APPLICATION_JSON_VALUE }, produces = { "application/hal+json", MediaType.APPLICATION_JSON_VALUE })
|
||||||
ResponseEntity<Void> postAssignedDistributionSet(@PathVariable("controllerId") final String controllerId,
|
ResponseEntity<Void> postAssignedDistributionSet(@PathVariable("controllerId") final String controllerId,
|
||||||
@RequestBody final MgmtDistributionSetAssigment dsId);
|
final MgmtDistributionSetAssigment dsId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles the GET request of retrieving the installed distribution set of
|
* Handles the GET request of retrieving the installed distribution set of
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ import org.eclipse.hawkbit.mgmt.json.model.target.MgmtTarget;
|
|||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
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.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMethod;
|
import org.springframework.web.bind.annotation.RequestMethod;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
@@ -81,7 +80,7 @@ public interface MgmtTargetTagRestApi {
|
|||||||
*/
|
*/
|
||||||
@RequestMapping(method = RequestMethod.POST, consumes = { "application/hal+json",
|
@RequestMapping(method = RequestMethod.POST, consumes = { "application/hal+json",
|
||||||
MediaType.APPLICATION_JSON_VALUE }, produces = { "application/hal+json", MediaType.APPLICATION_JSON_VALUE })
|
MediaType.APPLICATION_JSON_VALUE }, produces = { "application/hal+json", MediaType.APPLICATION_JSON_VALUE })
|
||||||
ResponseEntity<List<MgmtTag>> createTargetTags(@RequestBody final List<MgmtTagRequestBodyPut> tags);
|
ResponseEntity<List<MgmtTag>> createTargetTags(final List<MgmtTagRequestBodyPut> tags);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -96,7 +95,7 @@ public interface MgmtTargetTagRestApi {
|
|||||||
@RequestMapping(method = RequestMethod.PUT, value = "/{targetTagId}", consumes = { "application/hal+json",
|
@RequestMapping(method = RequestMethod.PUT, value = "/{targetTagId}", consumes = { "application/hal+json",
|
||||||
MediaType.APPLICATION_JSON_VALUE }, produces = { "application/hal+json", MediaType.APPLICATION_JSON_VALUE })
|
MediaType.APPLICATION_JSON_VALUE }, produces = { "application/hal+json", MediaType.APPLICATION_JSON_VALUE })
|
||||||
ResponseEntity<MgmtTag> updateTagretTag(@PathVariable("targetTagId") final Long targetTagId,
|
ResponseEntity<MgmtTag> updateTagretTag(@PathVariable("targetTagId") final Long targetTagId,
|
||||||
@RequestBody final MgmtTagRequestBodyPut restTargetTagRest);
|
final MgmtTagRequestBodyPut restTargetTagRest);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles the DELETE request for a single target tag.
|
* Handles the DELETE request for a single target tag.
|
||||||
@@ -136,7 +135,7 @@ public interface MgmtTargetTagRestApi {
|
|||||||
+ "/toggleTagAssignment")
|
+ "/toggleTagAssignment")
|
||||||
ResponseEntity<MgmtTargetTagAssigmentResult> toggleTagAssignment(
|
ResponseEntity<MgmtTargetTagAssigmentResult> toggleTagAssignment(
|
||||||
@PathVariable("targetTagId") final Long targetTagId,
|
@PathVariable("targetTagId") final Long targetTagId,
|
||||||
@RequestBody final List<MgmtAssignedTargetRequestBody> assignedTargetRequestBodies);
|
final List<MgmtAssignedTargetRequestBody> assignedTargetRequestBodies);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles the POST request to assign targets to the given tag id.
|
* Handles the POST request to assign targets to the given tag id.
|
||||||
@@ -150,7 +149,7 @@ public interface MgmtTargetTagRestApi {
|
|||||||
*/
|
*/
|
||||||
@RequestMapping(method = RequestMethod.POST, value = MgmtRestConstants.TARGET_TAG_TAGERTS_REQUEST_MAPPING)
|
@RequestMapping(method = RequestMethod.POST, value = MgmtRestConstants.TARGET_TAG_TAGERTS_REQUEST_MAPPING)
|
||||||
ResponseEntity<List<MgmtTarget>> assignTargets(@PathVariable("targetTagId") final Long targetTagId,
|
ResponseEntity<List<MgmtTarget>> assignTargets(@PathVariable("targetTagId") final Long targetTagId,
|
||||||
@RequestBody final List<MgmtAssignedTargetRequestBody> assignedTargetRequestBodies);
|
final List<MgmtAssignedTargetRequestBody> assignedTargetRequestBodies);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles the DELETE request to unassign all targets from the given tag id.
|
* Handles the DELETE request to unassign all targets from the given tag id.
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ package org.eclipse.hawkbit.repository;
|
|||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
@@ -19,7 +20,7 @@ import org.eclipse.hawkbit.repository.eventbus.event.DownloadProgressEvent;
|
|||||||
import org.eclipse.hawkbit.repository.exception.EntityAlreadyExistsException;
|
import org.eclipse.hawkbit.repository.exception.EntityAlreadyExistsException;
|
||||||
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
|
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
|
||||||
import org.eclipse.hawkbit.repository.exception.ToManyAttributeEntriesException;
|
import org.eclipse.hawkbit.repository.exception.ToManyAttributeEntriesException;
|
||||||
import org.eclipse.hawkbit.repository.exception.ToManyStatusEntriesException;
|
import org.eclipse.hawkbit.repository.exception.TooManyStatusEntriesException;
|
||||||
import org.eclipse.hawkbit.repository.model.Action;
|
import org.eclipse.hawkbit.repository.model.Action;
|
||||||
import org.eclipse.hawkbit.repository.model.Action.Status;
|
import org.eclipse.hawkbit.repository.model.Action.Status;
|
||||||
import org.eclipse.hawkbit.repository.model.ActionStatus;
|
import org.eclipse.hawkbit.repository.model.ActionStatus;
|
||||||
@@ -95,7 +96,7 @@ public interface ControllerManagement {
|
|||||||
*
|
*
|
||||||
* @throws EntityAlreadyExistsException
|
* @throws EntityAlreadyExistsException
|
||||||
* if a given entity already exists
|
* if a given entity already exists
|
||||||
* @throws ToManyStatusEntriesException
|
* @throws TooManyStatusEntriesException
|
||||||
* if more than the allowed number of status entries are
|
* if more than the allowed number of status entries are
|
||||||
* inserted
|
* inserted
|
||||||
*/
|
*/
|
||||||
@@ -111,7 +112,18 @@ public interface ControllerManagement {
|
|||||||
* @return a list of actions assigned to given target which are active
|
* @return a list of actions assigned to given target which are active
|
||||||
*/
|
*/
|
||||||
@PreAuthorize(SpringEvalExpressions.IS_CONTROLLER)
|
@PreAuthorize(SpringEvalExpressions.IS_CONTROLLER)
|
||||||
List<Action> findActionByTargetAndActive(@NotNull Target target);
|
List<Action> findActiveActionByTarget(@NotNull Target target);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves oldest {@link Action} that is active and assigned to a
|
||||||
|
* {@link Target}.
|
||||||
|
*
|
||||||
|
* @param target
|
||||||
|
* the target to retrieve the actions from
|
||||||
|
* @return a list of actions assigned to given target which are active
|
||||||
|
*/
|
||||||
|
@PreAuthorize(SpringEvalExpressions.IS_CONTROLLER)
|
||||||
|
Optional<Action> findOldestActiveActionByTarget(@NotNull Target target);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the {@link Action} entity for given actionId with all lazy
|
* Get the {@link Action} entity for given actionId with all lazy
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ import org.eclipse.hawkbit.exception.AbstractServerRtException;
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public final class ToManyStatusEntriesException extends AbstractServerRtException {
|
public final class TooManyStatusEntriesException extends AbstractServerRtException {
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@@ -28,7 +28,7 @@ public final class ToManyStatusEntriesException extends AbstractServerRtExceptio
|
|||||||
* Creates a new FileUploadFailedException with
|
* Creates a new FileUploadFailedException with
|
||||||
* {@link SpServerError#SP_REST_BODY_NOT_READABLE} error.
|
* {@link SpServerError#SP_REST_BODY_NOT_READABLE} error.
|
||||||
*/
|
*/
|
||||||
public ToManyStatusEntriesException() {
|
public TooManyStatusEntriesException() {
|
||||||
super(SpServerError.SP_ACTION_STATUS_TO_MANY_ENTRIES);
|
super(SpServerError.SP_ACTION_STATUS_TO_MANY_ENTRIES);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -36,7 +36,7 @@ public final class ToManyStatusEntriesException extends AbstractServerRtExceptio
|
|||||||
* @param cause
|
* @param cause
|
||||||
* for the exception
|
* for the exception
|
||||||
*/
|
*/
|
||||||
public ToManyStatusEntriesException(final Throwable cause) {
|
public TooManyStatusEntriesException(final Throwable cause) {
|
||||||
super(SpServerError.SP_ACTION_STATUS_TO_MANY_ENTRIES, cause);
|
super(SpServerError.SP_ACTION_STATUS_TO_MANY_ENTRIES, cause);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -44,7 +44,7 @@ public final class ToManyStatusEntriesException extends AbstractServerRtExceptio
|
|||||||
* @param message
|
* @param message
|
||||||
* of the error
|
* of the error
|
||||||
*/
|
*/
|
||||||
public ToManyStatusEntriesException(final String message) {
|
public TooManyStatusEntriesException(final String message) {
|
||||||
super(message, SpServerError.SP_ACTION_STATUS_TO_MANY_ENTRIES);
|
super(message, SpServerError.SP_ACTION_STATUS_TO_MANY_ENTRIES);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -10,6 +10,7 @@ package org.eclipse.hawkbit.repository.jpa;
|
|||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
import org.eclipse.hawkbit.repository.jpa.model.JpaAction;
|
import org.eclipse.hawkbit.repository.jpa.model.JpaAction;
|
||||||
import org.eclipse.hawkbit.repository.jpa.model.JpaDistributionSet;
|
import org.eclipse.hawkbit.repository.jpa.model.JpaDistributionSet;
|
||||||
@@ -79,21 +80,31 @@ public interface ActionRepository extends BaseEntityRepository<JpaAction, Long>,
|
|||||||
Slice<Action> findByTarget(Pageable pageable, JpaTarget target);
|
Slice<Action> findByTarget(Pageable pageable, JpaTarget target);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves all {@link Action}s which are active and referring the given
|
* Retrieves all {@link Action}s which are active and referring to the given
|
||||||
* {@link Target} in a specified order. Loads also the lazy
|
* {@link Target} order by ID ascending.
|
||||||
* {@link Action#getDistributionSet()} field.
|
|
||||||
*
|
*
|
||||||
* @param pageable
|
|
||||||
* page parameters
|
|
||||||
* @param target
|
* @param target
|
||||||
* the target to find assigned actions
|
* the target to find assigned actions
|
||||||
* @param active
|
* @param active
|
||||||
* the action active flag
|
* the action active flag
|
||||||
* @return the found {@link Action}s
|
* @return the found {@link Action}s
|
||||||
*/
|
*/
|
||||||
@EntityGraph(value = "Action.ds", type = EntityGraphType.LOAD)
|
|
||||||
List<Action> findByTargetAndActiveOrderByIdAsc(final JpaTarget target, boolean active);
|
List<Action> findByTargetAndActiveOrderByIdAsc(final JpaTarget target, boolean active);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the oldest {@link Action} that is active and referring to the
|
||||||
|
* given {@link Target}.
|
||||||
|
*
|
||||||
|
* @param target
|
||||||
|
* the target to find assigned actions
|
||||||
|
* @param active
|
||||||
|
* the action active flag
|
||||||
|
*
|
||||||
|
* @return the found {@link Action}
|
||||||
|
*/
|
||||||
|
@EntityGraph(value = "Action.ds", type = EntityGraphType.LOAD)
|
||||||
|
Optional<Action> findFirstByTargetAndActiveOrderByIdAsc(final JpaTarget target, boolean active);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves latest {@link UpdateAction} for given target and
|
* Retrieves latest {@link UpdateAction} for given target and
|
||||||
* {@link SoftwareModule}.
|
* {@link SoftwareModule}.
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import java.net.URI;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
import javax.persistence.EntityManager;
|
import javax.persistence.EntityManager;
|
||||||
import javax.persistence.criteria.CriteriaBuilder;
|
import javax.persistence.criteria.CriteriaBuilder;
|
||||||
@@ -26,7 +27,7 @@ import org.eclipse.hawkbit.repository.TargetManagement;
|
|||||||
import org.eclipse.hawkbit.repository.TenantConfigurationManagement;
|
import org.eclipse.hawkbit.repository.TenantConfigurationManagement;
|
||||||
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
|
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
|
||||||
import org.eclipse.hawkbit.repository.exception.ToManyAttributeEntriesException;
|
import org.eclipse.hawkbit.repository.exception.ToManyAttributeEntriesException;
|
||||||
import org.eclipse.hawkbit.repository.exception.ToManyStatusEntriesException;
|
import org.eclipse.hawkbit.repository.exception.TooManyStatusEntriesException;
|
||||||
import org.eclipse.hawkbit.repository.jpa.cache.CacheWriteNotify;
|
import org.eclipse.hawkbit.repository.jpa.cache.CacheWriteNotify;
|
||||||
import org.eclipse.hawkbit.repository.jpa.model.JpaAction;
|
import org.eclipse.hawkbit.repository.jpa.model.JpaAction;
|
||||||
import org.eclipse.hawkbit.repository.jpa.model.JpaActionStatus;
|
import org.eclipse.hawkbit.repository.jpa.model.JpaActionStatus;
|
||||||
@@ -156,10 +157,15 @@ public class JpaControllerManagement implements ControllerManagement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Action> findActionByTargetAndActive(final Target target) {
|
public List<Action> findActiveActionByTarget(final Target target) {
|
||||||
return actionRepository.findByTargetAndActiveOrderByIdAsc((JpaTarget) target, true);
|
return actionRepository.findByTargetAndActiveOrderByIdAsc((JpaTarget) target, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Optional<Action> findOldestActiveActionByTarget(final Target target) {
|
||||||
|
return actionRepository.findFirstByTargetAndActiveOrderByIdAsc((JpaTarget) target, true);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<SoftwareModule> findSoftwareModulesByDistributionSet(final DistributionSet distributionSet) {
|
public List<SoftwareModule> findSoftwareModulesByDistributionSet(final DistributionSet distributionSet) {
|
||||||
return new ArrayList<>(softwareModuleRepository.findByAssignedTo((JpaDistributionSet) distributionSet));
|
return new ArrayList<>(softwareModuleRepository.findByAssignedTo((JpaDistributionSet) distributionSet));
|
||||||
@@ -326,7 +332,7 @@ public class JpaControllerManagement implements ControllerManagement {
|
|||||||
LOG_DOS.error(
|
LOG_DOS.error(
|
||||||
"Potential denial of service (DOS) attack identfied. More status entries in the system than permitted ({})!",
|
"Potential denial of service (DOS) attack identfied. More status entries in the system than permitted ({})!",
|
||||||
securityProperties.getDos().getMaxStatusEntriesPerAction());
|
securityProperties.getDos().getMaxStatusEntriesPerAction());
|
||||||
throw new ToManyStatusEntriesException(
|
throw new TooManyStatusEntriesException(
|
||||||
String.valueOf(securityProperties.getDos().getMaxStatusEntriesPerAction()));
|
String.valueOf(securityProperties.getDos().getMaxStatusEntriesPerAction()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
2
pom.xml
2
pom.xml
@@ -96,7 +96,7 @@
|
|||||||
<org.powermock.version>1.5.4</org.powermock.version>
|
<org.powermock.version>1.5.4</org.powermock.version>
|
||||||
<pl.pragmatists.version>1.0.2</pl.pragmatists.version>
|
<pl.pragmatists.version>1.0.2</pl.pragmatists.version>
|
||||||
<guava.version>19.0</guava.version>
|
<guava.version>19.0</guava.version>
|
||||||
<mariadb-java-client.version>1.4.3</mariadb-java-client.version>
|
<mariadb-java-client.version>1.5.2</mariadb-java-client.version>
|
||||||
<embedded-mongo.version>1.50.5</embedded-mongo.version>
|
<embedded-mongo.version>1.50.5</embedded-mongo.version>
|
||||||
<javax.el-api.version>2.2.4</javax.el-api.version>
|
<javax.el-api.version>2.2.4</javax.el-api.version>
|
||||||
<corn-cps.version>1.1.7</corn-cps.version>
|
<corn-cps.version>1.1.7</corn-cps.version>
|
||||||
|
|||||||
Reference in New Issue
Block a user