3838from datacustomcode .io .base import BaseDataAccessLayer
3939from datacustomcode .io .reader .base import BaseDataCloudReader # noqa: TCH001
4040from datacustomcode .io .writer .base import BaseDataCloudWriter # noqa: TCH001
41+ from datacustomcode .proxy .base import BaseProxyAccessLayer
42+ from datacustomcode .proxy .client .base import BaseProxyClient # noqa: TCH001
4143from datacustomcode .spark .base import BaseSparkSessionProvider
4244
4345DEFAULT_CONFIG_NAME = "config.yaml"
@@ -92,6 +94,23 @@ class SparkConfig(ForceableConfig):
9294
9395_P = TypeVar ("_P" , bound = BaseSparkSessionProvider )
9496
97+ _PX = TypeVar ("_PX" , bound = BaseProxyAccessLayer )
98+
99+
100+ class ProxyAccessLayerObjectConfig (ForceableConfig , Generic [_PX ]):
101+ """Config for proxy clients that take no constructor args (e.g. no spark)."""
102+
103+ model_config = ConfigDict (validate_default = True , extra = "forbid" )
104+ type_base : ClassVar [Type [BaseProxyAccessLayer ]] = BaseProxyAccessLayer
105+ type_config_name : str = Field (
106+ description = "CONFIG_NAME of the proxy client (e.g. 'LocalProxyClient')." ,
107+ )
108+ options : dict [str , Any ] = Field (default_factory = dict )
109+
110+ def to_object (self ) -> _PX :
111+ type_ = self .type_base .subclass_from_config_name (self .type_config_name )
112+ return cast (_PX , type_ (** self .options ))
113+
95114
96115class SparkProviderConfig (ForceableConfig , Generic [_P ]):
97116 model_config = ConfigDict (validate_default = True , extra = "forbid" )
@@ -109,6 +128,7 @@ def to_object(self) -> _P:
109128class ClientConfig (BaseModel ):
110129 reader_config : Union [AccessLayerObjectConfig [BaseDataCloudReader ], None ] = None
111130 writer_config : Union [AccessLayerObjectConfig [BaseDataCloudWriter ], None ] = None
131+ proxy_config : Union [ProxyAccessLayerObjectConfig [BaseProxyClient ], None ] = None
112132 spark_config : Union [SparkConfig , None ] = None
113133 spark_provider_config : Union [
114134 SparkProviderConfig [BaseSparkSessionProvider ], None
@@ -136,6 +156,7 @@ def merge(
136156
137157 self .reader_config = merge (self .reader_config , other .reader_config )
138158 self .writer_config = merge (self .writer_config , other .writer_config )
159+ self .proxy_config = merge (self .proxy_config , other .proxy_config )
139160 self .spark_config = merge (self .spark_config , other .spark_config )
140161 self .spark_provider_config = merge (
141162 self .spark_provider_config , other .spark_provider_config
0 commit comments