@@ -721,7 +721,7 @@ def patch_conf(conf: Configuration, endpoint: Optional[str] = None) -> Configura
721721 return conf
722722
723723
724- def get_conf (profile : str ) -> Configuration :
724+ def get_conf (profile : str , service : str ) -> Configuration :
725725 # Check which conf_path is used.
726726 conf_path = next ((path for path in CONF_PATHS if path .exists ()), None )
727727
@@ -740,6 +740,29 @@ def get_conf(profile: str) -> Configuration:
740740 if "https" not in json_profile :
741741 json_profile ["https" ] = True
742742
743+ if "endpoints" in json_profile :
744+ if service == "api" and "api" in json_profile ["endpoints" ]:
745+ json_profile ["endpoint" ] = json_profile ["endpoints" ]["api" ]
746+ del json_profile ["endpoints" ]
747+ elif (
748+ service == "directlink"
749+ and "directlink" in json_profile ["endpoints" ]
750+ ):
751+ json_profile ["endpoint" ] = json_profile ["endpoints" ]["directlink" ]
752+ del json_profile ["endpoints" ]
753+ elif service == "eim" and "eim" in json_profile ["endpoints" ]:
754+ json_profile ["endpoint" ] = json_profile ["endpoints" ]["eim" ]
755+ del json_profile ["endpoints" ]
756+ elif service == "fcu" and "fcu" in json_profile ["endpoints" ]:
757+ json_profile ["endpoint" ] = json_profile ["endpoints" ]["fcu" ]
758+ del json_profile ["endpoints" ]
759+ elif service == "lbu" and "lbu" in json_profile ["endpoints" ]:
760+ json_profile ["endpoint" ] = json_profile ["endpoints" ]["lbu" ]
761+ del json_profile ["endpoints" ]
762+ elif service == "okms" and "okms" in json_profile ["endpoints" ]:
763+ json_profile ["endpoint" ] = json_profile ["endpoints" ]["okms" ]
764+ del json_profile ["endpoints" ]
765+
743766 if "region_name" not in json_profile :
744767 json_profile ["region_name" ] = json_profile ["region" ]
745768 del json_profile ["region" ]
@@ -790,7 +813,7 @@ def api_connect(
790813 login ,
791814 PASSWORD_ARG ,
792815 authentication_method ,
793- ** patch_conf (get_conf (profile ), endpoint ),
816+ ** patch_conf (get_conf (profile , service ), endpoint ),
794817 )
795818
796819 handler .make_request (call , ** kwargs )
0 commit comments