resource mapping 정보 추가

This commit is contained in:
hyunjujeong 2023-08-16 20:00:06 +09:00
parent 9470a02ccb
commit d32521e412
8 changed files with 42 additions and 12 deletions

4
Dockerfile Normal file
View File

@ -0,0 +1,4 @@
FROM amazoncorretto:17.0.6-al2023
EXPOSE 8081
ADD ./build/libs/*.jar device-deployer.jar
ENTRYPOINT ["java", "-jar", "/device-deployer.jar"]

View File

@ -40,7 +40,7 @@ public class DefaultDeployerService implements DeployerService{
log.info("[publish]");
try {
OutboundMessagePayload payload = new OutboundMessagePayload(
deployMessage.getUrl(),
deployMessage.getFileId(),
deployMessage.getName(),
deployMessage.getCommand(),
deployMessage.getEnv(),

View File

@ -4,7 +4,7 @@ import java.util.HashMap;
import java.util.Set;
public class OutboundMessage {
private String url;
private String fileId;
private String name;
private HashMap<String, String> env;
private String command;
@ -13,8 +13,8 @@ public class OutboundMessage {
protected OutboundMessage() {}
public String getUrl() {
return url;
public String getFileId() {
return fileId;
}
public String getName() {
@ -44,7 +44,7 @@ public class OutboundMessage {
@Override
public String toString() {
return "AssetApp{" +
"url='" + url + '\'' +
"fileId='" + fileId + '\'' +
", name='" + name + '\'' +
", env=" + env +
", command='" + command + '\'' +
@ -58,15 +58,15 @@ public class OutboundMessage {
}
public static final class Builder {
private String url;
private String fileId;
private String name;
private HashMap<String, String> env;
private String command;
private OperationType operationType;
private String requestId;
public Builder url(String url) {
this.url = url;
public Builder fileId(String fileId) {
this.fileId = fileId;
return this;
}
@ -97,7 +97,7 @@ public class OutboundMessage {
public OutboundMessage build() {
OutboundMessage deployMessage = new OutboundMessage();
deployMessage.url = this.url;
deployMessage.fileId = this.fileId;
deployMessage.name = this.name;
deployMessage.env = this.env;
deployMessage.command = this.command;

View File

@ -6,6 +6,7 @@ import inc.sdt.blokworks.devicedeployer.domain.AssetApp;
import inc.sdt.blokworks.devicedeployer.domain.OperationType;
import inc.sdt.blokworks.devicedeployer.domain.OutboundMessage;
import inc.sdt.blokworks.devicedeployer.domain.Process;
import inc.sdt.blokworks.devicedeployer.infrastructure.amqp.ResourceMapping;
import jakarta.servlet.http.HttpSession;
import jakarta.validation.Valid;
import org.slf4j.Logger;
@ -37,6 +38,7 @@ public class DeployerController {
* @param assetCode
* @param assetAppResource
*/
@ResourceMapping(name = "Deploy_App", method = "POST", uri = "/assets/{code}/apps", description = "앱 배포 명령")
@ResponseStatus(HttpStatus.CREATED)
@PostMapping("/assets/{assetCode}/apps")
public void deploy(@PathVariable String assetCode,
@ -52,6 +54,7 @@ public class DeployerController {
* ( )
* @param assetCode
*/
@ResourceMapping(name = "Get_Asset_App", method = "GET", uri = "/assets/{code}/apps", description = "배포된 앱 정보 조회")
@ResponseStatus(HttpStatus.OK)
@GetMapping("/assets/{assetCode}/apps")
public PageableResponse<AssetAppResource> get(@PathVariable String assetCode,

View File

@ -6,7 +6,7 @@ import java.util.HashMap;
record OutboundMessageResource(
@NotNull
String url,
String fileId,
@NotNull
String name,
String command,

View File

@ -8,7 +8,7 @@ public class OutboundMessageResourceConverter {
public OutboundMessageResource toResource(OutboundMessage outboundMessage) {
return new OutboundMessageResource(
outboundMessage.getUrl(),
outboundMessage.getFileId(),
outboundMessage.getName(),
outboundMessage.getCommand(),
outboundMessage.getEnv()
@ -17,7 +17,7 @@ public class OutboundMessageResourceConverter {
public OutboundMessage fromResource(OutboundMessageResource resource) {
return OutboundMessage.builder()
.url(resource.url())
.fileId(resource.fileId())
.name(resource.name())
.command(resource.command())
.env(resource.env())

View File

@ -2,6 +2,7 @@ package inc.sdt.blokworks.devicedeployer.presentation;
import inc.sdt.blokworks.devicedeployer.application.ProcessService;
import inc.sdt.blokworks.devicedeployer.domain.Process;
import inc.sdt.blokworks.devicedeployer.infrastructure.amqp.ResourceMapping;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.domain.Page;
@ -27,6 +28,7 @@ public class ProcessController {
* ( )
* @param assetCode
*/
@ResourceMapping(name = "Get_App_Process", method = "GET", uri = "/assets/{code}/apps/process", description = "배포된 앱의 프로세스 정보 조회")
@ResponseStatus(HttpStatus.OK)
@GetMapping("/assets/{assetCode}/apps/process")
public PageableResponse<ProcessResource> get(@PathVariable String assetCode,

View File

@ -1,3 +1,24 @@
spring:
datasource:
url: ${POSTGRES_URL}
username: ${POSTGRES_CREDENTIALS_USERNAME}
password: ${POSTGRES_CREDENTIALS_PASSWORD}
hikari:
maximum-pool-size: 3
jpa:
hibernate:
ddl-auto: update
show-sql: false
inbound:
mqtt:
url: ${INBOUND_MQTT_URL}
username: ${INBOUND_MQTT_CREDENTIALS_USERNAME}
password: ${INBOUND_MQTT_CREDENTIALS_PASSWORD}
topics:
- /assets/+/command-req/+
- /assets/+/apps/process
iam:
enabled: ${IAM_REGISTER_ENABLED}
amqp: