Skip to content

Commit 72a06a4

Browse files
Merge pull request #559 from conductor-oss/CCOR-12630
Introduce maskedFields in workflow def
2 parents 64fa165 + dbacd3b commit 72a06a4

File tree

3 files changed

+42
-19
lines changed

3 files changed

+42
-19
lines changed

common/src/main/java/com/netflix/conductor/common/metadata/workflow/WorkflowDef.java

Lines changed: 35 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,16 @@
2424
import com.netflix.conductor.common.metadata.SchemaDef;
2525
import com.netflix.conductor.common.metadata.tasks.TaskType;
2626

27-
import jakarta.validation.*;
28-
import jakarta.validation.constraints.*;
27+
import jakarta.validation.Valid;
28+
import jakarta.validation.constraints.Max;
29+
import jakarta.validation.constraints.Min;
30+
import jakarta.validation.constraints.NotEmpty;
31+
import jakarta.validation.constraints.NotNull;
2932

3033
@ProtoMessage
3134
@TaskReferenceNameUniqueConstraint
3235
public class WorkflowDef extends Auditable {
3336

34-
@ProtoEnum
35-
public enum TimeoutPolicy {
36-
TIME_OUT_WF,
37-
ALERT_ONLY
38-
}
39-
4037
@NotEmpty(message = "WorkflowDef name cannot be null or empty")
4138
@ProtoField(id = 1)
4239
@ValidNameConstraint
@@ -112,6 +109,13 @@ public enum TimeoutPolicy {
112109
@ProtoField(id = 23)
113110
private CacheConfig cacheConfig;
114111

112+
@ProtoField(id = 24)
113+
private List<String> maskedFields = new ArrayList<>();
114+
115+
public static String getKey(String name, int version) {
116+
return name + "." + version;
117+
}
118+
115119
public boolean isEnforceSchema() {
116120
return enforceSchema;
117121
}
@@ -197,6 +201,13 @@ public int getVersion() {
197201
return version;
198202
}
199203

204+
/**
205+
* @param version the version to set
206+
*/
207+
public void setVersion(int version) {
208+
this.version = version;
209+
}
210+
200211
/**
201212
* @return the failureWorkflow
202213
*/
@@ -211,13 +222,6 @@ public void setFailureWorkflow(String failureWorkflow) {
211222
this.failureWorkflow = failureWorkflow;
212223
}
213224

214-
/**
215-
* @param version the version to set
216-
*/
217-
public void setVersion(int version) {
218-
this.version = version;
219-
}
220-
221225
/**
222226
* This method determines if the workflow is restartable or not
223227
*
@@ -336,10 +340,6 @@ public String key() {
336340
return getKey(name, version);
337341
}
338342

339-
public static String getKey(String name, int version) {
340-
return name + "." + version;
341-
}
342-
343343
public String getWorkflowStatusListenerSink() {
344344
return workflowStatusListenerSink;
345345
}
@@ -388,6 +388,14 @@ public void setCacheConfig(final CacheConfig cacheConfig) {
388388
this.cacheConfig = cacheConfig;
389389
}
390390

391+
public List<String> getMaskedFields() {
392+
return maskedFields;
393+
}
394+
395+
public void setMaskedFields(List<String> maskedFields) {
396+
this.maskedFields = maskedFields;
397+
}
398+
391399
public boolean containsType(String taskType) {
392400
return collectTasks().stream().anyMatch(t -> t.getType().equals(taskType));
393401
}
@@ -507,6 +515,14 @@ public String toString() {
507515
+ outputSchema
508516
+ ", enforceSchema="
509517
+ enforceSchema
518+
+ ", maskedFields="
519+
+ maskedFields
510520
+ '}';
511521
}
522+
523+
@ProtoEnum
524+
public enum TimeoutPolicy {
525+
TIME_OUT_WF,
526+
ALERT_ONLY
527+
}
512528
}

grpc/src/main/java/com/netflix/conductor/grpc/AbstractProtoMapper.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1363,6 +1363,7 @@ public WorkflowDefPb.WorkflowDef toProto(WorkflowDef from) {
13631363
if (from.getCacheConfig() != null) {
13641364
to.setCacheConfig( toProto( from.getCacheConfig() ) );
13651365
}
1366+
to.addAllMaskedFields( from.getMaskedFields() );
13661367
return to.build();
13671368
}
13681369

@@ -1414,6 +1415,7 @@ public WorkflowDef fromProto(WorkflowDefPb.WorkflowDef from) {
14141415
if (from.hasCacheConfig()) {
14151416
to.setCacheConfig( fromProto( from.getCacheConfig() ) );
14161417
}
1418+
to.setMaskedFields( from.getMaskedFieldsList().stream().collect(Collectors.toCollection(ArrayList::new)) );
14171419
return to;
14181420
}
14191421

@@ -1509,6 +1511,9 @@ public WorkflowSummaryPb.WorkflowSummary toProto(WorkflowSummary from) {
15091511
to.setCreatedBy( from.getCreatedBy() );
15101512
}
15111513
to.putAllTaskToDomain( from.getTaskToDomain() );
1514+
if (from.getIdempotencyKey() != null) {
1515+
to.setIdempotencyKey( from.getIdempotencyKey() );
1516+
}
15121517
return to.build();
15131518
}
15141519

@@ -1534,6 +1539,7 @@ public WorkflowSummary fromProto(WorkflowSummaryPb.WorkflowSummary from) {
15341539
to.setFailedTaskNames( from.getFailedTaskNamesList().stream().collect(Collectors.toCollection(HashSet::new)) );
15351540
to.setCreatedBy( from.getCreatedBy() );
15361541
to.setTaskToDomain( from.getTaskToDomainMap() );
1542+
to.setIdempotencyKey( from.getIdempotencyKey() );
15371543
return to;
15381544
}
15391545

grpc/src/main/proto/model/workflowdef.proto

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,5 @@ message WorkflowDef {
3838
bool enforce_schema = 21;
3939
map<string, google.protobuf.Value> metadata = 22;
4040
CacheConfig cache_config = 23;
41+
repeated string masked_fields = 24;
4142
}

0 commit comments

Comments
 (0)