77
88import pandas as pd
99
10- from awswrangler import _utils , exceptions
10+ from awswrangler import exceptions
1111
1212_logger : logging .Logger = logging .getLogger (__name__ )
1313
@@ -31,15 +31,30 @@ class _ConfigArg(NamedTuple):
3131 "max_cache_seconds" : _ConfigArg (dtype = int , nullable = False ),
3232 "s3_block_size" : _ConfigArg (dtype = int , nullable = False , enforced = True ),
3333 "workgroup" : _ConfigArg (dtype = str , nullable = False , enforced = True ),
34+ # Endpoints URLs
35+ "s3_endpoint_url" : _ConfigArg (dtype = str , nullable = True , enforced = True ),
36+ "athena_endpoint_url" : _ConfigArg (dtype = str , nullable = True , enforced = True ),
37+ "sts_endpoint_url" : _ConfigArg (dtype = str , nullable = True , enforced = True ),
38+ "glue_endpoint_url" : _ConfigArg (dtype = str , nullable = True , enforced = True ),
39+ "redshift_endpoint_url" : _ConfigArg (dtype = str , nullable = True , enforced = True ),
40+ "kms_endpoint_url" : _ConfigArg (dtype = str , nullable = True , enforced = True ),
41+ "emr_endpoint_url" : _ConfigArg (dtype = str , nullable = True , enforced = True ),
3442}
3543
3644
37- class _Config :
45+ class _Config : # pylint: disable=too-many-instance-attributes
3846 """Wrangler's Configuration class."""
3947
4048 def __init__ (self ) -> None :
4149 self ._loaded_values : Dict [str , _ConfigValueType ] = {}
4250 name : str
51+ self .s3_endpoint_url = None
52+ self .athena_endpoint_url = None
53+ self .sts_endpoint_url = None
54+ self .glue_endpoint_url = None
55+ self .redshift_endpoint_url = None
56+ self .kms_endpoint_url = None
57+ self .emr_endpoint_url = None
4358 for name in _CONFIG_ARGS :
4459 self ._load_config (name = name )
4560
@@ -125,7 +140,10 @@ def __getitem__(self, item: str) -> _ConfigValueType:
125140
126141 def _reset_item (self , item : str ) -> None :
127142 if item in self ._loaded_values :
128- del self ._loaded_values [item ]
143+ if item .endswith ("_endpoint_url" ):
144+ self ._loaded_values [item ] = None
145+ else :
146+ del self ._loaded_values [item ]
129147 self ._load_config (name = item )
130148
131149 def _repr_html_ (self ) -> Any :
@@ -224,6 +242,75 @@ def workgroup(self) -> Optional[str]:
224242 def workgroup (self , value : Optional [str ]) -> None :
225243 self ._set_config_value (key = "workgroup" , value = value )
226244
245+ @property
246+ def s3_endpoint_url (self ) -> Optional [str ]:
247+ """Property s3_endpoint_url."""
248+ return cast (Optional [str ], self ["s3_endpoint_url" ])
249+
250+ @s3_endpoint_url .setter
251+ def s3_endpoint_url (self , value : Optional [str ]) -> None :
252+ self ._set_config_value (key = "s3_endpoint_url" , value = value )
253+
254+ @property
255+ def athena_endpoint_url (self ) -> Optional [str ]:
256+ """Property athena_endpoint_url."""
257+ return cast (Optional [str ], self ["athena_endpoint_url" ])
258+
259+ @athena_endpoint_url .setter
260+ def athena_endpoint_url (self , value : Optional [str ]) -> None :
261+ self ._set_config_value (key = "athena_endpoint_url" , value = value )
262+
263+ @property
264+ def sts_endpoint_url (self ) -> Optional [str ]:
265+ """Property sts_endpoint_url."""
266+ return cast (Optional [str ], self ["sts_endpoint_url" ])
267+
268+ @sts_endpoint_url .setter
269+ def sts_endpoint_url (self , value : Optional [str ]) -> None :
270+ self ._set_config_value (key = "sts_endpoint_url" , value = value )
271+
272+ @property
273+ def glue_endpoint_url (self ) -> Optional [str ]:
274+ """Property glue_endpoint_url."""
275+ return cast (Optional [str ], self ["glue_endpoint_url" ])
276+
277+ @glue_endpoint_url .setter
278+ def glue_endpoint_url (self , value : Optional [str ]) -> None :
279+ self ._set_config_value (key = "glue_endpoint_url" , value = value )
280+
281+ @property
282+ def redshift_endpoint_url (self ) -> Optional [str ]:
283+ """Property redshift_endpoint_url."""
284+ return cast (Optional [str ], self ["redshift_endpoint_url" ])
285+
286+ @redshift_endpoint_url .setter
287+ def redshift_endpoint_url (self , value : Optional [str ]) -> None :
288+ self ._set_config_value (key = "redshift_endpoint_url" , value = value )
289+
290+ @property
291+ def kms_endpoint_url (self ) -> Optional [str ]:
292+ """Property kms_endpoint_url."""
293+ return cast (Optional [str ], self ["kms_endpoint_url" ])
294+
295+ @kms_endpoint_url .setter
296+ def kms_endpoint_url (self , value : Optional [str ]) -> None :
297+ self ._set_config_value (key = "kms_endpoint_url" , value = value )
298+
299+ @property
300+ def emr_endpoint_url (self ) -> Optional [str ]:
301+ """Property emr_endpoint_url."""
302+ return cast (Optional [str ], self ["emr_endpoint_url" ])
303+
304+ @emr_endpoint_url .setter
305+ def emr_endpoint_url (self , value : Optional [str ]) -> None :
306+ self ._set_config_value (key = "emr_endpoint_url" , value = value )
307+
308+
309+ def _insert_str (text : str , token : str , insert : str ) -> str :
310+ """Insert string into other."""
311+ index : int = text .find (token )
312+ return text [:index ] + insert + text [index :]
313+
227314
228315def _inject_config_doc (doc : Optional [str ], available_configs : Tuple [str , ...]) -> str :
229316 if doc is None :
@@ -244,7 +331,7 @@ def _inject_config_doc(doc: Optional[str], available_configs: Tuple[str, ...]) -
244331 " for details.\n "
245332 )
246333 insertion : str = header + args_block + footer + "\n \n "
247- return _utils . insert_str (text = doc , token = "\n Parameters" , insert = insertion )
334+ return _insert_str (text = doc , token = "\n Parameters" , insert = insertion )
248335
249336
250337def apply_configs (function : Callable [..., Any ]) -> Callable [..., Any ]:
0 commit comments