/* Ċ Ġ* ĠLicensed Ġunder Ġthe ĠApache ĠLicense , ĠVersion Ġ 2 . 0 Ġ( the Ġ" License "); Ċ Ġ* Ġyou Ġmay Ġnot Ġuse Ġthis Ġfile Ġexcept Ġin Ġcompliance Ġwith Ġthe ĠLicense . Ċ Ġ* ĠYou Ġmay Ġobtain Ġa Ġcopy Ġof Ġthe ĠLicense Ġat Ċ Ġ* Ċ Ġ* ĠĠĠĠ Ġhttp :// www . apache . org / licenses / LICENSE - 2 . 0 Ċ Ġ* Ċ Ġ* ĠUnless Ġrequired Ġby Ġapplicable Ġlaw Ġor Ġagreed Ġto Ġin Ġwriting , Ġsoftware Ċ Ġ* Ġdistributed Ġunder Ġthe ĠLicense Ġis Ġdistributed Ġon Ġan Ġ" AS ĠIS " ĠBASIS , Ċ Ġ* ĠWITHOUT ĠWARRANTIES ĠOR ĠCONDITIONS ĠOF ĠANY ĠKIND , Ġeither Ġexpress Ġor Ġimplied . Ċ Ġ* ĠSee Ġthe ĠLicense Ġfor Ġthe Ġspecific Ġlanguage Ġgoverning Ġpermissions Ġand Ċ Ġ* Ġlimitations Ġunder Ġthe ĠLicense . Ċ Ġ*/ Ċ package Ġtech . cuda . w od en . webserver . controller Ċ Ċ import Ġorg . springframework . boot . autoconfigure . Enable Auto Configuration Ċ import Ġorg . springframework . web . bind . annotation .* Ċ import Ġtech . cuda . w od en . common . i 1 8 n . I 1 8 N Ċ import Ġtech . cuda . w od en . common . service . Container Service Ċ import Ġtech . cuda . w od en . webserver . Response Ċ import Ġtech . cuda . w od en . webserver . ResponseData Ċ Ċ /** Ċ Ġ* Ġ@ author ĠJ ens en ĠQ i Ġ< j inx iu . qi @ alu . hit . edu . cn > Ċ Ġ* Ġ@ since Ġ 0 . 1 . 0 Ċ Ġ*/ Ċ @ RestController Ċ @ Enable Auto Configuration Ċ @ RequestMapping ("/ api / container ") Ċ class ĠContainer Controller Ġ{ ĊĊĠĠĠ Ġ/** ĊĠĠĠĠ Ġ* Ġ@ api Ġ{ get } Ġ/ api / container Ġèİ·åıĸ å®¹åĻ¨ åĪĹè¡¨ ĊĠĠĠĠ Ġ* Ġ@ api Description Ġèİ·åıĸ å®¹åĻ¨ åĪĹè¡¨ ï¼Į æĶ¯æĮģ åĪĨé¡µ æŁ¥è¯¢ åĴĮ æ¨¡ ç³ Ĭ æŁ¥è¯¢ ĊĠĠĠĠ Ġ* Ġ@ api Group ĠContainer ĊĠĠĠĠ Ġ* Ġ@ apiVersion Ġ 0 . 1 . 0 ĊĠĠĠĠ Ġ* Ġ@ api Header Ġ{ String } Ġtoken ĠçĶ¨æĪ· æİĪæĿĥ Ġtoken ĊĠĠĠĠ Ġ* Ġ@ api Param Ġ{ Number } Ġ[ page Ġ= Ġ 1 ] ĠåĪĨ é¡µ ID ĊĠĠĠĠ Ġ* Ġ@ api Param Ġ{ Number } Ġ[ pageSize Ġ= Ġ 9 9 9 9 ] ĠåĪĨ é¡µ å¤§å°ı ĊĠĠĠĠ Ġ* Ġ@ api Param Ġ{ String } Ġlike Ġ å®¹åĻ¨ Ġhostname Ġæ¨¡ ç³ Ĭ åĮ¹éħį ï¼Į å¤ļä¸ª è¯į çĶ¨ ç©º æł¼ åĪĨ éļĶ ï¼Į null Ġ åŃĹç¬¦ä¸² ä¼ļ è¢« å¿½ ĊĠĠĠĠ Ġ* Ġ@ api Success Example Ġè¯·æ±Ĥ æĪĲåĬŁ ĊĠĠĠĠ Ġ* Ġ{" status ":" success "," data ":{" containers ":[{" id ": 1 ," hostname ":" new Ġhost Ġname "" cpu Load ": 3 4 ," mem Load ": 3 1 ," disk Usage ": 6 3 ," create Time ":" 2 0 2 9 - 0 6 - 0 6 Ġ 1 9 : 5 7 : 0 8 "," update Time ":" 2 0 2 0 - 0 5 - 2 3 Ġ 0 1 : 4 0 : 2 5 "},{" id ": 3 ," hostname ":" nk nv le if "," cpu Load ": 9 8 ," mem Load ": 4 8 ," disk Usage ": 3 1 ," create Time ":" 2 0 3 5 - 1 1 - 0 5 Ġ 1 4 : 1 7 : 4 3 "," update Time ":" 2 0 2 0 - 0 5 - 2 3 Ġ 0 1 : 4 0 : 2 5 "},{" id ": 5 ," hostname ":" anything "," cpu Load ": 1 ," mem Load ": 6 0 ," disk Usage ": 5 9 ," create Time ":" 2 0 0 4 - 1 1 - 2 8 Ġ 2 1 : 5 0 : 0 6 "," update Time ":" 2 0 2 0 - 0 5 - 2 3 Ġ 0 1 : 4 0 : 2 5 "}], " count ": 1 8 8 }} ĊĠĠĠĠ Ġ* Ġ@ api Success Example Ġè¯·æ±Ĥ å¤±è´¥ ĊĠĠĠĠ Ġ* Ġ{" status ":" failed "," error ":" éĶĻè¯¯ ä¿¡æģ¯ "} ĊĠĠĠĠ Ġ*/ ĊĠĠĠ Ġ@ GetMapping ĊĠĠĠ Ġfun Ġlisting (@ RequestParam ( required Ġ= Ġfalse , ĠdefaultValue Ġ= Ġ" 1 ") Ġpage : ĠInt , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ@ RequestParam ( required Ġ= Ġfalse , ĠdefaultValue Ġ= Ġ" 9 9 9 9 ") ĠpageSize : ĠInt , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ@ RequestParam ( required Ġ= Ġfalse ) Ġlike : ĠString ?): ĠResponse Data Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġ( containers , Ġcount ) Ġ= ĠContainer Service . listing ( page , ĠpageSize , Ġlike ) ĊĠĠĠĠĠĠĠ Ġreturn ĠResponse . Success . data (" containers " Ġto Ġcontainers , Ġ" count " Ġto Ġcount ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ/** ĊĠĠĠĠ Ġ* Ġ@ api Ġ{ get } Ġ/ api / container /{ id } ĠæŁ¥è¯¢ å®¹åĻ¨ ĊĠĠĠĠ Ġ* Ġ@ api Description ĠæŁ¥è¯¢ æĮĩå®ļ ĠID ĠçļĦ å®¹åĻ¨ è¯¦æĥħ ĊĠĠĠĠ Ġ* Ġ@ api Group ĠContainer ĊĠĠĠĠ Ġ* Ġ@ apiVersion Ġ 0 . 1 . 0 ĊĠĠĠĠ Ġ* Ġ@ api Header Ġ{ String } Ġtoken ĠçĶ¨æĪ· æİĪæĿĥ Ġtoken ĊĠĠĠĠ Ġ* Ġ@ api Success Example Ġè¯·æ±Ĥ æĪĲåĬŁ ĊĠĠĠĠ Ġ* Ġ{" status ":" success "," data ":{" container ":{" id ": 1 ," hostname ":" new Ġhost Ġname "," cpu Load ": 3 4 ," mem Load ": 3 1 ," disk Usage ": 6 3 ," create Time ":" 2 0 2 9 - 0 6 - 0 6 Ġ 1 9 : 5 7 : 0 8 "," update Time ":" 2 0 2 0 - 0 5 - 2 3 Ġ 0 1 : 4 0 : 2 5 "}} } ĊĠĠĠĠ Ġ* Ġ@ api Success Example Ġè¯·æ±Ĥ å¤±è´¥ ĊĠĠĠĠ Ġ* Ġ{" status ":" failed "," error ":" è°ĥ åº¦ å®¹åĻ¨ Ġ 2 Ġä¸į åŃĺåľ¨ æĪĸ å·² è¢« åĪłéĻ¤ "} ĊĠĠĠĠ Ġ*/ ĊĠĠĠ Ġ@ GetMapping ("{ id }") ĊĠĠĠ Ġfun Ġfind (@ PathVariable Ġid : ĠInt ): ĠResponse Data Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġcontainer Ġ= ĠContainer Service . findById ( id ) ĊĠĠĠĠĠĠĠ Ġreturn Ġif Ġ( container Ġ== Ġnull ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ ĠResponse . Failed . WithError ("${ I 1 8 N . container } Ġ$ id Ġ${ I 1 8 N . not Exists Or HasBeen Remove }") ĊĠĠĠĠĠĠĠ Ġ} Ġelse Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ ĠResponse . Success . data (" container " Ġto ĠContainer Service . findById ( id )) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} Ċ Ċ }