@@ -721,7 +721,7 @@ def patch_conf(conf: Configuration, endpoint: Optional[str] = None) -> Configura
721
721
return conf
722
722
723
723
724
- def get_conf (profile : str ) -> Configuration :
724
+ def get_conf (profile : str , service : str ) -> Configuration :
725
725
# Check which conf_path is used.
726
726
conf_path = next ((path for path in CONF_PATHS if path .exists ()), None )
727
727
@@ -741,6 +741,29 @@ def get_conf(profile: str) -> Configuration:
741
741
if not "https" in json_profile :
742
742
json_profile ["https" ] = True
743
743
744
+ if "endpoints" in json_profile :
745
+ if service == "api" and "api" in json_profile ["endpoints" ]:
746
+ json_profile ["endpoint" ] = json_profile ["endpoints" ]["api" ]
747
+ del json_profile ["endpoints" ]
748
+ elif (
749
+ service == "directlink"
750
+ and "directlink" in json_profile ["endpoints" ]
751
+ ):
752
+ json_profile ["endpoint" ] = json_profile ["endpoints" ]["directlink" ]
753
+ del json_profile ["endpoints" ]
754
+ elif service == "eim" and "eim" in json_profile ["endpoints" ]:
755
+ json_profile ["endpoint" ] = json_profile ["endpoints" ]["eim" ]
756
+ del json_profile ["endpoints" ]
757
+ elif service == "fcu" and "fcu" in json_profile ["endpoints" ]:
758
+ json_profile ["endpoint" ] = json_profile ["endpoints" ]["fcu" ]
759
+ del json_profile ["endpoints" ]
760
+ elif service == "lbu" and "lbu" in json_profile ["endpoints" ]:
761
+ json_profile ["endpoint" ] = json_profile ["endpoints" ]["lbu" ]
762
+ del json_profile ["endpoints" ]
763
+ elif service == "okms" and "okms" in json_profile ["endpoints" ]:
764
+ json_profile ["endpoint" ] = json_profile ["endpoints" ]["okms" ]
765
+ del json_profile ["endpoints" ]
766
+
744
767
if not "region_name" in json_profile :
745
768
json_profile ["region_name" ] = json_profile ["region" ]
746
769
del json_profile ["region" ]
@@ -792,7 +815,7 @@ def api_connect(
792
815
login ,
793
816
PASSWORD_ARG ,
794
817
authentication_method ,
795
- ** patch_conf (get_conf (profile ), endpoint ),
818
+ ** patch_conf (get_conf (profile , service ), endpoint ),
796
819
)
797
820
798
821
handler .make_request (call , ** kwargs )
0 commit comments