sqladmin-gen.go 229 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019
  1. // Package sqladmin provides access to the Cloud SQL Administration API.
  2. //
  3. // See https://cloud.google.com/sql/docs/reference/latest
  4. //
  5. // Usage example:
  6. //
  7. // import "google.golang.org/api/sqladmin/v1beta4"
  8. // ...
  9. // sqladminService, err := sqladmin.New(oauthHttpClient)
  10. package sqladmin // import "google.golang.org/api/sqladmin/v1beta4"
  11. import (
  12. "bytes"
  13. "encoding/json"
  14. "errors"
  15. "fmt"
  16. context "golang.org/x/net/context"
  17. ctxhttp "golang.org/x/net/context/ctxhttp"
  18. gensupport "google.golang.org/api/gensupport"
  19. googleapi "google.golang.org/api/googleapi"
  20. "io"
  21. "net/http"
  22. "net/url"
  23. "strconv"
  24. "strings"
  25. )
  26. // Always reference these packages, just in case the auto-generated code
  27. // below doesn't.
  28. var _ = bytes.NewBuffer
  29. var _ = strconv.Itoa
  30. var _ = fmt.Sprintf
  31. var _ = json.NewDecoder
  32. var _ = io.Copy
  33. var _ = url.Parse
  34. var _ = gensupport.MarshalJSON
  35. var _ = googleapi.Version
  36. var _ = errors.New
  37. var _ = strings.Replace
  38. var _ = context.Canceled
  39. var _ = ctxhttp.Do
  40. const apiId = "sqladmin:v1beta4"
  41. const apiName = "sqladmin"
  42. const apiVersion = "v1beta4"
  43. const basePath = "https://www.googleapis.com/sql/v1beta4/"
  44. // OAuth2 scopes used by this API.
  45. const (
  46. // View and manage your data across Google Cloud Platform services
  47. CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform"
  48. // Manage your Google SQL Service instances
  49. SqlserviceAdminScope = "https://www.googleapis.com/auth/sqlservice.admin"
  50. )
  51. func New(client *http.Client) (*Service, error) {
  52. if client == nil {
  53. return nil, errors.New("client is nil")
  54. }
  55. s := &Service{client: client, BasePath: basePath}
  56. s.BackupRuns = NewBackupRunsService(s)
  57. s.Databases = NewDatabasesService(s)
  58. s.Flags = NewFlagsService(s)
  59. s.Instances = NewInstancesService(s)
  60. s.Operations = NewOperationsService(s)
  61. s.SslCerts = NewSslCertsService(s)
  62. s.Tiers = NewTiersService(s)
  63. s.Users = NewUsersService(s)
  64. return s, nil
  65. }
  66. type Service struct {
  67. client *http.Client
  68. BasePath string // API endpoint base URL
  69. UserAgent string // optional additional User-Agent fragment
  70. BackupRuns *BackupRunsService
  71. Databases *DatabasesService
  72. Flags *FlagsService
  73. Instances *InstancesService
  74. Operations *OperationsService
  75. SslCerts *SslCertsService
  76. Tiers *TiersService
  77. Users *UsersService
  78. }
  79. func (s *Service) userAgent() string {
  80. if s.UserAgent == "" {
  81. return googleapi.UserAgent
  82. }
  83. return googleapi.UserAgent + " " + s.UserAgent
  84. }
  85. func NewBackupRunsService(s *Service) *BackupRunsService {
  86. rs := &BackupRunsService{s: s}
  87. return rs
  88. }
  89. type BackupRunsService struct {
  90. s *Service
  91. }
  92. func NewDatabasesService(s *Service) *DatabasesService {
  93. rs := &DatabasesService{s: s}
  94. return rs
  95. }
  96. type DatabasesService struct {
  97. s *Service
  98. }
  99. func NewFlagsService(s *Service) *FlagsService {
  100. rs := &FlagsService{s: s}
  101. return rs
  102. }
  103. type FlagsService struct {
  104. s *Service
  105. }
  106. func NewInstancesService(s *Service) *InstancesService {
  107. rs := &InstancesService{s: s}
  108. return rs
  109. }
  110. type InstancesService struct {
  111. s *Service
  112. }
  113. func NewOperationsService(s *Service) *OperationsService {
  114. rs := &OperationsService{s: s}
  115. return rs
  116. }
  117. type OperationsService struct {
  118. s *Service
  119. }
  120. func NewSslCertsService(s *Service) *SslCertsService {
  121. rs := &SslCertsService{s: s}
  122. return rs
  123. }
  124. type SslCertsService struct {
  125. s *Service
  126. }
  127. func NewTiersService(s *Service) *TiersService {
  128. rs := &TiersService{s: s}
  129. return rs
  130. }
  131. type TiersService struct {
  132. s *Service
  133. }
  134. func NewUsersService(s *Service) *UsersService {
  135. rs := &UsersService{s: s}
  136. return rs
  137. }
  138. type UsersService struct {
  139. s *Service
  140. }
  141. // AclEntry: An entry for an Access Control list.
  142. type AclEntry struct {
  143. // ExpirationTime: The time when this access control entry expires in
  144. // RFC 3339 format, for example 2012-11-15T16:19:00.094Z.
  145. ExpirationTime string `json:"expirationTime,omitempty"`
  146. // Kind: This is always sql#aclEntry.
  147. Kind string `json:"kind,omitempty"`
  148. // Name: An optional label to identify this entry.
  149. Name string `json:"name,omitempty"`
  150. // Value: The whitelisted value for the access control list.
  151. Value string `json:"value,omitempty"`
  152. // ForceSendFields is a list of field names (e.g. "ExpirationTime") to
  153. // unconditionally include in API requests. By default, fields with
  154. // empty values are omitted from API requests. However, any non-pointer,
  155. // non-interface field appearing in ForceSendFields will be sent to the
  156. // server regardless of whether the field is empty or not. This may be
  157. // used to include empty fields in Patch requests.
  158. ForceSendFields []string `json:"-"`
  159. }
  160. func (s *AclEntry) MarshalJSON() ([]byte, error) {
  161. type noMethod AclEntry
  162. raw := noMethod(*s)
  163. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  164. }
  165. // BackupConfiguration: Database instance backup configuration.
  166. type BackupConfiguration struct {
  167. // BinaryLogEnabled: Whether binary log is enabled. If backup
  168. // configuration is disabled, binary log must be disabled as well.
  169. BinaryLogEnabled bool `json:"binaryLogEnabled,omitempty"`
  170. // Enabled: Whether this configuration is enabled.
  171. Enabled bool `json:"enabled,omitempty"`
  172. // Kind: This is always sql#backupConfiguration.
  173. Kind string `json:"kind,omitempty"`
  174. // StartTime: Start time for the daily backup configuration in UTC
  175. // timezone in the 24 hour format - HH:MM.
  176. StartTime string `json:"startTime,omitempty"`
  177. // ForceSendFields is a list of field names (e.g. "BinaryLogEnabled") to
  178. // unconditionally include in API requests. By default, fields with
  179. // empty values are omitted from API requests. However, any non-pointer,
  180. // non-interface field appearing in ForceSendFields will be sent to the
  181. // server regardless of whether the field is empty or not. This may be
  182. // used to include empty fields in Patch requests.
  183. ForceSendFields []string `json:"-"`
  184. }
  185. func (s *BackupConfiguration) MarshalJSON() ([]byte, error) {
  186. type noMethod BackupConfiguration
  187. raw := noMethod(*s)
  188. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  189. }
  190. // BackupRun: A database instance backup run resource.
  191. type BackupRun struct {
  192. // EndTime: The time the backup operation completed in UTC timezone in
  193. // RFC 3339 format, for example 2012-11-15T16:19:00.094Z.
  194. EndTime string `json:"endTime,omitempty"`
  195. // EnqueuedTime: The time the run was enqueued in UTC timezone in RFC
  196. // 3339 format, for example 2012-11-15T16:19:00.094Z.
  197. EnqueuedTime string `json:"enqueuedTime,omitempty"`
  198. // Error: Information about why the backup operation failed. This is
  199. // only present if the run has the FAILED status.
  200. Error *OperationError `json:"error,omitempty"`
  201. // Id: A unique identifier for this backup run. Note that this is unique
  202. // only within the scope of a particular Cloud SQL instance.
  203. Id int64 `json:"id,omitempty,string"`
  204. // Instance: Name of the database instance.
  205. Instance string `json:"instance,omitempty"`
  206. // Kind: This is always sql#backupRun.
  207. Kind string `json:"kind,omitempty"`
  208. // SelfLink: The URI of this resource.
  209. SelfLink string `json:"selfLink,omitempty"`
  210. // StartTime: The time the backup operation actually started in UTC
  211. // timezone in RFC 3339 format, for example 2012-11-15T16:19:00.094Z.
  212. StartTime string `json:"startTime,omitempty"`
  213. // Status: The status of this run.
  214. Status string `json:"status,omitempty"`
  215. // WindowStartTime: The start time of the backup window during which
  216. // this the backup was attempted in RFC 3339 format, for example
  217. // 2012-11-15T16:19:00.094Z.
  218. WindowStartTime string `json:"windowStartTime,omitempty"`
  219. // ServerResponse contains the HTTP response code and headers from the
  220. // server.
  221. googleapi.ServerResponse `json:"-"`
  222. // ForceSendFields is a list of field names (e.g. "EndTime") to
  223. // unconditionally include in API requests. By default, fields with
  224. // empty values are omitted from API requests. However, any non-pointer,
  225. // non-interface field appearing in ForceSendFields will be sent to the
  226. // server regardless of whether the field is empty or not. This may be
  227. // used to include empty fields in Patch requests.
  228. ForceSendFields []string `json:"-"`
  229. }
  230. func (s *BackupRun) MarshalJSON() ([]byte, error) {
  231. type noMethod BackupRun
  232. raw := noMethod(*s)
  233. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  234. }
  235. // BackupRunsListResponse: Backup run list results.
  236. type BackupRunsListResponse struct {
  237. // Items: A list of backup runs in reverse chronological order of the
  238. // enqueued time.
  239. Items []*BackupRun `json:"items,omitempty"`
  240. // Kind: This is always sql#backupRunsList.
  241. Kind string `json:"kind,omitempty"`
  242. // NextPageToken: The continuation token, used to page through large
  243. // result sets. Provide this value in a subsequent request to return the
  244. // next page of results.
  245. NextPageToken string `json:"nextPageToken,omitempty"`
  246. // ServerResponse contains the HTTP response code and headers from the
  247. // server.
  248. googleapi.ServerResponse `json:"-"`
  249. // ForceSendFields is a list of field names (e.g. "Items") to
  250. // unconditionally include in API requests. By default, fields with
  251. // empty values are omitted from API requests. However, any non-pointer,
  252. // non-interface field appearing in ForceSendFields will be sent to the
  253. // server regardless of whether the field is empty or not. This may be
  254. // used to include empty fields in Patch requests.
  255. ForceSendFields []string `json:"-"`
  256. }
  257. func (s *BackupRunsListResponse) MarshalJSON() ([]byte, error) {
  258. type noMethod BackupRunsListResponse
  259. raw := noMethod(*s)
  260. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  261. }
  262. // BinLogCoordinates: Binary log coordinates.
  263. type BinLogCoordinates struct {
  264. // BinLogFileName: Name of the binary log file for a Cloud SQL instance.
  265. BinLogFileName string `json:"binLogFileName,omitempty"`
  266. // BinLogPosition: Position (offset) within the binary log file.
  267. BinLogPosition int64 `json:"binLogPosition,omitempty,string"`
  268. // Kind: This is always sql#binLogCoordinates.
  269. Kind string `json:"kind,omitempty"`
  270. // ForceSendFields is a list of field names (e.g. "BinLogFileName") to
  271. // unconditionally include in API requests. By default, fields with
  272. // empty values are omitted from API requests. However, any non-pointer,
  273. // non-interface field appearing in ForceSendFields will be sent to the
  274. // server regardless of whether the field is empty or not. This may be
  275. // used to include empty fields in Patch requests.
  276. ForceSendFields []string `json:"-"`
  277. }
  278. func (s *BinLogCoordinates) MarshalJSON() ([]byte, error) {
  279. type noMethod BinLogCoordinates
  280. raw := noMethod(*s)
  281. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  282. }
  283. // CloneContext: Database instance clone context.
  284. type CloneContext struct {
  285. // BinLogCoordinates: Binary log coordinates, if specified, indentify
  286. // the the position up to which the source instance should be cloned. If
  287. // not specified, the source instance is cloned up to the most recent
  288. // binary log coordintes.
  289. BinLogCoordinates *BinLogCoordinates `json:"binLogCoordinates,omitempty"`
  290. // DestinationInstanceName: Name of the Cloud SQL instance to be created
  291. // as a clone.
  292. DestinationInstanceName string `json:"destinationInstanceName,omitempty"`
  293. // Kind: This is always sql#cloneContext.
  294. Kind string `json:"kind,omitempty"`
  295. // ForceSendFields is a list of field names (e.g. "BinLogCoordinates")
  296. // to unconditionally include in API requests. By default, fields with
  297. // empty values are omitted from API requests. However, any non-pointer,
  298. // non-interface field appearing in ForceSendFields will be sent to the
  299. // server regardless of whether the field is empty or not. This may be
  300. // used to include empty fields in Patch requests.
  301. ForceSendFields []string `json:"-"`
  302. }
  303. func (s *CloneContext) MarshalJSON() ([]byte, error) {
  304. type noMethod CloneContext
  305. raw := noMethod(*s)
  306. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  307. }
  308. // Database: A database resource inside a Cloud SQL instance.
  309. type Database struct {
  310. // Charset: The MySQL charset value.
  311. Charset string `json:"charset,omitempty"`
  312. // Collation: The MySQL collation value.
  313. Collation string `json:"collation,omitempty"`
  314. // Etag: HTTP 1.1 Entity tag for the resource.
  315. Etag string `json:"etag,omitempty"`
  316. // Instance: The name of the Cloud SQL instance. This does not include
  317. // the project ID.
  318. Instance string `json:"instance,omitempty"`
  319. // Kind: This is always sql#database.
  320. Kind string `json:"kind,omitempty"`
  321. // Name: The name of the database in the Cloud SQL instance. This does
  322. // not include the project ID or instance name.
  323. Name string `json:"name,omitempty"`
  324. // Project: The project ID of the project containing the Cloud SQL
  325. // database. The Google apps domain is prefixed if applicable.
  326. Project string `json:"project,omitempty"`
  327. // SelfLink: The URI of this resource.
  328. SelfLink string `json:"selfLink,omitempty"`
  329. // ServerResponse contains the HTTP response code and headers from the
  330. // server.
  331. googleapi.ServerResponse `json:"-"`
  332. // ForceSendFields is a list of field names (e.g. "Charset") to
  333. // unconditionally include in API requests. By default, fields with
  334. // empty values are omitted from API requests. However, any non-pointer,
  335. // non-interface field appearing in ForceSendFields will be sent to the
  336. // server regardless of whether the field is empty or not. This may be
  337. // used to include empty fields in Patch requests.
  338. ForceSendFields []string `json:"-"`
  339. }
  340. func (s *Database) MarshalJSON() ([]byte, error) {
  341. type noMethod Database
  342. raw := noMethod(*s)
  343. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  344. }
  345. // DatabaseFlags: MySQL flags for Cloud SQL instances.
  346. type DatabaseFlags struct {
  347. // Name: The name of the flag. These flags are passed at instance
  348. // startup, so include both MySQL server options and MySQL system
  349. // variables. Flags should be specified with underscores, not hyphens.
  350. // For more information, see Configuring MySQL Flags in the Google Cloud
  351. // SQL documentation, as well as the official MySQL documentation for
  352. // server options and system variables.
  353. Name string `json:"name,omitempty"`
  354. // Value: The value of the flag. Booleans should be set to on for true
  355. // and off for false. This field must be omitted if the flag doesn't
  356. // take a value.
  357. Value string `json:"value,omitempty"`
  358. // ForceSendFields is a list of field names (e.g. "Name") to
  359. // unconditionally include in API requests. By default, fields with
  360. // empty values are omitted from API requests. However, any non-pointer,
  361. // non-interface field appearing in ForceSendFields will be sent to the
  362. // server regardless of whether the field is empty or not. This may be
  363. // used to include empty fields in Patch requests.
  364. ForceSendFields []string `json:"-"`
  365. }
  366. func (s *DatabaseFlags) MarshalJSON() ([]byte, error) {
  367. type noMethod DatabaseFlags
  368. raw := noMethod(*s)
  369. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  370. }
  371. // DatabaseInstance: A Cloud SQL instance resource.
  372. type DatabaseInstance struct {
  373. // CurrentDiskSize: The current disk usage of the instance in bytes.
  374. CurrentDiskSize int64 `json:"currentDiskSize,omitempty,string"`
  375. // DatabaseVersion: The database engine type and version. Can be
  376. // MYSQL_5_5 or MYSQL_5_6. Defaults to MYSQL_5_5. The databaseVersion
  377. // can not be changed after instance creation.
  378. DatabaseVersion string `json:"databaseVersion,omitempty"`
  379. // Etag: HTTP 1.1 Entity tag for the resource.
  380. Etag string `json:"etag,omitempty"`
  381. // FailoverReplica: The name and status of the failover replica. Only
  382. // applies to Second Generation instances.
  383. FailoverReplica *DatabaseInstanceFailoverReplica `json:"failoverReplica,omitempty"`
  384. // InstanceType: The instance type. This can be one of the
  385. // following.
  386. // CLOUD_SQL_INSTANCE: A Cloud SQL instance that is not replicating from
  387. // a master.
  388. // ON_PREMISES_INSTANCE: An instance running on the customer's
  389. // premises.
  390. // READ_REPLICA_INSTANCE: A Cloud SQL instance configured as a
  391. // read-replica.
  392. InstanceType string `json:"instanceType,omitempty"`
  393. // IpAddresses: The assigned IP addresses for the instance.
  394. IpAddresses []*IpMapping `json:"ipAddresses,omitempty"`
  395. // Ipv6Address: The IPv6 address assigned to the instance.
  396. Ipv6Address string `json:"ipv6Address,omitempty"`
  397. // Kind: This is always sql#instance.
  398. Kind string `json:"kind,omitempty"`
  399. // MasterInstanceName: The name of the instance which will act as master
  400. // in the replication setup.
  401. MasterInstanceName string `json:"masterInstanceName,omitempty"`
  402. // MaxDiskSize: The maximum disk size of the instance in bytes.
  403. MaxDiskSize int64 `json:"maxDiskSize,omitempty,string"`
  404. // Name: Name of the Cloud SQL instance. This does not include the
  405. // project ID.
  406. Name string `json:"name,omitempty"`
  407. // OnPremisesConfiguration: Configuration specific to on-premises
  408. // instances.
  409. OnPremisesConfiguration *OnPremisesConfiguration `json:"onPremisesConfiguration,omitempty"`
  410. // Project: The project ID of the project containing the Cloud SQL
  411. // instance. The Google apps domain is prefixed if applicable.
  412. Project string `json:"project,omitempty"`
  413. // Region: The geographical region. Can be us-central, asia-east1 or
  414. // europe-west1. Defaults to us-central. The region can not be changed
  415. // after instance creation.
  416. Region string `json:"region,omitempty"`
  417. // ReplicaConfiguration: Configuration specific to read-replicas
  418. // replicating from on-premises masters.
  419. ReplicaConfiguration *ReplicaConfiguration `json:"replicaConfiguration,omitempty"`
  420. // ReplicaNames: The replicas of the instance.
  421. ReplicaNames []string `json:"replicaNames,omitempty"`
  422. // SelfLink: The URI of this resource.
  423. SelfLink string `json:"selfLink,omitempty"`
  424. // ServerCaCert: SSL configuration.
  425. ServerCaCert *SslCert `json:"serverCaCert,omitempty"`
  426. // ServiceAccountEmailAddress: The service account email address
  427. // assigned to the instance.
  428. ServiceAccountEmailAddress string `json:"serviceAccountEmailAddress,omitempty"`
  429. // Settings: The user settings.
  430. Settings *Settings `json:"settings,omitempty"`
  431. // State: The current serving state of the Cloud SQL instance. This can
  432. // be one of the following.
  433. // RUNNABLE: The instance is running, or is ready to run when
  434. // accessed.
  435. // SUSPENDED: The instance is not available, for example due to problems
  436. // with billing.
  437. // PENDING_CREATE: The instance is being created.
  438. // MAINTENANCE: The instance is down for maintenance.
  439. // FAILED: The instance creation failed.
  440. // UNKNOWN_STATE: The state of the instance is unknown.
  441. State string `json:"state,omitempty"`
  442. // ServerResponse contains the HTTP response code and headers from the
  443. // server.
  444. googleapi.ServerResponse `json:"-"`
  445. // ForceSendFields is a list of field names (e.g. "CurrentDiskSize") to
  446. // unconditionally include in API requests. By default, fields with
  447. // empty values are omitted from API requests. However, any non-pointer,
  448. // non-interface field appearing in ForceSendFields will be sent to the
  449. // server regardless of whether the field is empty or not. This may be
  450. // used to include empty fields in Patch requests.
  451. ForceSendFields []string `json:"-"`
  452. }
  453. func (s *DatabaseInstance) MarshalJSON() ([]byte, error) {
  454. type noMethod DatabaseInstance
  455. raw := noMethod(*s)
  456. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  457. }
  458. // DatabaseInstanceFailoverReplica: The name and status of the failover
  459. // replica. Only applies to Second Generation instances.
  460. type DatabaseInstanceFailoverReplica struct {
  461. Available bool `json:"available,omitempty"`
  462. Name string `json:"name,omitempty"`
  463. // ForceSendFields is a list of field names (e.g. "Available") to
  464. // unconditionally include in API requests. By default, fields with
  465. // empty values are omitted from API requests. However, any non-pointer,
  466. // non-interface field appearing in ForceSendFields will be sent to the
  467. // server regardless of whether the field is empty or not. This may be
  468. // used to include empty fields in Patch requests.
  469. ForceSendFields []string `json:"-"`
  470. }
  471. func (s *DatabaseInstanceFailoverReplica) MarshalJSON() ([]byte, error) {
  472. type noMethod DatabaseInstanceFailoverReplica
  473. raw := noMethod(*s)
  474. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  475. }
  476. // DatabasesListResponse: Database list response.
  477. type DatabasesListResponse struct {
  478. // Items: List of database resources in the instance.
  479. Items []*Database `json:"items,omitempty"`
  480. // Kind: This is always sql#databasesList.
  481. Kind string `json:"kind,omitempty"`
  482. // ServerResponse contains the HTTP response code and headers from the
  483. // server.
  484. googleapi.ServerResponse `json:"-"`
  485. // ForceSendFields is a list of field names (e.g. "Items") to
  486. // unconditionally include in API requests. By default, fields with
  487. // empty values are omitted from API requests. However, any non-pointer,
  488. // non-interface field appearing in ForceSendFields will be sent to the
  489. // server regardless of whether the field is empty or not. This may be
  490. // used to include empty fields in Patch requests.
  491. ForceSendFields []string `json:"-"`
  492. }
  493. func (s *DatabasesListResponse) MarshalJSON() ([]byte, error) {
  494. type noMethod DatabasesListResponse
  495. raw := noMethod(*s)
  496. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  497. }
  498. // ExportContext: Database instance export context.
  499. type ExportContext struct {
  500. // CsvExportOptions: Options for exporting data as CSV.
  501. CsvExportOptions *ExportContextCsvExportOptions `json:"csvExportOptions,omitempty"`
  502. // Databases: Databases (for example, guestbook) from which the export
  503. // is made. If fileType is SQL and no database is specified, all
  504. // databases are exported. If fileType is CSV, you can optionally
  505. // specify at most one database to export. If
  506. // csvExportOptions.selectQuery also specifies the database, this field
  507. // will be ignored.
  508. Databases []string `json:"databases,omitempty"`
  509. // FileType: The file type for the specified uri.
  510. // SQL: The file contains SQL statements.
  511. // CSV: The file contains CSV data.
  512. FileType string `json:"fileType,omitempty"`
  513. // Kind: This is always sql#exportContext.
  514. Kind string `json:"kind,omitempty"`
  515. // SqlExportOptions: Options for exporting data as SQL statements.
  516. SqlExportOptions *ExportContextSqlExportOptions `json:"sqlExportOptions,omitempty"`
  517. // Uri: The path to the file in Google Cloud Storage where the export
  518. // will be stored. The URI is in the form gs://bucketName/fileName. If
  519. // the file already exists, the operation fails. If fileType is SQL and
  520. // the filename ends with .gz, the contents are compressed.
  521. Uri string `json:"uri,omitempty"`
  522. // ForceSendFields is a list of field names (e.g. "CsvExportOptions") to
  523. // unconditionally include in API requests. By default, fields with
  524. // empty values are omitted from API requests. However, any non-pointer,
  525. // non-interface field appearing in ForceSendFields will be sent to the
  526. // server regardless of whether the field is empty or not. This may be
  527. // used to include empty fields in Patch requests.
  528. ForceSendFields []string `json:"-"`
  529. }
  530. func (s *ExportContext) MarshalJSON() ([]byte, error) {
  531. type noMethod ExportContext
  532. raw := noMethod(*s)
  533. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  534. }
  535. // ExportContextCsvExportOptions: Options for exporting data as CSV.
  536. type ExportContextCsvExportOptions struct {
  537. // SelectQuery: The select query used to extract the data.
  538. SelectQuery string `json:"selectQuery,omitempty"`
  539. // ForceSendFields is a list of field names (e.g. "SelectQuery") to
  540. // unconditionally include in API requests. By default, fields with
  541. // empty values are omitted from API requests. However, any non-pointer,
  542. // non-interface field appearing in ForceSendFields will be sent to the
  543. // server regardless of whether the field is empty or not. This may be
  544. // used to include empty fields in Patch requests.
  545. ForceSendFields []string `json:"-"`
  546. }
  547. func (s *ExportContextCsvExportOptions) MarshalJSON() ([]byte, error) {
  548. type noMethod ExportContextCsvExportOptions
  549. raw := noMethod(*s)
  550. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  551. }
  552. // ExportContextSqlExportOptions: Options for exporting data as SQL
  553. // statements.
  554. type ExportContextSqlExportOptions struct {
  555. // SchemaOnly: Export only schemas.
  556. SchemaOnly bool `json:"schemaOnly,omitempty"`
  557. // Tables: Tables to export, or that were exported, from the specified
  558. // database. If you specify tables, specify one and only one database.
  559. Tables []string `json:"tables,omitempty"`
  560. // ForceSendFields is a list of field names (e.g. "SchemaOnly") to
  561. // unconditionally include in API requests. By default, fields with
  562. // empty values are omitted from API requests. However, any non-pointer,
  563. // non-interface field appearing in ForceSendFields will be sent to the
  564. // server regardless of whether the field is empty or not. This may be
  565. // used to include empty fields in Patch requests.
  566. ForceSendFields []string `json:"-"`
  567. }
  568. func (s *ExportContextSqlExportOptions) MarshalJSON() ([]byte, error) {
  569. type noMethod ExportContextSqlExportOptions
  570. raw := noMethod(*s)
  571. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  572. }
  573. // FailoverContext: Database instance failover context.
  574. type FailoverContext struct {
  575. // Kind: This is always sql#failoverContext.
  576. Kind string `json:"kind,omitempty"`
  577. // SettingsVersion: The current settings version of this instance.
  578. // Request will be rejected if this version doesn't match the current
  579. // settings version.
  580. SettingsVersion int64 `json:"settingsVersion,omitempty,string"`
  581. // ForceSendFields is a list of field names (e.g. "Kind") to
  582. // unconditionally include in API requests. By default, fields with
  583. // empty values are omitted from API requests. However, any non-pointer,
  584. // non-interface field appearing in ForceSendFields will be sent to the
  585. // server regardless of whether the field is empty or not. This may be
  586. // used to include empty fields in Patch requests.
  587. ForceSendFields []string `json:"-"`
  588. }
  589. func (s *FailoverContext) MarshalJSON() ([]byte, error) {
  590. type noMethod FailoverContext
  591. raw := noMethod(*s)
  592. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  593. }
  594. // Flag: A Google Cloud SQL service flag resource.
  595. type Flag struct {
  596. // AllowedStringValues: For STRING flags, a list of strings that the
  597. // value can be set to.
  598. AllowedStringValues []string `json:"allowedStringValues,omitempty"`
  599. // AppliesTo: The database version this flag applies to. Can be
  600. // MYSQL_5_5, MYSQL_5_6, or both.
  601. AppliesTo []string `json:"appliesTo,omitempty"`
  602. // Kind: This is always sql#flag.
  603. Kind string `json:"kind,omitempty"`
  604. // MaxValue: For INTEGER flags, the maximum allowed value.
  605. MaxValue int64 `json:"maxValue,omitempty,string"`
  606. // MinValue: For INTEGER flags, the minimum allowed value.
  607. MinValue int64 `json:"minValue,omitempty,string"`
  608. // Name: This is the name of the flag. Flag names always use
  609. // underscores, not hyphens, e.g. max_allowed_packet
  610. Name string `json:"name,omitempty"`
  611. // RequiresRestart: Indicates whether changing this flag will trigger a
  612. // database restart. Only applicable to Second Generation instances.
  613. RequiresRestart bool `json:"requiresRestart,omitempty"`
  614. // Type: The type of the flag. Flags are typed to being BOOLEAN, STRING,
  615. // INTEGER or NONE. NONE is used for flags which do not take a value,
  616. // such as skip_grant_tables.
  617. Type string `json:"type,omitempty"`
  618. // ForceSendFields is a list of field names (e.g. "AllowedStringValues")
  619. // to unconditionally include in API requests. By default, fields with
  620. // empty values are omitted from API requests. However, any non-pointer,
  621. // non-interface field appearing in ForceSendFields will be sent to the
  622. // server regardless of whether the field is empty or not. This may be
  623. // used to include empty fields in Patch requests.
  624. ForceSendFields []string `json:"-"`
  625. }
  626. func (s *Flag) MarshalJSON() ([]byte, error) {
  627. type noMethod Flag
  628. raw := noMethod(*s)
  629. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  630. }
  631. // FlagsListResponse: Flags list response.
  632. type FlagsListResponse struct {
  633. // Items: List of flags.
  634. Items []*Flag `json:"items,omitempty"`
  635. // Kind: This is always sql#flagsList.
  636. Kind string `json:"kind,omitempty"`
  637. // ServerResponse contains the HTTP response code and headers from the
  638. // server.
  639. googleapi.ServerResponse `json:"-"`
  640. // ForceSendFields is a list of field names (e.g. "Items") to
  641. // unconditionally include in API requests. By default, fields with
  642. // empty values are omitted from API requests. However, any non-pointer,
  643. // non-interface field appearing in ForceSendFields will be sent to the
  644. // server regardless of whether the field is empty or not. This may be
  645. // used to include empty fields in Patch requests.
  646. ForceSendFields []string `json:"-"`
  647. }
  648. func (s *FlagsListResponse) MarshalJSON() ([]byte, error) {
  649. type noMethod FlagsListResponse
  650. raw := noMethod(*s)
  651. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  652. }
  653. // ImportContext: Database instance import context.
  654. type ImportContext struct {
  655. // CsvImportOptions: Options for importing data as CSV.
  656. CsvImportOptions *ImportContextCsvImportOptions `json:"csvImportOptions,omitempty"`
  657. // Database: The database (for example, guestbook) to which the import
  658. // is made. If fileType is SQL and no database is specified, it is
  659. // assumed that the database is specified in the file to be imported. If
  660. // fileType is CSV, it must be specified.
  661. Database string `json:"database,omitempty"`
  662. // FileType: The file type for the specified uri.
  663. // SQL: The file contains SQL statements.
  664. // CSV: The file contains CSV data.
  665. FileType string `json:"fileType,omitempty"`
  666. // Kind: This is always sql#importContext.
  667. Kind string `json:"kind,omitempty"`
  668. // Uri: A path to the file in Google Cloud Storage from which the import
  669. // is made. The URI is in the form gs://bucketName/fileName. Compressed
  670. // gzip files (.gz) are supported when fileType is SQL.
  671. Uri string `json:"uri,omitempty"`
  672. // ForceSendFields is a list of field names (e.g. "CsvImportOptions") to
  673. // unconditionally include in API requests. By default, fields with
  674. // empty values are omitted from API requests. However, any non-pointer,
  675. // non-interface field appearing in ForceSendFields will be sent to the
  676. // server regardless of whether the field is empty or not. This may be
  677. // used to include empty fields in Patch requests.
  678. ForceSendFields []string `json:"-"`
  679. }
  680. func (s *ImportContext) MarshalJSON() ([]byte, error) {
  681. type noMethod ImportContext
  682. raw := noMethod(*s)
  683. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  684. }
  685. // ImportContextCsvImportOptions: Options for importing data as CSV.
  686. type ImportContextCsvImportOptions struct {
  687. // Columns: The columns to which CSV data is imported. If not specified,
  688. // all columns of the database table are loaded with CSV data.
  689. Columns []string `json:"columns,omitempty"`
  690. // Table: The table to which CSV data is imported.
  691. Table string `json:"table,omitempty"`
  692. // ForceSendFields is a list of field names (e.g. "Columns") to
  693. // unconditionally include in API requests. By default, fields with
  694. // empty values are omitted from API requests. However, any non-pointer,
  695. // non-interface field appearing in ForceSendFields will be sent to the
  696. // server regardless of whether the field is empty or not. This may be
  697. // used to include empty fields in Patch requests.
  698. ForceSendFields []string `json:"-"`
  699. }
  700. func (s *ImportContextCsvImportOptions) MarshalJSON() ([]byte, error) {
  701. type noMethod ImportContextCsvImportOptions
  702. raw := noMethod(*s)
  703. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  704. }
  705. // InstancesCloneRequest: Database instance clone request.
  706. type InstancesCloneRequest struct {
  707. // CloneContext: Contains details about the clone operation.
  708. CloneContext *CloneContext `json:"cloneContext,omitempty"`
  709. // ForceSendFields is a list of field names (e.g. "CloneContext") to
  710. // unconditionally include in API requests. By default, fields with
  711. // empty values are omitted from API requests. However, any non-pointer,
  712. // non-interface field appearing in ForceSendFields will be sent to the
  713. // server regardless of whether the field is empty or not. This may be
  714. // used to include empty fields in Patch requests.
  715. ForceSendFields []string `json:"-"`
  716. }
  717. func (s *InstancesCloneRequest) MarshalJSON() ([]byte, error) {
  718. type noMethod InstancesCloneRequest
  719. raw := noMethod(*s)
  720. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  721. }
  722. // InstancesExportRequest: Database instance export request.
  723. type InstancesExportRequest struct {
  724. // ExportContext: Contains details about the export operation.
  725. ExportContext *ExportContext `json:"exportContext,omitempty"`
  726. // ForceSendFields is a list of field names (e.g. "ExportContext") to
  727. // unconditionally include in API requests. By default, fields with
  728. // empty values are omitted from API requests. However, any non-pointer,
  729. // non-interface field appearing in ForceSendFields will be sent to the
  730. // server regardless of whether the field is empty or not. This may be
  731. // used to include empty fields in Patch requests.
  732. ForceSendFields []string `json:"-"`
  733. }
  734. func (s *InstancesExportRequest) MarshalJSON() ([]byte, error) {
  735. type noMethod InstancesExportRequest
  736. raw := noMethod(*s)
  737. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  738. }
  739. // InstancesFailoverRequest: Instance failover request.
  740. type InstancesFailoverRequest struct {
  741. // FailoverContext: Failover Context.
  742. FailoverContext *FailoverContext `json:"failoverContext,omitempty"`
  743. // ForceSendFields is a list of field names (e.g. "FailoverContext") to
  744. // unconditionally include in API requests. By default, fields with
  745. // empty values are omitted from API requests. However, any non-pointer,
  746. // non-interface field appearing in ForceSendFields will be sent to the
  747. // server regardless of whether the field is empty or not. This may be
  748. // used to include empty fields in Patch requests.
  749. ForceSendFields []string `json:"-"`
  750. }
  751. func (s *InstancesFailoverRequest) MarshalJSON() ([]byte, error) {
  752. type noMethod InstancesFailoverRequest
  753. raw := noMethod(*s)
  754. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  755. }
  756. // InstancesImportRequest: Database instance import request.
  757. type InstancesImportRequest struct {
  758. // ImportContext: Contains details about the import operation.
  759. ImportContext *ImportContext `json:"importContext,omitempty"`
  760. // ForceSendFields is a list of field names (e.g. "ImportContext") to
  761. // unconditionally include in API requests. By default, fields with
  762. // empty values are omitted from API requests. However, any non-pointer,
  763. // non-interface field appearing in ForceSendFields will be sent to the
  764. // server regardless of whether the field is empty or not. This may be
  765. // used to include empty fields in Patch requests.
  766. ForceSendFields []string `json:"-"`
  767. }
  768. func (s *InstancesImportRequest) MarshalJSON() ([]byte, error) {
  769. type noMethod InstancesImportRequest
  770. raw := noMethod(*s)
  771. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  772. }
  773. // InstancesListResponse: Database instances list response.
  774. type InstancesListResponse struct {
  775. // Items: List of database instance resources.
  776. Items []*DatabaseInstance `json:"items,omitempty"`
  777. // Kind: This is always sql#instancesList.
  778. Kind string `json:"kind,omitempty"`
  779. // NextPageToken: The continuation token, used to page through large
  780. // result sets. Provide this value in a subsequent request to return the
  781. // next page of results.
  782. NextPageToken string `json:"nextPageToken,omitempty"`
  783. // ServerResponse contains the HTTP response code and headers from the
  784. // server.
  785. googleapi.ServerResponse `json:"-"`
  786. // ForceSendFields is a list of field names (e.g. "Items") to
  787. // unconditionally include in API requests. By default, fields with
  788. // empty values are omitted from API requests. However, any non-pointer,
  789. // non-interface field appearing in ForceSendFields will be sent to the
  790. // server regardless of whether the field is empty or not. This may be
  791. // used to include empty fields in Patch requests.
  792. ForceSendFields []string `json:"-"`
  793. }
  794. func (s *InstancesListResponse) MarshalJSON() ([]byte, error) {
  795. type noMethod InstancesListResponse
  796. raw := noMethod(*s)
  797. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  798. }
  799. // InstancesRestoreBackupRequest: Database instance restore backup
  800. // request.
  801. type InstancesRestoreBackupRequest struct {
  802. // RestoreBackupContext: Parameters required to perform the restore
  803. // backup operation.
  804. RestoreBackupContext *RestoreBackupContext `json:"restoreBackupContext,omitempty"`
  805. // ForceSendFields is a list of field names (e.g.
  806. // "RestoreBackupContext") to unconditionally include in API requests.
  807. // By default, fields with empty values are omitted from API requests.
  808. // However, any non-pointer, non-interface field appearing in
  809. // ForceSendFields will be sent to the server regardless of whether the
  810. // field is empty or not. This may be used to include empty fields in
  811. // Patch requests.
  812. ForceSendFields []string `json:"-"`
  813. }
  814. func (s *InstancesRestoreBackupRequest) MarshalJSON() ([]byte, error) {
  815. type noMethod InstancesRestoreBackupRequest
  816. raw := noMethod(*s)
  817. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  818. }
  819. // IpConfiguration: IP Management configuration.
  820. type IpConfiguration struct {
  821. // AuthorizedNetworks: The list of external networks that are allowed to
  822. // connect to the instance using the IP. In CIDR notation, also known as
  823. // 'slash' notation (e.g. 192.168.100.0/24).
  824. AuthorizedNetworks []*AclEntry `json:"authorizedNetworks,omitempty"`
  825. // Ipv4Enabled: Whether the instance should be assigned an IP address or
  826. // not.
  827. Ipv4Enabled bool `json:"ipv4Enabled,omitempty"`
  828. // RequireSsl: Whether the mysqld should default to 'REQUIRE X509' for
  829. // users connecting over IP.
  830. RequireSsl bool `json:"requireSsl,omitempty"`
  831. // ForceSendFields is a list of field names (e.g. "AuthorizedNetworks")
  832. // to unconditionally include in API requests. By default, fields with
  833. // empty values are omitted from API requests. However, any non-pointer,
  834. // non-interface field appearing in ForceSendFields will be sent to the
  835. // server regardless of whether the field is empty or not. This may be
  836. // used to include empty fields in Patch requests.
  837. ForceSendFields []string `json:"-"`
  838. }
  839. func (s *IpConfiguration) MarshalJSON() ([]byte, error) {
  840. type noMethod IpConfiguration
  841. raw := noMethod(*s)
  842. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  843. }
  844. // IpMapping: Database instance IP Mapping.
  845. type IpMapping struct {
  846. // IpAddress: The IP address assigned.
  847. IpAddress string `json:"ipAddress,omitempty"`
  848. // TimeToRetire: The due time for this IP to be retired in RFC 3339
  849. // format, for example 2012-11-15T16:19:00.094Z. This field is only
  850. // available when the IP is scheduled to be retired.
  851. TimeToRetire string `json:"timeToRetire,omitempty"`
  852. // ForceSendFields is a list of field names (e.g. "IpAddress") to
  853. // unconditionally include in API requests. By default, fields with
  854. // empty values are omitted from API requests. However, any non-pointer,
  855. // non-interface field appearing in ForceSendFields will be sent to the
  856. // server regardless of whether the field is empty or not. This may be
  857. // used to include empty fields in Patch requests.
  858. ForceSendFields []string `json:"-"`
  859. }
  860. func (s *IpMapping) MarshalJSON() ([]byte, error) {
  861. type noMethod IpMapping
  862. raw := noMethod(*s)
  863. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  864. }
  865. // LocationPreference: Preferred location. This specifies where a Cloud
  866. // SQL instance should preferably be located, either in a specific
  867. // Compute Engine zone, or co-located with an App Engine application.
  868. // Note that if the preferred location is not available, the instance
  869. // will be located as close as possible within the region. Only one
  870. // location may be specified.
  871. type LocationPreference struct {
  872. // FollowGaeApplication: The AppEngine application to follow, it must be
  873. // in the same region as the Cloud SQL instance.
  874. FollowGaeApplication string `json:"followGaeApplication,omitempty"`
  875. // Kind: This is always sql#locationPreference.
  876. Kind string `json:"kind,omitempty"`
  877. // Zone: The preferred Compute Engine zone (e.g. us-centra1-a,
  878. // us-central1-b, etc.).
  879. Zone string `json:"zone,omitempty"`
  880. // ForceSendFields is a list of field names (e.g.
  881. // "FollowGaeApplication") to unconditionally include in API requests.
  882. // By default, fields with empty values are omitted from API requests.
  883. // However, any non-pointer, non-interface field appearing in
  884. // ForceSendFields will be sent to the server regardless of whether the
  885. // field is empty or not. This may be used to include empty fields in
  886. // Patch requests.
  887. ForceSendFields []string `json:"-"`
  888. }
  889. func (s *LocationPreference) MarshalJSON() ([]byte, error) {
  890. type noMethod LocationPreference
  891. raw := noMethod(*s)
  892. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  893. }
  894. // MaintenanceWindow: Maintenance window. This specifies when a v2 Cloud
  895. // SQL instance should preferably be restarted for system maintenance
  896. // puruposes.
  897. type MaintenanceWindow struct {
  898. // Day: day of week (1-7), starting on Monday.
  899. Day int64 `json:"day,omitempty"`
  900. // Hour: hour of day - 0 to 23.
  901. Hour int64 `json:"hour,omitempty"`
  902. // Kind: This is always sql#maintenanceWindow.
  903. Kind string `json:"kind,omitempty"`
  904. UpdateTrack string `json:"updateTrack,omitempty"`
  905. // ForceSendFields is a list of field names (e.g. "Day") to
  906. // unconditionally include in API requests. By default, fields with
  907. // empty values are omitted from API requests. However, any non-pointer,
  908. // non-interface field appearing in ForceSendFields will be sent to the
  909. // server regardless of whether the field is empty or not. This may be
  910. // used to include empty fields in Patch requests.
  911. ForceSendFields []string `json:"-"`
  912. }
  913. func (s *MaintenanceWindow) MarshalJSON() ([]byte, error) {
  914. type noMethod MaintenanceWindow
  915. raw := noMethod(*s)
  916. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  917. }
  918. // MySqlReplicaConfiguration: Read-replica configuration specific to
  919. // MySQL databases.
  920. type MySqlReplicaConfiguration struct {
  921. // CaCertificate: PEM representation of the trusted CA's x509
  922. // certificate.
  923. CaCertificate string `json:"caCertificate,omitempty"`
  924. // ClientCertificate: PEM representation of the slave's x509
  925. // certificate.
  926. ClientCertificate string `json:"clientCertificate,omitempty"`
  927. // ClientKey: PEM representation of the slave's private key. The
  928. // corresponsing public key is encoded in the client's certificate.
  929. ClientKey string `json:"clientKey,omitempty"`
  930. // ConnectRetryInterval: Seconds to wait between connect retries.
  931. // MySQL's default is 60 seconds.
  932. ConnectRetryInterval int64 `json:"connectRetryInterval,omitempty"`
  933. // DumpFilePath: Path to a SQL dump file in Google Cloud Storage from
  934. // which the slave instance is to be created. The URI is in the form
  935. // gs://bucketName/fileName. Compressed gzip files (.gz) are also
  936. // supported. Dumps should have the binlog co-ordinates from which
  937. // replication should begin. This can be accomplished by setting
  938. // --master-data to 1 when using mysqldump.
  939. DumpFilePath string `json:"dumpFilePath,omitempty"`
  940. // Kind: This is always sql#mysqlReplicaConfiguration.
  941. Kind string `json:"kind,omitempty"`
  942. // MasterHeartbeatPeriod: Interval in milliseconds between replication
  943. // heartbeats.
  944. MasterHeartbeatPeriod int64 `json:"masterHeartbeatPeriod,omitempty,string"`
  945. // Password: The password for the replication connection.
  946. Password string `json:"password,omitempty"`
  947. // SslCipher: A list of permissible ciphers to use for SSL encryption.
  948. SslCipher string `json:"sslCipher,omitempty"`
  949. // Username: The username for the replication connection.
  950. Username string `json:"username,omitempty"`
  951. // VerifyServerCertificate: Whether or not to check the master's Common
  952. // Name value in the certificate that it sends during the SSL handshake.
  953. VerifyServerCertificate bool `json:"verifyServerCertificate,omitempty"`
  954. // ForceSendFields is a list of field names (e.g. "CaCertificate") to
  955. // unconditionally include in API requests. By default, fields with
  956. // empty values are omitted from API requests. However, any non-pointer,
  957. // non-interface field appearing in ForceSendFields will be sent to the
  958. // server regardless of whether the field is empty or not. This may be
  959. // used to include empty fields in Patch requests.
  960. ForceSendFields []string `json:"-"`
  961. }
  962. func (s *MySqlReplicaConfiguration) MarshalJSON() ([]byte, error) {
  963. type noMethod MySqlReplicaConfiguration
  964. raw := noMethod(*s)
  965. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  966. }
  967. // OnPremisesConfiguration: On-premises instance configuration.
  968. type OnPremisesConfiguration struct {
  969. // HostPort: The host and port of the on-premises instance in host:port
  970. // format
  971. HostPort string `json:"hostPort,omitempty"`
  972. // Kind: This is always sql#onPremisesConfiguration.
  973. Kind string `json:"kind,omitempty"`
  974. // ForceSendFields is a list of field names (e.g. "HostPort") to
  975. // unconditionally include in API requests. By default, fields with
  976. // empty values are omitted from API requests. However, any non-pointer,
  977. // non-interface field appearing in ForceSendFields will be sent to the
  978. // server regardless of whether the field is empty or not. This may be
  979. // used to include empty fields in Patch requests.
  980. ForceSendFields []string `json:"-"`
  981. }
  982. func (s *OnPremisesConfiguration) MarshalJSON() ([]byte, error) {
  983. type noMethod OnPremisesConfiguration
  984. raw := noMethod(*s)
  985. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  986. }
  987. // Operation: An Operations resource contains information about database
  988. // instance operations such as create, delete, and restart. Operations
  989. // resources are created in response to operations that were initiated;
  990. // you never create them directly.
  991. type Operation struct {
  992. // EndTime: The time this operation finished in UTC timezone in RFC 3339
  993. // format, for example 2012-11-15T16:19:00.094Z.
  994. EndTime string `json:"endTime,omitempty"`
  995. // Error: If errors occurred during processing of this operation, this
  996. // field will be populated.
  997. Error *OperationErrors `json:"error,omitempty"`
  998. // ExportContext: The context for export operation, if applicable.
  999. ExportContext *ExportContext `json:"exportContext,omitempty"`
  1000. // ImportContext: The context for import operation, if applicable.
  1001. ImportContext *ImportContext `json:"importContext,omitempty"`
  1002. // InsertTime: The time this operation was enqueued in UTC timezone in
  1003. // RFC 3339 format, for example 2012-11-15T16:19:00.094Z.
  1004. InsertTime string `json:"insertTime,omitempty"`
  1005. // Kind: This is always sql#operation.
  1006. Kind string `json:"kind,omitempty"`
  1007. // Name: An identifier that uniquely identifies the operation. You can
  1008. // use this identifier to retrieve the Operations resource that has
  1009. // information about the operation.
  1010. Name string `json:"name,omitempty"`
  1011. // OperationType: The type of the operation. Valid values are CREATE,
  1012. // DELETE, UPDATE, RESTART, IMPORT, EXPORT, BACKUP_VOLUME,
  1013. // RESTORE_VOLUME, CREATE_USER, DELETE_USER, CREATE_DATABASE,
  1014. // DELETE_DATABASE .
  1015. OperationType string `json:"operationType,omitempty"`
  1016. // SelfLink: The URI of this resource.
  1017. SelfLink string `json:"selfLink,omitempty"`
  1018. // StartTime: The time this operation actually started in UTC timezone
  1019. // in RFC 3339 format, for example 2012-11-15T16:19:00.094Z.
  1020. StartTime string `json:"startTime,omitempty"`
  1021. // Status: The status of an operation. Valid values are PENDING,
  1022. // RUNNING, DONE, UNKNOWN.
  1023. Status string `json:"status,omitempty"`
  1024. // TargetId: Name of the database instance related to this operation.
  1025. TargetId string `json:"targetId,omitempty"`
  1026. // TargetLink: The URI of the instance related to the operation.
  1027. TargetLink string `json:"targetLink,omitempty"`
  1028. // TargetProject: The project ID of the target instance related to this
  1029. // operation.
  1030. TargetProject string `json:"targetProject,omitempty"`
  1031. // User: The email address of the user who initiated this operation.
  1032. User string `json:"user,omitempty"`
  1033. // ServerResponse contains the HTTP response code and headers from the
  1034. // server.
  1035. googleapi.ServerResponse `json:"-"`
  1036. // ForceSendFields is a list of field names (e.g. "EndTime") to
  1037. // unconditionally include in API requests. By default, fields with
  1038. // empty values are omitted from API requests. However, any non-pointer,
  1039. // non-interface field appearing in ForceSendFields will be sent to the
  1040. // server regardless of whether the field is empty or not. This may be
  1041. // used to include empty fields in Patch requests.
  1042. ForceSendFields []string `json:"-"`
  1043. }
  1044. func (s *Operation) MarshalJSON() ([]byte, error) {
  1045. type noMethod Operation
  1046. raw := noMethod(*s)
  1047. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  1048. }
  1049. // OperationError: Database instance operation error.
  1050. type OperationError struct {
  1051. // Code: Identifies the specific error that occurred.
  1052. Code string `json:"code,omitempty"`
  1053. // Kind: This is always sql#operationError.
  1054. Kind string `json:"kind,omitempty"`
  1055. // Message: Additional information about the error encountered.
  1056. Message string `json:"message,omitempty"`
  1057. // ForceSendFields is a list of field names (e.g. "Code") to
  1058. // unconditionally include in API requests. By default, fields with
  1059. // empty values are omitted from API requests. However, any non-pointer,
  1060. // non-interface field appearing in ForceSendFields will be sent to the
  1061. // server regardless of whether the field is empty or not. This may be
  1062. // used to include empty fields in Patch requests.
  1063. ForceSendFields []string `json:"-"`
  1064. }
  1065. func (s *OperationError) MarshalJSON() ([]byte, error) {
  1066. type noMethod OperationError
  1067. raw := noMethod(*s)
  1068. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  1069. }
  1070. // OperationErrors: Database instance operation errors list wrapper.
  1071. type OperationErrors struct {
  1072. // Errors: The list of errors encountered while processing this
  1073. // operation.
  1074. Errors []*OperationError `json:"errors,omitempty"`
  1075. // Kind: This is always sql#operationErrors.
  1076. Kind string `json:"kind,omitempty"`
  1077. // ForceSendFields is a list of field names (e.g. "Errors") to
  1078. // unconditionally include in API requests. By default, fields with
  1079. // empty values are omitted from API requests. However, any non-pointer,
  1080. // non-interface field appearing in ForceSendFields will be sent to the
  1081. // server regardless of whether the field is empty or not. This may be
  1082. // used to include empty fields in Patch requests.
  1083. ForceSendFields []string `json:"-"`
  1084. }
  1085. func (s *OperationErrors) MarshalJSON() ([]byte, error) {
  1086. type noMethod OperationErrors
  1087. raw := noMethod(*s)
  1088. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  1089. }
  1090. // OperationsListResponse: Database instance list operations response.
  1091. type OperationsListResponse struct {
  1092. // Items: List of operation resources.
  1093. Items []*Operation `json:"items,omitempty"`
  1094. // Kind: This is always sql#operationsList.
  1095. Kind string `json:"kind,omitempty"`
  1096. // NextPageToken: The continuation token, used to page through large
  1097. // result sets. Provide this value in a subsequent request to return the
  1098. // next page of results.
  1099. NextPageToken string `json:"nextPageToken,omitempty"`
  1100. // ServerResponse contains the HTTP response code and headers from the
  1101. // server.
  1102. googleapi.ServerResponse `json:"-"`
  1103. // ForceSendFields is a list of field names (e.g. "Items") to
  1104. // unconditionally include in API requests. By default, fields with
  1105. // empty values are omitted from API requests. However, any non-pointer,
  1106. // non-interface field appearing in ForceSendFields will be sent to the
  1107. // server regardless of whether the field is empty or not. This may be
  1108. // used to include empty fields in Patch requests.
  1109. ForceSendFields []string `json:"-"`
  1110. }
  1111. func (s *OperationsListResponse) MarshalJSON() ([]byte, error) {
  1112. type noMethod OperationsListResponse
  1113. raw := noMethod(*s)
  1114. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  1115. }
  1116. // ReplicaConfiguration: Read-replica configuration for connecting to
  1117. // the master.
  1118. type ReplicaConfiguration struct {
  1119. // FailoverTarget: Specifies if the replica is the failover target. If
  1120. // the field is set to true the replica will be designated as a failover
  1121. // replica. In case the master instance fails, the replica instance will
  1122. // be promoted as the new master instance.
  1123. // Only one replica can be specified as failover target, and the replica
  1124. // has to be in different zone with the master instance.
  1125. FailoverTarget bool `json:"failoverTarget,omitempty"`
  1126. // Kind: This is always sql#replicaConfiguration.
  1127. Kind string `json:"kind,omitempty"`
  1128. // MysqlReplicaConfiguration: MySQL specific configuration when
  1129. // replicating from a MySQL on-premises master. Replication
  1130. // configuration information such as the username, password,
  1131. // certificates, and keys are not stored in the instance metadata. The
  1132. // configuration information is used only to set up the replication
  1133. // connection and is stored by MySQL in a file named master.info in the
  1134. // data directory.
  1135. MysqlReplicaConfiguration *MySqlReplicaConfiguration `json:"mysqlReplicaConfiguration,omitempty"`
  1136. // ForceSendFields is a list of field names (e.g. "FailoverTarget") to
  1137. // unconditionally include in API requests. By default, fields with
  1138. // empty values are omitted from API requests. However, any non-pointer,
  1139. // non-interface field appearing in ForceSendFields will be sent to the
  1140. // server regardless of whether the field is empty or not. This may be
  1141. // used to include empty fields in Patch requests.
  1142. ForceSendFields []string `json:"-"`
  1143. }
  1144. func (s *ReplicaConfiguration) MarshalJSON() ([]byte, error) {
  1145. type noMethod ReplicaConfiguration
  1146. raw := noMethod(*s)
  1147. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  1148. }
  1149. // RestoreBackupContext: Database instance restore from backup context.
  1150. type RestoreBackupContext struct {
  1151. // BackupRunId: The ID of the backup run to restore from.
  1152. BackupRunId int64 `json:"backupRunId,omitempty,string"`
  1153. // InstanceId: The ID of the instance that the backup was taken from.
  1154. InstanceId string `json:"instanceId,omitempty"`
  1155. // Kind: This is always sql#restoreBackupContext.
  1156. Kind string `json:"kind,omitempty"`
  1157. // ForceSendFields is a list of field names (e.g. "BackupRunId") to
  1158. // unconditionally include in API requests. By default, fields with
  1159. // empty values are omitted from API requests. However, any non-pointer,
  1160. // non-interface field appearing in ForceSendFields will be sent to the
  1161. // server regardless of whether the field is empty or not. This may be
  1162. // used to include empty fields in Patch requests.
  1163. ForceSendFields []string `json:"-"`
  1164. }
  1165. func (s *RestoreBackupContext) MarshalJSON() ([]byte, error) {
  1166. type noMethod RestoreBackupContext
  1167. raw := noMethod(*s)
  1168. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  1169. }
  1170. // Settings: Database instance settings.
  1171. type Settings struct {
  1172. // ActivationPolicy: The activation policy for this instance. This
  1173. // specifies when the instance should be activated and is applicable
  1174. // only when the instance state is RUNNABLE. This can be one of the
  1175. // following.
  1176. // ALWAYS: The instance should always be active.
  1177. // NEVER: The instance should never be activated.
  1178. // ON_DEMAND: The instance is activated upon receiving requests.
  1179. ActivationPolicy string `json:"activationPolicy,omitempty"`
  1180. // AuthorizedGaeApplications: The App Engine app IDs that can access
  1181. // this instance.
  1182. AuthorizedGaeApplications []string `json:"authorizedGaeApplications,omitempty"`
  1183. // BackupConfiguration: The daily backup configuration for the instance.
  1184. BackupConfiguration *BackupConfiguration `json:"backupConfiguration,omitempty"`
  1185. // CrashSafeReplicationEnabled: Configuration specific to read replica
  1186. // instances. Indicates whether database flags for crash-safe
  1187. // replication are enabled.
  1188. CrashSafeReplicationEnabled bool `json:"crashSafeReplicationEnabled,omitempty"`
  1189. // DataDiskSizeGb: The size of data disk, in GB. Only supported for 2nd
  1190. // Generation instances. The data disk size minimum is 10GB.
  1191. DataDiskSizeGb int64 `json:"dataDiskSizeGb,omitempty,string"`
  1192. // DataDiskType: The type of data disk. Only supported for 2nd
  1193. // Generation instances. The default type is SSD.
  1194. DataDiskType string `json:"dataDiskType,omitempty"`
  1195. // DatabaseFlags: The database flags passed to the instance at startup.
  1196. DatabaseFlags []*DatabaseFlags `json:"databaseFlags,omitempty"`
  1197. // DatabaseReplicationEnabled: Configuration specific to read replica
  1198. // instances. Indicates whether replication is enabled or not.
  1199. DatabaseReplicationEnabled bool `json:"databaseReplicationEnabled,omitempty"`
  1200. // IpConfiguration: The settings for IP Management. This allows to
  1201. // enable or disable the instance IP and manage which external networks
  1202. // can connect to the instance.
  1203. IpConfiguration *IpConfiguration `json:"ipConfiguration,omitempty"`
  1204. // Kind: This is always sql#settings.
  1205. Kind string `json:"kind,omitempty"`
  1206. // LocationPreference: The location preference settings. This allows the
  1207. // instance to be located as near as possible to either an App Engine
  1208. // app or GCE zone for better performance.
  1209. LocationPreference *LocationPreference `json:"locationPreference,omitempty"`
  1210. // MaintenanceWindow: The maintenance window for this instance. This
  1211. // specifies when the instance may be restarted for maintenance
  1212. // purposes.
  1213. MaintenanceWindow *MaintenanceWindow `json:"maintenanceWindow,omitempty"`
  1214. // PricingPlan: The pricing plan for this instance. This can be either
  1215. // PER_USE or PACKAGE.
  1216. PricingPlan string `json:"pricingPlan,omitempty"`
  1217. // ReplicationType: The type of replication this instance uses. This can
  1218. // be either ASYNCHRONOUS or SYNCHRONOUS.
  1219. ReplicationType string `json:"replicationType,omitempty"`
  1220. // SettingsVersion: The version of instance settings. This is a required
  1221. // field for update method to make sure concurrent updates are handled
  1222. // properly. During update, use the most recent settingsVersion value
  1223. // for this instance and do not try to update this value.
  1224. SettingsVersion int64 `json:"settingsVersion,omitempty,string"`
  1225. // Tier: The tier of service for this instance, for example D1, D2. For
  1226. // more information, see pricing.
  1227. Tier string `json:"tier,omitempty"`
  1228. // ForceSendFields is a list of field names (e.g. "ActivationPolicy") to
  1229. // unconditionally include in API requests. By default, fields with
  1230. // empty values are omitted from API requests. However, any non-pointer,
  1231. // non-interface field appearing in ForceSendFields will be sent to the
  1232. // server regardless of whether the field is empty or not. This may be
  1233. // used to include empty fields in Patch requests.
  1234. ForceSendFields []string `json:"-"`
  1235. }
  1236. func (s *Settings) MarshalJSON() ([]byte, error) {
  1237. type noMethod Settings
  1238. raw := noMethod(*s)
  1239. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  1240. }
  1241. // SslCert: SslCerts Resource
  1242. type SslCert struct {
  1243. // Cert: PEM representation.
  1244. Cert string `json:"cert,omitempty"`
  1245. // CertSerialNumber: Serial number, as extracted from the certificate.
  1246. CertSerialNumber string `json:"certSerialNumber,omitempty"`
  1247. // CommonName: User supplied name. Constrained to [a-zA-Z.-_ ]+.
  1248. CommonName string `json:"commonName,omitempty"`
  1249. // CreateTime: The time when the certificate was created in RFC 3339
  1250. // format, for example 2012-11-15T16:19:00.094Z
  1251. CreateTime string `json:"createTime,omitempty"`
  1252. // ExpirationTime: The time when the certificate expires in RFC 3339
  1253. // format, for example 2012-11-15T16:19:00.094Z.
  1254. ExpirationTime string `json:"expirationTime,omitempty"`
  1255. // Instance: Name of the database instance.
  1256. Instance string `json:"instance,omitempty"`
  1257. // Kind: This is always sql#sslCert.
  1258. Kind string `json:"kind,omitempty"`
  1259. // SelfLink: The URI of this resource.
  1260. SelfLink string `json:"selfLink,omitempty"`
  1261. // Sha1Fingerprint: Sha1 Fingerprint.
  1262. Sha1Fingerprint string `json:"sha1Fingerprint,omitempty"`
  1263. // ServerResponse contains the HTTP response code and headers from the
  1264. // server.
  1265. googleapi.ServerResponse `json:"-"`
  1266. // ForceSendFields is a list of field names (e.g. "Cert") to
  1267. // unconditionally include in API requests. By default, fields with
  1268. // empty values are omitted from API requests. However, any non-pointer,
  1269. // non-interface field appearing in ForceSendFields will be sent to the
  1270. // server regardless of whether the field is empty or not. This may be
  1271. // used to include empty fields in Patch requests.
  1272. ForceSendFields []string `json:"-"`
  1273. }
  1274. func (s *SslCert) MarshalJSON() ([]byte, error) {
  1275. type noMethod SslCert
  1276. raw := noMethod(*s)
  1277. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  1278. }
  1279. // SslCertDetail: SslCertDetail.
  1280. type SslCertDetail struct {
  1281. // CertInfo: The public information about the cert.
  1282. CertInfo *SslCert `json:"certInfo,omitempty"`
  1283. // CertPrivateKey: The private key for the client cert, in pem format.
  1284. // Keep private in order to protect your security.
  1285. CertPrivateKey string `json:"certPrivateKey,omitempty"`
  1286. // ForceSendFields is a list of field names (e.g. "CertInfo") to
  1287. // unconditionally include in API requests. By default, fields with
  1288. // empty values are omitted from API requests. However, any non-pointer,
  1289. // non-interface field appearing in ForceSendFields will be sent to the
  1290. // server regardless of whether the field is empty or not. This may be
  1291. // used to include empty fields in Patch requests.
  1292. ForceSendFields []string `json:"-"`
  1293. }
  1294. func (s *SslCertDetail) MarshalJSON() ([]byte, error) {
  1295. type noMethod SslCertDetail
  1296. raw := noMethod(*s)
  1297. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  1298. }
  1299. // SslCertsCreateEphemeralRequest: SslCerts create ephemeral certificate
  1300. // request.
  1301. type SslCertsCreateEphemeralRequest struct {
  1302. // PublicKey: PEM encoded public key to include in the signed
  1303. // certificate.
  1304. PublicKey string `json:"public_key,omitempty"`
  1305. // ForceSendFields is a list of field names (e.g. "PublicKey") to
  1306. // unconditionally include in API requests. By default, fields with
  1307. // empty values are omitted from API requests. However, any non-pointer,
  1308. // non-interface field appearing in ForceSendFields will be sent to the
  1309. // server regardless of whether the field is empty or not. This may be
  1310. // used to include empty fields in Patch requests.
  1311. ForceSendFields []string `json:"-"`
  1312. }
  1313. func (s *SslCertsCreateEphemeralRequest) MarshalJSON() ([]byte, error) {
  1314. type noMethod SslCertsCreateEphemeralRequest
  1315. raw := noMethod(*s)
  1316. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  1317. }
  1318. // SslCertsInsertRequest: SslCerts insert request.
  1319. type SslCertsInsertRequest struct {
  1320. // CommonName: User supplied name. Must be a distinct name from the
  1321. // other certificates for this instance. New certificates will not be
  1322. // usable until the instance is restarted.
  1323. CommonName string `json:"commonName,omitempty"`
  1324. // ForceSendFields is a list of field names (e.g. "CommonName") to
  1325. // unconditionally include in API requests. By default, fields with
  1326. // empty values are omitted from API requests. However, any non-pointer,
  1327. // non-interface field appearing in ForceSendFields will be sent to the
  1328. // server regardless of whether the field is empty or not. This may be
  1329. // used to include empty fields in Patch requests.
  1330. ForceSendFields []string `json:"-"`
  1331. }
  1332. func (s *SslCertsInsertRequest) MarshalJSON() ([]byte, error) {
  1333. type noMethod SslCertsInsertRequest
  1334. raw := noMethod(*s)
  1335. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  1336. }
  1337. // SslCertsInsertResponse: SslCert insert response.
  1338. type SslCertsInsertResponse struct {
  1339. // ClientCert: The new client certificate and private key. The new
  1340. // certificate will not work until the instance is restarted.
  1341. ClientCert *SslCertDetail `json:"clientCert,omitempty"`
  1342. // Kind: This is always sql#sslCertsInsert.
  1343. Kind string `json:"kind,omitempty"`
  1344. // ServerCaCert: The server Certificate Authority's certificate. If this
  1345. // is missing you can force a new one to be generated by calling
  1346. // resetSslConfig method on instances resource.
  1347. ServerCaCert *SslCert `json:"serverCaCert,omitempty"`
  1348. // ServerResponse contains the HTTP response code and headers from the
  1349. // server.
  1350. googleapi.ServerResponse `json:"-"`
  1351. // ForceSendFields is a list of field names (e.g. "ClientCert") to
  1352. // unconditionally include in API requests. By default, fields with
  1353. // empty values are omitted from API requests. However, any non-pointer,
  1354. // non-interface field appearing in ForceSendFields will be sent to the
  1355. // server regardless of whether the field is empty or not. This may be
  1356. // used to include empty fields in Patch requests.
  1357. ForceSendFields []string `json:"-"`
  1358. }
  1359. func (s *SslCertsInsertResponse) MarshalJSON() ([]byte, error) {
  1360. type noMethod SslCertsInsertResponse
  1361. raw := noMethod(*s)
  1362. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  1363. }
  1364. // SslCertsListResponse: SslCerts list response.
  1365. type SslCertsListResponse struct {
  1366. // Items: List of client certificates for the instance.
  1367. Items []*SslCert `json:"items,omitempty"`
  1368. // Kind: This is always sql#sslCertsList.
  1369. Kind string `json:"kind,omitempty"`
  1370. // ServerResponse contains the HTTP response code and headers from the
  1371. // server.
  1372. googleapi.ServerResponse `json:"-"`
  1373. // ForceSendFields is a list of field names (e.g. "Items") to
  1374. // unconditionally include in API requests. By default, fields with
  1375. // empty values are omitted from API requests. However, any non-pointer,
  1376. // non-interface field appearing in ForceSendFields will be sent to the
  1377. // server regardless of whether the field is empty or not. This may be
  1378. // used to include empty fields in Patch requests.
  1379. ForceSendFields []string `json:"-"`
  1380. }
  1381. func (s *SslCertsListResponse) MarshalJSON() ([]byte, error) {
  1382. type noMethod SslCertsListResponse
  1383. raw := noMethod(*s)
  1384. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  1385. }
  1386. // Tier: A Google Cloud SQL service tier resource.
  1387. type Tier struct {
  1388. // DiskQuota: The maximum disk size of this tier in bytes.
  1389. DiskQuota int64 `json:"DiskQuota,omitempty,string"`
  1390. // RAM: The maximum RAM usage of this tier in bytes.
  1391. RAM int64 `json:"RAM,omitempty,string"`
  1392. // Kind: This is always sql#tier.
  1393. Kind string `json:"kind,omitempty"`
  1394. // Region: The applicable regions for this tier. Can be us-east1,
  1395. // europe-west1 or asia-east1.
  1396. Region []string `json:"region,omitempty"`
  1397. // Tier: An identifier for the service tier, for example D1, D2 etc. For
  1398. // related information, see Pricing.
  1399. Tier string `json:"tier,omitempty"`
  1400. // ForceSendFields is a list of field names (e.g. "DiskQuota") to
  1401. // unconditionally include in API requests. By default, fields with
  1402. // empty values are omitted from API requests. However, any non-pointer,
  1403. // non-interface field appearing in ForceSendFields will be sent to the
  1404. // server regardless of whether the field is empty or not. This may be
  1405. // used to include empty fields in Patch requests.
  1406. ForceSendFields []string `json:"-"`
  1407. }
  1408. func (s *Tier) MarshalJSON() ([]byte, error) {
  1409. type noMethod Tier
  1410. raw := noMethod(*s)
  1411. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  1412. }
  1413. // TiersListResponse: Tiers list response.
  1414. type TiersListResponse struct {
  1415. // Items: List of tiers.
  1416. Items []*Tier `json:"items,omitempty"`
  1417. // Kind: This is always sql#tiersList.
  1418. Kind string `json:"kind,omitempty"`
  1419. // ServerResponse contains the HTTP response code and headers from the
  1420. // server.
  1421. googleapi.ServerResponse `json:"-"`
  1422. // ForceSendFields is a list of field names (e.g. "Items") to
  1423. // unconditionally include in API requests. By default, fields with
  1424. // empty values are omitted from API requests. However, any non-pointer,
  1425. // non-interface field appearing in ForceSendFields will be sent to the
  1426. // server regardless of whether the field is empty or not. This may be
  1427. // used to include empty fields in Patch requests.
  1428. ForceSendFields []string `json:"-"`
  1429. }
  1430. func (s *TiersListResponse) MarshalJSON() ([]byte, error) {
  1431. type noMethod TiersListResponse
  1432. raw := noMethod(*s)
  1433. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  1434. }
  1435. // User: A Cloud SQL user resource.
  1436. type User struct {
  1437. // Etag: HTTP 1.1 Entity tag for the resource.
  1438. Etag string `json:"etag,omitempty"`
  1439. // Host: The host name from which the user can connect. For insert
  1440. // operations, host defaults to an empty string. For update operations,
  1441. // host is specified as part of the request URL. The host name is not
  1442. // mutable with this API.
  1443. Host string `json:"host,omitempty"`
  1444. // Instance: The name of the Cloud SQL instance. This does not include
  1445. // the project ID. Can be omitted for update since it is already
  1446. // specified on the URL.
  1447. Instance string `json:"instance,omitempty"`
  1448. // Kind: This is always sql#user.
  1449. Kind string `json:"kind,omitempty"`
  1450. // Name: The name of the user in the Cloud SQL instance. Can be omitted
  1451. // for update since it is already specified on the URL.
  1452. Name string `json:"name,omitempty"`
  1453. // Password: The password for the user.
  1454. Password string `json:"password,omitempty"`
  1455. // Project: The project ID of the project containing the Cloud SQL
  1456. // database. The Google apps domain is prefixed if applicable. Can be
  1457. // omitted for update since it is already specified on the URL.
  1458. Project string `json:"project,omitempty"`
  1459. // ForceSendFields is a list of field names (e.g. "Etag") to
  1460. // unconditionally include in API requests. By default, fields with
  1461. // empty values are omitted from API requests. However, any non-pointer,
  1462. // non-interface field appearing in ForceSendFields will be sent to the
  1463. // server regardless of whether the field is empty or not. This may be
  1464. // used to include empty fields in Patch requests.
  1465. ForceSendFields []string `json:"-"`
  1466. }
  1467. func (s *User) MarshalJSON() ([]byte, error) {
  1468. type noMethod User
  1469. raw := noMethod(*s)
  1470. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  1471. }
  1472. // UsersListResponse: User list response.
  1473. type UsersListResponse struct {
  1474. // Items: List of user resources in the instance.
  1475. Items []*User `json:"items,omitempty"`
  1476. // Kind: This is always sql#usersList.
  1477. Kind string `json:"kind,omitempty"`
  1478. // NextPageToken: An identifier that uniquely identifies the operation.
  1479. // You can use this identifier to retrieve the Operations resource that
  1480. // has information about the operation.
  1481. NextPageToken string `json:"nextPageToken,omitempty"`
  1482. // ServerResponse contains the HTTP response code and headers from the
  1483. // server.
  1484. googleapi.ServerResponse `json:"-"`
  1485. // ForceSendFields is a list of field names (e.g. "Items") to
  1486. // unconditionally include in API requests. By default, fields with
  1487. // empty values are omitted from API requests. However, any non-pointer,
  1488. // non-interface field appearing in ForceSendFields will be sent to the
  1489. // server regardless of whether the field is empty or not. This may be
  1490. // used to include empty fields in Patch requests.
  1491. ForceSendFields []string `json:"-"`
  1492. }
  1493. func (s *UsersListResponse) MarshalJSON() ([]byte, error) {
  1494. type noMethod UsersListResponse
  1495. raw := noMethod(*s)
  1496. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  1497. }
  1498. // method id "sql.backupRuns.delete":
  1499. type BackupRunsDeleteCall struct {
  1500. s *Service
  1501. project string
  1502. instance string
  1503. id int64
  1504. urlParams_ gensupport.URLParams
  1505. ctx_ context.Context
  1506. }
  1507. // Delete: Deletes the backup taken by a backup run.
  1508. func (r *BackupRunsService) Delete(project string, instance string, id int64) *BackupRunsDeleteCall {
  1509. c := &BackupRunsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1510. c.project = project
  1511. c.instance = instance
  1512. c.id = id
  1513. return c
  1514. }
  1515. // Fields allows partial responses to be retrieved. See
  1516. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1517. // for more information.
  1518. func (c *BackupRunsDeleteCall) Fields(s ...googleapi.Field) *BackupRunsDeleteCall {
  1519. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1520. return c
  1521. }
  1522. // Context sets the context to be used in this call's Do method. Any
  1523. // pending HTTP request will be aborted if the provided context is
  1524. // canceled.
  1525. func (c *BackupRunsDeleteCall) Context(ctx context.Context) *BackupRunsDeleteCall {
  1526. c.ctx_ = ctx
  1527. return c
  1528. }
  1529. func (c *BackupRunsDeleteCall) doRequest(alt string) (*http.Response, error) {
  1530. var body io.Reader = nil
  1531. c.urlParams_.Set("alt", alt)
  1532. urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/instances/{instance}/backupRuns/{id}")
  1533. urls += "?" + c.urlParams_.Encode()
  1534. req, _ := http.NewRequest("DELETE", urls, body)
  1535. googleapi.Expand(req.URL, map[string]string{
  1536. "project": c.project,
  1537. "instance": c.instance,
  1538. "id": strconv.FormatInt(c.id, 10),
  1539. })
  1540. req.Header.Set("User-Agent", c.s.userAgent())
  1541. if c.ctx_ != nil {
  1542. return ctxhttp.Do(c.ctx_, c.s.client, req)
  1543. }
  1544. return c.s.client.Do(req)
  1545. }
  1546. // Do executes the "sql.backupRuns.delete" call.
  1547. // Exactly one of *Operation or error will be non-nil. Any non-2xx
  1548. // status code is an error. Response headers are in either
  1549. // *Operation.ServerResponse.Header or (if a response was returned at
  1550. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  1551. // to check whether the returned error was because
  1552. // http.StatusNotModified was returned.
  1553. func (c *BackupRunsDeleteCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  1554. gensupport.SetOptions(c.urlParams_, opts...)
  1555. res, err := c.doRequest("json")
  1556. if res != nil && res.StatusCode == http.StatusNotModified {
  1557. if res.Body != nil {
  1558. res.Body.Close()
  1559. }
  1560. return nil, &googleapi.Error{
  1561. Code: res.StatusCode,
  1562. Header: res.Header,
  1563. }
  1564. }
  1565. if err != nil {
  1566. return nil, err
  1567. }
  1568. defer googleapi.CloseBody(res)
  1569. if err := googleapi.CheckResponse(res); err != nil {
  1570. return nil, err
  1571. }
  1572. ret := &Operation{
  1573. ServerResponse: googleapi.ServerResponse{
  1574. Header: res.Header,
  1575. HTTPStatusCode: res.StatusCode,
  1576. },
  1577. }
  1578. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  1579. return nil, err
  1580. }
  1581. return ret, nil
  1582. // {
  1583. // "description": "Deletes the backup taken by a backup run.",
  1584. // "httpMethod": "DELETE",
  1585. // "id": "sql.backupRuns.delete",
  1586. // "parameterOrder": [
  1587. // "project",
  1588. // "instance",
  1589. // "id"
  1590. // ],
  1591. // "parameters": {
  1592. // "id": {
  1593. // "description": "The ID of the Backup Run to delete. To find a Backup Run ID, use the list method.",
  1594. // "format": "int64",
  1595. // "location": "path",
  1596. // "required": true,
  1597. // "type": "string"
  1598. // },
  1599. // "instance": {
  1600. // "description": "Cloud SQL instance ID. This does not include the project ID.",
  1601. // "location": "path",
  1602. // "required": true,
  1603. // "type": "string"
  1604. // },
  1605. // "project": {
  1606. // "description": "Project ID of the project that contains the instance.",
  1607. // "location": "path",
  1608. // "required": true,
  1609. // "type": "string"
  1610. // }
  1611. // },
  1612. // "path": "projects/{project}/instances/{instance}/backupRuns/{id}",
  1613. // "response": {
  1614. // "$ref": "Operation"
  1615. // },
  1616. // "scopes": [
  1617. // "https://www.googleapis.com/auth/cloud-platform",
  1618. // "https://www.googleapis.com/auth/sqlservice.admin"
  1619. // ]
  1620. // }
  1621. }
  1622. // method id "sql.backupRuns.get":
  1623. type BackupRunsGetCall struct {
  1624. s *Service
  1625. project string
  1626. instance string
  1627. id int64
  1628. urlParams_ gensupport.URLParams
  1629. ifNoneMatch_ string
  1630. ctx_ context.Context
  1631. }
  1632. // Get: Retrieves a resource containing information about a backup run.
  1633. func (r *BackupRunsService) Get(project string, instance string, id int64) *BackupRunsGetCall {
  1634. c := &BackupRunsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1635. c.project = project
  1636. c.instance = instance
  1637. c.id = id
  1638. return c
  1639. }
  1640. // Fields allows partial responses to be retrieved. See
  1641. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1642. // for more information.
  1643. func (c *BackupRunsGetCall) Fields(s ...googleapi.Field) *BackupRunsGetCall {
  1644. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1645. return c
  1646. }
  1647. // IfNoneMatch sets the optional parameter which makes the operation
  1648. // fail if the object's ETag matches the given value. This is useful for
  1649. // getting updates only after the object has changed since the last
  1650. // request. Use googleapi.IsNotModified to check whether the response
  1651. // error from Do is the result of In-None-Match.
  1652. func (c *BackupRunsGetCall) IfNoneMatch(entityTag string) *BackupRunsGetCall {
  1653. c.ifNoneMatch_ = entityTag
  1654. return c
  1655. }
  1656. // Context sets the context to be used in this call's Do method. Any
  1657. // pending HTTP request will be aborted if the provided context is
  1658. // canceled.
  1659. func (c *BackupRunsGetCall) Context(ctx context.Context) *BackupRunsGetCall {
  1660. c.ctx_ = ctx
  1661. return c
  1662. }
  1663. func (c *BackupRunsGetCall) doRequest(alt string) (*http.Response, error) {
  1664. var body io.Reader = nil
  1665. c.urlParams_.Set("alt", alt)
  1666. urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/instances/{instance}/backupRuns/{id}")
  1667. urls += "?" + c.urlParams_.Encode()
  1668. req, _ := http.NewRequest("GET", urls, body)
  1669. googleapi.Expand(req.URL, map[string]string{
  1670. "project": c.project,
  1671. "instance": c.instance,
  1672. "id": strconv.FormatInt(c.id, 10),
  1673. })
  1674. req.Header.Set("User-Agent", c.s.userAgent())
  1675. if c.ifNoneMatch_ != "" {
  1676. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  1677. }
  1678. if c.ctx_ != nil {
  1679. return ctxhttp.Do(c.ctx_, c.s.client, req)
  1680. }
  1681. return c.s.client.Do(req)
  1682. }
  1683. // Do executes the "sql.backupRuns.get" call.
  1684. // Exactly one of *BackupRun or error will be non-nil. Any non-2xx
  1685. // status code is an error. Response headers are in either
  1686. // *BackupRun.ServerResponse.Header or (if a response was returned at
  1687. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  1688. // to check whether the returned error was because
  1689. // http.StatusNotModified was returned.
  1690. func (c *BackupRunsGetCall) Do(opts ...googleapi.CallOption) (*BackupRun, error) {
  1691. gensupport.SetOptions(c.urlParams_, opts...)
  1692. res, err := c.doRequest("json")
  1693. if res != nil && res.StatusCode == http.StatusNotModified {
  1694. if res.Body != nil {
  1695. res.Body.Close()
  1696. }
  1697. return nil, &googleapi.Error{
  1698. Code: res.StatusCode,
  1699. Header: res.Header,
  1700. }
  1701. }
  1702. if err != nil {
  1703. return nil, err
  1704. }
  1705. defer googleapi.CloseBody(res)
  1706. if err := googleapi.CheckResponse(res); err != nil {
  1707. return nil, err
  1708. }
  1709. ret := &BackupRun{
  1710. ServerResponse: googleapi.ServerResponse{
  1711. Header: res.Header,
  1712. HTTPStatusCode: res.StatusCode,
  1713. },
  1714. }
  1715. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  1716. return nil, err
  1717. }
  1718. return ret, nil
  1719. // {
  1720. // "description": "Retrieves a resource containing information about a backup run.",
  1721. // "httpMethod": "GET",
  1722. // "id": "sql.backupRuns.get",
  1723. // "parameterOrder": [
  1724. // "project",
  1725. // "instance",
  1726. // "id"
  1727. // ],
  1728. // "parameters": {
  1729. // "id": {
  1730. // "description": "The ID of this Backup Run.",
  1731. // "format": "int64",
  1732. // "location": "path",
  1733. // "required": true,
  1734. // "type": "string"
  1735. // },
  1736. // "instance": {
  1737. // "description": "Cloud SQL instance ID. This does not include the project ID.",
  1738. // "location": "path",
  1739. // "required": true,
  1740. // "type": "string"
  1741. // },
  1742. // "project": {
  1743. // "description": "Project ID of the project that contains the instance.",
  1744. // "location": "path",
  1745. // "required": true,
  1746. // "type": "string"
  1747. // }
  1748. // },
  1749. // "path": "projects/{project}/instances/{instance}/backupRuns/{id}",
  1750. // "response": {
  1751. // "$ref": "BackupRun"
  1752. // },
  1753. // "scopes": [
  1754. // "https://www.googleapis.com/auth/cloud-platform",
  1755. // "https://www.googleapis.com/auth/sqlservice.admin"
  1756. // ]
  1757. // }
  1758. }
  1759. // method id "sql.backupRuns.list":
  1760. type BackupRunsListCall struct {
  1761. s *Service
  1762. project string
  1763. instance string
  1764. urlParams_ gensupport.URLParams
  1765. ifNoneMatch_ string
  1766. ctx_ context.Context
  1767. }
  1768. // List: Lists all backup runs associated with a given instance and
  1769. // configuration in the reverse chronological order of the enqueued
  1770. // time.
  1771. func (r *BackupRunsService) List(project string, instance string) *BackupRunsListCall {
  1772. c := &BackupRunsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1773. c.project = project
  1774. c.instance = instance
  1775. return c
  1776. }
  1777. // MaxResults sets the optional parameter "maxResults": Maximum number
  1778. // of backup runs per response.
  1779. func (c *BackupRunsListCall) MaxResults(maxResults int64) *BackupRunsListCall {
  1780. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  1781. return c
  1782. }
  1783. // PageToken sets the optional parameter "pageToken": A
  1784. // previously-returned page token representing part of the larger set of
  1785. // results to view.
  1786. func (c *BackupRunsListCall) PageToken(pageToken string) *BackupRunsListCall {
  1787. c.urlParams_.Set("pageToken", pageToken)
  1788. return c
  1789. }
  1790. // Fields allows partial responses to be retrieved. See
  1791. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1792. // for more information.
  1793. func (c *BackupRunsListCall) Fields(s ...googleapi.Field) *BackupRunsListCall {
  1794. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1795. return c
  1796. }
  1797. // IfNoneMatch sets the optional parameter which makes the operation
  1798. // fail if the object's ETag matches the given value. This is useful for
  1799. // getting updates only after the object has changed since the last
  1800. // request. Use googleapi.IsNotModified to check whether the response
  1801. // error from Do is the result of In-None-Match.
  1802. func (c *BackupRunsListCall) IfNoneMatch(entityTag string) *BackupRunsListCall {
  1803. c.ifNoneMatch_ = entityTag
  1804. return c
  1805. }
  1806. // Context sets the context to be used in this call's Do method. Any
  1807. // pending HTTP request will be aborted if the provided context is
  1808. // canceled.
  1809. func (c *BackupRunsListCall) Context(ctx context.Context) *BackupRunsListCall {
  1810. c.ctx_ = ctx
  1811. return c
  1812. }
  1813. func (c *BackupRunsListCall) doRequest(alt string) (*http.Response, error) {
  1814. var body io.Reader = nil
  1815. c.urlParams_.Set("alt", alt)
  1816. urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/instances/{instance}/backupRuns")
  1817. urls += "?" + c.urlParams_.Encode()
  1818. req, _ := http.NewRequest("GET", urls, body)
  1819. googleapi.Expand(req.URL, map[string]string{
  1820. "project": c.project,
  1821. "instance": c.instance,
  1822. })
  1823. req.Header.Set("User-Agent", c.s.userAgent())
  1824. if c.ifNoneMatch_ != "" {
  1825. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  1826. }
  1827. if c.ctx_ != nil {
  1828. return ctxhttp.Do(c.ctx_, c.s.client, req)
  1829. }
  1830. return c.s.client.Do(req)
  1831. }
  1832. // Do executes the "sql.backupRuns.list" call.
  1833. // Exactly one of *BackupRunsListResponse or error will be non-nil. Any
  1834. // non-2xx status code is an error. Response headers are in either
  1835. // *BackupRunsListResponse.ServerResponse.Header or (if a response was
  1836. // returned at all) in error.(*googleapi.Error).Header. Use
  1837. // googleapi.IsNotModified to check whether the returned error was
  1838. // because http.StatusNotModified was returned.
  1839. func (c *BackupRunsListCall) Do(opts ...googleapi.CallOption) (*BackupRunsListResponse, error) {
  1840. gensupport.SetOptions(c.urlParams_, opts...)
  1841. res, err := c.doRequest("json")
  1842. if res != nil && res.StatusCode == http.StatusNotModified {
  1843. if res.Body != nil {
  1844. res.Body.Close()
  1845. }
  1846. return nil, &googleapi.Error{
  1847. Code: res.StatusCode,
  1848. Header: res.Header,
  1849. }
  1850. }
  1851. if err != nil {
  1852. return nil, err
  1853. }
  1854. defer googleapi.CloseBody(res)
  1855. if err := googleapi.CheckResponse(res); err != nil {
  1856. return nil, err
  1857. }
  1858. ret := &BackupRunsListResponse{
  1859. ServerResponse: googleapi.ServerResponse{
  1860. Header: res.Header,
  1861. HTTPStatusCode: res.StatusCode,
  1862. },
  1863. }
  1864. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  1865. return nil, err
  1866. }
  1867. return ret, nil
  1868. // {
  1869. // "description": "Lists all backup runs associated with a given instance and configuration in the reverse chronological order of the enqueued time.",
  1870. // "httpMethod": "GET",
  1871. // "id": "sql.backupRuns.list",
  1872. // "parameterOrder": [
  1873. // "project",
  1874. // "instance"
  1875. // ],
  1876. // "parameters": {
  1877. // "instance": {
  1878. // "description": "Cloud SQL instance ID. This does not include the project ID.",
  1879. // "location": "path",
  1880. // "required": true,
  1881. // "type": "string"
  1882. // },
  1883. // "maxResults": {
  1884. // "description": "Maximum number of backup runs per response.",
  1885. // "format": "int32",
  1886. // "location": "query",
  1887. // "type": "integer"
  1888. // },
  1889. // "pageToken": {
  1890. // "description": "A previously-returned page token representing part of the larger set of results to view.",
  1891. // "location": "query",
  1892. // "type": "string"
  1893. // },
  1894. // "project": {
  1895. // "description": "Project ID of the project that contains the instance.",
  1896. // "location": "path",
  1897. // "required": true,
  1898. // "type": "string"
  1899. // }
  1900. // },
  1901. // "path": "projects/{project}/instances/{instance}/backupRuns",
  1902. // "response": {
  1903. // "$ref": "BackupRunsListResponse"
  1904. // },
  1905. // "scopes": [
  1906. // "https://www.googleapis.com/auth/cloud-platform",
  1907. // "https://www.googleapis.com/auth/sqlservice.admin"
  1908. // ]
  1909. // }
  1910. }
  1911. // Pages invokes f for each page of results.
  1912. // A non-nil error returned from f will halt the iteration.
  1913. // The provided context supersedes any context provided to the Context method.
  1914. func (c *BackupRunsListCall) Pages(ctx context.Context, f func(*BackupRunsListResponse) error) error {
  1915. c.ctx_ = ctx
  1916. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  1917. for {
  1918. x, err := c.Do()
  1919. if err != nil {
  1920. return err
  1921. }
  1922. if err := f(x); err != nil {
  1923. return err
  1924. }
  1925. if x.NextPageToken == "" {
  1926. return nil
  1927. }
  1928. c.PageToken(x.NextPageToken)
  1929. }
  1930. }
  1931. // method id "sql.databases.delete":
  1932. type DatabasesDeleteCall struct {
  1933. s *Service
  1934. project string
  1935. instance string
  1936. database string
  1937. urlParams_ gensupport.URLParams
  1938. ctx_ context.Context
  1939. }
  1940. // Delete: Deletes a resource containing information about a database
  1941. // inside a Cloud SQL instance.
  1942. func (r *DatabasesService) Delete(project string, instance string, database string) *DatabasesDeleteCall {
  1943. c := &DatabasesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1944. c.project = project
  1945. c.instance = instance
  1946. c.database = database
  1947. return c
  1948. }
  1949. // Fields allows partial responses to be retrieved. See
  1950. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1951. // for more information.
  1952. func (c *DatabasesDeleteCall) Fields(s ...googleapi.Field) *DatabasesDeleteCall {
  1953. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1954. return c
  1955. }
  1956. // Context sets the context to be used in this call's Do method. Any
  1957. // pending HTTP request will be aborted if the provided context is
  1958. // canceled.
  1959. func (c *DatabasesDeleteCall) Context(ctx context.Context) *DatabasesDeleteCall {
  1960. c.ctx_ = ctx
  1961. return c
  1962. }
  1963. func (c *DatabasesDeleteCall) doRequest(alt string) (*http.Response, error) {
  1964. var body io.Reader = nil
  1965. c.urlParams_.Set("alt", alt)
  1966. urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/instances/{instance}/databases/{database}")
  1967. urls += "?" + c.urlParams_.Encode()
  1968. req, _ := http.NewRequest("DELETE", urls, body)
  1969. googleapi.Expand(req.URL, map[string]string{
  1970. "project": c.project,
  1971. "instance": c.instance,
  1972. "database": c.database,
  1973. })
  1974. req.Header.Set("User-Agent", c.s.userAgent())
  1975. if c.ctx_ != nil {
  1976. return ctxhttp.Do(c.ctx_, c.s.client, req)
  1977. }
  1978. return c.s.client.Do(req)
  1979. }
  1980. // Do executes the "sql.databases.delete" call.
  1981. // Exactly one of *Operation or error will be non-nil. Any non-2xx
  1982. // status code is an error. Response headers are in either
  1983. // *Operation.ServerResponse.Header or (if a response was returned at
  1984. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  1985. // to check whether the returned error was because
  1986. // http.StatusNotModified was returned.
  1987. func (c *DatabasesDeleteCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  1988. gensupport.SetOptions(c.urlParams_, opts...)
  1989. res, err := c.doRequest("json")
  1990. if res != nil && res.StatusCode == http.StatusNotModified {
  1991. if res.Body != nil {
  1992. res.Body.Close()
  1993. }
  1994. return nil, &googleapi.Error{
  1995. Code: res.StatusCode,
  1996. Header: res.Header,
  1997. }
  1998. }
  1999. if err != nil {
  2000. return nil, err
  2001. }
  2002. defer googleapi.CloseBody(res)
  2003. if err := googleapi.CheckResponse(res); err != nil {
  2004. return nil, err
  2005. }
  2006. ret := &Operation{
  2007. ServerResponse: googleapi.ServerResponse{
  2008. Header: res.Header,
  2009. HTTPStatusCode: res.StatusCode,
  2010. },
  2011. }
  2012. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  2013. return nil, err
  2014. }
  2015. return ret, nil
  2016. // {
  2017. // "description": "Deletes a resource containing information about a database inside a Cloud SQL instance.",
  2018. // "httpMethod": "DELETE",
  2019. // "id": "sql.databases.delete",
  2020. // "parameterOrder": [
  2021. // "project",
  2022. // "instance",
  2023. // "database"
  2024. // ],
  2025. // "parameters": {
  2026. // "database": {
  2027. // "description": "Name of the database to be deleted in the instance.",
  2028. // "location": "path",
  2029. // "required": true,
  2030. // "type": "string"
  2031. // },
  2032. // "instance": {
  2033. // "description": "Database instance ID. This does not include the project ID.",
  2034. // "location": "path",
  2035. // "required": true,
  2036. // "type": "string"
  2037. // },
  2038. // "project": {
  2039. // "description": "Project ID of the project that contains the instance.",
  2040. // "location": "path",
  2041. // "required": true,
  2042. // "type": "string"
  2043. // }
  2044. // },
  2045. // "path": "projects/{project}/instances/{instance}/databases/{database}",
  2046. // "response": {
  2047. // "$ref": "Operation"
  2048. // },
  2049. // "scopes": [
  2050. // "https://www.googleapis.com/auth/cloud-platform",
  2051. // "https://www.googleapis.com/auth/sqlservice.admin"
  2052. // ]
  2053. // }
  2054. }
  2055. // method id "sql.databases.get":
  2056. type DatabasesGetCall struct {
  2057. s *Service
  2058. project string
  2059. instance string
  2060. database string
  2061. urlParams_ gensupport.URLParams
  2062. ifNoneMatch_ string
  2063. ctx_ context.Context
  2064. }
  2065. // Get: Retrieves a resource containing information about a database
  2066. // inside a Cloud SQL instance.
  2067. func (r *DatabasesService) Get(project string, instance string, database string) *DatabasesGetCall {
  2068. c := &DatabasesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2069. c.project = project
  2070. c.instance = instance
  2071. c.database = database
  2072. return c
  2073. }
  2074. // Fields allows partial responses to be retrieved. See
  2075. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2076. // for more information.
  2077. func (c *DatabasesGetCall) Fields(s ...googleapi.Field) *DatabasesGetCall {
  2078. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2079. return c
  2080. }
  2081. // IfNoneMatch sets the optional parameter which makes the operation
  2082. // fail if the object's ETag matches the given value. This is useful for
  2083. // getting updates only after the object has changed since the last
  2084. // request. Use googleapi.IsNotModified to check whether the response
  2085. // error from Do is the result of In-None-Match.
  2086. func (c *DatabasesGetCall) IfNoneMatch(entityTag string) *DatabasesGetCall {
  2087. c.ifNoneMatch_ = entityTag
  2088. return c
  2089. }
  2090. // Context sets the context to be used in this call's Do method. Any
  2091. // pending HTTP request will be aborted if the provided context is
  2092. // canceled.
  2093. func (c *DatabasesGetCall) Context(ctx context.Context) *DatabasesGetCall {
  2094. c.ctx_ = ctx
  2095. return c
  2096. }
  2097. func (c *DatabasesGetCall) doRequest(alt string) (*http.Response, error) {
  2098. var body io.Reader = nil
  2099. c.urlParams_.Set("alt", alt)
  2100. urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/instances/{instance}/databases/{database}")
  2101. urls += "?" + c.urlParams_.Encode()
  2102. req, _ := http.NewRequest("GET", urls, body)
  2103. googleapi.Expand(req.URL, map[string]string{
  2104. "project": c.project,
  2105. "instance": c.instance,
  2106. "database": c.database,
  2107. })
  2108. req.Header.Set("User-Agent", c.s.userAgent())
  2109. if c.ifNoneMatch_ != "" {
  2110. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  2111. }
  2112. if c.ctx_ != nil {
  2113. return ctxhttp.Do(c.ctx_, c.s.client, req)
  2114. }
  2115. return c.s.client.Do(req)
  2116. }
  2117. // Do executes the "sql.databases.get" call.
  2118. // Exactly one of *Database or error will be non-nil. Any non-2xx status
  2119. // code is an error. Response headers are in either
  2120. // *Database.ServerResponse.Header or (if a response was returned at
  2121. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  2122. // to check whether the returned error was because
  2123. // http.StatusNotModified was returned.
  2124. func (c *DatabasesGetCall) Do(opts ...googleapi.CallOption) (*Database, error) {
  2125. gensupport.SetOptions(c.urlParams_, opts...)
  2126. res, err := c.doRequest("json")
  2127. if res != nil && res.StatusCode == http.StatusNotModified {
  2128. if res.Body != nil {
  2129. res.Body.Close()
  2130. }
  2131. return nil, &googleapi.Error{
  2132. Code: res.StatusCode,
  2133. Header: res.Header,
  2134. }
  2135. }
  2136. if err != nil {
  2137. return nil, err
  2138. }
  2139. defer googleapi.CloseBody(res)
  2140. if err := googleapi.CheckResponse(res); err != nil {
  2141. return nil, err
  2142. }
  2143. ret := &Database{
  2144. ServerResponse: googleapi.ServerResponse{
  2145. Header: res.Header,
  2146. HTTPStatusCode: res.StatusCode,
  2147. },
  2148. }
  2149. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  2150. return nil, err
  2151. }
  2152. return ret, nil
  2153. // {
  2154. // "description": "Retrieves a resource containing information about a database inside a Cloud SQL instance.",
  2155. // "httpMethod": "GET",
  2156. // "id": "sql.databases.get",
  2157. // "parameterOrder": [
  2158. // "project",
  2159. // "instance",
  2160. // "database"
  2161. // ],
  2162. // "parameters": {
  2163. // "database": {
  2164. // "description": "Name of the database in the instance.",
  2165. // "location": "path",
  2166. // "required": true,
  2167. // "type": "string"
  2168. // },
  2169. // "instance": {
  2170. // "description": "Database instance ID. This does not include the project ID.",
  2171. // "location": "path",
  2172. // "required": true,
  2173. // "type": "string"
  2174. // },
  2175. // "project": {
  2176. // "description": "Project ID of the project that contains the instance.",
  2177. // "location": "path",
  2178. // "required": true,
  2179. // "type": "string"
  2180. // }
  2181. // },
  2182. // "path": "projects/{project}/instances/{instance}/databases/{database}",
  2183. // "response": {
  2184. // "$ref": "Database"
  2185. // },
  2186. // "scopes": [
  2187. // "https://www.googleapis.com/auth/cloud-platform",
  2188. // "https://www.googleapis.com/auth/sqlservice.admin"
  2189. // ]
  2190. // }
  2191. }
  2192. // method id "sql.databases.insert":
  2193. type DatabasesInsertCall struct {
  2194. s *Service
  2195. project string
  2196. instance string
  2197. database *Database
  2198. urlParams_ gensupport.URLParams
  2199. ctx_ context.Context
  2200. }
  2201. // Insert: Inserts a resource containing information about a database
  2202. // inside a Cloud SQL instance.
  2203. func (r *DatabasesService) Insert(project string, instance string, database *Database) *DatabasesInsertCall {
  2204. c := &DatabasesInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2205. c.project = project
  2206. c.instance = instance
  2207. c.database = database
  2208. return c
  2209. }
  2210. // Fields allows partial responses to be retrieved. See
  2211. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2212. // for more information.
  2213. func (c *DatabasesInsertCall) Fields(s ...googleapi.Field) *DatabasesInsertCall {
  2214. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2215. return c
  2216. }
  2217. // Context sets the context to be used in this call's Do method. Any
  2218. // pending HTTP request will be aborted if the provided context is
  2219. // canceled.
  2220. func (c *DatabasesInsertCall) Context(ctx context.Context) *DatabasesInsertCall {
  2221. c.ctx_ = ctx
  2222. return c
  2223. }
  2224. func (c *DatabasesInsertCall) doRequest(alt string) (*http.Response, error) {
  2225. var body io.Reader = nil
  2226. body, err := googleapi.WithoutDataWrapper.JSONReader(c.database)
  2227. if err != nil {
  2228. return nil, err
  2229. }
  2230. ctype := "application/json"
  2231. c.urlParams_.Set("alt", alt)
  2232. urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/instances/{instance}/databases")
  2233. urls += "?" + c.urlParams_.Encode()
  2234. req, _ := http.NewRequest("POST", urls, body)
  2235. googleapi.Expand(req.URL, map[string]string{
  2236. "project": c.project,
  2237. "instance": c.instance,
  2238. })
  2239. req.Header.Set("Content-Type", ctype)
  2240. req.Header.Set("User-Agent", c.s.userAgent())
  2241. if c.ctx_ != nil {
  2242. return ctxhttp.Do(c.ctx_, c.s.client, req)
  2243. }
  2244. return c.s.client.Do(req)
  2245. }
  2246. // Do executes the "sql.databases.insert" call.
  2247. // Exactly one of *Operation or error will be non-nil. Any non-2xx
  2248. // status code is an error. Response headers are in either
  2249. // *Operation.ServerResponse.Header or (if a response was returned at
  2250. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  2251. // to check whether the returned error was because
  2252. // http.StatusNotModified was returned.
  2253. func (c *DatabasesInsertCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  2254. gensupport.SetOptions(c.urlParams_, opts...)
  2255. res, err := c.doRequest("json")
  2256. if res != nil && res.StatusCode == http.StatusNotModified {
  2257. if res.Body != nil {
  2258. res.Body.Close()
  2259. }
  2260. return nil, &googleapi.Error{
  2261. Code: res.StatusCode,
  2262. Header: res.Header,
  2263. }
  2264. }
  2265. if err != nil {
  2266. return nil, err
  2267. }
  2268. defer googleapi.CloseBody(res)
  2269. if err := googleapi.CheckResponse(res); err != nil {
  2270. return nil, err
  2271. }
  2272. ret := &Operation{
  2273. ServerResponse: googleapi.ServerResponse{
  2274. Header: res.Header,
  2275. HTTPStatusCode: res.StatusCode,
  2276. },
  2277. }
  2278. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  2279. return nil, err
  2280. }
  2281. return ret, nil
  2282. // {
  2283. // "description": "Inserts a resource containing information about a database inside a Cloud SQL instance.",
  2284. // "httpMethod": "POST",
  2285. // "id": "sql.databases.insert",
  2286. // "parameterOrder": [
  2287. // "project",
  2288. // "instance"
  2289. // ],
  2290. // "parameters": {
  2291. // "instance": {
  2292. // "description": "Database instance ID. This does not include the project ID.",
  2293. // "location": "path",
  2294. // "required": true,
  2295. // "type": "string"
  2296. // },
  2297. // "project": {
  2298. // "description": "Project ID of the project that contains the instance.",
  2299. // "location": "path",
  2300. // "required": true,
  2301. // "type": "string"
  2302. // }
  2303. // },
  2304. // "path": "projects/{project}/instances/{instance}/databases",
  2305. // "request": {
  2306. // "$ref": "Database"
  2307. // },
  2308. // "response": {
  2309. // "$ref": "Operation"
  2310. // },
  2311. // "scopes": [
  2312. // "https://www.googleapis.com/auth/cloud-platform",
  2313. // "https://www.googleapis.com/auth/sqlservice.admin"
  2314. // ]
  2315. // }
  2316. }
  2317. // method id "sql.databases.list":
  2318. type DatabasesListCall struct {
  2319. s *Service
  2320. project string
  2321. instance string
  2322. urlParams_ gensupport.URLParams
  2323. ifNoneMatch_ string
  2324. ctx_ context.Context
  2325. }
  2326. // List: Lists databases in the specified Cloud SQL instance.
  2327. func (r *DatabasesService) List(project string, instance string) *DatabasesListCall {
  2328. c := &DatabasesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2329. c.project = project
  2330. c.instance = instance
  2331. return c
  2332. }
  2333. // Fields allows partial responses to be retrieved. See
  2334. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2335. // for more information.
  2336. func (c *DatabasesListCall) Fields(s ...googleapi.Field) *DatabasesListCall {
  2337. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2338. return c
  2339. }
  2340. // IfNoneMatch sets the optional parameter which makes the operation
  2341. // fail if the object's ETag matches the given value. This is useful for
  2342. // getting updates only after the object has changed since the last
  2343. // request. Use googleapi.IsNotModified to check whether the response
  2344. // error from Do is the result of In-None-Match.
  2345. func (c *DatabasesListCall) IfNoneMatch(entityTag string) *DatabasesListCall {
  2346. c.ifNoneMatch_ = entityTag
  2347. return c
  2348. }
  2349. // Context sets the context to be used in this call's Do method. Any
  2350. // pending HTTP request will be aborted if the provided context is
  2351. // canceled.
  2352. func (c *DatabasesListCall) Context(ctx context.Context) *DatabasesListCall {
  2353. c.ctx_ = ctx
  2354. return c
  2355. }
  2356. func (c *DatabasesListCall) doRequest(alt string) (*http.Response, error) {
  2357. var body io.Reader = nil
  2358. c.urlParams_.Set("alt", alt)
  2359. urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/instances/{instance}/databases")
  2360. urls += "?" + c.urlParams_.Encode()
  2361. req, _ := http.NewRequest("GET", urls, body)
  2362. googleapi.Expand(req.URL, map[string]string{
  2363. "project": c.project,
  2364. "instance": c.instance,
  2365. })
  2366. req.Header.Set("User-Agent", c.s.userAgent())
  2367. if c.ifNoneMatch_ != "" {
  2368. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  2369. }
  2370. if c.ctx_ != nil {
  2371. return ctxhttp.Do(c.ctx_, c.s.client, req)
  2372. }
  2373. return c.s.client.Do(req)
  2374. }
  2375. // Do executes the "sql.databases.list" call.
  2376. // Exactly one of *DatabasesListResponse or error will be non-nil. Any
  2377. // non-2xx status code is an error. Response headers are in either
  2378. // *DatabasesListResponse.ServerResponse.Header or (if a response was
  2379. // returned at all) in error.(*googleapi.Error).Header. Use
  2380. // googleapi.IsNotModified to check whether the returned error was
  2381. // because http.StatusNotModified was returned.
  2382. func (c *DatabasesListCall) Do(opts ...googleapi.CallOption) (*DatabasesListResponse, error) {
  2383. gensupport.SetOptions(c.urlParams_, opts...)
  2384. res, err := c.doRequest("json")
  2385. if res != nil && res.StatusCode == http.StatusNotModified {
  2386. if res.Body != nil {
  2387. res.Body.Close()
  2388. }
  2389. return nil, &googleapi.Error{
  2390. Code: res.StatusCode,
  2391. Header: res.Header,
  2392. }
  2393. }
  2394. if err != nil {
  2395. return nil, err
  2396. }
  2397. defer googleapi.CloseBody(res)
  2398. if err := googleapi.CheckResponse(res); err != nil {
  2399. return nil, err
  2400. }
  2401. ret := &DatabasesListResponse{
  2402. ServerResponse: googleapi.ServerResponse{
  2403. Header: res.Header,
  2404. HTTPStatusCode: res.StatusCode,
  2405. },
  2406. }
  2407. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  2408. return nil, err
  2409. }
  2410. return ret, nil
  2411. // {
  2412. // "description": "Lists databases in the specified Cloud SQL instance.",
  2413. // "httpMethod": "GET",
  2414. // "id": "sql.databases.list",
  2415. // "parameterOrder": [
  2416. // "project",
  2417. // "instance"
  2418. // ],
  2419. // "parameters": {
  2420. // "instance": {
  2421. // "description": "Cloud SQL instance ID. This does not include the project ID.",
  2422. // "location": "path",
  2423. // "required": true,
  2424. // "type": "string"
  2425. // },
  2426. // "project": {
  2427. // "description": "Project ID of the project for which to list Cloud SQL instances.",
  2428. // "location": "path",
  2429. // "required": true,
  2430. // "type": "string"
  2431. // }
  2432. // },
  2433. // "path": "projects/{project}/instances/{instance}/databases",
  2434. // "response": {
  2435. // "$ref": "DatabasesListResponse"
  2436. // },
  2437. // "scopes": [
  2438. // "https://www.googleapis.com/auth/cloud-platform",
  2439. // "https://www.googleapis.com/auth/sqlservice.admin"
  2440. // ]
  2441. // }
  2442. }
  2443. // method id "sql.databases.patch":
  2444. type DatabasesPatchCall struct {
  2445. s *Service
  2446. project string
  2447. instance string
  2448. database string
  2449. database2 *Database
  2450. urlParams_ gensupport.URLParams
  2451. ctx_ context.Context
  2452. }
  2453. // Patch: Updates a resource containing information about a database
  2454. // inside a Cloud SQL instance. This method supports patch semantics.
  2455. func (r *DatabasesService) Patch(project string, instance string, database string, database2 *Database) *DatabasesPatchCall {
  2456. c := &DatabasesPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2457. c.project = project
  2458. c.instance = instance
  2459. c.database = database
  2460. c.database2 = database2
  2461. return c
  2462. }
  2463. // Fields allows partial responses to be retrieved. See
  2464. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2465. // for more information.
  2466. func (c *DatabasesPatchCall) Fields(s ...googleapi.Field) *DatabasesPatchCall {
  2467. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2468. return c
  2469. }
  2470. // Context sets the context to be used in this call's Do method. Any
  2471. // pending HTTP request will be aborted if the provided context is
  2472. // canceled.
  2473. func (c *DatabasesPatchCall) Context(ctx context.Context) *DatabasesPatchCall {
  2474. c.ctx_ = ctx
  2475. return c
  2476. }
  2477. func (c *DatabasesPatchCall) doRequest(alt string) (*http.Response, error) {
  2478. var body io.Reader = nil
  2479. body, err := googleapi.WithoutDataWrapper.JSONReader(c.database2)
  2480. if err != nil {
  2481. return nil, err
  2482. }
  2483. ctype := "application/json"
  2484. c.urlParams_.Set("alt", alt)
  2485. urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/instances/{instance}/databases/{database}")
  2486. urls += "?" + c.urlParams_.Encode()
  2487. req, _ := http.NewRequest("PATCH", urls, body)
  2488. googleapi.Expand(req.URL, map[string]string{
  2489. "project": c.project,
  2490. "instance": c.instance,
  2491. "database": c.database,
  2492. })
  2493. req.Header.Set("Content-Type", ctype)
  2494. req.Header.Set("User-Agent", c.s.userAgent())
  2495. if c.ctx_ != nil {
  2496. return ctxhttp.Do(c.ctx_, c.s.client, req)
  2497. }
  2498. return c.s.client.Do(req)
  2499. }
  2500. // Do executes the "sql.databases.patch" call.
  2501. // Exactly one of *Operation or error will be non-nil. Any non-2xx
  2502. // status code is an error. Response headers are in either
  2503. // *Operation.ServerResponse.Header or (if a response was returned at
  2504. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  2505. // to check whether the returned error was because
  2506. // http.StatusNotModified was returned.
  2507. func (c *DatabasesPatchCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  2508. gensupport.SetOptions(c.urlParams_, opts...)
  2509. res, err := c.doRequest("json")
  2510. if res != nil && res.StatusCode == http.StatusNotModified {
  2511. if res.Body != nil {
  2512. res.Body.Close()
  2513. }
  2514. return nil, &googleapi.Error{
  2515. Code: res.StatusCode,
  2516. Header: res.Header,
  2517. }
  2518. }
  2519. if err != nil {
  2520. return nil, err
  2521. }
  2522. defer googleapi.CloseBody(res)
  2523. if err := googleapi.CheckResponse(res); err != nil {
  2524. return nil, err
  2525. }
  2526. ret := &Operation{
  2527. ServerResponse: googleapi.ServerResponse{
  2528. Header: res.Header,
  2529. HTTPStatusCode: res.StatusCode,
  2530. },
  2531. }
  2532. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  2533. return nil, err
  2534. }
  2535. return ret, nil
  2536. // {
  2537. // "description": "Updates a resource containing information about a database inside a Cloud SQL instance. This method supports patch semantics.",
  2538. // "httpMethod": "PATCH",
  2539. // "id": "sql.databases.patch",
  2540. // "parameterOrder": [
  2541. // "project",
  2542. // "instance",
  2543. // "database"
  2544. // ],
  2545. // "parameters": {
  2546. // "database": {
  2547. // "description": "Name of the database to be updated in the instance.",
  2548. // "location": "path",
  2549. // "required": true,
  2550. // "type": "string"
  2551. // },
  2552. // "instance": {
  2553. // "description": "Database instance ID. This does not include the project ID.",
  2554. // "location": "path",
  2555. // "required": true,
  2556. // "type": "string"
  2557. // },
  2558. // "project": {
  2559. // "description": "Project ID of the project that contains the instance.",
  2560. // "location": "path",
  2561. // "required": true,
  2562. // "type": "string"
  2563. // }
  2564. // },
  2565. // "path": "projects/{project}/instances/{instance}/databases/{database}",
  2566. // "request": {
  2567. // "$ref": "Database"
  2568. // },
  2569. // "response": {
  2570. // "$ref": "Operation"
  2571. // },
  2572. // "scopes": [
  2573. // "https://www.googleapis.com/auth/cloud-platform",
  2574. // "https://www.googleapis.com/auth/sqlservice.admin"
  2575. // ]
  2576. // }
  2577. }
  2578. // method id "sql.databases.update":
  2579. type DatabasesUpdateCall struct {
  2580. s *Service
  2581. project string
  2582. instance string
  2583. database string
  2584. database2 *Database
  2585. urlParams_ gensupport.URLParams
  2586. ctx_ context.Context
  2587. }
  2588. // Update: Updates a resource containing information about a database
  2589. // inside a Cloud SQL instance.
  2590. func (r *DatabasesService) Update(project string, instance string, database string, database2 *Database) *DatabasesUpdateCall {
  2591. c := &DatabasesUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2592. c.project = project
  2593. c.instance = instance
  2594. c.database = database
  2595. c.database2 = database2
  2596. return c
  2597. }
  2598. // Fields allows partial responses to be retrieved. See
  2599. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2600. // for more information.
  2601. func (c *DatabasesUpdateCall) Fields(s ...googleapi.Field) *DatabasesUpdateCall {
  2602. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2603. return c
  2604. }
  2605. // Context sets the context to be used in this call's Do method. Any
  2606. // pending HTTP request will be aborted if the provided context is
  2607. // canceled.
  2608. func (c *DatabasesUpdateCall) Context(ctx context.Context) *DatabasesUpdateCall {
  2609. c.ctx_ = ctx
  2610. return c
  2611. }
  2612. func (c *DatabasesUpdateCall) doRequest(alt string) (*http.Response, error) {
  2613. var body io.Reader = nil
  2614. body, err := googleapi.WithoutDataWrapper.JSONReader(c.database2)
  2615. if err != nil {
  2616. return nil, err
  2617. }
  2618. ctype := "application/json"
  2619. c.urlParams_.Set("alt", alt)
  2620. urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/instances/{instance}/databases/{database}")
  2621. urls += "?" + c.urlParams_.Encode()
  2622. req, _ := http.NewRequest("PUT", urls, body)
  2623. googleapi.Expand(req.URL, map[string]string{
  2624. "project": c.project,
  2625. "instance": c.instance,
  2626. "database": c.database,
  2627. })
  2628. req.Header.Set("Content-Type", ctype)
  2629. req.Header.Set("User-Agent", c.s.userAgent())
  2630. if c.ctx_ != nil {
  2631. return ctxhttp.Do(c.ctx_, c.s.client, req)
  2632. }
  2633. return c.s.client.Do(req)
  2634. }
  2635. // Do executes the "sql.databases.update" call.
  2636. // Exactly one of *Operation or error will be non-nil. Any non-2xx
  2637. // status code is an error. Response headers are in either
  2638. // *Operation.ServerResponse.Header or (if a response was returned at
  2639. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  2640. // to check whether the returned error was because
  2641. // http.StatusNotModified was returned.
  2642. func (c *DatabasesUpdateCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  2643. gensupport.SetOptions(c.urlParams_, opts...)
  2644. res, err := c.doRequest("json")
  2645. if res != nil && res.StatusCode == http.StatusNotModified {
  2646. if res.Body != nil {
  2647. res.Body.Close()
  2648. }
  2649. return nil, &googleapi.Error{
  2650. Code: res.StatusCode,
  2651. Header: res.Header,
  2652. }
  2653. }
  2654. if err != nil {
  2655. return nil, err
  2656. }
  2657. defer googleapi.CloseBody(res)
  2658. if err := googleapi.CheckResponse(res); err != nil {
  2659. return nil, err
  2660. }
  2661. ret := &Operation{
  2662. ServerResponse: googleapi.ServerResponse{
  2663. Header: res.Header,
  2664. HTTPStatusCode: res.StatusCode,
  2665. },
  2666. }
  2667. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  2668. return nil, err
  2669. }
  2670. return ret, nil
  2671. // {
  2672. // "description": "Updates a resource containing information about a database inside a Cloud SQL instance.",
  2673. // "httpMethod": "PUT",
  2674. // "id": "sql.databases.update",
  2675. // "parameterOrder": [
  2676. // "project",
  2677. // "instance",
  2678. // "database"
  2679. // ],
  2680. // "parameters": {
  2681. // "database": {
  2682. // "description": "Name of the database to be updated in the instance.",
  2683. // "location": "path",
  2684. // "required": true,
  2685. // "type": "string"
  2686. // },
  2687. // "instance": {
  2688. // "description": "Database instance ID. This does not include the project ID.",
  2689. // "location": "path",
  2690. // "required": true,
  2691. // "type": "string"
  2692. // },
  2693. // "project": {
  2694. // "description": "Project ID of the project that contains the instance.",
  2695. // "location": "path",
  2696. // "required": true,
  2697. // "type": "string"
  2698. // }
  2699. // },
  2700. // "path": "projects/{project}/instances/{instance}/databases/{database}",
  2701. // "request": {
  2702. // "$ref": "Database"
  2703. // },
  2704. // "response": {
  2705. // "$ref": "Operation"
  2706. // },
  2707. // "scopes": [
  2708. // "https://www.googleapis.com/auth/cloud-platform",
  2709. // "https://www.googleapis.com/auth/sqlservice.admin"
  2710. // ]
  2711. // }
  2712. }
  2713. // method id "sql.flags.list":
  2714. type FlagsListCall struct {
  2715. s *Service
  2716. urlParams_ gensupport.URLParams
  2717. ifNoneMatch_ string
  2718. ctx_ context.Context
  2719. }
  2720. // List: List all available database flags for Google Cloud SQL
  2721. // instances.
  2722. func (r *FlagsService) List() *FlagsListCall {
  2723. c := &FlagsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2724. return c
  2725. }
  2726. // Fields allows partial responses to be retrieved. See
  2727. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2728. // for more information.
  2729. func (c *FlagsListCall) Fields(s ...googleapi.Field) *FlagsListCall {
  2730. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2731. return c
  2732. }
  2733. // IfNoneMatch sets the optional parameter which makes the operation
  2734. // fail if the object's ETag matches the given value. This is useful for
  2735. // getting updates only after the object has changed since the last
  2736. // request. Use googleapi.IsNotModified to check whether the response
  2737. // error from Do is the result of In-None-Match.
  2738. func (c *FlagsListCall) IfNoneMatch(entityTag string) *FlagsListCall {
  2739. c.ifNoneMatch_ = entityTag
  2740. return c
  2741. }
  2742. // Context sets the context to be used in this call's Do method. Any
  2743. // pending HTTP request will be aborted if the provided context is
  2744. // canceled.
  2745. func (c *FlagsListCall) Context(ctx context.Context) *FlagsListCall {
  2746. c.ctx_ = ctx
  2747. return c
  2748. }
  2749. func (c *FlagsListCall) doRequest(alt string) (*http.Response, error) {
  2750. var body io.Reader = nil
  2751. c.urlParams_.Set("alt", alt)
  2752. urls := googleapi.ResolveRelative(c.s.BasePath, "flags")
  2753. urls += "?" + c.urlParams_.Encode()
  2754. req, _ := http.NewRequest("GET", urls, body)
  2755. googleapi.SetOpaque(req.URL)
  2756. req.Header.Set("User-Agent", c.s.userAgent())
  2757. if c.ifNoneMatch_ != "" {
  2758. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  2759. }
  2760. if c.ctx_ != nil {
  2761. return ctxhttp.Do(c.ctx_, c.s.client, req)
  2762. }
  2763. return c.s.client.Do(req)
  2764. }
  2765. // Do executes the "sql.flags.list" call.
  2766. // Exactly one of *FlagsListResponse or error will be non-nil. Any
  2767. // non-2xx status code is an error. Response headers are in either
  2768. // *FlagsListResponse.ServerResponse.Header or (if a response was
  2769. // returned at all) in error.(*googleapi.Error).Header. Use
  2770. // googleapi.IsNotModified to check whether the returned error was
  2771. // because http.StatusNotModified was returned.
  2772. func (c *FlagsListCall) Do(opts ...googleapi.CallOption) (*FlagsListResponse, error) {
  2773. gensupport.SetOptions(c.urlParams_, opts...)
  2774. res, err := c.doRequest("json")
  2775. if res != nil && res.StatusCode == http.StatusNotModified {
  2776. if res.Body != nil {
  2777. res.Body.Close()
  2778. }
  2779. return nil, &googleapi.Error{
  2780. Code: res.StatusCode,
  2781. Header: res.Header,
  2782. }
  2783. }
  2784. if err != nil {
  2785. return nil, err
  2786. }
  2787. defer googleapi.CloseBody(res)
  2788. if err := googleapi.CheckResponse(res); err != nil {
  2789. return nil, err
  2790. }
  2791. ret := &FlagsListResponse{
  2792. ServerResponse: googleapi.ServerResponse{
  2793. Header: res.Header,
  2794. HTTPStatusCode: res.StatusCode,
  2795. },
  2796. }
  2797. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  2798. return nil, err
  2799. }
  2800. return ret, nil
  2801. // {
  2802. // "description": "List all available database flags for Google Cloud SQL instances.",
  2803. // "httpMethod": "GET",
  2804. // "id": "sql.flags.list",
  2805. // "path": "flags",
  2806. // "response": {
  2807. // "$ref": "FlagsListResponse"
  2808. // },
  2809. // "scopes": [
  2810. // "https://www.googleapis.com/auth/cloud-platform",
  2811. // "https://www.googleapis.com/auth/sqlservice.admin"
  2812. // ]
  2813. // }
  2814. }
  2815. // method id "sql.instances.clone":
  2816. type InstancesCloneCall struct {
  2817. s *Service
  2818. project string
  2819. instance string
  2820. instancesclonerequest *InstancesCloneRequest
  2821. urlParams_ gensupport.URLParams
  2822. ctx_ context.Context
  2823. }
  2824. // Clone: Creates a Cloud SQL instance as a clone of the source
  2825. // instance.
  2826. func (r *InstancesService) Clone(project string, instance string, instancesclonerequest *InstancesCloneRequest) *InstancesCloneCall {
  2827. c := &InstancesCloneCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2828. c.project = project
  2829. c.instance = instance
  2830. c.instancesclonerequest = instancesclonerequest
  2831. return c
  2832. }
  2833. // Fields allows partial responses to be retrieved. See
  2834. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2835. // for more information.
  2836. func (c *InstancesCloneCall) Fields(s ...googleapi.Field) *InstancesCloneCall {
  2837. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2838. return c
  2839. }
  2840. // Context sets the context to be used in this call's Do method. Any
  2841. // pending HTTP request will be aborted if the provided context is
  2842. // canceled.
  2843. func (c *InstancesCloneCall) Context(ctx context.Context) *InstancesCloneCall {
  2844. c.ctx_ = ctx
  2845. return c
  2846. }
  2847. func (c *InstancesCloneCall) doRequest(alt string) (*http.Response, error) {
  2848. var body io.Reader = nil
  2849. body, err := googleapi.WithoutDataWrapper.JSONReader(c.instancesclonerequest)
  2850. if err != nil {
  2851. return nil, err
  2852. }
  2853. ctype := "application/json"
  2854. c.urlParams_.Set("alt", alt)
  2855. urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/instances/{instance}/clone")
  2856. urls += "?" + c.urlParams_.Encode()
  2857. req, _ := http.NewRequest("POST", urls, body)
  2858. googleapi.Expand(req.URL, map[string]string{
  2859. "project": c.project,
  2860. "instance": c.instance,
  2861. })
  2862. req.Header.Set("Content-Type", ctype)
  2863. req.Header.Set("User-Agent", c.s.userAgent())
  2864. if c.ctx_ != nil {
  2865. return ctxhttp.Do(c.ctx_, c.s.client, req)
  2866. }
  2867. return c.s.client.Do(req)
  2868. }
  2869. // Do executes the "sql.instances.clone" call.
  2870. // Exactly one of *Operation or error will be non-nil. Any non-2xx
  2871. // status code is an error. Response headers are in either
  2872. // *Operation.ServerResponse.Header or (if a response was returned at
  2873. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  2874. // to check whether the returned error was because
  2875. // http.StatusNotModified was returned.
  2876. func (c *InstancesCloneCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  2877. gensupport.SetOptions(c.urlParams_, opts...)
  2878. res, err := c.doRequest("json")
  2879. if res != nil && res.StatusCode == http.StatusNotModified {
  2880. if res.Body != nil {
  2881. res.Body.Close()
  2882. }
  2883. return nil, &googleapi.Error{
  2884. Code: res.StatusCode,
  2885. Header: res.Header,
  2886. }
  2887. }
  2888. if err != nil {
  2889. return nil, err
  2890. }
  2891. defer googleapi.CloseBody(res)
  2892. if err := googleapi.CheckResponse(res); err != nil {
  2893. return nil, err
  2894. }
  2895. ret := &Operation{
  2896. ServerResponse: googleapi.ServerResponse{
  2897. Header: res.Header,
  2898. HTTPStatusCode: res.StatusCode,
  2899. },
  2900. }
  2901. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  2902. return nil, err
  2903. }
  2904. return ret, nil
  2905. // {
  2906. // "description": "Creates a Cloud SQL instance as a clone of the source instance.",
  2907. // "httpMethod": "POST",
  2908. // "id": "sql.instances.clone",
  2909. // "parameterOrder": [
  2910. // "project",
  2911. // "instance"
  2912. // ],
  2913. // "parameters": {
  2914. // "instance": {
  2915. // "description": "The ID of the Cloud SQL instance to be cloned (source). This does not include the project ID.",
  2916. // "location": "path",
  2917. // "required": true,
  2918. // "type": "string"
  2919. // },
  2920. // "project": {
  2921. // "description": "Project ID of the source as well as the clone Cloud SQL instance.",
  2922. // "location": "path",
  2923. // "required": true,
  2924. // "type": "string"
  2925. // }
  2926. // },
  2927. // "path": "projects/{project}/instances/{instance}/clone",
  2928. // "request": {
  2929. // "$ref": "InstancesCloneRequest"
  2930. // },
  2931. // "response": {
  2932. // "$ref": "Operation"
  2933. // },
  2934. // "scopes": [
  2935. // "https://www.googleapis.com/auth/cloud-platform",
  2936. // "https://www.googleapis.com/auth/sqlservice.admin"
  2937. // ]
  2938. // }
  2939. }
  2940. // method id "sql.instances.delete":
  2941. type InstancesDeleteCall struct {
  2942. s *Service
  2943. project string
  2944. instance string
  2945. urlParams_ gensupport.URLParams
  2946. ctx_ context.Context
  2947. }
  2948. // Delete: Deletes a Cloud SQL instance.
  2949. func (r *InstancesService) Delete(project string, instance string) *InstancesDeleteCall {
  2950. c := &InstancesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2951. c.project = project
  2952. c.instance = instance
  2953. return c
  2954. }
  2955. // Fields allows partial responses to be retrieved. See
  2956. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2957. // for more information.
  2958. func (c *InstancesDeleteCall) Fields(s ...googleapi.Field) *InstancesDeleteCall {
  2959. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2960. return c
  2961. }
  2962. // Context sets the context to be used in this call's Do method. Any
  2963. // pending HTTP request will be aborted if the provided context is
  2964. // canceled.
  2965. func (c *InstancesDeleteCall) Context(ctx context.Context) *InstancesDeleteCall {
  2966. c.ctx_ = ctx
  2967. return c
  2968. }
  2969. func (c *InstancesDeleteCall) doRequest(alt string) (*http.Response, error) {
  2970. var body io.Reader = nil
  2971. c.urlParams_.Set("alt", alt)
  2972. urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/instances/{instance}")
  2973. urls += "?" + c.urlParams_.Encode()
  2974. req, _ := http.NewRequest("DELETE", urls, body)
  2975. googleapi.Expand(req.URL, map[string]string{
  2976. "project": c.project,
  2977. "instance": c.instance,
  2978. })
  2979. req.Header.Set("User-Agent", c.s.userAgent())
  2980. if c.ctx_ != nil {
  2981. return ctxhttp.Do(c.ctx_, c.s.client, req)
  2982. }
  2983. return c.s.client.Do(req)
  2984. }
  2985. // Do executes the "sql.instances.delete" call.
  2986. // Exactly one of *Operation or error will be non-nil. Any non-2xx
  2987. // status code is an error. Response headers are in either
  2988. // *Operation.ServerResponse.Header or (if a response was returned at
  2989. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  2990. // to check whether the returned error was because
  2991. // http.StatusNotModified was returned.
  2992. func (c *InstancesDeleteCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  2993. gensupport.SetOptions(c.urlParams_, opts...)
  2994. res, err := c.doRequest("json")
  2995. if res != nil && res.StatusCode == http.StatusNotModified {
  2996. if res.Body != nil {
  2997. res.Body.Close()
  2998. }
  2999. return nil, &googleapi.Error{
  3000. Code: res.StatusCode,
  3001. Header: res.Header,
  3002. }
  3003. }
  3004. if err != nil {
  3005. return nil, err
  3006. }
  3007. defer googleapi.CloseBody(res)
  3008. if err := googleapi.CheckResponse(res); err != nil {
  3009. return nil, err
  3010. }
  3011. ret := &Operation{
  3012. ServerResponse: googleapi.ServerResponse{
  3013. Header: res.Header,
  3014. HTTPStatusCode: res.StatusCode,
  3015. },
  3016. }
  3017. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  3018. return nil, err
  3019. }
  3020. return ret, nil
  3021. // {
  3022. // "description": "Deletes a Cloud SQL instance.",
  3023. // "httpMethod": "DELETE",
  3024. // "id": "sql.instances.delete",
  3025. // "parameterOrder": [
  3026. // "project",
  3027. // "instance"
  3028. // ],
  3029. // "parameters": {
  3030. // "instance": {
  3031. // "description": "Cloud SQL instance ID. This does not include the project ID.",
  3032. // "location": "path",
  3033. // "required": true,
  3034. // "type": "string"
  3035. // },
  3036. // "project": {
  3037. // "description": "Project ID of the project that contains the instance to be deleted.",
  3038. // "location": "path",
  3039. // "required": true,
  3040. // "type": "string"
  3041. // }
  3042. // },
  3043. // "path": "projects/{project}/instances/{instance}",
  3044. // "response": {
  3045. // "$ref": "Operation"
  3046. // },
  3047. // "scopes": [
  3048. // "https://www.googleapis.com/auth/cloud-platform",
  3049. // "https://www.googleapis.com/auth/sqlservice.admin"
  3050. // ]
  3051. // }
  3052. }
  3053. // method id "sql.instances.export":
  3054. type InstancesExportCall struct {
  3055. s *Service
  3056. project string
  3057. instance string
  3058. instancesexportrequest *InstancesExportRequest
  3059. urlParams_ gensupport.URLParams
  3060. ctx_ context.Context
  3061. }
  3062. // Export: Exports data from a Cloud SQL instance to a Google Cloud
  3063. // Storage bucket as a MySQL dump file.
  3064. func (r *InstancesService) Export(project string, instance string, instancesexportrequest *InstancesExportRequest) *InstancesExportCall {
  3065. c := &InstancesExportCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3066. c.project = project
  3067. c.instance = instance
  3068. c.instancesexportrequest = instancesexportrequest
  3069. return c
  3070. }
  3071. // Fields allows partial responses to be retrieved. See
  3072. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3073. // for more information.
  3074. func (c *InstancesExportCall) Fields(s ...googleapi.Field) *InstancesExportCall {
  3075. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3076. return c
  3077. }
  3078. // Context sets the context to be used in this call's Do method. Any
  3079. // pending HTTP request will be aborted if the provided context is
  3080. // canceled.
  3081. func (c *InstancesExportCall) Context(ctx context.Context) *InstancesExportCall {
  3082. c.ctx_ = ctx
  3083. return c
  3084. }
  3085. func (c *InstancesExportCall) doRequest(alt string) (*http.Response, error) {
  3086. var body io.Reader = nil
  3087. body, err := googleapi.WithoutDataWrapper.JSONReader(c.instancesexportrequest)
  3088. if err != nil {
  3089. return nil, err
  3090. }
  3091. ctype := "application/json"
  3092. c.urlParams_.Set("alt", alt)
  3093. urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/instances/{instance}/export")
  3094. urls += "?" + c.urlParams_.Encode()
  3095. req, _ := http.NewRequest("POST", urls, body)
  3096. googleapi.Expand(req.URL, map[string]string{
  3097. "project": c.project,
  3098. "instance": c.instance,
  3099. })
  3100. req.Header.Set("Content-Type", ctype)
  3101. req.Header.Set("User-Agent", c.s.userAgent())
  3102. if c.ctx_ != nil {
  3103. return ctxhttp.Do(c.ctx_, c.s.client, req)
  3104. }
  3105. return c.s.client.Do(req)
  3106. }
  3107. // Do executes the "sql.instances.export" call.
  3108. // Exactly one of *Operation or error will be non-nil. Any non-2xx
  3109. // status code is an error. Response headers are in either
  3110. // *Operation.ServerResponse.Header or (if a response was returned at
  3111. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  3112. // to check whether the returned error was because
  3113. // http.StatusNotModified was returned.
  3114. func (c *InstancesExportCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  3115. gensupport.SetOptions(c.urlParams_, opts...)
  3116. res, err := c.doRequest("json")
  3117. if res != nil && res.StatusCode == http.StatusNotModified {
  3118. if res.Body != nil {
  3119. res.Body.Close()
  3120. }
  3121. return nil, &googleapi.Error{
  3122. Code: res.StatusCode,
  3123. Header: res.Header,
  3124. }
  3125. }
  3126. if err != nil {
  3127. return nil, err
  3128. }
  3129. defer googleapi.CloseBody(res)
  3130. if err := googleapi.CheckResponse(res); err != nil {
  3131. return nil, err
  3132. }
  3133. ret := &Operation{
  3134. ServerResponse: googleapi.ServerResponse{
  3135. Header: res.Header,
  3136. HTTPStatusCode: res.StatusCode,
  3137. },
  3138. }
  3139. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  3140. return nil, err
  3141. }
  3142. return ret, nil
  3143. // {
  3144. // "description": "Exports data from a Cloud SQL instance to a Google Cloud Storage bucket as a MySQL dump file.",
  3145. // "httpMethod": "POST",
  3146. // "id": "sql.instances.export",
  3147. // "parameterOrder": [
  3148. // "project",
  3149. // "instance"
  3150. // ],
  3151. // "parameters": {
  3152. // "instance": {
  3153. // "description": "Cloud SQL instance ID. This does not include the project ID.",
  3154. // "location": "path",
  3155. // "required": true,
  3156. // "type": "string"
  3157. // },
  3158. // "project": {
  3159. // "description": "Project ID of the project that contains the instance to be exported.",
  3160. // "location": "path",
  3161. // "required": true,
  3162. // "type": "string"
  3163. // }
  3164. // },
  3165. // "path": "projects/{project}/instances/{instance}/export",
  3166. // "request": {
  3167. // "$ref": "InstancesExportRequest"
  3168. // },
  3169. // "response": {
  3170. // "$ref": "Operation"
  3171. // },
  3172. // "scopes": [
  3173. // "https://www.googleapis.com/auth/cloud-platform"
  3174. // ]
  3175. // }
  3176. }
  3177. // method id "sql.instances.failover":
  3178. type InstancesFailoverCall struct {
  3179. s *Service
  3180. project string
  3181. instance string
  3182. instancesfailoverrequest *InstancesFailoverRequest
  3183. urlParams_ gensupport.URLParams
  3184. ctx_ context.Context
  3185. }
  3186. // Failover: Failover the instance to its failover replica instance.
  3187. func (r *InstancesService) Failover(project string, instance string, instancesfailoverrequest *InstancesFailoverRequest) *InstancesFailoverCall {
  3188. c := &InstancesFailoverCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3189. c.project = project
  3190. c.instance = instance
  3191. c.instancesfailoverrequest = instancesfailoverrequest
  3192. return c
  3193. }
  3194. // Fields allows partial responses to be retrieved. See
  3195. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3196. // for more information.
  3197. func (c *InstancesFailoverCall) Fields(s ...googleapi.Field) *InstancesFailoverCall {
  3198. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3199. return c
  3200. }
  3201. // Context sets the context to be used in this call's Do method. Any
  3202. // pending HTTP request will be aborted if the provided context is
  3203. // canceled.
  3204. func (c *InstancesFailoverCall) Context(ctx context.Context) *InstancesFailoverCall {
  3205. c.ctx_ = ctx
  3206. return c
  3207. }
  3208. func (c *InstancesFailoverCall) doRequest(alt string) (*http.Response, error) {
  3209. var body io.Reader = nil
  3210. body, err := googleapi.WithoutDataWrapper.JSONReader(c.instancesfailoverrequest)
  3211. if err != nil {
  3212. return nil, err
  3213. }
  3214. ctype := "application/json"
  3215. c.urlParams_.Set("alt", alt)
  3216. urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/instances/{instance}/failover")
  3217. urls += "?" + c.urlParams_.Encode()
  3218. req, _ := http.NewRequest("POST", urls, body)
  3219. googleapi.Expand(req.URL, map[string]string{
  3220. "project": c.project,
  3221. "instance": c.instance,
  3222. })
  3223. req.Header.Set("Content-Type", ctype)
  3224. req.Header.Set("User-Agent", c.s.userAgent())
  3225. if c.ctx_ != nil {
  3226. return ctxhttp.Do(c.ctx_, c.s.client, req)
  3227. }
  3228. return c.s.client.Do(req)
  3229. }
  3230. // Do executes the "sql.instances.failover" call.
  3231. // Exactly one of *Operation or error will be non-nil. Any non-2xx
  3232. // status code is an error. Response headers are in either
  3233. // *Operation.ServerResponse.Header or (if a response was returned at
  3234. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  3235. // to check whether the returned error was because
  3236. // http.StatusNotModified was returned.
  3237. func (c *InstancesFailoverCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  3238. gensupport.SetOptions(c.urlParams_, opts...)
  3239. res, err := c.doRequest("json")
  3240. if res != nil && res.StatusCode == http.StatusNotModified {
  3241. if res.Body != nil {
  3242. res.Body.Close()
  3243. }
  3244. return nil, &googleapi.Error{
  3245. Code: res.StatusCode,
  3246. Header: res.Header,
  3247. }
  3248. }
  3249. if err != nil {
  3250. return nil, err
  3251. }
  3252. defer googleapi.CloseBody(res)
  3253. if err := googleapi.CheckResponse(res); err != nil {
  3254. return nil, err
  3255. }
  3256. ret := &Operation{
  3257. ServerResponse: googleapi.ServerResponse{
  3258. Header: res.Header,
  3259. HTTPStatusCode: res.StatusCode,
  3260. },
  3261. }
  3262. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  3263. return nil, err
  3264. }
  3265. return ret, nil
  3266. // {
  3267. // "description": "Failover the instance to its failover replica instance.",
  3268. // "httpMethod": "POST",
  3269. // "id": "sql.instances.failover",
  3270. // "parameterOrder": [
  3271. // "project",
  3272. // "instance"
  3273. // ],
  3274. // "parameters": {
  3275. // "instance": {
  3276. // "description": "Cloud SQL instance ID. This does not include the project ID.",
  3277. // "location": "path",
  3278. // "required": true,
  3279. // "type": "string"
  3280. // },
  3281. // "project": {
  3282. // "description": "ID of the project that contains the read replica.",
  3283. // "location": "path",
  3284. // "required": true,
  3285. // "type": "string"
  3286. // }
  3287. // },
  3288. // "path": "projects/{project}/instances/{instance}/failover",
  3289. // "request": {
  3290. // "$ref": "InstancesFailoverRequest"
  3291. // },
  3292. // "response": {
  3293. // "$ref": "Operation"
  3294. // },
  3295. // "scopes": [
  3296. // "https://www.googleapis.com/auth/cloud-platform",
  3297. // "https://www.googleapis.com/auth/sqlservice.admin"
  3298. // ]
  3299. // }
  3300. }
  3301. // method id "sql.instances.get":
  3302. type InstancesGetCall struct {
  3303. s *Service
  3304. project string
  3305. instance string
  3306. urlParams_ gensupport.URLParams
  3307. ifNoneMatch_ string
  3308. ctx_ context.Context
  3309. }
  3310. // Get: Retrieves a resource containing information about a Cloud SQL
  3311. // instance.
  3312. func (r *InstancesService) Get(project string, instance string) *InstancesGetCall {
  3313. c := &InstancesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3314. c.project = project
  3315. c.instance = instance
  3316. return c
  3317. }
  3318. // Fields allows partial responses to be retrieved. See
  3319. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3320. // for more information.
  3321. func (c *InstancesGetCall) Fields(s ...googleapi.Field) *InstancesGetCall {
  3322. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3323. return c
  3324. }
  3325. // IfNoneMatch sets the optional parameter which makes the operation
  3326. // fail if the object's ETag matches the given value. This is useful for
  3327. // getting updates only after the object has changed since the last
  3328. // request. Use googleapi.IsNotModified to check whether the response
  3329. // error from Do is the result of In-None-Match.
  3330. func (c *InstancesGetCall) IfNoneMatch(entityTag string) *InstancesGetCall {
  3331. c.ifNoneMatch_ = entityTag
  3332. return c
  3333. }
  3334. // Context sets the context to be used in this call's Do method. Any
  3335. // pending HTTP request will be aborted if the provided context is
  3336. // canceled.
  3337. func (c *InstancesGetCall) Context(ctx context.Context) *InstancesGetCall {
  3338. c.ctx_ = ctx
  3339. return c
  3340. }
  3341. func (c *InstancesGetCall) doRequest(alt string) (*http.Response, error) {
  3342. var body io.Reader = nil
  3343. c.urlParams_.Set("alt", alt)
  3344. urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/instances/{instance}")
  3345. urls += "?" + c.urlParams_.Encode()
  3346. req, _ := http.NewRequest("GET", urls, body)
  3347. googleapi.Expand(req.URL, map[string]string{
  3348. "project": c.project,
  3349. "instance": c.instance,
  3350. })
  3351. req.Header.Set("User-Agent", c.s.userAgent())
  3352. if c.ifNoneMatch_ != "" {
  3353. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  3354. }
  3355. if c.ctx_ != nil {
  3356. return ctxhttp.Do(c.ctx_, c.s.client, req)
  3357. }
  3358. return c.s.client.Do(req)
  3359. }
  3360. // Do executes the "sql.instances.get" call.
  3361. // Exactly one of *DatabaseInstance or error will be non-nil. Any
  3362. // non-2xx status code is an error. Response headers are in either
  3363. // *DatabaseInstance.ServerResponse.Header or (if a response was
  3364. // returned at all) in error.(*googleapi.Error).Header. Use
  3365. // googleapi.IsNotModified to check whether the returned error was
  3366. // because http.StatusNotModified was returned.
  3367. func (c *InstancesGetCall) Do(opts ...googleapi.CallOption) (*DatabaseInstance, error) {
  3368. gensupport.SetOptions(c.urlParams_, opts...)
  3369. res, err := c.doRequest("json")
  3370. if res != nil && res.StatusCode == http.StatusNotModified {
  3371. if res.Body != nil {
  3372. res.Body.Close()
  3373. }
  3374. return nil, &googleapi.Error{
  3375. Code: res.StatusCode,
  3376. Header: res.Header,
  3377. }
  3378. }
  3379. if err != nil {
  3380. return nil, err
  3381. }
  3382. defer googleapi.CloseBody(res)
  3383. if err := googleapi.CheckResponse(res); err != nil {
  3384. return nil, err
  3385. }
  3386. ret := &DatabaseInstance{
  3387. ServerResponse: googleapi.ServerResponse{
  3388. Header: res.Header,
  3389. HTTPStatusCode: res.StatusCode,
  3390. },
  3391. }
  3392. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  3393. return nil, err
  3394. }
  3395. return ret, nil
  3396. // {
  3397. // "description": "Retrieves a resource containing information about a Cloud SQL instance.",
  3398. // "httpMethod": "GET",
  3399. // "id": "sql.instances.get",
  3400. // "parameterOrder": [
  3401. // "project",
  3402. // "instance"
  3403. // ],
  3404. // "parameters": {
  3405. // "instance": {
  3406. // "description": "Database instance ID. This does not include the project ID.",
  3407. // "location": "path",
  3408. // "required": true,
  3409. // "type": "string"
  3410. // },
  3411. // "project": {
  3412. // "description": "Project ID of the project that contains the instance.",
  3413. // "location": "path",
  3414. // "required": true,
  3415. // "type": "string"
  3416. // }
  3417. // },
  3418. // "path": "projects/{project}/instances/{instance}",
  3419. // "response": {
  3420. // "$ref": "DatabaseInstance"
  3421. // },
  3422. // "scopes": [
  3423. // "https://www.googleapis.com/auth/cloud-platform",
  3424. // "https://www.googleapis.com/auth/sqlservice.admin"
  3425. // ]
  3426. // }
  3427. }
  3428. // method id "sql.instances.import":
  3429. type InstancesImportCall struct {
  3430. s *Service
  3431. project string
  3432. instance string
  3433. instancesimportrequest *InstancesImportRequest
  3434. urlParams_ gensupport.URLParams
  3435. ctx_ context.Context
  3436. }
  3437. // Import: Imports data into a Cloud SQL instance from a MySQL dump file
  3438. // in Google Cloud Storage.
  3439. func (r *InstancesService) Import(project string, instance string, instancesimportrequest *InstancesImportRequest) *InstancesImportCall {
  3440. c := &InstancesImportCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3441. c.project = project
  3442. c.instance = instance
  3443. c.instancesimportrequest = instancesimportrequest
  3444. return c
  3445. }
  3446. // Fields allows partial responses to be retrieved. See
  3447. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3448. // for more information.
  3449. func (c *InstancesImportCall) Fields(s ...googleapi.Field) *InstancesImportCall {
  3450. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3451. return c
  3452. }
  3453. // Context sets the context to be used in this call's Do method. Any
  3454. // pending HTTP request will be aborted if the provided context is
  3455. // canceled.
  3456. func (c *InstancesImportCall) Context(ctx context.Context) *InstancesImportCall {
  3457. c.ctx_ = ctx
  3458. return c
  3459. }
  3460. func (c *InstancesImportCall) doRequest(alt string) (*http.Response, error) {
  3461. var body io.Reader = nil
  3462. body, err := googleapi.WithoutDataWrapper.JSONReader(c.instancesimportrequest)
  3463. if err != nil {
  3464. return nil, err
  3465. }
  3466. ctype := "application/json"
  3467. c.urlParams_.Set("alt", alt)
  3468. urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/instances/{instance}/import")
  3469. urls += "?" + c.urlParams_.Encode()
  3470. req, _ := http.NewRequest("POST", urls, body)
  3471. googleapi.Expand(req.URL, map[string]string{
  3472. "project": c.project,
  3473. "instance": c.instance,
  3474. })
  3475. req.Header.Set("Content-Type", ctype)
  3476. req.Header.Set("User-Agent", c.s.userAgent())
  3477. if c.ctx_ != nil {
  3478. return ctxhttp.Do(c.ctx_, c.s.client, req)
  3479. }
  3480. return c.s.client.Do(req)
  3481. }
  3482. // Do executes the "sql.instances.import" call.
  3483. // Exactly one of *Operation or error will be non-nil. Any non-2xx
  3484. // status code is an error. Response headers are in either
  3485. // *Operation.ServerResponse.Header or (if a response was returned at
  3486. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  3487. // to check whether the returned error was because
  3488. // http.StatusNotModified was returned.
  3489. func (c *InstancesImportCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  3490. gensupport.SetOptions(c.urlParams_, opts...)
  3491. res, err := c.doRequest("json")
  3492. if res != nil && res.StatusCode == http.StatusNotModified {
  3493. if res.Body != nil {
  3494. res.Body.Close()
  3495. }
  3496. return nil, &googleapi.Error{
  3497. Code: res.StatusCode,
  3498. Header: res.Header,
  3499. }
  3500. }
  3501. if err != nil {
  3502. return nil, err
  3503. }
  3504. defer googleapi.CloseBody(res)
  3505. if err := googleapi.CheckResponse(res); err != nil {
  3506. return nil, err
  3507. }
  3508. ret := &Operation{
  3509. ServerResponse: googleapi.ServerResponse{
  3510. Header: res.Header,
  3511. HTTPStatusCode: res.StatusCode,
  3512. },
  3513. }
  3514. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  3515. return nil, err
  3516. }
  3517. return ret, nil
  3518. // {
  3519. // "description": "Imports data into a Cloud SQL instance from a MySQL dump file in Google Cloud Storage.",
  3520. // "httpMethod": "POST",
  3521. // "id": "sql.instances.import",
  3522. // "parameterOrder": [
  3523. // "project",
  3524. // "instance"
  3525. // ],
  3526. // "parameters": {
  3527. // "instance": {
  3528. // "description": "Cloud SQL instance ID. This does not include the project ID.",
  3529. // "location": "path",
  3530. // "required": true,
  3531. // "type": "string"
  3532. // },
  3533. // "project": {
  3534. // "description": "Project ID of the project that contains the instance.",
  3535. // "location": "path",
  3536. // "required": true,
  3537. // "type": "string"
  3538. // }
  3539. // },
  3540. // "path": "projects/{project}/instances/{instance}/import",
  3541. // "request": {
  3542. // "$ref": "InstancesImportRequest"
  3543. // },
  3544. // "response": {
  3545. // "$ref": "Operation"
  3546. // },
  3547. // "scopes": [
  3548. // "https://www.googleapis.com/auth/cloud-platform"
  3549. // ]
  3550. // }
  3551. }
  3552. // method id "sql.instances.insert":
  3553. type InstancesInsertCall struct {
  3554. s *Service
  3555. project string
  3556. databaseinstance *DatabaseInstance
  3557. urlParams_ gensupport.URLParams
  3558. ctx_ context.Context
  3559. }
  3560. // Insert: Creates a new Cloud SQL instance.
  3561. func (r *InstancesService) Insert(project string, databaseinstance *DatabaseInstance) *InstancesInsertCall {
  3562. c := &InstancesInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3563. c.project = project
  3564. c.databaseinstance = databaseinstance
  3565. return c
  3566. }
  3567. // Fields allows partial responses to be retrieved. See
  3568. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3569. // for more information.
  3570. func (c *InstancesInsertCall) Fields(s ...googleapi.Field) *InstancesInsertCall {
  3571. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3572. return c
  3573. }
  3574. // Context sets the context to be used in this call's Do method. Any
  3575. // pending HTTP request will be aborted if the provided context is
  3576. // canceled.
  3577. func (c *InstancesInsertCall) Context(ctx context.Context) *InstancesInsertCall {
  3578. c.ctx_ = ctx
  3579. return c
  3580. }
  3581. func (c *InstancesInsertCall) doRequest(alt string) (*http.Response, error) {
  3582. var body io.Reader = nil
  3583. body, err := googleapi.WithoutDataWrapper.JSONReader(c.databaseinstance)
  3584. if err != nil {
  3585. return nil, err
  3586. }
  3587. ctype := "application/json"
  3588. c.urlParams_.Set("alt", alt)
  3589. urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/instances")
  3590. urls += "?" + c.urlParams_.Encode()
  3591. req, _ := http.NewRequest("POST", urls, body)
  3592. googleapi.Expand(req.URL, map[string]string{
  3593. "project": c.project,
  3594. })
  3595. req.Header.Set("Content-Type", ctype)
  3596. req.Header.Set("User-Agent", c.s.userAgent())
  3597. if c.ctx_ != nil {
  3598. return ctxhttp.Do(c.ctx_, c.s.client, req)
  3599. }
  3600. return c.s.client.Do(req)
  3601. }
  3602. // Do executes the "sql.instances.insert" call.
  3603. // Exactly one of *Operation or error will be non-nil. Any non-2xx
  3604. // status code is an error. Response headers are in either
  3605. // *Operation.ServerResponse.Header or (if a response was returned at
  3606. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  3607. // to check whether the returned error was because
  3608. // http.StatusNotModified was returned.
  3609. func (c *InstancesInsertCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  3610. gensupport.SetOptions(c.urlParams_, opts...)
  3611. res, err := c.doRequest("json")
  3612. if res != nil && res.StatusCode == http.StatusNotModified {
  3613. if res.Body != nil {
  3614. res.Body.Close()
  3615. }
  3616. return nil, &googleapi.Error{
  3617. Code: res.StatusCode,
  3618. Header: res.Header,
  3619. }
  3620. }
  3621. if err != nil {
  3622. return nil, err
  3623. }
  3624. defer googleapi.CloseBody(res)
  3625. if err := googleapi.CheckResponse(res); err != nil {
  3626. return nil, err
  3627. }
  3628. ret := &Operation{
  3629. ServerResponse: googleapi.ServerResponse{
  3630. Header: res.Header,
  3631. HTTPStatusCode: res.StatusCode,
  3632. },
  3633. }
  3634. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  3635. return nil, err
  3636. }
  3637. return ret, nil
  3638. // {
  3639. // "description": "Creates a new Cloud SQL instance.",
  3640. // "httpMethod": "POST",
  3641. // "id": "sql.instances.insert",
  3642. // "parameterOrder": [
  3643. // "project"
  3644. // ],
  3645. // "parameters": {
  3646. // "project": {
  3647. // "description": "Project ID of the project to which the newly created Cloud SQL instances should belong.",
  3648. // "location": "path",
  3649. // "required": true,
  3650. // "type": "string"
  3651. // }
  3652. // },
  3653. // "path": "projects/{project}/instances",
  3654. // "request": {
  3655. // "$ref": "DatabaseInstance"
  3656. // },
  3657. // "response": {
  3658. // "$ref": "Operation"
  3659. // },
  3660. // "scopes": [
  3661. // "https://www.googleapis.com/auth/cloud-platform",
  3662. // "https://www.googleapis.com/auth/sqlservice.admin"
  3663. // ]
  3664. // }
  3665. }
  3666. // method id "sql.instances.list":
  3667. type InstancesListCall struct {
  3668. s *Service
  3669. project string
  3670. urlParams_ gensupport.URLParams
  3671. ifNoneMatch_ string
  3672. ctx_ context.Context
  3673. }
  3674. // List: Lists instances under a given project in the alphabetical order
  3675. // of the instance name.
  3676. func (r *InstancesService) List(project string) *InstancesListCall {
  3677. c := &InstancesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3678. c.project = project
  3679. return c
  3680. }
  3681. // MaxResults sets the optional parameter "maxResults": The maximum
  3682. // number of results to return per response.
  3683. func (c *InstancesListCall) MaxResults(maxResults int64) *InstancesListCall {
  3684. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  3685. return c
  3686. }
  3687. // PageToken sets the optional parameter "pageToken": A
  3688. // previously-returned page token representing part of the larger set of
  3689. // results to view.
  3690. func (c *InstancesListCall) PageToken(pageToken string) *InstancesListCall {
  3691. c.urlParams_.Set("pageToken", pageToken)
  3692. return c
  3693. }
  3694. // Fields allows partial responses to be retrieved. See
  3695. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3696. // for more information.
  3697. func (c *InstancesListCall) Fields(s ...googleapi.Field) *InstancesListCall {
  3698. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3699. return c
  3700. }
  3701. // IfNoneMatch sets the optional parameter which makes the operation
  3702. // fail if the object's ETag matches the given value. This is useful for
  3703. // getting updates only after the object has changed since the last
  3704. // request. Use googleapi.IsNotModified to check whether the response
  3705. // error from Do is the result of In-None-Match.
  3706. func (c *InstancesListCall) IfNoneMatch(entityTag string) *InstancesListCall {
  3707. c.ifNoneMatch_ = entityTag
  3708. return c
  3709. }
  3710. // Context sets the context to be used in this call's Do method. Any
  3711. // pending HTTP request will be aborted if the provided context is
  3712. // canceled.
  3713. func (c *InstancesListCall) Context(ctx context.Context) *InstancesListCall {
  3714. c.ctx_ = ctx
  3715. return c
  3716. }
  3717. func (c *InstancesListCall) doRequest(alt string) (*http.Response, error) {
  3718. var body io.Reader = nil
  3719. c.urlParams_.Set("alt", alt)
  3720. urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/instances")
  3721. urls += "?" + c.urlParams_.Encode()
  3722. req, _ := http.NewRequest("GET", urls, body)
  3723. googleapi.Expand(req.URL, map[string]string{
  3724. "project": c.project,
  3725. })
  3726. req.Header.Set("User-Agent", c.s.userAgent())
  3727. if c.ifNoneMatch_ != "" {
  3728. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  3729. }
  3730. if c.ctx_ != nil {
  3731. return ctxhttp.Do(c.ctx_, c.s.client, req)
  3732. }
  3733. return c.s.client.Do(req)
  3734. }
  3735. // Do executes the "sql.instances.list" call.
  3736. // Exactly one of *InstancesListResponse or error will be non-nil. Any
  3737. // non-2xx status code is an error. Response headers are in either
  3738. // *InstancesListResponse.ServerResponse.Header or (if a response was
  3739. // returned at all) in error.(*googleapi.Error).Header. Use
  3740. // googleapi.IsNotModified to check whether the returned error was
  3741. // because http.StatusNotModified was returned.
  3742. func (c *InstancesListCall) Do(opts ...googleapi.CallOption) (*InstancesListResponse, error) {
  3743. gensupport.SetOptions(c.urlParams_, opts...)
  3744. res, err := c.doRequest("json")
  3745. if res != nil && res.StatusCode == http.StatusNotModified {
  3746. if res.Body != nil {
  3747. res.Body.Close()
  3748. }
  3749. return nil, &googleapi.Error{
  3750. Code: res.StatusCode,
  3751. Header: res.Header,
  3752. }
  3753. }
  3754. if err != nil {
  3755. return nil, err
  3756. }
  3757. defer googleapi.CloseBody(res)
  3758. if err := googleapi.CheckResponse(res); err != nil {
  3759. return nil, err
  3760. }
  3761. ret := &InstancesListResponse{
  3762. ServerResponse: googleapi.ServerResponse{
  3763. Header: res.Header,
  3764. HTTPStatusCode: res.StatusCode,
  3765. },
  3766. }
  3767. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  3768. return nil, err
  3769. }
  3770. return ret, nil
  3771. // {
  3772. // "description": "Lists instances under a given project in the alphabetical order of the instance name.",
  3773. // "httpMethod": "GET",
  3774. // "id": "sql.instances.list",
  3775. // "parameterOrder": [
  3776. // "project"
  3777. // ],
  3778. // "parameters": {
  3779. // "maxResults": {
  3780. // "description": "The maximum number of results to return per response.",
  3781. // "format": "uint32",
  3782. // "location": "query",
  3783. // "type": "integer"
  3784. // },
  3785. // "pageToken": {
  3786. // "description": "A previously-returned page token representing part of the larger set of results to view.",
  3787. // "location": "query",
  3788. // "type": "string"
  3789. // },
  3790. // "project": {
  3791. // "description": "Project ID of the project for which to list Cloud SQL instances.",
  3792. // "location": "path",
  3793. // "required": true,
  3794. // "type": "string"
  3795. // }
  3796. // },
  3797. // "path": "projects/{project}/instances",
  3798. // "response": {
  3799. // "$ref": "InstancesListResponse"
  3800. // },
  3801. // "scopes": [
  3802. // "https://www.googleapis.com/auth/cloud-platform",
  3803. // "https://www.googleapis.com/auth/sqlservice.admin"
  3804. // ]
  3805. // }
  3806. }
  3807. // Pages invokes f for each page of results.
  3808. // A non-nil error returned from f will halt the iteration.
  3809. // The provided context supersedes any context provided to the Context method.
  3810. func (c *InstancesListCall) Pages(ctx context.Context, f func(*InstancesListResponse) error) error {
  3811. c.ctx_ = ctx
  3812. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  3813. for {
  3814. x, err := c.Do()
  3815. if err != nil {
  3816. return err
  3817. }
  3818. if err := f(x); err != nil {
  3819. return err
  3820. }
  3821. if x.NextPageToken == "" {
  3822. return nil
  3823. }
  3824. c.PageToken(x.NextPageToken)
  3825. }
  3826. }
  3827. // method id "sql.instances.patch":
  3828. type InstancesPatchCall struct {
  3829. s *Service
  3830. project string
  3831. instance string
  3832. databaseinstance *DatabaseInstance
  3833. urlParams_ gensupport.URLParams
  3834. ctx_ context.Context
  3835. }
  3836. // Patch: Updates settings of a Cloud SQL instance. Caution: This is not
  3837. // a partial update, so you must include values for all the settings
  3838. // that you want to retain. For partial updates, use patch.. This method
  3839. // supports patch semantics.
  3840. func (r *InstancesService) Patch(project string, instance string, databaseinstance *DatabaseInstance) *InstancesPatchCall {
  3841. c := &InstancesPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3842. c.project = project
  3843. c.instance = instance
  3844. c.databaseinstance = databaseinstance
  3845. return c
  3846. }
  3847. // Fields allows partial responses to be retrieved. See
  3848. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3849. // for more information.
  3850. func (c *InstancesPatchCall) Fields(s ...googleapi.Field) *InstancesPatchCall {
  3851. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3852. return c
  3853. }
  3854. // Context sets the context to be used in this call's Do method. Any
  3855. // pending HTTP request will be aborted if the provided context is
  3856. // canceled.
  3857. func (c *InstancesPatchCall) Context(ctx context.Context) *InstancesPatchCall {
  3858. c.ctx_ = ctx
  3859. return c
  3860. }
  3861. func (c *InstancesPatchCall) doRequest(alt string) (*http.Response, error) {
  3862. var body io.Reader = nil
  3863. body, err := googleapi.WithoutDataWrapper.JSONReader(c.databaseinstance)
  3864. if err != nil {
  3865. return nil, err
  3866. }
  3867. ctype := "application/json"
  3868. c.urlParams_.Set("alt", alt)
  3869. urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/instances/{instance}")
  3870. urls += "?" + c.urlParams_.Encode()
  3871. req, _ := http.NewRequest("PATCH", urls, body)
  3872. googleapi.Expand(req.URL, map[string]string{
  3873. "project": c.project,
  3874. "instance": c.instance,
  3875. })
  3876. req.Header.Set("Content-Type", ctype)
  3877. req.Header.Set("User-Agent", c.s.userAgent())
  3878. if c.ctx_ != nil {
  3879. return ctxhttp.Do(c.ctx_, c.s.client, req)
  3880. }
  3881. return c.s.client.Do(req)
  3882. }
  3883. // Do executes the "sql.instances.patch" call.
  3884. // Exactly one of *Operation or error will be non-nil. Any non-2xx
  3885. // status code is an error. Response headers are in either
  3886. // *Operation.ServerResponse.Header or (if a response was returned at
  3887. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  3888. // to check whether the returned error was because
  3889. // http.StatusNotModified was returned.
  3890. func (c *InstancesPatchCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  3891. gensupport.SetOptions(c.urlParams_, opts...)
  3892. res, err := c.doRequest("json")
  3893. if res != nil && res.StatusCode == http.StatusNotModified {
  3894. if res.Body != nil {
  3895. res.Body.Close()
  3896. }
  3897. return nil, &googleapi.Error{
  3898. Code: res.StatusCode,
  3899. Header: res.Header,
  3900. }
  3901. }
  3902. if err != nil {
  3903. return nil, err
  3904. }
  3905. defer googleapi.CloseBody(res)
  3906. if err := googleapi.CheckResponse(res); err != nil {
  3907. return nil, err
  3908. }
  3909. ret := &Operation{
  3910. ServerResponse: googleapi.ServerResponse{
  3911. Header: res.Header,
  3912. HTTPStatusCode: res.StatusCode,
  3913. },
  3914. }
  3915. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  3916. return nil, err
  3917. }
  3918. return ret, nil
  3919. // {
  3920. // "description": "Updates settings of a Cloud SQL instance. Caution: This is not a partial update, so you must include values for all the settings that you want to retain. For partial updates, use patch.. This method supports patch semantics.",
  3921. // "httpMethod": "PATCH",
  3922. // "id": "sql.instances.patch",
  3923. // "parameterOrder": [
  3924. // "project",
  3925. // "instance"
  3926. // ],
  3927. // "parameters": {
  3928. // "instance": {
  3929. // "description": "Cloud SQL instance ID. This does not include the project ID.",
  3930. // "location": "path",
  3931. // "required": true,
  3932. // "type": "string"
  3933. // },
  3934. // "project": {
  3935. // "description": "Project ID of the project that contains the instance.",
  3936. // "location": "path",
  3937. // "required": true,
  3938. // "type": "string"
  3939. // }
  3940. // },
  3941. // "path": "projects/{project}/instances/{instance}",
  3942. // "request": {
  3943. // "$ref": "DatabaseInstance"
  3944. // },
  3945. // "response": {
  3946. // "$ref": "Operation"
  3947. // },
  3948. // "scopes": [
  3949. // "https://www.googleapis.com/auth/cloud-platform",
  3950. // "https://www.googleapis.com/auth/sqlservice.admin"
  3951. // ]
  3952. // }
  3953. }
  3954. // method id "sql.instances.promoteReplica":
  3955. type InstancesPromoteReplicaCall struct {
  3956. s *Service
  3957. project string
  3958. instance string
  3959. urlParams_ gensupport.URLParams
  3960. ctx_ context.Context
  3961. }
  3962. // PromoteReplica: Promotes the read replica instance to be a
  3963. // stand-alone Cloud SQL instance.
  3964. func (r *InstancesService) PromoteReplica(project string, instance string) *InstancesPromoteReplicaCall {
  3965. c := &InstancesPromoteReplicaCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3966. c.project = project
  3967. c.instance = instance
  3968. return c
  3969. }
  3970. // Fields allows partial responses to be retrieved. See
  3971. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3972. // for more information.
  3973. func (c *InstancesPromoteReplicaCall) Fields(s ...googleapi.Field) *InstancesPromoteReplicaCall {
  3974. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3975. return c
  3976. }
  3977. // Context sets the context to be used in this call's Do method. Any
  3978. // pending HTTP request will be aborted if the provided context is
  3979. // canceled.
  3980. func (c *InstancesPromoteReplicaCall) Context(ctx context.Context) *InstancesPromoteReplicaCall {
  3981. c.ctx_ = ctx
  3982. return c
  3983. }
  3984. func (c *InstancesPromoteReplicaCall) doRequest(alt string) (*http.Response, error) {
  3985. var body io.Reader = nil
  3986. c.urlParams_.Set("alt", alt)
  3987. urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/instances/{instance}/promoteReplica")
  3988. urls += "?" + c.urlParams_.Encode()
  3989. req, _ := http.NewRequest("POST", urls, body)
  3990. googleapi.Expand(req.URL, map[string]string{
  3991. "project": c.project,
  3992. "instance": c.instance,
  3993. })
  3994. req.Header.Set("User-Agent", c.s.userAgent())
  3995. if c.ctx_ != nil {
  3996. return ctxhttp.Do(c.ctx_, c.s.client, req)
  3997. }
  3998. return c.s.client.Do(req)
  3999. }
  4000. // Do executes the "sql.instances.promoteReplica" call.
  4001. // Exactly one of *Operation or error will be non-nil. Any non-2xx
  4002. // status code is an error. Response headers are in either
  4003. // *Operation.ServerResponse.Header or (if a response was returned at
  4004. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  4005. // to check whether the returned error was because
  4006. // http.StatusNotModified was returned.
  4007. func (c *InstancesPromoteReplicaCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  4008. gensupport.SetOptions(c.urlParams_, opts...)
  4009. res, err := c.doRequest("json")
  4010. if res != nil && res.StatusCode == http.StatusNotModified {
  4011. if res.Body != nil {
  4012. res.Body.Close()
  4013. }
  4014. return nil, &googleapi.Error{
  4015. Code: res.StatusCode,
  4016. Header: res.Header,
  4017. }
  4018. }
  4019. if err != nil {
  4020. return nil, err
  4021. }
  4022. defer googleapi.CloseBody(res)
  4023. if err := googleapi.CheckResponse(res); err != nil {
  4024. return nil, err
  4025. }
  4026. ret := &Operation{
  4027. ServerResponse: googleapi.ServerResponse{
  4028. Header: res.Header,
  4029. HTTPStatusCode: res.StatusCode,
  4030. },
  4031. }
  4032. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  4033. return nil, err
  4034. }
  4035. return ret, nil
  4036. // {
  4037. // "description": "Promotes the read replica instance to be a stand-alone Cloud SQL instance.",
  4038. // "httpMethod": "POST",
  4039. // "id": "sql.instances.promoteReplica",
  4040. // "parameterOrder": [
  4041. // "project",
  4042. // "instance"
  4043. // ],
  4044. // "parameters": {
  4045. // "instance": {
  4046. // "description": "Cloud SQL read replica instance name.",
  4047. // "location": "path",
  4048. // "required": true,
  4049. // "type": "string"
  4050. // },
  4051. // "project": {
  4052. // "description": "ID of the project that contains the read replica.",
  4053. // "location": "path",
  4054. // "required": true,
  4055. // "type": "string"
  4056. // }
  4057. // },
  4058. // "path": "projects/{project}/instances/{instance}/promoteReplica",
  4059. // "response": {
  4060. // "$ref": "Operation"
  4061. // },
  4062. // "scopes": [
  4063. // "https://www.googleapis.com/auth/cloud-platform",
  4064. // "https://www.googleapis.com/auth/sqlservice.admin"
  4065. // ]
  4066. // }
  4067. }
  4068. // method id "sql.instances.resetSslConfig":
  4069. type InstancesResetSslConfigCall struct {
  4070. s *Service
  4071. project string
  4072. instance string
  4073. urlParams_ gensupport.URLParams
  4074. ctx_ context.Context
  4075. }
  4076. // ResetSslConfig: Deletes all client certificates and generates a new
  4077. // server SSL certificate for the instance. The changes will not take
  4078. // effect until the instance is restarted. Existing instances without a
  4079. // server certificate will need to call this once to set a server
  4080. // certificate.
  4081. func (r *InstancesService) ResetSslConfig(project string, instance string) *InstancesResetSslConfigCall {
  4082. c := &InstancesResetSslConfigCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4083. c.project = project
  4084. c.instance = instance
  4085. return c
  4086. }
  4087. // Fields allows partial responses to be retrieved. See
  4088. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4089. // for more information.
  4090. func (c *InstancesResetSslConfigCall) Fields(s ...googleapi.Field) *InstancesResetSslConfigCall {
  4091. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4092. return c
  4093. }
  4094. // Context sets the context to be used in this call's Do method. Any
  4095. // pending HTTP request will be aborted if the provided context is
  4096. // canceled.
  4097. func (c *InstancesResetSslConfigCall) Context(ctx context.Context) *InstancesResetSslConfigCall {
  4098. c.ctx_ = ctx
  4099. return c
  4100. }
  4101. func (c *InstancesResetSslConfigCall) doRequest(alt string) (*http.Response, error) {
  4102. var body io.Reader = nil
  4103. c.urlParams_.Set("alt", alt)
  4104. urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/instances/{instance}/resetSslConfig")
  4105. urls += "?" + c.urlParams_.Encode()
  4106. req, _ := http.NewRequest("POST", urls, body)
  4107. googleapi.Expand(req.URL, map[string]string{
  4108. "project": c.project,
  4109. "instance": c.instance,
  4110. })
  4111. req.Header.Set("User-Agent", c.s.userAgent())
  4112. if c.ctx_ != nil {
  4113. return ctxhttp.Do(c.ctx_, c.s.client, req)
  4114. }
  4115. return c.s.client.Do(req)
  4116. }
  4117. // Do executes the "sql.instances.resetSslConfig" call.
  4118. // Exactly one of *Operation or error will be non-nil. Any non-2xx
  4119. // status code is an error. Response headers are in either
  4120. // *Operation.ServerResponse.Header or (if a response was returned at
  4121. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  4122. // to check whether the returned error was because
  4123. // http.StatusNotModified was returned.
  4124. func (c *InstancesResetSslConfigCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  4125. gensupport.SetOptions(c.urlParams_, opts...)
  4126. res, err := c.doRequest("json")
  4127. if res != nil && res.StatusCode == http.StatusNotModified {
  4128. if res.Body != nil {
  4129. res.Body.Close()
  4130. }
  4131. return nil, &googleapi.Error{
  4132. Code: res.StatusCode,
  4133. Header: res.Header,
  4134. }
  4135. }
  4136. if err != nil {
  4137. return nil, err
  4138. }
  4139. defer googleapi.CloseBody(res)
  4140. if err := googleapi.CheckResponse(res); err != nil {
  4141. return nil, err
  4142. }
  4143. ret := &Operation{
  4144. ServerResponse: googleapi.ServerResponse{
  4145. Header: res.Header,
  4146. HTTPStatusCode: res.StatusCode,
  4147. },
  4148. }
  4149. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  4150. return nil, err
  4151. }
  4152. return ret, nil
  4153. // {
  4154. // "description": "Deletes all client certificates and generates a new server SSL certificate for the instance. The changes will not take effect until the instance is restarted. Existing instances without a server certificate will need to call this once to set a server certificate.",
  4155. // "httpMethod": "POST",
  4156. // "id": "sql.instances.resetSslConfig",
  4157. // "parameterOrder": [
  4158. // "project",
  4159. // "instance"
  4160. // ],
  4161. // "parameters": {
  4162. // "instance": {
  4163. // "description": "Cloud SQL instance ID. This does not include the project ID.",
  4164. // "location": "path",
  4165. // "required": true,
  4166. // "type": "string"
  4167. // },
  4168. // "project": {
  4169. // "description": "Project ID of the project that contains the instance.",
  4170. // "location": "path",
  4171. // "required": true,
  4172. // "type": "string"
  4173. // }
  4174. // },
  4175. // "path": "projects/{project}/instances/{instance}/resetSslConfig",
  4176. // "response": {
  4177. // "$ref": "Operation"
  4178. // },
  4179. // "scopes": [
  4180. // "https://www.googleapis.com/auth/cloud-platform",
  4181. // "https://www.googleapis.com/auth/sqlservice.admin"
  4182. // ]
  4183. // }
  4184. }
  4185. // method id "sql.instances.restart":
  4186. type InstancesRestartCall struct {
  4187. s *Service
  4188. project string
  4189. instance string
  4190. urlParams_ gensupport.URLParams
  4191. ctx_ context.Context
  4192. }
  4193. // Restart: Restarts a Cloud SQL instance.
  4194. func (r *InstancesService) Restart(project string, instance string) *InstancesRestartCall {
  4195. c := &InstancesRestartCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4196. c.project = project
  4197. c.instance = instance
  4198. return c
  4199. }
  4200. // Fields allows partial responses to be retrieved. See
  4201. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4202. // for more information.
  4203. func (c *InstancesRestartCall) Fields(s ...googleapi.Field) *InstancesRestartCall {
  4204. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4205. return c
  4206. }
  4207. // Context sets the context to be used in this call's Do method. Any
  4208. // pending HTTP request will be aborted if the provided context is
  4209. // canceled.
  4210. func (c *InstancesRestartCall) Context(ctx context.Context) *InstancesRestartCall {
  4211. c.ctx_ = ctx
  4212. return c
  4213. }
  4214. func (c *InstancesRestartCall) doRequest(alt string) (*http.Response, error) {
  4215. var body io.Reader = nil
  4216. c.urlParams_.Set("alt", alt)
  4217. urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/instances/{instance}/restart")
  4218. urls += "?" + c.urlParams_.Encode()
  4219. req, _ := http.NewRequest("POST", urls, body)
  4220. googleapi.Expand(req.URL, map[string]string{
  4221. "project": c.project,
  4222. "instance": c.instance,
  4223. })
  4224. req.Header.Set("User-Agent", c.s.userAgent())
  4225. if c.ctx_ != nil {
  4226. return ctxhttp.Do(c.ctx_, c.s.client, req)
  4227. }
  4228. return c.s.client.Do(req)
  4229. }
  4230. // Do executes the "sql.instances.restart" call.
  4231. // Exactly one of *Operation or error will be non-nil. Any non-2xx
  4232. // status code is an error. Response headers are in either
  4233. // *Operation.ServerResponse.Header or (if a response was returned at
  4234. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  4235. // to check whether the returned error was because
  4236. // http.StatusNotModified was returned.
  4237. func (c *InstancesRestartCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  4238. gensupport.SetOptions(c.urlParams_, opts...)
  4239. res, err := c.doRequest("json")
  4240. if res != nil && res.StatusCode == http.StatusNotModified {
  4241. if res.Body != nil {
  4242. res.Body.Close()
  4243. }
  4244. return nil, &googleapi.Error{
  4245. Code: res.StatusCode,
  4246. Header: res.Header,
  4247. }
  4248. }
  4249. if err != nil {
  4250. return nil, err
  4251. }
  4252. defer googleapi.CloseBody(res)
  4253. if err := googleapi.CheckResponse(res); err != nil {
  4254. return nil, err
  4255. }
  4256. ret := &Operation{
  4257. ServerResponse: googleapi.ServerResponse{
  4258. Header: res.Header,
  4259. HTTPStatusCode: res.StatusCode,
  4260. },
  4261. }
  4262. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  4263. return nil, err
  4264. }
  4265. return ret, nil
  4266. // {
  4267. // "description": "Restarts a Cloud SQL instance.",
  4268. // "httpMethod": "POST",
  4269. // "id": "sql.instances.restart",
  4270. // "parameterOrder": [
  4271. // "project",
  4272. // "instance"
  4273. // ],
  4274. // "parameters": {
  4275. // "instance": {
  4276. // "description": "Cloud SQL instance ID. This does not include the project ID.",
  4277. // "location": "path",
  4278. // "required": true,
  4279. // "type": "string"
  4280. // },
  4281. // "project": {
  4282. // "description": "Project ID of the project that contains the instance to be restarted.",
  4283. // "location": "path",
  4284. // "required": true,
  4285. // "type": "string"
  4286. // }
  4287. // },
  4288. // "path": "projects/{project}/instances/{instance}/restart",
  4289. // "response": {
  4290. // "$ref": "Operation"
  4291. // },
  4292. // "scopes": [
  4293. // "https://www.googleapis.com/auth/cloud-platform",
  4294. // "https://www.googleapis.com/auth/sqlservice.admin"
  4295. // ]
  4296. // }
  4297. }
  4298. // method id "sql.instances.restoreBackup":
  4299. type InstancesRestoreBackupCall struct {
  4300. s *Service
  4301. project string
  4302. instance string
  4303. instancesrestorebackuprequest *InstancesRestoreBackupRequest
  4304. urlParams_ gensupport.URLParams
  4305. ctx_ context.Context
  4306. }
  4307. // RestoreBackup: Restores a backup of a Cloud SQL instance.
  4308. func (r *InstancesService) RestoreBackup(project string, instance string, instancesrestorebackuprequest *InstancesRestoreBackupRequest) *InstancesRestoreBackupCall {
  4309. c := &InstancesRestoreBackupCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4310. c.project = project
  4311. c.instance = instance
  4312. c.instancesrestorebackuprequest = instancesrestorebackuprequest
  4313. return c
  4314. }
  4315. // Fields allows partial responses to be retrieved. See
  4316. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4317. // for more information.
  4318. func (c *InstancesRestoreBackupCall) Fields(s ...googleapi.Field) *InstancesRestoreBackupCall {
  4319. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4320. return c
  4321. }
  4322. // Context sets the context to be used in this call's Do method. Any
  4323. // pending HTTP request will be aborted if the provided context is
  4324. // canceled.
  4325. func (c *InstancesRestoreBackupCall) Context(ctx context.Context) *InstancesRestoreBackupCall {
  4326. c.ctx_ = ctx
  4327. return c
  4328. }
  4329. func (c *InstancesRestoreBackupCall) doRequest(alt string) (*http.Response, error) {
  4330. var body io.Reader = nil
  4331. body, err := googleapi.WithoutDataWrapper.JSONReader(c.instancesrestorebackuprequest)
  4332. if err != nil {
  4333. return nil, err
  4334. }
  4335. ctype := "application/json"
  4336. c.urlParams_.Set("alt", alt)
  4337. urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/instances/{instance}/restoreBackup")
  4338. urls += "?" + c.urlParams_.Encode()
  4339. req, _ := http.NewRequest("POST", urls, body)
  4340. googleapi.Expand(req.URL, map[string]string{
  4341. "project": c.project,
  4342. "instance": c.instance,
  4343. })
  4344. req.Header.Set("Content-Type", ctype)
  4345. req.Header.Set("User-Agent", c.s.userAgent())
  4346. if c.ctx_ != nil {
  4347. return ctxhttp.Do(c.ctx_, c.s.client, req)
  4348. }
  4349. return c.s.client.Do(req)
  4350. }
  4351. // Do executes the "sql.instances.restoreBackup" call.
  4352. // Exactly one of *Operation or error will be non-nil. Any non-2xx
  4353. // status code is an error. Response headers are in either
  4354. // *Operation.ServerResponse.Header or (if a response was returned at
  4355. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  4356. // to check whether the returned error was because
  4357. // http.StatusNotModified was returned.
  4358. func (c *InstancesRestoreBackupCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  4359. gensupport.SetOptions(c.urlParams_, opts...)
  4360. res, err := c.doRequest("json")
  4361. if res != nil && res.StatusCode == http.StatusNotModified {
  4362. if res.Body != nil {
  4363. res.Body.Close()
  4364. }
  4365. return nil, &googleapi.Error{
  4366. Code: res.StatusCode,
  4367. Header: res.Header,
  4368. }
  4369. }
  4370. if err != nil {
  4371. return nil, err
  4372. }
  4373. defer googleapi.CloseBody(res)
  4374. if err := googleapi.CheckResponse(res); err != nil {
  4375. return nil, err
  4376. }
  4377. ret := &Operation{
  4378. ServerResponse: googleapi.ServerResponse{
  4379. Header: res.Header,
  4380. HTTPStatusCode: res.StatusCode,
  4381. },
  4382. }
  4383. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  4384. return nil, err
  4385. }
  4386. return ret, nil
  4387. // {
  4388. // "description": "Restores a backup of a Cloud SQL instance.",
  4389. // "httpMethod": "POST",
  4390. // "id": "sql.instances.restoreBackup",
  4391. // "parameterOrder": [
  4392. // "project",
  4393. // "instance"
  4394. // ],
  4395. // "parameters": {
  4396. // "instance": {
  4397. // "description": "Cloud SQL instance ID. This does not include the project ID.",
  4398. // "location": "path",
  4399. // "required": true,
  4400. // "type": "string"
  4401. // },
  4402. // "project": {
  4403. // "description": "Project ID of the project that contains the instance.",
  4404. // "location": "path",
  4405. // "required": true,
  4406. // "type": "string"
  4407. // }
  4408. // },
  4409. // "path": "projects/{project}/instances/{instance}/restoreBackup",
  4410. // "request": {
  4411. // "$ref": "InstancesRestoreBackupRequest"
  4412. // },
  4413. // "response": {
  4414. // "$ref": "Operation"
  4415. // },
  4416. // "scopes": [
  4417. // "https://www.googleapis.com/auth/cloud-platform",
  4418. // "https://www.googleapis.com/auth/sqlservice.admin"
  4419. // ]
  4420. // }
  4421. }
  4422. // method id "sql.instances.startReplica":
  4423. type InstancesStartReplicaCall struct {
  4424. s *Service
  4425. project string
  4426. instance string
  4427. urlParams_ gensupport.URLParams
  4428. ctx_ context.Context
  4429. }
  4430. // StartReplica: Starts the replication in the read replica instance.
  4431. func (r *InstancesService) StartReplica(project string, instance string) *InstancesStartReplicaCall {
  4432. c := &InstancesStartReplicaCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4433. c.project = project
  4434. c.instance = instance
  4435. return c
  4436. }
  4437. // Fields allows partial responses to be retrieved. See
  4438. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4439. // for more information.
  4440. func (c *InstancesStartReplicaCall) Fields(s ...googleapi.Field) *InstancesStartReplicaCall {
  4441. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4442. return c
  4443. }
  4444. // Context sets the context to be used in this call's Do method. Any
  4445. // pending HTTP request will be aborted if the provided context is
  4446. // canceled.
  4447. func (c *InstancesStartReplicaCall) Context(ctx context.Context) *InstancesStartReplicaCall {
  4448. c.ctx_ = ctx
  4449. return c
  4450. }
  4451. func (c *InstancesStartReplicaCall) doRequest(alt string) (*http.Response, error) {
  4452. var body io.Reader = nil
  4453. c.urlParams_.Set("alt", alt)
  4454. urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/instances/{instance}/startReplica")
  4455. urls += "?" + c.urlParams_.Encode()
  4456. req, _ := http.NewRequest("POST", urls, body)
  4457. googleapi.Expand(req.URL, map[string]string{
  4458. "project": c.project,
  4459. "instance": c.instance,
  4460. })
  4461. req.Header.Set("User-Agent", c.s.userAgent())
  4462. if c.ctx_ != nil {
  4463. return ctxhttp.Do(c.ctx_, c.s.client, req)
  4464. }
  4465. return c.s.client.Do(req)
  4466. }
  4467. // Do executes the "sql.instances.startReplica" call.
  4468. // Exactly one of *Operation or error will be non-nil. Any non-2xx
  4469. // status code is an error. Response headers are in either
  4470. // *Operation.ServerResponse.Header or (if a response was returned at
  4471. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  4472. // to check whether the returned error was because
  4473. // http.StatusNotModified was returned.
  4474. func (c *InstancesStartReplicaCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  4475. gensupport.SetOptions(c.urlParams_, opts...)
  4476. res, err := c.doRequest("json")
  4477. if res != nil && res.StatusCode == http.StatusNotModified {
  4478. if res.Body != nil {
  4479. res.Body.Close()
  4480. }
  4481. return nil, &googleapi.Error{
  4482. Code: res.StatusCode,
  4483. Header: res.Header,
  4484. }
  4485. }
  4486. if err != nil {
  4487. return nil, err
  4488. }
  4489. defer googleapi.CloseBody(res)
  4490. if err := googleapi.CheckResponse(res); err != nil {
  4491. return nil, err
  4492. }
  4493. ret := &Operation{
  4494. ServerResponse: googleapi.ServerResponse{
  4495. Header: res.Header,
  4496. HTTPStatusCode: res.StatusCode,
  4497. },
  4498. }
  4499. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  4500. return nil, err
  4501. }
  4502. return ret, nil
  4503. // {
  4504. // "description": "Starts the replication in the read replica instance.",
  4505. // "httpMethod": "POST",
  4506. // "id": "sql.instances.startReplica",
  4507. // "parameterOrder": [
  4508. // "project",
  4509. // "instance"
  4510. // ],
  4511. // "parameters": {
  4512. // "instance": {
  4513. // "description": "Cloud SQL read replica instance name.",
  4514. // "location": "path",
  4515. // "required": true,
  4516. // "type": "string"
  4517. // },
  4518. // "project": {
  4519. // "description": "ID of the project that contains the read replica.",
  4520. // "location": "path",
  4521. // "required": true,
  4522. // "type": "string"
  4523. // }
  4524. // },
  4525. // "path": "projects/{project}/instances/{instance}/startReplica",
  4526. // "response": {
  4527. // "$ref": "Operation"
  4528. // },
  4529. // "scopes": [
  4530. // "https://www.googleapis.com/auth/cloud-platform",
  4531. // "https://www.googleapis.com/auth/sqlservice.admin"
  4532. // ]
  4533. // }
  4534. }
  4535. // method id "sql.instances.stopReplica":
  4536. type InstancesStopReplicaCall struct {
  4537. s *Service
  4538. project string
  4539. instance string
  4540. urlParams_ gensupport.URLParams
  4541. ctx_ context.Context
  4542. }
  4543. // StopReplica: Stops the replication in the read replica instance.
  4544. func (r *InstancesService) StopReplica(project string, instance string) *InstancesStopReplicaCall {
  4545. c := &InstancesStopReplicaCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4546. c.project = project
  4547. c.instance = instance
  4548. return c
  4549. }
  4550. // Fields allows partial responses to be retrieved. See
  4551. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4552. // for more information.
  4553. func (c *InstancesStopReplicaCall) Fields(s ...googleapi.Field) *InstancesStopReplicaCall {
  4554. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4555. return c
  4556. }
  4557. // Context sets the context to be used in this call's Do method. Any
  4558. // pending HTTP request will be aborted if the provided context is
  4559. // canceled.
  4560. func (c *InstancesStopReplicaCall) Context(ctx context.Context) *InstancesStopReplicaCall {
  4561. c.ctx_ = ctx
  4562. return c
  4563. }
  4564. func (c *InstancesStopReplicaCall) doRequest(alt string) (*http.Response, error) {
  4565. var body io.Reader = nil
  4566. c.urlParams_.Set("alt", alt)
  4567. urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/instances/{instance}/stopReplica")
  4568. urls += "?" + c.urlParams_.Encode()
  4569. req, _ := http.NewRequest("POST", urls, body)
  4570. googleapi.Expand(req.URL, map[string]string{
  4571. "project": c.project,
  4572. "instance": c.instance,
  4573. })
  4574. req.Header.Set("User-Agent", c.s.userAgent())
  4575. if c.ctx_ != nil {
  4576. return ctxhttp.Do(c.ctx_, c.s.client, req)
  4577. }
  4578. return c.s.client.Do(req)
  4579. }
  4580. // Do executes the "sql.instances.stopReplica" call.
  4581. // Exactly one of *Operation or error will be non-nil. Any non-2xx
  4582. // status code is an error. Response headers are in either
  4583. // *Operation.ServerResponse.Header or (if a response was returned at
  4584. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  4585. // to check whether the returned error was because
  4586. // http.StatusNotModified was returned.
  4587. func (c *InstancesStopReplicaCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  4588. gensupport.SetOptions(c.urlParams_, opts...)
  4589. res, err := c.doRequest("json")
  4590. if res != nil && res.StatusCode == http.StatusNotModified {
  4591. if res.Body != nil {
  4592. res.Body.Close()
  4593. }
  4594. return nil, &googleapi.Error{
  4595. Code: res.StatusCode,
  4596. Header: res.Header,
  4597. }
  4598. }
  4599. if err != nil {
  4600. return nil, err
  4601. }
  4602. defer googleapi.CloseBody(res)
  4603. if err := googleapi.CheckResponse(res); err != nil {
  4604. return nil, err
  4605. }
  4606. ret := &Operation{
  4607. ServerResponse: googleapi.ServerResponse{
  4608. Header: res.Header,
  4609. HTTPStatusCode: res.StatusCode,
  4610. },
  4611. }
  4612. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  4613. return nil, err
  4614. }
  4615. return ret, nil
  4616. // {
  4617. // "description": "Stops the replication in the read replica instance.",
  4618. // "httpMethod": "POST",
  4619. // "id": "sql.instances.stopReplica",
  4620. // "parameterOrder": [
  4621. // "project",
  4622. // "instance"
  4623. // ],
  4624. // "parameters": {
  4625. // "instance": {
  4626. // "description": "Cloud SQL read replica instance name.",
  4627. // "location": "path",
  4628. // "required": true,
  4629. // "type": "string"
  4630. // },
  4631. // "project": {
  4632. // "description": "ID of the project that contains the read replica.",
  4633. // "location": "path",
  4634. // "required": true,
  4635. // "type": "string"
  4636. // }
  4637. // },
  4638. // "path": "projects/{project}/instances/{instance}/stopReplica",
  4639. // "response": {
  4640. // "$ref": "Operation"
  4641. // },
  4642. // "scopes": [
  4643. // "https://www.googleapis.com/auth/cloud-platform",
  4644. // "https://www.googleapis.com/auth/sqlservice.admin"
  4645. // ]
  4646. // }
  4647. }
  4648. // method id "sql.instances.update":
  4649. type InstancesUpdateCall struct {
  4650. s *Service
  4651. project string
  4652. instance string
  4653. databaseinstance *DatabaseInstance
  4654. urlParams_ gensupport.URLParams
  4655. ctx_ context.Context
  4656. }
  4657. // Update: Updates settings of a Cloud SQL instance. Caution: This is
  4658. // not a partial update, so you must include values for all the settings
  4659. // that you want to retain. For partial updates, use patch.
  4660. func (r *InstancesService) Update(project string, instance string, databaseinstance *DatabaseInstance) *InstancesUpdateCall {
  4661. c := &InstancesUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4662. c.project = project
  4663. c.instance = instance
  4664. c.databaseinstance = databaseinstance
  4665. return c
  4666. }
  4667. // Fields allows partial responses to be retrieved. See
  4668. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4669. // for more information.
  4670. func (c *InstancesUpdateCall) Fields(s ...googleapi.Field) *InstancesUpdateCall {
  4671. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4672. return c
  4673. }
  4674. // Context sets the context to be used in this call's Do method. Any
  4675. // pending HTTP request will be aborted if the provided context is
  4676. // canceled.
  4677. func (c *InstancesUpdateCall) Context(ctx context.Context) *InstancesUpdateCall {
  4678. c.ctx_ = ctx
  4679. return c
  4680. }
  4681. func (c *InstancesUpdateCall) doRequest(alt string) (*http.Response, error) {
  4682. var body io.Reader = nil
  4683. body, err := googleapi.WithoutDataWrapper.JSONReader(c.databaseinstance)
  4684. if err != nil {
  4685. return nil, err
  4686. }
  4687. ctype := "application/json"
  4688. c.urlParams_.Set("alt", alt)
  4689. urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/instances/{instance}")
  4690. urls += "?" + c.urlParams_.Encode()
  4691. req, _ := http.NewRequest("PUT", urls, body)
  4692. googleapi.Expand(req.URL, map[string]string{
  4693. "project": c.project,
  4694. "instance": c.instance,
  4695. })
  4696. req.Header.Set("Content-Type", ctype)
  4697. req.Header.Set("User-Agent", c.s.userAgent())
  4698. if c.ctx_ != nil {
  4699. return ctxhttp.Do(c.ctx_, c.s.client, req)
  4700. }
  4701. return c.s.client.Do(req)
  4702. }
  4703. // Do executes the "sql.instances.update" call.
  4704. // Exactly one of *Operation or error will be non-nil. Any non-2xx
  4705. // status code is an error. Response headers are in either
  4706. // *Operation.ServerResponse.Header or (if a response was returned at
  4707. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  4708. // to check whether the returned error was because
  4709. // http.StatusNotModified was returned.
  4710. func (c *InstancesUpdateCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  4711. gensupport.SetOptions(c.urlParams_, opts...)
  4712. res, err := c.doRequest("json")
  4713. if res != nil && res.StatusCode == http.StatusNotModified {
  4714. if res.Body != nil {
  4715. res.Body.Close()
  4716. }
  4717. return nil, &googleapi.Error{
  4718. Code: res.StatusCode,
  4719. Header: res.Header,
  4720. }
  4721. }
  4722. if err != nil {
  4723. return nil, err
  4724. }
  4725. defer googleapi.CloseBody(res)
  4726. if err := googleapi.CheckResponse(res); err != nil {
  4727. return nil, err
  4728. }
  4729. ret := &Operation{
  4730. ServerResponse: googleapi.ServerResponse{
  4731. Header: res.Header,
  4732. HTTPStatusCode: res.StatusCode,
  4733. },
  4734. }
  4735. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  4736. return nil, err
  4737. }
  4738. return ret, nil
  4739. // {
  4740. // "description": "Updates settings of a Cloud SQL instance. Caution: This is not a partial update, so you must include values for all the settings that you want to retain. For partial updates, use patch.",
  4741. // "etagRequired": true,
  4742. // "httpMethod": "PUT",
  4743. // "id": "sql.instances.update",
  4744. // "parameterOrder": [
  4745. // "project",
  4746. // "instance"
  4747. // ],
  4748. // "parameters": {
  4749. // "instance": {
  4750. // "description": "Cloud SQL instance ID. This does not include the project ID.",
  4751. // "location": "path",
  4752. // "required": true,
  4753. // "type": "string"
  4754. // },
  4755. // "project": {
  4756. // "description": "Project ID of the project that contains the instance.",
  4757. // "location": "path",
  4758. // "required": true,
  4759. // "type": "string"
  4760. // }
  4761. // },
  4762. // "path": "projects/{project}/instances/{instance}",
  4763. // "request": {
  4764. // "$ref": "DatabaseInstance"
  4765. // },
  4766. // "response": {
  4767. // "$ref": "Operation"
  4768. // },
  4769. // "scopes": [
  4770. // "https://www.googleapis.com/auth/cloud-platform",
  4771. // "https://www.googleapis.com/auth/sqlservice.admin"
  4772. // ]
  4773. // }
  4774. }
  4775. // method id "sql.operations.get":
  4776. type OperationsGetCall struct {
  4777. s *Service
  4778. project string
  4779. operation string
  4780. urlParams_ gensupport.URLParams
  4781. ifNoneMatch_ string
  4782. ctx_ context.Context
  4783. }
  4784. // Get: Retrieves an instance operation that has been performed on an
  4785. // instance.
  4786. func (r *OperationsService) Get(project string, operation string) *OperationsGetCall {
  4787. c := &OperationsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4788. c.project = project
  4789. c.operation = operation
  4790. return c
  4791. }
  4792. // Fields allows partial responses to be retrieved. See
  4793. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4794. // for more information.
  4795. func (c *OperationsGetCall) Fields(s ...googleapi.Field) *OperationsGetCall {
  4796. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4797. return c
  4798. }
  4799. // IfNoneMatch sets the optional parameter which makes the operation
  4800. // fail if the object's ETag matches the given value. This is useful for
  4801. // getting updates only after the object has changed since the last
  4802. // request. Use googleapi.IsNotModified to check whether the response
  4803. // error from Do is the result of In-None-Match.
  4804. func (c *OperationsGetCall) IfNoneMatch(entityTag string) *OperationsGetCall {
  4805. c.ifNoneMatch_ = entityTag
  4806. return c
  4807. }
  4808. // Context sets the context to be used in this call's Do method. Any
  4809. // pending HTTP request will be aborted if the provided context is
  4810. // canceled.
  4811. func (c *OperationsGetCall) Context(ctx context.Context) *OperationsGetCall {
  4812. c.ctx_ = ctx
  4813. return c
  4814. }
  4815. func (c *OperationsGetCall) doRequest(alt string) (*http.Response, error) {
  4816. var body io.Reader = nil
  4817. c.urlParams_.Set("alt", alt)
  4818. urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/operations/{operation}")
  4819. urls += "?" + c.urlParams_.Encode()
  4820. req, _ := http.NewRequest("GET", urls, body)
  4821. googleapi.Expand(req.URL, map[string]string{
  4822. "project": c.project,
  4823. "operation": c.operation,
  4824. })
  4825. req.Header.Set("User-Agent", c.s.userAgent())
  4826. if c.ifNoneMatch_ != "" {
  4827. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  4828. }
  4829. if c.ctx_ != nil {
  4830. return ctxhttp.Do(c.ctx_, c.s.client, req)
  4831. }
  4832. return c.s.client.Do(req)
  4833. }
  4834. // Do executes the "sql.operations.get" call.
  4835. // Exactly one of *Operation or error will be non-nil. Any non-2xx
  4836. // status code is an error. Response headers are in either
  4837. // *Operation.ServerResponse.Header or (if a response was returned at
  4838. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  4839. // to check whether the returned error was because
  4840. // http.StatusNotModified was returned.
  4841. func (c *OperationsGetCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  4842. gensupport.SetOptions(c.urlParams_, opts...)
  4843. res, err := c.doRequest("json")
  4844. if res != nil && res.StatusCode == http.StatusNotModified {
  4845. if res.Body != nil {
  4846. res.Body.Close()
  4847. }
  4848. return nil, &googleapi.Error{
  4849. Code: res.StatusCode,
  4850. Header: res.Header,
  4851. }
  4852. }
  4853. if err != nil {
  4854. return nil, err
  4855. }
  4856. defer googleapi.CloseBody(res)
  4857. if err := googleapi.CheckResponse(res); err != nil {
  4858. return nil, err
  4859. }
  4860. ret := &Operation{
  4861. ServerResponse: googleapi.ServerResponse{
  4862. Header: res.Header,
  4863. HTTPStatusCode: res.StatusCode,
  4864. },
  4865. }
  4866. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  4867. return nil, err
  4868. }
  4869. return ret, nil
  4870. // {
  4871. // "description": "Retrieves an instance operation that has been performed on an instance.",
  4872. // "httpMethod": "GET",
  4873. // "id": "sql.operations.get",
  4874. // "parameterOrder": [
  4875. // "project",
  4876. // "operation"
  4877. // ],
  4878. // "parameters": {
  4879. // "operation": {
  4880. // "description": "Instance operation ID.",
  4881. // "location": "path",
  4882. // "required": true,
  4883. // "type": "string"
  4884. // },
  4885. // "project": {
  4886. // "description": "Project ID of the project that contains the instance.",
  4887. // "location": "path",
  4888. // "required": true,
  4889. // "type": "string"
  4890. // }
  4891. // },
  4892. // "path": "projects/{project}/operations/{operation}",
  4893. // "response": {
  4894. // "$ref": "Operation"
  4895. // },
  4896. // "scopes": [
  4897. // "https://www.googleapis.com/auth/cloud-platform",
  4898. // "https://www.googleapis.com/auth/sqlservice.admin"
  4899. // ]
  4900. // }
  4901. }
  4902. // method id "sql.operations.list":
  4903. type OperationsListCall struct {
  4904. s *Service
  4905. project string
  4906. urlParams_ gensupport.URLParams
  4907. ifNoneMatch_ string
  4908. ctx_ context.Context
  4909. }
  4910. // List: Lists all instance operations that have been performed on the
  4911. // given Cloud SQL instance in the reverse chronological order of the
  4912. // start time.
  4913. func (r *OperationsService) List(project string, instance string) *OperationsListCall {
  4914. c := &OperationsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4915. c.project = project
  4916. c.urlParams_.Set("instance", instance)
  4917. return c
  4918. }
  4919. // MaxResults sets the optional parameter "maxResults": Maximum number
  4920. // of operations per response.
  4921. func (c *OperationsListCall) MaxResults(maxResults int64) *OperationsListCall {
  4922. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  4923. return c
  4924. }
  4925. // PageToken sets the optional parameter "pageToken": A
  4926. // previously-returned page token representing part of the larger set of
  4927. // results to view.
  4928. func (c *OperationsListCall) PageToken(pageToken string) *OperationsListCall {
  4929. c.urlParams_.Set("pageToken", pageToken)
  4930. return c
  4931. }
  4932. // Fields allows partial responses to be retrieved. See
  4933. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4934. // for more information.
  4935. func (c *OperationsListCall) Fields(s ...googleapi.Field) *OperationsListCall {
  4936. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4937. return c
  4938. }
  4939. // IfNoneMatch sets the optional parameter which makes the operation
  4940. // fail if the object's ETag matches the given value. This is useful for
  4941. // getting updates only after the object has changed since the last
  4942. // request. Use googleapi.IsNotModified to check whether the response
  4943. // error from Do is the result of In-None-Match.
  4944. func (c *OperationsListCall) IfNoneMatch(entityTag string) *OperationsListCall {
  4945. c.ifNoneMatch_ = entityTag
  4946. return c
  4947. }
  4948. // Context sets the context to be used in this call's Do method. Any
  4949. // pending HTTP request will be aborted if the provided context is
  4950. // canceled.
  4951. func (c *OperationsListCall) Context(ctx context.Context) *OperationsListCall {
  4952. c.ctx_ = ctx
  4953. return c
  4954. }
  4955. func (c *OperationsListCall) doRequest(alt string) (*http.Response, error) {
  4956. var body io.Reader = nil
  4957. c.urlParams_.Set("alt", alt)
  4958. urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/operations")
  4959. urls += "?" + c.urlParams_.Encode()
  4960. req, _ := http.NewRequest("GET", urls, body)
  4961. googleapi.Expand(req.URL, map[string]string{
  4962. "project": c.project,
  4963. })
  4964. req.Header.Set("User-Agent", c.s.userAgent())
  4965. if c.ifNoneMatch_ != "" {
  4966. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  4967. }
  4968. if c.ctx_ != nil {
  4969. return ctxhttp.Do(c.ctx_, c.s.client, req)
  4970. }
  4971. return c.s.client.Do(req)
  4972. }
  4973. // Do executes the "sql.operations.list" call.
  4974. // Exactly one of *OperationsListResponse or error will be non-nil. Any
  4975. // non-2xx status code is an error. Response headers are in either
  4976. // *OperationsListResponse.ServerResponse.Header or (if a response was
  4977. // returned at all) in error.(*googleapi.Error).Header. Use
  4978. // googleapi.IsNotModified to check whether the returned error was
  4979. // because http.StatusNotModified was returned.
  4980. func (c *OperationsListCall) Do(opts ...googleapi.CallOption) (*OperationsListResponse, error) {
  4981. gensupport.SetOptions(c.urlParams_, opts...)
  4982. res, err := c.doRequest("json")
  4983. if res != nil && res.StatusCode == http.StatusNotModified {
  4984. if res.Body != nil {
  4985. res.Body.Close()
  4986. }
  4987. return nil, &googleapi.Error{
  4988. Code: res.StatusCode,
  4989. Header: res.Header,
  4990. }
  4991. }
  4992. if err != nil {
  4993. return nil, err
  4994. }
  4995. defer googleapi.CloseBody(res)
  4996. if err := googleapi.CheckResponse(res); err != nil {
  4997. return nil, err
  4998. }
  4999. ret := &OperationsListResponse{
  5000. ServerResponse: googleapi.ServerResponse{
  5001. Header: res.Header,
  5002. HTTPStatusCode: res.StatusCode,
  5003. },
  5004. }
  5005. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  5006. return nil, err
  5007. }
  5008. return ret, nil
  5009. // {
  5010. // "description": "Lists all instance operations that have been performed on the given Cloud SQL instance in the reverse chronological order of the start time.",
  5011. // "httpMethod": "GET",
  5012. // "id": "sql.operations.list",
  5013. // "parameterOrder": [
  5014. // "project",
  5015. // "instance"
  5016. // ],
  5017. // "parameters": {
  5018. // "instance": {
  5019. // "description": "Cloud SQL instance ID. This does not include the project ID.",
  5020. // "location": "query",
  5021. // "required": true,
  5022. // "type": "string"
  5023. // },
  5024. // "maxResults": {
  5025. // "description": "Maximum number of operations per response.",
  5026. // "format": "uint32",
  5027. // "location": "query",
  5028. // "type": "integer"
  5029. // },
  5030. // "pageToken": {
  5031. // "description": "A previously-returned page token representing part of the larger set of results to view.",
  5032. // "location": "query",
  5033. // "type": "string"
  5034. // },
  5035. // "project": {
  5036. // "description": "Project ID of the project that contains the instance.",
  5037. // "location": "path",
  5038. // "required": true,
  5039. // "type": "string"
  5040. // }
  5041. // },
  5042. // "path": "projects/{project}/operations",
  5043. // "response": {
  5044. // "$ref": "OperationsListResponse"
  5045. // },
  5046. // "scopes": [
  5047. // "https://www.googleapis.com/auth/cloud-platform",
  5048. // "https://www.googleapis.com/auth/sqlservice.admin"
  5049. // ]
  5050. // }
  5051. }
  5052. // Pages invokes f for each page of results.
  5053. // A non-nil error returned from f will halt the iteration.
  5054. // The provided context supersedes any context provided to the Context method.
  5055. func (c *OperationsListCall) Pages(ctx context.Context, f func(*OperationsListResponse) error) error {
  5056. c.ctx_ = ctx
  5057. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  5058. for {
  5059. x, err := c.Do()
  5060. if err != nil {
  5061. return err
  5062. }
  5063. if err := f(x); err != nil {
  5064. return err
  5065. }
  5066. if x.NextPageToken == "" {
  5067. return nil
  5068. }
  5069. c.PageToken(x.NextPageToken)
  5070. }
  5071. }
  5072. // method id "sql.sslCerts.createEphemeral":
  5073. type SslCertsCreateEphemeralCall struct {
  5074. s *Service
  5075. project string
  5076. instance string
  5077. sslcertscreateephemeralrequest *SslCertsCreateEphemeralRequest
  5078. urlParams_ gensupport.URLParams
  5079. ctx_ context.Context
  5080. }
  5081. // CreateEphemeral: Generates a short-lived X509 certificate containing
  5082. // the provided public key and signed by a private key specific to the
  5083. // target instance. Users may use the certificate to authenticate as
  5084. // themselves when connecting to the database.
  5085. func (r *SslCertsService) CreateEphemeral(project string, instance string, sslcertscreateephemeralrequest *SslCertsCreateEphemeralRequest) *SslCertsCreateEphemeralCall {
  5086. c := &SslCertsCreateEphemeralCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5087. c.project = project
  5088. c.instance = instance
  5089. c.sslcertscreateephemeralrequest = sslcertscreateephemeralrequest
  5090. return c
  5091. }
  5092. // Fields allows partial responses to be retrieved. See
  5093. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5094. // for more information.
  5095. func (c *SslCertsCreateEphemeralCall) Fields(s ...googleapi.Field) *SslCertsCreateEphemeralCall {
  5096. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5097. return c
  5098. }
  5099. // Context sets the context to be used in this call's Do method. Any
  5100. // pending HTTP request will be aborted if the provided context is
  5101. // canceled.
  5102. func (c *SslCertsCreateEphemeralCall) Context(ctx context.Context) *SslCertsCreateEphemeralCall {
  5103. c.ctx_ = ctx
  5104. return c
  5105. }
  5106. func (c *SslCertsCreateEphemeralCall) doRequest(alt string) (*http.Response, error) {
  5107. var body io.Reader = nil
  5108. body, err := googleapi.WithoutDataWrapper.JSONReader(c.sslcertscreateephemeralrequest)
  5109. if err != nil {
  5110. return nil, err
  5111. }
  5112. ctype := "application/json"
  5113. c.urlParams_.Set("alt", alt)
  5114. urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/instances/{instance}/createEphemeral")
  5115. urls += "?" + c.urlParams_.Encode()
  5116. req, _ := http.NewRequest("POST", urls, body)
  5117. googleapi.Expand(req.URL, map[string]string{
  5118. "project": c.project,
  5119. "instance": c.instance,
  5120. })
  5121. req.Header.Set("Content-Type", ctype)
  5122. req.Header.Set("User-Agent", c.s.userAgent())
  5123. if c.ctx_ != nil {
  5124. return ctxhttp.Do(c.ctx_, c.s.client, req)
  5125. }
  5126. return c.s.client.Do(req)
  5127. }
  5128. // Do executes the "sql.sslCerts.createEphemeral" call.
  5129. // Exactly one of *SslCert or error will be non-nil. Any non-2xx status
  5130. // code is an error. Response headers are in either
  5131. // *SslCert.ServerResponse.Header or (if a response was returned at all)
  5132. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  5133. // check whether the returned error was because http.StatusNotModified
  5134. // was returned.
  5135. func (c *SslCertsCreateEphemeralCall) Do(opts ...googleapi.CallOption) (*SslCert, error) {
  5136. gensupport.SetOptions(c.urlParams_, opts...)
  5137. res, err := c.doRequest("json")
  5138. if res != nil && res.StatusCode == http.StatusNotModified {
  5139. if res.Body != nil {
  5140. res.Body.Close()
  5141. }
  5142. return nil, &googleapi.Error{
  5143. Code: res.StatusCode,
  5144. Header: res.Header,
  5145. }
  5146. }
  5147. if err != nil {
  5148. return nil, err
  5149. }
  5150. defer googleapi.CloseBody(res)
  5151. if err := googleapi.CheckResponse(res); err != nil {
  5152. return nil, err
  5153. }
  5154. ret := &SslCert{
  5155. ServerResponse: googleapi.ServerResponse{
  5156. Header: res.Header,
  5157. HTTPStatusCode: res.StatusCode,
  5158. },
  5159. }
  5160. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  5161. return nil, err
  5162. }
  5163. return ret, nil
  5164. // {
  5165. // "description": "Generates a short-lived X509 certificate containing the provided public key and signed by a private key specific to the target instance. Users may use the certificate to authenticate as themselves when connecting to the database.",
  5166. // "httpMethod": "POST",
  5167. // "id": "sql.sslCerts.createEphemeral",
  5168. // "parameterOrder": [
  5169. // "project",
  5170. // "instance"
  5171. // ],
  5172. // "parameters": {
  5173. // "instance": {
  5174. // "description": "Cloud SQL instance ID. This does not include the project ID.",
  5175. // "location": "path",
  5176. // "required": true,
  5177. // "type": "string"
  5178. // },
  5179. // "project": {
  5180. // "description": "Project ID of the Cloud SQL project.",
  5181. // "location": "path",
  5182. // "required": true,
  5183. // "type": "string"
  5184. // }
  5185. // },
  5186. // "path": "projects/{project}/instances/{instance}/createEphemeral",
  5187. // "request": {
  5188. // "$ref": "SslCertsCreateEphemeralRequest"
  5189. // },
  5190. // "response": {
  5191. // "$ref": "SslCert"
  5192. // },
  5193. // "scopes": [
  5194. // "https://www.googleapis.com/auth/cloud-platform",
  5195. // "https://www.googleapis.com/auth/sqlservice.admin"
  5196. // ]
  5197. // }
  5198. }
  5199. // method id "sql.sslCerts.delete":
  5200. type SslCertsDeleteCall struct {
  5201. s *Service
  5202. project string
  5203. instance string
  5204. sha1Fingerprint string
  5205. urlParams_ gensupport.URLParams
  5206. ctx_ context.Context
  5207. }
  5208. // Delete: Deletes the SSL certificate. The change will not take effect
  5209. // until the instance is restarted.
  5210. func (r *SslCertsService) Delete(project string, instance string, sha1Fingerprint string) *SslCertsDeleteCall {
  5211. c := &SslCertsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5212. c.project = project
  5213. c.instance = instance
  5214. c.sha1Fingerprint = sha1Fingerprint
  5215. return c
  5216. }
  5217. // Fields allows partial responses to be retrieved. See
  5218. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5219. // for more information.
  5220. func (c *SslCertsDeleteCall) Fields(s ...googleapi.Field) *SslCertsDeleteCall {
  5221. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5222. return c
  5223. }
  5224. // Context sets the context to be used in this call's Do method. Any
  5225. // pending HTTP request will be aborted if the provided context is
  5226. // canceled.
  5227. func (c *SslCertsDeleteCall) Context(ctx context.Context) *SslCertsDeleteCall {
  5228. c.ctx_ = ctx
  5229. return c
  5230. }
  5231. func (c *SslCertsDeleteCall) doRequest(alt string) (*http.Response, error) {
  5232. var body io.Reader = nil
  5233. c.urlParams_.Set("alt", alt)
  5234. urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/instances/{instance}/sslCerts/{sha1Fingerprint}")
  5235. urls += "?" + c.urlParams_.Encode()
  5236. req, _ := http.NewRequest("DELETE", urls, body)
  5237. googleapi.Expand(req.URL, map[string]string{
  5238. "project": c.project,
  5239. "instance": c.instance,
  5240. "sha1Fingerprint": c.sha1Fingerprint,
  5241. })
  5242. req.Header.Set("User-Agent", c.s.userAgent())
  5243. if c.ctx_ != nil {
  5244. return ctxhttp.Do(c.ctx_, c.s.client, req)
  5245. }
  5246. return c.s.client.Do(req)
  5247. }
  5248. // Do executes the "sql.sslCerts.delete" call.
  5249. // Exactly one of *Operation or error will be non-nil. Any non-2xx
  5250. // status code is an error. Response headers are in either
  5251. // *Operation.ServerResponse.Header or (if a response was returned at
  5252. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  5253. // to check whether the returned error was because
  5254. // http.StatusNotModified was returned.
  5255. func (c *SslCertsDeleteCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  5256. gensupport.SetOptions(c.urlParams_, opts...)
  5257. res, err := c.doRequest("json")
  5258. if res != nil && res.StatusCode == http.StatusNotModified {
  5259. if res.Body != nil {
  5260. res.Body.Close()
  5261. }
  5262. return nil, &googleapi.Error{
  5263. Code: res.StatusCode,
  5264. Header: res.Header,
  5265. }
  5266. }
  5267. if err != nil {
  5268. return nil, err
  5269. }
  5270. defer googleapi.CloseBody(res)
  5271. if err := googleapi.CheckResponse(res); err != nil {
  5272. return nil, err
  5273. }
  5274. ret := &Operation{
  5275. ServerResponse: googleapi.ServerResponse{
  5276. Header: res.Header,
  5277. HTTPStatusCode: res.StatusCode,
  5278. },
  5279. }
  5280. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  5281. return nil, err
  5282. }
  5283. return ret, nil
  5284. // {
  5285. // "description": "Deletes the SSL certificate. The change will not take effect until the instance is restarted.",
  5286. // "httpMethod": "DELETE",
  5287. // "id": "sql.sslCerts.delete",
  5288. // "parameterOrder": [
  5289. // "project",
  5290. // "instance",
  5291. // "sha1Fingerprint"
  5292. // ],
  5293. // "parameters": {
  5294. // "instance": {
  5295. // "description": "Cloud SQL instance ID. This does not include the project ID.",
  5296. // "location": "path",
  5297. // "required": true,
  5298. // "type": "string"
  5299. // },
  5300. // "project": {
  5301. // "description": "Project ID of the project that contains the instance to be deleted.",
  5302. // "location": "path",
  5303. // "required": true,
  5304. // "type": "string"
  5305. // },
  5306. // "sha1Fingerprint": {
  5307. // "description": "Sha1 FingerPrint.",
  5308. // "location": "path",
  5309. // "required": true,
  5310. // "type": "string"
  5311. // }
  5312. // },
  5313. // "path": "projects/{project}/instances/{instance}/sslCerts/{sha1Fingerprint}",
  5314. // "response": {
  5315. // "$ref": "Operation"
  5316. // },
  5317. // "scopes": [
  5318. // "https://www.googleapis.com/auth/cloud-platform",
  5319. // "https://www.googleapis.com/auth/sqlservice.admin"
  5320. // ]
  5321. // }
  5322. }
  5323. // method id "sql.sslCerts.get":
  5324. type SslCertsGetCall struct {
  5325. s *Service
  5326. project string
  5327. instance string
  5328. sha1Fingerprint string
  5329. urlParams_ gensupport.URLParams
  5330. ifNoneMatch_ string
  5331. ctx_ context.Context
  5332. }
  5333. // Get: Retrieves a particular SSL certificate. Does not include the
  5334. // private key (required for usage). The private key must be saved from
  5335. // the response to initial creation.
  5336. func (r *SslCertsService) Get(project string, instance string, sha1Fingerprint string) *SslCertsGetCall {
  5337. c := &SslCertsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5338. c.project = project
  5339. c.instance = instance
  5340. c.sha1Fingerprint = sha1Fingerprint
  5341. return c
  5342. }
  5343. // Fields allows partial responses to be retrieved. See
  5344. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5345. // for more information.
  5346. func (c *SslCertsGetCall) Fields(s ...googleapi.Field) *SslCertsGetCall {
  5347. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5348. return c
  5349. }
  5350. // IfNoneMatch sets the optional parameter which makes the operation
  5351. // fail if the object's ETag matches the given value. This is useful for
  5352. // getting updates only after the object has changed since the last
  5353. // request. Use googleapi.IsNotModified to check whether the response
  5354. // error from Do is the result of In-None-Match.
  5355. func (c *SslCertsGetCall) IfNoneMatch(entityTag string) *SslCertsGetCall {
  5356. c.ifNoneMatch_ = entityTag
  5357. return c
  5358. }
  5359. // Context sets the context to be used in this call's Do method. Any
  5360. // pending HTTP request will be aborted if the provided context is
  5361. // canceled.
  5362. func (c *SslCertsGetCall) Context(ctx context.Context) *SslCertsGetCall {
  5363. c.ctx_ = ctx
  5364. return c
  5365. }
  5366. func (c *SslCertsGetCall) doRequest(alt string) (*http.Response, error) {
  5367. var body io.Reader = nil
  5368. c.urlParams_.Set("alt", alt)
  5369. urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/instances/{instance}/sslCerts/{sha1Fingerprint}")
  5370. urls += "?" + c.urlParams_.Encode()
  5371. req, _ := http.NewRequest("GET", urls, body)
  5372. googleapi.Expand(req.URL, map[string]string{
  5373. "project": c.project,
  5374. "instance": c.instance,
  5375. "sha1Fingerprint": c.sha1Fingerprint,
  5376. })
  5377. req.Header.Set("User-Agent", c.s.userAgent())
  5378. if c.ifNoneMatch_ != "" {
  5379. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  5380. }
  5381. if c.ctx_ != nil {
  5382. return ctxhttp.Do(c.ctx_, c.s.client, req)
  5383. }
  5384. return c.s.client.Do(req)
  5385. }
  5386. // Do executes the "sql.sslCerts.get" call.
  5387. // Exactly one of *SslCert or error will be non-nil. Any non-2xx status
  5388. // code is an error. Response headers are in either
  5389. // *SslCert.ServerResponse.Header or (if a response was returned at all)
  5390. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  5391. // check whether the returned error was because http.StatusNotModified
  5392. // was returned.
  5393. func (c *SslCertsGetCall) Do(opts ...googleapi.CallOption) (*SslCert, error) {
  5394. gensupport.SetOptions(c.urlParams_, opts...)
  5395. res, err := c.doRequest("json")
  5396. if res != nil && res.StatusCode == http.StatusNotModified {
  5397. if res.Body != nil {
  5398. res.Body.Close()
  5399. }
  5400. return nil, &googleapi.Error{
  5401. Code: res.StatusCode,
  5402. Header: res.Header,
  5403. }
  5404. }
  5405. if err != nil {
  5406. return nil, err
  5407. }
  5408. defer googleapi.CloseBody(res)
  5409. if err := googleapi.CheckResponse(res); err != nil {
  5410. return nil, err
  5411. }
  5412. ret := &SslCert{
  5413. ServerResponse: googleapi.ServerResponse{
  5414. Header: res.Header,
  5415. HTTPStatusCode: res.StatusCode,
  5416. },
  5417. }
  5418. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  5419. return nil, err
  5420. }
  5421. return ret, nil
  5422. // {
  5423. // "description": "Retrieves a particular SSL certificate. Does not include the private key (required for usage). The private key must be saved from the response to initial creation.",
  5424. // "httpMethod": "GET",
  5425. // "id": "sql.sslCerts.get",
  5426. // "parameterOrder": [
  5427. // "project",
  5428. // "instance",
  5429. // "sha1Fingerprint"
  5430. // ],
  5431. // "parameters": {
  5432. // "instance": {
  5433. // "description": "Cloud SQL instance ID. This does not include the project ID.",
  5434. // "location": "path",
  5435. // "required": true,
  5436. // "type": "string"
  5437. // },
  5438. // "project": {
  5439. // "description": "Project ID of the project that contains the instance.",
  5440. // "location": "path",
  5441. // "required": true,
  5442. // "type": "string"
  5443. // },
  5444. // "sha1Fingerprint": {
  5445. // "description": "Sha1 FingerPrint.",
  5446. // "location": "path",
  5447. // "required": true,
  5448. // "type": "string"
  5449. // }
  5450. // },
  5451. // "path": "projects/{project}/instances/{instance}/sslCerts/{sha1Fingerprint}",
  5452. // "response": {
  5453. // "$ref": "SslCert"
  5454. // },
  5455. // "scopes": [
  5456. // "https://www.googleapis.com/auth/cloud-platform",
  5457. // "https://www.googleapis.com/auth/sqlservice.admin"
  5458. // ]
  5459. // }
  5460. }
  5461. // method id "sql.sslCerts.insert":
  5462. type SslCertsInsertCall struct {
  5463. s *Service
  5464. project string
  5465. instance string
  5466. sslcertsinsertrequest *SslCertsInsertRequest
  5467. urlParams_ gensupport.URLParams
  5468. ctx_ context.Context
  5469. }
  5470. // Insert: Creates an SSL certificate and returns it along with the
  5471. // private key and server certificate authority. The new certificate
  5472. // will not be usable until the instance is restarted.
  5473. func (r *SslCertsService) Insert(project string, instance string, sslcertsinsertrequest *SslCertsInsertRequest) *SslCertsInsertCall {
  5474. c := &SslCertsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5475. c.project = project
  5476. c.instance = instance
  5477. c.sslcertsinsertrequest = sslcertsinsertrequest
  5478. return c
  5479. }
  5480. // Fields allows partial responses to be retrieved. See
  5481. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5482. // for more information.
  5483. func (c *SslCertsInsertCall) Fields(s ...googleapi.Field) *SslCertsInsertCall {
  5484. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5485. return c
  5486. }
  5487. // Context sets the context to be used in this call's Do method. Any
  5488. // pending HTTP request will be aborted if the provided context is
  5489. // canceled.
  5490. func (c *SslCertsInsertCall) Context(ctx context.Context) *SslCertsInsertCall {
  5491. c.ctx_ = ctx
  5492. return c
  5493. }
  5494. func (c *SslCertsInsertCall) doRequest(alt string) (*http.Response, error) {
  5495. var body io.Reader = nil
  5496. body, err := googleapi.WithoutDataWrapper.JSONReader(c.sslcertsinsertrequest)
  5497. if err != nil {
  5498. return nil, err
  5499. }
  5500. ctype := "application/json"
  5501. c.urlParams_.Set("alt", alt)
  5502. urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/instances/{instance}/sslCerts")
  5503. urls += "?" + c.urlParams_.Encode()
  5504. req, _ := http.NewRequest("POST", urls, body)
  5505. googleapi.Expand(req.URL, map[string]string{
  5506. "project": c.project,
  5507. "instance": c.instance,
  5508. })
  5509. req.Header.Set("Content-Type", ctype)
  5510. req.Header.Set("User-Agent", c.s.userAgent())
  5511. if c.ctx_ != nil {
  5512. return ctxhttp.Do(c.ctx_, c.s.client, req)
  5513. }
  5514. return c.s.client.Do(req)
  5515. }
  5516. // Do executes the "sql.sslCerts.insert" call.
  5517. // Exactly one of *SslCertsInsertResponse or error will be non-nil. Any
  5518. // non-2xx status code is an error. Response headers are in either
  5519. // *SslCertsInsertResponse.ServerResponse.Header or (if a response was
  5520. // returned at all) in error.(*googleapi.Error).Header. Use
  5521. // googleapi.IsNotModified to check whether the returned error was
  5522. // because http.StatusNotModified was returned.
  5523. func (c *SslCertsInsertCall) Do(opts ...googleapi.CallOption) (*SslCertsInsertResponse, error) {
  5524. gensupport.SetOptions(c.urlParams_, opts...)
  5525. res, err := c.doRequest("json")
  5526. if res != nil && res.StatusCode == http.StatusNotModified {
  5527. if res.Body != nil {
  5528. res.Body.Close()
  5529. }
  5530. return nil, &googleapi.Error{
  5531. Code: res.StatusCode,
  5532. Header: res.Header,
  5533. }
  5534. }
  5535. if err != nil {
  5536. return nil, err
  5537. }
  5538. defer googleapi.CloseBody(res)
  5539. if err := googleapi.CheckResponse(res); err != nil {
  5540. return nil, err
  5541. }
  5542. ret := &SslCertsInsertResponse{
  5543. ServerResponse: googleapi.ServerResponse{
  5544. Header: res.Header,
  5545. HTTPStatusCode: res.StatusCode,
  5546. },
  5547. }
  5548. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  5549. return nil, err
  5550. }
  5551. return ret, nil
  5552. // {
  5553. // "description": "Creates an SSL certificate and returns it along with the private key and server certificate authority. The new certificate will not be usable until the instance is restarted.",
  5554. // "httpMethod": "POST",
  5555. // "id": "sql.sslCerts.insert",
  5556. // "parameterOrder": [
  5557. // "project",
  5558. // "instance"
  5559. // ],
  5560. // "parameters": {
  5561. // "instance": {
  5562. // "description": "Cloud SQL instance ID. This does not include the project ID.",
  5563. // "location": "path",
  5564. // "required": true,
  5565. // "type": "string"
  5566. // },
  5567. // "project": {
  5568. // "description": "Project ID of the project to which the newly created Cloud SQL instances should belong.",
  5569. // "location": "path",
  5570. // "required": true,
  5571. // "type": "string"
  5572. // }
  5573. // },
  5574. // "path": "projects/{project}/instances/{instance}/sslCerts",
  5575. // "request": {
  5576. // "$ref": "SslCertsInsertRequest"
  5577. // },
  5578. // "response": {
  5579. // "$ref": "SslCertsInsertResponse"
  5580. // },
  5581. // "scopes": [
  5582. // "https://www.googleapis.com/auth/cloud-platform",
  5583. // "https://www.googleapis.com/auth/sqlservice.admin"
  5584. // ]
  5585. // }
  5586. }
  5587. // method id "sql.sslCerts.list":
  5588. type SslCertsListCall struct {
  5589. s *Service
  5590. project string
  5591. instance string
  5592. urlParams_ gensupport.URLParams
  5593. ifNoneMatch_ string
  5594. ctx_ context.Context
  5595. }
  5596. // List: Lists all of the current SSL certificates for the instance.
  5597. func (r *SslCertsService) List(project string, instance string) *SslCertsListCall {
  5598. c := &SslCertsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5599. c.project = project
  5600. c.instance = instance
  5601. return c
  5602. }
  5603. // Fields allows partial responses to be retrieved. See
  5604. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5605. // for more information.
  5606. func (c *SslCertsListCall) Fields(s ...googleapi.Field) *SslCertsListCall {
  5607. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5608. return c
  5609. }
  5610. // IfNoneMatch sets the optional parameter which makes the operation
  5611. // fail if the object's ETag matches the given value. This is useful for
  5612. // getting updates only after the object has changed since the last
  5613. // request. Use googleapi.IsNotModified to check whether the response
  5614. // error from Do is the result of In-None-Match.
  5615. func (c *SslCertsListCall) IfNoneMatch(entityTag string) *SslCertsListCall {
  5616. c.ifNoneMatch_ = entityTag
  5617. return c
  5618. }
  5619. // Context sets the context to be used in this call's Do method. Any
  5620. // pending HTTP request will be aborted if the provided context is
  5621. // canceled.
  5622. func (c *SslCertsListCall) Context(ctx context.Context) *SslCertsListCall {
  5623. c.ctx_ = ctx
  5624. return c
  5625. }
  5626. func (c *SslCertsListCall) doRequest(alt string) (*http.Response, error) {
  5627. var body io.Reader = nil
  5628. c.urlParams_.Set("alt", alt)
  5629. urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/instances/{instance}/sslCerts")
  5630. urls += "?" + c.urlParams_.Encode()
  5631. req, _ := http.NewRequest("GET", urls, body)
  5632. googleapi.Expand(req.URL, map[string]string{
  5633. "project": c.project,
  5634. "instance": c.instance,
  5635. })
  5636. req.Header.Set("User-Agent", c.s.userAgent())
  5637. if c.ifNoneMatch_ != "" {
  5638. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  5639. }
  5640. if c.ctx_ != nil {
  5641. return ctxhttp.Do(c.ctx_, c.s.client, req)
  5642. }
  5643. return c.s.client.Do(req)
  5644. }
  5645. // Do executes the "sql.sslCerts.list" call.
  5646. // Exactly one of *SslCertsListResponse or error will be non-nil. Any
  5647. // non-2xx status code is an error. Response headers are in either
  5648. // *SslCertsListResponse.ServerResponse.Header or (if a response was
  5649. // returned at all) in error.(*googleapi.Error).Header. Use
  5650. // googleapi.IsNotModified to check whether the returned error was
  5651. // because http.StatusNotModified was returned.
  5652. func (c *SslCertsListCall) Do(opts ...googleapi.CallOption) (*SslCertsListResponse, error) {
  5653. gensupport.SetOptions(c.urlParams_, opts...)
  5654. res, err := c.doRequest("json")
  5655. if res != nil && res.StatusCode == http.StatusNotModified {
  5656. if res.Body != nil {
  5657. res.Body.Close()
  5658. }
  5659. return nil, &googleapi.Error{
  5660. Code: res.StatusCode,
  5661. Header: res.Header,
  5662. }
  5663. }
  5664. if err != nil {
  5665. return nil, err
  5666. }
  5667. defer googleapi.CloseBody(res)
  5668. if err := googleapi.CheckResponse(res); err != nil {
  5669. return nil, err
  5670. }
  5671. ret := &SslCertsListResponse{
  5672. ServerResponse: googleapi.ServerResponse{
  5673. Header: res.Header,
  5674. HTTPStatusCode: res.StatusCode,
  5675. },
  5676. }
  5677. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  5678. return nil, err
  5679. }
  5680. return ret, nil
  5681. // {
  5682. // "description": "Lists all of the current SSL certificates for the instance.",
  5683. // "httpMethod": "GET",
  5684. // "id": "sql.sslCerts.list",
  5685. // "parameterOrder": [
  5686. // "project",
  5687. // "instance"
  5688. // ],
  5689. // "parameters": {
  5690. // "instance": {
  5691. // "description": "Cloud SQL instance ID. This does not include the project ID.",
  5692. // "location": "path",
  5693. // "required": true,
  5694. // "type": "string"
  5695. // },
  5696. // "project": {
  5697. // "description": "Project ID of the project for which to list Cloud SQL instances.",
  5698. // "location": "path",
  5699. // "required": true,
  5700. // "type": "string"
  5701. // }
  5702. // },
  5703. // "path": "projects/{project}/instances/{instance}/sslCerts",
  5704. // "response": {
  5705. // "$ref": "SslCertsListResponse"
  5706. // },
  5707. // "scopes": [
  5708. // "https://www.googleapis.com/auth/cloud-platform",
  5709. // "https://www.googleapis.com/auth/sqlservice.admin"
  5710. // ]
  5711. // }
  5712. }
  5713. // method id "sql.tiers.list":
  5714. type TiersListCall struct {
  5715. s *Service
  5716. project string
  5717. urlParams_ gensupport.URLParams
  5718. ifNoneMatch_ string
  5719. ctx_ context.Context
  5720. }
  5721. // List: Lists all available service tiers for Google Cloud SQL, for
  5722. // example D1, D2. For related information, see Pricing.
  5723. func (r *TiersService) List(project string) *TiersListCall {
  5724. c := &TiersListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5725. c.project = project
  5726. return c
  5727. }
  5728. // Fields allows partial responses to be retrieved. See
  5729. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5730. // for more information.
  5731. func (c *TiersListCall) Fields(s ...googleapi.Field) *TiersListCall {
  5732. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5733. return c
  5734. }
  5735. // IfNoneMatch sets the optional parameter which makes the operation
  5736. // fail if the object's ETag matches the given value. This is useful for
  5737. // getting updates only after the object has changed since the last
  5738. // request. Use googleapi.IsNotModified to check whether the response
  5739. // error from Do is the result of In-None-Match.
  5740. func (c *TiersListCall) IfNoneMatch(entityTag string) *TiersListCall {
  5741. c.ifNoneMatch_ = entityTag
  5742. return c
  5743. }
  5744. // Context sets the context to be used in this call's Do method. Any
  5745. // pending HTTP request will be aborted if the provided context is
  5746. // canceled.
  5747. func (c *TiersListCall) Context(ctx context.Context) *TiersListCall {
  5748. c.ctx_ = ctx
  5749. return c
  5750. }
  5751. func (c *TiersListCall) doRequest(alt string) (*http.Response, error) {
  5752. var body io.Reader = nil
  5753. c.urlParams_.Set("alt", alt)
  5754. urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/tiers")
  5755. urls += "?" + c.urlParams_.Encode()
  5756. req, _ := http.NewRequest("GET", urls, body)
  5757. googleapi.Expand(req.URL, map[string]string{
  5758. "project": c.project,
  5759. })
  5760. req.Header.Set("User-Agent", c.s.userAgent())
  5761. if c.ifNoneMatch_ != "" {
  5762. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  5763. }
  5764. if c.ctx_ != nil {
  5765. return ctxhttp.Do(c.ctx_, c.s.client, req)
  5766. }
  5767. return c.s.client.Do(req)
  5768. }
  5769. // Do executes the "sql.tiers.list" call.
  5770. // Exactly one of *TiersListResponse or error will be non-nil. Any
  5771. // non-2xx status code is an error. Response headers are in either
  5772. // *TiersListResponse.ServerResponse.Header or (if a response was
  5773. // returned at all) in error.(*googleapi.Error).Header. Use
  5774. // googleapi.IsNotModified to check whether the returned error was
  5775. // because http.StatusNotModified was returned.
  5776. func (c *TiersListCall) Do(opts ...googleapi.CallOption) (*TiersListResponse, error) {
  5777. gensupport.SetOptions(c.urlParams_, opts...)
  5778. res, err := c.doRequest("json")
  5779. if res != nil && res.StatusCode == http.StatusNotModified {
  5780. if res.Body != nil {
  5781. res.Body.Close()
  5782. }
  5783. return nil, &googleapi.Error{
  5784. Code: res.StatusCode,
  5785. Header: res.Header,
  5786. }
  5787. }
  5788. if err != nil {
  5789. return nil, err
  5790. }
  5791. defer googleapi.CloseBody(res)
  5792. if err := googleapi.CheckResponse(res); err != nil {
  5793. return nil, err
  5794. }
  5795. ret := &TiersListResponse{
  5796. ServerResponse: googleapi.ServerResponse{
  5797. Header: res.Header,
  5798. HTTPStatusCode: res.StatusCode,
  5799. },
  5800. }
  5801. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  5802. return nil, err
  5803. }
  5804. return ret, nil
  5805. // {
  5806. // "description": "Lists all available service tiers for Google Cloud SQL, for example D1, D2. For related information, see Pricing.",
  5807. // "httpMethod": "GET",
  5808. // "id": "sql.tiers.list",
  5809. // "parameterOrder": [
  5810. // "project"
  5811. // ],
  5812. // "parameters": {
  5813. // "project": {
  5814. // "description": "Project ID of the project for which to list tiers.",
  5815. // "location": "path",
  5816. // "required": true,
  5817. // "type": "string"
  5818. // }
  5819. // },
  5820. // "path": "projects/{project}/tiers",
  5821. // "response": {
  5822. // "$ref": "TiersListResponse"
  5823. // },
  5824. // "scopes": [
  5825. // "https://www.googleapis.com/auth/cloud-platform",
  5826. // "https://www.googleapis.com/auth/sqlservice.admin"
  5827. // ]
  5828. // }
  5829. }
  5830. // method id "sql.users.delete":
  5831. type UsersDeleteCall struct {
  5832. s *Service
  5833. project string
  5834. instance string
  5835. urlParams_ gensupport.URLParams
  5836. ctx_ context.Context
  5837. }
  5838. // Delete: Deletes a user from a Cloud SQL instance.
  5839. func (r *UsersService) Delete(project string, instance string, host string, name string) *UsersDeleteCall {
  5840. c := &UsersDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5841. c.project = project
  5842. c.instance = instance
  5843. c.urlParams_.Set("host", host)
  5844. c.urlParams_.Set("name", name)
  5845. return c
  5846. }
  5847. // Fields allows partial responses to be retrieved. See
  5848. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5849. // for more information.
  5850. func (c *UsersDeleteCall) Fields(s ...googleapi.Field) *UsersDeleteCall {
  5851. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5852. return c
  5853. }
  5854. // Context sets the context to be used in this call's Do method. Any
  5855. // pending HTTP request will be aborted if the provided context is
  5856. // canceled.
  5857. func (c *UsersDeleteCall) Context(ctx context.Context) *UsersDeleteCall {
  5858. c.ctx_ = ctx
  5859. return c
  5860. }
  5861. func (c *UsersDeleteCall) doRequest(alt string) (*http.Response, error) {
  5862. var body io.Reader = nil
  5863. c.urlParams_.Set("alt", alt)
  5864. urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/instances/{instance}/users")
  5865. urls += "?" + c.urlParams_.Encode()
  5866. req, _ := http.NewRequest("DELETE", urls, body)
  5867. googleapi.Expand(req.URL, map[string]string{
  5868. "project": c.project,
  5869. "instance": c.instance,
  5870. })
  5871. req.Header.Set("User-Agent", c.s.userAgent())
  5872. if c.ctx_ != nil {
  5873. return ctxhttp.Do(c.ctx_, c.s.client, req)
  5874. }
  5875. return c.s.client.Do(req)
  5876. }
  5877. // Do executes the "sql.users.delete" call.
  5878. // Exactly one of *Operation or error will be non-nil. Any non-2xx
  5879. // status code is an error. Response headers are in either
  5880. // *Operation.ServerResponse.Header or (if a response was returned at
  5881. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  5882. // to check whether the returned error was because
  5883. // http.StatusNotModified was returned.
  5884. func (c *UsersDeleteCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  5885. gensupport.SetOptions(c.urlParams_, opts...)
  5886. res, err := c.doRequest("json")
  5887. if res != nil && res.StatusCode == http.StatusNotModified {
  5888. if res.Body != nil {
  5889. res.Body.Close()
  5890. }
  5891. return nil, &googleapi.Error{
  5892. Code: res.StatusCode,
  5893. Header: res.Header,
  5894. }
  5895. }
  5896. if err != nil {
  5897. return nil, err
  5898. }
  5899. defer googleapi.CloseBody(res)
  5900. if err := googleapi.CheckResponse(res); err != nil {
  5901. return nil, err
  5902. }
  5903. ret := &Operation{
  5904. ServerResponse: googleapi.ServerResponse{
  5905. Header: res.Header,
  5906. HTTPStatusCode: res.StatusCode,
  5907. },
  5908. }
  5909. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  5910. return nil, err
  5911. }
  5912. return ret, nil
  5913. // {
  5914. // "description": "Deletes a user from a Cloud SQL instance.",
  5915. // "httpMethod": "DELETE",
  5916. // "id": "sql.users.delete",
  5917. // "parameterOrder": [
  5918. // "project",
  5919. // "instance",
  5920. // "host",
  5921. // "name"
  5922. // ],
  5923. // "parameters": {
  5924. // "host": {
  5925. // "description": "Host of the user in the instance.",
  5926. // "location": "query",
  5927. // "required": true,
  5928. // "type": "string"
  5929. // },
  5930. // "instance": {
  5931. // "description": "Database instance ID. This does not include the project ID.",
  5932. // "location": "path",
  5933. // "required": true,
  5934. // "type": "string"
  5935. // },
  5936. // "name": {
  5937. // "description": "Name of the user in the instance.",
  5938. // "location": "query",
  5939. // "required": true,
  5940. // "type": "string"
  5941. // },
  5942. // "project": {
  5943. // "description": "Project ID of the project that contains the instance.",
  5944. // "location": "path",
  5945. // "required": true,
  5946. // "type": "string"
  5947. // }
  5948. // },
  5949. // "path": "projects/{project}/instances/{instance}/users",
  5950. // "response": {
  5951. // "$ref": "Operation"
  5952. // },
  5953. // "scopes": [
  5954. // "https://www.googleapis.com/auth/cloud-platform",
  5955. // "https://www.googleapis.com/auth/sqlservice.admin"
  5956. // ]
  5957. // }
  5958. }
  5959. // method id "sql.users.insert":
  5960. type UsersInsertCall struct {
  5961. s *Service
  5962. project string
  5963. instance string
  5964. user *User
  5965. urlParams_ gensupport.URLParams
  5966. ctx_ context.Context
  5967. }
  5968. // Insert: Creates a new user in a Cloud SQL instance.
  5969. func (r *UsersService) Insert(project string, instance string, user *User) *UsersInsertCall {
  5970. c := &UsersInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5971. c.project = project
  5972. c.instance = instance
  5973. c.user = user
  5974. return c
  5975. }
  5976. // Fields allows partial responses to be retrieved. See
  5977. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5978. // for more information.
  5979. func (c *UsersInsertCall) Fields(s ...googleapi.Field) *UsersInsertCall {
  5980. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5981. return c
  5982. }
  5983. // Context sets the context to be used in this call's Do method. Any
  5984. // pending HTTP request will be aborted if the provided context is
  5985. // canceled.
  5986. func (c *UsersInsertCall) Context(ctx context.Context) *UsersInsertCall {
  5987. c.ctx_ = ctx
  5988. return c
  5989. }
  5990. func (c *UsersInsertCall) doRequest(alt string) (*http.Response, error) {
  5991. var body io.Reader = nil
  5992. body, err := googleapi.WithoutDataWrapper.JSONReader(c.user)
  5993. if err != nil {
  5994. return nil, err
  5995. }
  5996. ctype := "application/json"
  5997. c.urlParams_.Set("alt", alt)
  5998. urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/instances/{instance}/users")
  5999. urls += "?" + c.urlParams_.Encode()
  6000. req, _ := http.NewRequest("POST", urls, body)
  6001. googleapi.Expand(req.URL, map[string]string{
  6002. "project": c.project,
  6003. "instance": c.instance,
  6004. })
  6005. req.Header.Set("Content-Type", ctype)
  6006. req.Header.Set("User-Agent", c.s.userAgent())
  6007. if c.ctx_ != nil {
  6008. return ctxhttp.Do(c.ctx_, c.s.client, req)
  6009. }
  6010. return c.s.client.Do(req)
  6011. }
  6012. // Do executes the "sql.users.insert" call.
  6013. // Exactly one of *Operation or error will be non-nil. Any non-2xx
  6014. // status code is an error. Response headers are in either
  6015. // *Operation.ServerResponse.Header or (if a response was returned at
  6016. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  6017. // to check whether the returned error was because
  6018. // http.StatusNotModified was returned.
  6019. func (c *UsersInsertCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  6020. gensupport.SetOptions(c.urlParams_, opts...)
  6021. res, err := c.doRequest("json")
  6022. if res != nil && res.StatusCode == http.StatusNotModified {
  6023. if res.Body != nil {
  6024. res.Body.Close()
  6025. }
  6026. return nil, &googleapi.Error{
  6027. Code: res.StatusCode,
  6028. Header: res.Header,
  6029. }
  6030. }
  6031. if err != nil {
  6032. return nil, err
  6033. }
  6034. defer googleapi.CloseBody(res)
  6035. if err := googleapi.CheckResponse(res); err != nil {
  6036. return nil, err
  6037. }
  6038. ret := &Operation{
  6039. ServerResponse: googleapi.ServerResponse{
  6040. Header: res.Header,
  6041. HTTPStatusCode: res.StatusCode,
  6042. },
  6043. }
  6044. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  6045. return nil, err
  6046. }
  6047. return ret, nil
  6048. // {
  6049. // "description": "Creates a new user in a Cloud SQL instance.",
  6050. // "httpMethod": "POST",
  6051. // "id": "sql.users.insert",
  6052. // "parameterOrder": [
  6053. // "project",
  6054. // "instance"
  6055. // ],
  6056. // "parameters": {
  6057. // "instance": {
  6058. // "description": "Database instance ID. This does not include the project ID.",
  6059. // "location": "path",
  6060. // "required": true,
  6061. // "type": "string"
  6062. // },
  6063. // "project": {
  6064. // "description": "Project ID of the project that contains the instance.",
  6065. // "location": "path",
  6066. // "required": true,
  6067. // "type": "string"
  6068. // }
  6069. // },
  6070. // "path": "projects/{project}/instances/{instance}/users",
  6071. // "request": {
  6072. // "$ref": "User"
  6073. // },
  6074. // "response": {
  6075. // "$ref": "Operation"
  6076. // },
  6077. // "scopes": [
  6078. // "https://www.googleapis.com/auth/cloud-platform",
  6079. // "https://www.googleapis.com/auth/sqlservice.admin"
  6080. // ]
  6081. // }
  6082. }
  6083. // method id "sql.users.list":
  6084. type UsersListCall struct {
  6085. s *Service
  6086. project string
  6087. instance string
  6088. urlParams_ gensupport.URLParams
  6089. ifNoneMatch_ string
  6090. ctx_ context.Context
  6091. }
  6092. // List: Lists users in the specified Cloud SQL instance.
  6093. func (r *UsersService) List(project string, instance string) *UsersListCall {
  6094. c := &UsersListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6095. c.project = project
  6096. c.instance = instance
  6097. return c
  6098. }
  6099. // Fields allows partial responses to be retrieved. See
  6100. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6101. // for more information.
  6102. func (c *UsersListCall) Fields(s ...googleapi.Field) *UsersListCall {
  6103. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6104. return c
  6105. }
  6106. // IfNoneMatch sets the optional parameter which makes the operation
  6107. // fail if the object's ETag matches the given value. This is useful for
  6108. // getting updates only after the object has changed since the last
  6109. // request. Use googleapi.IsNotModified to check whether the response
  6110. // error from Do is the result of In-None-Match.
  6111. func (c *UsersListCall) IfNoneMatch(entityTag string) *UsersListCall {
  6112. c.ifNoneMatch_ = entityTag
  6113. return c
  6114. }
  6115. // Context sets the context to be used in this call's Do method. Any
  6116. // pending HTTP request will be aborted if the provided context is
  6117. // canceled.
  6118. func (c *UsersListCall) Context(ctx context.Context) *UsersListCall {
  6119. c.ctx_ = ctx
  6120. return c
  6121. }
  6122. func (c *UsersListCall) doRequest(alt string) (*http.Response, error) {
  6123. var body io.Reader = nil
  6124. c.urlParams_.Set("alt", alt)
  6125. urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/instances/{instance}/users")
  6126. urls += "?" + c.urlParams_.Encode()
  6127. req, _ := http.NewRequest("GET", urls, body)
  6128. googleapi.Expand(req.URL, map[string]string{
  6129. "project": c.project,
  6130. "instance": c.instance,
  6131. })
  6132. req.Header.Set("User-Agent", c.s.userAgent())
  6133. if c.ifNoneMatch_ != "" {
  6134. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  6135. }
  6136. if c.ctx_ != nil {
  6137. return ctxhttp.Do(c.ctx_, c.s.client, req)
  6138. }
  6139. return c.s.client.Do(req)
  6140. }
  6141. // Do executes the "sql.users.list" call.
  6142. // Exactly one of *UsersListResponse or error will be non-nil. Any
  6143. // non-2xx status code is an error. Response headers are in either
  6144. // *UsersListResponse.ServerResponse.Header or (if a response was
  6145. // returned at all) in error.(*googleapi.Error).Header. Use
  6146. // googleapi.IsNotModified to check whether the returned error was
  6147. // because http.StatusNotModified was returned.
  6148. func (c *UsersListCall) Do(opts ...googleapi.CallOption) (*UsersListResponse, error) {
  6149. gensupport.SetOptions(c.urlParams_, opts...)
  6150. res, err := c.doRequest("json")
  6151. if res != nil && res.StatusCode == http.StatusNotModified {
  6152. if res.Body != nil {
  6153. res.Body.Close()
  6154. }
  6155. return nil, &googleapi.Error{
  6156. Code: res.StatusCode,
  6157. Header: res.Header,
  6158. }
  6159. }
  6160. if err != nil {
  6161. return nil, err
  6162. }
  6163. defer googleapi.CloseBody(res)
  6164. if err := googleapi.CheckResponse(res); err != nil {
  6165. return nil, err
  6166. }
  6167. ret := &UsersListResponse{
  6168. ServerResponse: googleapi.ServerResponse{
  6169. Header: res.Header,
  6170. HTTPStatusCode: res.StatusCode,
  6171. },
  6172. }
  6173. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  6174. return nil, err
  6175. }
  6176. return ret, nil
  6177. // {
  6178. // "description": "Lists users in the specified Cloud SQL instance.",
  6179. // "httpMethod": "GET",
  6180. // "id": "sql.users.list",
  6181. // "parameterOrder": [
  6182. // "project",
  6183. // "instance"
  6184. // ],
  6185. // "parameters": {
  6186. // "instance": {
  6187. // "description": "Database instance ID. This does not include the project ID.",
  6188. // "location": "path",
  6189. // "required": true,
  6190. // "type": "string"
  6191. // },
  6192. // "project": {
  6193. // "description": "Project ID of the project that contains the instance.",
  6194. // "location": "path",
  6195. // "required": true,
  6196. // "type": "string"
  6197. // }
  6198. // },
  6199. // "path": "projects/{project}/instances/{instance}/users",
  6200. // "response": {
  6201. // "$ref": "UsersListResponse"
  6202. // },
  6203. // "scopes": [
  6204. // "https://www.googleapis.com/auth/cloud-platform",
  6205. // "https://www.googleapis.com/auth/sqlservice.admin"
  6206. // ]
  6207. // }
  6208. }
  6209. // method id "sql.users.update":
  6210. type UsersUpdateCall struct {
  6211. s *Service
  6212. project string
  6213. instance string
  6214. user *User
  6215. urlParams_ gensupport.URLParams
  6216. ctx_ context.Context
  6217. }
  6218. // Update: Updates an existing user in a Cloud SQL instance.
  6219. func (r *UsersService) Update(project string, instance string, host string, name string, user *User) *UsersUpdateCall {
  6220. c := &UsersUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6221. c.project = project
  6222. c.instance = instance
  6223. c.urlParams_.Set("host", host)
  6224. c.urlParams_.Set("name", name)
  6225. c.user = user
  6226. return c
  6227. }
  6228. // Fields allows partial responses to be retrieved. See
  6229. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6230. // for more information.
  6231. func (c *UsersUpdateCall) Fields(s ...googleapi.Field) *UsersUpdateCall {
  6232. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6233. return c
  6234. }
  6235. // Context sets the context to be used in this call's Do method. Any
  6236. // pending HTTP request will be aborted if the provided context is
  6237. // canceled.
  6238. func (c *UsersUpdateCall) Context(ctx context.Context) *UsersUpdateCall {
  6239. c.ctx_ = ctx
  6240. return c
  6241. }
  6242. func (c *UsersUpdateCall) doRequest(alt string) (*http.Response, error) {
  6243. var body io.Reader = nil
  6244. body, err := googleapi.WithoutDataWrapper.JSONReader(c.user)
  6245. if err != nil {
  6246. return nil, err
  6247. }
  6248. ctype := "application/json"
  6249. c.urlParams_.Set("alt", alt)
  6250. urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/instances/{instance}/users")
  6251. urls += "?" + c.urlParams_.Encode()
  6252. req, _ := http.NewRequest("PUT", urls, body)
  6253. googleapi.Expand(req.URL, map[string]string{
  6254. "project": c.project,
  6255. "instance": c.instance,
  6256. })
  6257. req.Header.Set("Content-Type", ctype)
  6258. req.Header.Set("User-Agent", c.s.userAgent())
  6259. if c.ctx_ != nil {
  6260. return ctxhttp.Do(c.ctx_, c.s.client, req)
  6261. }
  6262. return c.s.client.Do(req)
  6263. }
  6264. // Do executes the "sql.users.update" call.
  6265. // Exactly one of *Operation or error will be non-nil. Any non-2xx
  6266. // status code is an error. Response headers are in either
  6267. // *Operation.ServerResponse.Header or (if a response was returned at
  6268. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  6269. // to check whether the returned error was because
  6270. // http.StatusNotModified was returned.
  6271. func (c *UsersUpdateCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  6272. gensupport.SetOptions(c.urlParams_, opts...)
  6273. res, err := c.doRequest("json")
  6274. if res != nil && res.StatusCode == http.StatusNotModified {
  6275. if res.Body != nil {
  6276. res.Body.Close()
  6277. }
  6278. return nil, &googleapi.Error{
  6279. Code: res.StatusCode,
  6280. Header: res.Header,
  6281. }
  6282. }
  6283. if err != nil {
  6284. return nil, err
  6285. }
  6286. defer googleapi.CloseBody(res)
  6287. if err := googleapi.CheckResponse(res); err != nil {
  6288. return nil, err
  6289. }
  6290. ret := &Operation{
  6291. ServerResponse: googleapi.ServerResponse{
  6292. Header: res.Header,
  6293. HTTPStatusCode: res.StatusCode,
  6294. },
  6295. }
  6296. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  6297. return nil, err
  6298. }
  6299. return ret, nil
  6300. // {
  6301. // "description": "Updates an existing user in a Cloud SQL instance.",
  6302. // "httpMethod": "PUT",
  6303. // "id": "sql.users.update",
  6304. // "parameterOrder": [
  6305. // "project",
  6306. // "instance",
  6307. // "host",
  6308. // "name"
  6309. // ],
  6310. // "parameters": {
  6311. // "host": {
  6312. // "description": "Host of the user in the instance.",
  6313. // "location": "query",
  6314. // "required": true,
  6315. // "type": "string"
  6316. // },
  6317. // "instance": {
  6318. // "description": "Database instance ID. This does not include the project ID.",
  6319. // "location": "path",
  6320. // "required": true,
  6321. // "type": "string"
  6322. // },
  6323. // "name": {
  6324. // "description": "Name of the user in the instance.",
  6325. // "location": "query",
  6326. // "required": true,
  6327. // "type": "string"
  6328. // },
  6329. // "project": {
  6330. // "description": "Project ID of the project that contains the instance.",
  6331. // "location": "path",
  6332. // "required": true,
  6333. // "type": "string"
  6334. // }
  6335. // },
  6336. // "path": "projects/{project}/instances/{instance}/users",
  6337. // "request": {
  6338. // "$ref": "User"
  6339. // },
  6340. // "response": {
  6341. // "$ref": "Operation"
  6342. // },
  6343. // "scopes": [
  6344. // "https://www.googleapis.com/auth/cloud-platform",
  6345. // "https://www.googleapis.com/auth/sqlservice.admin"
  6346. // ]
  6347. // }
  6348. }