package Ġuk . co . os iris . server . controllers Ċ Ċ import Ġuk . co . os iris . server . security . C ord a User Ċ import Ġnet . cord a . core . contracts . Contract State Ċ import Ġnet . cord a . core . messaging . vault Query By Ċ import Ġorg . springframework . security . authentication . Username Password Authentication Token Ċ import Ġorg . springframework . stereotype . Controller Ċ import Ġorg . springframework . web . bind . annotation . GetMapping Ċ import Ġorg . springframework . web . bind . annotation . RequestMapping Ċ import Ġjava . time . LocalDateTime Ċ import Ġjava . time . Zone Id Ċ Ċ /** Ċ Ġ* ĠA ĠCor D app - agnostic Ġcontroller Ġthat Ġexposes Ġstandard Ġendpoints . Ċ Ġ*/ Ċ @ Controller Ċ @ RequestMapping ("/") Ġ// ĠThe Ġpaths Ġfor ĠGET Ġand ĠPOST Ġrequests Ġare Ġrelative Ġto Ġthis Ġbase Ġpath . Ċ class ĠStandard Controller Ġ{ ĊĊĊĠĠĠ Ġfun Ġproxy ( up at : ĠUsername Password Authentication Token ) Ġ= Ġ( up at . principal Ġas ĠC ord a User ). get Proxy () ĊĊĊĠĠĠ Ġ@ GetMapping ( value Ġ= Ġ["/ status "]) ĊĠĠĠ Ġfun Ġstatus ( m : ĠMutable Map < String , ĠAny >, Ġu : ĠUsername Password Authentication Token ): ĠString Ġ{ ĊĠĠĠĠĠĠĠ Ġm [" server time "] Ġ= ĠLocalDateTime . of Instant ( proxy ( u ). currentNode Time (), ĠZone Id . of (" UTC ")). toString () ĊĠĠĠĠĠĠĠ Ġm [" addresses "] Ġ= Ġproxy ( u ). node Info (). addresses . toString () ĊĠĠĠĠĠĠĠ Ġm [" ident ities "] Ġ= Ġproxy ( u ). node Info (). legal Id entities . toString () ĊĠĠĠĠĠĠĠ Ġm [" version "] Ġ= Ġproxy ( u ). node Info (). platform Version . toString () ĊĠĠĠĠĠĠĠ Ġval Ġx Ġ= Ġproxy ( u ). network Map Snapshot (). flatMap Ġ{ Ġit . legal Id entities Ġ}. toSet () ĊĠĠĠĠĠĠĠ Ġval Ġy Ġ= Ġx . map { Ġit . name . toString () Ġ} ĊĠĠĠĠĠĠĠ Ġm [" peers "] Ġ= Ġy ĊĠĠĠĠĠĠĠ Ġm [" not aries "] Ġ= Ġproxy ( u ). not ary Id entities (). toString () ĊĠĠĠĠĠĠĠ Ġm [" flows "] Ġ= Ġproxy ( u ). registered Flows () ĊĠĠĠĠĠĠĠ Ġm [" states "] Ġ= Ġproxy ( u ). vault Query By < Contract State >(). states . toString () ĊĠĠĠĠĠĠĠ Ġreturn Ġ" status " ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ GetMapping ( value Ġ= Ġ["/ server time "], Ġproduces Ġ= Ġ[" text / plain "]) ĊĠĠĠ Ġprivate Ġfun Ġserver Time ( u : ĠUsername Password Authentication Token ) Ġ= ĠLocalDateTime . of Instant ( proxy ( u ). currentNode Time (), ĠZone Id . of (" UTC ")). toString () ĊĊĠĠĠ Ġ@ GetMapping ( value Ġ= Ġ["/ addresses "], Ġproduces Ġ= Ġ[" text / plain "]) ĊĠĠĠ Ġprivate Ġfun Ġaddresses ( u : ĠUsername Password Authentication Token ) Ġ= Ġproxy ( u ). node Info (). addresses . toString () ĊĊĠĠĠ Ġ@ GetMapping ( value Ġ= Ġ["/ ident ities "], Ġproduces Ġ= Ġ[" text / plain "]) ĊĠĠĠ Ġprivate Ġfun Ġident ities ( u : ĠUsername Password Authentication Token ) Ġ= Ġproxy ( u ). node Info (). legal Id entities . toString () ĊĊĠĠĠ Ġ@ GetMapping ( value Ġ= Ġ["/ platform version "], Ġproduces Ġ= Ġ[" text / plain "]) ĊĠĠĠ Ġprivate Ġfun Ġplatform Version ( u : ĠUsername Password Authentication Token ) Ġ= Ġproxy ( u ). node Info (). platform Version . toString () ĊĊĠĠĠ Ġ@ GetMapping ( value Ġ= Ġ["/ peers "], Ġproduces Ġ= Ġ[" text / plain "]) ĊĠĠĠ Ġprivate Ġfun Ġpeers ( u : ĠUsername Password Authentication Token ) Ġ= Ġproxy ( u ). network Map Snapshot (). flatMap Ġ{ Ġit . legal Id entities Ġ}. toString () ĊĊĠĠĠ Ġ@ GetMapping ( value Ġ= Ġ["/ not aries "], Ġproduces Ġ= Ġ[" text / plain "]) ĊĠĠĠ Ġprivate Ġfun Ġnot aries ( u : ĠUsername Password Authentication Token ) Ġ= Ġproxy ( u ). not ary Id entities (). toString () ĊĊĠĠĠ Ġ@ GetMapping ( value Ġ= Ġ["/ flows "], Ġproduces Ġ= Ġ[" text / plain "]) ĊĠĠĠ Ġprivate Ġfun Ġflows ( u : ĠUsername Password Authentication Token ) Ġ= Ġproxy ( u ). registered Flows (). toString () ĊĊĠĠĠ Ġ@ GetMapping ( value Ġ= Ġ["/ states "], Ġproduces Ġ= Ġ[" text / plain "]) ĊĠĠĠ Ġprivate Ġfun Ġstates ( u : ĠUsername Password Authentication Token ) Ġ= Ġproxy ( u ). vault Query By < Contract State >(). states Ċ Ċ }