Skip to content

Commit a3388ad

Browse files
authored
refactor: move cloud audit and lock request/response to cloud-api" (#884)
1 parent aae4039 commit a3388ad

45 files changed

Lines changed: 776 additions & 372 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ allprojects {
1818
group = "io.flamingock"
1919
version = "1.3.0-SNAPSHOT"
2020

21-
extra["generalUtilVersion"] = "1.5.1"
21+
extra["generalUtilVersion"] = "1.5.2"
2222
extra["templateApiVersion"] = "1.3.2"
2323
extra["coreApiVersion"] = "1.3.1"
2424
extra["sqlVersion"] = "1.2.0"

cloud/flamingock-cloud-api/build.gradle.kts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ dependencies {
33

44
description = "Cloud Edition public API definitions"
55

6+
val coreApiVersion: String by extra
7+
dependencies {
8+
api("io.flamingock:flamingock-core-api:${coreApiVersion}")
9+
}
10+
611
java {
712
toolchain {
813
languageVersion.set(JavaLanguageVersion.of(8))
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/*
2+
* Copyright 2026 Flamingock (https://www.flamingock.io)
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package io.flamingock.cloud.api.error;
17+
18+
import java.util.Map;
19+
20+
public interface FlamingockError {
21+
22+
String getCode();
23+
24+
boolean getRecoverable();
25+
26+
String getPublicMessage();
27+
28+
String getInternalMessage();
29+
30+
Map<String, Object> getParameters();
31+
}

core/flamingock-core-commons/src/main/java/io/flamingock/internal/common/cloud/audit/AuditEntryRequest.java renamed to cloud/flamingock-cloud-api/src/main/java/io/flamingock/cloud/api/request/AuditEntryRequest.java

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -13,37 +13,39 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
package io.flamingock.internal.common.cloud.audit;
16+
package io.flamingock.cloud.api.request;
1717

1818
import io.flamingock.api.RecoveryStrategy;
19-
import io.flamingock.internal.common.core.audit.AuditTxType;
2019

2120
public class AuditEntryRequest {
2221

23-
private final String stageId;
24-
private final String taskId;
25-
private final String author;
26-
private final long appliedAtEpochMillis;
27-
private final Status state;
28-
private final String className;
29-
private final String methodName;
30-
private final Object metadata;
31-
private final long executionMillis;
32-
private final String executionHostname;
33-
private final String errorTrace;
34-
private final ChangeType type;
35-
private final AuditTxType txStrategy;
36-
private final String targetSystemId;
37-
private final String order;
38-
private final RecoveryStrategy recoveryStrategy;
39-
private final Boolean transactionFlag;
22+
private String stageId;
23+
private String taskId;
24+
private String author;
25+
private long appliedAtEpochMillis;
26+
private AuditEntryStatus state;
27+
private String className;
28+
private String methodName;
29+
private Object metadata;
30+
private long executionMillis;
31+
private String executionHostname;
32+
private String errorTrace;
33+
private ChangeType type;
34+
private CloudAuditTxType txStrategy;
35+
private String targetSystemId;
36+
private String order;
37+
private RecoveryStrategy recoveryStrategy;
38+
private Boolean transactionFlag;
4039
protected Boolean systemChange;//TODO not in server
4140

41+
public AuditEntryRequest() {
42+
}
43+
4244
public AuditEntryRequest(String stageId,
4345
String taskId,
4446
String author,
4547
long appliedAtEpochMillis,
46-
Status state,
48+
AuditEntryStatus state,
4749
ChangeType type,
4850
String className,
4951
String methodName,
@@ -52,7 +54,7 @@ public AuditEntryRequest(String stageId,
5254
Object metadata,
5355
boolean systemChange,
5456
String errorTrace,
55-
AuditTxType txStrategy,
57+
CloudAuditTxType txStrategy,
5658
String targetSystemId,
5759
String order,
5860
RecoveryStrategy recoveryStrategy,
@@ -94,7 +96,7 @@ public long getAppliedAtEpochMillis() {
9496
return appliedAtEpochMillis;
9597
}
9698

97-
public Status getState() {
99+
public AuditEntryStatus getState() {
98100
return state;
99101
}
100102

@@ -130,7 +132,7 @@ public ChangeType getType() {
130132
return type;
131133
}
132134

133-
public AuditTxType getTxStrategy() {
135+
public CloudAuditTxType getTxStrategy() {
134136
return txStrategy;
135137
}
136138

@@ -152,7 +154,7 @@ public Boolean getTransactionFlag() {
152154

153155
public enum ChangeType {STANDARD_CODE, STANDARD_TEMPLATE, MONGOCK_EXECUTION, MONGOCK_BEFORE}
154156

155-
public enum Status {
157+
public enum AuditEntryStatus {
156158
STARTED,
157159
APPLIED,
158160
FAILED,
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/*
2+
* Copyright 2025 Flamingock (https://www.flamingock.io)
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package io.flamingock.cloud.api.request;
17+
18+
public enum CloudAuditTxType {
19+
NON_TX,
20+
TX_SHARED, // SharedTx (Target system the same as the audit store)
21+
TX_SEPARATE_WITH_MARKER, // SimpleTx (Target system is not the audit store). With marker
22+
TX_SEPARATE_NO_MARKER; // SimpleTx (Target system is not the audit store). Without marker
23+
24+
}
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
/*
2+
* Copyright 2026 Flamingock (https://www.flamingock.io)
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package io.flamingock.cloud.api.request;
17+
18+
public class LockAcquisitionRequest {
19+
20+
private long acquiredForMillis;
21+
private String lastAcquisitionId;
22+
private Long elapsedMillis;
23+
24+
public LockAcquisitionRequest() {
25+
}
26+
27+
public LockAcquisitionRequest(long acquiredForMillis, String lastAcquisitionId, Long elapsedMillis) {
28+
this.acquiredForMillis = acquiredForMillis;
29+
this.lastAcquisitionId = lastAcquisitionId;
30+
this.elapsedMillis = elapsedMillis;
31+
}
32+
33+
public long getAcquiredForMillis() {
34+
return acquiredForMillis;
35+
}
36+
37+
public void setAcquiredForMillis(long acquiredForMillis) {
38+
this.acquiredForMillis = acquiredForMillis;
39+
}
40+
41+
public String getLastAcquisitionId() {
42+
return lastAcquisitionId;
43+
}
44+
45+
public void setLastAcquisitionId(String lastAcquisitionId) {
46+
this.lastAcquisitionId = lastAcquisitionId;
47+
}
48+
49+
public Long getElapsedMillis() {
50+
return elapsedMillis;
51+
}
52+
53+
public void setElapsedMillis(Long elapsedMillis) {
54+
this.elapsedMillis = elapsedMillis;
55+
}
56+
}

core/flamingock-core-commons/src/main/java/io/flamingock/internal/common/cloud/lock/LockExtensionRequest.java renamed to cloud/flamingock-cloud-api/src/main/java/io/flamingock/cloud/api/request/LockExtensionRequest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
package io.flamingock.internal.common.cloud.lock;
16+
package io.flamingock.cloud.api.request;
1717

1818
public class LockExtensionRequest {
1919

core/flamingock-core-commons/src/main/java/io/flamingock/internal/common/cloud/auth/AuthRequest.java renamed to cloud/flamingock-cloud-api/src/main/java/io/flamingock/cloud/api/request/TokenExchangeRequest.java

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,35 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
package io.flamingock.internal.common.cloud.auth;
16+
package io.flamingock.cloud.api.request;
1717

18-
public class AuthRequest {
18+
public class TokenExchangeRequest {
1919

20-
private final String apiToken;
21-
private final String serviceName;
22-
private final String environmentName;
20+
private String apiToken;
21+
private String serviceName;
22+
private String environmentName;
2323

24-
public AuthRequest(String apiToken, String serviceName, String environmentName) {
24+
public TokenExchangeRequest() {
25+
}
26+
27+
public TokenExchangeRequest(String apiToken, String serviceName, String environmentName) {
2528
this.apiToken = apiToken;
2629
this.serviceName = serviceName;
2730
this.environmentName = environmentName;
2831
}
2932

33+
public void setApiToken(String apiToken) {
34+
this.apiToken = apiToken;
35+
}
36+
37+
public void setServiceName(String serviceName) {
38+
this.serviceName = serviceName;
39+
}
40+
41+
public void setEnvironmentName(String environmentName) {
42+
this.environmentName = environmentName;
43+
}
44+
3045
public String getApiToken() {
3146
return apiToken;
3247
}
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
/*
2+
* Copyright 2026 Flamingock (https://www.flamingock.io)
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package io.flamingock.cloud.api.response;
17+
18+
import io.flamingock.cloud.api.request.ClientSubmission;
19+
20+
import java.time.Instant;
21+
22+
public class ExecutionFullResponse {
23+
24+
private String executionId;
25+
private long environmentId;
26+
private long serviceId;
27+
private String runnerId;
28+
private Instant startedAt;
29+
private ClientSubmission clientSubmission;
30+
private PipelineResponse pipeline;
31+
32+
public ExecutionFullResponse() {
33+
}
34+
35+
public ExecutionFullResponse(String executionId, long environmentId, long serviceId, String runnerId,
36+
Instant startedAt, ClientSubmission clientSubmission, PipelineResponse pipeline) {
37+
this.executionId = executionId;
38+
this.environmentId = environmentId;
39+
this.serviceId = serviceId;
40+
this.runnerId = runnerId;
41+
this.startedAt = startedAt;
42+
this.clientSubmission = clientSubmission;
43+
this.pipeline = pipeline;
44+
}
45+
46+
public String getExecutionId() { return executionId; }
47+
public void setExecutionId(String executionId) { this.executionId = executionId; }
48+
49+
public long getEnvironmentId() { return environmentId; }
50+
public void setEnvironmentId(long environmentId) { this.environmentId = environmentId; }
51+
52+
public long getServiceId() { return serviceId; }
53+
public void setServiceId(long serviceId) { this.serviceId = serviceId; }
54+
55+
public String getRunnerId() { return runnerId; }
56+
public void setRunnerId(String runnerId) { this.runnerId = runnerId; }
57+
58+
public Instant getStartedAt() { return startedAt; }
59+
public void setStartedAt(Instant startedAt) { this.startedAt = startedAt; }
60+
61+
public ClientSubmission getClientSubmission() { return clientSubmission; }
62+
public void setClientSubmission(ClientSubmission clientSubmission) { this.clientSubmission = clientSubmission; }
63+
64+
public PipelineResponse getPipeline() { return pipeline; }
65+
public void setPipeline(PipelineResponse pipeline) { this.pipeline = pipeline; }
66+
67+
@Override
68+
public boolean equals(Object o) {
69+
if (this == o) return true;
70+
if (o == null || getClass() != o.getClass()) return false;
71+
ExecutionFullResponse that = (ExecutionFullResponse) o;
72+
return environmentId == that.environmentId && serviceId == that.serviceId
73+
&& java.util.Objects.equals(executionId, that.executionId)
74+
&& java.util.Objects.equals(runnerId, that.runnerId)
75+
&& java.util.Objects.equals(startedAt, that.startedAt)
76+
&& java.util.Objects.equals(clientSubmission, that.clientSubmission)
77+
&& java.util.Objects.equals(pipeline, that.pipeline);
78+
}
79+
80+
@Override
81+
public int hashCode() {
82+
return java.util.Objects.hash(executionId, environmentId, serviceId, runnerId, startedAt, clientSubmission, pipeline);
83+
}
84+
}

0 commit comments

Comments
 (0)