/* Ċ Ġ* Ġ************************************************************************* *** Ċ Ġ* ĠĠ ĠCopyright Ġ 2 0 1 4 - 2 0 1 9 ĠSpect ra ĠLogic ĠCorporation . ĠAll ĠRights ĠReserved . Ċ Ġ* Ġ************************************************************************* ** Ċ Ġ*/ Ċ Ċ package Ġcom . spect ral og ic . escape pod . dev integration Ċ Ċ import Ġcom . fasterxml . jackson . module . kotlin . jackson ObjectMapper Ċ import Ġcom . spect ral og ic . ret rofit utils . Ret rofit Client Factory Impl Ċ import Ġretrofit 2 . Response Ċ import Ġretrofit 2 . http . Body Ċ import Ġretrofit 2 . http . GET Ċ import Ġretrofit 2 . http . POST Ċ import Ġretrofit 2 . http . Query Ċ Ċ interface ĠRio Auth Client Ġ{ ĊĠĠĠ Ġ@ GET ("/ api / cluster ") ĊĠĠĠ Ġsuspend Ġfun Ġget Cluster (): ĠResponse < Cluster Response > ĊĊĠĠĠ Ġ@ POST ("/ api / cluster ") ĊĠĠĠ Ġsuspend Ġfun Ġcreate Cluster (@ Query (" name ") Ġname : ĠString ): ĠCluster Response ĊĊĠĠĠ Ġ@ POST ("/ api / tokens ") ĊĠĠĠ Ġsuspend Ġfun Ġcreate Token (@ Body Ġcredentials : ĠUser Login Credentials ): ĠToken Response Ċ } Ċ Ċ fun Ġcreate R io Auth Client ( endpoint : ĠString ): ĠRio Auth Client Ġ{ ĊĠĠĠ Ġreturn ĠRet rofit Client Factory Impl (). create Json RestClient ( ĊĠĠĠĠĠĠĠ Ġendpoint , ĊĠĠĠĠĠĠĠ ĠRio Auth Client :: class . java , ĊĠĠĠĠĠĠĠ Ġ"", ĊĠĠĠĠĠĠĠ Ġ" R io - Dev - Integration ", ĊĠĠĠĠĠĠĠ Ġtrue , ĊĠĠĠĠĠĠĠ Ġj ack son ObjectMapper () ĊĠĠĠ Ġ) Ċ } Ċ Ċ fun Ġcreate R io Auth Client From Env (): ĠRio Auth Client Ġ{ ĊĠĠĠ Ġval Ġescape Pod Url Ġ= ĠSystem . getenv (" ESCAPE POD _ URL ") ĊĠĠĠ Ġreturn Ġcreate R io Auth Client ( escape Pod Url ) Ċ } Ċ