package Ġcom . netflix . spin n aker . ke el . rest Ċ Ċ import Ġcom . netflix . spin n aker . ke el . events . Resource History Event Ċ import Ġcom . netflix . spin n aker . ke el . persistence . Resource Repository Ċ import Ġcom . netflix . spin n aker . ke el . persistence . Resource Repository . Companion . DEFAULT _ MAX _ EVENTS Ċ import Ġcom . netflix . spin n aker . ke el . yaml . APPLICATION _ YAML _ VALUE Ċ import Ġorg . slf 4 j . LoggerFactory . getLogger Ċ import Ġorg . springframework . http . MediaType . APPLICATION _ JSON _ VALUE Ċ import Ġorg . springframework . security . access . pre post . Pre Authorize Ċ 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 Ċ Ċ @ RestController Ċ @ RequestMapping ( path Ġ= Ġ["/ resources / events "]) Ċ class ĠEvent Controller ( ĊĠ Ġprivate Ġval Ġresource Repository : ĠResource Repository Ċ ) Ġ{ ĊĠ Ġprivate Ġval Ġlog Ġby Ġlazy Ġ{ Ġget Logger ( java Class ) Ġ} ĊĊĠ Ġ// ĠTODO : Ġmove Ġthis Ġto ĠResource Controller Ġsince Ġthe Ġrequest Ġpath Ġbelongs Ġthere ĊĠ Ġ@ GetMapping ( ĊĠĠĠ Ġpath Ġ= Ġ[" /{ id } "], ĊĠĠĠ Ġproduces Ġ= Ġ[ APPLICATION _ JSON _ VALUE , ĠAP PLICATION _ YAML _ VALUE ] ĊĠ Ġ) ĊĠ Ġ@ Pre Authorize ( ĊĠĠĠ Ġ""" @ authorization Support . has Application Permission (' READ ', Ġ' RESOURCE ', Ġ# id ) ĊĠĠĠ Ġand Ġ@ authorization Support . has Cloud Account Permission (' READ ', Ġ' RESOURCE ', Ġ# id ) """ ĊĠ Ġ) ĊĠ Ġfun Ġevent History ( ĊĠĠĠ Ġ@ PathVariable (" id ") Ġid : ĠString , ĊĠĠĠ Ġ@ RequestParam (" limit ") Ġlimit : ĠInt ? ĊĠ Ġ): ĠList < Resource History Event > Ġ{ ĊĠĠĠ Ġlog . debug (" Getting Ġstate Ġhistory Ġfor : Ġ$ id ") ĊĠĠĠ Ġreturn Ġresource Repository . event History ( id , Ġlimit Ġ?: ĠDEFAULT _ MAX _ EVENTS ) ĊĠ Ġ} Ċ } Ċ