package Ġno . sk at te et aten . aur ora . b oo ber . controller . v 1 Ċ Ċ import Ġcom . fasterxml . jackson . module . kotlin . jackson ObjectMapper Ċ import Ġcom . fasterxml . jackson . module . kotlin . readValue Ċ import Ġno . sk at te et aten . aur ora . b oo ber . controller . internal . Response Ċ import Ġno . sk at te et aten . aur ora . b oo ber . facade . A ur ora Config Facade Ċ import Ġno . sk at te et aten . aur ora . b oo ber . model . Application Deployment Ref Ċ import Ġno . sk at te et aten . aur ora . b oo ber . model . A ur ora ConfigFile Ċ import Ġno . sk at te et aten . aur ora . b oo ber . model . to Ad r Ċ import Ġno . sk at te et aten . aur ora . b oo ber . service . A ur ora Config Ref Ċ import Ġno . sk at te et aten . aur ora . b oo ber . service . render Json For A ur ora Deployment Spec Pointers Ċ import Ġno . sk at te et aten . aur ora . b oo ber . service . render Spec As Json Ċ import Ġno . sk at te et aten . aur ora . b oo ber . utils . add If NotNull Ċ import Ġorg . springframework . web . bind . annotation . GetMapping Ċ import Ġorg . springframework . web . bind . annotation . PathVariable Ċ import Ġorg . springframework . web . bind . annotation . RequestMapping Ċ import Ġorg . springframework . web . bind . annotation . RequestParam Ċ import Ġorg . springframework . web . bind . annotation . RestController Ċ import Ġorg . springframework . web . util . Uri Utils Ċ import Ġjava . nio . charset . Charset Ċ Ċ @ RestController Ċ @ RequestMapping ("/ v 1 / aur or ade ploys pec /{ aur ora Config Name }") Ċ class ĠA ur ora Deployment Spec Controller V 1 ( ĊĠĠĠ Ġval Ġfac ade : ĠA ur ora Config Facade Ċ ) Ġ{ ĊĊĠĠĠ Ġ@ GetMapping ĊĠĠĠ Ġfun ĠfindAll Deployment Specs ( ĊĠĠĠĠĠĠĠ Ġ@ PathVariable Ġa ur ora Config Name : ĠString , ĊĠĠĠĠĠĠĠ Ġ@ RequestParam Ġaid : ĠList < String > ?, ĊĠĠĠĠĠĠĠ Ġ@ RequestParam Ġad r : ĠList < String > ?, ĊĠĠĠĠĠĠĠ Ġ@ RequestParam ( name Ġ= Ġ" include Defaults ", Ġrequired Ġ= Ġfalse , ĠdefaultValue Ġ= Ġ" true ") Ġinclude Defaults : ĠBoolean ĊĠĠĠ Ġ): ĠResponse Ġ{ ĊĊĠĠĠĠĠĠĠ Ġval Ġad r List Ġ= ĠlistOf < String >(). add If NotNull ( aid ). add If NotNull ( adr ). map Ġ{ Ġit . to Ad r () Ġ} ĊĠĠĠĠĠĠĠ Ġval Ġref Ġ= ĠA ur ora Config Ref ( aur ora Config Name , Ġget Ref Name From Request ()) ĊĠĠĠĠĠĠĠ Ġval Ġcontexts Ġ= Ġfac ade . find A ur ora Deployment Spec ( ref , Ġad r List ) ĊĊĠĠĠĠĠĠĠ Ġreturn ĠResponse ( items Ġ= Ġcontexts . map Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġrender Spec As Json ( it , Ġinclude Defaults ) ĊĠĠĠĠĠĠĠ Ġ}) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ GetMapping ("/ { environment }/ ") ĊĠĠĠ Ġfun ĠfindAll Deployment Specs For Environment ( ĊĠĠĠĠĠĠĠ Ġ@ PathVariable Ġa ur ora Config Name : ĠString , ĊĠĠĠĠĠĠĠ Ġ@ PathVariable Ġenvironment : ĠString , ĊĠĠĠĠĠĠĠ Ġ@ RequestParam ( name Ġ= Ġ" include Defaults ", Ġrequired Ġ= Ġfalse , ĠdefaultValue Ġ= Ġ" true ") Ġinclude Defaults : ĠBoolean ĊĠĠĠ Ġ): ĠResponse Ġ{ ĊĊĠĠĠĠĠĠĠ Ġval Ġref Ġ= ĠA ur ora Config Ref ( aur ora Config Name , Ġget Ref Name From Request ()) ĊĠĠĠĠĠĠĠ Ġval Ġspecs Ġ= Ġfac ade . find A ur ora Deployment Spec For Environment ( ref , Ġenvironment ) ĊĠĠĠĠĠĠĠ Ġreturn ĠResponse ( items Ġ= Ġspecs . map Ġ{ Ġrender Spec As Json ( it , Ġinclude Defaults ) Ġ}) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ// ĠTODO : ĠN Ã¥r Ġvi Ġskal Ġbru ke Ġgo bo ĠmÃ¥ Ġvi Ġreturn ere Ġwarnings Ġher . ĊĠĠĠ Ġ@ GetMapping ("/ { environment }/{ application }") ĊĠĠĠ Ġfun Ġget ( ĊĠĠĠĠĠĠĠ Ġ@ PathVariable Ġa ur ora Config Name : ĠString , ĊĠĠĠĠĠĠĠ Ġ@ PathVariable Ġenvironment : ĠString , ĊĠĠĠĠĠĠĠ Ġ@ PathVariable Ġapplication : ĠString , ĊĠĠĠĠĠĠĠ Ġ@ RequestParam ( name Ġ= Ġ" overrides ", Ġrequired Ġ= Ġfalse ) Ġoverrides : ĠString ?, ĊĠĠĠĠĠĠĠ Ġ@ RequestParam ( name Ġ= Ġ" include Defaults ", Ġrequired Ġ= Ġfalse , ĠdefaultValue Ġ= Ġ" true ") Ġinclude Defaults : ĠBoolean , ĊĠĠĠĠĠĠĠ Ġ@ RequestParam ( name Ġ= Ġ" errors As Warnings ", Ġrequired Ġ= Ġfalse , ĠdefaultValue Ġ= Ġ" false ") Ġerrors As Warnings : ĠBoolean ĊĠĠĠ Ġ): ĠResponse Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġoverride Files : ĠList < A ur ora ConfigFile > Ġ= Ġextract Overrides ( overrides ) ĊĠĠĠĠĠĠĠ Ġval Ġref Ġ= ĠA ur ora Config Ref ( aur ora Config Name , Ġget Ref Name From Request ()) ĊĠĠĠĠĠĠĠ Ġval Ġad r Ġ= ĠApplication Deployment Ref ( environment , Ġapplication ) ĊĠĠĠĠĠĠĠ Ġval Ġspec Ġ= Ġfac ade . find A ur ora Deployment Spec Single ( ref , Ġad r , Ġoverride Files , Ġerrors As Warnings ) ĊĠĠĠĠĠĠĠ Ġreturn ĠResponse ( items Ġ= ĠlistOf ( spec ). map Ġ{ Ġrender Spec As Json ( it , Ġinclude Defaults ) Ġ}) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ GetMapping ("/ { environment }/{ application }/ formatted ") ĊĠĠĠ Ġfun Ġget Json For Map Of Pointers ( ĊĠĠĠĠĠĠĠ Ġ@ PathVariable Ġa ur ora Config Name : ĠString , ĊĠĠĠĠĠĠĠ Ġ@ PathVariable Ġenvironment : ĠString , ĊĠĠĠĠĠĠĠ Ġ@ PathVariable Ġapplication : ĠString , ĊĠĠĠĠĠĠĠ Ġ@ RequestParam ( name Ġ= Ġ" overrides ", Ġrequired Ġ= Ġfalse ) Ġoverrides : ĠString ?, ĊĠĠĠĠĠĠĠ Ġ@ RequestParam ( name Ġ= Ġ" include Defaults ", Ġrequired Ġ= Ġfalse , ĠdefaultValue Ġ= Ġ" true ") Ġinclude Defaults : ĠBoolean , ĊĠĠĠĠĠĠĠ Ġ@ RequestParam ( name Ġ= Ġ" errors As Warnings ", Ġrequired Ġ= Ġfalse , ĠdefaultValue Ġ= Ġ" false ") Ġerrors As Warnings : ĠBoolean ĊĠĠĠ Ġ): ĠResponse Ġ{ ĊĊĠĠĠĠĠĠĠ Ġval Ġref Ġ= ĠA ur ora Config Ref ( aur ora Config Name , Ġget Ref Name From Request ()) ĊĠĠĠĠĠĠĠ Ġval Ġad r Ġ= ĠApplication Deployment Ref ( environment , Ġapplication ) ĊĠĠĠĠĠĠĠ Ġval Ġoverride Files Ġ= Ġextract Overrides ( overrides ) ĊĠĠĠĠĠĠĠ Ġval Ġspec Ġ= Ġfac ade . find A ur ora Deployment Spec Single ( ref , Ġad r , Ġoverride Files , Ġerrors As Warnings ) ĊĠĠĠĠĠĠĠ Ġreturn ĠResponse ( items Ġ= ĠlistOf ( render Json For A ur ora Deployment Spec Pointers ( spec , Ġinclude Defaults ))) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġextract Overrides ( overrides : ĠString ?): ĠList < A ur ora ConfigFile > Ġ{ ĊĠĠĠĠĠĠĠ Ġif Ġ( overrides . isNull Or Blank ()) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġreturn Ġempty List () ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġval Ġfiles : ĠMap < String , ĠString > Ġ= Ġj ack son ObjectMapper () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. readValue ( Uri Utils . decode ( overrides , ĠCharset . default Charset (). toString ())) ĊĊĠĠĠĠĠĠĠ Ġreturn Ġfiles . map Ġ{ ĠA ur ora ConfigFile ( it . key , Ġit . value , Ġtrue ) Ġ} ĊĠĠĠ Ġ} Ċ } Ċ