kubemodel_codecs.go 261 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591
  1. ////////////////////////////////////////////////////////////////////////////////
  2. //
  3. // DO NOT MODIFY
  4. //
  5. // ┻━┻ ︵ヽ(`Д´)ノ︵ ┻━┻
  6. //
  7. //
  8. // This source file was automatically generated by bingen.
  9. //
  10. ////////////////////////////////////////////////////////////////////////////////
  11. package kubemodel
  12. import (
  13. "fmt"
  14. "io"
  15. "iter"
  16. "os"
  17. "reflect"
  18. "strings"
  19. "sync"
  20. "time"
  21. "github.com/opencost/opencost/core/pkg/model/shared"
  22. bstream "github.com/opencost/bingen/pkg/stream"
  23. stringtable "github.com/opencost/bingen/pkg/table"
  24. util "github.com/opencost/bingen/pkg/util"
  25. )
  26. const (
  27. // GeneratorPackageName is the package the generator is targetting
  28. GeneratorPackageName string = "kubemodel"
  29. // DefaultCodecVersion is used for any resources listed in the Default version set
  30. DefaultCodecVersion uint8 = 2
  31. )
  32. //--------------------------------------------------------------------------
  33. // Configuration
  34. //--------------------------------------------------------------------------
  35. var (
  36. bingenConfigLock sync.RWMutex
  37. bingenConfig *BingenConfiguration = DefaultBingenConfiguration()
  38. )
  39. // BingenConfiguration is used to set any custom configuration in the way files are encoded
  40. // or decoded.
  41. type BingenConfiguration struct {
  42. // FileBackedStringTableEnabled enables the use of file-backed string tables for streaming
  43. // bingen decoding.
  44. FileBackedStringTableEnabled bool
  45. // FileBackedStringTableDir is the directory to write the string table files for reading.
  46. FileBackedStringTableDir string
  47. // FileBackedStringTableMemoMaxBytes limits in-memory memoization for file-backed table lookups.
  48. // 0 disables memoization.
  49. FileBackedStringTableMemoMaxBytes int64
  50. }
  51. // DefaultBingenConfiguration creates the default implementation of the bingen configuration
  52. // and returns it.
  53. func DefaultBingenConfiguration() *BingenConfiguration {
  54. return &BingenConfiguration{
  55. FileBackedStringTableEnabled: false,
  56. FileBackedStringTableDir: os.TempDir(),
  57. FileBackedStringTableMemoMaxBytes: 0,
  58. }
  59. }
  60. // ConfigureBingen accepts a new *BingenConfiguration instance which updates the internal decoder
  61. // and encoder behavior.
  62. func ConfigureBingen(config *BingenConfiguration) {
  63. bingenConfigLock.Lock()
  64. defer bingenConfigLock.Unlock()
  65. if config == nil {
  66. config = DefaultBingenConfiguration()
  67. }
  68. bingenConfig = config
  69. }
  70. // IsBingenFileBackedStringTableEnabled accessor for file backed string table configuration
  71. func IsBingenFileBackedStringTableEnabled() bool {
  72. bingenConfigLock.RLock()
  73. defer bingenConfigLock.RUnlock()
  74. return bingenConfig.FileBackedStringTableEnabled
  75. }
  76. // BingenFileBackedStringTableDir returns the directory configured for file backed string tables.
  77. func BingenFileBackedStringTableDir() string {
  78. bingenConfigLock.RLock()
  79. defer bingenConfigLock.RUnlock()
  80. return bingenConfig.FileBackedStringTableDir
  81. }
  82. // BingenFileBackedStringTableMemoMaxBytes returns the maximum bytes used for file-backed memo cache.
  83. func BingenFileBackedStringTableMemoMaxBytes() int64 {
  84. bingenConfigLock.RLock()
  85. defer bingenConfigLock.RUnlock()
  86. return bingenConfig.FileBackedStringTableMemoMaxBytes
  87. }
  88. //--------------------------------------------------------------------------
  89. // Type Map
  90. //--------------------------------------------------------------------------
  91. // Generated type map for resolving interface implementations to to concrete types
  92. var typeMap map[string]reflect.Type = map[string]reflect.Type{
  93. "Cluster": reflect.TypeFor[Cluster](),
  94. "Container": reflect.TypeFor[Container](),
  95. "CronJob": reflect.TypeFor[CronJob](),
  96. "DCGMContainer": reflect.TypeFor[DCGMContainer](),
  97. "DCGMDevice": reflect.TypeFor[DCGMDevice](),
  98. "DCGMPod": reflect.TypeFor[DCGMPod](),
  99. "DaemonSet": reflect.TypeFor[DaemonSet](),
  100. "Deployment": reflect.TypeFor[Deployment](),
  101. "Diagnostic": reflect.TypeFor[Diagnostic](),
  102. "FileSystem": reflect.TypeFor[FileSystem](),
  103. "Job": reflect.TypeFor[Job](),
  104. "KubeModelSet": reflect.TypeFor[KubeModelSet](),
  105. "Metadata": reflect.TypeFor[Metadata](),
  106. "Namespace": reflect.TypeFor[Namespace](),
  107. "NetworkTrafficDetail": reflect.TypeFor[NetworkTrafficDetail](),
  108. "Node": reflect.TypeFor[Node](),
  109. "Owner": reflect.TypeFor[Owner](),
  110. "PersistentVolume": reflect.TypeFor[PersistentVolume](),
  111. "PersistentVolumeClaim": reflect.TypeFor[PersistentVolumeClaim](),
  112. "Pod": reflect.TypeFor[Pod](),
  113. "PodPVCVolume": reflect.TypeFor[PodPVCVolume](),
  114. "ReplicaSet": reflect.TypeFor[ReplicaSet](),
  115. "ResourceQuantity": reflect.TypeFor[ResourceQuantity](),
  116. "ResourceQuota": reflect.TypeFor[ResourceQuota](),
  117. "ResourceQuotaSpec": reflect.TypeFor[ResourceQuotaSpec](),
  118. "ResourceQuotaSpecHard": reflect.TypeFor[ResourceQuotaSpecHard](),
  119. "ResourceQuotaStatus": reflect.TypeFor[ResourceQuotaStatus](),
  120. "ResourceQuotaStatusUsed": reflect.TypeFor[ResourceQuotaStatusUsed](),
  121. "Service": reflect.TypeFor[Service](),
  122. "StatefulSet": reflect.TypeFor[StatefulSet](),
  123. "Window": reflect.TypeFor[Window](),
  124. }
  125. //--------------------------------------------------------------------------
  126. // Type Helpers
  127. //--------------------------------------------------------------------------
  128. // isBinaryTag returns true when the first bytes in the provided binary matches the tag
  129. func isBinaryTag(data []byte, tag string) bool {
  130. if len(data) < len(tag) {
  131. return false
  132. }
  133. return string(data[:len(tag)]) == tag
  134. }
  135. // isReaderBinaryTag is used to peek the header for an io.Reader Buffer
  136. func isReaderBinaryTag(buff *util.Buffer, tag string) bool {
  137. data, err := buff.Peek(len(tag))
  138. if err != nil && err != io.EOF {
  139. panic(fmt.Sprintf("called Peek() on a non buffered reader: %s", err))
  140. }
  141. if len(data) < len(tag) {
  142. return false
  143. }
  144. return string(data[:len(tag)]) == tag
  145. }
  146. // typeToString determines the basic properties of the type, the qualifier, package path, and
  147. // type name, and returns the qualified type
  148. func typeToString(f interface{}) string {
  149. qual := ""
  150. t := reflect.TypeOf(f)
  151. if t.Kind() == reflect.Ptr {
  152. t = t.Elem()
  153. qual = "*"
  154. }
  155. return fmt.Sprintf("%s%s.%s", qual, t.PkgPath(), t.Name())
  156. }
  157. // resolveType uses the name of a type and returns the package, base type name, and whether
  158. // or not it's a pointer.
  159. func resolveType(t string) (pkg string, name string, isPtr bool) {
  160. isPtr = t[:1] == "*"
  161. if isPtr {
  162. t = t[1:]
  163. }
  164. slashIndex := strings.LastIndex(t, "/")
  165. if slashIndex >= 0 {
  166. t = t[slashIndex+1:]
  167. }
  168. parts := strings.Split(t, ".")
  169. if parts[0] == GeneratorPackageName {
  170. parts[0] = ""
  171. }
  172. pkg = parts[0]
  173. name = parts[1]
  174. return
  175. }
  176. //--------------------------------------------------------------------------
  177. // Stream Helpers
  178. //--------------------------------------------------------------------------
  179. // StreamFactoryFunc is an alias for a func that creates a BingenStream implementation.
  180. type StreamFactoryFunc func(io.Reader) bstream.BingenStream
  181. // Generated streamable factory map for finding the specific new stream methods
  182. // by T type
  183. var streamFactoryMap map[reflect.Type]StreamFactoryFunc = map[reflect.Type]StreamFactoryFunc{
  184. reflect.TypeFor[KubeModelSet](): NewKubeModelSetStream,
  185. }
  186. // NewStreamFor accepts an io.Reader, and returns a new BingenStream for the generic T
  187. // type provided _if_ it is a registered bingen type that is annotated as 'streamable'. See
  188. // the streamFactoryMap for generated type listings.
  189. func NewStreamFor[T any](reader io.Reader) (bstream.BingenStream, error) {
  190. typeKey := reflect.TypeFor[T]()
  191. factory, ok := streamFactoryMap[typeKey]
  192. if !ok {
  193. return nil, fmt.Errorf("the type: %s is not a registered bingen streamable type", typeKey.Name())
  194. }
  195. return factory(reader), nil
  196. }
  197. //--------------------------------------------------------------------------
  198. // Codec Context
  199. //--------------------------------------------------------------------------
  200. // EncodingContext is a context object passed to the encoders to ensure reuse of buffer
  201. // and table data
  202. type EncodingContext struct {
  203. Buffer *util.Buffer
  204. Table stringtable.StringTableWriter
  205. }
  206. // NewEncodingContext creates a new EncodingContext instance that will create a new []byte buffer
  207. // for writing, and return the context
  208. func NewEncodingContext(tableWriter stringtable.StringTableWriter) *EncodingContext {
  209. return &EncodingContext{
  210. Buffer: util.NewBuffer(),
  211. Table: tableWriter,
  212. }
  213. }
  214. // NewEncodingContextFromWriter creates a new EncodingContext instance that will create a new Buffer
  215. // from the provided io.Writer and StringTableWriter.
  216. func NewEncodingContextFromWriter(writer io.Writer, tableWriter stringtable.StringTableWriter) *EncodingContext {
  217. return &EncodingContext{
  218. Buffer: util.NewBufferFromWriter(writer),
  219. Table: tableWriter,
  220. }
  221. }
  222. // NewEncodingContextFromBuffer creates a new EncodingContext instance that will leverage an existing
  223. // Buffer and StringTableWriter.
  224. func NewEncodingContextFromBuffer(buffer *util.Buffer, tableWriter stringtable.StringTableWriter) *EncodingContext {
  225. return &EncodingContext{
  226. Buffer: buffer,
  227. Table: tableWriter,
  228. }
  229. }
  230. // ToBytes returns the encoded string table bytes (if applicable) combined with the encoded buffer bytes. If
  231. // a string table is being used, the string table bytes will be written first to ensure correct ordering for
  232. // decoding.
  233. func (ec *EncodingContext) ToBytes() []byte {
  234. encBytes := ec.Buffer.Bytes()
  235. if ec.Table != nil {
  236. buff := util.NewBuffer()
  237. ec.Table.WriteTo(buff)
  238. buff.WriteBytes(encBytes)
  239. return buff.Bytes()
  240. }
  241. return encBytes
  242. }
  243. // IsStringTable returns true if the table is available
  244. func (ec *EncodingContext) IsStringTable() bool {
  245. return ec.Table != nil
  246. }
  247. // DecodingContext is a context object passed to the decoders to ensure parent objects
  248. // reuse as much data as possible
  249. type DecodingContext struct {
  250. Buffer *util.Buffer
  251. Table stringtable.StringTableReader
  252. }
  253. // NewDecodingContextFromBytes creates a new DecodingContext instance using an byte slice
  254. func NewDecodingContextFromBytes(data []byte) *DecodingContext {
  255. var table stringtable.StringTableReader
  256. buff := util.NewBufferFromBytes(data)
  257. // string table header validation
  258. if isBinaryTag(data, stringtable.BinaryTagStringTable) {
  259. buff.ReadBytes(len(stringtable.BinaryTagStringTable)) // strip tag length
  260. // always use a slice string table with a byte array since the
  261. // data is already in memory
  262. table = stringtable.NewSliceStringTableReaderFrom(buff)
  263. }
  264. return &DecodingContext{
  265. Buffer: buff,
  266. Table: table,
  267. }
  268. }
  269. // NewDecodingContextFromReader creates a new DecodingContext instance using an io.Reader
  270. // implementation
  271. func NewDecodingContextFromReader(reader io.Reader) *DecodingContext {
  272. var table stringtable.StringTableReader
  273. buff := util.NewBufferFromReader(reader)
  274. if isReaderBinaryTag(buff, stringtable.BinaryTagStringTable) {
  275. buff.ReadBytes(len(stringtable.BinaryTagStringTable)) // strip tag length
  276. // create correct string table implementation
  277. if IsBingenFileBackedStringTableEnabled() {
  278. table = stringtable.NewFileStringTableReaderFrom(buff, BingenFileBackedStringTableDir(), GeneratorPackageName, BingenFileBackedStringTableMemoMaxBytes())
  279. } else {
  280. table = stringtable.NewSliceStringTableReaderFrom(buff)
  281. }
  282. }
  283. return &DecodingContext{
  284. Buffer: buff,
  285. Table: table,
  286. }
  287. }
  288. // IsStringTable returns true if the table is available
  289. func (dc *DecodingContext) IsStringTable() bool {
  290. return dc.Table != nil && dc.Table.Len() > 0
  291. }
  292. // Close will ensure that any string table resources and buffer resources are
  293. // cleaned up.
  294. func (dc *DecodingContext) Close() {
  295. if dc.Table != nil {
  296. _ = dc.Table.Close()
  297. dc.Table = nil
  298. }
  299. }
  300. //--------------------------------------------------------------------------
  301. // Binary Codec
  302. //--------------------------------------------------------------------------
  303. // BinEncoder is an encoding interface which defines a context based marshal contract.
  304. type BinEncoder interface {
  305. MarshalBinaryWithContext(*EncodingContext) error
  306. }
  307. // BinDecoder is a decoding interface which defines a context based unmarshal contract.
  308. type BinDecoder interface {
  309. UnmarshalBinaryWithContext(*DecodingContext) error
  310. }
  311. //--------------------------------------------------------------------------
  312. // Cluster
  313. //--------------------------------------------------------------------------
  314. // MarshalBinary serializes the internal properties of this Cluster instance
  315. // into a byte array
  316. func (target *Cluster) MarshalBinary() (data []byte, err error) {
  317. ctx := NewEncodingContext(nil)
  318. e := target.MarshalBinaryWithContext(ctx)
  319. if e != nil {
  320. return nil, e
  321. }
  322. return ctx.ToBytes(), nil
  323. }
  324. // MarshalBinary serializes the internal properties of this Cluster instance
  325. // into an io.Writer.
  326. func (target *Cluster) MarshalBinaryTo(writer io.Writer) error {
  327. buff := util.NewBufferFromWriter(writer)
  328. defer buff.Flush()
  329. ctx := NewEncodingContextFromBuffer(buff, nil)
  330. return target.MarshalBinaryWithContext(ctx)
  331. }
  332. // MarshalBinaryWithContext serializes the internal properties of this Cluster instance
  333. // into a byte array leveraging a predefined context.
  334. func (target *Cluster) MarshalBinaryWithContext(ctx *EncodingContext) (err error) {
  335. // panics are recovered and propagated as errors
  336. defer func() {
  337. if r := recover(); r != nil {
  338. if e, ok := r.(error); ok {
  339. err = e
  340. } else if s, ok := r.(string); ok {
  341. err = fmt.Errorf("unexpected panic: %s", s)
  342. } else {
  343. err = fmt.Errorf("unexpected panic: %+v", r)
  344. }
  345. }
  346. }()
  347. buff := ctx.Buffer
  348. buff.WriteUInt8(DefaultCodecVersion) // version
  349. if ctx.IsStringTable() {
  350. a := ctx.Table.AddOrGet(target.UID)
  351. buff.WriteInt(a) // write table index
  352. } else {
  353. buff.WriteString(target.UID) // write string
  354. }
  355. // --- [begin][write][alias](shared.Provider) ---
  356. if ctx.IsStringTable() {
  357. b := ctx.Table.AddOrGet(string(target.Provider))
  358. buff.WriteInt(b) // write table index
  359. } else {
  360. buff.WriteString(string(target.Provider)) // write string
  361. }
  362. // --- [end][write][alias](shared.Provider) ---
  363. if ctx.IsStringTable() {
  364. c := ctx.Table.AddOrGet(target.Account)
  365. buff.WriteInt(c) // write table index
  366. } else {
  367. buff.WriteString(target.Account) // write string
  368. }
  369. if ctx.IsStringTable() {
  370. d := ctx.Table.AddOrGet(target.Name)
  371. buff.WriteInt(d) // write table index
  372. } else {
  373. buff.WriteString(target.Name) // write string
  374. }
  375. if ctx.IsStringTable() {
  376. e := ctx.Table.AddOrGet(target.Region)
  377. buff.WriteInt(e) // write table index
  378. } else {
  379. buff.WriteString(target.Region) // write string
  380. }
  381. // --- [begin][write][reference](time.Time) ---
  382. f, errA := target.Start.MarshalBinary()
  383. if errA != nil {
  384. return errA
  385. }
  386. buff.WriteInt(len(f))
  387. buff.WriteBytes(f)
  388. // --- [end][write][reference](time.Time) ---
  389. // --- [begin][write][reference](time.Time) ---
  390. g, errB := target.End.MarshalBinary()
  391. if errB != nil {
  392. return errB
  393. }
  394. buff.WriteInt(len(g))
  395. buff.WriteBytes(g)
  396. // --- [end][write][reference](time.Time) ---
  397. return nil
  398. }
  399. // UnmarshalBinary uses the data passed byte array to set all the internal properties of
  400. // the Cluster type
  401. func (target *Cluster) UnmarshalBinary(data []byte) error {
  402. ctx := NewDecodingContextFromBytes(data)
  403. defer ctx.Close()
  404. err := target.UnmarshalBinaryWithContext(ctx)
  405. if err != nil {
  406. return err
  407. }
  408. return nil
  409. }
  410. // UnmarshalBinaryFromReader uses the io.Reader data to set all the internal properties of
  411. // the Cluster type
  412. func (target *Cluster) UnmarshalBinaryFromReader(reader io.Reader) error {
  413. ctx := NewDecodingContextFromReader(reader)
  414. defer ctx.Close()
  415. err := target.UnmarshalBinaryWithContext(ctx)
  416. if err != nil {
  417. return err
  418. }
  419. return nil
  420. }
  421. // UnmarshalBinaryWithContext uses the context containing a string table and binary buffer to set all the internal properties of
  422. // the Cluster type
  423. func (target *Cluster) UnmarshalBinaryWithContext(ctx *DecodingContext) (err error) {
  424. // panics are recovered and propagated as errors
  425. defer func() {
  426. if r := recover(); r != nil {
  427. if e, ok := r.(error); ok {
  428. err = e
  429. } else if s, ok := r.(string); ok {
  430. err = fmt.Errorf("unexpected panic: %s", s)
  431. } else {
  432. err = fmt.Errorf("unexpected panic: %+v", r)
  433. }
  434. }
  435. }()
  436. buff := ctx.Buffer
  437. version := buff.ReadUInt8()
  438. if version > DefaultCodecVersion {
  439. return fmt.Errorf("Invalid Version Unmarshalling Cluster. Expected %d or less, got %d", DefaultCodecVersion, version)
  440. }
  441. // field version check
  442. if uint8(1) <= version {
  443. var b string
  444. if ctx.IsStringTable() {
  445. c := buff.ReadInt() // read string index
  446. b = ctx.Table.At(c)
  447. } else {
  448. b = buff.ReadString() // read string
  449. }
  450. a := b
  451. target.UID = a
  452. } else {
  453. target.UID = "" // default
  454. }
  455. // field version check
  456. if uint8(1) <= version {
  457. // --- [begin][read][alias](shared.Provider) ---
  458. var d string
  459. var f string
  460. if ctx.IsStringTable() {
  461. g := buff.ReadInt() // read string index
  462. f = ctx.Table.At(g)
  463. } else {
  464. f = buff.ReadString() // read string
  465. }
  466. e := f
  467. d = e
  468. target.Provider = shared.Provider(d)
  469. // --- [end][read][alias](shared.Provider) ---
  470. } else {
  471. }
  472. // field version check
  473. if uint8(1) <= version {
  474. var l string
  475. if ctx.IsStringTable() {
  476. m := buff.ReadInt() // read string index
  477. l = ctx.Table.At(m)
  478. } else {
  479. l = buff.ReadString() // read string
  480. }
  481. h := l
  482. target.Account = h
  483. } else {
  484. target.Account = "" // default
  485. }
  486. // field version check
  487. if uint8(1) <= version {
  488. var o string
  489. if ctx.IsStringTable() {
  490. p := buff.ReadInt() // read string index
  491. o = ctx.Table.At(p)
  492. } else {
  493. o = buff.ReadString() // read string
  494. }
  495. n := o
  496. target.Name = n
  497. } else {
  498. target.Name = "" // default
  499. }
  500. // field version check
  501. if uint8(2) <= version {
  502. var r string
  503. if ctx.IsStringTable() {
  504. s := buff.ReadInt() // read string index
  505. r = ctx.Table.At(s)
  506. } else {
  507. r = buff.ReadString() // read string
  508. }
  509. q := r
  510. target.Region = q
  511. } else {
  512. target.Region = "" // default
  513. }
  514. // field version check
  515. if uint8(1) <= version {
  516. // --- [begin][read][reference](time.Time) ---
  517. t := new(time.Time)
  518. u := buff.ReadInt() // byte array length
  519. w := buff.ReadBytes(u)
  520. errA := t.UnmarshalBinary(w)
  521. if errA != nil {
  522. return errA
  523. }
  524. target.Start = *t
  525. // --- [end][read][reference](time.Time) ---
  526. } else {
  527. }
  528. // field version check
  529. if uint8(1) <= version {
  530. // --- [begin][read][reference](time.Time) ---
  531. x := new(time.Time)
  532. y := buff.ReadInt() // byte array length
  533. aa := buff.ReadBytes(y)
  534. errB := x.UnmarshalBinary(aa)
  535. if errB != nil {
  536. return errB
  537. }
  538. target.End = *x
  539. // --- [end][read][reference](time.Time) ---
  540. } else {
  541. }
  542. return nil
  543. }
  544. //--------------------------------------------------------------------------
  545. // Container
  546. //--------------------------------------------------------------------------
  547. // MarshalBinary serializes the internal properties of this Container instance
  548. // into a byte array
  549. func (target *Container) MarshalBinary() (data []byte, err error) {
  550. ctx := NewEncodingContext(nil)
  551. e := target.MarshalBinaryWithContext(ctx)
  552. if e != nil {
  553. return nil, e
  554. }
  555. return ctx.ToBytes(), nil
  556. }
  557. // MarshalBinary serializes the internal properties of this Container instance
  558. // into an io.Writer.
  559. func (target *Container) MarshalBinaryTo(writer io.Writer) error {
  560. buff := util.NewBufferFromWriter(writer)
  561. defer buff.Flush()
  562. ctx := NewEncodingContextFromBuffer(buff, nil)
  563. return target.MarshalBinaryWithContext(ctx)
  564. }
  565. // MarshalBinaryWithContext serializes the internal properties of this Container instance
  566. // into a byte array leveraging a predefined context.
  567. func (target *Container) MarshalBinaryWithContext(ctx *EncodingContext) (err error) {
  568. // panics are recovered and propagated as errors
  569. defer func() {
  570. if r := recover(); r != nil {
  571. if e, ok := r.(error); ok {
  572. err = e
  573. } else if s, ok := r.(string); ok {
  574. err = fmt.Errorf("unexpected panic: %s", s)
  575. } else {
  576. err = fmt.Errorf("unexpected panic: %+v", r)
  577. }
  578. }
  579. }()
  580. buff := ctx.Buffer
  581. buff.WriteUInt8(DefaultCodecVersion) // version
  582. if ctx.IsStringTable() {
  583. a := ctx.Table.AddOrGet(target.PodUID)
  584. buff.WriteInt(a) // write table index
  585. } else {
  586. buff.WriteString(target.PodUID) // write string
  587. }
  588. if ctx.IsStringTable() {
  589. b := ctx.Table.AddOrGet(target.Name)
  590. buff.WriteInt(b) // write table index
  591. } else {
  592. buff.WriteString(target.Name) // write string
  593. }
  594. // --- [begin][write][alias](ResourceQuantities) ---
  595. if map[Resource]ResourceQuantity(target.ResourceRequests) == nil {
  596. buff.WriteUInt8(uint8(0)) // write nil byte
  597. } else {
  598. buff.WriteUInt8(uint8(1)) // write non-nil byte
  599. // --- [begin][write][map](map[Resource]ResourceQuantity) ---
  600. buff.WriteInt(len(map[Resource]ResourceQuantity(target.ResourceRequests))) // map length
  601. for v, z := range map[Resource]ResourceQuantity(target.ResourceRequests) {
  602. // --- [begin][write][alias](Resource) ---
  603. if ctx.IsStringTable() {
  604. c := ctx.Table.AddOrGet(string(v))
  605. buff.WriteInt(c) // write table index
  606. } else {
  607. buff.WriteString(string(v)) // write string
  608. }
  609. // --- [end][write][alias](Resource) ---
  610. // --- [begin][write][struct](ResourceQuantity) ---
  611. buff.WriteInt(0) // [compatibility, unused]
  612. errA := z.MarshalBinaryWithContext(ctx)
  613. if errA != nil {
  614. return errA
  615. }
  616. // --- [end][write][struct](ResourceQuantity) ---
  617. }
  618. // --- [end][write][map](map[Resource]ResourceQuantity) ---
  619. }
  620. // --- [end][write][alias](ResourceQuantities) ---
  621. // --- [begin][write][alias](ResourceQuantities) ---
  622. if map[Resource]ResourceQuantity(target.ResourceLimits) == nil {
  623. buff.WriteUInt8(uint8(0)) // write nil byte
  624. } else {
  625. buff.WriteUInt8(uint8(1)) // write non-nil byte
  626. // --- [begin][write][map](map[Resource]ResourceQuantity) ---
  627. buff.WriteInt(len(map[Resource]ResourceQuantity(target.ResourceLimits))) // map length
  628. for vv, zz := range map[Resource]ResourceQuantity(target.ResourceLimits) {
  629. // --- [begin][write][alias](Resource) ---
  630. if ctx.IsStringTable() {
  631. d := ctx.Table.AddOrGet(string(vv))
  632. buff.WriteInt(d) // write table index
  633. } else {
  634. buff.WriteString(string(vv)) // write string
  635. }
  636. // --- [end][write][alias](Resource) ---
  637. // --- [begin][write][struct](ResourceQuantity) ---
  638. buff.WriteInt(0) // [compatibility, unused]
  639. errB := zz.MarshalBinaryWithContext(ctx)
  640. if errB != nil {
  641. return errB
  642. }
  643. // --- [end][write][struct](ResourceQuantity) ---
  644. }
  645. // --- [end][write][map](map[Resource]ResourceQuantity) ---
  646. }
  647. // --- [end][write][alias](ResourceQuantities) ---
  648. buff.WriteFloat64(target.CPUCoreAllocationAvg) // write float64
  649. buff.WriteFloat64(target.CPUCoreUsageAvg) // write float64
  650. buff.WriteFloat64(target.CPUCoreUsageMax) // write float64
  651. buff.WriteFloat64(target.RAMBytesAllocationAvg) // write float64
  652. buff.WriteFloat64(target.RAMBytesUsageAvg) // write float64
  653. buff.WriteFloat64(target.RAMBytesUsageMax) // write float64
  654. // --- [begin][write][reference](time.Time) ---
  655. e, errC := target.Start.MarshalBinary()
  656. if errC != nil {
  657. return errC
  658. }
  659. buff.WriteInt(len(e))
  660. buff.WriteBytes(e)
  661. // --- [end][write][reference](time.Time) ---
  662. // --- [begin][write][reference](time.Time) ---
  663. f, errD := target.End.MarshalBinary()
  664. if errD != nil {
  665. return errD
  666. }
  667. buff.WriteInt(len(f))
  668. buff.WriteBytes(f)
  669. // --- [end][write][reference](time.Time) ---
  670. return nil
  671. }
  672. // UnmarshalBinary uses the data passed byte array to set all the internal properties of
  673. // the Container type
  674. func (target *Container) UnmarshalBinary(data []byte) error {
  675. ctx := NewDecodingContextFromBytes(data)
  676. defer ctx.Close()
  677. err := target.UnmarshalBinaryWithContext(ctx)
  678. if err != nil {
  679. return err
  680. }
  681. return nil
  682. }
  683. // UnmarshalBinaryFromReader uses the io.Reader data to set all the internal properties of
  684. // the Container type
  685. func (target *Container) UnmarshalBinaryFromReader(reader io.Reader) error {
  686. ctx := NewDecodingContextFromReader(reader)
  687. defer ctx.Close()
  688. err := target.UnmarshalBinaryWithContext(ctx)
  689. if err != nil {
  690. return err
  691. }
  692. return nil
  693. }
  694. // UnmarshalBinaryWithContext uses the context containing a string table and binary buffer to set all the internal properties of
  695. // the Container type
  696. func (target *Container) UnmarshalBinaryWithContext(ctx *DecodingContext) (err error) {
  697. // panics are recovered and propagated as errors
  698. defer func() {
  699. if r := recover(); r != nil {
  700. if e, ok := r.(error); ok {
  701. err = e
  702. } else if s, ok := r.(string); ok {
  703. err = fmt.Errorf("unexpected panic: %s", s)
  704. } else {
  705. err = fmt.Errorf("unexpected panic: %+v", r)
  706. }
  707. }
  708. }()
  709. buff := ctx.Buffer
  710. version := buff.ReadUInt8()
  711. if version > DefaultCodecVersion {
  712. return fmt.Errorf("Invalid Version Unmarshalling Container. Expected %d or less, got %d", DefaultCodecVersion, version)
  713. }
  714. var b string
  715. if ctx.IsStringTable() {
  716. c := buff.ReadInt() // read string index
  717. b = ctx.Table.At(c)
  718. } else {
  719. b = buff.ReadString() // read string
  720. }
  721. a := b
  722. target.PodUID = a
  723. var e string
  724. if ctx.IsStringTable() {
  725. f := buff.ReadInt() // read string index
  726. e = ctx.Table.At(f)
  727. } else {
  728. e = buff.ReadString() // read string
  729. }
  730. d := e
  731. target.Name = d
  732. // --- [begin][read][alias](ResourceQuantities) ---
  733. var g map[Resource]ResourceQuantity
  734. if buff.ReadUInt8() == uint8(0) {
  735. g = nil
  736. } else {
  737. // --- [begin][read][map](map[Resource]ResourceQuantity) ---
  738. l := buff.ReadInt() // map len
  739. h := make(map[Resource]ResourceQuantity, l)
  740. for range l {
  741. // --- [begin][read][alias](Resource) ---
  742. var m string
  743. var o string
  744. if ctx.IsStringTable() {
  745. p := buff.ReadInt() // read string index
  746. o = ctx.Table.At(p)
  747. } else {
  748. o = buff.ReadString() // read string
  749. }
  750. n := o
  751. m = n
  752. v := Resource(m)
  753. // --- [end][read][alias](Resource) ---
  754. // --- [begin][read][struct](ResourceQuantity) ---
  755. q := new(ResourceQuantity)
  756. buff.ReadInt() // [compatibility, unused]
  757. errA := q.UnmarshalBinaryWithContext(ctx)
  758. if errA != nil {
  759. return errA
  760. }
  761. z := *q
  762. // --- [end][read][struct](ResourceQuantity) ---
  763. h[v] = z
  764. }
  765. g = h
  766. // --- [end][read][map](map[Resource]ResourceQuantity) ---
  767. }
  768. target.ResourceRequests = ResourceQuantities(g)
  769. // --- [end][read][alias](ResourceQuantities) ---
  770. // --- [begin][read][alias](ResourceQuantities) ---
  771. var r map[Resource]ResourceQuantity
  772. if buff.ReadUInt8() == uint8(0) {
  773. r = nil
  774. } else {
  775. // --- [begin][read][map](map[Resource]ResourceQuantity) ---
  776. t := buff.ReadInt() // map len
  777. s := make(map[Resource]ResourceQuantity, t)
  778. for range t {
  779. // --- [begin][read][alias](Resource) ---
  780. var u string
  781. var x string
  782. if ctx.IsStringTable() {
  783. y := buff.ReadInt() // read string index
  784. x = ctx.Table.At(y)
  785. } else {
  786. x = buff.ReadString() // read string
  787. }
  788. w := x
  789. u = w
  790. vv := Resource(u)
  791. // --- [end][read][alias](Resource) ---
  792. // --- [begin][read][struct](ResourceQuantity) ---
  793. aa := new(ResourceQuantity)
  794. buff.ReadInt() // [compatibility, unused]
  795. errB := aa.UnmarshalBinaryWithContext(ctx)
  796. if errB != nil {
  797. return errB
  798. }
  799. zz := *aa
  800. // --- [end][read][struct](ResourceQuantity) ---
  801. s[vv] = zz
  802. }
  803. r = s
  804. // --- [end][read][map](map[Resource]ResourceQuantity) ---
  805. }
  806. target.ResourceLimits = ResourceQuantities(r)
  807. // --- [end][read][alias](ResourceQuantities) ---
  808. bb := buff.ReadFloat64() // read float64
  809. target.CPUCoreAllocationAvg = bb
  810. cc := buff.ReadFloat64() // read float64
  811. target.CPUCoreUsageAvg = cc
  812. dd := buff.ReadFloat64() // read float64
  813. target.CPUCoreUsageMax = dd
  814. ee := buff.ReadFloat64() // read float64
  815. target.RAMBytesAllocationAvg = ee
  816. ff := buff.ReadFloat64() // read float64
  817. target.RAMBytesUsageAvg = ff
  818. gg := buff.ReadFloat64() // read float64
  819. target.RAMBytesUsageMax = gg
  820. // --- [begin][read][reference](time.Time) ---
  821. hh := new(time.Time)
  822. ll := buff.ReadInt() // byte array length
  823. mm := buff.ReadBytes(ll)
  824. errC := hh.UnmarshalBinary(mm)
  825. if errC != nil {
  826. return errC
  827. }
  828. target.Start = *hh
  829. // --- [end][read][reference](time.Time) ---
  830. // --- [begin][read][reference](time.Time) ---
  831. nn := new(time.Time)
  832. oo := buff.ReadInt() // byte array length
  833. pp := buff.ReadBytes(oo)
  834. errD := nn.UnmarshalBinary(pp)
  835. if errD != nil {
  836. return errD
  837. }
  838. target.End = *nn
  839. // --- [end][read][reference](time.Time) ---
  840. return nil
  841. }
  842. //--------------------------------------------------------------------------
  843. // CronJob
  844. //--------------------------------------------------------------------------
  845. // MarshalBinary serializes the internal properties of this CronJob instance
  846. // into a byte array
  847. func (target *CronJob) MarshalBinary() (data []byte, err error) {
  848. ctx := NewEncodingContext(nil)
  849. e := target.MarshalBinaryWithContext(ctx)
  850. if e != nil {
  851. return nil, e
  852. }
  853. return ctx.ToBytes(), nil
  854. }
  855. // MarshalBinary serializes the internal properties of this CronJob instance
  856. // into an io.Writer.
  857. func (target *CronJob) MarshalBinaryTo(writer io.Writer) error {
  858. buff := util.NewBufferFromWriter(writer)
  859. defer buff.Flush()
  860. ctx := NewEncodingContextFromBuffer(buff, nil)
  861. return target.MarshalBinaryWithContext(ctx)
  862. }
  863. // MarshalBinaryWithContext serializes the internal properties of this CronJob instance
  864. // into a byte array leveraging a predefined context.
  865. func (target *CronJob) MarshalBinaryWithContext(ctx *EncodingContext) (err error) {
  866. // panics are recovered and propagated as errors
  867. defer func() {
  868. if r := recover(); r != nil {
  869. if e, ok := r.(error); ok {
  870. err = e
  871. } else if s, ok := r.(string); ok {
  872. err = fmt.Errorf("unexpected panic: %s", s)
  873. } else {
  874. err = fmt.Errorf("unexpected panic: %+v", r)
  875. }
  876. }
  877. }()
  878. buff := ctx.Buffer
  879. buff.WriteUInt8(DefaultCodecVersion) // version
  880. if ctx.IsStringTable() {
  881. a := ctx.Table.AddOrGet(target.UID)
  882. buff.WriteInt(a) // write table index
  883. } else {
  884. buff.WriteString(target.UID) // write string
  885. }
  886. if ctx.IsStringTable() {
  887. b := ctx.Table.AddOrGet(target.NamespaceUID)
  888. buff.WriteInt(b) // write table index
  889. } else {
  890. buff.WriteString(target.NamespaceUID) // write string
  891. }
  892. if ctx.IsStringTable() {
  893. c := ctx.Table.AddOrGet(target.Name)
  894. buff.WriteInt(c) // write table index
  895. } else {
  896. buff.WriteString(target.Name) // write string
  897. }
  898. if target.Labels == nil {
  899. buff.WriteUInt8(uint8(0)) // write nil byte
  900. } else {
  901. buff.WriteUInt8(uint8(1)) // write non-nil byte
  902. // --- [begin][write][map](map[string]string) ---
  903. buff.WriteInt(len(target.Labels)) // map length
  904. for v, z := range target.Labels {
  905. if ctx.IsStringTable() {
  906. d := ctx.Table.AddOrGet(v)
  907. buff.WriteInt(d) // write table index
  908. } else {
  909. buff.WriteString(v) // write string
  910. }
  911. if ctx.IsStringTable() {
  912. e := ctx.Table.AddOrGet(z)
  913. buff.WriteInt(e) // write table index
  914. } else {
  915. buff.WriteString(z) // write string
  916. }
  917. }
  918. // --- [end][write][map](map[string]string) ---
  919. }
  920. if target.Annotations == nil {
  921. buff.WriteUInt8(uint8(0)) // write nil byte
  922. } else {
  923. buff.WriteUInt8(uint8(1)) // write non-nil byte
  924. // --- [begin][write][map](map[string]string) ---
  925. buff.WriteInt(len(target.Annotations)) // map length
  926. for vv, zz := range target.Annotations {
  927. if ctx.IsStringTable() {
  928. f := ctx.Table.AddOrGet(vv)
  929. buff.WriteInt(f) // write table index
  930. } else {
  931. buff.WriteString(vv) // write string
  932. }
  933. if ctx.IsStringTable() {
  934. g := ctx.Table.AddOrGet(zz)
  935. buff.WriteInt(g) // write table index
  936. } else {
  937. buff.WriteString(zz) // write string
  938. }
  939. }
  940. // --- [end][write][map](map[string]string) ---
  941. }
  942. // --- [begin][write][reference](time.Time) ---
  943. h, errA := target.Start.MarshalBinary()
  944. if errA != nil {
  945. return errA
  946. }
  947. buff.WriteInt(len(h))
  948. buff.WriteBytes(h)
  949. // --- [end][write][reference](time.Time) ---
  950. // --- [begin][write][reference](time.Time) ---
  951. l, errB := target.End.MarshalBinary()
  952. if errB != nil {
  953. return errB
  954. }
  955. buff.WriteInt(len(l))
  956. buff.WriteBytes(l)
  957. // --- [end][write][reference](time.Time) ---
  958. return nil
  959. }
  960. // UnmarshalBinary uses the data passed byte array to set all the internal properties of
  961. // the CronJob type
  962. func (target *CronJob) UnmarshalBinary(data []byte) error {
  963. ctx := NewDecodingContextFromBytes(data)
  964. defer ctx.Close()
  965. err := target.UnmarshalBinaryWithContext(ctx)
  966. if err != nil {
  967. return err
  968. }
  969. return nil
  970. }
  971. // UnmarshalBinaryFromReader uses the io.Reader data to set all the internal properties of
  972. // the CronJob type
  973. func (target *CronJob) UnmarshalBinaryFromReader(reader io.Reader) error {
  974. ctx := NewDecodingContextFromReader(reader)
  975. defer ctx.Close()
  976. err := target.UnmarshalBinaryWithContext(ctx)
  977. if err != nil {
  978. return err
  979. }
  980. return nil
  981. }
  982. // UnmarshalBinaryWithContext uses the context containing a string table and binary buffer to set all the internal properties of
  983. // the CronJob type
  984. func (target *CronJob) UnmarshalBinaryWithContext(ctx *DecodingContext) (err error) {
  985. // panics are recovered and propagated as errors
  986. defer func() {
  987. if r := recover(); r != nil {
  988. if e, ok := r.(error); ok {
  989. err = e
  990. } else if s, ok := r.(string); ok {
  991. err = fmt.Errorf("unexpected panic: %s", s)
  992. } else {
  993. err = fmt.Errorf("unexpected panic: %+v", r)
  994. }
  995. }
  996. }()
  997. buff := ctx.Buffer
  998. version := buff.ReadUInt8()
  999. if version > DefaultCodecVersion {
  1000. return fmt.Errorf("Invalid Version Unmarshalling CronJob. Expected %d or less, got %d", DefaultCodecVersion, version)
  1001. }
  1002. var b string
  1003. if ctx.IsStringTable() {
  1004. c := buff.ReadInt() // read string index
  1005. b = ctx.Table.At(c)
  1006. } else {
  1007. b = buff.ReadString() // read string
  1008. }
  1009. a := b
  1010. target.UID = a
  1011. var e string
  1012. if ctx.IsStringTable() {
  1013. f := buff.ReadInt() // read string index
  1014. e = ctx.Table.At(f)
  1015. } else {
  1016. e = buff.ReadString() // read string
  1017. }
  1018. d := e
  1019. target.NamespaceUID = d
  1020. var h string
  1021. if ctx.IsStringTable() {
  1022. l := buff.ReadInt() // read string index
  1023. h = ctx.Table.At(l)
  1024. } else {
  1025. h = buff.ReadString() // read string
  1026. }
  1027. g := h
  1028. target.Name = g
  1029. if buff.ReadUInt8() == uint8(0) {
  1030. target.Labels = nil
  1031. } else {
  1032. // --- [begin][read][map](map[string]string) ---
  1033. n := buff.ReadInt() // map len
  1034. m := make(map[string]string, n)
  1035. for range n {
  1036. var v string
  1037. var p string
  1038. if ctx.IsStringTable() {
  1039. q := buff.ReadInt() // read string index
  1040. p = ctx.Table.At(q)
  1041. } else {
  1042. p = buff.ReadString() // read string
  1043. }
  1044. o := p
  1045. v = o
  1046. var z string
  1047. var s string
  1048. if ctx.IsStringTable() {
  1049. t := buff.ReadInt() // read string index
  1050. s = ctx.Table.At(t)
  1051. } else {
  1052. s = buff.ReadString() // read string
  1053. }
  1054. r := s
  1055. z = r
  1056. m[v] = z
  1057. }
  1058. target.Labels = m
  1059. // --- [end][read][map](map[string]string) ---
  1060. }
  1061. if buff.ReadUInt8() == uint8(0) {
  1062. target.Annotations = nil
  1063. } else {
  1064. // --- [begin][read][map](map[string]string) ---
  1065. w := buff.ReadInt() // map len
  1066. u := make(map[string]string, w)
  1067. for range w {
  1068. var vv string
  1069. var y string
  1070. if ctx.IsStringTable() {
  1071. aa := buff.ReadInt() // read string index
  1072. y = ctx.Table.At(aa)
  1073. } else {
  1074. y = buff.ReadString() // read string
  1075. }
  1076. x := y
  1077. vv = x
  1078. var zz string
  1079. var cc string
  1080. if ctx.IsStringTable() {
  1081. dd := buff.ReadInt() // read string index
  1082. cc = ctx.Table.At(dd)
  1083. } else {
  1084. cc = buff.ReadString() // read string
  1085. }
  1086. bb := cc
  1087. zz = bb
  1088. u[vv] = zz
  1089. }
  1090. target.Annotations = u
  1091. // --- [end][read][map](map[string]string) ---
  1092. }
  1093. // --- [begin][read][reference](time.Time) ---
  1094. ee := new(time.Time)
  1095. ff := buff.ReadInt() // byte array length
  1096. gg := buff.ReadBytes(ff)
  1097. errA := ee.UnmarshalBinary(gg)
  1098. if errA != nil {
  1099. return errA
  1100. }
  1101. target.Start = *ee
  1102. // --- [end][read][reference](time.Time) ---
  1103. // --- [begin][read][reference](time.Time) ---
  1104. hh := new(time.Time)
  1105. ll := buff.ReadInt() // byte array length
  1106. mm := buff.ReadBytes(ll)
  1107. errB := hh.UnmarshalBinary(mm)
  1108. if errB != nil {
  1109. return errB
  1110. }
  1111. target.End = *hh
  1112. // --- [end][read][reference](time.Time) ---
  1113. return nil
  1114. }
  1115. //--------------------------------------------------------------------------
  1116. // DCGMContainer
  1117. //--------------------------------------------------------------------------
  1118. // MarshalBinary serializes the internal properties of this DCGMContainer instance
  1119. // into a byte array
  1120. func (target *DCGMContainer) MarshalBinary() (data []byte, err error) {
  1121. ctx := NewEncodingContext(nil)
  1122. e := target.MarshalBinaryWithContext(ctx)
  1123. if e != nil {
  1124. return nil, e
  1125. }
  1126. return ctx.ToBytes(), nil
  1127. }
  1128. // MarshalBinary serializes the internal properties of this DCGMContainer instance
  1129. // into an io.Writer.
  1130. func (target *DCGMContainer) MarshalBinaryTo(writer io.Writer) error {
  1131. buff := util.NewBufferFromWriter(writer)
  1132. defer buff.Flush()
  1133. ctx := NewEncodingContextFromBuffer(buff, nil)
  1134. return target.MarshalBinaryWithContext(ctx)
  1135. }
  1136. // MarshalBinaryWithContext serializes the internal properties of this DCGMContainer instance
  1137. // into a byte array leveraging a predefined context.
  1138. func (target *DCGMContainer) MarshalBinaryWithContext(ctx *EncodingContext) (err error) {
  1139. // panics are recovered and propagated as errors
  1140. defer func() {
  1141. if r := recover(); r != nil {
  1142. if e, ok := r.(error); ok {
  1143. err = e
  1144. } else if s, ok := r.(string); ok {
  1145. err = fmt.Errorf("unexpected panic: %s", s)
  1146. } else {
  1147. err = fmt.Errorf("unexpected panic: %+v", r)
  1148. }
  1149. }
  1150. }()
  1151. buff := ctx.Buffer
  1152. buff.WriteUInt8(DefaultCodecVersion) // version
  1153. buff.WriteFloat64(target.UsageAvg) // write float64
  1154. buff.WriteFloat64(target.UsageMax) // write float64
  1155. return nil
  1156. }
  1157. // UnmarshalBinary uses the data passed byte array to set all the internal properties of
  1158. // the DCGMContainer type
  1159. func (target *DCGMContainer) UnmarshalBinary(data []byte) error {
  1160. ctx := NewDecodingContextFromBytes(data)
  1161. defer ctx.Close()
  1162. err := target.UnmarshalBinaryWithContext(ctx)
  1163. if err != nil {
  1164. return err
  1165. }
  1166. return nil
  1167. }
  1168. // UnmarshalBinaryFromReader uses the io.Reader data to set all the internal properties of
  1169. // the DCGMContainer type
  1170. func (target *DCGMContainer) UnmarshalBinaryFromReader(reader io.Reader) error {
  1171. ctx := NewDecodingContextFromReader(reader)
  1172. defer ctx.Close()
  1173. err := target.UnmarshalBinaryWithContext(ctx)
  1174. if err != nil {
  1175. return err
  1176. }
  1177. return nil
  1178. }
  1179. // UnmarshalBinaryWithContext uses the context containing a string table and binary buffer to set all the internal properties of
  1180. // the DCGMContainer type
  1181. func (target *DCGMContainer) UnmarshalBinaryWithContext(ctx *DecodingContext) (err error) {
  1182. // panics are recovered and propagated as errors
  1183. defer func() {
  1184. if r := recover(); r != nil {
  1185. if e, ok := r.(error); ok {
  1186. err = e
  1187. } else if s, ok := r.(string); ok {
  1188. err = fmt.Errorf("unexpected panic: %s", s)
  1189. } else {
  1190. err = fmt.Errorf("unexpected panic: %+v", r)
  1191. }
  1192. }
  1193. }()
  1194. buff := ctx.Buffer
  1195. version := buff.ReadUInt8()
  1196. if version > DefaultCodecVersion {
  1197. return fmt.Errorf("Invalid Version Unmarshalling DCGMContainer. Expected %d or less, got %d", DefaultCodecVersion, version)
  1198. }
  1199. a := buff.ReadFloat64() // read float64
  1200. target.UsageAvg = a
  1201. b := buff.ReadFloat64() // read float64
  1202. target.UsageMax = b
  1203. return nil
  1204. }
  1205. //--------------------------------------------------------------------------
  1206. // DCGMDevice
  1207. //--------------------------------------------------------------------------
  1208. // MarshalBinary serializes the internal properties of this DCGMDevice instance
  1209. // into a byte array
  1210. func (target *DCGMDevice) MarshalBinary() (data []byte, err error) {
  1211. ctx := NewEncodingContext(nil)
  1212. e := target.MarshalBinaryWithContext(ctx)
  1213. if e != nil {
  1214. return nil, e
  1215. }
  1216. return ctx.ToBytes(), nil
  1217. }
  1218. // MarshalBinary serializes the internal properties of this DCGMDevice instance
  1219. // into an io.Writer.
  1220. func (target *DCGMDevice) MarshalBinaryTo(writer io.Writer) error {
  1221. buff := util.NewBufferFromWriter(writer)
  1222. defer buff.Flush()
  1223. ctx := NewEncodingContextFromBuffer(buff, nil)
  1224. return target.MarshalBinaryWithContext(ctx)
  1225. }
  1226. // MarshalBinaryWithContext serializes the internal properties of this DCGMDevice instance
  1227. // into a byte array leveraging a predefined context.
  1228. func (target *DCGMDevice) MarshalBinaryWithContext(ctx *EncodingContext) (err error) {
  1229. // panics are recovered and propagated as errors
  1230. defer func() {
  1231. if r := recover(); r != nil {
  1232. if e, ok := r.(error); ok {
  1233. err = e
  1234. } else if s, ok := r.(string); ok {
  1235. err = fmt.Errorf("unexpected panic: %s", s)
  1236. } else {
  1237. err = fmt.Errorf("unexpected panic: %+v", r)
  1238. }
  1239. }
  1240. }()
  1241. buff := ctx.Buffer
  1242. buff.WriteUInt8(DefaultCodecVersion) // version
  1243. if ctx.IsStringTable() {
  1244. a := ctx.Table.AddOrGet(target.UUID)
  1245. buff.WriteInt(a) // write table index
  1246. } else {
  1247. buff.WriteString(target.UUID) // write string
  1248. }
  1249. // --- [begin][write][reference](time.Time) ---
  1250. b, errA := target.Start.MarshalBinary()
  1251. if errA != nil {
  1252. return errA
  1253. }
  1254. buff.WriteInt(len(b))
  1255. buff.WriteBytes(b)
  1256. // --- [end][write][reference](time.Time) ---
  1257. // --- [begin][write][reference](time.Time) ---
  1258. c, errB := target.End.MarshalBinary()
  1259. if errB != nil {
  1260. return errB
  1261. }
  1262. buff.WriteInt(len(c))
  1263. buff.WriteBytes(c)
  1264. // --- [end][write][reference](time.Time) ---
  1265. if ctx.IsStringTable() {
  1266. d := ctx.Table.AddOrGet(target.Device)
  1267. buff.WriteInt(d) // write table index
  1268. } else {
  1269. buff.WriteString(target.Device) // write string
  1270. }
  1271. if ctx.IsStringTable() {
  1272. e := ctx.Table.AddOrGet(target.ModelName)
  1273. buff.WriteInt(e) // write table index
  1274. } else {
  1275. buff.WriteString(target.ModelName) // write string
  1276. }
  1277. if target.PodUsages == nil {
  1278. buff.WriteUInt8(uint8(0)) // write nil byte
  1279. } else {
  1280. buff.WriteUInt8(uint8(1)) // write non-nil byte
  1281. // --- [begin][write][map](map[string]DCGMPod) ---
  1282. buff.WriteInt(len(target.PodUsages)) // map length
  1283. for v, z := range target.PodUsages {
  1284. if ctx.IsStringTable() {
  1285. f := ctx.Table.AddOrGet(v)
  1286. buff.WriteInt(f) // write table index
  1287. } else {
  1288. buff.WriteString(v) // write string
  1289. }
  1290. // --- [begin][write][struct](DCGMPod) ---
  1291. buff.WriteInt(0) // [compatibility, unused]
  1292. errC := z.MarshalBinaryWithContext(ctx)
  1293. if errC != nil {
  1294. return errC
  1295. }
  1296. // --- [end][write][struct](DCGMPod) ---
  1297. }
  1298. // --- [end][write][map](map[string]DCGMPod) ---
  1299. }
  1300. return nil
  1301. }
  1302. // UnmarshalBinary uses the data passed byte array to set all the internal properties of
  1303. // the DCGMDevice type
  1304. func (target *DCGMDevice) UnmarshalBinary(data []byte) error {
  1305. ctx := NewDecodingContextFromBytes(data)
  1306. defer ctx.Close()
  1307. err := target.UnmarshalBinaryWithContext(ctx)
  1308. if err != nil {
  1309. return err
  1310. }
  1311. return nil
  1312. }
  1313. // UnmarshalBinaryFromReader uses the io.Reader data to set all the internal properties of
  1314. // the DCGMDevice type
  1315. func (target *DCGMDevice) UnmarshalBinaryFromReader(reader io.Reader) error {
  1316. ctx := NewDecodingContextFromReader(reader)
  1317. defer ctx.Close()
  1318. err := target.UnmarshalBinaryWithContext(ctx)
  1319. if err != nil {
  1320. return err
  1321. }
  1322. return nil
  1323. }
  1324. // UnmarshalBinaryWithContext uses the context containing a string table and binary buffer to set all the internal properties of
  1325. // the DCGMDevice type
  1326. func (target *DCGMDevice) UnmarshalBinaryWithContext(ctx *DecodingContext) (err error) {
  1327. // panics are recovered and propagated as errors
  1328. defer func() {
  1329. if r := recover(); r != nil {
  1330. if e, ok := r.(error); ok {
  1331. err = e
  1332. } else if s, ok := r.(string); ok {
  1333. err = fmt.Errorf("unexpected panic: %s", s)
  1334. } else {
  1335. err = fmt.Errorf("unexpected panic: %+v", r)
  1336. }
  1337. }
  1338. }()
  1339. buff := ctx.Buffer
  1340. version := buff.ReadUInt8()
  1341. if version > DefaultCodecVersion {
  1342. return fmt.Errorf("Invalid Version Unmarshalling DCGMDevice. Expected %d or less, got %d", DefaultCodecVersion, version)
  1343. }
  1344. var b string
  1345. if ctx.IsStringTable() {
  1346. c := buff.ReadInt() // read string index
  1347. b = ctx.Table.At(c)
  1348. } else {
  1349. b = buff.ReadString() // read string
  1350. }
  1351. a := b
  1352. target.UUID = a
  1353. // --- [begin][read][reference](time.Time) ---
  1354. d := new(time.Time)
  1355. e := buff.ReadInt() // byte array length
  1356. f := buff.ReadBytes(e)
  1357. errA := d.UnmarshalBinary(f)
  1358. if errA != nil {
  1359. return errA
  1360. }
  1361. target.Start = *d
  1362. // --- [end][read][reference](time.Time) ---
  1363. // --- [begin][read][reference](time.Time) ---
  1364. g := new(time.Time)
  1365. h := buff.ReadInt() // byte array length
  1366. l := buff.ReadBytes(h)
  1367. errB := g.UnmarshalBinary(l)
  1368. if errB != nil {
  1369. return errB
  1370. }
  1371. target.End = *g
  1372. // --- [end][read][reference](time.Time) ---
  1373. var n string
  1374. if ctx.IsStringTable() {
  1375. o := buff.ReadInt() // read string index
  1376. n = ctx.Table.At(o)
  1377. } else {
  1378. n = buff.ReadString() // read string
  1379. }
  1380. m := n
  1381. target.Device = m
  1382. var q string
  1383. if ctx.IsStringTable() {
  1384. r := buff.ReadInt() // read string index
  1385. q = ctx.Table.At(r)
  1386. } else {
  1387. q = buff.ReadString() // read string
  1388. }
  1389. p := q
  1390. target.ModelName = p
  1391. if buff.ReadUInt8() == uint8(0) {
  1392. target.PodUsages = nil
  1393. } else {
  1394. // --- [begin][read][map](map[string]DCGMPod) ---
  1395. t := buff.ReadInt() // map len
  1396. s := make(map[string]DCGMPod, t)
  1397. for range t {
  1398. var v string
  1399. var w string
  1400. if ctx.IsStringTable() {
  1401. x := buff.ReadInt() // read string index
  1402. w = ctx.Table.At(x)
  1403. } else {
  1404. w = buff.ReadString() // read string
  1405. }
  1406. u := w
  1407. v = u
  1408. // --- [begin][read][struct](DCGMPod) ---
  1409. y := new(DCGMPod)
  1410. buff.ReadInt() // [compatibility, unused]
  1411. errC := y.UnmarshalBinaryWithContext(ctx)
  1412. if errC != nil {
  1413. return errC
  1414. }
  1415. z := *y
  1416. // --- [end][read][struct](DCGMPod) ---
  1417. s[v] = z
  1418. }
  1419. target.PodUsages = s
  1420. // --- [end][read][map](map[string]DCGMPod) ---
  1421. }
  1422. return nil
  1423. }
  1424. //--------------------------------------------------------------------------
  1425. // DCGMPod
  1426. //--------------------------------------------------------------------------
  1427. // MarshalBinary serializes the internal properties of this DCGMPod instance
  1428. // into a byte array
  1429. func (target *DCGMPod) MarshalBinary() (data []byte, err error) {
  1430. ctx := NewEncodingContext(nil)
  1431. e := target.MarshalBinaryWithContext(ctx)
  1432. if e != nil {
  1433. return nil, e
  1434. }
  1435. return ctx.ToBytes(), nil
  1436. }
  1437. // MarshalBinary serializes the internal properties of this DCGMPod instance
  1438. // into an io.Writer.
  1439. func (target *DCGMPod) MarshalBinaryTo(writer io.Writer) error {
  1440. buff := util.NewBufferFromWriter(writer)
  1441. defer buff.Flush()
  1442. ctx := NewEncodingContextFromBuffer(buff, nil)
  1443. return target.MarshalBinaryWithContext(ctx)
  1444. }
  1445. // MarshalBinaryWithContext serializes the internal properties of this DCGMPod instance
  1446. // into a byte array leveraging a predefined context.
  1447. func (target *DCGMPod) MarshalBinaryWithContext(ctx *EncodingContext) (err error) {
  1448. // panics are recovered and propagated as errors
  1449. defer func() {
  1450. if r := recover(); r != nil {
  1451. if e, ok := r.(error); ok {
  1452. err = e
  1453. } else if s, ok := r.(string); ok {
  1454. err = fmt.Errorf("unexpected panic: %s", s)
  1455. } else {
  1456. err = fmt.Errorf("unexpected panic: %+v", r)
  1457. }
  1458. }
  1459. }()
  1460. buff := ctx.Buffer
  1461. buff.WriteUInt8(DefaultCodecVersion) // version
  1462. if target.ContainerUsages == nil {
  1463. buff.WriteUInt8(uint8(0)) // write nil byte
  1464. } else {
  1465. buff.WriteUInt8(uint8(1)) // write non-nil byte
  1466. // --- [begin][write][map](map[string]DCGMContainer) ---
  1467. buff.WriteInt(len(target.ContainerUsages)) // map length
  1468. for v, z := range target.ContainerUsages {
  1469. if ctx.IsStringTable() {
  1470. a := ctx.Table.AddOrGet(v)
  1471. buff.WriteInt(a) // write table index
  1472. } else {
  1473. buff.WriteString(v) // write string
  1474. }
  1475. // --- [begin][write][struct](DCGMContainer) ---
  1476. buff.WriteInt(0) // [compatibility, unused]
  1477. errA := z.MarshalBinaryWithContext(ctx)
  1478. if errA != nil {
  1479. return errA
  1480. }
  1481. // --- [end][write][struct](DCGMContainer) ---
  1482. }
  1483. // --- [end][write][map](map[string]DCGMContainer) ---
  1484. }
  1485. return nil
  1486. }
  1487. // UnmarshalBinary uses the data passed byte array to set all the internal properties of
  1488. // the DCGMPod type
  1489. func (target *DCGMPod) UnmarshalBinary(data []byte) error {
  1490. ctx := NewDecodingContextFromBytes(data)
  1491. defer ctx.Close()
  1492. err := target.UnmarshalBinaryWithContext(ctx)
  1493. if err != nil {
  1494. return err
  1495. }
  1496. return nil
  1497. }
  1498. // UnmarshalBinaryFromReader uses the io.Reader data to set all the internal properties of
  1499. // the DCGMPod type
  1500. func (target *DCGMPod) UnmarshalBinaryFromReader(reader io.Reader) error {
  1501. ctx := NewDecodingContextFromReader(reader)
  1502. defer ctx.Close()
  1503. err := target.UnmarshalBinaryWithContext(ctx)
  1504. if err != nil {
  1505. return err
  1506. }
  1507. return nil
  1508. }
  1509. // UnmarshalBinaryWithContext uses the context containing a string table and binary buffer to set all the internal properties of
  1510. // the DCGMPod type
  1511. func (target *DCGMPod) UnmarshalBinaryWithContext(ctx *DecodingContext) (err error) {
  1512. // panics are recovered and propagated as errors
  1513. defer func() {
  1514. if r := recover(); r != nil {
  1515. if e, ok := r.(error); ok {
  1516. err = e
  1517. } else if s, ok := r.(string); ok {
  1518. err = fmt.Errorf("unexpected panic: %s", s)
  1519. } else {
  1520. err = fmt.Errorf("unexpected panic: %+v", r)
  1521. }
  1522. }
  1523. }()
  1524. buff := ctx.Buffer
  1525. version := buff.ReadUInt8()
  1526. if version > DefaultCodecVersion {
  1527. return fmt.Errorf("Invalid Version Unmarshalling DCGMPod. Expected %d or less, got %d", DefaultCodecVersion, version)
  1528. }
  1529. if buff.ReadUInt8() == uint8(0) {
  1530. target.ContainerUsages = nil
  1531. } else {
  1532. // --- [begin][read][map](map[string]DCGMContainer) ---
  1533. b := buff.ReadInt() // map len
  1534. a := make(map[string]DCGMContainer, b)
  1535. for range b {
  1536. var v string
  1537. var d string
  1538. if ctx.IsStringTable() {
  1539. e := buff.ReadInt() // read string index
  1540. d = ctx.Table.At(e)
  1541. } else {
  1542. d = buff.ReadString() // read string
  1543. }
  1544. c := d
  1545. v = c
  1546. // --- [begin][read][struct](DCGMContainer) ---
  1547. f := new(DCGMContainer)
  1548. buff.ReadInt() // [compatibility, unused]
  1549. errA := f.UnmarshalBinaryWithContext(ctx)
  1550. if errA != nil {
  1551. return errA
  1552. }
  1553. z := *f
  1554. // --- [end][read][struct](DCGMContainer) ---
  1555. a[v] = z
  1556. }
  1557. target.ContainerUsages = a
  1558. // --- [end][read][map](map[string]DCGMContainer) ---
  1559. }
  1560. return nil
  1561. }
  1562. //--------------------------------------------------------------------------
  1563. // DaemonSet
  1564. //--------------------------------------------------------------------------
  1565. // MarshalBinary serializes the internal properties of this DaemonSet instance
  1566. // into a byte array
  1567. func (target *DaemonSet) MarshalBinary() (data []byte, err error) {
  1568. ctx := NewEncodingContext(nil)
  1569. e := target.MarshalBinaryWithContext(ctx)
  1570. if e != nil {
  1571. return nil, e
  1572. }
  1573. return ctx.ToBytes(), nil
  1574. }
  1575. // MarshalBinary serializes the internal properties of this DaemonSet instance
  1576. // into an io.Writer.
  1577. func (target *DaemonSet) MarshalBinaryTo(writer io.Writer) error {
  1578. buff := util.NewBufferFromWriter(writer)
  1579. defer buff.Flush()
  1580. ctx := NewEncodingContextFromBuffer(buff, nil)
  1581. return target.MarshalBinaryWithContext(ctx)
  1582. }
  1583. // MarshalBinaryWithContext serializes the internal properties of this DaemonSet instance
  1584. // into a byte array leveraging a predefined context.
  1585. func (target *DaemonSet) MarshalBinaryWithContext(ctx *EncodingContext) (err error) {
  1586. // panics are recovered and propagated as errors
  1587. defer func() {
  1588. if r := recover(); r != nil {
  1589. if e, ok := r.(error); ok {
  1590. err = e
  1591. } else if s, ok := r.(string); ok {
  1592. err = fmt.Errorf("unexpected panic: %s", s)
  1593. } else {
  1594. err = fmt.Errorf("unexpected panic: %+v", r)
  1595. }
  1596. }
  1597. }()
  1598. buff := ctx.Buffer
  1599. buff.WriteUInt8(DefaultCodecVersion) // version
  1600. if ctx.IsStringTable() {
  1601. a := ctx.Table.AddOrGet(target.UID)
  1602. buff.WriteInt(a) // write table index
  1603. } else {
  1604. buff.WriteString(target.UID) // write string
  1605. }
  1606. if ctx.IsStringTable() {
  1607. b := ctx.Table.AddOrGet(target.NamespaceUID)
  1608. buff.WriteInt(b) // write table index
  1609. } else {
  1610. buff.WriteString(target.NamespaceUID) // write string
  1611. }
  1612. if ctx.IsStringTable() {
  1613. c := ctx.Table.AddOrGet(target.Name)
  1614. buff.WriteInt(c) // write table index
  1615. } else {
  1616. buff.WriteString(target.Name) // write string
  1617. }
  1618. if target.Labels == nil {
  1619. buff.WriteUInt8(uint8(0)) // write nil byte
  1620. } else {
  1621. buff.WriteUInt8(uint8(1)) // write non-nil byte
  1622. // --- [begin][write][map](map[string]string) ---
  1623. buff.WriteInt(len(target.Labels)) // map length
  1624. for v, z := range target.Labels {
  1625. if ctx.IsStringTable() {
  1626. d := ctx.Table.AddOrGet(v)
  1627. buff.WriteInt(d) // write table index
  1628. } else {
  1629. buff.WriteString(v) // write string
  1630. }
  1631. if ctx.IsStringTable() {
  1632. e := ctx.Table.AddOrGet(z)
  1633. buff.WriteInt(e) // write table index
  1634. } else {
  1635. buff.WriteString(z) // write string
  1636. }
  1637. }
  1638. // --- [end][write][map](map[string]string) ---
  1639. }
  1640. if target.Annotations == nil {
  1641. buff.WriteUInt8(uint8(0)) // write nil byte
  1642. } else {
  1643. buff.WriteUInt8(uint8(1)) // write non-nil byte
  1644. // --- [begin][write][map](map[string]string) ---
  1645. buff.WriteInt(len(target.Annotations)) // map length
  1646. for vv, zz := range target.Annotations {
  1647. if ctx.IsStringTable() {
  1648. f := ctx.Table.AddOrGet(vv)
  1649. buff.WriteInt(f) // write table index
  1650. } else {
  1651. buff.WriteString(vv) // write string
  1652. }
  1653. if ctx.IsStringTable() {
  1654. g := ctx.Table.AddOrGet(zz)
  1655. buff.WriteInt(g) // write table index
  1656. } else {
  1657. buff.WriteString(zz) // write string
  1658. }
  1659. }
  1660. // --- [end][write][map](map[string]string) ---
  1661. }
  1662. if target.DevicePluginInfo == nil {
  1663. buff.WriteUInt8(uint8(0)) // write nil byte
  1664. } else {
  1665. buff.WriteUInt8(uint8(1)) // write non-nil byte
  1666. // --- [begin][write][map](map[string]string) ---
  1667. buff.WriteInt(len(target.DevicePluginInfo)) // map length
  1668. for vvv, zzz := range target.DevicePluginInfo {
  1669. if ctx.IsStringTable() {
  1670. h := ctx.Table.AddOrGet(vvv)
  1671. buff.WriteInt(h) // write table index
  1672. } else {
  1673. buff.WriteString(vvv) // write string
  1674. }
  1675. if ctx.IsStringTable() {
  1676. l := ctx.Table.AddOrGet(zzz)
  1677. buff.WriteInt(l) // write table index
  1678. } else {
  1679. buff.WriteString(zzz) // write string
  1680. }
  1681. }
  1682. // --- [end][write][map](map[string]string) ---
  1683. }
  1684. // --- [begin][write][reference](time.Time) ---
  1685. m, errA := target.Start.MarshalBinary()
  1686. if errA != nil {
  1687. return errA
  1688. }
  1689. buff.WriteInt(len(m))
  1690. buff.WriteBytes(m)
  1691. // --- [end][write][reference](time.Time) ---
  1692. // --- [begin][write][reference](time.Time) ---
  1693. n, errB := target.End.MarshalBinary()
  1694. if errB != nil {
  1695. return errB
  1696. }
  1697. buff.WriteInt(len(n))
  1698. buff.WriteBytes(n)
  1699. // --- [end][write][reference](time.Time) ---
  1700. return nil
  1701. }
  1702. // UnmarshalBinary uses the data passed byte array to set all the internal properties of
  1703. // the DaemonSet type
  1704. func (target *DaemonSet) UnmarshalBinary(data []byte) error {
  1705. ctx := NewDecodingContextFromBytes(data)
  1706. defer ctx.Close()
  1707. err := target.UnmarshalBinaryWithContext(ctx)
  1708. if err != nil {
  1709. return err
  1710. }
  1711. return nil
  1712. }
  1713. // UnmarshalBinaryFromReader uses the io.Reader data to set all the internal properties of
  1714. // the DaemonSet type
  1715. func (target *DaemonSet) UnmarshalBinaryFromReader(reader io.Reader) error {
  1716. ctx := NewDecodingContextFromReader(reader)
  1717. defer ctx.Close()
  1718. err := target.UnmarshalBinaryWithContext(ctx)
  1719. if err != nil {
  1720. return err
  1721. }
  1722. return nil
  1723. }
  1724. // UnmarshalBinaryWithContext uses the context containing a string table and binary buffer to set all the internal properties of
  1725. // the DaemonSet type
  1726. func (target *DaemonSet) UnmarshalBinaryWithContext(ctx *DecodingContext) (err error) {
  1727. // panics are recovered and propagated as errors
  1728. defer func() {
  1729. if r := recover(); r != nil {
  1730. if e, ok := r.(error); ok {
  1731. err = e
  1732. } else if s, ok := r.(string); ok {
  1733. err = fmt.Errorf("unexpected panic: %s", s)
  1734. } else {
  1735. err = fmt.Errorf("unexpected panic: %+v", r)
  1736. }
  1737. }
  1738. }()
  1739. buff := ctx.Buffer
  1740. version := buff.ReadUInt8()
  1741. if version > DefaultCodecVersion {
  1742. return fmt.Errorf("Invalid Version Unmarshalling DaemonSet. Expected %d or less, got %d", DefaultCodecVersion, version)
  1743. }
  1744. var b string
  1745. if ctx.IsStringTable() {
  1746. c := buff.ReadInt() // read string index
  1747. b = ctx.Table.At(c)
  1748. } else {
  1749. b = buff.ReadString() // read string
  1750. }
  1751. a := b
  1752. target.UID = a
  1753. var e string
  1754. if ctx.IsStringTable() {
  1755. f := buff.ReadInt() // read string index
  1756. e = ctx.Table.At(f)
  1757. } else {
  1758. e = buff.ReadString() // read string
  1759. }
  1760. d := e
  1761. target.NamespaceUID = d
  1762. var h string
  1763. if ctx.IsStringTable() {
  1764. l := buff.ReadInt() // read string index
  1765. h = ctx.Table.At(l)
  1766. } else {
  1767. h = buff.ReadString() // read string
  1768. }
  1769. g := h
  1770. target.Name = g
  1771. if buff.ReadUInt8() == uint8(0) {
  1772. target.Labels = nil
  1773. } else {
  1774. // --- [begin][read][map](map[string]string) ---
  1775. n := buff.ReadInt() // map len
  1776. m := make(map[string]string, n)
  1777. for range n {
  1778. var v string
  1779. var p string
  1780. if ctx.IsStringTable() {
  1781. q := buff.ReadInt() // read string index
  1782. p = ctx.Table.At(q)
  1783. } else {
  1784. p = buff.ReadString() // read string
  1785. }
  1786. o := p
  1787. v = o
  1788. var z string
  1789. var s string
  1790. if ctx.IsStringTable() {
  1791. t := buff.ReadInt() // read string index
  1792. s = ctx.Table.At(t)
  1793. } else {
  1794. s = buff.ReadString() // read string
  1795. }
  1796. r := s
  1797. z = r
  1798. m[v] = z
  1799. }
  1800. target.Labels = m
  1801. // --- [end][read][map](map[string]string) ---
  1802. }
  1803. if buff.ReadUInt8() == uint8(0) {
  1804. target.Annotations = nil
  1805. } else {
  1806. // --- [begin][read][map](map[string]string) ---
  1807. w := buff.ReadInt() // map len
  1808. u := make(map[string]string, w)
  1809. for range w {
  1810. var vv string
  1811. var y string
  1812. if ctx.IsStringTable() {
  1813. aa := buff.ReadInt() // read string index
  1814. y = ctx.Table.At(aa)
  1815. } else {
  1816. y = buff.ReadString() // read string
  1817. }
  1818. x := y
  1819. vv = x
  1820. var zz string
  1821. var cc string
  1822. if ctx.IsStringTable() {
  1823. dd := buff.ReadInt() // read string index
  1824. cc = ctx.Table.At(dd)
  1825. } else {
  1826. cc = buff.ReadString() // read string
  1827. }
  1828. bb := cc
  1829. zz = bb
  1830. u[vv] = zz
  1831. }
  1832. target.Annotations = u
  1833. // --- [end][read][map](map[string]string) ---
  1834. }
  1835. if buff.ReadUInt8() == uint8(0) {
  1836. target.DevicePluginInfo = nil
  1837. } else {
  1838. // --- [begin][read][map](map[string]string) ---
  1839. ff := buff.ReadInt() // map len
  1840. ee := make(map[string]string, ff)
  1841. for range ff {
  1842. var vvv string
  1843. var hh string
  1844. if ctx.IsStringTable() {
  1845. ll := buff.ReadInt() // read string index
  1846. hh = ctx.Table.At(ll)
  1847. } else {
  1848. hh = buff.ReadString() // read string
  1849. }
  1850. gg := hh
  1851. vvv = gg
  1852. var zzz string
  1853. var nn string
  1854. if ctx.IsStringTable() {
  1855. oo := buff.ReadInt() // read string index
  1856. nn = ctx.Table.At(oo)
  1857. } else {
  1858. nn = buff.ReadString() // read string
  1859. }
  1860. mm := nn
  1861. zzz = mm
  1862. ee[vvv] = zzz
  1863. }
  1864. target.DevicePluginInfo = ee
  1865. // --- [end][read][map](map[string]string) ---
  1866. }
  1867. // --- [begin][read][reference](time.Time) ---
  1868. pp := new(time.Time)
  1869. qq := buff.ReadInt() // byte array length
  1870. rr := buff.ReadBytes(qq)
  1871. errA := pp.UnmarshalBinary(rr)
  1872. if errA != nil {
  1873. return errA
  1874. }
  1875. target.Start = *pp
  1876. // --- [end][read][reference](time.Time) ---
  1877. // --- [begin][read][reference](time.Time) ---
  1878. ss := new(time.Time)
  1879. tt := buff.ReadInt() // byte array length
  1880. uu := buff.ReadBytes(tt)
  1881. errB := ss.UnmarshalBinary(uu)
  1882. if errB != nil {
  1883. return errB
  1884. }
  1885. target.End = *ss
  1886. // --- [end][read][reference](time.Time) ---
  1887. return nil
  1888. }
  1889. //--------------------------------------------------------------------------
  1890. // Deployment
  1891. //--------------------------------------------------------------------------
  1892. // MarshalBinary serializes the internal properties of this Deployment instance
  1893. // into a byte array
  1894. func (target *Deployment) MarshalBinary() (data []byte, err error) {
  1895. ctx := NewEncodingContext(nil)
  1896. e := target.MarshalBinaryWithContext(ctx)
  1897. if e != nil {
  1898. return nil, e
  1899. }
  1900. return ctx.ToBytes(), nil
  1901. }
  1902. // MarshalBinary serializes the internal properties of this Deployment instance
  1903. // into an io.Writer.
  1904. func (target *Deployment) MarshalBinaryTo(writer io.Writer) error {
  1905. buff := util.NewBufferFromWriter(writer)
  1906. defer buff.Flush()
  1907. ctx := NewEncodingContextFromBuffer(buff, nil)
  1908. return target.MarshalBinaryWithContext(ctx)
  1909. }
  1910. // MarshalBinaryWithContext serializes the internal properties of this Deployment instance
  1911. // into a byte array leveraging a predefined context.
  1912. func (target *Deployment) MarshalBinaryWithContext(ctx *EncodingContext) (err error) {
  1913. // panics are recovered and propagated as errors
  1914. defer func() {
  1915. if r := recover(); r != nil {
  1916. if e, ok := r.(error); ok {
  1917. err = e
  1918. } else if s, ok := r.(string); ok {
  1919. err = fmt.Errorf("unexpected panic: %s", s)
  1920. } else {
  1921. err = fmt.Errorf("unexpected panic: %+v", r)
  1922. }
  1923. }
  1924. }()
  1925. buff := ctx.Buffer
  1926. buff.WriteUInt8(DefaultCodecVersion) // version
  1927. if ctx.IsStringTable() {
  1928. a := ctx.Table.AddOrGet(target.UID)
  1929. buff.WriteInt(a) // write table index
  1930. } else {
  1931. buff.WriteString(target.UID) // write string
  1932. }
  1933. if ctx.IsStringTable() {
  1934. b := ctx.Table.AddOrGet(target.NamespaceUID)
  1935. buff.WriteInt(b) // write table index
  1936. } else {
  1937. buff.WriteString(target.NamespaceUID) // write string
  1938. }
  1939. if ctx.IsStringTable() {
  1940. c := ctx.Table.AddOrGet(target.Name)
  1941. buff.WriteInt(c) // write table index
  1942. } else {
  1943. buff.WriteString(target.Name) // write string
  1944. }
  1945. if target.Labels == nil {
  1946. buff.WriteUInt8(uint8(0)) // write nil byte
  1947. } else {
  1948. buff.WriteUInt8(uint8(1)) // write non-nil byte
  1949. // --- [begin][write][map](map[string]string) ---
  1950. buff.WriteInt(len(target.Labels)) // map length
  1951. for v, z := range target.Labels {
  1952. if ctx.IsStringTable() {
  1953. d := ctx.Table.AddOrGet(v)
  1954. buff.WriteInt(d) // write table index
  1955. } else {
  1956. buff.WriteString(v) // write string
  1957. }
  1958. if ctx.IsStringTable() {
  1959. e := ctx.Table.AddOrGet(z)
  1960. buff.WriteInt(e) // write table index
  1961. } else {
  1962. buff.WriteString(z) // write string
  1963. }
  1964. }
  1965. // --- [end][write][map](map[string]string) ---
  1966. }
  1967. if target.Annotations == nil {
  1968. buff.WriteUInt8(uint8(0)) // write nil byte
  1969. } else {
  1970. buff.WriteUInt8(uint8(1)) // write non-nil byte
  1971. // --- [begin][write][map](map[string]string) ---
  1972. buff.WriteInt(len(target.Annotations)) // map length
  1973. for vv, zz := range target.Annotations {
  1974. if ctx.IsStringTable() {
  1975. f := ctx.Table.AddOrGet(vv)
  1976. buff.WriteInt(f) // write table index
  1977. } else {
  1978. buff.WriteString(vv) // write string
  1979. }
  1980. if ctx.IsStringTable() {
  1981. g := ctx.Table.AddOrGet(zz)
  1982. buff.WriteInt(g) // write table index
  1983. } else {
  1984. buff.WriteString(zz) // write string
  1985. }
  1986. }
  1987. // --- [end][write][map](map[string]string) ---
  1988. }
  1989. if target.MatchLabels == nil {
  1990. buff.WriteUInt8(uint8(0)) // write nil byte
  1991. } else {
  1992. buff.WriteUInt8(uint8(1)) // write non-nil byte
  1993. // --- [begin][write][map](map[string]string) ---
  1994. buff.WriteInt(len(target.MatchLabels)) // map length
  1995. for vvv, zzz := range target.MatchLabels {
  1996. if ctx.IsStringTable() {
  1997. h := ctx.Table.AddOrGet(vvv)
  1998. buff.WriteInt(h) // write table index
  1999. } else {
  2000. buff.WriteString(vvv) // write string
  2001. }
  2002. if ctx.IsStringTable() {
  2003. l := ctx.Table.AddOrGet(zzz)
  2004. buff.WriteInt(l) // write table index
  2005. } else {
  2006. buff.WriteString(zzz) // write string
  2007. }
  2008. }
  2009. // --- [end][write][map](map[string]string) ---
  2010. }
  2011. // --- [begin][write][reference](time.Time) ---
  2012. m, errA := target.Start.MarshalBinary()
  2013. if errA != nil {
  2014. return errA
  2015. }
  2016. buff.WriteInt(len(m))
  2017. buff.WriteBytes(m)
  2018. // --- [end][write][reference](time.Time) ---
  2019. // --- [begin][write][reference](time.Time) ---
  2020. n, errB := target.End.MarshalBinary()
  2021. if errB != nil {
  2022. return errB
  2023. }
  2024. buff.WriteInt(len(n))
  2025. buff.WriteBytes(n)
  2026. // --- [end][write][reference](time.Time) ---
  2027. return nil
  2028. }
  2029. // UnmarshalBinary uses the data passed byte array to set all the internal properties of
  2030. // the Deployment type
  2031. func (target *Deployment) UnmarshalBinary(data []byte) error {
  2032. ctx := NewDecodingContextFromBytes(data)
  2033. defer ctx.Close()
  2034. err := target.UnmarshalBinaryWithContext(ctx)
  2035. if err != nil {
  2036. return err
  2037. }
  2038. return nil
  2039. }
  2040. // UnmarshalBinaryFromReader uses the io.Reader data to set all the internal properties of
  2041. // the Deployment type
  2042. func (target *Deployment) UnmarshalBinaryFromReader(reader io.Reader) error {
  2043. ctx := NewDecodingContextFromReader(reader)
  2044. defer ctx.Close()
  2045. err := target.UnmarshalBinaryWithContext(ctx)
  2046. if err != nil {
  2047. return err
  2048. }
  2049. return nil
  2050. }
  2051. // UnmarshalBinaryWithContext uses the context containing a string table and binary buffer to set all the internal properties of
  2052. // the Deployment type
  2053. func (target *Deployment) UnmarshalBinaryWithContext(ctx *DecodingContext) (err error) {
  2054. // panics are recovered and propagated as errors
  2055. defer func() {
  2056. if r := recover(); r != nil {
  2057. if e, ok := r.(error); ok {
  2058. err = e
  2059. } else if s, ok := r.(string); ok {
  2060. err = fmt.Errorf("unexpected panic: %s", s)
  2061. } else {
  2062. err = fmt.Errorf("unexpected panic: %+v", r)
  2063. }
  2064. }
  2065. }()
  2066. buff := ctx.Buffer
  2067. version := buff.ReadUInt8()
  2068. if version > DefaultCodecVersion {
  2069. return fmt.Errorf("Invalid Version Unmarshalling Deployment. Expected %d or less, got %d", DefaultCodecVersion, version)
  2070. }
  2071. var b string
  2072. if ctx.IsStringTable() {
  2073. c := buff.ReadInt() // read string index
  2074. b = ctx.Table.At(c)
  2075. } else {
  2076. b = buff.ReadString() // read string
  2077. }
  2078. a := b
  2079. target.UID = a
  2080. var e string
  2081. if ctx.IsStringTable() {
  2082. f := buff.ReadInt() // read string index
  2083. e = ctx.Table.At(f)
  2084. } else {
  2085. e = buff.ReadString() // read string
  2086. }
  2087. d := e
  2088. target.NamespaceUID = d
  2089. var h string
  2090. if ctx.IsStringTable() {
  2091. l := buff.ReadInt() // read string index
  2092. h = ctx.Table.At(l)
  2093. } else {
  2094. h = buff.ReadString() // read string
  2095. }
  2096. g := h
  2097. target.Name = g
  2098. if buff.ReadUInt8() == uint8(0) {
  2099. target.Labels = nil
  2100. } else {
  2101. // --- [begin][read][map](map[string]string) ---
  2102. n := buff.ReadInt() // map len
  2103. m := make(map[string]string, n)
  2104. for range n {
  2105. var v string
  2106. var p string
  2107. if ctx.IsStringTable() {
  2108. q := buff.ReadInt() // read string index
  2109. p = ctx.Table.At(q)
  2110. } else {
  2111. p = buff.ReadString() // read string
  2112. }
  2113. o := p
  2114. v = o
  2115. var z string
  2116. var s string
  2117. if ctx.IsStringTable() {
  2118. t := buff.ReadInt() // read string index
  2119. s = ctx.Table.At(t)
  2120. } else {
  2121. s = buff.ReadString() // read string
  2122. }
  2123. r := s
  2124. z = r
  2125. m[v] = z
  2126. }
  2127. target.Labels = m
  2128. // --- [end][read][map](map[string]string) ---
  2129. }
  2130. if buff.ReadUInt8() == uint8(0) {
  2131. target.Annotations = nil
  2132. } else {
  2133. // --- [begin][read][map](map[string]string) ---
  2134. w := buff.ReadInt() // map len
  2135. u := make(map[string]string, w)
  2136. for range w {
  2137. var vv string
  2138. var y string
  2139. if ctx.IsStringTable() {
  2140. aa := buff.ReadInt() // read string index
  2141. y = ctx.Table.At(aa)
  2142. } else {
  2143. y = buff.ReadString() // read string
  2144. }
  2145. x := y
  2146. vv = x
  2147. var zz string
  2148. var cc string
  2149. if ctx.IsStringTable() {
  2150. dd := buff.ReadInt() // read string index
  2151. cc = ctx.Table.At(dd)
  2152. } else {
  2153. cc = buff.ReadString() // read string
  2154. }
  2155. bb := cc
  2156. zz = bb
  2157. u[vv] = zz
  2158. }
  2159. target.Annotations = u
  2160. // --- [end][read][map](map[string]string) ---
  2161. }
  2162. if buff.ReadUInt8() == uint8(0) {
  2163. target.MatchLabels = nil
  2164. } else {
  2165. // --- [begin][read][map](map[string]string) ---
  2166. ff := buff.ReadInt() // map len
  2167. ee := make(map[string]string, ff)
  2168. for range ff {
  2169. var vvv string
  2170. var hh string
  2171. if ctx.IsStringTable() {
  2172. ll := buff.ReadInt() // read string index
  2173. hh = ctx.Table.At(ll)
  2174. } else {
  2175. hh = buff.ReadString() // read string
  2176. }
  2177. gg := hh
  2178. vvv = gg
  2179. var zzz string
  2180. var nn string
  2181. if ctx.IsStringTable() {
  2182. oo := buff.ReadInt() // read string index
  2183. nn = ctx.Table.At(oo)
  2184. } else {
  2185. nn = buff.ReadString() // read string
  2186. }
  2187. mm := nn
  2188. zzz = mm
  2189. ee[vvv] = zzz
  2190. }
  2191. target.MatchLabels = ee
  2192. // --- [end][read][map](map[string]string) ---
  2193. }
  2194. // --- [begin][read][reference](time.Time) ---
  2195. pp := new(time.Time)
  2196. qq := buff.ReadInt() // byte array length
  2197. rr := buff.ReadBytes(qq)
  2198. errA := pp.UnmarshalBinary(rr)
  2199. if errA != nil {
  2200. return errA
  2201. }
  2202. target.Start = *pp
  2203. // --- [end][read][reference](time.Time) ---
  2204. // --- [begin][read][reference](time.Time) ---
  2205. ss := new(time.Time)
  2206. tt := buff.ReadInt() // byte array length
  2207. uu := buff.ReadBytes(tt)
  2208. errB := ss.UnmarshalBinary(uu)
  2209. if errB != nil {
  2210. return errB
  2211. }
  2212. target.End = *ss
  2213. // --- [end][read][reference](time.Time) ---
  2214. return nil
  2215. }
  2216. //--------------------------------------------------------------------------
  2217. // Diagnostic
  2218. //--------------------------------------------------------------------------
  2219. // MarshalBinary serializes the internal properties of this Diagnostic instance
  2220. // into a byte array
  2221. func (target *Diagnostic) MarshalBinary() (data []byte, err error) {
  2222. ctx := NewEncodingContext(nil)
  2223. e := target.MarshalBinaryWithContext(ctx)
  2224. if e != nil {
  2225. return nil, e
  2226. }
  2227. return ctx.ToBytes(), nil
  2228. }
  2229. // MarshalBinary serializes the internal properties of this Diagnostic instance
  2230. // into an io.Writer.
  2231. func (target *Diagnostic) MarshalBinaryTo(writer io.Writer) error {
  2232. buff := util.NewBufferFromWriter(writer)
  2233. defer buff.Flush()
  2234. ctx := NewEncodingContextFromBuffer(buff, nil)
  2235. return target.MarshalBinaryWithContext(ctx)
  2236. }
  2237. // MarshalBinaryWithContext serializes the internal properties of this Diagnostic instance
  2238. // into a byte array leveraging a predefined context.
  2239. func (target *Diagnostic) MarshalBinaryWithContext(ctx *EncodingContext) (err error) {
  2240. // panics are recovered and propagated as errors
  2241. defer func() {
  2242. if r := recover(); r != nil {
  2243. if e, ok := r.(error); ok {
  2244. err = e
  2245. } else if s, ok := r.(string); ok {
  2246. err = fmt.Errorf("unexpected panic: %s", s)
  2247. } else {
  2248. err = fmt.Errorf("unexpected panic: %+v", r)
  2249. }
  2250. }
  2251. }()
  2252. buff := ctx.Buffer
  2253. buff.WriteUInt8(DefaultCodecVersion) // version
  2254. // --- [begin][write][reference](time.Time) ---
  2255. a, errA := target.Timestamp.MarshalBinary()
  2256. if errA != nil {
  2257. return errA
  2258. }
  2259. buff.WriteInt(len(a))
  2260. buff.WriteBytes(a)
  2261. // --- [end][write][reference](time.Time) ---
  2262. // --- [begin][write][alias](DiagnosticLevel) ---
  2263. buff.WriteInt(int(target.Level)) // write int
  2264. // --- [end][write][alias](DiagnosticLevel) ---
  2265. if ctx.IsStringTable() {
  2266. b := ctx.Table.AddOrGet(target.Message)
  2267. buff.WriteInt(b) // write table index
  2268. } else {
  2269. buff.WriteString(target.Message) // write string
  2270. }
  2271. if target.Details == nil {
  2272. buff.WriteUInt8(uint8(0)) // write nil byte
  2273. } else {
  2274. buff.WriteUInt8(uint8(1)) // write non-nil byte
  2275. // --- [begin][write][map](map[string]string) ---
  2276. buff.WriteInt(len(target.Details)) // map length
  2277. for v, z := range target.Details {
  2278. if ctx.IsStringTable() {
  2279. c := ctx.Table.AddOrGet(v)
  2280. buff.WriteInt(c) // write table index
  2281. } else {
  2282. buff.WriteString(v) // write string
  2283. }
  2284. if ctx.IsStringTable() {
  2285. d := ctx.Table.AddOrGet(z)
  2286. buff.WriteInt(d) // write table index
  2287. } else {
  2288. buff.WriteString(z) // write string
  2289. }
  2290. }
  2291. // --- [end][write][map](map[string]string) ---
  2292. }
  2293. return nil
  2294. }
  2295. // UnmarshalBinary uses the data passed byte array to set all the internal properties of
  2296. // the Diagnostic type
  2297. func (target *Diagnostic) UnmarshalBinary(data []byte) error {
  2298. ctx := NewDecodingContextFromBytes(data)
  2299. defer ctx.Close()
  2300. err := target.UnmarshalBinaryWithContext(ctx)
  2301. if err != nil {
  2302. return err
  2303. }
  2304. return nil
  2305. }
  2306. // UnmarshalBinaryFromReader uses the io.Reader data to set all the internal properties of
  2307. // the Diagnostic type
  2308. func (target *Diagnostic) UnmarshalBinaryFromReader(reader io.Reader) error {
  2309. ctx := NewDecodingContextFromReader(reader)
  2310. defer ctx.Close()
  2311. err := target.UnmarshalBinaryWithContext(ctx)
  2312. if err != nil {
  2313. return err
  2314. }
  2315. return nil
  2316. }
  2317. // UnmarshalBinaryWithContext uses the context containing a string table and binary buffer to set all the internal properties of
  2318. // the Diagnostic type
  2319. func (target *Diagnostic) UnmarshalBinaryWithContext(ctx *DecodingContext) (err error) {
  2320. // panics are recovered and propagated as errors
  2321. defer func() {
  2322. if r := recover(); r != nil {
  2323. if e, ok := r.(error); ok {
  2324. err = e
  2325. } else if s, ok := r.(string); ok {
  2326. err = fmt.Errorf("unexpected panic: %s", s)
  2327. } else {
  2328. err = fmt.Errorf("unexpected panic: %+v", r)
  2329. }
  2330. }
  2331. }()
  2332. buff := ctx.Buffer
  2333. version := buff.ReadUInt8()
  2334. if version > DefaultCodecVersion {
  2335. return fmt.Errorf("Invalid Version Unmarshalling Diagnostic. Expected %d or less, got %d", DefaultCodecVersion, version)
  2336. }
  2337. // field version check
  2338. if uint8(1) <= version {
  2339. // --- [begin][read][reference](time.Time) ---
  2340. a := new(time.Time)
  2341. b := buff.ReadInt() // byte array length
  2342. c := buff.ReadBytes(b)
  2343. errA := a.UnmarshalBinary(c)
  2344. if errA != nil {
  2345. return errA
  2346. }
  2347. target.Timestamp = *a
  2348. // --- [end][read][reference](time.Time) ---
  2349. } else {
  2350. }
  2351. // field version check
  2352. if uint8(1) <= version {
  2353. // --- [begin][read][alias](DiagnosticLevel) ---
  2354. var d int
  2355. e := buff.ReadInt() // read int
  2356. d = e
  2357. target.Level = DiagnosticLevel(d)
  2358. // --- [end][read][alias](DiagnosticLevel) ---
  2359. } else {
  2360. }
  2361. // field version check
  2362. if uint8(1) <= version {
  2363. var g string
  2364. if ctx.IsStringTable() {
  2365. h := buff.ReadInt() // read string index
  2366. g = ctx.Table.At(h)
  2367. } else {
  2368. g = buff.ReadString() // read string
  2369. }
  2370. f := g
  2371. target.Message = f
  2372. } else {
  2373. target.Message = "" // default
  2374. }
  2375. // field version check
  2376. if uint8(1) <= version {
  2377. if buff.ReadUInt8() == uint8(0) {
  2378. target.Details = nil
  2379. } else {
  2380. // --- [begin][read][map](map[string]string) ---
  2381. m := buff.ReadInt() // map len
  2382. l := make(map[string]string, m)
  2383. for range m {
  2384. var v string
  2385. var o string
  2386. if ctx.IsStringTable() {
  2387. p := buff.ReadInt() // read string index
  2388. o = ctx.Table.At(p)
  2389. } else {
  2390. o = buff.ReadString() // read string
  2391. }
  2392. n := o
  2393. v = n
  2394. var z string
  2395. var r string
  2396. if ctx.IsStringTable() {
  2397. s := buff.ReadInt() // read string index
  2398. r = ctx.Table.At(s)
  2399. } else {
  2400. r = buff.ReadString() // read string
  2401. }
  2402. q := r
  2403. z = q
  2404. l[v] = z
  2405. }
  2406. target.Details = l
  2407. // --- [end][read][map](map[string]string) ---
  2408. }
  2409. } else {
  2410. target.Details = nil
  2411. }
  2412. return nil
  2413. }
  2414. //--------------------------------------------------------------------------
  2415. // FileSystem
  2416. //--------------------------------------------------------------------------
  2417. // MarshalBinary serializes the internal properties of this FileSystem instance
  2418. // into a byte array
  2419. func (target *FileSystem) MarshalBinary() (data []byte, err error) {
  2420. ctx := NewEncodingContext(nil)
  2421. e := target.MarshalBinaryWithContext(ctx)
  2422. if e != nil {
  2423. return nil, e
  2424. }
  2425. return ctx.ToBytes(), nil
  2426. }
  2427. // MarshalBinary serializes the internal properties of this FileSystem instance
  2428. // into an io.Writer.
  2429. func (target *FileSystem) MarshalBinaryTo(writer io.Writer) error {
  2430. buff := util.NewBufferFromWriter(writer)
  2431. defer buff.Flush()
  2432. ctx := NewEncodingContextFromBuffer(buff, nil)
  2433. return target.MarshalBinaryWithContext(ctx)
  2434. }
  2435. // MarshalBinaryWithContext serializes the internal properties of this FileSystem instance
  2436. // into a byte array leveraging a predefined context.
  2437. func (target *FileSystem) MarshalBinaryWithContext(ctx *EncodingContext) (err error) {
  2438. // panics are recovered and propagated as errors
  2439. defer func() {
  2440. if r := recover(); r != nil {
  2441. if e, ok := r.(error); ok {
  2442. err = e
  2443. } else if s, ok := r.(string); ok {
  2444. err = fmt.Errorf("unexpected panic: %s", s)
  2445. } else {
  2446. err = fmt.Errorf("unexpected panic: %+v", r)
  2447. }
  2448. }
  2449. }()
  2450. buff := ctx.Buffer
  2451. buff.WriteUInt8(DefaultCodecVersion) // version
  2452. buff.WriteFloat64(target.CapacityBytes) // write float64
  2453. buff.WriteFloat64(target.UsageByteAvg) // write float64
  2454. buff.WriteFloat64(target.UsageByteMax) // write float64
  2455. return nil
  2456. }
  2457. // UnmarshalBinary uses the data passed byte array to set all the internal properties of
  2458. // the FileSystem type
  2459. func (target *FileSystem) UnmarshalBinary(data []byte) error {
  2460. ctx := NewDecodingContextFromBytes(data)
  2461. defer ctx.Close()
  2462. err := target.UnmarshalBinaryWithContext(ctx)
  2463. if err != nil {
  2464. return err
  2465. }
  2466. return nil
  2467. }
  2468. // UnmarshalBinaryFromReader uses the io.Reader data to set all the internal properties of
  2469. // the FileSystem type
  2470. func (target *FileSystem) UnmarshalBinaryFromReader(reader io.Reader) error {
  2471. ctx := NewDecodingContextFromReader(reader)
  2472. defer ctx.Close()
  2473. err := target.UnmarshalBinaryWithContext(ctx)
  2474. if err != nil {
  2475. return err
  2476. }
  2477. return nil
  2478. }
  2479. // UnmarshalBinaryWithContext uses the context containing a string table and binary buffer to set all the internal properties of
  2480. // the FileSystem type
  2481. func (target *FileSystem) UnmarshalBinaryWithContext(ctx *DecodingContext) (err error) {
  2482. // panics are recovered and propagated as errors
  2483. defer func() {
  2484. if r := recover(); r != nil {
  2485. if e, ok := r.(error); ok {
  2486. err = e
  2487. } else if s, ok := r.(string); ok {
  2488. err = fmt.Errorf("unexpected panic: %s", s)
  2489. } else {
  2490. err = fmt.Errorf("unexpected panic: %+v", r)
  2491. }
  2492. }
  2493. }()
  2494. buff := ctx.Buffer
  2495. version := buff.ReadUInt8()
  2496. if version > DefaultCodecVersion {
  2497. return fmt.Errorf("Invalid Version Unmarshalling FileSystem. Expected %d or less, got %d", DefaultCodecVersion, version)
  2498. }
  2499. a := buff.ReadFloat64() // read float64
  2500. target.CapacityBytes = a
  2501. b := buff.ReadFloat64() // read float64
  2502. target.UsageByteAvg = b
  2503. c := buff.ReadFloat64() // read float64
  2504. target.UsageByteMax = c
  2505. return nil
  2506. }
  2507. //--------------------------------------------------------------------------
  2508. // Job
  2509. //--------------------------------------------------------------------------
  2510. // MarshalBinary serializes the internal properties of this Job instance
  2511. // into a byte array
  2512. func (target *Job) MarshalBinary() (data []byte, err error) {
  2513. ctx := NewEncodingContext(nil)
  2514. e := target.MarshalBinaryWithContext(ctx)
  2515. if e != nil {
  2516. return nil, e
  2517. }
  2518. return ctx.ToBytes(), nil
  2519. }
  2520. // MarshalBinary serializes the internal properties of this Job instance
  2521. // into an io.Writer.
  2522. func (target *Job) MarshalBinaryTo(writer io.Writer) error {
  2523. buff := util.NewBufferFromWriter(writer)
  2524. defer buff.Flush()
  2525. ctx := NewEncodingContextFromBuffer(buff, nil)
  2526. return target.MarshalBinaryWithContext(ctx)
  2527. }
  2528. // MarshalBinaryWithContext serializes the internal properties of this Job instance
  2529. // into a byte array leveraging a predefined context.
  2530. func (target *Job) MarshalBinaryWithContext(ctx *EncodingContext) (err error) {
  2531. // panics are recovered and propagated as errors
  2532. defer func() {
  2533. if r := recover(); r != nil {
  2534. if e, ok := r.(error); ok {
  2535. err = e
  2536. } else if s, ok := r.(string); ok {
  2537. err = fmt.Errorf("unexpected panic: %s", s)
  2538. } else {
  2539. err = fmt.Errorf("unexpected panic: %+v", r)
  2540. }
  2541. }
  2542. }()
  2543. buff := ctx.Buffer
  2544. buff.WriteUInt8(DefaultCodecVersion) // version
  2545. if ctx.IsStringTable() {
  2546. a := ctx.Table.AddOrGet(target.UID)
  2547. buff.WriteInt(a) // write table index
  2548. } else {
  2549. buff.WriteString(target.UID) // write string
  2550. }
  2551. if ctx.IsStringTable() {
  2552. b := ctx.Table.AddOrGet(target.NamespaceUID)
  2553. buff.WriteInt(b) // write table index
  2554. } else {
  2555. buff.WriteString(target.NamespaceUID) // write string
  2556. }
  2557. if ctx.IsStringTable() {
  2558. c := ctx.Table.AddOrGet(target.Name)
  2559. buff.WriteInt(c) // write table index
  2560. } else {
  2561. buff.WriteString(target.Name) // write string
  2562. }
  2563. if target.Labels == nil {
  2564. buff.WriteUInt8(uint8(0)) // write nil byte
  2565. } else {
  2566. buff.WriteUInt8(uint8(1)) // write non-nil byte
  2567. // --- [begin][write][map](map[string]string) ---
  2568. buff.WriteInt(len(target.Labels)) // map length
  2569. for v, z := range target.Labels {
  2570. if ctx.IsStringTable() {
  2571. d := ctx.Table.AddOrGet(v)
  2572. buff.WriteInt(d) // write table index
  2573. } else {
  2574. buff.WriteString(v) // write string
  2575. }
  2576. if ctx.IsStringTable() {
  2577. e := ctx.Table.AddOrGet(z)
  2578. buff.WriteInt(e) // write table index
  2579. } else {
  2580. buff.WriteString(z) // write string
  2581. }
  2582. }
  2583. // --- [end][write][map](map[string]string) ---
  2584. }
  2585. if target.Annotations == nil {
  2586. buff.WriteUInt8(uint8(0)) // write nil byte
  2587. } else {
  2588. buff.WriteUInt8(uint8(1)) // write non-nil byte
  2589. // --- [begin][write][map](map[string]string) ---
  2590. buff.WriteInt(len(target.Annotations)) // map length
  2591. for vv, zz := range target.Annotations {
  2592. if ctx.IsStringTable() {
  2593. f := ctx.Table.AddOrGet(vv)
  2594. buff.WriteInt(f) // write table index
  2595. } else {
  2596. buff.WriteString(vv) // write string
  2597. }
  2598. if ctx.IsStringTable() {
  2599. g := ctx.Table.AddOrGet(zz)
  2600. buff.WriteInt(g) // write table index
  2601. } else {
  2602. buff.WriteString(zz) // write string
  2603. }
  2604. }
  2605. // --- [end][write][map](map[string]string) ---
  2606. }
  2607. // --- [begin][write][reference](time.Time) ---
  2608. h, errA := target.Start.MarshalBinary()
  2609. if errA != nil {
  2610. return errA
  2611. }
  2612. buff.WriteInt(len(h))
  2613. buff.WriteBytes(h)
  2614. // --- [end][write][reference](time.Time) ---
  2615. // --- [begin][write][reference](time.Time) ---
  2616. l, errB := target.End.MarshalBinary()
  2617. if errB != nil {
  2618. return errB
  2619. }
  2620. buff.WriteInt(len(l))
  2621. buff.WriteBytes(l)
  2622. // --- [end][write][reference](time.Time) ---
  2623. return nil
  2624. }
  2625. // UnmarshalBinary uses the data passed byte array to set all the internal properties of
  2626. // the Job type
  2627. func (target *Job) UnmarshalBinary(data []byte) error {
  2628. ctx := NewDecodingContextFromBytes(data)
  2629. defer ctx.Close()
  2630. err := target.UnmarshalBinaryWithContext(ctx)
  2631. if err != nil {
  2632. return err
  2633. }
  2634. return nil
  2635. }
  2636. // UnmarshalBinaryFromReader uses the io.Reader data to set all the internal properties of
  2637. // the Job type
  2638. func (target *Job) UnmarshalBinaryFromReader(reader io.Reader) error {
  2639. ctx := NewDecodingContextFromReader(reader)
  2640. defer ctx.Close()
  2641. err := target.UnmarshalBinaryWithContext(ctx)
  2642. if err != nil {
  2643. return err
  2644. }
  2645. return nil
  2646. }
  2647. // UnmarshalBinaryWithContext uses the context containing a string table and binary buffer to set all the internal properties of
  2648. // the Job type
  2649. func (target *Job) UnmarshalBinaryWithContext(ctx *DecodingContext) (err error) {
  2650. // panics are recovered and propagated as errors
  2651. defer func() {
  2652. if r := recover(); r != nil {
  2653. if e, ok := r.(error); ok {
  2654. err = e
  2655. } else if s, ok := r.(string); ok {
  2656. err = fmt.Errorf("unexpected panic: %s", s)
  2657. } else {
  2658. err = fmt.Errorf("unexpected panic: %+v", r)
  2659. }
  2660. }
  2661. }()
  2662. buff := ctx.Buffer
  2663. version := buff.ReadUInt8()
  2664. if version > DefaultCodecVersion {
  2665. return fmt.Errorf("Invalid Version Unmarshalling Job. Expected %d or less, got %d", DefaultCodecVersion, version)
  2666. }
  2667. var b string
  2668. if ctx.IsStringTable() {
  2669. c := buff.ReadInt() // read string index
  2670. b = ctx.Table.At(c)
  2671. } else {
  2672. b = buff.ReadString() // read string
  2673. }
  2674. a := b
  2675. target.UID = a
  2676. var e string
  2677. if ctx.IsStringTable() {
  2678. f := buff.ReadInt() // read string index
  2679. e = ctx.Table.At(f)
  2680. } else {
  2681. e = buff.ReadString() // read string
  2682. }
  2683. d := e
  2684. target.NamespaceUID = d
  2685. var h string
  2686. if ctx.IsStringTable() {
  2687. l := buff.ReadInt() // read string index
  2688. h = ctx.Table.At(l)
  2689. } else {
  2690. h = buff.ReadString() // read string
  2691. }
  2692. g := h
  2693. target.Name = g
  2694. if buff.ReadUInt8() == uint8(0) {
  2695. target.Labels = nil
  2696. } else {
  2697. // --- [begin][read][map](map[string]string) ---
  2698. n := buff.ReadInt() // map len
  2699. m := make(map[string]string, n)
  2700. for range n {
  2701. var v string
  2702. var p string
  2703. if ctx.IsStringTable() {
  2704. q := buff.ReadInt() // read string index
  2705. p = ctx.Table.At(q)
  2706. } else {
  2707. p = buff.ReadString() // read string
  2708. }
  2709. o := p
  2710. v = o
  2711. var z string
  2712. var s string
  2713. if ctx.IsStringTable() {
  2714. t := buff.ReadInt() // read string index
  2715. s = ctx.Table.At(t)
  2716. } else {
  2717. s = buff.ReadString() // read string
  2718. }
  2719. r := s
  2720. z = r
  2721. m[v] = z
  2722. }
  2723. target.Labels = m
  2724. // --- [end][read][map](map[string]string) ---
  2725. }
  2726. if buff.ReadUInt8() == uint8(0) {
  2727. target.Annotations = nil
  2728. } else {
  2729. // --- [begin][read][map](map[string]string) ---
  2730. w := buff.ReadInt() // map len
  2731. u := make(map[string]string, w)
  2732. for range w {
  2733. var vv string
  2734. var y string
  2735. if ctx.IsStringTable() {
  2736. aa := buff.ReadInt() // read string index
  2737. y = ctx.Table.At(aa)
  2738. } else {
  2739. y = buff.ReadString() // read string
  2740. }
  2741. x := y
  2742. vv = x
  2743. var zz string
  2744. var cc string
  2745. if ctx.IsStringTable() {
  2746. dd := buff.ReadInt() // read string index
  2747. cc = ctx.Table.At(dd)
  2748. } else {
  2749. cc = buff.ReadString() // read string
  2750. }
  2751. bb := cc
  2752. zz = bb
  2753. u[vv] = zz
  2754. }
  2755. target.Annotations = u
  2756. // --- [end][read][map](map[string]string) ---
  2757. }
  2758. // --- [begin][read][reference](time.Time) ---
  2759. ee := new(time.Time)
  2760. ff := buff.ReadInt() // byte array length
  2761. gg := buff.ReadBytes(ff)
  2762. errA := ee.UnmarshalBinary(gg)
  2763. if errA != nil {
  2764. return errA
  2765. }
  2766. target.Start = *ee
  2767. // --- [end][read][reference](time.Time) ---
  2768. // --- [begin][read][reference](time.Time) ---
  2769. hh := new(time.Time)
  2770. ll := buff.ReadInt() // byte array length
  2771. mm := buff.ReadBytes(ll)
  2772. errB := hh.UnmarshalBinary(mm)
  2773. if errB != nil {
  2774. return errB
  2775. }
  2776. target.End = *hh
  2777. // --- [end][read][reference](time.Time) ---
  2778. return nil
  2779. }
  2780. //--------------------------------------------------------------------------
  2781. // KubeModelSet
  2782. //--------------------------------------------------------------------------
  2783. // MarshalBinary serializes the internal properties of this KubeModelSet instance
  2784. // into a byte array
  2785. func (target *KubeModelSet) MarshalBinary() (data []byte, err error) {
  2786. ctx := NewEncodingContext(stringtable.NewIndexedStringTableWriter())
  2787. e := target.MarshalBinaryWithContext(ctx)
  2788. if e != nil {
  2789. return nil, e
  2790. }
  2791. return ctx.ToBytes(), nil
  2792. }
  2793. // MarshalBinary serializes the internal properties of this KubeModelSet instance
  2794. // into an io.Writer.
  2795. func (target *KubeModelSet) MarshalBinaryTo(writer io.Writer) error {
  2796. buff := util.NewBufferFromWriter(writer)
  2797. defer buff.Flush()
  2798. // run a pre-pass to collect all strings into the string table and discard all writes to the main
  2799. // buffer. Then, we write the string table, sorted by number of repeated uses (descending), to the
  2800. // main buffer, and use the resulting table as part of the context for the main pass.
  2801. prepass := stringtable.NewPrepassStringTableWriter()
  2802. prepassCtx := NewEncodingContextFromWriter(io.Discard, prepass)
  2803. e := target.MarshalBinaryWithContext(prepassCtx)
  2804. if e != nil {
  2805. return e
  2806. }
  2807. tableWriter := prepass.WriteSortedTo(buff)
  2808. ctx := NewEncodingContextFromBuffer(buff, tableWriter)
  2809. return target.MarshalBinaryWithContext(ctx)
  2810. }
  2811. // MarshalBinaryWithContext serializes the internal properties of this KubeModelSet instance
  2812. // into a byte array leveraging a predefined context.
  2813. func (target *KubeModelSet) MarshalBinaryWithContext(ctx *EncodingContext) (err error) {
  2814. // panics are recovered and propagated as errors
  2815. defer func() {
  2816. if r := recover(); r != nil {
  2817. if e, ok := r.(error); ok {
  2818. err = e
  2819. } else if s, ok := r.(string); ok {
  2820. err = fmt.Errorf("unexpected panic: %s", s)
  2821. } else {
  2822. err = fmt.Errorf("unexpected panic: %+v", r)
  2823. }
  2824. }
  2825. }()
  2826. buff := ctx.Buffer
  2827. buff.WriteUInt8(DefaultCodecVersion) // version
  2828. if target.Metadata == nil {
  2829. buff.WriteUInt8(uint8(0)) // write nil byte
  2830. } else {
  2831. buff.WriteUInt8(uint8(1)) // write non-nil byte
  2832. // --- [begin][write][struct](Metadata) ---
  2833. buff.WriteInt(0) // [compatibility, unused]
  2834. errA := target.Metadata.MarshalBinaryWithContext(ctx)
  2835. if errA != nil {
  2836. return errA
  2837. }
  2838. // --- [end][write][struct](Metadata) ---
  2839. }
  2840. // --- [begin][write][struct](Window) ---
  2841. buff.WriteInt(0) // [compatibility, unused]
  2842. errB := target.Window.MarshalBinaryWithContext(ctx)
  2843. if errB != nil {
  2844. return errB
  2845. }
  2846. // --- [end][write][struct](Window) ---
  2847. if target.Cluster == nil {
  2848. buff.WriteUInt8(uint8(0)) // write nil byte
  2849. } else {
  2850. buff.WriteUInt8(uint8(1)) // write non-nil byte
  2851. // --- [begin][write][struct](Cluster) ---
  2852. buff.WriteInt(0) // [compatibility, unused]
  2853. errC := target.Cluster.MarshalBinaryWithContext(ctx)
  2854. if errC != nil {
  2855. return errC
  2856. }
  2857. // --- [end][write][struct](Cluster) ---
  2858. }
  2859. if target.Namespaces == nil {
  2860. buff.WriteUInt8(uint8(0)) // write nil byte
  2861. } else {
  2862. buff.WriteUInt8(uint8(1)) // write non-nil byte
  2863. // --- [begin][write][map](map[string]*Namespace) ---
  2864. buff.WriteInt(len(target.Namespaces)) // map length
  2865. for v, z := range target.Namespaces {
  2866. if ctx.IsStringTable() {
  2867. a := ctx.Table.AddOrGet(v)
  2868. buff.WriteInt(a) // write table index
  2869. } else {
  2870. buff.WriteString(v) // write string
  2871. }
  2872. if z == nil {
  2873. buff.WriteUInt8(uint8(0)) // write nil byte
  2874. } else {
  2875. buff.WriteUInt8(uint8(1)) // write non-nil byte
  2876. // --- [begin][write][struct](Namespace) ---
  2877. buff.WriteInt(0) // [compatibility, unused]
  2878. errD := z.MarshalBinaryWithContext(ctx)
  2879. if errD != nil {
  2880. return errD
  2881. }
  2882. // --- [end][write][struct](Namespace) ---
  2883. }
  2884. }
  2885. // --- [end][write][map](map[string]*Namespace) ---
  2886. }
  2887. if target.ResourceQuotas == nil {
  2888. buff.WriteUInt8(uint8(0)) // write nil byte
  2889. } else {
  2890. buff.WriteUInt8(uint8(1)) // write non-nil byte
  2891. // --- [begin][write][map](map[string]*ResourceQuota) ---
  2892. buff.WriteInt(len(target.ResourceQuotas)) // map length
  2893. for vv, zz := range target.ResourceQuotas {
  2894. if ctx.IsStringTable() {
  2895. b := ctx.Table.AddOrGet(vv)
  2896. buff.WriteInt(b) // write table index
  2897. } else {
  2898. buff.WriteString(vv) // write string
  2899. }
  2900. if zz == nil {
  2901. buff.WriteUInt8(uint8(0)) // write nil byte
  2902. } else {
  2903. buff.WriteUInt8(uint8(1)) // write non-nil byte
  2904. // --- [begin][write][struct](ResourceQuota) ---
  2905. buff.WriteInt(0) // [compatibility, unused]
  2906. errE := zz.MarshalBinaryWithContext(ctx)
  2907. if errE != nil {
  2908. return errE
  2909. }
  2910. // --- [end][write][struct](ResourceQuota) ---
  2911. }
  2912. }
  2913. // --- [end][write][map](map[string]*ResourceQuota) ---
  2914. }
  2915. if target.Services == nil {
  2916. buff.WriteUInt8(uint8(0)) // write nil byte
  2917. } else {
  2918. buff.WriteUInt8(uint8(1)) // write non-nil byte
  2919. // --- [begin][write][map](map[string]*Service) ---
  2920. buff.WriteInt(len(target.Services)) // map length
  2921. for vvv, zzz := range target.Services {
  2922. if ctx.IsStringTable() {
  2923. c := ctx.Table.AddOrGet(vvv)
  2924. buff.WriteInt(c) // write table index
  2925. } else {
  2926. buff.WriteString(vvv) // write string
  2927. }
  2928. if zzz == nil {
  2929. buff.WriteUInt8(uint8(0)) // write nil byte
  2930. } else {
  2931. buff.WriteUInt8(uint8(1)) // write non-nil byte
  2932. // --- [begin][write][struct](Service) ---
  2933. buff.WriteInt(0) // [compatibility, unused]
  2934. errF := zzz.MarshalBinaryWithContext(ctx)
  2935. if errF != nil {
  2936. return errF
  2937. }
  2938. // --- [end][write][struct](Service) ---
  2939. }
  2940. }
  2941. // --- [end][write][map](map[string]*Service) ---
  2942. }
  2943. if target.Deployments == nil {
  2944. buff.WriteUInt8(uint8(0)) // write nil byte
  2945. } else {
  2946. buff.WriteUInt8(uint8(1)) // write non-nil byte
  2947. // --- [begin][write][map](map[string]*Deployment) ---
  2948. buff.WriteInt(len(target.Deployments)) // map length
  2949. for vvvv, zzzz := range target.Deployments {
  2950. if ctx.IsStringTable() {
  2951. d := ctx.Table.AddOrGet(vvvv)
  2952. buff.WriteInt(d) // write table index
  2953. } else {
  2954. buff.WriteString(vvvv) // write string
  2955. }
  2956. if zzzz == nil {
  2957. buff.WriteUInt8(uint8(0)) // write nil byte
  2958. } else {
  2959. buff.WriteUInt8(uint8(1)) // write non-nil byte
  2960. // --- [begin][write][struct](Deployment) ---
  2961. buff.WriteInt(0) // [compatibility, unused]
  2962. errG := zzzz.MarshalBinaryWithContext(ctx)
  2963. if errG != nil {
  2964. return errG
  2965. }
  2966. // --- [end][write][struct](Deployment) ---
  2967. }
  2968. }
  2969. // --- [end][write][map](map[string]*Deployment) ---
  2970. }
  2971. if target.StatefulSets == nil {
  2972. buff.WriteUInt8(uint8(0)) // write nil byte
  2973. } else {
  2974. buff.WriteUInt8(uint8(1)) // write non-nil byte
  2975. // --- [begin][write][map](map[string]*StatefulSet) ---
  2976. buff.WriteInt(len(target.StatefulSets)) // map length
  2977. for vvvvv, zzzzz := range target.StatefulSets {
  2978. if ctx.IsStringTable() {
  2979. e := ctx.Table.AddOrGet(vvvvv)
  2980. buff.WriteInt(e) // write table index
  2981. } else {
  2982. buff.WriteString(vvvvv) // write string
  2983. }
  2984. if zzzzz == nil {
  2985. buff.WriteUInt8(uint8(0)) // write nil byte
  2986. } else {
  2987. buff.WriteUInt8(uint8(1)) // write non-nil byte
  2988. // --- [begin][write][struct](StatefulSet) ---
  2989. buff.WriteInt(0) // [compatibility, unused]
  2990. errH := zzzzz.MarshalBinaryWithContext(ctx)
  2991. if errH != nil {
  2992. return errH
  2993. }
  2994. // --- [end][write][struct](StatefulSet) ---
  2995. }
  2996. }
  2997. // --- [end][write][map](map[string]*StatefulSet) ---
  2998. }
  2999. if target.DaemonSets == nil {
  3000. buff.WriteUInt8(uint8(0)) // write nil byte
  3001. } else {
  3002. buff.WriteUInt8(uint8(1)) // write non-nil byte
  3003. // --- [begin][write][map](map[string]*DaemonSet) ---
  3004. buff.WriteInt(len(target.DaemonSets)) // map length
  3005. for vvvvvv, zzzzzz := range target.DaemonSets {
  3006. if ctx.IsStringTable() {
  3007. f := ctx.Table.AddOrGet(vvvvvv)
  3008. buff.WriteInt(f) // write table index
  3009. } else {
  3010. buff.WriteString(vvvvvv) // write string
  3011. }
  3012. if zzzzzz == nil {
  3013. buff.WriteUInt8(uint8(0)) // write nil byte
  3014. } else {
  3015. buff.WriteUInt8(uint8(1)) // write non-nil byte
  3016. // --- [begin][write][struct](DaemonSet) ---
  3017. buff.WriteInt(0) // [compatibility, unused]
  3018. errI := zzzzzz.MarshalBinaryWithContext(ctx)
  3019. if errI != nil {
  3020. return errI
  3021. }
  3022. // --- [end][write][struct](DaemonSet) ---
  3023. }
  3024. }
  3025. // --- [end][write][map](map[string]*DaemonSet) ---
  3026. }
  3027. if target.Jobs == nil {
  3028. buff.WriteUInt8(uint8(0)) // write nil byte
  3029. } else {
  3030. buff.WriteUInt8(uint8(1)) // write non-nil byte
  3031. // --- [begin][write][map](map[string]*Job) ---
  3032. buff.WriteInt(len(target.Jobs)) // map length
  3033. for vvvvvvv, zzzzzzz := range target.Jobs {
  3034. if ctx.IsStringTable() {
  3035. g := ctx.Table.AddOrGet(vvvvvvv)
  3036. buff.WriteInt(g) // write table index
  3037. } else {
  3038. buff.WriteString(vvvvvvv) // write string
  3039. }
  3040. if zzzzzzz == nil {
  3041. buff.WriteUInt8(uint8(0)) // write nil byte
  3042. } else {
  3043. buff.WriteUInt8(uint8(1)) // write non-nil byte
  3044. // --- [begin][write][struct](Job) ---
  3045. buff.WriteInt(0) // [compatibility, unused]
  3046. errJ := zzzzzzz.MarshalBinaryWithContext(ctx)
  3047. if errJ != nil {
  3048. return errJ
  3049. }
  3050. // --- [end][write][struct](Job) ---
  3051. }
  3052. }
  3053. // --- [end][write][map](map[string]*Job) ---
  3054. }
  3055. if target.CronJobs == nil {
  3056. buff.WriteUInt8(uint8(0)) // write nil byte
  3057. } else {
  3058. buff.WriteUInt8(uint8(1)) // write non-nil byte
  3059. // --- [begin][write][map](map[string]*CronJob) ---
  3060. buff.WriteInt(len(target.CronJobs)) // map length
  3061. for vvvvvvvv, zzzzzzzz := range target.CronJobs {
  3062. if ctx.IsStringTable() {
  3063. h := ctx.Table.AddOrGet(vvvvvvvv)
  3064. buff.WriteInt(h) // write table index
  3065. } else {
  3066. buff.WriteString(vvvvvvvv) // write string
  3067. }
  3068. if zzzzzzzz == nil {
  3069. buff.WriteUInt8(uint8(0)) // write nil byte
  3070. } else {
  3071. buff.WriteUInt8(uint8(1)) // write non-nil byte
  3072. // --- [begin][write][struct](CronJob) ---
  3073. buff.WriteInt(0) // [compatibility, unused]
  3074. errK := zzzzzzzz.MarshalBinaryWithContext(ctx)
  3075. if errK != nil {
  3076. return errK
  3077. }
  3078. // --- [end][write][struct](CronJob) ---
  3079. }
  3080. }
  3081. // --- [end][write][map](map[string]*CronJob) ---
  3082. }
  3083. if target.ReplicaSets == nil {
  3084. buff.WriteUInt8(uint8(0)) // write nil byte
  3085. } else {
  3086. buff.WriteUInt8(uint8(1)) // write non-nil byte
  3087. // --- [begin][write][map](map[string]*ReplicaSet) ---
  3088. buff.WriteInt(len(target.ReplicaSets)) // map length
  3089. for vvvvvvvvv, zzzzzzzzz := range target.ReplicaSets {
  3090. if ctx.IsStringTable() {
  3091. l := ctx.Table.AddOrGet(vvvvvvvvv)
  3092. buff.WriteInt(l) // write table index
  3093. } else {
  3094. buff.WriteString(vvvvvvvvv) // write string
  3095. }
  3096. if zzzzzzzzz == nil {
  3097. buff.WriteUInt8(uint8(0)) // write nil byte
  3098. } else {
  3099. buff.WriteUInt8(uint8(1)) // write non-nil byte
  3100. // --- [begin][write][struct](ReplicaSet) ---
  3101. buff.WriteInt(0) // [compatibility, unused]
  3102. errL := zzzzzzzzz.MarshalBinaryWithContext(ctx)
  3103. if errL != nil {
  3104. return errL
  3105. }
  3106. // --- [end][write][struct](ReplicaSet) ---
  3107. }
  3108. }
  3109. // --- [end][write][map](map[string]*ReplicaSet) ---
  3110. }
  3111. if target.Nodes == nil {
  3112. buff.WriteUInt8(uint8(0)) // write nil byte
  3113. } else {
  3114. buff.WriteUInt8(uint8(1)) // write non-nil byte
  3115. // --- [begin][write][map](map[string]*Node) ---
  3116. buff.WriteInt(len(target.Nodes)) // map length
  3117. for vvvvvvvvvv, zzzzzzzzzz := range target.Nodes {
  3118. if ctx.IsStringTable() {
  3119. m := ctx.Table.AddOrGet(vvvvvvvvvv)
  3120. buff.WriteInt(m) // write table index
  3121. } else {
  3122. buff.WriteString(vvvvvvvvvv) // write string
  3123. }
  3124. if zzzzzzzzzz == nil {
  3125. buff.WriteUInt8(uint8(0)) // write nil byte
  3126. } else {
  3127. buff.WriteUInt8(uint8(1)) // write non-nil byte
  3128. // --- [begin][write][struct](Node) ---
  3129. buff.WriteInt(0) // [compatibility, unused]
  3130. errM := zzzzzzzzzz.MarshalBinaryWithContext(ctx)
  3131. if errM != nil {
  3132. return errM
  3133. }
  3134. // --- [end][write][struct](Node) ---
  3135. }
  3136. }
  3137. // --- [end][write][map](map[string]*Node) ---
  3138. }
  3139. if target.PersistentVolumes == nil {
  3140. buff.WriteUInt8(uint8(0)) // write nil byte
  3141. } else {
  3142. buff.WriteUInt8(uint8(1)) // write non-nil byte
  3143. // --- [begin][write][map](map[string]*PersistentVolume) ---
  3144. buff.WriteInt(len(target.PersistentVolumes)) // map length
  3145. for vvvvvvvvvvv, zzzzzzzzzzz := range target.PersistentVolumes {
  3146. if ctx.IsStringTable() {
  3147. n := ctx.Table.AddOrGet(vvvvvvvvvvv)
  3148. buff.WriteInt(n) // write table index
  3149. } else {
  3150. buff.WriteString(vvvvvvvvvvv) // write string
  3151. }
  3152. if zzzzzzzzzzz == nil {
  3153. buff.WriteUInt8(uint8(0)) // write nil byte
  3154. } else {
  3155. buff.WriteUInt8(uint8(1)) // write non-nil byte
  3156. // --- [begin][write][struct](PersistentVolume) ---
  3157. buff.WriteInt(0) // [compatibility, unused]
  3158. errN := zzzzzzzzzzz.MarshalBinaryWithContext(ctx)
  3159. if errN != nil {
  3160. return errN
  3161. }
  3162. // --- [end][write][struct](PersistentVolume) ---
  3163. }
  3164. }
  3165. // --- [end][write][map](map[string]*PersistentVolume) ---
  3166. }
  3167. if target.PersistentVolumeClaims == nil {
  3168. buff.WriteUInt8(uint8(0)) // write nil byte
  3169. } else {
  3170. buff.WriteUInt8(uint8(1)) // write non-nil byte
  3171. // --- [begin][write][map](map[string]*PersistentVolumeClaim) ---
  3172. buff.WriteInt(len(target.PersistentVolumeClaims)) // map length
  3173. for vvvvvvvvvvvv, zzzzzzzzzzzz := range target.PersistentVolumeClaims {
  3174. if ctx.IsStringTable() {
  3175. o := ctx.Table.AddOrGet(vvvvvvvvvvvv)
  3176. buff.WriteInt(o) // write table index
  3177. } else {
  3178. buff.WriteString(vvvvvvvvvvvv) // write string
  3179. }
  3180. if zzzzzzzzzzzz == nil {
  3181. buff.WriteUInt8(uint8(0)) // write nil byte
  3182. } else {
  3183. buff.WriteUInt8(uint8(1)) // write non-nil byte
  3184. // --- [begin][write][struct](PersistentVolumeClaim) ---
  3185. buff.WriteInt(0) // [compatibility, unused]
  3186. errO := zzzzzzzzzzzz.MarshalBinaryWithContext(ctx)
  3187. if errO != nil {
  3188. return errO
  3189. }
  3190. // --- [end][write][struct](PersistentVolumeClaim) ---
  3191. }
  3192. }
  3193. // --- [end][write][map](map[string]*PersistentVolumeClaim) ---
  3194. }
  3195. if target.Pods == nil {
  3196. buff.WriteUInt8(uint8(0)) // write nil byte
  3197. } else {
  3198. buff.WriteUInt8(uint8(1)) // write non-nil byte
  3199. // --- [begin][write][map](map[string]*Pod) ---
  3200. buff.WriteInt(len(target.Pods)) // map length
  3201. for vvvvvvvvvvvvv, zzzzzzzzzzzzz := range target.Pods {
  3202. if ctx.IsStringTable() {
  3203. p := ctx.Table.AddOrGet(vvvvvvvvvvvvv)
  3204. buff.WriteInt(p) // write table index
  3205. } else {
  3206. buff.WriteString(vvvvvvvvvvvvv) // write string
  3207. }
  3208. if zzzzzzzzzzzzz == nil {
  3209. buff.WriteUInt8(uint8(0)) // write nil byte
  3210. } else {
  3211. buff.WriteUInt8(uint8(1)) // write non-nil byte
  3212. // --- [begin][write][struct](Pod) ---
  3213. buff.WriteInt(0) // [compatibility, unused]
  3214. errP := zzzzzzzzzzzzz.MarshalBinaryWithContext(ctx)
  3215. if errP != nil {
  3216. return errP
  3217. }
  3218. // --- [end][write][struct](Pod) ---
  3219. }
  3220. }
  3221. // --- [end][write][map](map[string]*Pod) ---
  3222. }
  3223. if target.Containers == nil {
  3224. buff.WriteUInt8(uint8(0)) // write nil byte
  3225. } else {
  3226. buff.WriteUInt8(uint8(1)) // write non-nil byte
  3227. // --- [begin][write][map](map[string]*Container) ---
  3228. buff.WriteInt(len(target.Containers)) // map length
  3229. for vvvvvvvvvvvvvv, zzzzzzzzzzzzzz := range target.Containers {
  3230. if ctx.IsStringTable() {
  3231. q := ctx.Table.AddOrGet(vvvvvvvvvvvvvv)
  3232. buff.WriteInt(q) // write table index
  3233. } else {
  3234. buff.WriteString(vvvvvvvvvvvvvv) // write string
  3235. }
  3236. if zzzzzzzzzzzzzz == nil {
  3237. buff.WriteUInt8(uint8(0)) // write nil byte
  3238. } else {
  3239. buff.WriteUInt8(uint8(1)) // write non-nil byte
  3240. // --- [begin][write][struct](Container) ---
  3241. buff.WriteInt(0) // [compatibility, unused]
  3242. errQ := zzzzzzzzzzzzzz.MarshalBinaryWithContext(ctx)
  3243. if errQ != nil {
  3244. return errQ
  3245. }
  3246. // --- [end][write][struct](Container) ---
  3247. }
  3248. }
  3249. // --- [end][write][map](map[string]*Container) ---
  3250. }
  3251. return nil
  3252. }
  3253. // UnmarshalBinary uses the data passed byte array to set all the internal properties of
  3254. // the KubeModelSet type
  3255. func (target *KubeModelSet) UnmarshalBinary(data []byte) error {
  3256. ctx := NewDecodingContextFromBytes(data)
  3257. defer ctx.Close()
  3258. err := target.UnmarshalBinaryWithContext(ctx)
  3259. if err != nil {
  3260. return err
  3261. }
  3262. return nil
  3263. }
  3264. // UnmarshalBinaryFromReader uses the io.Reader data to set all the internal properties of
  3265. // the KubeModelSet type
  3266. func (target *KubeModelSet) UnmarshalBinaryFromReader(reader io.Reader) error {
  3267. ctx := NewDecodingContextFromReader(reader)
  3268. defer ctx.Close()
  3269. err := target.UnmarshalBinaryWithContext(ctx)
  3270. if err != nil {
  3271. return err
  3272. }
  3273. return nil
  3274. }
  3275. // UnmarshalBinaryWithContext uses the context containing a string table and binary buffer to set all the internal properties of
  3276. // the KubeModelSet type
  3277. func (target *KubeModelSet) UnmarshalBinaryWithContext(ctx *DecodingContext) (err error) {
  3278. // panics are recovered and propagated as errors
  3279. defer func() {
  3280. if r := recover(); r != nil {
  3281. if e, ok := r.(error); ok {
  3282. err = e
  3283. } else if s, ok := r.(string); ok {
  3284. err = fmt.Errorf("unexpected panic: %s", s)
  3285. } else {
  3286. err = fmt.Errorf("unexpected panic: %+v", r)
  3287. }
  3288. }
  3289. }()
  3290. buff := ctx.Buffer
  3291. version := buff.ReadUInt8()
  3292. if version > DefaultCodecVersion {
  3293. return fmt.Errorf("Invalid Version Unmarshalling KubeModelSet. Expected %d or less, got %d", DefaultCodecVersion, version)
  3294. }
  3295. // field version check
  3296. if uint8(1) <= version {
  3297. if buff.ReadUInt8() == uint8(0) {
  3298. target.Metadata = nil
  3299. } else {
  3300. // --- [begin][read][struct](Metadata) ---
  3301. a := new(Metadata)
  3302. buff.ReadInt() // [compatibility, unused]
  3303. errA := a.UnmarshalBinaryWithContext(ctx)
  3304. if errA != nil {
  3305. return errA
  3306. }
  3307. target.Metadata = a
  3308. // --- [end][read][struct](Metadata) ---
  3309. }
  3310. } else {
  3311. target.Metadata = nil
  3312. }
  3313. // field version check
  3314. if uint8(1) <= version {
  3315. // --- [begin][read][struct](Window) ---
  3316. b := new(Window)
  3317. buff.ReadInt() // [compatibility, unused]
  3318. errB := b.UnmarshalBinaryWithContext(ctx)
  3319. if errB != nil {
  3320. return errB
  3321. }
  3322. target.Window = *b
  3323. // --- [end][read][struct](Window) ---
  3324. } else {
  3325. }
  3326. // field version check
  3327. if uint8(1) <= version {
  3328. if buff.ReadUInt8() == uint8(0) {
  3329. target.Cluster = nil
  3330. } else {
  3331. // --- [begin][read][struct](Cluster) ---
  3332. c := new(Cluster)
  3333. buff.ReadInt() // [compatibility, unused]
  3334. errC := c.UnmarshalBinaryWithContext(ctx)
  3335. if errC != nil {
  3336. return errC
  3337. }
  3338. target.Cluster = c
  3339. // --- [end][read][struct](Cluster) ---
  3340. }
  3341. } else {
  3342. target.Cluster = nil
  3343. }
  3344. // field version check
  3345. if uint8(1) <= version {
  3346. if buff.ReadUInt8() == uint8(0) {
  3347. target.Namespaces = nil
  3348. } else {
  3349. // --- [begin][read][map](map[string]*Namespace) ---
  3350. e := buff.ReadInt() // map len
  3351. d := make(map[string]*Namespace, e)
  3352. for range e {
  3353. var v string
  3354. var g string
  3355. if ctx.IsStringTable() {
  3356. h := buff.ReadInt() // read string index
  3357. g = ctx.Table.At(h)
  3358. } else {
  3359. g = buff.ReadString() // read string
  3360. }
  3361. f := g
  3362. v = f
  3363. var z *Namespace
  3364. if buff.ReadUInt8() == uint8(0) {
  3365. z = nil
  3366. } else {
  3367. // --- [begin][read][struct](Namespace) ---
  3368. l := new(Namespace)
  3369. buff.ReadInt() // [compatibility, unused]
  3370. errD := l.UnmarshalBinaryWithContext(ctx)
  3371. if errD != nil {
  3372. return errD
  3373. }
  3374. z = l
  3375. // --- [end][read][struct](Namespace) ---
  3376. }
  3377. d[v] = z
  3378. }
  3379. target.Namespaces = d
  3380. // --- [end][read][map](map[string]*Namespace) ---
  3381. }
  3382. } else {
  3383. target.Namespaces = nil
  3384. }
  3385. // field version check
  3386. if uint8(1) <= version {
  3387. if buff.ReadUInt8() == uint8(0) {
  3388. target.ResourceQuotas = nil
  3389. } else {
  3390. // --- [begin][read][map](map[string]*ResourceQuota) ---
  3391. n := buff.ReadInt() // map len
  3392. m := make(map[string]*ResourceQuota, n)
  3393. for range n {
  3394. var vv string
  3395. var p string
  3396. if ctx.IsStringTable() {
  3397. q := buff.ReadInt() // read string index
  3398. p = ctx.Table.At(q)
  3399. } else {
  3400. p = buff.ReadString() // read string
  3401. }
  3402. o := p
  3403. vv = o
  3404. var zz *ResourceQuota
  3405. if buff.ReadUInt8() == uint8(0) {
  3406. zz = nil
  3407. } else {
  3408. // --- [begin][read][struct](ResourceQuota) ---
  3409. r := new(ResourceQuota)
  3410. buff.ReadInt() // [compatibility, unused]
  3411. errE := r.UnmarshalBinaryWithContext(ctx)
  3412. if errE != nil {
  3413. return errE
  3414. }
  3415. zz = r
  3416. // --- [end][read][struct](ResourceQuota) ---
  3417. }
  3418. m[vv] = zz
  3419. }
  3420. target.ResourceQuotas = m
  3421. // --- [end][read][map](map[string]*ResourceQuota) ---
  3422. }
  3423. } else {
  3424. target.ResourceQuotas = nil
  3425. }
  3426. // field version check
  3427. if uint8(2) <= version {
  3428. if buff.ReadUInt8() == uint8(0) {
  3429. target.Services = nil
  3430. } else {
  3431. // --- [begin][read][map](map[string]*Service) ---
  3432. t := buff.ReadInt() // map len
  3433. s := make(map[string]*Service, t)
  3434. for range t {
  3435. var vvv string
  3436. var w string
  3437. if ctx.IsStringTable() {
  3438. x := buff.ReadInt() // read string index
  3439. w = ctx.Table.At(x)
  3440. } else {
  3441. w = buff.ReadString() // read string
  3442. }
  3443. u := w
  3444. vvv = u
  3445. var zzz *Service
  3446. if buff.ReadUInt8() == uint8(0) {
  3447. zzz = nil
  3448. } else {
  3449. // --- [begin][read][struct](Service) ---
  3450. y := new(Service)
  3451. buff.ReadInt() // [compatibility, unused]
  3452. errF := y.UnmarshalBinaryWithContext(ctx)
  3453. if errF != nil {
  3454. return errF
  3455. }
  3456. zzz = y
  3457. // --- [end][read][struct](Service) ---
  3458. }
  3459. s[vvv] = zzz
  3460. }
  3461. target.Services = s
  3462. // --- [end][read][map](map[string]*Service) ---
  3463. }
  3464. } else {
  3465. target.Services = nil
  3466. }
  3467. // field version check
  3468. if uint8(2) <= version {
  3469. if buff.ReadUInt8() == uint8(0) {
  3470. target.Deployments = nil
  3471. } else {
  3472. // --- [begin][read][map](map[string]*Deployment) ---
  3473. bb := buff.ReadInt() // map len
  3474. aa := make(map[string]*Deployment, bb)
  3475. for range bb {
  3476. var vvvv string
  3477. var dd string
  3478. if ctx.IsStringTable() {
  3479. ee := buff.ReadInt() // read string index
  3480. dd = ctx.Table.At(ee)
  3481. } else {
  3482. dd = buff.ReadString() // read string
  3483. }
  3484. cc := dd
  3485. vvvv = cc
  3486. var zzzz *Deployment
  3487. if buff.ReadUInt8() == uint8(0) {
  3488. zzzz = nil
  3489. } else {
  3490. // --- [begin][read][struct](Deployment) ---
  3491. ff := new(Deployment)
  3492. buff.ReadInt() // [compatibility, unused]
  3493. errG := ff.UnmarshalBinaryWithContext(ctx)
  3494. if errG != nil {
  3495. return errG
  3496. }
  3497. zzzz = ff
  3498. // --- [end][read][struct](Deployment) ---
  3499. }
  3500. aa[vvvv] = zzzz
  3501. }
  3502. target.Deployments = aa
  3503. // --- [end][read][map](map[string]*Deployment) ---
  3504. }
  3505. } else {
  3506. target.Deployments = nil
  3507. }
  3508. // field version check
  3509. if uint8(2) <= version {
  3510. if buff.ReadUInt8() == uint8(0) {
  3511. target.StatefulSets = nil
  3512. } else {
  3513. // --- [begin][read][map](map[string]*StatefulSet) ---
  3514. hh := buff.ReadInt() // map len
  3515. gg := make(map[string]*StatefulSet, hh)
  3516. for range hh {
  3517. var vvvvv string
  3518. var mm string
  3519. if ctx.IsStringTable() {
  3520. nn := buff.ReadInt() // read string index
  3521. mm = ctx.Table.At(nn)
  3522. } else {
  3523. mm = buff.ReadString() // read string
  3524. }
  3525. ll := mm
  3526. vvvvv = ll
  3527. var zzzzz *StatefulSet
  3528. if buff.ReadUInt8() == uint8(0) {
  3529. zzzzz = nil
  3530. } else {
  3531. // --- [begin][read][struct](StatefulSet) ---
  3532. oo := new(StatefulSet)
  3533. buff.ReadInt() // [compatibility, unused]
  3534. errH := oo.UnmarshalBinaryWithContext(ctx)
  3535. if errH != nil {
  3536. return errH
  3537. }
  3538. zzzzz = oo
  3539. // --- [end][read][struct](StatefulSet) ---
  3540. }
  3541. gg[vvvvv] = zzzzz
  3542. }
  3543. target.StatefulSets = gg
  3544. // --- [end][read][map](map[string]*StatefulSet) ---
  3545. }
  3546. } else {
  3547. target.StatefulSets = nil
  3548. }
  3549. // field version check
  3550. if uint8(2) <= version {
  3551. if buff.ReadUInt8() == uint8(0) {
  3552. target.DaemonSets = nil
  3553. } else {
  3554. // --- [begin][read][map](map[string]*DaemonSet) ---
  3555. qq := buff.ReadInt() // map len
  3556. pp := make(map[string]*DaemonSet, qq)
  3557. for range qq {
  3558. var vvvvvv string
  3559. var ss string
  3560. if ctx.IsStringTable() {
  3561. tt := buff.ReadInt() // read string index
  3562. ss = ctx.Table.At(tt)
  3563. } else {
  3564. ss = buff.ReadString() // read string
  3565. }
  3566. rr := ss
  3567. vvvvvv = rr
  3568. var zzzzzz *DaemonSet
  3569. if buff.ReadUInt8() == uint8(0) {
  3570. zzzzzz = nil
  3571. } else {
  3572. // --- [begin][read][struct](DaemonSet) ---
  3573. uu := new(DaemonSet)
  3574. buff.ReadInt() // [compatibility, unused]
  3575. errI := uu.UnmarshalBinaryWithContext(ctx)
  3576. if errI != nil {
  3577. return errI
  3578. }
  3579. zzzzzz = uu
  3580. // --- [end][read][struct](DaemonSet) ---
  3581. }
  3582. pp[vvvvvv] = zzzzzz
  3583. }
  3584. target.DaemonSets = pp
  3585. // --- [end][read][map](map[string]*DaemonSet) ---
  3586. }
  3587. } else {
  3588. target.DaemonSets = nil
  3589. }
  3590. // field version check
  3591. if uint8(2) <= version {
  3592. if buff.ReadUInt8() == uint8(0) {
  3593. target.Jobs = nil
  3594. } else {
  3595. // --- [begin][read][map](map[string]*Job) ---
  3596. xx := buff.ReadInt() // map len
  3597. ww := make(map[string]*Job, xx)
  3598. for range xx {
  3599. var vvvvvvv string
  3600. var aaa string
  3601. if ctx.IsStringTable() {
  3602. bbb := buff.ReadInt() // read string index
  3603. aaa = ctx.Table.At(bbb)
  3604. } else {
  3605. aaa = buff.ReadString() // read string
  3606. }
  3607. yy := aaa
  3608. vvvvvvv = yy
  3609. var zzzzzzz *Job
  3610. if buff.ReadUInt8() == uint8(0) {
  3611. zzzzzzz = nil
  3612. } else {
  3613. // --- [begin][read][struct](Job) ---
  3614. ccc := new(Job)
  3615. buff.ReadInt() // [compatibility, unused]
  3616. errJ := ccc.UnmarshalBinaryWithContext(ctx)
  3617. if errJ != nil {
  3618. return errJ
  3619. }
  3620. zzzzzzz = ccc
  3621. // --- [end][read][struct](Job) ---
  3622. }
  3623. ww[vvvvvvv] = zzzzzzz
  3624. }
  3625. target.Jobs = ww
  3626. // --- [end][read][map](map[string]*Job) ---
  3627. }
  3628. } else {
  3629. target.Jobs = nil
  3630. }
  3631. // field version check
  3632. if uint8(2) <= version {
  3633. if buff.ReadUInt8() == uint8(0) {
  3634. target.CronJobs = nil
  3635. } else {
  3636. // --- [begin][read][map](map[string]*CronJob) ---
  3637. eee := buff.ReadInt() // map len
  3638. ddd := make(map[string]*CronJob, eee)
  3639. for range eee {
  3640. var vvvvvvvv string
  3641. var ggg string
  3642. if ctx.IsStringTable() {
  3643. hhh := buff.ReadInt() // read string index
  3644. ggg = ctx.Table.At(hhh)
  3645. } else {
  3646. ggg = buff.ReadString() // read string
  3647. }
  3648. fff := ggg
  3649. vvvvvvvv = fff
  3650. var zzzzzzzz *CronJob
  3651. if buff.ReadUInt8() == uint8(0) {
  3652. zzzzzzzz = nil
  3653. } else {
  3654. // --- [begin][read][struct](CronJob) ---
  3655. lll := new(CronJob)
  3656. buff.ReadInt() // [compatibility, unused]
  3657. errK := lll.UnmarshalBinaryWithContext(ctx)
  3658. if errK != nil {
  3659. return errK
  3660. }
  3661. zzzzzzzz = lll
  3662. // --- [end][read][struct](CronJob) ---
  3663. }
  3664. ddd[vvvvvvvv] = zzzzzzzz
  3665. }
  3666. target.CronJobs = ddd
  3667. // --- [end][read][map](map[string]*CronJob) ---
  3668. }
  3669. } else {
  3670. target.CronJobs = nil
  3671. }
  3672. // field version check
  3673. if uint8(2) <= version {
  3674. if buff.ReadUInt8() == uint8(0) {
  3675. target.ReplicaSets = nil
  3676. } else {
  3677. // --- [begin][read][map](map[string]*ReplicaSet) ---
  3678. nnn := buff.ReadInt() // map len
  3679. mmm := make(map[string]*ReplicaSet, nnn)
  3680. for range nnn {
  3681. var vvvvvvvvv string
  3682. var ppp string
  3683. if ctx.IsStringTable() {
  3684. qqq := buff.ReadInt() // read string index
  3685. ppp = ctx.Table.At(qqq)
  3686. } else {
  3687. ppp = buff.ReadString() // read string
  3688. }
  3689. ooo := ppp
  3690. vvvvvvvvv = ooo
  3691. var zzzzzzzzz *ReplicaSet
  3692. if buff.ReadUInt8() == uint8(0) {
  3693. zzzzzzzzz = nil
  3694. } else {
  3695. // --- [begin][read][struct](ReplicaSet) ---
  3696. rrr := new(ReplicaSet)
  3697. buff.ReadInt() // [compatibility, unused]
  3698. errL := rrr.UnmarshalBinaryWithContext(ctx)
  3699. if errL != nil {
  3700. return errL
  3701. }
  3702. zzzzzzzzz = rrr
  3703. // --- [end][read][struct](ReplicaSet) ---
  3704. }
  3705. mmm[vvvvvvvvv] = zzzzzzzzz
  3706. }
  3707. target.ReplicaSets = mmm
  3708. // --- [end][read][map](map[string]*ReplicaSet) ---
  3709. }
  3710. } else {
  3711. target.ReplicaSets = nil
  3712. }
  3713. // field version check
  3714. if uint8(2) <= version {
  3715. if buff.ReadUInt8() == uint8(0) {
  3716. target.Nodes = nil
  3717. } else {
  3718. // --- [begin][read][map](map[string]*Node) ---
  3719. ttt := buff.ReadInt() // map len
  3720. sss := make(map[string]*Node, ttt)
  3721. for range ttt {
  3722. var vvvvvvvvvv string
  3723. var www string
  3724. if ctx.IsStringTable() {
  3725. xxx := buff.ReadInt() // read string index
  3726. www = ctx.Table.At(xxx)
  3727. } else {
  3728. www = buff.ReadString() // read string
  3729. }
  3730. uuu := www
  3731. vvvvvvvvvv = uuu
  3732. var zzzzzzzzzz *Node
  3733. if buff.ReadUInt8() == uint8(0) {
  3734. zzzzzzzzzz = nil
  3735. } else {
  3736. // --- [begin][read][struct](Node) ---
  3737. yyy := new(Node)
  3738. buff.ReadInt() // [compatibility, unused]
  3739. errM := yyy.UnmarshalBinaryWithContext(ctx)
  3740. if errM != nil {
  3741. return errM
  3742. }
  3743. zzzzzzzzzz = yyy
  3744. // --- [end][read][struct](Node) ---
  3745. }
  3746. sss[vvvvvvvvvv] = zzzzzzzzzz
  3747. }
  3748. target.Nodes = sss
  3749. // --- [end][read][map](map[string]*Node) ---
  3750. }
  3751. } else {
  3752. target.Nodes = nil
  3753. }
  3754. // field version check
  3755. if uint8(2) <= version {
  3756. if buff.ReadUInt8() == uint8(0) {
  3757. target.PersistentVolumes = nil
  3758. } else {
  3759. // --- [begin][read][map](map[string]*PersistentVolume) ---
  3760. bbbb := buff.ReadInt() // map len
  3761. aaaa := make(map[string]*PersistentVolume, bbbb)
  3762. for range bbbb {
  3763. var vvvvvvvvvvv string
  3764. var dddd string
  3765. if ctx.IsStringTable() {
  3766. eeee := buff.ReadInt() // read string index
  3767. dddd = ctx.Table.At(eeee)
  3768. } else {
  3769. dddd = buff.ReadString() // read string
  3770. }
  3771. cccc := dddd
  3772. vvvvvvvvvvv = cccc
  3773. var zzzzzzzzzzz *PersistentVolume
  3774. if buff.ReadUInt8() == uint8(0) {
  3775. zzzzzzzzzzz = nil
  3776. } else {
  3777. // --- [begin][read][struct](PersistentVolume) ---
  3778. ffff := new(PersistentVolume)
  3779. buff.ReadInt() // [compatibility, unused]
  3780. errN := ffff.UnmarshalBinaryWithContext(ctx)
  3781. if errN != nil {
  3782. return errN
  3783. }
  3784. zzzzzzzzzzz = ffff
  3785. // --- [end][read][struct](PersistentVolume) ---
  3786. }
  3787. aaaa[vvvvvvvvvvv] = zzzzzzzzzzz
  3788. }
  3789. target.PersistentVolumes = aaaa
  3790. // --- [end][read][map](map[string]*PersistentVolume) ---
  3791. }
  3792. } else {
  3793. target.PersistentVolumes = nil
  3794. }
  3795. // field version check
  3796. if uint8(2) <= version {
  3797. if buff.ReadUInt8() == uint8(0) {
  3798. target.PersistentVolumeClaims = nil
  3799. } else {
  3800. // --- [begin][read][map](map[string]*PersistentVolumeClaim) ---
  3801. hhhh := buff.ReadInt() // map len
  3802. gggg := make(map[string]*PersistentVolumeClaim, hhhh)
  3803. for range hhhh {
  3804. var vvvvvvvvvvvv string
  3805. var mmmm string
  3806. if ctx.IsStringTable() {
  3807. nnnn := buff.ReadInt() // read string index
  3808. mmmm = ctx.Table.At(nnnn)
  3809. } else {
  3810. mmmm = buff.ReadString() // read string
  3811. }
  3812. llll := mmmm
  3813. vvvvvvvvvvvv = llll
  3814. var zzzzzzzzzzzz *PersistentVolumeClaim
  3815. if buff.ReadUInt8() == uint8(0) {
  3816. zzzzzzzzzzzz = nil
  3817. } else {
  3818. // --- [begin][read][struct](PersistentVolumeClaim) ---
  3819. oooo := new(PersistentVolumeClaim)
  3820. buff.ReadInt() // [compatibility, unused]
  3821. errO := oooo.UnmarshalBinaryWithContext(ctx)
  3822. if errO != nil {
  3823. return errO
  3824. }
  3825. zzzzzzzzzzzz = oooo
  3826. // --- [end][read][struct](PersistentVolumeClaim) ---
  3827. }
  3828. gggg[vvvvvvvvvvvv] = zzzzzzzzzzzz
  3829. }
  3830. target.PersistentVolumeClaims = gggg
  3831. // --- [end][read][map](map[string]*PersistentVolumeClaim) ---
  3832. }
  3833. } else {
  3834. target.PersistentVolumeClaims = nil
  3835. }
  3836. // field version check
  3837. if uint8(2) <= version {
  3838. if buff.ReadUInt8() == uint8(0) {
  3839. target.Pods = nil
  3840. } else {
  3841. // --- [begin][read][map](map[string]*Pod) ---
  3842. qqqq := buff.ReadInt() // map len
  3843. pppp := make(map[string]*Pod, qqqq)
  3844. for range qqqq {
  3845. var vvvvvvvvvvvvv string
  3846. var ssss string
  3847. if ctx.IsStringTable() {
  3848. tttt := buff.ReadInt() // read string index
  3849. ssss = ctx.Table.At(tttt)
  3850. } else {
  3851. ssss = buff.ReadString() // read string
  3852. }
  3853. rrrr := ssss
  3854. vvvvvvvvvvvvv = rrrr
  3855. var zzzzzzzzzzzzz *Pod
  3856. if buff.ReadUInt8() == uint8(0) {
  3857. zzzzzzzzzzzzz = nil
  3858. } else {
  3859. // --- [begin][read][struct](Pod) ---
  3860. uuuu := new(Pod)
  3861. buff.ReadInt() // [compatibility, unused]
  3862. errP := uuuu.UnmarshalBinaryWithContext(ctx)
  3863. if errP != nil {
  3864. return errP
  3865. }
  3866. zzzzzzzzzzzzz = uuuu
  3867. // --- [end][read][struct](Pod) ---
  3868. }
  3869. pppp[vvvvvvvvvvvvv] = zzzzzzzzzzzzz
  3870. }
  3871. target.Pods = pppp
  3872. // --- [end][read][map](map[string]*Pod) ---
  3873. }
  3874. } else {
  3875. target.Pods = nil
  3876. }
  3877. // field version check
  3878. if uint8(2) <= version {
  3879. if buff.ReadUInt8() == uint8(0) {
  3880. target.Containers = nil
  3881. } else {
  3882. // --- [begin][read][map](map[string]*Container) ---
  3883. xxxx := buff.ReadInt() // map len
  3884. wwww := make(map[string]*Container, xxxx)
  3885. for range xxxx {
  3886. var vvvvvvvvvvvvvv string
  3887. var aaaaa string
  3888. if ctx.IsStringTable() {
  3889. bbbbb := buff.ReadInt() // read string index
  3890. aaaaa = ctx.Table.At(bbbbb)
  3891. } else {
  3892. aaaaa = buff.ReadString() // read string
  3893. }
  3894. yyyy := aaaaa
  3895. vvvvvvvvvvvvvv = yyyy
  3896. var zzzzzzzzzzzzzz *Container
  3897. if buff.ReadUInt8() == uint8(0) {
  3898. zzzzzzzzzzzzzz = nil
  3899. } else {
  3900. // --- [begin][read][struct](Container) ---
  3901. ccccc := new(Container)
  3902. buff.ReadInt() // [compatibility, unused]
  3903. errQ := ccccc.UnmarshalBinaryWithContext(ctx)
  3904. if errQ != nil {
  3905. return errQ
  3906. }
  3907. zzzzzzzzzzzzzz = ccccc
  3908. // --- [end][read][struct](Container) ---
  3909. }
  3910. wwww[vvvvvvvvvvvvvv] = zzzzzzzzzzzzzz
  3911. }
  3912. target.Containers = wwww
  3913. // --- [end][read][map](map[string]*Container) ---
  3914. }
  3915. } else {
  3916. target.Containers = nil
  3917. }
  3918. return nil
  3919. }
  3920. //--------------------------------------------------------------------------
  3921. // KubeModelSetStream
  3922. //--------------------------------------------------------------------------
  3923. // KubeModelSetStream is a single use field stream for the contents of an KubeModelSet instance. Instead of creating an instance and populating
  3924. // the fields on that instance, we provide a streaming iterator which yields (BingenFieldInfo, *BingenValue) tuples for each
  3925. // streamable element. All slices and maps will be flattened one depth and each element streamed individually.
  3926. type KubeModelSetStream struct {
  3927. reader io.Reader
  3928. ctx *DecodingContext
  3929. err error
  3930. }
  3931. // Closes closes the internal io.Reader used to read and parse the KubeModelSet fields.
  3932. // This should be called once the stream is no longer needed.
  3933. func (stream *KubeModelSetStream) Close() {
  3934. if closer, ok := stream.reader.(io.Closer); ok {
  3935. closer.Close()
  3936. }
  3937. stream.ctx.Close()
  3938. }
  3939. // Error returns an error if one occurred during the process of streaming the KubeModelSet
  3940. // This can be checked after iterating through the Stream().
  3941. func (stream *KubeModelSetStream) Error() error {
  3942. return stream.err
  3943. }
  3944. // NewKubeModelSetStream creates a new KubeModelSetStream, which uses the io.Reader data to stream all internal fields of an KubeModelSet instance
  3945. func NewKubeModelSetStream(reader io.Reader) bstream.BingenStream {
  3946. ctx := NewDecodingContextFromReader(reader)
  3947. return &KubeModelSetStream{
  3948. ctx: ctx,
  3949. reader: reader,
  3950. }
  3951. }
  3952. // Stream returns the iterator which will stream each field of the target type.
  3953. func (stream *KubeModelSetStream) Stream() iter.Seq2[bstream.BingenFieldInfo, *bstream.BingenValue] {
  3954. return func(yield func(bstream.BingenFieldInfo, *bstream.BingenValue) bool) {
  3955. var fi bstream.BingenFieldInfo
  3956. ctx := stream.ctx
  3957. buff := ctx.Buffer
  3958. version := buff.ReadUInt8()
  3959. if version > DefaultCodecVersion {
  3960. stream.err = fmt.Errorf("Invalid Version Unmarshalling KubeModelSet. Expected %d or less, got %d", DefaultCodecVersion, version)
  3961. return
  3962. }
  3963. fi = bstream.BingenFieldInfo{
  3964. Type: reflect.TypeFor[*Metadata](),
  3965. Name: "Metadata",
  3966. }
  3967. // field version check
  3968. if uint8(1) <= version {
  3969. if buff.ReadUInt8() == uint8(0) {
  3970. if !yield(fi, nil) {
  3971. return
  3972. }
  3973. } else {
  3974. // --- [begin][read][struct](Metadata) ---
  3975. b := new(Metadata)
  3976. buff.ReadInt() // [compatibility, unused]
  3977. errA := b.UnmarshalBinaryWithContext(ctx)
  3978. if errA != nil {
  3979. stream.err = errA
  3980. return
  3981. }
  3982. a := b
  3983. // --- [end][read][struct](Metadata) ---
  3984. if !yield(fi, bstream.SingleV(a)) {
  3985. return
  3986. }
  3987. }
  3988. } else {
  3989. if !yield(fi, nil) {
  3990. return
  3991. }
  3992. }
  3993. fi = bstream.BingenFieldInfo{
  3994. Type: reflect.TypeFor[Window](),
  3995. Name: "Window",
  3996. }
  3997. // field version check
  3998. if uint8(1) <= version {
  3999. // --- [begin][read][struct](Window) ---
  4000. d := new(Window)
  4001. buff.ReadInt() // [compatibility, unused]
  4002. errB := d.UnmarshalBinaryWithContext(ctx)
  4003. if errB != nil {
  4004. stream.err = errB
  4005. return
  4006. }
  4007. c := *d
  4008. // --- [end][read][struct](Window) ---
  4009. if !yield(fi, bstream.SingleV(c)) {
  4010. return
  4011. }
  4012. } else {
  4013. }
  4014. fi = bstream.BingenFieldInfo{
  4015. Type: reflect.TypeFor[*Cluster](),
  4016. Name: "Cluster",
  4017. }
  4018. // field version check
  4019. if uint8(1) <= version {
  4020. if buff.ReadUInt8() == uint8(0) {
  4021. if !yield(fi, nil) {
  4022. return
  4023. }
  4024. } else {
  4025. // --- [begin][read][struct](Cluster) ---
  4026. f := new(Cluster)
  4027. buff.ReadInt() // [compatibility, unused]
  4028. errC := f.UnmarshalBinaryWithContext(ctx)
  4029. if errC != nil {
  4030. stream.err = errC
  4031. return
  4032. }
  4033. e := f
  4034. // --- [end][read][struct](Cluster) ---
  4035. if !yield(fi, bstream.SingleV(e)) {
  4036. return
  4037. }
  4038. }
  4039. } else {
  4040. if !yield(fi, nil) {
  4041. return
  4042. }
  4043. }
  4044. fi = bstream.BingenFieldInfo{
  4045. Type: reflect.TypeFor[map[string]*Namespace](),
  4046. Name: "Namespaces",
  4047. }
  4048. // field version check
  4049. if uint8(1) <= version {
  4050. if buff.ReadUInt8() == uint8(0) {
  4051. if !yield(fi, nil) {
  4052. return
  4053. }
  4054. } else {
  4055. // --- [begin][read][streaming-map](map[string]*Namespace) ---
  4056. g := buff.ReadInt() // map len
  4057. for range g {
  4058. var v string
  4059. var l string
  4060. if ctx.IsStringTable() {
  4061. m := buff.ReadInt() // read string index
  4062. l = ctx.Table.At(m)
  4063. } else {
  4064. l = buff.ReadString() // read string
  4065. }
  4066. h := l
  4067. v = h
  4068. var z *Namespace
  4069. if buff.ReadUInt8() == uint8(0) {
  4070. z = nil
  4071. } else {
  4072. // --- [begin][read][struct](Namespace) ---
  4073. n := new(Namespace)
  4074. buff.ReadInt() // [compatibility, unused]
  4075. errD := n.UnmarshalBinaryWithContext(ctx)
  4076. if errD != nil {
  4077. stream.err = errD
  4078. return
  4079. }
  4080. z = n
  4081. // --- [end][read][struct](Namespace) ---
  4082. }
  4083. if !yield(fi, bstream.PairV(v, z)) {
  4084. return
  4085. }
  4086. }
  4087. // --- [end][read][streaming-map](map[string]*Namespace) ---
  4088. }
  4089. } else {
  4090. if !yield(fi, nil) {
  4091. return
  4092. }
  4093. }
  4094. fi = bstream.BingenFieldInfo{
  4095. Type: reflect.TypeFor[map[string]*ResourceQuota](),
  4096. Name: "ResourceQuotas",
  4097. }
  4098. // field version check
  4099. if uint8(1) <= version {
  4100. if buff.ReadUInt8() == uint8(0) {
  4101. if !yield(fi, nil) {
  4102. return
  4103. }
  4104. } else {
  4105. // --- [begin][read][streaming-map](map[string]*ResourceQuota) ---
  4106. o := buff.ReadInt() // map len
  4107. for range o {
  4108. var vv string
  4109. var q string
  4110. if ctx.IsStringTable() {
  4111. r := buff.ReadInt() // read string index
  4112. q = ctx.Table.At(r)
  4113. } else {
  4114. q = buff.ReadString() // read string
  4115. }
  4116. p := q
  4117. vv = p
  4118. var zz *ResourceQuota
  4119. if buff.ReadUInt8() == uint8(0) {
  4120. zz = nil
  4121. } else {
  4122. // --- [begin][read][struct](ResourceQuota) ---
  4123. s := new(ResourceQuota)
  4124. buff.ReadInt() // [compatibility, unused]
  4125. errE := s.UnmarshalBinaryWithContext(ctx)
  4126. if errE != nil {
  4127. stream.err = errE
  4128. return
  4129. }
  4130. zz = s
  4131. // --- [end][read][struct](ResourceQuota) ---
  4132. }
  4133. if !yield(fi, bstream.PairV(vv, zz)) {
  4134. return
  4135. }
  4136. }
  4137. // --- [end][read][streaming-map](map[string]*ResourceQuota) ---
  4138. }
  4139. } else {
  4140. if !yield(fi, nil) {
  4141. return
  4142. }
  4143. }
  4144. fi = bstream.BingenFieldInfo{
  4145. Type: reflect.TypeFor[map[string]*Service](),
  4146. Name: "Services",
  4147. }
  4148. // field version check
  4149. if uint8(2) <= version {
  4150. if buff.ReadUInt8() == uint8(0) {
  4151. if !yield(fi, nil) {
  4152. return
  4153. }
  4154. } else {
  4155. // --- [begin][read][streaming-map](map[string]*Service) ---
  4156. t := buff.ReadInt() // map len
  4157. for range t {
  4158. var vvv string
  4159. var w string
  4160. if ctx.IsStringTable() {
  4161. x := buff.ReadInt() // read string index
  4162. w = ctx.Table.At(x)
  4163. } else {
  4164. w = buff.ReadString() // read string
  4165. }
  4166. u := w
  4167. vvv = u
  4168. var zzz *Service
  4169. if buff.ReadUInt8() == uint8(0) {
  4170. zzz = nil
  4171. } else {
  4172. // --- [begin][read][struct](Service) ---
  4173. y := new(Service)
  4174. buff.ReadInt() // [compatibility, unused]
  4175. errF := y.UnmarshalBinaryWithContext(ctx)
  4176. if errF != nil {
  4177. stream.err = errF
  4178. return
  4179. }
  4180. zzz = y
  4181. // --- [end][read][struct](Service) ---
  4182. }
  4183. if !yield(fi, bstream.PairV(vvv, zzz)) {
  4184. return
  4185. }
  4186. }
  4187. // --- [end][read][streaming-map](map[string]*Service) ---
  4188. }
  4189. } else {
  4190. if !yield(fi, nil) {
  4191. return
  4192. }
  4193. }
  4194. fi = bstream.BingenFieldInfo{
  4195. Type: reflect.TypeFor[map[string]*Deployment](),
  4196. Name: "Deployments",
  4197. }
  4198. // field version check
  4199. if uint8(2) <= version {
  4200. if buff.ReadUInt8() == uint8(0) {
  4201. if !yield(fi, nil) {
  4202. return
  4203. }
  4204. } else {
  4205. // --- [begin][read][streaming-map](map[string]*Deployment) ---
  4206. aa := buff.ReadInt() // map len
  4207. for range aa {
  4208. var vvvv string
  4209. var cc string
  4210. if ctx.IsStringTable() {
  4211. dd := buff.ReadInt() // read string index
  4212. cc = ctx.Table.At(dd)
  4213. } else {
  4214. cc = buff.ReadString() // read string
  4215. }
  4216. bb := cc
  4217. vvvv = bb
  4218. var zzzz *Deployment
  4219. if buff.ReadUInt8() == uint8(0) {
  4220. zzzz = nil
  4221. } else {
  4222. // --- [begin][read][struct](Deployment) ---
  4223. ee := new(Deployment)
  4224. buff.ReadInt() // [compatibility, unused]
  4225. errG := ee.UnmarshalBinaryWithContext(ctx)
  4226. if errG != nil {
  4227. stream.err = errG
  4228. return
  4229. }
  4230. zzzz = ee
  4231. // --- [end][read][struct](Deployment) ---
  4232. }
  4233. if !yield(fi, bstream.PairV(vvvv, zzzz)) {
  4234. return
  4235. }
  4236. }
  4237. // --- [end][read][streaming-map](map[string]*Deployment) ---
  4238. }
  4239. } else {
  4240. if !yield(fi, nil) {
  4241. return
  4242. }
  4243. }
  4244. fi = bstream.BingenFieldInfo{
  4245. Type: reflect.TypeFor[map[string]*StatefulSet](),
  4246. Name: "StatefulSets",
  4247. }
  4248. // field version check
  4249. if uint8(2) <= version {
  4250. if buff.ReadUInt8() == uint8(0) {
  4251. if !yield(fi, nil) {
  4252. return
  4253. }
  4254. } else {
  4255. // --- [begin][read][streaming-map](map[string]*StatefulSet) ---
  4256. ff := buff.ReadInt() // map len
  4257. for range ff {
  4258. var vvvvv string
  4259. var hh string
  4260. if ctx.IsStringTable() {
  4261. ll := buff.ReadInt() // read string index
  4262. hh = ctx.Table.At(ll)
  4263. } else {
  4264. hh = buff.ReadString() // read string
  4265. }
  4266. gg := hh
  4267. vvvvv = gg
  4268. var zzzzz *StatefulSet
  4269. if buff.ReadUInt8() == uint8(0) {
  4270. zzzzz = nil
  4271. } else {
  4272. // --- [begin][read][struct](StatefulSet) ---
  4273. mm := new(StatefulSet)
  4274. buff.ReadInt() // [compatibility, unused]
  4275. errH := mm.UnmarshalBinaryWithContext(ctx)
  4276. if errH != nil {
  4277. stream.err = errH
  4278. return
  4279. }
  4280. zzzzz = mm
  4281. // --- [end][read][struct](StatefulSet) ---
  4282. }
  4283. if !yield(fi, bstream.PairV(vvvvv, zzzzz)) {
  4284. return
  4285. }
  4286. }
  4287. // --- [end][read][streaming-map](map[string]*StatefulSet) ---
  4288. }
  4289. } else {
  4290. if !yield(fi, nil) {
  4291. return
  4292. }
  4293. }
  4294. fi = bstream.BingenFieldInfo{
  4295. Type: reflect.TypeFor[map[string]*DaemonSet](),
  4296. Name: "DaemonSets",
  4297. }
  4298. // field version check
  4299. if uint8(2) <= version {
  4300. if buff.ReadUInt8() == uint8(0) {
  4301. if !yield(fi, nil) {
  4302. return
  4303. }
  4304. } else {
  4305. // --- [begin][read][streaming-map](map[string]*DaemonSet) ---
  4306. nn := buff.ReadInt() // map len
  4307. for range nn {
  4308. var vvvvvv string
  4309. var pp string
  4310. if ctx.IsStringTable() {
  4311. qq := buff.ReadInt() // read string index
  4312. pp = ctx.Table.At(qq)
  4313. } else {
  4314. pp = buff.ReadString() // read string
  4315. }
  4316. oo := pp
  4317. vvvvvv = oo
  4318. var zzzzzz *DaemonSet
  4319. if buff.ReadUInt8() == uint8(0) {
  4320. zzzzzz = nil
  4321. } else {
  4322. // --- [begin][read][struct](DaemonSet) ---
  4323. rr := new(DaemonSet)
  4324. buff.ReadInt() // [compatibility, unused]
  4325. errI := rr.UnmarshalBinaryWithContext(ctx)
  4326. if errI != nil {
  4327. stream.err = errI
  4328. return
  4329. }
  4330. zzzzzz = rr
  4331. // --- [end][read][struct](DaemonSet) ---
  4332. }
  4333. if !yield(fi, bstream.PairV(vvvvvv, zzzzzz)) {
  4334. return
  4335. }
  4336. }
  4337. // --- [end][read][streaming-map](map[string]*DaemonSet) ---
  4338. }
  4339. } else {
  4340. if !yield(fi, nil) {
  4341. return
  4342. }
  4343. }
  4344. fi = bstream.BingenFieldInfo{
  4345. Type: reflect.TypeFor[map[string]*Job](),
  4346. Name: "Jobs",
  4347. }
  4348. // field version check
  4349. if uint8(2) <= version {
  4350. if buff.ReadUInt8() == uint8(0) {
  4351. if !yield(fi, nil) {
  4352. return
  4353. }
  4354. } else {
  4355. // --- [begin][read][streaming-map](map[string]*Job) ---
  4356. ss := buff.ReadInt() // map len
  4357. for range ss {
  4358. var vvvvvvv string
  4359. var uu string
  4360. if ctx.IsStringTable() {
  4361. ww := buff.ReadInt() // read string index
  4362. uu = ctx.Table.At(ww)
  4363. } else {
  4364. uu = buff.ReadString() // read string
  4365. }
  4366. tt := uu
  4367. vvvvvvv = tt
  4368. var zzzzzzz *Job
  4369. if buff.ReadUInt8() == uint8(0) {
  4370. zzzzzzz = nil
  4371. } else {
  4372. // --- [begin][read][struct](Job) ---
  4373. xx := new(Job)
  4374. buff.ReadInt() // [compatibility, unused]
  4375. errJ := xx.UnmarshalBinaryWithContext(ctx)
  4376. if errJ != nil {
  4377. stream.err = errJ
  4378. return
  4379. }
  4380. zzzzzzz = xx
  4381. // --- [end][read][struct](Job) ---
  4382. }
  4383. if !yield(fi, bstream.PairV(vvvvvvv, zzzzzzz)) {
  4384. return
  4385. }
  4386. }
  4387. // --- [end][read][streaming-map](map[string]*Job) ---
  4388. }
  4389. } else {
  4390. if !yield(fi, nil) {
  4391. return
  4392. }
  4393. }
  4394. fi = bstream.BingenFieldInfo{
  4395. Type: reflect.TypeFor[map[string]*CronJob](),
  4396. Name: "CronJobs",
  4397. }
  4398. // field version check
  4399. if uint8(2) <= version {
  4400. if buff.ReadUInt8() == uint8(0) {
  4401. if !yield(fi, nil) {
  4402. return
  4403. }
  4404. } else {
  4405. // --- [begin][read][streaming-map](map[string]*CronJob) ---
  4406. yy := buff.ReadInt() // map len
  4407. for range yy {
  4408. var vvvvvvvv string
  4409. var bbb string
  4410. if ctx.IsStringTable() {
  4411. ccc := buff.ReadInt() // read string index
  4412. bbb = ctx.Table.At(ccc)
  4413. } else {
  4414. bbb = buff.ReadString() // read string
  4415. }
  4416. aaa := bbb
  4417. vvvvvvvv = aaa
  4418. var zzzzzzzz *CronJob
  4419. if buff.ReadUInt8() == uint8(0) {
  4420. zzzzzzzz = nil
  4421. } else {
  4422. // --- [begin][read][struct](CronJob) ---
  4423. ddd := new(CronJob)
  4424. buff.ReadInt() // [compatibility, unused]
  4425. errK := ddd.UnmarshalBinaryWithContext(ctx)
  4426. if errK != nil {
  4427. stream.err = errK
  4428. return
  4429. }
  4430. zzzzzzzz = ddd
  4431. // --- [end][read][struct](CronJob) ---
  4432. }
  4433. if !yield(fi, bstream.PairV(vvvvvvvv, zzzzzzzz)) {
  4434. return
  4435. }
  4436. }
  4437. // --- [end][read][streaming-map](map[string]*CronJob) ---
  4438. }
  4439. } else {
  4440. if !yield(fi, nil) {
  4441. return
  4442. }
  4443. }
  4444. fi = bstream.BingenFieldInfo{
  4445. Type: reflect.TypeFor[map[string]*ReplicaSet](),
  4446. Name: "ReplicaSets",
  4447. }
  4448. // field version check
  4449. if uint8(2) <= version {
  4450. if buff.ReadUInt8() == uint8(0) {
  4451. if !yield(fi, nil) {
  4452. return
  4453. }
  4454. } else {
  4455. // --- [begin][read][streaming-map](map[string]*ReplicaSet) ---
  4456. eee := buff.ReadInt() // map len
  4457. for range eee {
  4458. var vvvvvvvvv string
  4459. var ggg string
  4460. if ctx.IsStringTable() {
  4461. hhh := buff.ReadInt() // read string index
  4462. ggg = ctx.Table.At(hhh)
  4463. } else {
  4464. ggg = buff.ReadString() // read string
  4465. }
  4466. fff := ggg
  4467. vvvvvvvvv = fff
  4468. var zzzzzzzzz *ReplicaSet
  4469. if buff.ReadUInt8() == uint8(0) {
  4470. zzzzzzzzz = nil
  4471. } else {
  4472. // --- [begin][read][struct](ReplicaSet) ---
  4473. lll := new(ReplicaSet)
  4474. buff.ReadInt() // [compatibility, unused]
  4475. errL := lll.UnmarshalBinaryWithContext(ctx)
  4476. if errL != nil {
  4477. stream.err = errL
  4478. return
  4479. }
  4480. zzzzzzzzz = lll
  4481. // --- [end][read][struct](ReplicaSet) ---
  4482. }
  4483. if !yield(fi, bstream.PairV(vvvvvvvvv, zzzzzzzzz)) {
  4484. return
  4485. }
  4486. }
  4487. // --- [end][read][streaming-map](map[string]*ReplicaSet) ---
  4488. }
  4489. } else {
  4490. if !yield(fi, nil) {
  4491. return
  4492. }
  4493. }
  4494. fi = bstream.BingenFieldInfo{
  4495. Type: reflect.TypeFor[map[string]*Node](),
  4496. Name: "Nodes",
  4497. }
  4498. // field version check
  4499. if uint8(2) <= version {
  4500. if buff.ReadUInt8() == uint8(0) {
  4501. if !yield(fi, nil) {
  4502. return
  4503. }
  4504. } else {
  4505. // --- [begin][read][streaming-map](map[string]*Node) ---
  4506. mmm := buff.ReadInt() // map len
  4507. for range mmm {
  4508. var vvvvvvvvvv string
  4509. var ooo string
  4510. if ctx.IsStringTable() {
  4511. ppp := buff.ReadInt() // read string index
  4512. ooo = ctx.Table.At(ppp)
  4513. } else {
  4514. ooo = buff.ReadString() // read string
  4515. }
  4516. nnn := ooo
  4517. vvvvvvvvvv = nnn
  4518. var zzzzzzzzzz *Node
  4519. if buff.ReadUInt8() == uint8(0) {
  4520. zzzzzzzzzz = nil
  4521. } else {
  4522. // --- [begin][read][struct](Node) ---
  4523. qqq := new(Node)
  4524. buff.ReadInt() // [compatibility, unused]
  4525. errM := qqq.UnmarshalBinaryWithContext(ctx)
  4526. if errM != nil {
  4527. stream.err = errM
  4528. return
  4529. }
  4530. zzzzzzzzzz = qqq
  4531. // --- [end][read][struct](Node) ---
  4532. }
  4533. if !yield(fi, bstream.PairV(vvvvvvvvvv, zzzzzzzzzz)) {
  4534. return
  4535. }
  4536. }
  4537. // --- [end][read][streaming-map](map[string]*Node) ---
  4538. }
  4539. } else {
  4540. if !yield(fi, nil) {
  4541. return
  4542. }
  4543. }
  4544. fi = bstream.BingenFieldInfo{
  4545. Type: reflect.TypeFor[map[string]*PersistentVolume](),
  4546. Name: "PersistentVolumes",
  4547. }
  4548. // field version check
  4549. if uint8(2) <= version {
  4550. if buff.ReadUInt8() == uint8(0) {
  4551. if !yield(fi, nil) {
  4552. return
  4553. }
  4554. } else {
  4555. // --- [begin][read][streaming-map](map[string]*PersistentVolume) ---
  4556. rrr := buff.ReadInt() // map len
  4557. for range rrr {
  4558. var vvvvvvvvvvv string
  4559. var ttt string
  4560. if ctx.IsStringTable() {
  4561. uuu := buff.ReadInt() // read string index
  4562. ttt = ctx.Table.At(uuu)
  4563. } else {
  4564. ttt = buff.ReadString() // read string
  4565. }
  4566. sss := ttt
  4567. vvvvvvvvvvv = sss
  4568. var zzzzzzzzzzz *PersistentVolume
  4569. if buff.ReadUInt8() == uint8(0) {
  4570. zzzzzzzzzzz = nil
  4571. } else {
  4572. // --- [begin][read][struct](PersistentVolume) ---
  4573. www := new(PersistentVolume)
  4574. buff.ReadInt() // [compatibility, unused]
  4575. errN := www.UnmarshalBinaryWithContext(ctx)
  4576. if errN != nil {
  4577. stream.err = errN
  4578. return
  4579. }
  4580. zzzzzzzzzzz = www
  4581. // --- [end][read][struct](PersistentVolume) ---
  4582. }
  4583. if !yield(fi, bstream.PairV(vvvvvvvvvvv, zzzzzzzzzzz)) {
  4584. return
  4585. }
  4586. }
  4587. // --- [end][read][streaming-map](map[string]*PersistentVolume) ---
  4588. }
  4589. } else {
  4590. if !yield(fi, nil) {
  4591. return
  4592. }
  4593. }
  4594. fi = bstream.BingenFieldInfo{
  4595. Type: reflect.TypeFor[map[string]*PersistentVolumeClaim](),
  4596. Name: "PersistentVolumeClaims",
  4597. }
  4598. // field version check
  4599. if uint8(2) <= version {
  4600. if buff.ReadUInt8() == uint8(0) {
  4601. if !yield(fi, nil) {
  4602. return
  4603. }
  4604. } else {
  4605. // --- [begin][read][streaming-map](map[string]*PersistentVolumeClaim) ---
  4606. xxx := buff.ReadInt() // map len
  4607. for range xxx {
  4608. var vvvvvvvvvvvv string
  4609. var aaaa string
  4610. if ctx.IsStringTable() {
  4611. bbbb := buff.ReadInt() // read string index
  4612. aaaa = ctx.Table.At(bbbb)
  4613. } else {
  4614. aaaa = buff.ReadString() // read string
  4615. }
  4616. yyy := aaaa
  4617. vvvvvvvvvvvv = yyy
  4618. var zzzzzzzzzzzz *PersistentVolumeClaim
  4619. if buff.ReadUInt8() == uint8(0) {
  4620. zzzzzzzzzzzz = nil
  4621. } else {
  4622. // --- [begin][read][struct](PersistentVolumeClaim) ---
  4623. cccc := new(PersistentVolumeClaim)
  4624. buff.ReadInt() // [compatibility, unused]
  4625. errO := cccc.UnmarshalBinaryWithContext(ctx)
  4626. if errO != nil {
  4627. stream.err = errO
  4628. return
  4629. }
  4630. zzzzzzzzzzzz = cccc
  4631. // --- [end][read][struct](PersistentVolumeClaim) ---
  4632. }
  4633. if !yield(fi, bstream.PairV(vvvvvvvvvvvv, zzzzzzzzzzzz)) {
  4634. return
  4635. }
  4636. }
  4637. // --- [end][read][streaming-map](map[string]*PersistentVolumeClaim) ---
  4638. }
  4639. } else {
  4640. if !yield(fi, nil) {
  4641. return
  4642. }
  4643. }
  4644. fi = bstream.BingenFieldInfo{
  4645. Type: reflect.TypeFor[map[string]*Pod](),
  4646. Name: "Pods",
  4647. }
  4648. // field version check
  4649. if uint8(2) <= version {
  4650. if buff.ReadUInt8() == uint8(0) {
  4651. if !yield(fi, nil) {
  4652. return
  4653. }
  4654. } else {
  4655. // --- [begin][read][streaming-map](map[string]*Pod) ---
  4656. dddd := buff.ReadInt() // map len
  4657. for range dddd {
  4658. var vvvvvvvvvvvvv string
  4659. var ffff string
  4660. if ctx.IsStringTable() {
  4661. gggg := buff.ReadInt() // read string index
  4662. ffff = ctx.Table.At(gggg)
  4663. } else {
  4664. ffff = buff.ReadString() // read string
  4665. }
  4666. eeee := ffff
  4667. vvvvvvvvvvvvv = eeee
  4668. var zzzzzzzzzzzzz *Pod
  4669. if buff.ReadUInt8() == uint8(0) {
  4670. zzzzzzzzzzzzz = nil
  4671. } else {
  4672. // --- [begin][read][struct](Pod) ---
  4673. hhhh := new(Pod)
  4674. buff.ReadInt() // [compatibility, unused]
  4675. errP := hhhh.UnmarshalBinaryWithContext(ctx)
  4676. if errP != nil {
  4677. stream.err = errP
  4678. return
  4679. }
  4680. zzzzzzzzzzzzz = hhhh
  4681. // --- [end][read][struct](Pod) ---
  4682. }
  4683. if !yield(fi, bstream.PairV(vvvvvvvvvvvvv, zzzzzzzzzzzzz)) {
  4684. return
  4685. }
  4686. }
  4687. // --- [end][read][streaming-map](map[string]*Pod) ---
  4688. }
  4689. } else {
  4690. if !yield(fi, nil) {
  4691. return
  4692. }
  4693. }
  4694. fi = bstream.BingenFieldInfo{
  4695. Type: reflect.TypeFor[map[string]*Container](),
  4696. Name: "Containers",
  4697. }
  4698. // field version check
  4699. if uint8(2) <= version {
  4700. if buff.ReadUInt8() == uint8(0) {
  4701. if !yield(fi, nil) {
  4702. return
  4703. }
  4704. } else {
  4705. // --- [begin][read][streaming-map](map[string]*Container) ---
  4706. llll := buff.ReadInt() // map len
  4707. for range llll {
  4708. var vvvvvvvvvvvvvv string
  4709. var nnnn string
  4710. if ctx.IsStringTable() {
  4711. oooo := buff.ReadInt() // read string index
  4712. nnnn = ctx.Table.At(oooo)
  4713. } else {
  4714. nnnn = buff.ReadString() // read string
  4715. }
  4716. mmmm := nnnn
  4717. vvvvvvvvvvvvvv = mmmm
  4718. var zzzzzzzzzzzzzz *Container
  4719. if buff.ReadUInt8() == uint8(0) {
  4720. zzzzzzzzzzzzzz = nil
  4721. } else {
  4722. // --- [begin][read][struct](Container) ---
  4723. pppp := new(Container)
  4724. buff.ReadInt() // [compatibility, unused]
  4725. errQ := pppp.UnmarshalBinaryWithContext(ctx)
  4726. if errQ != nil {
  4727. stream.err = errQ
  4728. return
  4729. }
  4730. zzzzzzzzzzzzzz = pppp
  4731. // --- [end][read][struct](Container) ---
  4732. }
  4733. if !yield(fi, bstream.PairV(vvvvvvvvvvvvvv, zzzzzzzzzzzzzz)) {
  4734. return
  4735. }
  4736. }
  4737. // --- [end][read][streaming-map](map[string]*Container) ---
  4738. }
  4739. } else {
  4740. if !yield(fi, nil) {
  4741. return
  4742. }
  4743. }
  4744. }
  4745. }
  4746. //--------------------------------------------------------------------------
  4747. // Metadata
  4748. //--------------------------------------------------------------------------
  4749. // MarshalBinary serializes the internal properties of this Metadata instance
  4750. // into a byte array
  4751. func (target *Metadata) MarshalBinary() (data []byte, err error) {
  4752. ctx := NewEncodingContext(nil)
  4753. e := target.MarshalBinaryWithContext(ctx)
  4754. if e != nil {
  4755. return nil, e
  4756. }
  4757. return ctx.ToBytes(), nil
  4758. }
  4759. // MarshalBinary serializes the internal properties of this Metadata instance
  4760. // into an io.Writer.
  4761. func (target *Metadata) MarshalBinaryTo(writer io.Writer) error {
  4762. buff := util.NewBufferFromWriter(writer)
  4763. defer buff.Flush()
  4764. ctx := NewEncodingContextFromBuffer(buff, nil)
  4765. return target.MarshalBinaryWithContext(ctx)
  4766. }
  4767. // MarshalBinaryWithContext serializes the internal properties of this Metadata instance
  4768. // into a byte array leveraging a predefined context.
  4769. func (target *Metadata) MarshalBinaryWithContext(ctx *EncodingContext) (err error) {
  4770. // panics are recovered and propagated as errors
  4771. defer func() {
  4772. if r := recover(); r != nil {
  4773. if e, ok := r.(error); ok {
  4774. err = e
  4775. } else if s, ok := r.(string); ok {
  4776. err = fmt.Errorf("unexpected panic: %s", s)
  4777. } else {
  4778. err = fmt.Errorf("unexpected panic: %+v", r)
  4779. }
  4780. }
  4781. }()
  4782. buff := ctx.Buffer
  4783. buff.WriteUInt8(DefaultCodecVersion) // version
  4784. // --- [begin][write][reference](time.Time) ---
  4785. a, errA := target.CreatedAt.MarshalBinary()
  4786. if errA != nil {
  4787. return errA
  4788. }
  4789. buff.WriteInt(len(a))
  4790. buff.WriteBytes(a)
  4791. // --- [end][write][reference](time.Time) ---
  4792. // --- [begin][write][reference](time.Time) ---
  4793. b, errB := target.CompletedAt.MarshalBinary()
  4794. if errB != nil {
  4795. return errB
  4796. }
  4797. buff.WriteInt(len(b))
  4798. buff.WriteBytes(b)
  4799. // --- [end][write][reference](time.Time) ---
  4800. buff.WriteInt(target.ObjectCount) // write int
  4801. if target.Diagnostics == nil {
  4802. buff.WriteUInt8(uint8(0)) // write nil byte
  4803. } else {
  4804. buff.WriteUInt8(uint8(1)) // write non-nil byte
  4805. // --- [begin][write][slice]([]Diagnostic) ---
  4806. buff.WriteInt(len(target.Diagnostics)) // slice length
  4807. for i := range target.Diagnostics {
  4808. // --- [begin][write][struct](Diagnostic) ---
  4809. buff.WriteInt(0) // [compatibility, unused]
  4810. errC := target.Diagnostics[i].MarshalBinaryWithContext(ctx)
  4811. if errC != nil {
  4812. return errC
  4813. }
  4814. // --- [end][write][struct](Diagnostic) ---
  4815. }
  4816. // --- [end][write][slice]([]Diagnostic) ---
  4817. }
  4818. // --- [begin][write][alias](DiagnosticLevel) ---
  4819. buff.WriteInt(int(target.DiagnosticLevel)) // write int
  4820. // --- [end][write][alias](DiagnosticLevel) ---
  4821. return nil
  4822. }
  4823. // UnmarshalBinary uses the data passed byte array to set all the internal properties of
  4824. // the Metadata type
  4825. func (target *Metadata) UnmarshalBinary(data []byte) error {
  4826. ctx := NewDecodingContextFromBytes(data)
  4827. defer ctx.Close()
  4828. err := target.UnmarshalBinaryWithContext(ctx)
  4829. if err != nil {
  4830. return err
  4831. }
  4832. return nil
  4833. }
  4834. // UnmarshalBinaryFromReader uses the io.Reader data to set all the internal properties of
  4835. // the Metadata type
  4836. func (target *Metadata) UnmarshalBinaryFromReader(reader io.Reader) error {
  4837. ctx := NewDecodingContextFromReader(reader)
  4838. defer ctx.Close()
  4839. err := target.UnmarshalBinaryWithContext(ctx)
  4840. if err != nil {
  4841. return err
  4842. }
  4843. return nil
  4844. }
  4845. // UnmarshalBinaryWithContext uses the context containing a string table and binary buffer to set all the internal properties of
  4846. // the Metadata type
  4847. func (target *Metadata) UnmarshalBinaryWithContext(ctx *DecodingContext) (err error) {
  4848. // panics are recovered and propagated as errors
  4849. defer func() {
  4850. if r := recover(); r != nil {
  4851. if e, ok := r.(error); ok {
  4852. err = e
  4853. } else if s, ok := r.(string); ok {
  4854. err = fmt.Errorf("unexpected panic: %s", s)
  4855. } else {
  4856. err = fmt.Errorf("unexpected panic: %+v", r)
  4857. }
  4858. }
  4859. }()
  4860. buff := ctx.Buffer
  4861. version := buff.ReadUInt8()
  4862. if version > DefaultCodecVersion {
  4863. return fmt.Errorf("Invalid Version Unmarshalling Metadata. Expected %d or less, got %d", DefaultCodecVersion, version)
  4864. }
  4865. // field version check
  4866. if uint8(1) <= version {
  4867. // --- [begin][read][reference](time.Time) ---
  4868. a := new(time.Time)
  4869. b := buff.ReadInt() // byte array length
  4870. c := buff.ReadBytes(b)
  4871. errA := a.UnmarshalBinary(c)
  4872. if errA != nil {
  4873. return errA
  4874. }
  4875. target.CreatedAt = *a
  4876. // --- [end][read][reference](time.Time) ---
  4877. } else {
  4878. }
  4879. // field version check
  4880. if uint8(1) <= version {
  4881. // --- [begin][read][reference](time.Time) ---
  4882. d := new(time.Time)
  4883. e := buff.ReadInt() // byte array length
  4884. f := buff.ReadBytes(e)
  4885. errB := d.UnmarshalBinary(f)
  4886. if errB != nil {
  4887. return errB
  4888. }
  4889. target.CompletedAt = *d
  4890. // --- [end][read][reference](time.Time) ---
  4891. } else {
  4892. }
  4893. // field version check
  4894. if uint8(1) <= version {
  4895. g := buff.ReadInt() // read int
  4896. target.ObjectCount = g
  4897. } else {
  4898. target.ObjectCount = int(0) // default
  4899. }
  4900. // field version check
  4901. if uint8(1) <= version {
  4902. if buff.ReadUInt8() == uint8(0) {
  4903. target.Diagnostics = nil
  4904. } else {
  4905. // --- [begin][read][slice]([]Diagnostic) ---
  4906. l := buff.ReadInt() // slice len
  4907. h := make([]Diagnostic, l)
  4908. for i := range l {
  4909. // --- [begin][read][struct](Diagnostic) ---
  4910. n := new(Diagnostic)
  4911. buff.ReadInt() // [compatibility, unused]
  4912. errC := n.UnmarshalBinaryWithContext(ctx)
  4913. if errC != nil {
  4914. return errC
  4915. }
  4916. m := *n
  4917. // --- [end][read][struct](Diagnostic) ---
  4918. h[i] = m
  4919. }
  4920. target.Diagnostics = h
  4921. // --- [end][read][slice]([]Diagnostic) ---
  4922. }
  4923. } else {
  4924. target.Diagnostics = nil
  4925. }
  4926. // field version check
  4927. if uint8(1) <= version {
  4928. // --- [begin][read][alias](DiagnosticLevel) ---
  4929. var o int
  4930. p := buff.ReadInt() // read int
  4931. o = p
  4932. target.DiagnosticLevel = DiagnosticLevel(o)
  4933. // --- [end][read][alias](DiagnosticLevel) ---
  4934. } else {
  4935. }
  4936. return nil
  4937. }
  4938. //--------------------------------------------------------------------------
  4939. // Namespace
  4940. //--------------------------------------------------------------------------
  4941. // MarshalBinary serializes the internal properties of this Namespace instance
  4942. // into a byte array
  4943. func (target *Namespace) MarshalBinary() (data []byte, err error) {
  4944. ctx := NewEncodingContext(nil)
  4945. e := target.MarshalBinaryWithContext(ctx)
  4946. if e != nil {
  4947. return nil, e
  4948. }
  4949. return ctx.ToBytes(), nil
  4950. }
  4951. // MarshalBinary serializes the internal properties of this Namespace instance
  4952. // into an io.Writer.
  4953. func (target *Namespace) MarshalBinaryTo(writer io.Writer) error {
  4954. buff := util.NewBufferFromWriter(writer)
  4955. defer buff.Flush()
  4956. ctx := NewEncodingContextFromBuffer(buff, nil)
  4957. return target.MarshalBinaryWithContext(ctx)
  4958. }
  4959. // MarshalBinaryWithContext serializes the internal properties of this Namespace instance
  4960. // into a byte array leveraging a predefined context.
  4961. func (target *Namespace) MarshalBinaryWithContext(ctx *EncodingContext) (err error) {
  4962. // panics are recovered and propagated as errors
  4963. defer func() {
  4964. if r := recover(); r != nil {
  4965. if e, ok := r.(error); ok {
  4966. err = e
  4967. } else if s, ok := r.(string); ok {
  4968. err = fmt.Errorf("unexpected panic: %s", s)
  4969. } else {
  4970. err = fmt.Errorf("unexpected panic: %+v", r)
  4971. }
  4972. }
  4973. }()
  4974. buff := ctx.Buffer
  4975. buff.WriteUInt8(DefaultCodecVersion) // version
  4976. if ctx.IsStringTable() {
  4977. a := ctx.Table.AddOrGet(target.UID)
  4978. buff.WriteInt(a) // write table index
  4979. } else {
  4980. buff.WriteString(target.UID) // write string
  4981. }
  4982. if ctx.IsStringTable() {
  4983. b := ctx.Table.AddOrGet(target.bingenPlaceHolder)
  4984. buff.WriteInt(b) // write table index
  4985. } else {
  4986. buff.WriteString(target.bingenPlaceHolder) // write string
  4987. }
  4988. if ctx.IsStringTable() {
  4989. c := ctx.Table.AddOrGet(target.Name)
  4990. buff.WriteInt(c) // write table index
  4991. } else {
  4992. buff.WriteString(target.Name) // write string
  4993. }
  4994. if target.Labels == nil {
  4995. buff.WriteUInt8(uint8(0)) // write nil byte
  4996. } else {
  4997. buff.WriteUInt8(uint8(1)) // write non-nil byte
  4998. // --- [begin][write][map](map[string]string) ---
  4999. buff.WriteInt(len(target.Labels)) // map length
  5000. for v, z := range target.Labels {
  5001. if ctx.IsStringTable() {
  5002. d := ctx.Table.AddOrGet(v)
  5003. buff.WriteInt(d) // write table index
  5004. } else {
  5005. buff.WriteString(v) // write string
  5006. }
  5007. if ctx.IsStringTable() {
  5008. e := ctx.Table.AddOrGet(z)
  5009. buff.WriteInt(e) // write table index
  5010. } else {
  5011. buff.WriteString(z) // write string
  5012. }
  5013. }
  5014. // --- [end][write][map](map[string]string) ---
  5015. }
  5016. if target.Annotations == nil {
  5017. buff.WriteUInt8(uint8(0)) // write nil byte
  5018. } else {
  5019. buff.WriteUInt8(uint8(1)) // write non-nil byte
  5020. // --- [begin][write][map](map[string]string) ---
  5021. buff.WriteInt(len(target.Annotations)) // map length
  5022. for vv, zz := range target.Annotations {
  5023. if ctx.IsStringTable() {
  5024. f := ctx.Table.AddOrGet(vv)
  5025. buff.WriteInt(f) // write table index
  5026. } else {
  5027. buff.WriteString(vv) // write string
  5028. }
  5029. if ctx.IsStringTable() {
  5030. g := ctx.Table.AddOrGet(zz)
  5031. buff.WriteInt(g) // write table index
  5032. } else {
  5033. buff.WriteString(zz) // write string
  5034. }
  5035. }
  5036. // --- [end][write][map](map[string]string) ---
  5037. }
  5038. // --- [begin][write][reference](time.Time) ---
  5039. h, errA := target.Start.MarshalBinary()
  5040. if errA != nil {
  5041. return errA
  5042. }
  5043. buff.WriteInt(len(h))
  5044. buff.WriteBytes(h)
  5045. // --- [end][write][reference](time.Time) ---
  5046. // --- [begin][write][reference](time.Time) ---
  5047. l, errB := target.End.MarshalBinary()
  5048. if errB != nil {
  5049. return errB
  5050. }
  5051. buff.WriteInt(len(l))
  5052. buff.WriteBytes(l)
  5053. // --- [end][write][reference](time.Time) ---
  5054. return nil
  5055. }
  5056. // UnmarshalBinary uses the data passed byte array to set all the internal properties of
  5057. // the Namespace type
  5058. func (target *Namespace) UnmarshalBinary(data []byte) error {
  5059. ctx := NewDecodingContextFromBytes(data)
  5060. defer ctx.Close()
  5061. err := target.UnmarshalBinaryWithContext(ctx)
  5062. if err != nil {
  5063. return err
  5064. }
  5065. return nil
  5066. }
  5067. // UnmarshalBinaryFromReader uses the io.Reader data to set all the internal properties of
  5068. // the Namespace type
  5069. func (target *Namespace) UnmarshalBinaryFromReader(reader io.Reader) error {
  5070. ctx := NewDecodingContextFromReader(reader)
  5071. defer ctx.Close()
  5072. err := target.UnmarshalBinaryWithContext(ctx)
  5073. if err != nil {
  5074. return err
  5075. }
  5076. return nil
  5077. }
  5078. // UnmarshalBinaryWithContext uses the context containing a string table and binary buffer to set all the internal properties of
  5079. // the Namespace type
  5080. func (target *Namespace) UnmarshalBinaryWithContext(ctx *DecodingContext) (err error) {
  5081. // panics are recovered and propagated as errors
  5082. defer func() {
  5083. if r := recover(); r != nil {
  5084. if e, ok := r.(error); ok {
  5085. err = e
  5086. } else if s, ok := r.(string); ok {
  5087. err = fmt.Errorf("unexpected panic: %s", s)
  5088. } else {
  5089. err = fmt.Errorf("unexpected panic: %+v", r)
  5090. }
  5091. }
  5092. }()
  5093. buff := ctx.Buffer
  5094. version := buff.ReadUInt8()
  5095. if version > DefaultCodecVersion {
  5096. return fmt.Errorf("Invalid Version Unmarshalling Namespace. Expected %d or less, got %d", DefaultCodecVersion, version)
  5097. }
  5098. // field version check
  5099. if uint8(1) <= version {
  5100. var b string
  5101. if ctx.IsStringTable() {
  5102. c := buff.ReadInt() // read string index
  5103. b = ctx.Table.At(c)
  5104. } else {
  5105. b = buff.ReadString() // read string
  5106. }
  5107. a := b
  5108. target.UID = a
  5109. } else {
  5110. target.UID = "" // default
  5111. }
  5112. // field version check
  5113. if uint8(1) <= version {
  5114. var e string
  5115. if ctx.IsStringTable() {
  5116. f := buff.ReadInt() // read string index
  5117. e = ctx.Table.At(f)
  5118. } else {
  5119. e = buff.ReadString() // read string
  5120. }
  5121. d := e
  5122. target.bingenPlaceHolder = d
  5123. } else {
  5124. target.bingenPlaceHolder = "" // default
  5125. }
  5126. // field version check
  5127. if uint8(1) <= version {
  5128. var h string
  5129. if ctx.IsStringTable() {
  5130. l := buff.ReadInt() // read string index
  5131. h = ctx.Table.At(l)
  5132. } else {
  5133. h = buff.ReadString() // read string
  5134. }
  5135. g := h
  5136. target.Name = g
  5137. } else {
  5138. target.Name = "" // default
  5139. }
  5140. // field version check
  5141. if uint8(1) <= version {
  5142. if buff.ReadUInt8() == uint8(0) {
  5143. target.Labels = nil
  5144. } else {
  5145. // --- [begin][read][map](map[string]string) ---
  5146. n := buff.ReadInt() // map len
  5147. m := make(map[string]string, n)
  5148. for range n {
  5149. var v string
  5150. var p string
  5151. if ctx.IsStringTable() {
  5152. q := buff.ReadInt() // read string index
  5153. p = ctx.Table.At(q)
  5154. } else {
  5155. p = buff.ReadString() // read string
  5156. }
  5157. o := p
  5158. v = o
  5159. var z string
  5160. var s string
  5161. if ctx.IsStringTable() {
  5162. t := buff.ReadInt() // read string index
  5163. s = ctx.Table.At(t)
  5164. } else {
  5165. s = buff.ReadString() // read string
  5166. }
  5167. r := s
  5168. z = r
  5169. m[v] = z
  5170. }
  5171. target.Labels = m
  5172. // --- [end][read][map](map[string]string) ---
  5173. }
  5174. } else {
  5175. target.Labels = nil
  5176. }
  5177. // field version check
  5178. if uint8(1) <= version {
  5179. if buff.ReadUInt8() == uint8(0) {
  5180. target.Annotations = nil
  5181. } else {
  5182. // --- [begin][read][map](map[string]string) ---
  5183. w := buff.ReadInt() // map len
  5184. u := make(map[string]string, w)
  5185. for range w {
  5186. var vv string
  5187. var y string
  5188. if ctx.IsStringTable() {
  5189. aa := buff.ReadInt() // read string index
  5190. y = ctx.Table.At(aa)
  5191. } else {
  5192. y = buff.ReadString() // read string
  5193. }
  5194. x := y
  5195. vv = x
  5196. var zz string
  5197. var cc string
  5198. if ctx.IsStringTable() {
  5199. dd := buff.ReadInt() // read string index
  5200. cc = ctx.Table.At(dd)
  5201. } else {
  5202. cc = buff.ReadString() // read string
  5203. }
  5204. bb := cc
  5205. zz = bb
  5206. u[vv] = zz
  5207. }
  5208. target.Annotations = u
  5209. // --- [end][read][map](map[string]string) ---
  5210. }
  5211. } else {
  5212. target.Annotations = nil
  5213. }
  5214. // field version check
  5215. if uint8(1) <= version {
  5216. // --- [begin][read][reference](time.Time) ---
  5217. ee := new(time.Time)
  5218. ff := buff.ReadInt() // byte array length
  5219. gg := buff.ReadBytes(ff)
  5220. errA := ee.UnmarshalBinary(gg)
  5221. if errA != nil {
  5222. return errA
  5223. }
  5224. target.Start = *ee
  5225. // --- [end][read][reference](time.Time) ---
  5226. } else {
  5227. }
  5228. // field version check
  5229. if uint8(1) <= version {
  5230. // --- [begin][read][reference](time.Time) ---
  5231. hh := new(time.Time)
  5232. ll := buff.ReadInt() // byte array length
  5233. mm := buff.ReadBytes(ll)
  5234. errB := hh.UnmarshalBinary(mm)
  5235. if errB != nil {
  5236. return errB
  5237. }
  5238. target.End = *hh
  5239. // --- [end][read][reference](time.Time) ---
  5240. } else {
  5241. }
  5242. return nil
  5243. }
  5244. //--------------------------------------------------------------------------
  5245. // NetworkTrafficDetail
  5246. //--------------------------------------------------------------------------
  5247. // MarshalBinary serializes the internal properties of this NetworkTrafficDetail instance
  5248. // into a byte array
  5249. func (target *NetworkTrafficDetail) MarshalBinary() (data []byte, err error) {
  5250. ctx := NewEncodingContext(nil)
  5251. e := target.MarshalBinaryWithContext(ctx)
  5252. if e != nil {
  5253. return nil, e
  5254. }
  5255. return ctx.ToBytes(), nil
  5256. }
  5257. // MarshalBinary serializes the internal properties of this NetworkTrafficDetail instance
  5258. // into an io.Writer.
  5259. func (target *NetworkTrafficDetail) MarshalBinaryTo(writer io.Writer) error {
  5260. buff := util.NewBufferFromWriter(writer)
  5261. defer buff.Flush()
  5262. ctx := NewEncodingContextFromBuffer(buff, nil)
  5263. return target.MarshalBinaryWithContext(ctx)
  5264. }
  5265. // MarshalBinaryWithContext serializes the internal properties of this NetworkTrafficDetail instance
  5266. // into a byte array leveraging a predefined context.
  5267. func (target *NetworkTrafficDetail) MarshalBinaryWithContext(ctx *EncodingContext) (err error) {
  5268. // panics are recovered and propagated as errors
  5269. defer func() {
  5270. if r := recover(); r != nil {
  5271. if e, ok := r.(error); ok {
  5272. err = e
  5273. } else if s, ok := r.(string); ok {
  5274. err = fmt.Errorf("unexpected panic: %s", s)
  5275. } else {
  5276. err = fmt.Errorf("unexpected panic: %+v", r)
  5277. }
  5278. }
  5279. }()
  5280. buff := ctx.Buffer
  5281. buff.WriteUInt8(DefaultCodecVersion) // version
  5282. if ctx.IsStringTable() {
  5283. a := ctx.Table.AddOrGet(target.PodUID)
  5284. buff.WriteInt(a) // write table index
  5285. } else {
  5286. buff.WriteString(target.PodUID) // write string
  5287. }
  5288. if ctx.IsStringTable() {
  5289. b := ctx.Table.AddOrGet(target.Endpoint)
  5290. buff.WriteInt(b) // write table index
  5291. } else {
  5292. buff.WriteString(target.Endpoint) // write string
  5293. }
  5294. // --- [begin][write][alias](TrafficDirection) ---
  5295. if ctx.IsStringTable() {
  5296. c := ctx.Table.AddOrGet(string(target.TrafficDirection))
  5297. buff.WriteInt(c) // write table index
  5298. } else {
  5299. buff.WriteString(string(target.TrafficDirection)) // write string
  5300. }
  5301. // --- [end][write][alias](TrafficDirection) ---
  5302. // --- [begin][write][alias](TrafficType) ---
  5303. if ctx.IsStringTable() {
  5304. d := ctx.Table.AddOrGet(string(target.TrafficType))
  5305. buff.WriteInt(d) // write table index
  5306. } else {
  5307. buff.WriteString(string(target.TrafficType)) // write string
  5308. }
  5309. // --- [end][write][alias](TrafficType) ---
  5310. buff.WriteBool(target.IsNatGateway) // write bool
  5311. buff.WriteFloat64(target.Bytes) // write float64
  5312. return nil
  5313. }
  5314. // UnmarshalBinary uses the data passed byte array to set all the internal properties of
  5315. // the NetworkTrafficDetail type
  5316. func (target *NetworkTrafficDetail) UnmarshalBinary(data []byte) error {
  5317. ctx := NewDecodingContextFromBytes(data)
  5318. defer ctx.Close()
  5319. err := target.UnmarshalBinaryWithContext(ctx)
  5320. if err != nil {
  5321. return err
  5322. }
  5323. return nil
  5324. }
  5325. // UnmarshalBinaryFromReader uses the io.Reader data to set all the internal properties of
  5326. // the NetworkTrafficDetail type
  5327. func (target *NetworkTrafficDetail) UnmarshalBinaryFromReader(reader io.Reader) error {
  5328. ctx := NewDecodingContextFromReader(reader)
  5329. defer ctx.Close()
  5330. err := target.UnmarshalBinaryWithContext(ctx)
  5331. if err != nil {
  5332. return err
  5333. }
  5334. return nil
  5335. }
  5336. // UnmarshalBinaryWithContext uses the context containing a string table and binary buffer to set all the internal properties of
  5337. // the NetworkTrafficDetail type
  5338. func (target *NetworkTrafficDetail) UnmarshalBinaryWithContext(ctx *DecodingContext) (err error) {
  5339. // panics are recovered and propagated as errors
  5340. defer func() {
  5341. if r := recover(); r != nil {
  5342. if e, ok := r.(error); ok {
  5343. err = e
  5344. } else if s, ok := r.(string); ok {
  5345. err = fmt.Errorf("unexpected panic: %s", s)
  5346. } else {
  5347. err = fmt.Errorf("unexpected panic: %+v", r)
  5348. }
  5349. }
  5350. }()
  5351. buff := ctx.Buffer
  5352. version := buff.ReadUInt8()
  5353. if version > DefaultCodecVersion {
  5354. return fmt.Errorf("Invalid Version Unmarshalling NetworkTrafficDetail. Expected %d or less, got %d", DefaultCodecVersion, version)
  5355. }
  5356. var b string
  5357. if ctx.IsStringTable() {
  5358. c := buff.ReadInt() // read string index
  5359. b = ctx.Table.At(c)
  5360. } else {
  5361. b = buff.ReadString() // read string
  5362. }
  5363. a := b
  5364. target.PodUID = a
  5365. var e string
  5366. if ctx.IsStringTable() {
  5367. f := buff.ReadInt() // read string index
  5368. e = ctx.Table.At(f)
  5369. } else {
  5370. e = buff.ReadString() // read string
  5371. }
  5372. d := e
  5373. target.Endpoint = d
  5374. // --- [begin][read][alias](TrafficDirection) ---
  5375. var g string
  5376. var l string
  5377. if ctx.IsStringTable() {
  5378. m := buff.ReadInt() // read string index
  5379. l = ctx.Table.At(m)
  5380. } else {
  5381. l = buff.ReadString() // read string
  5382. }
  5383. h := l
  5384. g = h
  5385. target.TrafficDirection = TrafficDirection(g)
  5386. // --- [end][read][alias](TrafficDirection) ---
  5387. // --- [begin][read][alias](TrafficType) ---
  5388. var n string
  5389. var p string
  5390. if ctx.IsStringTable() {
  5391. q := buff.ReadInt() // read string index
  5392. p = ctx.Table.At(q)
  5393. } else {
  5394. p = buff.ReadString() // read string
  5395. }
  5396. o := p
  5397. n = o
  5398. target.TrafficType = TrafficType(n)
  5399. // --- [end][read][alias](TrafficType) ---
  5400. r := buff.ReadBool() // read bool
  5401. target.IsNatGateway = r
  5402. s := buff.ReadFloat64() // read float64
  5403. target.Bytes = s
  5404. return nil
  5405. }
  5406. //--------------------------------------------------------------------------
  5407. // Node
  5408. //--------------------------------------------------------------------------
  5409. // MarshalBinary serializes the internal properties of this Node instance
  5410. // into a byte array
  5411. func (target *Node) MarshalBinary() (data []byte, err error) {
  5412. ctx := NewEncodingContext(nil)
  5413. e := target.MarshalBinaryWithContext(ctx)
  5414. if e != nil {
  5415. return nil, e
  5416. }
  5417. return ctx.ToBytes(), nil
  5418. }
  5419. // MarshalBinary serializes the internal properties of this Node instance
  5420. // into an io.Writer.
  5421. func (target *Node) MarshalBinaryTo(writer io.Writer) error {
  5422. buff := util.NewBufferFromWriter(writer)
  5423. defer buff.Flush()
  5424. ctx := NewEncodingContextFromBuffer(buff, nil)
  5425. return target.MarshalBinaryWithContext(ctx)
  5426. }
  5427. // MarshalBinaryWithContext serializes the internal properties of this Node instance
  5428. // into a byte array leveraging a predefined context.
  5429. func (target *Node) MarshalBinaryWithContext(ctx *EncodingContext) (err error) {
  5430. // panics are recovered and propagated as errors
  5431. defer func() {
  5432. if r := recover(); r != nil {
  5433. if e, ok := r.(error); ok {
  5434. err = e
  5435. } else if s, ok := r.(string); ok {
  5436. err = fmt.Errorf("unexpected panic: %s", s)
  5437. } else {
  5438. err = fmt.Errorf("unexpected panic: %+v", r)
  5439. }
  5440. }
  5441. }()
  5442. buff := ctx.Buffer
  5443. buff.WriteUInt8(DefaultCodecVersion) // version
  5444. if ctx.IsStringTable() {
  5445. a := ctx.Table.AddOrGet(target.UID)
  5446. buff.WriteInt(a) // write table index
  5447. } else {
  5448. buff.WriteString(target.UID) // write string
  5449. }
  5450. if ctx.IsStringTable() {
  5451. b := ctx.Table.AddOrGet(target.ProviderID)
  5452. buff.WriteInt(b) // write table index
  5453. } else {
  5454. buff.WriteString(target.ProviderID) // write string
  5455. }
  5456. if ctx.IsStringTable() {
  5457. c := ctx.Table.AddOrGet(target.Name)
  5458. buff.WriteInt(c) // write table index
  5459. } else {
  5460. buff.WriteString(target.Name) // write string
  5461. }
  5462. if target.Labels == nil {
  5463. buff.WriteUInt8(uint8(0)) // write nil byte
  5464. } else {
  5465. buff.WriteUInt8(uint8(1)) // write non-nil byte
  5466. // --- [begin][write][map](map[string]string) ---
  5467. buff.WriteInt(len(target.Labels)) // map length
  5468. for v, z := range target.Labels {
  5469. if ctx.IsStringTable() {
  5470. d := ctx.Table.AddOrGet(v)
  5471. buff.WriteInt(d) // write table index
  5472. } else {
  5473. buff.WriteString(v) // write string
  5474. }
  5475. if ctx.IsStringTable() {
  5476. e := ctx.Table.AddOrGet(z)
  5477. buff.WriteInt(e) // write table index
  5478. } else {
  5479. buff.WriteString(z) // write string
  5480. }
  5481. }
  5482. // --- [end][write][map](map[string]string) ---
  5483. }
  5484. // --- [begin][write][alias](ResourceQuantities) ---
  5485. if map[Resource]ResourceQuantity(target.ResourceCapacities) == nil {
  5486. buff.WriteUInt8(uint8(0)) // write nil byte
  5487. } else {
  5488. buff.WriteUInt8(uint8(1)) // write non-nil byte
  5489. // --- [begin][write][map](map[Resource]ResourceQuantity) ---
  5490. buff.WriteInt(len(map[Resource]ResourceQuantity(target.ResourceCapacities))) // map length
  5491. for vv, zz := range map[Resource]ResourceQuantity(target.ResourceCapacities) {
  5492. // --- [begin][write][alias](Resource) ---
  5493. if ctx.IsStringTable() {
  5494. f := ctx.Table.AddOrGet(string(vv))
  5495. buff.WriteInt(f) // write table index
  5496. } else {
  5497. buff.WriteString(string(vv)) // write string
  5498. }
  5499. // --- [end][write][alias](Resource) ---
  5500. // --- [begin][write][struct](ResourceQuantity) ---
  5501. buff.WriteInt(0) // [compatibility, unused]
  5502. errA := zz.MarshalBinaryWithContext(ctx)
  5503. if errA != nil {
  5504. return errA
  5505. }
  5506. // --- [end][write][struct](ResourceQuantity) ---
  5507. }
  5508. // --- [end][write][map](map[Resource]ResourceQuantity) ---
  5509. }
  5510. // --- [end][write][alias](ResourceQuantities) ---
  5511. // --- [begin][write][alias](ResourceQuantities) ---
  5512. if map[Resource]ResourceQuantity(target.ResourcesAllocatable) == nil {
  5513. buff.WriteUInt8(uint8(0)) // write nil byte
  5514. } else {
  5515. buff.WriteUInt8(uint8(1)) // write non-nil byte
  5516. // --- [begin][write][map](map[Resource]ResourceQuantity) ---
  5517. buff.WriteInt(len(map[Resource]ResourceQuantity(target.ResourcesAllocatable))) // map length
  5518. for vvv, zzz := range map[Resource]ResourceQuantity(target.ResourcesAllocatable) {
  5519. // --- [begin][write][alias](Resource) ---
  5520. if ctx.IsStringTable() {
  5521. g := ctx.Table.AddOrGet(string(vvv))
  5522. buff.WriteInt(g) // write table index
  5523. } else {
  5524. buff.WriteString(string(vvv)) // write string
  5525. }
  5526. // --- [end][write][alias](Resource) ---
  5527. // --- [begin][write][struct](ResourceQuantity) ---
  5528. buff.WriteInt(0) // [compatibility, unused]
  5529. errB := zzz.MarshalBinaryWithContext(ctx)
  5530. if errB != nil {
  5531. return errB
  5532. }
  5533. // --- [end][write][struct](ResourceQuantity) ---
  5534. }
  5535. // --- [end][write][map](map[Resource]ResourceQuantity) ---
  5536. }
  5537. // --- [end][write][alias](ResourceQuantities) ---
  5538. // --- [begin][write][struct](FileSystem) ---
  5539. buff.WriteInt(0) // [compatibility, unused]
  5540. errC := target.FileSystem.MarshalBinaryWithContext(ctx)
  5541. if errC != nil {
  5542. return errC
  5543. }
  5544. // --- [end][write][struct](FileSystem) ---
  5545. // --- [begin][write][reference](time.Time) ---
  5546. h, errD := target.Start.MarshalBinary()
  5547. if errD != nil {
  5548. return errD
  5549. }
  5550. buff.WriteInt(len(h))
  5551. buff.WriteBytes(h)
  5552. // --- [end][write][reference](time.Time) ---
  5553. // --- [begin][write][reference](time.Time) ---
  5554. l, errE := target.End.MarshalBinary()
  5555. if errE != nil {
  5556. return errE
  5557. }
  5558. buff.WriteInt(len(l))
  5559. buff.WriteBytes(l)
  5560. // --- [end][write][reference](time.Time) ---
  5561. return nil
  5562. }
  5563. // UnmarshalBinary uses the data passed byte array to set all the internal properties of
  5564. // the Node type
  5565. func (target *Node) UnmarshalBinary(data []byte) error {
  5566. ctx := NewDecodingContextFromBytes(data)
  5567. defer ctx.Close()
  5568. err := target.UnmarshalBinaryWithContext(ctx)
  5569. if err != nil {
  5570. return err
  5571. }
  5572. return nil
  5573. }
  5574. // UnmarshalBinaryFromReader uses the io.Reader data to set all the internal properties of
  5575. // the Node type
  5576. func (target *Node) UnmarshalBinaryFromReader(reader io.Reader) error {
  5577. ctx := NewDecodingContextFromReader(reader)
  5578. defer ctx.Close()
  5579. err := target.UnmarshalBinaryWithContext(ctx)
  5580. if err != nil {
  5581. return err
  5582. }
  5583. return nil
  5584. }
  5585. // UnmarshalBinaryWithContext uses the context containing a string table and binary buffer to set all the internal properties of
  5586. // the Node type
  5587. func (target *Node) UnmarshalBinaryWithContext(ctx *DecodingContext) (err error) {
  5588. // panics are recovered and propagated as errors
  5589. defer func() {
  5590. if r := recover(); r != nil {
  5591. if e, ok := r.(error); ok {
  5592. err = e
  5593. } else if s, ok := r.(string); ok {
  5594. err = fmt.Errorf("unexpected panic: %s", s)
  5595. } else {
  5596. err = fmt.Errorf("unexpected panic: %+v", r)
  5597. }
  5598. }
  5599. }()
  5600. buff := ctx.Buffer
  5601. version := buff.ReadUInt8()
  5602. if version > DefaultCodecVersion {
  5603. return fmt.Errorf("Invalid Version Unmarshalling Node. Expected %d or less, got %d", DefaultCodecVersion, version)
  5604. }
  5605. var b string
  5606. if ctx.IsStringTable() {
  5607. c := buff.ReadInt() // read string index
  5608. b = ctx.Table.At(c)
  5609. } else {
  5610. b = buff.ReadString() // read string
  5611. }
  5612. a := b
  5613. target.UID = a
  5614. var e string
  5615. if ctx.IsStringTable() {
  5616. f := buff.ReadInt() // read string index
  5617. e = ctx.Table.At(f)
  5618. } else {
  5619. e = buff.ReadString() // read string
  5620. }
  5621. d := e
  5622. target.ProviderID = d
  5623. var h string
  5624. if ctx.IsStringTable() {
  5625. l := buff.ReadInt() // read string index
  5626. h = ctx.Table.At(l)
  5627. } else {
  5628. h = buff.ReadString() // read string
  5629. }
  5630. g := h
  5631. target.Name = g
  5632. if buff.ReadUInt8() == uint8(0) {
  5633. target.Labels = nil
  5634. } else {
  5635. // --- [begin][read][map](map[string]string) ---
  5636. n := buff.ReadInt() // map len
  5637. m := make(map[string]string, n)
  5638. for range n {
  5639. var v string
  5640. var p string
  5641. if ctx.IsStringTable() {
  5642. q := buff.ReadInt() // read string index
  5643. p = ctx.Table.At(q)
  5644. } else {
  5645. p = buff.ReadString() // read string
  5646. }
  5647. o := p
  5648. v = o
  5649. var z string
  5650. var s string
  5651. if ctx.IsStringTable() {
  5652. t := buff.ReadInt() // read string index
  5653. s = ctx.Table.At(t)
  5654. } else {
  5655. s = buff.ReadString() // read string
  5656. }
  5657. r := s
  5658. z = r
  5659. m[v] = z
  5660. }
  5661. target.Labels = m
  5662. // --- [end][read][map](map[string]string) ---
  5663. }
  5664. // --- [begin][read][alias](ResourceQuantities) ---
  5665. var u map[Resource]ResourceQuantity
  5666. if buff.ReadUInt8() == uint8(0) {
  5667. u = nil
  5668. } else {
  5669. // --- [begin][read][map](map[Resource]ResourceQuantity) ---
  5670. x := buff.ReadInt() // map len
  5671. w := make(map[Resource]ResourceQuantity, x)
  5672. for range x {
  5673. // --- [begin][read][alias](Resource) ---
  5674. var y string
  5675. var bb string
  5676. if ctx.IsStringTable() {
  5677. cc := buff.ReadInt() // read string index
  5678. bb = ctx.Table.At(cc)
  5679. } else {
  5680. bb = buff.ReadString() // read string
  5681. }
  5682. aa := bb
  5683. y = aa
  5684. vv := Resource(y)
  5685. // --- [end][read][alias](Resource) ---
  5686. // --- [begin][read][struct](ResourceQuantity) ---
  5687. dd := new(ResourceQuantity)
  5688. buff.ReadInt() // [compatibility, unused]
  5689. errA := dd.UnmarshalBinaryWithContext(ctx)
  5690. if errA != nil {
  5691. return errA
  5692. }
  5693. zz := *dd
  5694. // --- [end][read][struct](ResourceQuantity) ---
  5695. w[vv] = zz
  5696. }
  5697. u = w
  5698. // --- [end][read][map](map[Resource]ResourceQuantity) ---
  5699. }
  5700. target.ResourceCapacities = ResourceQuantities(u)
  5701. // --- [end][read][alias](ResourceQuantities) ---
  5702. // --- [begin][read][alias](ResourceQuantities) ---
  5703. var ee map[Resource]ResourceQuantity
  5704. if buff.ReadUInt8() == uint8(0) {
  5705. ee = nil
  5706. } else {
  5707. // --- [begin][read][map](map[Resource]ResourceQuantity) ---
  5708. gg := buff.ReadInt() // map len
  5709. ff := make(map[Resource]ResourceQuantity, gg)
  5710. for range gg {
  5711. // --- [begin][read][alias](Resource) ---
  5712. var hh string
  5713. var mm string
  5714. if ctx.IsStringTable() {
  5715. nn := buff.ReadInt() // read string index
  5716. mm = ctx.Table.At(nn)
  5717. } else {
  5718. mm = buff.ReadString() // read string
  5719. }
  5720. ll := mm
  5721. hh = ll
  5722. vvv := Resource(hh)
  5723. // --- [end][read][alias](Resource) ---
  5724. // --- [begin][read][struct](ResourceQuantity) ---
  5725. oo := new(ResourceQuantity)
  5726. buff.ReadInt() // [compatibility, unused]
  5727. errB := oo.UnmarshalBinaryWithContext(ctx)
  5728. if errB != nil {
  5729. return errB
  5730. }
  5731. zzz := *oo
  5732. // --- [end][read][struct](ResourceQuantity) ---
  5733. ff[vvv] = zzz
  5734. }
  5735. ee = ff
  5736. // --- [end][read][map](map[Resource]ResourceQuantity) ---
  5737. }
  5738. target.ResourcesAllocatable = ResourceQuantities(ee)
  5739. // --- [end][read][alias](ResourceQuantities) ---
  5740. // --- [begin][read][struct](FileSystem) ---
  5741. pp := new(FileSystem)
  5742. buff.ReadInt() // [compatibility, unused]
  5743. errC := pp.UnmarshalBinaryWithContext(ctx)
  5744. if errC != nil {
  5745. return errC
  5746. }
  5747. target.FileSystem = *pp
  5748. // --- [end][read][struct](FileSystem) ---
  5749. // --- [begin][read][reference](time.Time) ---
  5750. qq := new(time.Time)
  5751. rr := buff.ReadInt() // byte array length
  5752. ss := buff.ReadBytes(rr)
  5753. errD := qq.UnmarshalBinary(ss)
  5754. if errD != nil {
  5755. return errD
  5756. }
  5757. target.Start = *qq
  5758. // --- [end][read][reference](time.Time) ---
  5759. // --- [begin][read][reference](time.Time) ---
  5760. tt := new(time.Time)
  5761. uu := buff.ReadInt() // byte array length
  5762. ww := buff.ReadBytes(uu)
  5763. errE := tt.UnmarshalBinary(ww)
  5764. if errE != nil {
  5765. return errE
  5766. }
  5767. target.End = *tt
  5768. // --- [end][read][reference](time.Time) ---
  5769. return nil
  5770. }
  5771. //--------------------------------------------------------------------------
  5772. // Owner
  5773. //--------------------------------------------------------------------------
  5774. // MarshalBinary serializes the internal properties of this Owner instance
  5775. // into a byte array
  5776. func (target *Owner) MarshalBinary() (data []byte, err error) {
  5777. ctx := NewEncodingContext(nil)
  5778. e := target.MarshalBinaryWithContext(ctx)
  5779. if e != nil {
  5780. return nil, e
  5781. }
  5782. return ctx.ToBytes(), nil
  5783. }
  5784. // MarshalBinary serializes the internal properties of this Owner instance
  5785. // into an io.Writer.
  5786. func (target *Owner) MarshalBinaryTo(writer io.Writer) error {
  5787. buff := util.NewBufferFromWriter(writer)
  5788. defer buff.Flush()
  5789. ctx := NewEncodingContextFromBuffer(buff, nil)
  5790. return target.MarshalBinaryWithContext(ctx)
  5791. }
  5792. // MarshalBinaryWithContext serializes the internal properties of this Owner instance
  5793. // into a byte array leveraging a predefined context.
  5794. func (target *Owner) MarshalBinaryWithContext(ctx *EncodingContext) (err error) {
  5795. // panics are recovered and propagated as errors
  5796. defer func() {
  5797. if r := recover(); r != nil {
  5798. if e, ok := r.(error); ok {
  5799. err = e
  5800. } else if s, ok := r.(string); ok {
  5801. err = fmt.Errorf("unexpected panic: %s", s)
  5802. } else {
  5803. err = fmt.Errorf("unexpected panic: %+v", r)
  5804. }
  5805. }
  5806. }()
  5807. buff := ctx.Buffer
  5808. buff.WriteUInt8(DefaultCodecVersion) // version
  5809. if ctx.IsStringTable() {
  5810. a := ctx.Table.AddOrGet(target.UID)
  5811. buff.WriteInt(a) // write table index
  5812. } else {
  5813. buff.WriteString(target.UID) // write string
  5814. }
  5815. buff.WriteBool(target.Controller) // write bool
  5816. // --- [begin][write][alias](OwnerKind) ---
  5817. if ctx.IsStringTable() {
  5818. b := ctx.Table.AddOrGet(string(target.Kind))
  5819. buff.WriteInt(b) // write table index
  5820. } else {
  5821. buff.WriteString(string(target.Kind)) // write string
  5822. }
  5823. // --- [end][write][alias](OwnerKind) ---
  5824. return nil
  5825. }
  5826. // UnmarshalBinary uses the data passed byte array to set all the internal properties of
  5827. // the Owner type
  5828. func (target *Owner) UnmarshalBinary(data []byte) error {
  5829. ctx := NewDecodingContextFromBytes(data)
  5830. defer ctx.Close()
  5831. err := target.UnmarshalBinaryWithContext(ctx)
  5832. if err != nil {
  5833. return err
  5834. }
  5835. return nil
  5836. }
  5837. // UnmarshalBinaryFromReader uses the io.Reader data to set all the internal properties of
  5838. // the Owner type
  5839. func (target *Owner) UnmarshalBinaryFromReader(reader io.Reader) error {
  5840. ctx := NewDecodingContextFromReader(reader)
  5841. defer ctx.Close()
  5842. err := target.UnmarshalBinaryWithContext(ctx)
  5843. if err != nil {
  5844. return err
  5845. }
  5846. return nil
  5847. }
  5848. // UnmarshalBinaryWithContext uses the context containing a string table and binary buffer to set all the internal properties of
  5849. // the Owner type
  5850. func (target *Owner) UnmarshalBinaryWithContext(ctx *DecodingContext) (err error) {
  5851. // panics are recovered and propagated as errors
  5852. defer func() {
  5853. if r := recover(); r != nil {
  5854. if e, ok := r.(error); ok {
  5855. err = e
  5856. } else if s, ok := r.(string); ok {
  5857. err = fmt.Errorf("unexpected panic: %s", s)
  5858. } else {
  5859. err = fmt.Errorf("unexpected panic: %+v", r)
  5860. }
  5861. }
  5862. }()
  5863. buff := ctx.Buffer
  5864. version := buff.ReadUInt8()
  5865. if version > DefaultCodecVersion {
  5866. return fmt.Errorf("Invalid Version Unmarshalling Owner. Expected %d or less, got %d", DefaultCodecVersion, version)
  5867. }
  5868. var b string
  5869. if ctx.IsStringTable() {
  5870. c := buff.ReadInt() // read string index
  5871. b = ctx.Table.At(c)
  5872. } else {
  5873. b = buff.ReadString() // read string
  5874. }
  5875. a := b
  5876. target.UID = a
  5877. d := buff.ReadBool() // read bool
  5878. target.Controller = d
  5879. // --- [begin][read][alias](OwnerKind) ---
  5880. var e string
  5881. var g string
  5882. if ctx.IsStringTable() {
  5883. h := buff.ReadInt() // read string index
  5884. g = ctx.Table.At(h)
  5885. } else {
  5886. g = buff.ReadString() // read string
  5887. }
  5888. f := g
  5889. e = f
  5890. target.Kind = OwnerKind(e)
  5891. // --- [end][read][alias](OwnerKind) ---
  5892. return nil
  5893. }
  5894. //--------------------------------------------------------------------------
  5895. // PersistentVolume
  5896. //--------------------------------------------------------------------------
  5897. // MarshalBinary serializes the internal properties of this PersistentVolume instance
  5898. // into a byte array
  5899. func (target *PersistentVolume) MarshalBinary() (data []byte, err error) {
  5900. ctx := NewEncodingContext(nil)
  5901. e := target.MarshalBinaryWithContext(ctx)
  5902. if e != nil {
  5903. return nil, e
  5904. }
  5905. return ctx.ToBytes(), nil
  5906. }
  5907. // MarshalBinary serializes the internal properties of this PersistentVolume instance
  5908. // into an io.Writer.
  5909. func (target *PersistentVolume) MarshalBinaryTo(writer io.Writer) error {
  5910. buff := util.NewBufferFromWriter(writer)
  5911. defer buff.Flush()
  5912. ctx := NewEncodingContextFromBuffer(buff, nil)
  5913. return target.MarshalBinaryWithContext(ctx)
  5914. }
  5915. // MarshalBinaryWithContext serializes the internal properties of this PersistentVolume instance
  5916. // into a byte array leveraging a predefined context.
  5917. func (target *PersistentVolume) MarshalBinaryWithContext(ctx *EncodingContext) (err error) {
  5918. // panics are recovered and propagated as errors
  5919. defer func() {
  5920. if r := recover(); r != nil {
  5921. if e, ok := r.(error); ok {
  5922. err = e
  5923. } else if s, ok := r.(string); ok {
  5924. err = fmt.Errorf("unexpected panic: %s", s)
  5925. } else {
  5926. err = fmt.Errorf("unexpected panic: %+v", r)
  5927. }
  5928. }
  5929. }()
  5930. buff := ctx.Buffer
  5931. buff.WriteUInt8(DefaultCodecVersion) // version
  5932. if ctx.IsStringTable() {
  5933. a := ctx.Table.AddOrGet(target.UID)
  5934. buff.WriteInt(a) // write table index
  5935. } else {
  5936. buff.WriteString(target.UID) // write string
  5937. }
  5938. if ctx.IsStringTable() {
  5939. b := ctx.Table.AddOrGet(target.Name)
  5940. buff.WriteInt(b) // write table index
  5941. } else {
  5942. buff.WriteString(target.Name) // write string
  5943. }
  5944. if ctx.IsStringTable() {
  5945. c := ctx.Table.AddOrGet(target.StorageClass)
  5946. buff.WriteInt(c) // write table index
  5947. } else {
  5948. buff.WriteString(target.StorageClass) // write string
  5949. }
  5950. if ctx.IsStringTable() {
  5951. d := ctx.Table.AddOrGet(target.CSIVolumeHandle)
  5952. buff.WriteInt(d) // write table index
  5953. } else {
  5954. buff.WriteString(target.CSIVolumeHandle) // write string
  5955. }
  5956. buff.WriteFloat64(target.SizeBytes) // write float64
  5957. // --- [begin][write][reference](time.Time) ---
  5958. e, errA := target.Start.MarshalBinary()
  5959. if errA != nil {
  5960. return errA
  5961. }
  5962. buff.WriteInt(len(e))
  5963. buff.WriteBytes(e)
  5964. // --- [end][write][reference](time.Time) ---
  5965. // --- [begin][write][reference](time.Time) ---
  5966. f, errB := target.End.MarshalBinary()
  5967. if errB != nil {
  5968. return errB
  5969. }
  5970. buff.WriteInt(len(f))
  5971. buff.WriteBytes(f)
  5972. // --- [end][write][reference](time.Time) ---
  5973. return nil
  5974. }
  5975. // UnmarshalBinary uses the data passed byte array to set all the internal properties of
  5976. // the PersistentVolume type
  5977. func (target *PersistentVolume) UnmarshalBinary(data []byte) error {
  5978. ctx := NewDecodingContextFromBytes(data)
  5979. defer ctx.Close()
  5980. err := target.UnmarshalBinaryWithContext(ctx)
  5981. if err != nil {
  5982. return err
  5983. }
  5984. return nil
  5985. }
  5986. // UnmarshalBinaryFromReader uses the io.Reader data to set all the internal properties of
  5987. // the PersistentVolume type
  5988. func (target *PersistentVolume) UnmarshalBinaryFromReader(reader io.Reader) error {
  5989. ctx := NewDecodingContextFromReader(reader)
  5990. defer ctx.Close()
  5991. err := target.UnmarshalBinaryWithContext(ctx)
  5992. if err != nil {
  5993. return err
  5994. }
  5995. return nil
  5996. }
  5997. // UnmarshalBinaryWithContext uses the context containing a string table and binary buffer to set all the internal properties of
  5998. // the PersistentVolume type
  5999. func (target *PersistentVolume) UnmarshalBinaryWithContext(ctx *DecodingContext) (err error) {
  6000. // panics are recovered and propagated as errors
  6001. defer func() {
  6002. if r := recover(); r != nil {
  6003. if e, ok := r.(error); ok {
  6004. err = e
  6005. } else if s, ok := r.(string); ok {
  6006. err = fmt.Errorf("unexpected panic: %s", s)
  6007. } else {
  6008. err = fmt.Errorf("unexpected panic: %+v", r)
  6009. }
  6010. }
  6011. }()
  6012. buff := ctx.Buffer
  6013. version := buff.ReadUInt8()
  6014. if version > DefaultCodecVersion {
  6015. return fmt.Errorf("Invalid Version Unmarshalling PersistentVolume. Expected %d or less, got %d", DefaultCodecVersion, version)
  6016. }
  6017. var b string
  6018. if ctx.IsStringTable() {
  6019. c := buff.ReadInt() // read string index
  6020. b = ctx.Table.At(c)
  6021. } else {
  6022. b = buff.ReadString() // read string
  6023. }
  6024. a := b
  6025. target.UID = a
  6026. var e string
  6027. if ctx.IsStringTable() {
  6028. f := buff.ReadInt() // read string index
  6029. e = ctx.Table.At(f)
  6030. } else {
  6031. e = buff.ReadString() // read string
  6032. }
  6033. d := e
  6034. target.Name = d
  6035. var h string
  6036. if ctx.IsStringTable() {
  6037. l := buff.ReadInt() // read string index
  6038. h = ctx.Table.At(l)
  6039. } else {
  6040. h = buff.ReadString() // read string
  6041. }
  6042. g := h
  6043. target.StorageClass = g
  6044. var n string
  6045. if ctx.IsStringTable() {
  6046. o := buff.ReadInt() // read string index
  6047. n = ctx.Table.At(o)
  6048. } else {
  6049. n = buff.ReadString() // read string
  6050. }
  6051. m := n
  6052. target.CSIVolumeHandle = m
  6053. p := buff.ReadFloat64() // read float64
  6054. target.SizeBytes = p
  6055. // --- [begin][read][reference](time.Time) ---
  6056. q := new(time.Time)
  6057. r := buff.ReadInt() // byte array length
  6058. s := buff.ReadBytes(r)
  6059. errA := q.UnmarshalBinary(s)
  6060. if errA != nil {
  6061. return errA
  6062. }
  6063. target.Start = *q
  6064. // --- [end][read][reference](time.Time) ---
  6065. // --- [begin][read][reference](time.Time) ---
  6066. t := new(time.Time)
  6067. u := buff.ReadInt() // byte array length
  6068. w := buff.ReadBytes(u)
  6069. errB := t.UnmarshalBinary(w)
  6070. if errB != nil {
  6071. return errB
  6072. }
  6073. target.End = *t
  6074. // --- [end][read][reference](time.Time) ---
  6075. return nil
  6076. }
  6077. //--------------------------------------------------------------------------
  6078. // PersistentVolumeClaim
  6079. //--------------------------------------------------------------------------
  6080. // MarshalBinary serializes the internal properties of this PersistentVolumeClaim instance
  6081. // into a byte array
  6082. func (target *PersistentVolumeClaim) MarshalBinary() (data []byte, err error) {
  6083. ctx := NewEncodingContext(nil)
  6084. e := target.MarshalBinaryWithContext(ctx)
  6085. if e != nil {
  6086. return nil, e
  6087. }
  6088. return ctx.ToBytes(), nil
  6089. }
  6090. // MarshalBinary serializes the internal properties of this PersistentVolumeClaim instance
  6091. // into an io.Writer.
  6092. func (target *PersistentVolumeClaim) MarshalBinaryTo(writer io.Writer) error {
  6093. buff := util.NewBufferFromWriter(writer)
  6094. defer buff.Flush()
  6095. ctx := NewEncodingContextFromBuffer(buff, nil)
  6096. return target.MarshalBinaryWithContext(ctx)
  6097. }
  6098. // MarshalBinaryWithContext serializes the internal properties of this PersistentVolumeClaim instance
  6099. // into a byte array leveraging a predefined context.
  6100. func (target *PersistentVolumeClaim) MarshalBinaryWithContext(ctx *EncodingContext) (err error) {
  6101. // panics are recovered and propagated as errors
  6102. defer func() {
  6103. if r := recover(); r != nil {
  6104. if e, ok := r.(error); ok {
  6105. err = e
  6106. } else if s, ok := r.(string); ok {
  6107. err = fmt.Errorf("unexpected panic: %s", s)
  6108. } else {
  6109. err = fmt.Errorf("unexpected panic: %+v", r)
  6110. }
  6111. }
  6112. }()
  6113. buff := ctx.Buffer
  6114. buff.WriteUInt8(DefaultCodecVersion) // version
  6115. if ctx.IsStringTable() {
  6116. a := ctx.Table.AddOrGet(target.UID)
  6117. buff.WriteInt(a) // write table index
  6118. } else {
  6119. buff.WriteString(target.UID) // write string
  6120. }
  6121. if ctx.IsStringTable() {
  6122. b := ctx.Table.AddOrGet(target.NamespaceUID)
  6123. buff.WriteInt(b) // write table index
  6124. } else {
  6125. buff.WriteString(target.NamespaceUID) // write string
  6126. }
  6127. if ctx.IsStringTable() {
  6128. c := ctx.Table.AddOrGet(target.Name)
  6129. buff.WriteInt(c) // write table index
  6130. } else {
  6131. buff.WriteString(target.Name) // write string
  6132. }
  6133. if ctx.IsStringTable() {
  6134. d := ctx.Table.AddOrGet(target.PersistentVolumeUID)
  6135. buff.WriteInt(d) // write table index
  6136. } else {
  6137. buff.WriteString(target.PersistentVolumeUID) // write string
  6138. }
  6139. if ctx.IsStringTable() {
  6140. e := ctx.Table.AddOrGet(target.StorageClass)
  6141. buff.WriteInt(e) // write table index
  6142. } else {
  6143. buff.WriteString(target.StorageClass) // write string
  6144. }
  6145. // --- [begin][write][reference](time.Time) ---
  6146. f, errA := target.Start.MarshalBinary()
  6147. if errA != nil {
  6148. return errA
  6149. }
  6150. buff.WriteInt(len(f))
  6151. buff.WriteBytes(f)
  6152. // --- [end][write][reference](time.Time) ---
  6153. // --- [begin][write][reference](time.Time) ---
  6154. g, errB := target.End.MarshalBinary()
  6155. if errB != nil {
  6156. return errB
  6157. }
  6158. buff.WriteInt(len(g))
  6159. buff.WriteBytes(g)
  6160. // --- [end][write][reference](time.Time) ---
  6161. buff.WriteFloat64(target.RequestedBytes) // write float64
  6162. buff.WriteFloat64(target.UsageBytesAvg) // write float64
  6163. buff.WriteFloat64(target.UsageBytesMax) // write float64
  6164. return nil
  6165. }
  6166. // UnmarshalBinary uses the data passed byte array to set all the internal properties of
  6167. // the PersistentVolumeClaim type
  6168. func (target *PersistentVolumeClaim) UnmarshalBinary(data []byte) error {
  6169. ctx := NewDecodingContextFromBytes(data)
  6170. defer ctx.Close()
  6171. err := target.UnmarshalBinaryWithContext(ctx)
  6172. if err != nil {
  6173. return err
  6174. }
  6175. return nil
  6176. }
  6177. // UnmarshalBinaryFromReader uses the io.Reader data to set all the internal properties of
  6178. // the PersistentVolumeClaim type
  6179. func (target *PersistentVolumeClaim) UnmarshalBinaryFromReader(reader io.Reader) error {
  6180. ctx := NewDecodingContextFromReader(reader)
  6181. defer ctx.Close()
  6182. err := target.UnmarshalBinaryWithContext(ctx)
  6183. if err != nil {
  6184. return err
  6185. }
  6186. return nil
  6187. }
  6188. // UnmarshalBinaryWithContext uses the context containing a string table and binary buffer to set all the internal properties of
  6189. // the PersistentVolumeClaim type
  6190. func (target *PersistentVolumeClaim) UnmarshalBinaryWithContext(ctx *DecodingContext) (err error) {
  6191. // panics are recovered and propagated as errors
  6192. defer func() {
  6193. if r := recover(); r != nil {
  6194. if e, ok := r.(error); ok {
  6195. err = e
  6196. } else if s, ok := r.(string); ok {
  6197. err = fmt.Errorf("unexpected panic: %s", s)
  6198. } else {
  6199. err = fmt.Errorf("unexpected panic: %+v", r)
  6200. }
  6201. }
  6202. }()
  6203. buff := ctx.Buffer
  6204. version := buff.ReadUInt8()
  6205. if version > DefaultCodecVersion {
  6206. return fmt.Errorf("Invalid Version Unmarshalling PersistentVolumeClaim. Expected %d or less, got %d", DefaultCodecVersion, version)
  6207. }
  6208. var b string
  6209. if ctx.IsStringTable() {
  6210. c := buff.ReadInt() // read string index
  6211. b = ctx.Table.At(c)
  6212. } else {
  6213. b = buff.ReadString() // read string
  6214. }
  6215. a := b
  6216. target.UID = a
  6217. var e string
  6218. if ctx.IsStringTable() {
  6219. f := buff.ReadInt() // read string index
  6220. e = ctx.Table.At(f)
  6221. } else {
  6222. e = buff.ReadString() // read string
  6223. }
  6224. d := e
  6225. target.NamespaceUID = d
  6226. var h string
  6227. if ctx.IsStringTable() {
  6228. l := buff.ReadInt() // read string index
  6229. h = ctx.Table.At(l)
  6230. } else {
  6231. h = buff.ReadString() // read string
  6232. }
  6233. g := h
  6234. target.Name = g
  6235. var n string
  6236. if ctx.IsStringTable() {
  6237. o := buff.ReadInt() // read string index
  6238. n = ctx.Table.At(o)
  6239. } else {
  6240. n = buff.ReadString() // read string
  6241. }
  6242. m := n
  6243. target.PersistentVolumeUID = m
  6244. var q string
  6245. if ctx.IsStringTable() {
  6246. r := buff.ReadInt() // read string index
  6247. q = ctx.Table.At(r)
  6248. } else {
  6249. q = buff.ReadString() // read string
  6250. }
  6251. p := q
  6252. target.StorageClass = p
  6253. // --- [begin][read][reference](time.Time) ---
  6254. s := new(time.Time)
  6255. t := buff.ReadInt() // byte array length
  6256. u := buff.ReadBytes(t)
  6257. errA := s.UnmarshalBinary(u)
  6258. if errA != nil {
  6259. return errA
  6260. }
  6261. target.Start = *s
  6262. // --- [end][read][reference](time.Time) ---
  6263. // --- [begin][read][reference](time.Time) ---
  6264. w := new(time.Time)
  6265. x := buff.ReadInt() // byte array length
  6266. y := buff.ReadBytes(x)
  6267. errB := w.UnmarshalBinary(y)
  6268. if errB != nil {
  6269. return errB
  6270. }
  6271. target.End = *w
  6272. // --- [end][read][reference](time.Time) ---
  6273. aa := buff.ReadFloat64() // read float64
  6274. target.RequestedBytes = aa
  6275. bb := buff.ReadFloat64() // read float64
  6276. target.UsageBytesAvg = bb
  6277. cc := buff.ReadFloat64() // read float64
  6278. target.UsageBytesMax = cc
  6279. return nil
  6280. }
  6281. //--------------------------------------------------------------------------
  6282. // Pod
  6283. //--------------------------------------------------------------------------
  6284. // MarshalBinary serializes the internal properties of this Pod instance
  6285. // into a byte array
  6286. func (target *Pod) MarshalBinary() (data []byte, err error) {
  6287. ctx := NewEncodingContext(nil)
  6288. e := target.MarshalBinaryWithContext(ctx)
  6289. if e != nil {
  6290. return nil, e
  6291. }
  6292. return ctx.ToBytes(), nil
  6293. }
  6294. // MarshalBinary serializes the internal properties of this Pod instance
  6295. // into an io.Writer.
  6296. func (target *Pod) MarshalBinaryTo(writer io.Writer) error {
  6297. buff := util.NewBufferFromWriter(writer)
  6298. defer buff.Flush()
  6299. ctx := NewEncodingContextFromBuffer(buff, nil)
  6300. return target.MarshalBinaryWithContext(ctx)
  6301. }
  6302. // MarshalBinaryWithContext serializes the internal properties of this Pod instance
  6303. // into a byte array leveraging a predefined context.
  6304. func (target *Pod) MarshalBinaryWithContext(ctx *EncodingContext) (err error) {
  6305. // panics are recovered and propagated as errors
  6306. defer func() {
  6307. if r := recover(); r != nil {
  6308. if e, ok := r.(error); ok {
  6309. err = e
  6310. } else if s, ok := r.(string); ok {
  6311. err = fmt.Errorf("unexpected panic: %s", s)
  6312. } else {
  6313. err = fmt.Errorf("unexpected panic: %+v", r)
  6314. }
  6315. }
  6316. }()
  6317. buff := ctx.Buffer
  6318. buff.WriteUInt8(DefaultCodecVersion) // version
  6319. if ctx.IsStringTable() {
  6320. a := ctx.Table.AddOrGet(target.UID)
  6321. buff.WriteInt(a) // write table index
  6322. } else {
  6323. buff.WriteString(target.UID) // write string
  6324. }
  6325. if ctx.IsStringTable() {
  6326. b := ctx.Table.AddOrGet(target.NamespaceUID)
  6327. buff.WriteInt(b) // write table index
  6328. } else {
  6329. buff.WriteString(target.NamespaceUID) // write string
  6330. }
  6331. if ctx.IsStringTable() {
  6332. c := ctx.Table.AddOrGet(target.NodeUID)
  6333. buff.WriteInt(c) // write table index
  6334. } else {
  6335. buff.WriteString(target.NodeUID) // write string
  6336. }
  6337. if ctx.IsStringTable() {
  6338. d := ctx.Table.AddOrGet(target.Name)
  6339. buff.WriteInt(d) // write table index
  6340. } else {
  6341. buff.WriteString(target.Name) // write string
  6342. }
  6343. if target.Owners == nil {
  6344. buff.WriteUInt8(uint8(0)) // write nil byte
  6345. } else {
  6346. buff.WriteUInt8(uint8(1)) // write non-nil byte
  6347. // --- [begin][write][slice]([]Owner) ---
  6348. buff.WriteInt(len(target.Owners)) // slice length
  6349. for i := range target.Owners {
  6350. // --- [begin][write][struct](Owner) ---
  6351. buff.WriteInt(0) // [compatibility, unused]
  6352. errA := target.Owners[i].MarshalBinaryWithContext(ctx)
  6353. if errA != nil {
  6354. return errA
  6355. }
  6356. // --- [end][write][struct](Owner) ---
  6357. }
  6358. // --- [end][write][slice]([]Owner) ---
  6359. }
  6360. if target.PVCVolumes == nil {
  6361. buff.WriteUInt8(uint8(0)) // write nil byte
  6362. } else {
  6363. buff.WriteUInt8(uint8(1)) // write non-nil byte
  6364. // --- [begin][write][slice]([]PodPVCVolume) ---
  6365. buff.WriteInt(len(target.PVCVolumes)) // slice length
  6366. for j := range target.PVCVolumes {
  6367. // --- [begin][write][struct](PodPVCVolume) ---
  6368. buff.WriteInt(0) // [compatibility, unused]
  6369. errB := target.PVCVolumes[j].MarshalBinaryWithContext(ctx)
  6370. if errB != nil {
  6371. return errB
  6372. }
  6373. // --- [end][write][struct](PodPVCVolume) ---
  6374. }
  6375. // --- [end][write][slice]([]PodPVCVolume) ---
  6376. }
  6377. if target.Labels == nil {
  6378. buff.WriteUInt8(uint8(0)) // write nil byte
  6379. } else {
  6380. buff.WriteUInt8(uint8(1)) // write non-nil byte
  6381. // --- [begin][write][map](map[string]string) ---
  6382. buff.WriteInt(len(target.Labels)) // map length
  6383. for v, z := range target.Labels {
  6384. if ctx.IsStringTable() {
  6385. e := ctx.Table.AddOrGet(v)
  6386. buff.WriteInt(e) // write table index
  6387. } else {
  6388. buff.WriteString(v) // write string
  6389. }
  6390. if ctx.IsStringTable() {
  6391. f := ctx.Table.AddOrGet(z)
  6392. buff.WriteInt(f) // write table index
  6393. } else {
  6394. buff.WriteString(z) // write string
  6395. }
  6396. }
  6397. // --- [end][write][map](map[string]string) ---
  6398. }
  6399. if target.Annotations == nil {
  6400. buff.WriteUInt8(uint8(0)) // write nil byte
  6401. } else {
  6402. buff.WriteUInt8(uint8(1)) // write non-nil byte
  6403. // --- [begin][write][map](map[string]string) ---
  6404. buff.WriteInt(len(target.Annotations)) // map length
  6405. for vv, zz := range target.Annotations {
  6406. if ctx.IsStringTable() {
  6407. g := ctx.Table.AddOrGet(vv)
  6408. buff.WriteInt(g) // write table index
  6409. } else {
  6410. buff.WriteString(vv) // write string
  6411. }
  6412. if ctx.IsStringTable() {
  6413. h := ctx.Table.AddOrGet(zz)
  6414. buff.WriteInt(h) // write table index
  6415. } else {
  6416. buff.WriteString(zz) // write string
  6417. }
  6418. }
  6419. // --- [end][write][map](map[string]string) ---
  6420. }
  6421. if target.NetworkTrafficDetails == nil {
  6422. buff.WriteUInt8(uint8(0)) // write nil byte
  6423. } else {
  6424. buff.WriteUInt8(uint8(1)) // write non-nil byte
  6425. // --- [begin][write][slice]([]NetworkTrafficDetail) ---
  6426. buff.WriteInt(len(target.NetworkTrafficDetails)) // slice length
  6427. for ii := range target.NetworkTrafficDetails {
  6428. // --- [begin][write][struct](NetworkTrafficDetail) ---
  6429. buff.WriteInt(0) // [compatibility, unused]
  6430. errC := target.NetworkTrafficDetails[ii].MarshalBinaryWithContext(ctx)
  6431. if errC != nil {
  6432. return errC
  6433. }
  6434. // --- [end][write][struct](NetworkTrafficDetail) ---
  6435. }
  6436. // --- [end][write][slice]([]NetworkTrafficDetail) ---
  6437. }
  6438. // --- [begin][write][reference](time.Time) ---
  6439. l, errD := target.Start.MarshalBinary()
  6440. if errD != nil {
  6441. return errD
  6442. }
  6443. buff.WriteInt(len(l))
  6444. buff.WriteBytes(l)
  6445. // --- [end][write][reference](time.Time) ---
  6446. // --- [begin][write][reference](time.Time) ---
  6447. m, errE := target.End.MarshalBinary()
  6448. if errE != nil {
  6449. return errE
  6450. }
  6451. buff.WriteInt(len(m))
  6452. buff.WriteBytes(m)
  6453. // --- [end][write][reference](time.Time) ---
  6454. return nil
  6455. }
  6456. // UnmarshalBinary uses the data passed byte array to set all the internal properties of
  6457. // the Pod type
  6458. func (target *Pod) UnmarshalBinary(data []byte) error {
  6459. ctx := NewDecodingContextFromBytes(data)
  6460. defer ctx.Close()
  6461. err := target.UnmarshalBinaryWithContext(ctx)
  6462. if err != nil {
  6463. return err
  6464. }
  6465. return nil
  6466. }
  6467. // UnmarshalBinaryFromReader uses the io.Reader data to set all the internal properties of
  6468. // the Pod type
  6469. func (target *Pod) UnmarshalBinaryFromReader(reader io.Reader) error {
  6470. ctx := NewDecodingContextFromReader(reader)
  6471. defer ctx.Close()
  6472. err := target.UnmarshalBinaryWithContext(ctx)
  6473. if err != nil {
  6474. return err
  6475. }
  6476. return nil
  6477. }
  6478. // UnmarshalBinaryWithContext uses the context containing a string table and binary buffer to set all the internal properties of
  6479. // the Pod type
  6480. func (target *Pod) UnmarshalBinaryWithContext(ctx *DecodingContext) (err error) {
  6481. // panics are recovered and propagated as errors
  6482. defer func() {
  6483. if r := recover(); r != nil {
  6484. if e, ok := r.(error); ok {
  6485. err = e
  6486. } else if s, ok := r.(string); ok {
  6487. err = fmt.Errorf("unexpected panic: %s", s)
  6488. } else {
  6489. err = fmt.Errorf("unexpected panic: %+v", r)
  6490. }
  6491. }
  6492. }()
  6493. buff := ctx.Buffer
  6494. version := buff.ReadUInt8()
  6495. if version > DefaultCodecVersion {
  6496. return fmt.Errorf("Invalid Version Unmarshalling Pod. Expected %d or less, got %d", DefaultCodecVersion, version)
  6497. }
  6498. var b string
  6499. if ctx.IsStringTable() {
  6500. c := buff.ReadInt() // read string index
  6501. b = ctx.Table.At(c)
  6502. } else {
  6503. b = buff.ReadString() // read string
  6504. }
  6505. a := b
  6506. target.UID = a
  6507. var e string
  6508. if ctx.IsStringTable() {
  6509. f := buff.ReadInt() // read string index
  6510. e = ctx.Table.At(f)
  6511. } else {
  6512. e = buff.ReadString() // read string
  6513. }
  6514. d := e
  6515. target.NamespaceUID = d
  6516. var h string
  6517. if ctx.IsStringTable() {
  6518. l := buff.ReadInt() // read string index
  6519. h = ctx.Table.At(l)
  6520. } else {
  6521. h = buff.ReadString() // read string
  6522. }
  6523. g := h
  6524. target.NodeUID = g
  6525. var n string
  6526. if ctx.IsStringTable() {
  6527. o := buff.ReadInt() // read string index
  6528. n = ctx.Table.At(o)
  6529. } else {
  6530. n = buff.ReadString() // read string
  6531. }
  6532. m := n
  6533. target.Name = m
  6534. if buff.ReadUInt8() == uint8(0) {
  6535. target.Owners = nil
  6536. } else {
  6537. // --- [begin][read][slice]([]Owner) ---
  6538. q := buff.ReadInt() // slice len
  6539. p := make([]Owner, q)
  6540. for i := range q {
  6541. // --- [begin][read][struct](Owner) ---
  6542. s := new(Owner)
  6543. buff.ReadInt() // [compatibility, unused]
  6544. errA := s.UnmarshalBinaryWithContext(ctx)
  6545. if errA != nil {
  6546. return errA
  6547. }
  6548. r := *s
  6549. // --- [end][read][struct](Owner) ---
  6550. p[i] = r
  6551. }
  6552. target.Owners = p
  6553. // --- [end][read][slice]([]Owner) ---
  6554. }
  6555. if buff.ReadUInt8() == uint8(0) {
  6556. target.PVCVolumes = nil
  6557. } else {
  6558. // --- [begin][read][slice]([]PodPVCVolume) ---
  6559. u := buff.ReadInt() // slice len
  6560. t := make([]PodPVCVolume, u)
  6561. for j := range u {
  6562. // --- [begin][read][struct](PodPVCVolume) ---
  6563. x := new(PodPVCVolume)
  6564. buff.ReadInt() // [compatibility, unused]
  6565. errB := x.UnmarshalBinaryWithContext(ctx)
  6566. if errB != nil {
  6567. return errB
  6568. }
  6569. w := *x
  6570. // --- [end][read][struct](PodPVCVolume) ---
  6571. t[j] = w
  6572. }
  6573. target.PVCVolumes = t
  6574. // --- [end][read][slice]([]PodPVCVolume) ---
  6575. }
  6576. if buff.ReadUInt8() == uint8(0) {
  6577. target.Labels = nil
  6578. } else {
  6579. // --- [begin][read][map](map[string]string) ---
  6580. aa := buff.ReadInt() // map len
  6581. y := make(map[string]string, aa)
  6582. for range aa {
  6583. var v string
  6584. var cc string
  6585. if ctx.IsStringTable() {
  6586. dd := buff.ReadInt() // read string index
  6587. cc = ctx.Table.At(dd)
  6588. } else {
  6589. cc = buff.ReadString() // read string
  6590. }
  6591. bb := cc
  6592. v = bb
  6593. var z string
  6594. var ff string
  6595. if ctx.IsStringTable() {
  6596. gg := buff.ReadInt() // read string index
  6597. ff = ctx.Table.At(gg)
  6598. } else {
  6599. ff = buff.ReadString() // read string
  6600. }
  6601. ee := ff
  6602. z = ee
  6603. y[v] = z
  6604. }
  6605. target.Labels = y
  6606. // --- [end][read][map](map[string]string) ---
  6607. }
  6608. if buff.ReadUInt8() == uint8(0) {
  6609. target.Annotations = nil
  6610. } else {
  6611. // --- [begin][read][map](map[string]string) ---
  6612. ll := buff.ReadInt() // map len
  6613. hh := make(map[string]string, ll)
  6614. for range ll {
  6615. var vv string
  6616. var nn string
  6617. if ctx.IsStringTable() {
  6618. oo := buff.ReadInt() // read string index
  6619. nn = ctx.Table.At(oo)
  6620. } else {
  6621. nn = buff.ReadString() // read string
  6622. }
  6623. mm := nn
  6624. vv = mm
  6625. var zz string
  6626. var qq string
  6627. if ctx.IsStringTable() {
  6628. rr := buff.ReadInt() // read string index
  6629. qq = ctx.Table.At(rr)
  6630. } else {
  6631. qq = buff.ReadString() // read string
  6632. }
  6633. pp := qq
  6634. zz = pp
  6635. hh[vv] = zz
  6636. }
  6637. target.Annotations = hh
  6638. // --- [end][read][map](map[string]string) ---
  6639. }
  6640. if buff.ReadUInt8() == uint8(0) {
  6641. target.NetworkTrafficDetails = nil
  6642. } else {
  6643. // --- [begin][read][slice]([]NetworkTrafficDetail) ---
  6644. tt := buff.ReadInt() // slice len
  6645. ss := make([]NetworkTrafficDetail, tt)
  6646. for ii := range tt {
  6647. // --- [begin][read][struct](NetworkTrafficDetail) ---
  6648. ww := new(NetworkTrafficDetail)
  6649. buff.ReadInt() // [compatibility, unused]
  6650. errC := ww.UnmarshalBinaryWithContext(ctx)
  6651. if errC != nil {
  6652. return errC
  6653. }
  6654. uu := *ww
  6655. // --- [end][read][struct](NetworkTrafficDetail) ---
  6656. ss[ii] = uu
  6657. }
  6658. target.NetworkTrafficDetails = ss
  6659. // --- [end][read][slice]([]NetworkTrafficDetail) ---
  6660. }
  6661. // --- [begin][read][reference](time.Time) ---
  6662. xx := new(time.Time)
  6663. yy := buff.ReadInt() // byte array length
  6664. aaa := buff.ReadBytes(yy)
  6665. errD := xx.UnmarshalBinary(aaa)
  6666. if errD != nil {
  6667. return errD
  6668. }
  6669. target.Start = *xx
  6670. // --- [end][read][reference](time.Time) ---
  6671. // --- [begin][read][reference](time.Time) ---
  6672. bbb := new(time.Time)
  6673. ccc := buff.ReadInt() // byte array length
  6674. ddd := buff.ReadBytes(ccc)
  6675. errE := bbb.UnmarshalBinary(ddd)
  6676. if errE != nil {
  6677. return errE
  6678. }
  6679. target.End = *bbb
  6680. // --- [end][read][reference](time.Time) ---
  6681. return nil
  6682. }
  6683. //--------------------------------------------------------------------------
  6684. // PodPVCVolume
  6685. //--------------------------------------------------------------------------
  6686. // MarshalBinary serializes the internal properties of this PodPVCVolume instance
  6687. // into a byte array
  6688. func (target *PodPVCVolume) MarshalBinary() (data []byte, err error) {
  6689. ctx := NewEncodingContext(nil)
  6690. e := target.MarshalBinaryWithContext(ctx)
  6691. if e != nil {
  6692. return nil, e
  6693. }
  6694. return ctx.ToBytes(), nil
  6695. }
  6696. // MarshalBinary serializes the internal properties of this PodPVCVolume instance
  6697. // into an io.Writer.
  6698. func (target *PodPVCVolume) MarshalBinaryTo(writer io.Writer) error {
  6699. buff := util.NewBufferFromWriter(writer)
  6700. defer buff.Flush()
  6701. ctx := NewEncodingContextFromBuffer(buff, nil)
  6702. return target.MarshalBinaryWithContext(ctx)
  6703. }
  6704. // MarshalBinaryWithContext serializes the internal properties of this PodPVCVolume instance
  6705. // into a byte array leveraging a predefined context.
  6706. func (target *PodPVCVolume) MarshalBinaryWithContext(ctx *EncodingContext) (err error) {
  6707. // panics are recovered and propagated as errors
  6708. defer func() {
  6709. if r := recover(); r != nil {
  6710. if e, ok := r.(error); ok {
  6711. err = e
  6712. } else if s, ok := r.(string); ok {
  6713. err = fmt.Errorf("unexpected panic: %s", s)
  6714. } else {
  6715. err = fmt.Errorf("unexpected panic: %+v", r)
  6716. }
  6717. }
  6718. }()
  6719. buff := ctx.Buffer
  6720. buff.WriteUInt8(DefaultCodecVersion) // version
  6721. if ctx.IsStringTable() {
  6722. a := ctx.Table.AddOrGet(target.Name)
  6723. buff.WriteInt(a) // write table index
  6724. } else {
  6725. buff.WriteString(target.Name) // write string
  6726. }
  6727. if ctx.IsStringTable() {
  6728. b := ctx.Table.AddOrGet(target.PersistentVolumeClaimUID)
  6729. buff.WriteInt(b) // write table index
  6730. } else {
  6731. buff.WriteString(target.PersistentVolumeClaimUID) // write string
  6732. }
  6733. return nil
  6734. }
  6735. // UnmarshalBinary uses the data passed byte array to set all the internal properties of
  6736. // the PodPVCVolume type
  6737. func (target *PodPVCVolume) UnmarshalBinary(data []byte) error {
  6738. ctx := NewDecodingContextFromBytes(data)
  6739. defer ctx.Close()
  6740. err := target.UnmarshalBinaryWithContext(ctx)
  6741. if err != nil {
  6742. return err
  6743. }
  6744. return nil
  6745. }
  6746. // UnmarshalBinaryFromReader uses the io.Reader data to set all the internal properties of
  6747. // the PodPVCVolume type
  6748. func (target *PodPVCVolume) UnmarshalBinaryFromReader(reader io.Reader) error {
  6749. ctx := NewDecodingContextFromReader(reader)
  6750. defer ctx.Close()
  6751. err := target.UnmarshalBinaryWithContext(ctx)
  6752. if err != nil {
  6753. return err
  6754. }
  6755. return nil
  6756. }
  6757. // UnmarshalBinaryWithContext uses the context containing a string table and binary buffer to set all the internal properties of
  6758. // the PodPVCVolume type
  6759. func (target *PodPVCVolume) UnmarshalBinaryWithContext(ctx *DecodingContext) (err error) {
  6760. // panics are recovered and propagated as errors
  6761. defer func() {
  6762. if r := recover(); r != nil {
  6763. if e, ok := r.(error); ok {
  6764. err = e
  6765. } else if s, ok := r.(string); ok {
  6766. err = fmt.Errorf("unexpected panic: %s", s)
  6767. } else {
  6768. err = fmt.Errorf("unexpected panic: %+v", r)
  6769. }
  6770. }
  6771. }()
  6772. buff := ctx.Buffer
  6773. version := buff.ReadUInt8()
  6774. if version > DefaultCodecVersion {
  6775. return fmt.Errorf("Invalid Version Unmarshalling PodPVCVolume. Expected %d or less, got %d", DefaultCodecVersion, version)
  6776. }
  6777. var b string
  6778. if ctx.IsStringTable() {
  6779. c := buff.ReadInt() // read string index
  6780. b = ctx.Table.At(c)
  6781. } else {
  6782. b = buff.ReadString() // read string
  6783. }
  6784. a := b
  6785. target.Name = a
  6786. var e string
  6787. if ctx.IsStringTable() {
  6788. f := buff.ReadInt() // read string index
  6789. e = ctx.Table.At(f)
  6790. } else {
  6791. e = buff.ReadString() // read string
  6792. }
  6793. d := e
  6794. target.PersistentVolumeClaimUID = d
  6795. return nil
  6796. }
  6797. //--------------------------------------------------------------------------
  6798. // ReplicaSet
  6799. //--------------------------------------------------------------------------
  6800. // MarshalBinary serializes the internal properties of this ReplicaSet instance
  6801. // into a byte array
  6802. func (target *ReplicaSet) MarshalBinary() (data []byte, err error) {
  6803. ctx := NewEncodingContext(nil)
  6804. e := target.MarshalBinaryWithContext(ctx)
  6805. if e != nil {
  6806. return nil, e
  6807. }
  6808. return ctx.ToBytes(), nil
  6809. }
  6810. // MarshalBinary serializes the internal properties of this ReplicaSet instance
  6811. // into an io.Writer.
  6812. func (target *ReplicaSet) MarshalBinaryTo(writer io.Writer) error {
  6813. buff := util.NewBufferFromWriter(writer)
  6814. defer buff.Flush()
  6815. ctx := NewEncodingContextFromBuffer(buff, nil)
  6816. return target.MarshalBinaryWithContext(ctx)
  6817. }
  6818. // MarshalBinaryWithContext serializes the internal properties of this ReplicaSet instance
  6819. // into a byte array leveraging a predefined context.
  6820. func (target *ReplicaSet) MarshalBinaryWithContext(ctx *EncodingContext) (err error) {
  6821. // panics are recovered and propagated as errors
  6822. defer func() {
  6823. if r := recover(); r != nil {
  6824. if e, ok := r.(error); ok {
  6825. err = e
  6826. } else if s, ok := r.(string); ok {
  6827. err = fmt.Errorf("unexpected panic: %s", s)
  6828. } else {
  6829. err = fmt.Errorf("unexpected panic: %+v", r)
  6830. }
  6831. }
  6832. }()
  6833. buff := ctx.Buffer
  6834. buff.WriteUInt8(DefaultCodecVersion) // version
  6835. if ctx.IsStringTable() {
  6836. a := ctx.Table.AddOrGet(target.UID)
  6837. buff.WriteInt(a) // write table index
  6838. } else {
  6839. buff.WriteString(target.UID) // write string
  6840. }
  6841. if ctx.IsStringTable() {
  6842. b := ctx.Table.AddOrGet(target.NamespaceUID)
  6843. buff.WriteInt(b) // write table index
  6844. } else {
  6845. buff.WriteString(target.NamespaceUID) // write string
  6846. }
  6847. if ctx.IsStringTable() {
  6848. c := ctx.Table.AddOrGet(target.Name)
  6849. buff.WriteInt(c) // write table index
  6850. } else {
  6851. buff.WriteString(target.Name) // write string
  6852. }
  6853. if target.Owners == nil {
  6854. buff.WriteUInt8(uint8(0)) // write nil byte
  6855. } else {
  6856. buff.WriteUInt8(uint8(1)) // write non-nil byte
  6857. // --- [begin][write][slice]([]Owner) ---
  6858. buff.WriteInt(len(target.Owners)) // slice length
  6859. for i := range target.Owners {
  6860. // --- [begin][write][struct](Owner) ---
  6861. buff.WriteInt(0) // [compatibility, unused]
  6862. errA := target.Owners[i].MarshalBinaryWithContext(ctx)
  6863. if errA != nil {
  6864. return errA
  6865. }
  6866. // --- [end][write][struct](Owner) ---
  6867. }
  6868. // --- [end][write][slice]([]Owner) ---
  6869. }
  6870. if target.Labels == nil {
  6871. buff.WriteUInt8(uint8(0)) // write nil byte
  6872. } else {
  6873. buff.WriteUInt8(uint8(1)) // write non-nil byte
  6874. // --- [begin][write][map](map[string]string) ---
  6875. buff.WriteInt(len(target.Labels)) // map length
  6876. for v, z := range target.Labels {
  6877. if ctx.IsStringTable() {
  6878. d := ctx.Table.AddOrGet(v)
  6879. buff.WriteInt(d) // write table index
  6880. } else {
  6881. buff.WriteString(v) // write string
  6882. }
  6883. if ctx.IsStringTable() {
  6884. e := ctx.Table.AddOrGet(z)
  6885. buff.WriteInt(e) // write table index
  6886. } else {
  6887. buff.WriteString(z) // write string
  6888. }
  6889. }
  6890. // --- [end][write][map](map[string]string) ---
  6891. }
  6892. if target.Annotations == nil {
  6893. buff.WriteUInt8(uint8(0)) // write nil byte
  6894. } else {
  6895. buff.WriteUInt8(uint8(1)) // write non-nil byte
  6896. // --- [begin][write][map](map[string]string) ---
  6897. buff.WriteInt(len(target.Annotations)) // map length
  6898. for vv, zz := range target.Annotations {
  6899. if ctx.IsStringTable() {
  6900. f := ctx.Table.AddOrGet(vv)
  6901. buff.WriteInt(f) // write table index
  6902. } else {
  6903. buff.WriteString(vv) // write string
  6904. }
  6905. if ctx.IsStringTable() {
  6906. g := ctx.Table.AddOrGet(zz)
  6907. buff.WriteInt(g) // write table index
  6908. } else {
  6909. buff.WriteString(zz) // write string
  6910. }
  6911. }
  6912. // --- [end][write][map](map[string]string) ---
  6913. }
  6914. // --- [begin][write][reference](time.Time) ---
  6915. h, errB := target.Start.MarshalBinary()
  6916. if errB != nil {
  6917. return errB
  6918. }
  6919. buff.WriteInt(len(h))
  6920. buff.WriteBytes(h)
  6921. // --- [end][write][reference](time.Time) ---
  6922. // --- [begin][write][reference](time.Time) ---
  6923. l, errC := target.End.MarshalBinary()
  6924. if errC != nil {
  6925. return errC
  6926. }
  6927. buff.WriteInt(len(l))
  6928. buff.WriteBytes(l)
  6929. // --- [end][write][reference](time.Time) ---
  6930. return nil
  6931. }
  6932. // UnmarshalBinary uses the data passed byte array to set all the internal properties of
  6933. // the ReplicaSet type
  6934. func (target *ReplicaSet) UnmarshalBinary(data []byte) error {
  6935. ctx := NewDecodingContextFromBytes(data)
  6936. defer ctx.Close()
  6937. err := target.UnmarshalBinaryWithContext(ctx)
  6938. if err != nil {
  6939. return err
  6940. }
  6941. return nil
  6942. }
  6943. // UnmarshalBinaryFromReader uses the io.Reader data to set all the internal properties of
  6944. // the ReplicaSet type
  6945. func (target *ReplicaSet) UnmarshalBinaryFromReader(reader io.Reader) error {
  6946. ctx := NewDecodingContextFromReader(reader)
  6947. defer ctx.Close()
  6948. err := target.UnmarshalBinaryWithContext(ctx)
  6949. if err != nil {
  6950. return err
  6951. }
  6952. return nil
  6953. }
  6954. // UnmarshalBinaryWithContext uses the context containing a string table and binary buffer to set all the internal properties of
  6955. // the ReplicaSet type
  6956. func (target *ReplicaSet) UnmarshalBinaryWithContext(ctx *DecodingContext) (err error) {
  6957. // panics are recovered and propagated as errors
  6958. defer func() {
  6959. if r := recover(); r != nil {
  6960. if e, ok := r.(error); ok {
  6961. err = e
  6962. } else if s, ok := r.(string); ok {
  6963. err = fmt.Errorf("unexpected panic: %s", s)
  6964. } else {
  6965. err = fmt.Errorf("unexpected panic: %+v", r)
  6966. }
  6967. }
  6968. }()
  6969. buff := ctx.Buffer
  6970. version := buff.ReadUInt8()
  6971. if version > DefaultCodecVersion {
  6972. return fmt.Errorf("Invalid Version Unmarshalling ReplicaSet. Expected %d or less, got %d", DefaultCodecVersion, version)
  6973. }
  6974. var b string
  6975. if ctx.IsStringTable() {
  6976. c := buff.ReadInt() // read string index
  6977. b = ctx.Table.At(c)
  6978. } else {
  6979. b = buff.ReadString() // read string
  6980. }
  6981. a := b
  6982. target.UID = a
  6983. var e string
  6984. if ctx.IsStringTable() {
  6985. f := buff.ReadInt() // read string index
  6986. e = ctx.Table.At(f)
  6987. } else {
  6988. e = buff.ReadString() // read string
  6989. }
  6990. d := e
  6991. target.NamespaceUID = d
  6992. var h string
  6993. if ctx.IsStringTable() {
  6994. l := buff.ReadInt() // read string index
  6995. h = ctx.Table.At(l)
  6996. } else {
  6997. h = buff.ReadString() // read string
  6998. }
  6999. g := h
  7000. target.Name = g
  7001. if buff.ReadUInt8() == uint8(0) {
  7002. target.Owners = nil
  7003. } else {
  7004. // --- [begin][read][slice]([]Owner) ---
  7005. n := buff.ReadInt() // slice len
  7006. m := make([]Owner, n)
  7007. for i := range n {
  7008. // --- [begin][read][struct](Owner) ---
  7009. p := new(Owner)
  7010. buff.ReadInt() // [compatibility, unused]
  7011. errA := p.UnmarshalBinaryWithContext(ctx)
  7012. if errA != nil {
  7013. return errA
  7014. }
  7015. o := *p
  7016. // --- [end][read][struct](Owner) ---
  7017. m[i] = o
  7018. }
  7019. target.Owners = m
  7020. // --- [end][read][slice]([]Owner) ---
  7021. }
  7022. if buff.ReadUInt8() == uint8(0) {
  7023. target.Labels = nil
  7024. } else {
  7025. // --- [begin][read][map](map[string]string) ---
  7026. r := buff.ReadInt() // map len
  7027. q := make(map[string]string, r)
  7028. for range r {
  7029. var v string
  7030. var t string
  7031. if ctx.IsStringTable() {
  7032. u := buff.ReadInt() // read string index
  7033. t = ctx.Table.At(u)
  7034. } else {
  7035. t = buff.ReadString() // read string
  7036. }
  7037. s := t
  7038. v = s
  7039. var z string
  7040. var x string
  7041. if ctx.IsStringTable() {
  7042. y := buff.ReadInt() // read string index
  7043. x = ctx.Table.At(y)
  7044. } else {
  7045. x = buff.ReadString() // read string
  7046. }
  7047. w := x
  7048. z = w
  7049. q[v] = z
  7050. }
  7051. target.Labels = q
  7052. // --- [end][read][map](map[string]string) ---
  7053. }
  7054. if buff.ReadUInt8() == uint8(0) {
  7055. target.Annotations = nil
  7056. } else {
  7057. // --- [begin][read][map](map[string]string) ---
  7058. bb := buff.ReadInt() // map len
  7059. aa := make(map[string]string, bb)
  7060. for range bb {
  7061. var vv string
  7062. var dd string
  7063. if ctx.IsStringTable() {
  7064. ee := buff.ReadInt() // read string index
  7065. dd = ctx.Table.At(ee)
  7066. } else {
  7067. dd = buff.ReadString() // read string
  7068. }
  7069. cc := dd
  7070. vv = cc
  7071. var zz string
  7072. var gg string
  7073. if ctx.IsStringTable() {
  7074. hh := buff.ReadInt() // read string index
  7075. gg = ctx.Table.At(hh)
  7076. } else {
  7077. gg = buff.ReadString() // read string
  7078. }
  7079. ff := gg
  7080. zz = ff
  7081. aa[vv] = zz
  7082. }
  7083. target.Annotations = aa
  7084. // --- [end][read][map](map[string]string) ---
  7085. }
  7086. // --- [begin][read][reference](time.Time) ---
  7087. ll := new(time.Time)
  7088. mm := buff.ReadInt() // byte array length
  7089. nn := buff.ReadBytes(mm)
  7090. errB := ll.UnmarshalBinary(nn)
  7091. if errB != nil {
  7092. return errB
  7093. }
  7094. target.Start = *ll
  7095. // --- [end][read][reference](time.Time) ---
  7096. // --- [begin][read][reference](time.Time) ---
  7097. oo := new(time.Time)
  7098. pp := buff.ReadInt() // byte array length
  7099. qq := buff.ReadBytes(pp)
  7100. errC := oo.UnmarshalBinary(qq)
  7101. if errC != nil {
  7102. return errC
  7103. }
  7104. target.End = *oo
  7105. // --- [end][read][reference](time.Time) ---
  7106. return nil
  7107. }
  7108. //--------------------------------------------------------------------------
  7109. // ResourceQuantity
  7110. //--------------------------------------------------------------------------
  7111. // MarshalBinary serializes the internal properties of this ResourceQuantity instance
  7112. // into a byte array
  7113. func (target *ResourceQuantity) MarshalBinary() (data []byte, err error) {
  7114. ctx := NewEncodingContext(nil)
  7115. e := target.MarshalBinaryWithContext(ctx)
  7116. if e != nil {
  7117. return nil, e
  7118. }
  7119. return ctx.ToBytes(), nil
  7120. }
  7121. // MarshalBinary serializes the internal properties of this ResourceQuantity instance
  7122. // into an io.Writer.
  7123. func (target *ResourceQuantity) MarshalBinaryTo(writer io.Writer) error {
  7124. buff := util.NewBufferFromWriter(writer)
  7125. defer buff.Flush()
  7126. ctx := NewEncodingContextFromBuffer(buff, nil)
  7127. return target.MarshalBinaryWithContext(ctx)
  7128. }
  7129. // MarshalBinaryWithContext serializes the internal properties of this ResourceQuantity instance
  7130. // into a byte array leveraging a predefined context.
  7131. func (target *ResourceQuantity) MarshalBinaryWithContext(ctx *EncodingContext) (err error) {
  7132. // panics are recovered and propagated as errors
  7133. defer func() {
  7134. if r := recover(); r != nil {
  7135. if e, ok := r.(error); ok {
  7136. err = e
  7137. } else if s, ok := r.(string); ok {
  7138. err = fmt.Errorf("unexpected panic: %s", s)
  7139. } else {
  7140. err = fmt.Errorf("unexpected panic: %+v", r)
  7141. }
  7142. }
  7143. }()
  7144. buff := ctx.Buffer
  7145. buff.WriteUInt8(DefaultCodecVersion) // version
  7146. // --- [begin][write][alias](Resource) ---
  7147. if ctx.IsStringTable() {
  7148. a := ctx.Table.AddOrGet(string(target.Resource))
  7149. buff.WriteInt(a) // write table index
  7150. } else {
  7151. buff.WriteString(string(target.Resource)) // write string
  7152. }
  7153. // --- [end][write][alias](Resource) ---
  7154. // --- [begin][write][alias](Unit) ---
  7155. if ctx.IsStringTable() {
  7156. b := ctx.Table.AddOrGet(string(target.Unit))
  7157. buff.WriteInt(b) // write table index
  7158. } else {
  7159. buff.WriteString(string(target.Unit)) // write string
  7160. }
  7161. // --- [end][write][alias](Unit) ---
  7162. // --- [begin][write][alias](Stats) ---
  7163. if map[StatType]float64(target.Values) == nil {
  7164. buff.WriteUInt8(uint8(0)) // write nil byte
  7165. } else {
  7166. buff.WriteUInt8(uint8(1)) // write non-nil byte
  7167. // --- [begin][write][map](map[StatType]float64) ---
  7168. buff.WriteInt(len(map[StatType]float64(target.Values))) // map length
  7169. for v, z := range map[StatType]float64(target.Values) {
  7170. // --- [begin][write][alias](StatType) ---
  7171. if ctx.IsStringTable() {
  7172. c := ctx.Table.AddOrGet(string(v))
  7173. buff.WriteInt(c) // write table index
  7174. } else {
  7175. buff.WriteString(string(v)) // write string
  7176. }
  7177. // --- [end][write][alias](StatType) ---
  7178. buff.WriteFloat64(z) // write float64
  7179. }
  7180. // --- [end][write][map](map[StatType]float64) ---
  7181. }
  7182. // --- [end][write][alias](Stats) ---
  7183. return nil
  7184. }
  7185. // UnmarshalBinary uses the data passed byte array to set all the internal properties of
  7186. // the ResourceQuantity type
  7187. func (target *ResourceQuantity) UnmarshalBinary(data []byte) error {
  7188. ctx := NewDecodingContextFromBytes(data)
  7189. defer ctx.Close()
  7190. err := target.UnmarshalBinaryWithContext(ctx)
  7191. if err != nil {
  7192. return err
  7193. }
  7194. return nil
  7195. }
  7196. // UnmarshalBinaryFromReader uses the io.Reader data to set all the internal properties of
  7197. // the ResourceQuantity type
  7198. func (target *ResourceQuantity) UnmarshalBinaryFromReader(reader io.Reader) error {
  7199. ctx := NewDecodingContextFromReader(reader)
  7200. defer ctx.Close()
  7201. err := target.UnmarshalBinaryWithContext(ctx)
  7202. if err != nil {
  7203. return err
  7204. }
  7205. return nil
  7206. }
  7207. // UnmarshalBinaryWithContext uses the context containing a string table and binary buffer to set all the internal properties of
  7208. // the ResourceQuantity type
  7209. func (target *ResourceQuantity) UnmarshalBinaryWithContext(ctx *DecodingContext) (err error) {
  7210. // panics are recovered and propagated as errors
  7211. defer func() {
  7212. if r := recover(); r != nil {
  7213. if e, ok := r.(error); ok {
  7214. err = e
  7215. } else if s, ok := r.(string); ok {
  7216. err = fmt.Errorf("unexpected panic: %s", s)
  7217. } else {
  7218. err = fmt.Errorf("unexpected panic: %+v", r)
  7219. }
  7220. }
  7221. }()
  7222. buff := ctx.Buffer
  7223. version := buff.ReadUInt8()
  7224. if version > DefaultCodecVersion {
  7225. return fmt.Errorf("Invalid Version Unmarshalling ResourceQuantity. Expected %d or less, got %d", DefaultCodecVersion, version)
  7226. }
  7227. // field version check
  7228. if uint8(1) <= version {
  7229. // --- [begin][read][alias](Resource) ---
  7230. var a string
  7231. var c string
  7232. if ctx.IsStringTable() {
  7233. d := buff.ReadInt() // read string index
  7234. c = ctx.Table.At(d)
  7235. } else {
  7236. c = buff.ReadString() // read string
  7237. }
  7238. b := c
  7239. a = b
  7240. target.Resource = Resource(a)
  7241. // --- [end][read][alias](Resource) ---
  7242. } else {
  7243. }
  7244. // field version check
  7245. if uint8(1) <= version {
  7246. // --- [begin][read][alias](Unit) ---
  7247. var e string
  7248. var g string
  7249. if ctx.IsStringTable() {
  7250. h := buff.ReadInt() // read string index
  7251. g = ctx.Table.At(h)
  7252. } else {
  7253. g = buff.ReadString() // read string
  7254. }
  7255. f := g
  7256. e = f
  7257. target.Unit = Unit(e)
  7258. // --- [end][read][alias](Unit) ---
  7259. } else {
  7260. }
  7261. // field version check
  7262. if uint8(1) <= version {
  7263. // --- [begin][read][alias](Stats) ---
  7264. var l map[StatType]float64
  7265. if buff.ReadUInt8() == uint8(0) {
  7266. l = nil
  7267. } else {
  7268. // --- [begin][read][map](map[StatType]float64) ---
  7269. n := buff.ReadInt() // map len
  7270. m := make(map[StatType]float64, n)
  7271. for range n {
  7272. // --- [begin][read][alias](StatType) ---
  7273. var o string
  7274. var q string
  7275. if ctx.IsStringTable() {
  7276. r := buff.ReadInt() // read string index
  7277. q = ctx.Table.At(r)
  7278. } else {
  7279. q = buff.ReadString() // read string
  7280. }
  7281. p := q
  7282. o = p
  7283. v := StatType(o)
  7284. // --- [end][read][alias](StatType) ---
  7285. var z float64
  7286. s := buff.ReadFloat64() // read float64
  7287. z = s
  7288. m[v] = z
  7289. }
  7290. l = m
  7291. // --- [end][read][map](map[StatType]float64) ---
  7292. }
  7293. target.Values = Stats(l)
  7294. // --- [end][read][alias](Stats) ---
  7295. } else {
  7296. }
  7297. return nil
  7298. }
  7299. //--------------------------------------------------------------------------
  7300. // ResourceQuota
  7301. //--------------------------------------------------------------------------
  7302. // MarshalBinary serializes the internal properties of this ResourceQuota instance
  7303. // into a byte array
  7304. func (target *ResourceQuota) MarshalBinary() (data []byte, err error) {
  7305. ctx := NewEncodingContext(nil)
  7306. e := target.MarshalBinaryWithContext(ctx)
  7307. if e != nil {
  7308. return nil, e
  7309. }
  7310. return ctx.ToBytes(), nil
  7311. }
  7312. // MarshalBinary serializes the internal properties of this ResourceQuota instance
  7313. // into an io.Writer.
  7314. func (target *ResourceQuota) MarshalBinaryTo(writer io.Writer) error {
  7315. buff := util.NewBufferFromWriter(writer)
  7316. defer buff.Flush()
  7317. ctx := NewEncodingContextFromBuffer(buff, nil)
  7318. return target.MarshalBinaryWithContext(ctx)
  7319. }
  7320. // MarshalBinaryWithContext serializes the internal properties of this ResourceQuota instance
  7321. // into a byte array leveraging a predefined context.
  7322. func (target *ResourceQuota) MarshalBinaryWithContext(ctx *EncodingContext) (err error) {
  7323. // panics are recovered and propagated as errors
  7324. defer func() {
  7325. if r := recover(); r != nil {
  7326. if e, ok := r.(error); ok {
  7327. err = e
  7328. } else if s, ok := r.(string); ok {
  7329. err = fmt.Errorf("unexpected panic: %s", s)
  7330. } else {
  7331. err = fmt.Errorf("unexpected panic: %+v", r)
  7332. }
  7333. }
  7334. }()
  7335. buff := ctx.Buffer
  7336. buff.WriteUInt8(DefaultCodecVersion) // version
  7337. if ctx.IsStringTable() {
  7338. a := ctx.Table.AddOrGet(target.UID)
  7339. buff.WriteInt(a) // write table index
  7340. } else {
  7341. buff.WriteString(target.UID) // write string
  7342. }
  7343. if ctx.IsStringTable() {
  7344. b := ctx.Table.AddOrGet(target.NamespaceUID)
  7345. buff.WriteInt(b) // write table index
  7346. } else {
  7347. buff.WriteString(target.NamespaceUID) // write string
  7348. }
  7349. if ctx.IsStringTable() {
  7350. c := ctx.Table.AddOrGet(target.Name)
  7351. buff.WriteInt(c) // write table index
  7352. } else {
  7353. buff.WriteString(target.Name) // write string
  7354. }
  7355. if target.Spec == nil {
  7356. buff.WriteUInt8(uint8(0)) // write nil byte
  7357. } else {
  7358. buff.WriteUInt8(uint8(1)) // write non-nil byte
  7359. // --- [begin][write][struct](ResourceQuotaSpec) ---
  7360. buff.WriteInt(0) // [compatibility, unused]
  7361. errA := target.Spec.MarshalBinaryWithContext(ctx)
  7362. if errA != nil {
  7363. return errA
  7364. }
  7365. // --- [end][write][struct](ResourceQuotaSpec) ---
  7366. }
  7367. if target.Status == nil {
  7368. buff.WriteUInt8(uint8(0)) // write nil byte
  7369. } else {
  7370. buff.WriteUInt8(uint8(1)) // write non-nil byte
  7371. // --- [begin][write][struct](ResourceQuotaStatus) ---
  7372. buff.WriteInt(0) // [compatibility, unused]
  7373. errB := target.Status.MarshalBinaryWithContext(ctx)
  7374. if errB != nil {
  7375. return errB
  7376. }
  7377. // --- [end][write][struct](ResourceQuotaStatus) ---
  7378. }
  7379. // --- [begin][write][reference](time.Time) ---
  7380. d, errC := target.Start.MarshalBinary()
  7381. if errC != nil {
  7382. return errC
  7383. }
  7384. buff.WriteInt(len(d))
  7385. buff.WriteBytes(d)
  7386. // --- [end][write][reference](time.Time) ---
  7387. // --- [begin][write][reference](time.Time) ---
  7388. e, errD := target.End.MarshalBinary()
  7389. if errD != nil {
  7390. return errD
  7391. }
  7392. buff.WriteInt(len(e))
  7393. buff.WriteBytes(e)
  7394. // --- [end][write][reference](time.Time) ---
  7395. return nil
  7396. }
  7397. // UnmarshalBinary uses the data passed byte array to set all the internal properties of
  7398. // the ResourceQuota type
  7399. func (target *ResourceQuota) UnmarshalBinary(data []byte) error {
  7400. ctx := NewDecodingContextFromBytes(data)
  7401. defer ctx.Close()
  7402. err := target.UnmarshalBinaryWithContext(ctx)
  7403. if err != nil {
  7404. return err
  7405. }
  7406. return nil
  7407. }
  7408. // UnmarshalBinaryFromReader uses the io.Reader data to set all the internal properties of
  7409. // the ResourceQuota type
  7410. func (target *ResourceQuota) UnmarshalBinaryFromReader(reader io.Reader) error {
  7411. ctx := NewDecodingContextFromReader(reader)
  7412. defer ctx.Close()
  7413. err := target.UnmarshalBinaryWithContext(ctx)
  7414. if err != nil {
  7415. return err
  7416. }
  7417. return nil
  7418. }
  7419. // UnmarshalBinaryWithContext uses the context containing a string table and binary buffer to set all the internal properties of
  7420. // the ResourceQuota type
  7421. func (target *ResourceQuota) UnmarshalBinaryWithContext(ctx *DecodingContext) (err error) {
  7422. // panics are recovered and propagated as errors
  7423. defer func() {
  7424. if r := recover(); r != nil {
  7425. if e, ok := r.(error); ok {
  7426. err = e
  7427. } else if s, ok := r.(string); ok {
  7428. err = fmt.Errorf("unexpected panic: %s", s)
  7429. } else {
  7430. err = fmt.Errorf("unexpected panic: %+v", r)
  7431. }
  7432. }
  7433. }()
  7434. buff := ctx.Buffer
  7435. version := buff.ReadUInt8()
  7436. if version > DefaultCodecVersion {
  7437. return fmt.Errorf("Invalid Version Unmarshalling ResourceQuota. Expected %d or less, got %d", DefaultCodecVersion, version)
  7438. }
  7439. // field version check
  7440. if uint8(1) <= version {
  7441. var b string
  7442. if ctx.IsStringTable() {
  7443. c := buff.ReadInt() // read string index
  7444. b = ctx.Table.At(c)
  7445. } else {
  7446. b = buff.ReadString() // read string
  7447. }
  7448. a := b
  7449. target.UID = a
  7450. } else {
  7451. target.UID = "" // default
  7452. }
  7453. // field version check
  7454. if uint8(1) <= version {
  7455. var e string
  7456. if ctx.IsStringTable() {
  7457. f := buff.ReadInt() // read string index
  7458. e = ctx.Table.At(f)
  7459. } else {
  7460. e = buff.ReadString() // read string
  7461. }
  7462. d := e
  7463. target.NamespaceUID = d
  7464. } else {
  7465. target.NamespaceUID = "" // default
  7466. }
  7467. // field version check
  7468. if uint8(1) <= version {
  7469. var h string
  7470. if ctx.IsStringTable() {
  7471. l := buff.ReadInt() // read string index
  7472. h = ctx.Table.At(l)
  7473. } else {
  7474. h = buff.ReadString() // read string
  7475. }
  7476. g := h
  7477. target.Name = g
  7478. } else {
  7479. target.Name = "" // default
  7480. }
  7481. // field version check
  7482. if uint8(1) <= version {
  7483. if buff.ReadUInt8() == uint8(0) {
  7484. target.Spec = nil
  7485. } else {
  7486. // --- [begin][read][struct](ResourceQuotaSpec) ---
  7487. m := new(ResourceQuotaSpec)
  7488. buff.ReadInt() // [compatibility, unused]
  7489. errA := m.UnmarshalBinaryWithContext(ctx)
  7490. if errA != nil {
  7491. return errA
  7492. }
  7493. target.Spec = m
  7494. // --- [end][read][struct](ResourceQuotaSpec) ---
  7495. }
  7496. } else {
  7497. target.Spec = nil
  7498. }
  7499. // field version check
  7500. if uint8(1) <= version {
  7501. if buff.ReadUInt8() == uint8(0) {
  7502. target.Status = nil
  7503. } else {
  7504. // --- [begin][read][struct](ResourceQuotaStatus) ---
  7505. n := new(ResourceQuotaStatus)
  7506. buff.ReadInt() // [compatibility, unused]
  7507. errB := n.UnmarshalBinaryWithContext(ctx)
  7508. if errB != nil {
  7509. return errB
  7510. }
  7511. target.Status = n
  7512. // --- [end][read][struct](ResourceQuotaStatus) ---
  7513. }
  7514. } else {
  7515. target.Status = nil
  7516. }
  7517. // field version check
  7518. if uint8(1) <= version {
  7519. // --- [begin][read][reference](time.Time) ---
  7520. o := new(time.Time)
  7521. p := buff.ReadInt() // byte array length
  7522. q := buff.ReadBytes(p)
  7523. errC := o.UnmarshalBinary(q)
  7524. if errC != nil {
  7525. return errC
  7526. }
  7527. target.Start = *o
  7528. // --- [end][read][reference](time.Time) ---
  7529. } else {
  7530. }
  7531. // field version check
  7532. if uint8(1) <= version {
  7533. // --- [begin][read][reference](time.Time) ---
  7534. r := new(time.Time)
  7535. s := buff.ReadInt() // byte array length
  7536. t := buff.ReadBytes(s)
  7537. errD := r.UnmarshalBinary(t)
  7538. if errD != nil {
  7539. return errD
  7540. }
  7541. target.End = *r
  7542. // --- [end][read][reference](time.Time) ---
  7543. } else {
  7544. }
  7545. return nil
  7546. }
  7547. //--------------------------------------------------------------------------
  7548. // ResourceQuotaSpec
  7549. //--------------------------------------------------------------------------
  7550. // MarshalBinary serializes the internal properties of this ResourceQuotaSpec instance
  7551. // into a byte array
  7552. func (target *ResourceQuotaSpec) MarshalBinary() (data []byte, err error) {
  7553. ctx := NewEncodingContext(nil)
  7554. e := target.MarshalBinaryWithContext(ctx)
  7555. if e != nil {
  7556. return nil, e
  7557. }
  7558. return ctx.ToBytes(), nil
  7559. }
  7560. // MarshalBinary serializes the internal properties of this ResourceQuotaSpec instance
  7561. // into an io.Writer.
  7562. func (target *ResourceQuotaSpec) MarshalBinaryTo(writer io.Writer) error {
  7563. buff := util.NewBufferFromWriter(writer)
  7564. defer buff.Flush()
  7565. ctx := NewEncodingContextFromBuffer(buff, nil)
  7566. return target.MarshalBinaryWithContext(ctx)
  7567. }
  7568. // MarshalBinaryWithContext serializes the internal properties of this ResourceQuotaSpec instance
  7569. // into a byte array leveraging a predefined context.
  7570. func (target *ResourceQuotaSpec) MarshalBinaryWithContext(ctx *EncodingContext) (err error) {
  7571. // panics are recovered and propagated as errors
  7572. defer func() {
  7573. if r := recover(); r != nil {
  7574. if e, ok := r.(error); ok {
  7575. err = e
  7576. } else if s, ok := r.(string); ok {
  7577. err = fmt.Errorf("unexpected panic: %s", s)
  7578. } else {
  7579. err = fmt.Errorf("unexpected panic: %+v", r)
  7580. }
  7581. }
  7582. }()
  7583. buff := ctx.Buffer
  7584. buff.WriteUInt8(DefaultCodecVersion) // version
  7585. if target.Hard == nil {
  7586. buff.WriteUInt8(uint8(0)) // write nil byte
  7587. } else {
  7588. buff.WriteUInt8(uint8(1)) // write non-nil byte
  7589. // --- [begin][write][struct](ResourceQuotaSpecHard) ---
  7590. buff.WriteInt(0) // [compatibility, unused]
  7591. errA := target.Hard.MarshalBinaryWithContext(ctx)
  7592. if errA != nil {
  7593. return errA
  7594. }
  7595. // --- [end][write][struct](ResourceQuotaSpecHard) ---
  7596. }
  7597. return nil
  7598. }
  7599. // UnmarshalBinary uses the data passed byte array to set all the internal properties of
  7600. // the ResourceQuotaSpec type
  7601. func (target *ResourceQuotaSpec) UnmarshalBinary(data []byte) error {
  7602. ctx := NewDecodingContextFromBytes(data)
  7603. defer ctx.Close()
  7604. err := target.UnmarshalBinaryWithContext(ctx)
  7605. if err != nil {
  7606. return err
  7607. }
  7608. return nil
  7609. }
  7610. // UnmarshalBinaryFromReader uses the io.Reader data to set all the internal properties of
  7611. // the ResourceQuotaSpec type
  7612. func (target *ResourceQuotaSpec) UnmarshalBinaryFromReader(reader io.Reader) error {
  7613. ctx := NewDecodingContextFromReader(reader)
  7614. defer ctx.Close()
  7615. err := target.UnmarshalBinaryWithContext(ctx)
  7616. if err != nil {
  7617. return err
  7618. }
  7619. return nil
  7620. }
  7621. // UnmarshalBinaryWithContext uses the context containing a string table and binary buffer to set all the internal properties of
  7622. // the ResourceQuotaSpec type
  7623. func (target *ResourceQuotaSpec) UnmarshalBinaryWithContext(ctx *DecodingContext) (err error) {
  7624. // panics are recovered and propagated as errors
  7625. defer func() {
  7626. if r := recover(); r != nil {
  7627. if e, ok := r.(error); ok {
  7628. err = e
  7629. } else if s, ok := r.(string); ok {
  7630. err = fmt.Errorf("unexpected panic: %s", s)
  7631. } else {
  7632. err = fmt.Errorf("unexpected panic: %+v", r)
  7633. }
  7634. }
  7635. }()
  7636. buff := ctx.Buffer
  7637. version := buff.ReadUInt8()
  7638. if version > DefaultCodecVersion {
  7639. return fmt.Errorf("Invalid Version Unmarshalling ResourceQuotaSpec. Expected %d or less, got %d", DefaultCodecVersion, version)
  7640. }
  7641. // field version check
  7642. if uint8(1) <= version {
  7643. if buff.ReadUInt8() == uint8(0) {
  7644. target.Hard = nil
  7645. } else {
  7646. // --- [begin][read][struct](ResourceQuotaSpecHard) ---
  7647. a := new(ResourceQuotaSpecHard)
  7648. buff.ReadInt() // [compatibility, unused]
  7649. errA := a.UnmarshalBinaryWithContext(ctx)
  7650. if errA != nil {
  7651. return errA
  7652. }
  7653. target.Hard = a
  7654. // --- [end][read][struct](ResourceQuotaSpecHard) ---
  7655. }
  7656. } else {
  7657. target.Hard = nil
  7658. }
  7659. return nil
  7660. }
  7661. //--------------------------------------------------------------------------
  7662. // ResourceQuotaSpecHard
  7663. //--------------------------------------------------------------------------
  7664. // MarshalBinary serializes the internal properties of this ResourceQuotaSpecHard instance
  7665. // into a byte array
  7666. func (target *ResourceQuotaSpecHard) MarshalBinary() (data []byte, err error) {
  7667. ctx := NewEncodingContext(nil)
  7668. e := target.MarshalBinaryWithContext(ctx)
  7669. if e != nil {
  7670. return nil, e
  7671. }
  7672. return ctx.ToBytes(), nil
  7673. }
  7674. // MarshalBinary serializes the internal properties of this ResourceQuotaSpecHard instance
  7675. // into an io.Writer.
  7676. func (target *ResourceQuotaSpecHard) MarshalBinaryTo(writer io.Writer) error {
  7677. buff := util.NewBufferFromWriter(writer)
  7678. defer buff.Flush()
  7679. ctx := NewEncodingContextFromBuffer(buff, nil)
  7680. return target.MarshalBinaryWithContext(ctx)
  7681. }
  7682. // MarshalBinaryWithContext serializes the internal properties of this ResourceQuotaSpecHard instance
  7683. // into a byte array leveraging a predefined context.
  7684. func (target *ResourceQuotaSpecHard) MarshalBinaryWithContext(ctx *EncodingContext) (err error) {
  7685. // panics are recovered and propagated as errors
  7686. defer func() {
  7687. if r := recover(); r != nil {
  7688. if e, ok := r.(error); ok {
  7689. err = e
  7690. } else if s, ok := r.(string); ok {
  7691. err = fmt.Errorf("unexpected panic: %s", s)
  7692. } else {
  7693. err = fmt.Errorf("unexpected panic: %+v", r)
  7694. }
  7695. }
  7696. }()
  7697. buff := ctx.Buffer
  7698. buff.WriteUInt8(DefaultCodecVersion) // version
  7699. // --- [begin][write][alias](ResourceQuantities) ---
  7700. if map[Resource]ResourceQuantity(target.Requests) == nil {
  7701. buff.WriteUInt8(uint8(0)) // write nil byte
  7702. } else {
  7703. buff.WriteUInt8(uint8(1)) // write non-nil byte
  7704. // --- [begin][write][map](map[Resource]ResourceQuantity) ---
  7705. buff.WriteInt(len(map[Resource]ResourceQuantity(target.Requests))) // map length
  7706. for v, z := range map[Resource]ResourceQuantity(target.Requests) {
  7707. // --- [begin][write][alias](Resource) ---
  7708. if ctx.IsStringTable() {
  7709. a := ctx.Table.AddOrGet(string(v))
  7710. buff.WriteInt(a) // write table index
  7711. } else {
  7712. buff.WriteString(string(v)) // write string
  7713. }
  7714. // --- [end][write][alias](Resource) ---
  7715. // --- [begin][write][struct](ResourceQuantity) ---
  7716. buff.WriteInt(0) // [compatibility, unused]
  7717. errA := z.MarshalBinaryWithContext(ctx)
  7718. if errA != nil {
  7719. return errA
  7720. }
  7721. // --- [end][write][struct](ResourceQuantity) ---
  7722. }
  7723. // --- [end][write][map](map[Resource]ResourceQuantity) ---
  7724. }
  7725. // --- [end][write][alias](ResourceQuantities) ---
  7726. // --- [begin][write][alias](ResourceQuantities) ---
  7727. if map[Resource]ResourceQuantity(target.Limits) == nil {
  7728. buff.WriteUInt8(uint8(0)) // write nil byte
  7729. } else {
  7730. buff.WriteUInt8(uint8(1)) // write non-nil byte
  7731. // --- [begin][write][map](map[Resource]ResourceQuantity) ---
  7732. buff.WriteInt(len(map[Resource]ResourceQuantity(target.Limits))) // map length
  7733. for vv, zz := range map[Resource]ResourceQuantity(target.Limits) {
  7734. // --- [begin][write][alias](Resource) ---
  7735. if ctx.IsStringTable() {
  7736. b := ctx.Table.AddOrGet(string(vv))
  7737. buff.WriteInt(b) // write table index
  7738. } else {
  7739. buff.WriteString(string(vv)) // write string
  7740. }
  7741. // --- [end][write][alias](Resource) ---
  7742. // --- [begin][write][struct](ResourceQuantity) ---
  7743. buff.WriteInt(0) // [compatibility, unused]
  7744. errB := zz.MarshalBinaryWithContext(ctx)
  7745. if errB != nil {
  7746. return errB
  7747. }
  7748. // --- [end][write][struct](ResourceQuantity) ---
  7749. }
  7750. // --- [end][write][map](map[Resource]ResourceQuantity) ---
  7751. }
  7752. // --- [end][write][alias](ResourceQuantities) ---
  7753. return nil
  7754. }
  7755. // UnmarshalBinary uses the data passed byte array to set all the internal properties of
  7756. // the ResourceQuotaSpecHard type
  7757. func (target *ResourceQuotaSpecHard) UnmarshalBinary(data []byte) error {
  7758. ctx := NewDecodingContextFromBytes(data)
  7759. defer ctx.Close()
  7760. err := target.UnmarshalBinaryWithContext(ctx)
  7761. if err != nil {
  7762. return err
  7763. }
  7764. return nil
  7765. }
  7766. // UnmarshalBinaryFromReader uses the io.Reader data to set all the internal properties of
  7767. // the ResourceQuotaSpecHard type
  7768. func (target *ResourceQuotaSpecHard) UnmarshalBinaryFromReader(reader io.Reader) error {
  7769. ctx := NewDecodingContextFromReader(reader)
  7770. defer ctx.Close()
  7771. err := target.UnmarshalBinaryWithContext(ctx)
  7772. if err != nil {
  7773. return err
  7774. }
  7775. return nil
  7776. }
  7777. // UnmarshalBinaryWithContext uses the context containing a string table and binary buffer to set all the internal properties of
  7778. // the ResourceQuotaSpecHard type
  7779. func (target *ResourceQuotaSpecHard) UnmarshalBinaryWithContext(ctx *DecodingContext) (err error) {
  7780. // panics are recovered and propagated as errors
  7781. defer func() {
  7782. if r := recover(); r != nil {
  7783. if e, ok := r.(error); ok {
  7784. err = e
  7785. } else if s, ok := r.(string); ok {
  7786. err = fmt.Errorf("unexpected panic: %s", s)
  7787. } else {
  7788. err = fmt.Errorf("unexpected panic: %+v", r)
  7789. }
  7790. }
  7791. }()
  7792. buff := ctx.Buffer
  7793. version := buff.ReadUInt8()
  7794. if version > DefaultCodecVersion {
  7795. return fmt.Errorf("Invalid Version Unmarshalling ResourceQuotaSpecHard. Expected %d or less, got %d", DefaultCodecVersion, version)
  7796. }
  7797. // field version check
  7798. if uint8(1) <= version {
  7799. // --- [begin][read][alias](ResourceQuantities) ---
  7800. var a map[Resource]ResourceQuantity
  7801. if buff.ReadUInt8() == uint8(0) {
  7802. a = nil
  7803. } else {
  7804. // --- [begin][read][map](map[Resource]ResourceQuantity) ---
  7805. c := buff.ReadInt() // map len
  7806. b := make(map[Resource]ResourceQuantity, c)
  7807. for range c {
  7808. // --- [begin][read][alias](Resource) ---
  7809. var d string
  7810. var f string
  7811. if ctx.IsStringTable() {
  7812. g := buff.ReadInt() // read string index
  7813. f = ctx.Table.At(g)
  7814. } else {
  7815. f = buff.ReadString() // read string
  7816. }
  7817. e := f
  7818. d = e
  7819. v := Resource(d)
  7820. // --- [end][read][alias](Resource) ---
  7821. // --- [begin][read][struct](ResourceQuantity) ---
  7822. h := new(ResourceQuantity)
  7823. buff.ReadInt() // [compatibility, unused]
  7824. errA := h.UnmarshalBinaryWithContext(ctx)
  7825. if errA != nil {
  7826. return errA
  7827. }
  7828. z := *h
  7829. // --- [end][read][struct](ResourceQuantity) ---
  7830. b[v] = z
  7831. }
  7832. a = b
  7833. // --- [end][read][map](map[Resource]ResourceQuantity) ---
  7834. }
  7835. target.Requests = ResourceQuantities(a)
  7836. // --- [end][read][alias](ResourceQuantities) ---
  7837. } else {
  7838. }
  7839. // field version check
  7840. if uint8(1) <= version {
  7841. // --- [begin][read][alias](ResourceQuantities) ---
  7842. var l map[Resource]ResourceQuantity
  7843. if buff.ReadUInt8() == uint8(0) {
  7844. l = nil
  7845. } else {
  7846. // --- [begin][read][map](map[Resource]ResourceQuantity) ---
  7847. n := buff.ReadInt() // map len
  7848. m := make(map[Resource]ResourceQuantity, n)
  7849. for range n {
  7850. // --- [begin][read][alias](Resource) ---
  7851. var o string
  7852. var q string
  7853. if ctx.IsStringTable() {
  7854. r := buff.ReadInt() // read string index
  7855. q = ctx.Table.At(r)
  7856. } else {
  7857. q = buff.ReadString() // read string
  7858. }
  7859. p := q
  7860. o = p
  7861. vv := Resource(o)
  7862. // --- [end][read][alias](Resource) ---
  7863. // --- [begin][read][struct](ResourceQuantity) ---
  7864. s := new(ResourceQuantity)
  7865. buff.ReadInt() // [compatibility, unused]
  7866. errB := s.UnmarshalBinaryWithContext(ctx)
  7867. if errB != nil {
  7868. return errB
  7869. }
  7870. zz := *s
  7871. // --- [end][read][struct](ResourceQuantity) ---
  7872. m[vv] = zz
  7873. }
  7874. l = m
  7875. // --- [end][read][map](map[Resource]ResourceQuantity) ---
  7876. }
  7877. target.Limits = ResourceQuantities(l)
  7878. // --- [end][read][alias](ResourceQuantities) ---
  7879. } else {
  7880. }
  7881. return nil
  7882. }
  7883. //--------------------------------------------------------------------------
  7884. // ResourceQuotaStatus
  7885. //--------------------------------------------------------------------------
  7886. // MarshalBinary serializes the internal properties of this ResourceQuotaStatus instance
  7887. // into a byte array
  7888. func (target *ResourceQuotaStatus) MarshalBinary() (data []byte, err error) {
  7889. ctx := NewEncodingContext(nil)
  7890. e := target.MarshalBinaryWithContext(ctx)
  7891. if e != nil {
  7892. return nil, e
  7893. }
  7894. return ctx.ToBytes(), nil
  7895. }
  7896. // MarshalBinary serializes the internal properties of this ResourceQuotaStatus instance
  7897. // into an io.Writer.
  7898. func (target *ResourceQuotaStatus) MarshalBinaryTo(writer io.Writer) error {
  7899. buff := util.NewBufferFromWriter(writer)
  7900. defer buff.Flush()
  7901. ctx := NewEncodingContextFromBuffer(buff, nil)
  7902. return target.MarshalBinaryWithContext(ctx)
  7903. }
  7904. // MarshalBinaryWithContext serializes the internal properties of this ResourceQuotaStatus instance
  7905. // into a byte array leveraging a predefined context.
  7906. func (target *ResourceQuotaStatus) MarshalBinaryWithContext(ctx *EncodingContext) (err error) {
  7907. // panics are recovered and propagated as errors
  7908. defer func() {
  7909. if r := recover(); r != nil {
  7910. if e, ok := r.(error); ok {
  7911. err = e
  7912. } else if s, ok := r.(string); ok {
  7913. err = fmt.Errorf("unexpected panic: %s", s)
  7914. } else {
  7915. err = fmt.Errorf("unexpected panic: %+v", r)
  7916. }
  7917. }
  7918. }()
  7919. buff := ctx.Buffer
  7920. buff.WriteUInt8(DefaultCodecVersion) // version
  7921. if target.Used == nil {
  7922. buff.WriteUInt8(uint8(0)) // write nil byte
  7923. } else {
  7924. buff.WriteUInt8(uint8(1)) // write non-nil byte
  7925. // --- [begin][write][struct](ResourceQuotaStatusUsed) ---
  7926. buff.WriteInt(0) // [compatibility, unused]
  7927. errA := target.Used.MarshalBinaryWithContext(ctx)
  7928. if errA != nil {
  7929. return errA
  7930. }
  7931. // --- [end][write][struct](ResourceQuotaStatusUsed) ---
  7932. }
  7933. return nil
  7934. }
  7935. // UnmarshalBinary uses the data passed byte array to set all the internal properties of
  7936. // the ResourceQuotaStatus type
  7937. func (target *ResourceQuotaStatus) UnmarshalBinary(data []byte) error {
  7938. ctx := NewDecodingContextFromBytes(data)
  7939. defer ctx.Close()
  7940. err := target.UnmarshalBinaryWithContext(ctx)
  7941. if err != nil {
  7942. return err
  7943. }
  7944. return nil
  7945. }
  7946. // UnmarshalBinaryFromReader uses the io.Reader data to set all the internal properties of
  7947. // the ResourceQuotaStatus type
  7948. func (target *ResourceQuotaStatus) UnmarshalBinaryFromReader(reader io.Reader) error {
  7949. ctx := NewDecodingContextFromReader(reader)
  7950. defer ctx.Close()
  7951. err := target.UnmarshalBinaryWithContext(ctx)
  7952. if err != nil {
  7953. return err
  7954. }
  7955. return nil
  7956. }
  7957. // UnmarshalBinaryWithContext uses the context containing a string table and binary buffer to set all the internal properties of
  7958. // the ResourceQuotaStatus type
  7959. func (target *ResourceQuotaStatus) UnmarshalBinaryWithContext(ctx *DecodingContext) (err error) {
  7960. // panics are recovered and propagated as errors
  7961. defer func() {
  7962. if r := recover(); r != nil {
  7963. if e, ok := r.(error); ok {
  7964. err = e
  7965. } else if s, ok := r.(string); ok {
  7966. err = fmt.Errorf("unexpected panic: %s", s)
  7967. } else {
  7968. err = fmt.Errorf("unexpected panic: %+v", r)
  7969. }
  7970. }
  7971. }()
  7972. buff := ctx.Buffer
  7973. version := buff.ReadUInt8()
  7974. if version > DefaultCodecVersion {
  7975. return fmt.Errorf("Invalid Version Unmarshalling ResourceQuotaStatus. Expected %d or less, got %d", DefaultCodecVersion, version)
  7976. }
  7977. // field version check
  7978. if uint8(1) <= version {
  7979. if buff.ReadUInt8() == uint8(0) {
  7980. target.Used = nil
  7981. } else {
  7982. // --- [begin][read][struct](ResourceQuotaStatusUsed) ---
  7983. a := new(ResourceQuotaStatusUsed)
  7984. buff.ReadInt() // [compatibility, unused]
  7985. errA := a.UnmarshalBinaryWithContext(ctx)
  7986. if errA != nil {
  7987. return errA
  7988. }
  7989. target.Used = a
  7990. // --- [end][read][struct](ResourceQuotaStatusUsed) ---
  7991. }
  7992. } else {
  7993. target.Used = nil
  7994. }
  7995. return nil
  7996. }
  7997. //--------------------------------------------------------------------------
  7998. // ResourceQuotaStatusUsed
  7999. //--------------------------------------------------------------------------
  8000. // MarshalBinary serializes the internal properties of this ResourceQuotaStatusUsed instance
  8001. // into a byte array
  8002. func (target *ResourceQuotaStatusUsed) MarshalBinary() (data []byte, err error) {
  8003. ctx := NewEncodingContext(nil)
  8004. e := target.MarshalBinaryWithContext(ctx)
  8005. if e != nil {
  8006. return nil, e
  8007. }
  8008. return ctx.ToBytes(), nil
  8009. }
  8010. // MarshalBinary serializes the internal properties of this ResourceQuotaStatusUsed instance
  8011. // into an io.Writer.
  8012. func (target *ResourceQuotaStatusUsed) MarshalBinaryTo(writer io.Writer) error {
  8013. buff := util.NewBufferFromWriter(writer)
  8014. defer buff.Flush()
  8015. ctx := NewEncodingContextFromBuffer(buff, nil)
  8016. return target.MarshalBinaryWithContext(ctx)
  8017. }
  8018. // MarshalBinaryWithContext serializes the internal properties of this ResourceQuotaStatusUsed instance
  8019. // into a byte array leveraging a predefined context.
  8020. func (target *ResourceQuotaStatusUsed) MarshalBinaryWithContext(ctx *EncodingContext) (err error) {
  8021. // panics are recovered and propagated as errors
  8022. defer func() {
  8023. if r := recover(); r != nil {
  8024. if e, ok := r.(error); ok {
  8025. err = e
  8026. } else if s, ok := r.(string); ok {
  8027. err = fmt.Errorf("unexpected panic: %s", s)
  8028. } else {
  8029. err = fmt.Errorf("unexpected panic: %+v", r)
  8030. }
  8031. }
  8032. }()
  8033. buff := ctx.Buffer
  8034. buff.WriteUInt8(DefaultCodecVersion) // version
  8035. // --- [begin][write][alias](ResourceQuantities) ---
  8036. if map[Resource]ResourceQuantity(target.Requests) == nil {
  8037. buff.WriteUInt8(uint8(0)) // write nil byte
  8038. } else {
  8039. buff.WriteUInt8(uint8(1)) // write non-nil byte
  8040. // --- [begin][write][map](map[Resource]ResourceQuantity) ---
  8041. buff.WriteInt(len(map[Resource]ResourceQuantity(target.Requests))) // map length
  8042. for v, z := range map[Resource]ResourceQuantity(target.Requests) {
  8043. // --- [begin][write][alias](Resource) ---
  8044. if ctx.IsStringTable() {
  8045. a := ctx.Table.AddOrGet(string(v))
  8046. buff.WriteInt(a) // write table index
  8047. } else {
  8048. buff.WriteString(string(v)) // write string
  8049. }
  8050. // --- [end][write][alias](Resource) ---
  8051. // --- [begin][write][struct](ResourceQuantity) ---
  8052. buff.WriteInt(0) // [compatibility, unused]
  8053. errA := z.MarshalBinaryWithContext(ctx)
  8054. if errA != nil {
  8055. return errA
  8056. }
  8057. // --- [end][write][struct](ResourceQuantity) ---
  8058. }
  8059. // --- [end][write][map](map[Resource]ResourceQuantity) ---
  8060. }
  8061. // --- [end][write][alias](ResourceQuantities) ---
  8062. // --- [begin][write][alias](ResourceQuantities) ---
  8063. if map[Resource]ResourceQuantity(target.Limits) == nil {
  8064. buff.WriteUInt8(uint8(0)) // write nil byte
  8065. } else {
  8066. buff.WriteUInt8(uint8(1)) // write non-nil byte
  8067. // --- [begin][write][map](map[Resource]ResourceQuantity) ---
  8068. buff.WriteInt(len(map[Resource]ResourceQuantity(target.Limits))) // map length
  8069. for vv, zz := range map[Resource]ResourceQuantity(target.Limits) {
  8070. // --- [begin][write][alias](Resource) ---
  8071. if ctx.IsStringTable() {
  8072. b := ctx.Table.AddOrGet(string(vv))
  8073. buff.WriteInt(b) // write table index
  8074. } else {
  8075. buff.WriteString(string(vv)) // write string
  8076. }
  8077. // --- [end][write][alias](Resource) ---
  8078. // --- [begin][write][struct](ResourceQuantity) ---
  8079. buff.WriteInt(0) // [compatibility, unused]
  8080. errB := zz.MarshalBinaryWithContext(ctx)
  8081. if errB != nil {
  8082. return errB
  8083. }
  8084. // --- [end][write][struct](ResourceQuantity) ---
  8085. }
  8086. // --- [end][write][map](map[Resource]ResourceQuantity) ---
  8087. }
  8088. // --- [end][write][alias](ResourceQuantities) ---
  8089. return nil
  8090. }
  8091. // UnmarshalBinary uses the data passed byte array to set all the internal properties of
  8092. // the ResourceQuotaStatusUsed type
  8093. func (target *ResourceQuotaStatusUsed) UnmarshalBinary(data []byte) error {
  8094. ctx := NewDecodingContextFromBytes(data)
  8095. defer ctx.Close()
  8096. err := target.UnmarshalBinaryWithContext(ctx)
  8097. if err != nil {
  8098. return err
  8099. }
  8100. return nil
  8101. }
  8102. // UnmarshalBinaryFromReader uses the io.Reader data to set all the internal properties of
  8103. // the ResourceQuotaStatusUsed type
  8104. func (target *ResourceQuotaStatusUsed) UnmarshalBinaryFromReader(reader io.Reader) error {
  8105. ctx := NewDecodingContextFromReader(reader)
  8106. defer ctx.Close()
  8107. err := target.UnmarshalBinaryWithContext(ctx)
  8108. if err != nil {
  8109. return err
  8110. }
  8111. return nil
  8112. }
  8113. // UnmarshalBinaryWithContext uses the context containing a string table and binary buffer to set all the internal properties of
  8114. // the ResourceQuotaStatusUsed type
  8115. func (target *ResourceQuotaStatusUsed) UnmarshalBinaryWithContext(ctx *DecodingContext) (err error) {
  8116. // panics are recovered and propagated as errors
  8117. defer func() {
  8118. if r := recover(); r != nil {
  8119. if e, ok := r.(error); ok {
  8120. err = e
  8121. } else if s, ok := r.(string); ok {
  8122. err = fmt.Errorf("unexpected panic: %s", s)
  8123. } else {
  8124. err = fmt.Errorf("unexpected panic: %+v", r)
  8125. }
  8126. }
  8127. }()
  8128. buff := ctx.Buffer
  8129. version := buff.ReadUInt8()
  8130. if version > DefaultCodecVersion {
  8131. return fmt.Errorf("Invalid Version Unmarshalling ResourceQuotaStatusUsed. Expected %d or less, got %d", DefaultCodecVersion, version)
  8132. }
  8133. // field version check
  8134. if uint8(1) <= version {
  8135. // --- [begin][read][alias](ResourceQuantities) ---
  8136. var a map[Resource]ResourceQuantity
  8137. if buff.ReadUInt8() == uint8(0) {
  8138. a = nil
  8139. } else {
  8140. // --- [begin][read][map](map[Resource]ResourceQuantity) ---
  8141. c := buff.ReadInt() // map len
  8142. b := make(map[Resource]ResourceQuantity, c)
  8143. for range c {
  8144. // --- [begin][read][alias](Resource) ---
  8145. var d string
  8146. var f string
  8147. if ctx.IsStringTable() {
  8148. g := buff.ReadInt() // read string index
  8149. f = ctx.Table.At(g)
  8150. } else {
  8151. f = buff.ReadString() // read string
  8152. }
  8153. e := f
  8154. d = e
  8155. v := Resource(d)
  8156. // --- [end][read][alias](Resource) ---
  8157. // --- [begin][read][struct](ResourceQuantity) ---
  8158. h := new(ResourceQuantity)
  8159. buff.ReadInt() // [compatibility, unused]
  8160. errA := h.UnmarshalBinaryWithContext(ctx)
  8161. if errA != nil {
  8162. return errA
  8163. }
  8164. z := *h
  8165. // --- [end][read][struct](ResourceQuantity) ---
  8166. b[v] = z
  8167. }
  8168. a = b
  8169. // --- [end][read][map](map[Resource]ResourceQuantity) ---
  8170. }
  8171. target.Requests = ResourceQuantities(a)
  8172. // --- [end][read][alias](ResourceQuantities) ---
  8173. } else {
  8174. }
  8175. // field version check
  8176. if uint8(1) <= version {
  8177. // --- [begin][read][alias](ResourceQuantities) ---
  8178. var l map[Resource]ResourceQuantity
  8179. if buff.ReadUInt8() == uint8(0) {
  8180. l = nil
  8181. } else {
  8182. // --- [begin][read][map](map[Resource]ResourceQuantity) ---
  8183. n := buff.ReadInt() // map len
  8184. m := make(map[Resource]ResourceQuantity, n)
  8185. for range n {
  8186. // --- [begin][read][alias](Resource) ---
  8187. var o string
  8188. var q string
  8189. if ctx.IsStringTable() {
  8190. r := buff.ReadInt() // read string index
  8191. q = ctx.Table.At(r)
  8192. } else {
  8193. q = buff.ReadString() // read string
  8194. }
  8195. p := q
  8196. o = p
  8197. vv := Resource(o)
  8198. // --- [end][read][alias](Resource) ---
  8199. // --- [begin][read][struct](ResourceQuantity) ---
  8200. s := new(ResourceQuantity)
  8201. buff.ReadInt() // [compatibility, unused]
  8202. errB := s.UnmarshalBinaryWithContext(ctx)
  8203. if errB != nil {
  8204. return errB
  8205. }
  8206. zz := *s
  8207. // --- [end][read][struct](ResourceQuantity) ---
  8208. m[vv] = zz
  8209. }
  8210. l = m
  8211. // --- [end][read][map](map[Resource]ResourceQuantity) ---
  8212. }
  8213. target.Limits = ResourceQuantities(l)
  8214. // --- [end][read][alias](ResourceQuantities) ---
  8215. } else {
  8216. }
  8217. return nil
  8218. }
  8219. //--------------------------------------------------------------------------
  8220. // Service
  8221. //--------------------------------------------------------------------------
  8222. // MarshalBinary serializes the internal properties of this Service instance
  8223. // into a byte array
  8224. func (target *Service) MarshalBinary() (data []byte, err error) {
  8225. ctx := NewEncodingContext(nil)
  8226. e := target.MarshalBinaryWithContext(ctx)
  8227. if e != nil {
  8228. return nil, e
  8229. }
  8230. return ctx.ToBytes(), nil
  8231. }
  8232. // MarshalBinary serializes the internal properties of this Service instance
  8233. // into an io.Writer.
  8234. func (target *Service) MarshalBinaryTo(writer io.Writer) error {
  8235. buff := util.NewBufferFromWriter(writer)
  8236. defer buff.Flush()
  8237. ctx := NewEncodingContextFromBuffer(buff, nil)
  8238. return target.MarshalBinaryWithContext(ctx)
  8239. }
  8240. // MarshalBinaryWithContext serializes the internal properties of this Service instance
  8241. // into a byte array leveraging a predefined context.
  8242. func (target *Service) MarshalBinaryWithContext(ctx *EncodingContext) (err error) {
  8243. // panics are recovered and propagated as errors
  8244. defer func() {
  8245. if r := recover(); r != nil {
  8246. if e, ok := r.(error); ok {
  8247. err = e
  8248. } else if s, ok := r.(string); ok {
  8249. err = fmt.Errorf("unexpected panic: %s", s)
  8250. } else {
  8251. err = fmt.Errorf("unexpected panic: %+v", r)
  8252. }
  8253. }
  8254. }()
  8255. buff := ctx.Buffer
  8256. buff.WriteUInt8(DefaultCodecVersion) // version
  8257. if ctx.IsStringTable() {
  8258. a := ctx.Table.AddOrGet(target.UID)
  8259. buff.WriteInt(a) // write table index
  8260. } else {
  8261. buff.WriteString(target.UID) // write string
  8262. }
  8263. if ctx.IsStringTable() {
  8264. b := ctx.Table.AddOrGet(target.NamespaceUID)
  8265. buff.WriteInt(b) // write table index
  8266. } else {
  8267. buff.WriteString(target.NamespaceUID) // write string
  8268. }
  8269. if ctx.IsStringTable() {
  8270. c := ctx.Table.AddOrGet(target.Name)
  8271. buff.WriteInt(c) // write table index
  8272. } else {
  8273. buff.WriteString(target.Name) // write string
  8274. }
  8275. // --- [begin][write][alias](ServiceType) ---
  8276. if ctx.IsStringTable() {
  8277. d := ctx.Table.AddOrGet(string(target.Type))
  8278. buff.WriteInt(d) // write table index
  8279. } else {
  8280. buff.WriteString(string(target.Type)) // write string
  8281. }
  8282. // --- [end][write][alias](ServiceType) ---
  8283. // --- [begin][write][reference](time.Time) ---
  8284. e, errA := target.Start.MarshalBinary()
  8285. if errA != nil {
  8286. return errA
  8287. }
  8288. buff.WriteInt(len(e))
  8289. buff.WriteBytes(e)
  8290. // --- [end][write][reference](time.Time) ---
  8291. // --- [begin][write][reference](time.Time) ---
  8292. f, errB := target.End.MarshalBinary()
  8293. if errB != nil {
  8294. return errB
  8295. }
  8296. buff.WriteInt(len(f))
  8297. buff.WriteBytes(f)
  8298. // --- [end][write][reference](time.Time) ---
  8299. if target.Selector == nil {
  8300. buff.WriteUInt8(uint8(0)) // write nil byte
  8301. } else {
  8302. buff.WriteUInt8(uint8(1)) // write non-nil byte
  8303. // --- [begin][write][map](map[string]string) ---
  8304. buff.WriteInt(len(target.Selector)) // map length
  8305. for v, z := range target.Selector {
  8306. if ctx.IsStringTable() {
  8307. g := ctx.Table.AddOrGet(v)
  8308. buff.WriteInt(g) // write table index
  8309. } else {
  8310. buff.WriteString(v) // write string
  8311. }
  8312. if ctx.IsStringTable() {
  8313. h := ctx.Table.AddOrGet(z)
  8314. buff.WriteInt(h) // write table index
  8315. } else {
  8316. buff.WriteString(z) // write string
  8317. }
  8318. }
  8319. // --- [end][write][map](map[string]string) ---
  8320. }
  8321. if ctx.IsStringTable() {
  8322. l := ctx.Table.AddOrGet(target.LBIngressAddress)
  8323. buff.WriteInt(l) // write table index
  8324. } else {
  8325. buff.WriteString(target.LBIngressAddress) // write string
  8326. }
  8327. return nil
  8328. }
  8329. // UnmarshalBinary uses the data passed byte array to set all the internal properties of
  8330. // the Service type
  8331. func (target *Service) UnmarshalBinary(data []byte) error {
  8332. ctx := NewDecodingContextFromBytes(data)
  8333. defer ctx.Close()
  8334. err := target.UnmarshalBinaryWithContext(ctx)
  8335. if err != nil {
  8336. return err
  8337. }
  8338. return nil
  8339. }
  8340. // UnmarshalBinaryFromReader uses the io.Reader data to set all the internal properties of
  8341. // the Service type
  8342. func (target *Service) UnmarshalBinaryFromReader(reader io.Reader) error {
  8343. ctx := NewDecodingContextFromReader(reader)
  8344. defer ctx.Close()
  8345. err := target.UnmarshalBinaryWithContext(ctx)
  8346. if err != nil {
  8347. return err
  8348. }
  8349. return nil
  8350. }
  8351. // UnmarshalBinaryWithContext uses the context containing a string table and binary buffer to set all the internal properties of
  8352. // the Service type
  8353. func (target *Service) UnmarshalBinaryWithContext(ctx *DecodingContext) (err error) {
  8354. // panics are recovered and propagated as errors
  8355. defer func() {
  8356. if r := recover(); r != nil {
  8357. if e, ok := r.(error); ok {
  8358. err = e
  8359. } else if s, ok := r.(string); ok {
  8360. err = fmt.Errorf("unexpected panic: %s", s)
  8361. } else {
  8362. err = fmt.Errorf("unexpected panic: %+v", r)
  8363. }
  8364. }
  8365. }()
  8366. buff := ctx.Buffer
  8367. version := buff.ReadUInt8()
  8368. if version > DefaultCodecVersion {
  8369. return fmt.Errorf("Invalid Version Unmarshalling Service. Expected %d or less, got %d", DefaultCodecVersion, version)
  8370. }
  8371. var b string
  8372. if ctx.IsStringTable() {
  8373. c := buff.ReadInt() // read string index
  8374. b = ctx.Table.At(c)
  8375. } else {
  8376. b = buff.ReadString() // read string
  8377. }
  8378. a := b
  8379. target.UID = a
  8380. var e string
  8381. if ctx.IsStringTable() {
  8382. f := buff.ReadInt() // read string index
  8383. e = ctx.Table.At(f)
  8384. } else {
  8385. e = buff.ReadString() // read string
  8386. }
  8387. d := e
  8388. target.NamespaceUID = d
  8389. var h string
  8390. if ctx.IsStringTable() {
  8391. l := buff.ReadInt() // read string index
  8392. h = ctx.Table.At(l)
  8393. } else {
  8394. h = buff.ReadString() // read string
  8395. }
  8396. g := h
  8397. target.Name = g
  8398. // --- [begin][read][alias](ServiceType) ---
  8399. var m string
  8400. var o string
  8401. if ctx.IsStringTable() {
  8402. p := buff.ReadInt() // read string index
  8403. o = ctx.Table.At(p)
  8404. } else {
  8405. o = buff.ReadString() // read string
  8406. }
  8407. n := o
  8408. m = n
  8409. target.Type = ServiceType(m)
  8410. // --- [end][read][alias](ServiceType) ---
  8411. // --- [begin][read][reference](time.Time) ---
  8412. q := new(time.Time)
  8413. r := buff.ReadInt() // byte array length
  8414. s := buff.ReadBytes(r)
  8415. errA := q.UnmarshalBinary(s)
  8416. if errA != nil {
  8417. return errA
  8418. }
  8419. target.Start = *q
  8420. // --- [end][read][reference](time.Time) ---
  8421. // --- [begin][read][reference](time.Time) ---
  8422. t := new(time.Time)
  8423. u := buff.ReadInt() // byte array length
  8424. w := buff.ReadBytes(u)
  8425. errB := t.UnmarshalBinary(w)
  8426. if errB != nil {
  8427. return errB
  8428. }
  8429. target.End = *t
  8430. // --- [end][read][reference](time.Time) ---
  8431. if buff.ReadUInt8() == uint8(0) {
  8432. target.Selector = nil
  8433. } else {
  8434. // --- [begin][read][map](map[string]string) ---
  8435. y := buff.ReadInt() // map len
  8436. x := make(map[string]string, y)
  8437. for range y {
  8438. var v string
  8439. var bb string
  8440. if ctx.IsStringTable() {
  8441. cc := buff.ReadInt() // read string index
  8442. bb = ctx.Table.At(cc)
  8443. } else {
  8444. bb = buff.ReadString() // read string
  8445. }
  8446. aa := bb
  8447. v = aa
  8448. var z string
  8449. var ee string
  8450. if ctx.IsStringTable() {
  8451. ff := buff.ReadInt() // read string index
  8452. ee = ctx.Table.At(ff)
  8453. } else {
  8454. ee = buff.ReadString() // read string
  8455. }
  8456. dd := ee
  8457. z = dd
  8458. x[v] = z
  8459. }
  8460. target.Selector = x
  8461. // --- [end][read][map](map[string]string) ---
  8462. }
  8463. var hh string
  8464. if ctx.IsStringTable() {
  8465. ll := buff.ReadInt() // read string index
  8466. hh = ctx.Table.At(ll)
  8467. } else {
  8468. hh = buff.ReadString() // read string
  8469. }
  8470. gg := hh
  8471. target.LBIngressAddress = gg
  8472. return nil
  8473. }
  8474. //--------------------------------------------------------------------------
  8475. // StatefulSet
  8476. //--------------------------------------------------------------------------
  8477. // MarshalBinary serializes the internal properties of this StatefulSet instance
  8478. // into a byte array
  8479. func (target *StatefulSet) MarshalBinary() (data []byte, err error) {
  8480. ctx := NewEncodingContext(nil)
  8481. e := target.MarshalBinaryWithContext(ctx)
  8482. if e != nil {
  8483. return nil, e
  8484. }
  8485. return ctx.ToBytes(), nil
  8486. }
  8487. // MarshalBinary serializes the internal properties of this StatefulSet instance
  8488. // into an io.Writer.
  8489. func (target *StatefulSet) MarshalBinaryTo(writer io.Writer) error {
  8490. buff := util.NewBufferFromWriter(writer)
  8491. defer buff.Flush()
  8492. ctx := NewEncodingContextFromBuffer(buff, nil)
  8493. return target.MarshalBinaryWithContext(ctx)
  8494. }
  8495. // MarshalBinaryWithContext serializes the internal properties of this StatefulSet instance
  8496. // into a byte array leveraging a predefined context.
  8497. func (target *StatefulSet) MarshalBinaryWithContext(ctx *EncodingContext) (err error) {
  8498. // panics are recovered and propagated as errors
  8499. defer func() {
  8500. if r := recover(); r != nil {
  8501. if e, ok := r.(error); ok {
  8502. err = e
  8503. } else if s, ok := r.(string); ok {
  8504. err = fmt.Errorf("unexpected panic: %s", s)
  8505. } else {
  8506. err = fmt.Errorf("unexpected panic: %+v", r)
  8507. }
  8508. }
  8509. }()
  8510. buff := ctx.Buffer
  8511. buff.WriteUInt8(DefaultCodecVersion) // version
  8512. if ctx.IsStringTable() {
  8513. a := ctx.Table.AddOrGet(target.UID)
  8514. buff.WriteInt(a) // write table index
  8515. } else {
  8516. buff.WriteString(target.UID) // write string
  8517. }
  8518. if ctx.IsStringTable() {
  8519. b := ctx.Table.AddOrGet(target.NamespaceUID)
  8520. buff.WriteInt(b) // write table index
  8521. } else {
  8522. buff.WriteString(target.NamespaceUID) // write string
  8523. }
  8524. if ctx.IsStringTable() {
  8525. c := ctx.Table.AddOrGet(target.Name)
  8526. buff.WriteInt(c) // write table index
  8527. } else {
  8528. buff.WriteString(target.Name) // write string
  8529. }
  8530. if target.Labels == nil {
  8531. buff.WriteUInt8(uint8(0)) // write nil byte
  8532. } else {
  8533. buff.WriteUInt8(uint8(1)) // write non-nil byte
  8534. // --- [begin][write][map](map[string]string) ---
  8535. buff.WriteInt(len(target.Labels)) // map length
  8536. for v, z := range target.Labels {
  8537. if ctx.IsStringTable() {
  8538. d := ctx.Table.AddOrGet(v)
  8539. buff.WriteInt(d) // write table index
  8540. } else {
  8541. buff.WriteString(v) // write string
  8542. }
  8543. if ctx.IsStringTable() {
  8544. e := ctx.Table.AddOrGet(z)
  8545. buff.WriteInt(e) // write table index
  8546. } else {
  8547. buff.WriteString(z) // write string
  8548. }
  8549. }
  8550. // --- [end][write][map](map[string]string) ---
  8551. }
  8552. if target.Annotations == nil {
  8553. buff.WriteUInt8(uint8(0)) // write nil byte
  8554. } else {
  8555. buff.WriteUInt8(uint8(1)) // write non-nil byte
  8556. // --- [begin][write][map](map[string]string) ---
  8557. buff.WriteInt(len(target.Annotations)) // map length
  8558. for vv, zz := range target.Annotations {
  8559. if ctx.IsStringTable() {
  8560. f := ctx.Table.AddOrGet(vv)
  8561. buff.WriteInt(f) // write table index
  8562. } else {
  8563. buff.WriteString(vv) // write string
  8564. }
  8565. if ctx.IsStringTable() {
  8566. g := ctx.Table.AddOrGet(zz)
  8567. buff.WriteInt(g) // write table index
  8568. } else {
  8569. buff.WriteString(zz) // write string
  8570. }
  8571. }
  8572. // --- [end][write][map](map[string]string) ---
  8573. }
  8574. if target.MatchLabels == nil {
  8575. buff.WriteUInt8(uint8(0)) // write nil byte
  8576. } else {
  8577. buff.WriteUInt8(uint8(1)) // write non-nil byte
  8578. // --- [begin][write][map](map[string]string) ---
  8579. buff.WriteInt(len(target.MatchLabels)) // map length
  8580. for vvv, zzz := range target.MatchLabels {
  8581. if ctx.IsStringTable() {
  8582. h := ctx.Table.AddOrGet(vvv)
  8583. buff.WriteInt(h) // write table index
  8584. } else {
  8585. buff.WriteString(vvv) // write string
  8586. }
  8587. if ctx.IsStringTable() {
  8588. l := ctx.Table.AddOrGet(zzz)
  8589. buff.WriteInt(l) // write table index
  8590. } else {
  8591. buff.WriteString(zzz) // write string
  8592. }
  8593. }
  8594. // --- [end][write][map](map[string]string) ---
  8595. }
  8596. // --- [begin][write][reference](time.Time) ---
  8597. m, errA := target.Start.MarshalBinary()
  8598. if errA != nil {
  8599. return errA
  8600. }
  8601. buff.WriteInt(len(m))
  8602. buff.WriteBytes(m)
  8603. // --- [end][write][reference](time.Time) ---
  8604. // --- [begin][write][reference](time.Time) ---
  8605. n, errB := target.End.MarshalBinary()
  8606. if errB != nil {
  8607. return errB
  8608. }
  8609. buff.WriteInt(len(n))
  8610. buff.WriteBytes(n)
  8611. // --- [end][write][reference](time.Time) ---
  8612. return nil
  8613. }
  8614. // UnmarshalBinary uses the data passed byte array to set all the internal properties of
  8615. // the StatefulSet type
  8616. func (target *StatefulSet) UnmarshalBinary(data []byte) error {
  8617. ctx := NewDecodingContextFromBytes(data)
  8618. defer ctx.Close()
  8619. err := target.UnmarshalBinaryWithContext(ctx)
  8620. if err != nil {
  8621. return err
  8622. }
  8623. return nil
  8624. }
  8625. // UnmarshalBinaryFromReader uses the io.Reader data to set all the internal properties of
  8626. // the StatefulSet type
  8627. func (target *StatefulSet) UnmarshalBinaryFromReader(reader io.Reader) error {
  8628. ctx := NewDecodingContextFromReader(reader)
  8629. defer ctx.Close()
  8630. err := target.UnmarshalBinaryWithContext(ctx)
  8631. if err != nil {
  8632. return err
  8633. }
  8634. return nil
  8635. }
  8636. // UnmarshalBinaryWithContext uses the context containing a string table and binary buffer to set all the internal properties of
  8637. // the StatefulSet type
  8638. func (target *StatefulSet) UnmarshalBinaryWithContext(ctx *DecodingContext) (err error) {
  8639. // panics are recovered and propagated as errors
  8640. defer func() {
  8641. if r := recover(); r != nil {
  8642. if e, ok := r.(error); ok {
  8643. err = e
  8644. } else if s, ok := r.(string); ok {
  8645. err = fmt.Errorf("unexpected panic: %s", s)
  8646. } else {
  8647. err = fmt.Errorf("unexpected panic: %+v", r)
  8648. }
  8649. }
  8650. }()
  8651. buff := ctx.Buffer
  8652. version := buff.ReadUInt8()
  8653. if version > DefaultCodecVersion {
  8654. return fmt.Errorf("Invalid Version Unmarshalling StatefulSet. Expected %d or less, got %d", DefaultCodecVersion, version)
  8655. }
  8656. var b string
  8657. if ctx.IsStringTable() {
  8658. c := buff.ReadInt() // read string index
  8659. b = ctx.Table.At(c)
  8660. } else {
  8661. b = buff.ReadString() // read string
  8662. }
  8663. a := b
  8664. target.UID = a
  8665. var e string
  8666. if ctx.IsStringTable() {
  8667. f := buff.ReadInt() // read string index
  8668. e = ctx.Table.At(f)
  8669. } else {
  8670. e = buff.ReadString() // read string
  8671. }
  8672. d := e
  8673. target.NamespaceUID = d
  8674. var h string
  8675. if ctx.IsStringTable() {
  8676. l := buff.ReadInt() // read string index
  8677. h = ctx.Table.At(l)
  8678. } else {
  8679. h = buff.ReadString() // read string
  8680. }
  8681. g := h
  8682. target.Name = g
  8683. if buff.ReadUInt8() == uint8(0) {
  8684. target.Labels = nil
  8685. } else {
  8686. // --- [begin][read][map](map[string]string) ---
  8687. n := buff.ReadInt() // map len
  8688. m := make(map[string]string, n)
  8689. for range n {
  8690. var v string
  8691. var p string
  8692. if ctx.IsStringTable() {
  8693. q := buff.ReadInt() // read string index
  8694. p = ctx.Table.At(q)
  8695. } else {
  8696. p = buff.ReadString() // read string
  8697. }
  8698. o := p
  8699. v = o
  8700. var z string
  8701. var s string
  8702. if ctx.IsStringTable() {
  8703. t := buff.ReadInt() // read string index
  8704. s = ctx.Table.At(t)
  8705. } else {
  8706. s = buff.ReadString() // read string
  8707. }
  8708. r := s
  8709. z = r
  8710. m[v] = z
  8711. }
  8712. target.Labels = m
  8713. // --- [end][read][map](map[string]string) ---
  8714. }
  8715. if buff.ReadUInt8() == uint8(0) {
  8716. target.Annotations = nil
  8717. } else {
  8718. // --- [begin][read][map](map[string]string) ---
  8719. w := buff.ReadInt() // map len
  8720. u := make(map[string]string, w)
  8721. for range w {
  8722. var vv string
  8723. var y string
  8724. if ctx.IsStringTable() {
  8725. aa := buff.ReadInt() // read string index
  8726. y = ctx.Table.At(aa)
  8727. } else {
  8728. y = buff.ReadString() // read string
  8729. }
  8730. x := y
  8731. vv = x
  8732. var zz string
  8733. var cc string
  8734. if ctx.IsStringTable() {
  8735. dd := buff.ReadInt() // read string index
  8736. cc = ctx.Table.At(dd)
  8737. } else {
  8738. cc = buff.ReadString() // read string
  8739. }
  8740. bb := cc
  8741. zz = bb
  8742. u[vv] = zz
  8743. }
  8744. target.Annotations = u
  8745. // --- [end][read][map](map[string]string) ---
  8746. }
  8747. if buff.ReadUInt8() == uint8(0) {
  8748. target.MatchLabels = nil
  8749. } else {
  8750. // --- [begin][read][map](map[string]string) ---
  8751. ff := buff.ReadInt() // map len
  8752. ee := make(map[string]string, ff)
  8753. for range ff {
  8754. var vvv string
  8755. var hh string
  8756. if ctx.IsStringTable() {
  8757. ll := buff.ReadInt() // read string index
  8758. hh = ctx.Table.At(ll)
  8759. } else {
  8760. hh = buff.ReadString() // read string
  8761. }
  8762. gg := hh
  8763. vvv = gg
  8764. var zzz string
  8765. var nn string
  8766. if ctx.IsStringTable() {
  8767. oo := buff.ReadInt() // read string index
  8768. nn = ctx.Table.At(oo)
  8769. } else {
  8770. nn = buff.ReadString() // read string
  8771. }
  8772. mm := nn
  8773. zzz = mm
  8774. ee[vvv] = zzz
  8775. }
  8776. target.MatchLabels = ee
  8777. // --- [end][read][map](map[string]string) ---
  8778. }
  8779. // --- [begin][read][reference](time.Time) ---
  8780. pp := new(time.Time)
  8781. qq := buff.ReadInt() // byte array length
  8782. rr := buff.ReadBytes(qq)
  8783. errA := pp.UnmarshalBinary(rr)
  8784. if errA != nil {
  8785. return errA
  8786. }
  8787. target.Start = *pp
  8788. // --- [end][read][reference](time.Time) ---
  8789. // --- [begin][read][reference](time.Time) ---
  8790. ss := new(time.Time)
  8791. tt := buff.ReadInt() // byte array length
  8792. uu := buff.ReadBytes(tt)
  8793. errB := ss.UnmarshalBinary(uu)
  8794. if errB != nil {
  8795. return errB
  8796. }
  8797. target.End = *ss
  8798. // --- [end][read][reference](time.Time) ---
  8799. return nil
  8800. }
  8801. //--------------------------------------------------------------------------
  8802. // Window
  8803. //--------------------------------------------------------------------------
  8804. // MarshalBinary serializes the internal properties of this Window instance
  8805. // into a byte array
  8806. func (target *Window) MarshalBinary() (data []byte, err error) {
  8807. ctx := NewEncodingContext(nil)
  8808. e := target.MarshalBinaryWithContext(ctx)
  8809. if e != nil {
  8810. return nil, e
  8811. }
  8812. return ctx.ToBytes(), nil
  8813. }
  8814. // MarshalBinary serializes the internal properties of this Window instance
  8815. // into an io.Writer.
  8816. func (target *Window) MarshalBinaryTo(writer io.Writer) error {
  8817. buff := util.NewBufferFromWriter(writer)
  8818. defer buff.Flush()
  8819. ctx := NewEncodingContextFromBuffer(buff, nil)
  8820. return target.MarshalBinaryWithContext(ctx)
  8821. }
  8822. // MarshalBinaryWithContext serializes the internal properties of this Window instance
  8823. // into a byte array leveraging a predefined context.
  8824. func (target *Window) MarshalBinaryWithContext(ctx *EncodingContext) (err error) {
  8825. // panics are recovered and propagated as errors
  8826. defer func() {
  8827. if r := recover(); r != nil {
  8828. if e, ok := r.(error); ok {
  8829. err = e
  8830. } else if s, ok := r.(string); ok {
  8831. err = fmt.Errorf("unexpected panic: %s", s)
  8832. } else {
  8833. err = fmt.Errorf("unexpected panic: %+v", r)
  8834. }
  8835. }
  8836. }()
  8837. buff := ctx.Buffer
  8838. buff.WriteUInt8(DefaultCodecVersion) // version
  8839. // --- [begin][write][reference](time.Time) ---
  8840. a, errA := target.Start.MarshalBinary()
  8841. if errA != nil {
  8842. return errA
  8843. }
  8844. buff.WriteInt(len(a))
  8845. buff.WriteBytes(a)
  8846. // --- [end][write][reference](time.Time) ---
  8847. // --- [begin][write][reference](time.Time) ---
  8848. b, errB := target.End.MarshalBinary()
  8849. if errB != nil {
  8850. return errB
  8851. }
  8852. buff.WriteInt(len(b))
  8853. buff.WriteBytes(b)
  8854. // --- [end][write][reference](time.Time) ---
  8855. return nil
  8856. }
  8857. // UnmarshalBinary uses the data passed byte array to set all the internal properties of
  8858. // the Window type
  8859. func (target *Window) UnmarshalBinary(data []byte) error {
  8860. ctx := NewDecodingContextFromBytes(data)
  8861. defer ctx.Close()
  8862. err := target.UnmarshalBinaryWithContext(ctx)
  8863. if err != nil {
  8864. return err
  8865. }
  8866. return nil
  8867. }
  8868. // UnmarshalBinaryFromReader uses the io.Reader data to set all the internal properties of
  8869. // the Window type
  8870. func (target *Window) UnmarshalBinaryFromReader(reader io.Reader) error {
  8871. ctx := NewDecodingContextFromReader(reader)
  8872. defer ctx.Close()
  8873. err := target.UnmarshalBinaryWithContext(ctx)
  8874. if err != nil {
  8875. return err
  8876. }
  8877. return nil
  8878. }
  8879. // UnmarshalBinaryWithContext uses the context containing a string table and binary buffer to set all the internal properties of
  8880. // the Window type
  8881. func (target *Window) UnmarshalBinaryWithContext(ctx *DecodingContext) (err error) {
  8882. // panics are recovered and propagated as errors
  8883. defer func() {
  8884. if r := recover(); r != nil {
  8885. if e, ok := r.(error); ok {
  8886. err = e
  8887. } else if s, ok := r.(string); ok {
  8888. err = fmt.Errorf("unexpected panic: %s", s)
  8889. } else {
  8890. err = fmt.Errorf("unexpected panic: %+v", r)
  8891. }
  8892. }
  8893. }()
  8894. buff := ctx.Buffer
  8895. version := buff.ReadUInt8()
  8896. if version > DefaultCodecVersion {
  8897. return fmt.Errorf("Invalid Version Unmarshalling Window. Expected %d or less, got %d", DefaultCodecVersion, version)
  8898. }
  8899. // field version check
  8900. if uint8(1) <= version {
  8901. // --- [begin][read][reference](time.Time) ---
  8902. a := new(time.Time)
  8903. b := buff.ReadInt() // byte array length
  8904. c := buff.ReadBytes(b)
  8905. errA := a.UnmarshalBinary(c)
  8906. if errA != nil {
  8907. return errA
  8908. }
  8909. target.Start = *a
  8910. // --- [end][read][reference](time.Time) ---
  8911. } else {
  8912. }
  8913. // field version check
  8914. if uint8(1) <= version {
  8915. // --- [begin][read][reference](time.Time) ---
  8916. d := new(time.Time)
  8917. e := buff.ReadInt() // byte array length
  8918. f := buff.ReadBytes(e)
  8919. errB := d.UnmarshalBinary(f)
  8920. if errB != nil {
  8921. return errB
  8922. }
  8923. target.End = *d
  8924. // --- [end][read][reference](time.Time) ---
  8925. } else {
  8926. }
  8927. return nil
  8928. }