|
|
@@ -4,10 +4,7 @@ import cn.reghao.bnt.web.devops.deployer.model.constant.SshAuthType;
|
|
|
import cn.reghao.bnt.web.devops.deployer.model.dto.RemoteMachine;
|
|
|
import cn.reghao.bnt.web.util.BaseEntity;
|
|
|
import cn.reghao.jutil.jdk.web.result.NotAvailable;
|
|
|
-import jakarta.persistence.Column;
|
|
|
-import jakarta.persistence.Entity;
|
|
|
-import jakarta.persistence.OneToOne;
|
|
|
-import jakarta.persistence.Table;
|
|
|
+import jakarta.persistence.*;
|
|
|
import jakarta.validation.constraints.NotBlank;
|
|
|
import jakarta.validation.constraints.NotNull;
|
|
|
import jakarta.validation.constraints.Size;
|
|
|
@@ -52,7 +49,7 @@ public class RemoteHost extends BaseEntity {
|
|
|
@Size(max = 255, message = "最大长度不能超过 255 个字符")
|
|
|
private String appVersion;
|
|
|
@NotNull
|
|
|
- @OneToOne
|
|
|
+ @ManyToOne
|
|
|
private RemoteAgentConfig remoteAgentConfig;
|
|
|
|
|
|
public RemoteHost() {
|
|
|
@@ -72,11 +69,21 @@ public class RemoteHost extends BaseEntity {
|
|
|
this.remoteAgentConfig = remoteAgentConfig;
|
|
|
}
|
|
|
|
|
|
- public RemoteHost(String host, int port, String username, String password) {
|
|
|
+ public RemoteHost(String host, int port, String authType, String username, String password) {
|
|
|
this.host = host;
|
|
|
this.port = port;
|
|
|
- this.authType = SshAuthType.password.name();
|
|
|
+ this.authType = authType;
|
|
|
this.username = username;
|
|
|
this.password = password;
|
|
|
+ this.appVersion = NotAvailable.na.getDesc();
|
|
|
+ }
|
|
|
+
|
|
|
+ public RemoteHost(String host, int port, String username, String privateKey) {
|
|
|
+ this.host = host;
|
|
|
+ this.port = port;
|
|
|
+ this.authType = SshAuthType.privateKey.name();
|
|
|
+ this.username = username;
|
|
|
+ this.privateKey = privateKey;
|
|
|
+ this.appVersion = NotAvailable.na.getDesc();
|
|
|
}
|
|
|
}
|