Skip to content

Commit

Permalink
DBZ-6493 refactored dynamic properties of all subresources into confi…
Browse files Browse the repository at this point in the history
…g property
  • Loading branch information
jcechace committed Jun 1, 2023
1 parent 366684f commit db7d374
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 98 deletions.
57 changes: 35 additions & 22 deletions k8/debeziumservers.debezium.io-v1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -701,13 +701,16 @@ spec:
type: string
type:
type: string
props:
additionalProperties:
type: object
config:
properties:
props:
additionalProperties:
type: object
type: object
x-kubernetes-preserve-unknown-fields: true
type: object
x-kubernetes-preserve-unknown-fields: true
type: object
x-kubernetes-preserve-unknown-fields: true
type: array
sink:
properties:
Expand All @@ -730,13 +733,16 @@ spec:
type: string
type:
type: string
props:
additionalProperties:
type: object
config:
properties:
props:
additionalProperties:
type: object
type: object
x-kubernetes-preserve-unknown-fields: true
type: object
x-kubernetes-preserve-unknown-fields: true
type: object
x-kubernetes-preserve-unknown-fields: true
type: array
storage:
properties:
Expand All @@ -758,9 +764,7 @@ spec:
additionalProperties:
type: object
type: object
x-kubernetes-preserve-unknown-fields: true
type: object
x-kubernetes-preserve-unknown-fields: true
source:
properties:
class:
Expand All @@ -781,35 +785,44 @@ spec:
properties:
type:
type: string
props:
additionalProperties:
type: object
config:
properties:
props:
additionalProperties:
type: object
type: object
x-kubernetes-preserve-unknown-fields: true
type: object
x-kubernetes-preserve-unknown-fields: true
type: object
x-kubernetes-preserve-unknown-fields: true
value:
properties:
type:
type: string
props:
additionalProperties:
type: object
config:
properties:
props:
additionalProperties:
type: object
type: object
x-kubernetes-preserve-unknown-fields: true
type: object
x-kubernetes-preserve-unknown-fields: true
type: object
x-kubernetes-preserve-unknown-fields: true
header:
properties:
type:
type: string
props:
additionalProperties:
type: object
config:
properties:
props:
additionalProperties:
type: object
type: object
x-kubernetes-preserve-unknown-fields: true
type: object
x-kubernetes-preserve-unknown-fields: true
type: object
x-kubernetes-preserve-unknown-fields: true
type: object
type: object
status:
Expand Down
23 changes: 8 additions & 15 deletions src/main/java/io/debezium/operator/model/FormatType.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,34 +5,26 @@
*/
package io.debezium.operator.model;

import java.util.HashMap;
import java.util.Map;

import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;

import io.debezium.operator.config.ConfigMappable;
import io.debezium.operator.config.ConfigMapping;

public class FormatType implements ConfigMappable {

private String type;

private final Map<String, Object> props;
private ConfigProperties config;

public FormatType() {
type = "json";
props = new HashMap<>(0);
this.config = new ConfigProperties();
}

@JsonAnyGetter
public Map<String, Object> getProps() {
return props;
public ConfigProperties getConfig() {
return config;
}

@JsonAnySetter
public void setProps(String name, Object value) {
getProps().put(name, value);
public void setConfig(ConfigProperties config) {
this.config = config;
}

public String getType() {
Expand All @@ -45,7 +37,8 @@ public void setType(String type) {

@Override
public ConfigMapping asConfiguration() {
var config = ConfigMapping.from(props);
var config = ConfigMapping.empty();
config.put(this.config);
config.rootValue(type);
return config;
}
Expand Down
28 changes: 13 additions & 15 deletions src/main/java/io/debezium/operator/model/Predicate.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,18 @@
*/
package io.debezium.operator.model;

import java.util.HashMap;
import java.util.Map;

import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;

import io.debezium.operator.config.ConfigMappable;
import io.debezium.operator.config.ConfigMapping;

public class Predicate implements ConfigMappable {

private String name;
private String type;
private Map<String, Object> props = new HashMap<>(0);
private ConfigProperties config;

public Predicate() {
this.config = new ConfigProperties();
}

public String getName() {
return name;
Expand All @@ -36,20 +34,20 @@ public void setType(String type) {
this.type = type;
}

@JsonAnyGetter
public Map<String, Object> getProps() {
return props;
public ConfigProperties getConfig() {
return config;
}

@JsonAnySetter
public void setProps(String name, Object value) {
getProps().put(name, value);
public void setConfig(ConfigProperties config) {
this.config = config;
}

@Override
public ConfigMapping asConfiguration() {
var config = ConfigMapping.from(props);
config.rootValue(type);
var config = ConfigMapping.prefixed(name);
config.put("type", type);
config.put(this.config);
return config;

}
}
28 changes: 1 addition & 27 deletions src/main/java/io/debezium/operator/model/Quarkus.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,5 @@
*/
package io.debezium.operator.model;

import java.util.HashMap;
import java.util.Map;

import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;

import io.debezium.operator.config.ConfigMappable;
import io.debezium.operator.config.ConfigMapping;

public class Quarkus implements ConfigMappable {

private Map<String, Object> props = new HashMap<>(0);

@JsonAnyGetter
public Map<String, Object> getProps() {
return props;
}

@JsonAnySetter
public void setProps(String name, Object value) {
getProps().put(name, value);
}

@Override
public ConfigMapping asConfiguration() {
return ConfigMapping.from(props);
}
public class Quarkus extends ConfigProperties {
}
27 changes: 8 additions & 19 deletions src/main/java/io/debezium/operator/model/Transformation.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,6 @@
*/
package io.debezium.operator.model;

import java.util.HashMap;
import java.util.Map;

import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;

import io.debezium.operator.config.ConfigMappable;
import io.debezium.operator.config.ConfigMapping;

Expand All @@ -20,7 +14,7 @@ public class Transformation implements ConfigMappable {
private String type;
private String predicate;
private boolean negate = false;
private Map<String, Object> props = new HashMap<>(0);
private ConfigProperties config;

public String getName() {
return name;
Expand All @@ -30,10 +24,6 @@ public void setName(String name) {
this.name = name;
}

public void setProps(Map<String, Object> props) {
this.props = props;
}

public String getType() {
return type;
}
Expand All @@ -58,22 +48,21 @@ public void setNegate(boolean negate) {
this.negate = negate;
}

@JsonAnyGetter
public Map<String, Object> getProps() {
return props;
public ConfigProperties getConfig() {
return config;
}

@JsonAnySetter
public void setProps(String name, Object value) {
getProps().put(name, value);
public void setConfig(ConfigProperties config) {
this.config = config;
}

@Override
public ConfigMapping asConfiguration() {
var config = ConfigMapping.from(props);
config.rootValue(type);
var config = ConfigMapping.empty();
config.put("type", type);
config.put("predicate", predicate);
config.put("negate", negate);
config.put(this.config);
return config;
}
}

0 comments on commit db7d374

Please sign in to comment.