12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019 |
- // Package sqladmin provides access to the Cloud SQL Administration API.
- //
- // See https://cloud.google.com/sql/docs/reference/latest
- //
- // Usage example:
- //
- // import "google.golang.org/api/sqladmin/v1beta4"
- // ...
- // sqladminService, err := sqladmin.New(oauthHttpClient)
- package sqladmin // import "google.golang.org/api/sqladmin/v1beta4"
- import (
- "bytes"
- "encoding/json"
- "errors"
- "fmt"
- context "golang.org/x/net/context"
- ctxhttp "golang.org/x/net/context/ctxhttp"
- gensupport "google.golang.org/api/gensupport"
- googleapi "google.golang.org/api/googleapi"
- "io"
- "net/http"
- "net/url"
- "strconv"
- "strings"
- )
- // Always reference these packages, just in case the auto-generated code
- // below doesn't.
- var _ = bytes.NewBuffer
- var _ = strconv.Itoa
- var _ = fmt.Sprintf
- var _ = json.NewDecoder
- var _ = io.Copy
- var _ = url.Parse
- var _ = gensupport.MarshalJSON
- var _ = googleapi.Version
- var _ = errors.New
- var _ = strings.Replace
- var _ = context.Canceled
- var _ = ctxhttp.Do
- const apiId = "sqladmin:v1beta4"
- const apiName = "sqladmin"
- const apiVersion = "v1beta4"
- const basePath = "https://www.googleapis.com/sql/v1beta4/"
- // OAuth2 scopes used by this API.
- const (
- // View and manage your data across Google Cloud Platform services
- CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform"
- // Manage your Google SQL Service instances
- SqlserviceAdminScope = "https://www.googleapis.com/auth/sqlservice.admin"
- )
- func New(client *http.Client) (*Service, error) {
- if client == nil {
- return nil, errors.New("client is nil")
- }
- s := &Service{client: client, BasePath: basePath}
- s.BackupRuns = NewBackupRunsService(s)
- s.Databases = NewDatabasesService(s)
- s.Flags = NewFlagsService(s)
- s.Instances = NewInstancesService(s)
- s.Operations = NewOperationsService(s)
- s.SslCerts = NewSslCertsService(s)
- s.Tiers = NewTiersService(s)
- s.Users = NewUsersService(s)
- return s, nil
- }
- type Service struct {
- client *http.Client
- BasePath string // API endpoint base URL
- UserAgent string // optional additional User-Agent fragment
- BackupRuns *BackupRunsService
- Databases *DatabasesService
- Flags *FlagsService
- Instances *InstancesService
- Operations *OperationsService
- SslCerts *SslCertsService
- Tiers *TiersService
- Users *UsersService
- }
- func (s *Service) userAgent() string {
- if s.UserAgent == "" {
- return googleapi.UserAgent
- }
- return googleapi.UserAgent + " " + s.UserAgent
- }
- func NewBackupRunsService(s *Service) *BackupRunsService {
- rs := &BackupRunsService{s: s}
- return rs
- }
- type BackupRunsService struct {
- s *Service
- }
- func NewDatabasesService(s *Service) *DatabasesService {
- rs := &DatabasesService{s: s}
- return rs
- }
- type DatabasesService struct {
- s *Service
- }
- func NewFlagsService(s *Service) *FlagsService {
- rs := &FlagsService{s: s}
- return rs
- }
- type FlagsService struct {
- s *Service
- }
- func NewInstancesService(s *Service) *InstancesService {
- rs := &InstancesService{s: s}
- return rs
- }
- type InstancesService struct {
- s *Service
- }
- func NewOperationsService(s *Service) *OperationsService {
- rs := &OperationsService{s: s}
- return rs
- }
- type OperationsService struct {
- s *Service
- }
- func NewSslCertsService(s *Service) *SslCertsService {
- rs := &SslCertsService{s: s}
- return rs
- }
- type SslCertsService struct {
- s *Service
- }
- func NewTiersService(s *Service) *TiersService {
- rs := &TiersService{s: s}
- return rs
- }
- type TiersService struct {
- s *Service
- }
- func NewUsersService(s *Service) *UsersService {
- rs := &UsersService{s: s}
- return rs
- }
- type UsersService struct {
- s *Service
- }
- // AclEntry: An entry for an Access Control list.
- type AclEntry struct {
- // ExpirationTime: The time when this access control entry expires in
- // RFC 3339 format, for example 2012-11-15T16:19:00.094Z.
- ExpirationTime string `json:"expirationTime,omitempty"`
- // Kind: This is always sql#aclEntry.
- Kind string `json:"kind,omitempty"`
- // Name: An optional label to identify this entry.
- Name string `json:"name,omitempty"`
- // Value: The whitelisted value for the access control list.
- Value string `json:"value,omitempty"`
- // ForceSendFields is a list of field names (e.g. "ExpirationTime") to
- // unconditionally include in API requests. By default, fields with
- // empty values are omitted from API requests. However, any non-pointer,
- // non-interface field appearing in ForceSendFields will be sent to the
- // server regardless of whether the field is empty or not. This may be
- // used to include empty fields in Patch requests.
- ForceSendFields []string `json:"-"`
- }
- func (s *AclEntry) MarshalJSON() ([]byte, error) {
- type noMethod AclEntry
- raw := noMethod(*s)
- return gensupport.MarshalJSON(raw, s.ForceSendFields)
- }
- // BackupConfiguration: Database instance backup configuration.
- type BackupConfiguration struct {
- // BinaryLogEnabled: Whether binary log is enabled. If backup
- // configuration is disabled, binary log must be disabled as well.
- BinaryLogEnabled bool `json:"binaryLogEnabled,omitempty"`
- // Enabled: Whether this configuration is enabled.
- Enabled bool `json:"enabled,omitempty"`
- // Kind: This is always sql#backupConfiguration.
- Kind string `json:"kind,omitempty"`
- // StartTime: Start time for the daily backup configuration in UTC
- // timezone in the 24 hour format - HH:MM.
- StartTime string `json:"startTime,omitempty"`
- // ForceSendFields is a list of field names (e.g. "BinaryLogEnabled") to
- // unconditionally include in API requests. By default, fields with
- // empty values are omitted from API requests. However, any non-pointer,
- // non-interface field appearing in ForceSendFields will be sent to the
- // server regardless of whether the field is empty or not. This may be
- // used to include empty fields in Patch requests.
- ForceSendFields []string `json:"-"`
- }
- func (s *BackupConfiguration) MarshalJSON() ([]byte, error) {
- type noMethod BackupConfiguration
- raw := noMethod(*s)
- return gensupport.MarshalJSON(raw, s.ForceSendFields)
- }
- // BackupRun: A database instance backup run resource.
- type BackupRun struct {
- // EndTime: The time the backup operation completed in UTC timezone in
- // RFC 3339 format, for example 2012-11-15T16:19:00.094Z.
- EndTime string `json:"endTime,omitempty"`
- // EnqueuedTime: The time the run was enqueued in UTC timezone in RFC
- // 3339 format, for example 2012-11-15T16:19:00.094Z.
- EnqueuedTime string `json:"enqueuedTime,omitempty"`
- // Error: Information about why the backup operation failed. This is
- // only present if the run has the FAILED status.
- Error *OperationError `json:"error,omitempty"`
- // Id: A unique identifier for this backup run. Note that this is unique
- // only within the scope of a particular Cloud SQL instance.
- Id int64 `json:"id,omitempty,string"`
- // Instance: Name of the database instance.
- Instance string `json:"instance,omitempty"`
- // Kind: This is always sql#backupRun.
- Kind string `json:"kind,omitempty"`
- // SelfLink: The URI of this resource.
- SelfLink string `json:"selfLink,omitempty"`
- // StartTime: The time the backup operation actually started in UTC
- // timezone in RFC 3339 format, for example 2012-11-15T16:19:00.094Z.
- StartTime string `json:"startTime,omitempty"`
- // Status: The status of this run.
- Status string `json:"status,omitempty"`
- // WindowStartTime: The start time of the backup window during which
- // this the backup was attempted in RFC 3339 format, for example
- // 2012-11-15T16:19:00.094Z.
- WindowStartTime string `json:"windowStartTime,omitempty"`
- // ServerResponse contains the HTTP response code and headers from the
- // server.
- googleapi.ServerResponse `json:"-"`
- // ForceSendFields is a list of field names (e.g. "EndTime") to
- // unconditionally include in API requests. By default, fields with
- // empty values are omitted from API requests. However, any non-pointer,
- // non-interface field appearing in ForceSendFields will be sent to the
- // server regardless of whether the field is empty or not. This may be
- // used to include empty fields in Patch requests.
- ForceSendFields []string `json:"-"`
- }
- func (s *BackupRun) MarshalJSON() ([]byte, error) {
- type noMethod BackupRun
- raw := noMethod(*s)
- return gensupport.MarshalJSON(raw, s.ForceSendFields)
- }
- // BackupRunsListResponse: Backup run list results.
- type BackupRunsListResponse struct {
- // Items: A list of backup runs in reverse chronological order of the
- // enqueued time.
- Items []*BackupRun `json:"items,omitempty"`
- // Kind: This is always sql#backupRunsList.
- Kind string `json:"kind,omitempty"`
- // NextPageToken: The continuation token, used to page through large
- // result sets. Provide this value in a subsequent request to return the
- // next page of results.
- NextPageToken string `json:"nextPageToken,omitempty"`
- // ServerResponse contains the HTTP response code and headers from the
- // server.
- googleapi.ServerResponse `json:"-"`
- // ForceSendFields is a list of field names (e.g. "Items") to
- // unconditionally include in API requests. By default, fields with
- // empty values are omitted from API requests. However, any non-pointer,
- // non-interface field appearing in ForceSendFields will be sent to the
- // server regardless of whether the field is empty or not. This may be
- // used to include empty fields in Patch requests.
- ForceSendFields []string `json:"-"`
- }
- func (s *BackupRunsListResponse) MarshalJSON() ([]byte, error) {
- type noMethod BackupRunsListResponse
- raw := noMethod(*s)
- return gensupport.MarshalJSON(raw, s.ForceSendFields)
- }
- // BinLogCoordinates: Binary log coordinates.
- type BinLogCoordinates struct {
- // BinLogFileName: Name of the binary log file for a Cloud SQL instance.
- BinLogFileName string `json:"binLogFileName,omitempty"`
- // BinLogPosition: Position (offset) within the binary log file.
- BinLogPosition int64 `json:"binLogPosition,omitempty,string"`
- // Kind: This is always sql#binLogCoordinates.
- Kind string `json:"kind,omitempty"`
- // ForceSendFields is a list of field names (e.g. "BinLogFileName") to
- // unconditionally include in API requests. By default, fields with
- // empty values are omitted from API requests. However, any non-pointer,
- // non-interface field appearing in ForceSendFields will be sent to the
- // server regardless of whether the field is empty or not. This may be
- // used to include empty fields in Patch requests.
- ForceSendFields []string `json:"-"`
- }
- func (s *BinLogCoordinates) MarshalJSON() ([]byte, error) {
- type noMethod BinLogCoordinates
- raw := noMethod(*s)
- return gensupport.MarshalJSON(raw, s.ForceSendFields)
- }
- // CloneContext: Database instance clone context.
- type CloneContext struct {
- // BinLogCoordinates: Binary log coordinates, if specified, indentify
- // the the position up to which the source instance should be cloned. If
- // not specified, the source instance is cloned up to the most recent
- // binary log coordintes.
- BinLogCoordinates *BinLogCoordinates `json:"binLogCoordinates,omitempty"`
- // DestinationInstanceName: Name of the Cloud SQL instance to be created
- // as a clone.
- DestinationInstanceName string `json:"destinationInstanceName,omitempty"`
- // Kind: This is always sql#cloneContext.
- Kind string `json:"kind,omitempty"`
- // ForceSendFields is a list of field names (e.g. "BinLogCoordinates")
- // to unconditionally include in API requests. By default, fields with
- // empty values are omitted from API requests. However, any non-pointer,
- // non-interface field appearing in ForceSendFields will be sent to the
- // server regardless of whether the field is empty or not. This may be
- // used to include empty fields in Patch requests.
- ForceSendFields []string `json:"-"`
- }
- func (s *CloneContext) MarshalJSON() ([]byte, error) {
- type noMethod CloneContext
- raw := noMethod(*s)
- return gensupport.MarshalJSON(raw, s.ForceSendFields)
- }
- // Database: A database resource inside a Cloud SQL instance.
- type Database struct {
- // Charset: The MySQL charset value.
- Charset string `json:"charset,omitempty"`
- // Collation: The MySQL collation value.
- Collation string `json:"collation,omitempty"`
- // Etag: HTTP 1.1 Entity tag for the resource.
- Etag string `json:"etag,omitempty"`
- // Instance: The name of the Cloud SQL instance. This does not include
- // the project ID.
- Instance string `json:"instance,omitempty"`
- // Kind: This is always sql#database.
- Kind string `json:"kind,omitempty"`
- // Name: The name of the database in the Cloud SQL instance. This does
- // not include the project ID or instance name.
- Name string `json:"name,omitempty"`
- // Project: The project ID of the project containing the Cloud SQL
- // database. The Google apps domain is prefixed if applicable.
- Project string `json:"project,omitempty"`
- // SelfLink: The URI of this resource.
- SelfLink string `json:"selfLink,omitempty"`
- // ServerResponse contains the HTTP response code and headers from the
- // server.
- googleapi.ServerResponse `json:"-"`
- // ForceSendFields is a list of field names (e.g. "Charset") to
- // unconditionally include in API requests. By default, fields with
- // empty values are omitted from API requests. However, any non-pointer,
- // non-interface field appearing in ForceSendFields will be sent to the
- // server regardless of whether the field is empty or not. This may be
- // used to include empty fields in Patch requests.
- ForceSendFields []string `json:"-"`
- }
- func (s *Database) MarshalJSON() ([]byte, error) {
- type noMethod Database
- raw := noMethod(*s)
- return gensupport.MarshalJSON(raw, s.ForceSendFields)
- }
- // DatabaseFlags: MySQL flags for Cloud SQL instances.
- type DatabaseFlags struct {
- // Name: The name of the flag. These flags are passed at instance
- // startup, so include both MySQL server options and MySQL system
- // variables. Flags should be specified with underscores, not hyphens.
- // For more information, see Configuring MySQL Flags in the Google Cloud
- // SQL documentation, as well as the official MySQL documentation for
- // server options and system variables.
- Name string `json:"name,omitempty"`
- // Value: The value of the flag. Booleans should be set to on for true
- // and off for false. This field must be omitted if the flag doesn't
- // take a value.
- Value string `json:"value,omitempty"`
- // ForceSendFields is a list of field names (e.g. "Name") to
- // unconditionally include in API requests. By default, fields with
- // empty values are omitted from API requests. However, any non-pointer,
- // non-interface field appearing in ForceSendFields will be sent to the
- // server regardless of whether the field is empty or not. This may be
- // used to include empty fields in Patch requests.
- ForceSendFields []string `json:"-"`
- }
- func (s *DatabaseFlags) MarshalJSON() ([]byte, error) {
- type noMethod DatabaseFlags
- raw := noMethod(*s)
- return gensupport.MarshalJSON(raw, s.ForceSendFields)
- }
- // DatabaseInstance: A Cloud SQL instance resource.
- type DatabaseInstance struct {
- // CurrentDiskSize: The current disk usage of the instance in bytes.
- CurrentDiskSize int64 `json:"currentDiskSize,omitempty,string"`
- // DatabaseVersion: The database engine type and version. Can be
- // MYSQL_5_5 or MYSQL_5_6. Defaults to MYSQL_5_5. The databaseVersion
- // can not be changed after instance creation.
- DatabaseVersion string `json:"databaseVersion,omitempty"`
- // Etag: HTTP 1.1 Entity tag for the resource.
- Etag string `json:"etag,omitempty"`
- // FailoverReplica: The name and status of the failover replica. Only
- // applies to Second Generation instances.
- FailoverReplica *DatabaseInstanceFailoverReplica `json:"failoverReplica,omitempty"`
- // InstanceType: The instance type. This can be one of the
- // following.
- // CLOUD_SQL_INSTANCE: A Cloud SQL instance that is not replicating from
- // a master.
- // ON_PREMISES_INSTANCE: An instance running on the customer's
- // premises.
- // READ_REPLICA_INSTANCE: A Cloud SQL instance configured as a
- // read-replica.
- InstanceType string `json:"instanceType,omitempty"`
- // IpAddresses: The assigned IP addresses for the instance.
- IpAddresses []*IpMapping `json:"ipAddresses,omitempty"`
- // Ipv6Address: The IPv6 address assigned to the instance.
- Ipv6Address string `json:"ipv6Address,omitempty"`
- // Kind: This is always sql#instance.
- Kind string `json:"kind,omitempty"`
- // MasterInstanceName: The name of the instance which will act as master
- // in the replication setup.
- MasterInstanceName string `json:"masterInstanceName,omitempty"`
- // MaxDiskSize: The maximum disk size of the instance in bytes.
- MaxDiskSize int64 `json:"maxDiskSize,omitempty,string"`
- // Name: Name of the Cloud SQL instance. This does not include the
- // project ID.
- Name string `json:"name,omitempty"`
- // OnPremisesConfiguration: Configuration specific to on-premises
- // instances.
- OnPremisesConfiguration *OnPremisesConfiguration `json:"onPremisesConfiguration,omitempty"`
- // Project: The project ID of the project containing the Cloud SQL
- // instance. The Google apps domain is prefixed if applicable.
- Project string `json:"project,omitempty"`
- // Region: The geographical region. Can be us-central, asia-east1 or
- // europe-west1. Defaults to us-central. The region can not be changed
- // after instance creation.
- Region string `json:"region,omitempty"`
- // ReplicaConfiguration: Configuration specific to read-replicas
- // replicating from on-premises masters.
- ReplicaConfiguration *ReplicaConfiguration `json:"replicaConfiguration,omitempty"`
- // ReplicaNames: The replicas of the instance.
- ReplicaNames []string `json:"replicaNames,omitempty"`
- // SelfLink: The URI of this resource.
- SelfLink string `json:"selfLink,omitempty"`
- // ServerCaCert: SSL configuration.
- ServerCaCert *SslCert `json:"serverCaCert,omitempty"`
- // ServiceAccountEmailAddress: The service account email address
- // assigned to the instance.
- ServiceAccountEmailAddress string `json:"serviceAccountEmailAddress,omitempty"`
- // Settings: The user settings.
- Settings *Settings `json:"settings,omitempty"`
- // State: The current serving state of the Cloud SQL instance. This can
- // be one of the following.
- // RUNNABLE: The instance is running, or is ready to run when
- // accessed.
- // SUSPENDED: The instance is not available, for example due to problems
- // with billing.
- // PENDING_CREATE: The instance is being created.
- // MAINTENANCE: The instance is down for maintenance.
- // FAILED: The instance creation failed.
- // UNKNOWN_STATE: The state of the instance is unknown.
- State string `json:"state,omitempty"`
- // ServerResponse contains the HTTP response code and headers from the
- // server.
- googleapi.ServerResponse `json:"-"`
- // ForceSendFields is a list of field names (e.g. "CurrentDiskSize") to
- // unconditionally include in API requests. By default, fields with
- // empty values are omitted from API requests. However, any non-pointer,
- // non-interface field appearing in ForceSendFields will be sent to the
- // server regardless of whether the field is empty or not. This may be
- // used to include empty fields in Patch requests.
- ForceSendFields []string `json:"-"`
- }
- func (s *DatabaseInstance) MarshalJSON() ([]byte, error) {
- type noMethod DatabaseInstance
- raw := noMethod(*s)
- return gensupport.MarshalJSON(raw, s.ForceSendFields)
- }
- // DatabaseInstanceFailoverReplica: The name and status of the failover
- // replica. Only applies to Second Generation instances.
- type DatabaseInstanceFailoverReplica struct {
- Available bool `json:"available,omitempty"`
- Name string `json:"name,omitempty"`
- // ForceSendFields is a list of field names (e.g. "Available") to
- // unconditionally include in API requests. By default, fields with
- // empty values are omitted from API requests. However, any non-pointer,
- // non-interface field appearing in ForceSendFields will be sent to the
- // server regardless of whether the field is empty or not. This may be
- // used to include empty fields in Patch requests.
- ForceSendFields []string `json:"-"`
- }
- func (s *DatabaseInstanceFailoverReplica) MarshalJSON() ([]byte, error) {
- type noMethod DatabaseInstanceFailoverReplica
- raw := noMethod(*s)
- return gensupport.MarshalJSON(raw, s.ForceSendFields)
- }
- // DatabasesListResponse: Database list response.
- type DatabasesListResponse struct {
- // Items: List of database resources in the instance.
- Items []*Database `json:"items,omitempty"`
- // Kind: This is always sql#databasesList.
- Kind string `json:"kind,omitempty"`
- // ServerResponse contains the HTTP response code and headers from the
- // server.
- googleapi.ServerResponse `json:"-"`
- // ForceSendFields is a list of field names (e.g. "Items") to
- // unconditionally include in API requests. By default, fields with
- // empty values are omitted from API requests. However, any non-pointer,
- // non-interface field appearing in ForceSendFields will be sent to the
- // server regardless of whether the field is empty or not. This may be
- // used to include empty fields in Patch requests.
- ForceSendFields []string `json:"-"`
- }
- func (s *DatabasesListResponse) MarshalJSON() ([]byte, error) {
- type noMethod DatabasesListResponse
- raw := noMethod(*s)
- return gensupport.MarshalJSON(raw, s.ForceSendFields)
- }
- // ExportContext: Database instance export context.
- type ExportContext struct {
- // CsvExportOptions: Options for exporting data as CSV.
- CsvExportOptions *ExportContextCsvExportOptions `json:"csvExportOptions,omitempty"`
- // Databases: Databases (for example, guestbook) from which the export
- // is made. If fileType is SQL and no database is specified, all
- // databases are exported. If fileType is CSV, you can optionally
- // specify at most one database to export. If
- // csvExportOptions.selectQuery also specifies the database, this field
- // will be ignored.
- Databases []string `json:"databases,omitempty"`
- // FileType: The file type for the specified uri.
- // SQL: The file contains SQL statements.
- // CSV: The file contains CSV data.
- FileType string `json:"fileType,omitempty"`
- // Kind: This is always sql#exportContext.
- Kind string `json:"kind,omitempty"`
- // SqlExportOptions: Options for exporting data as SQL statements.
- SqlExportOptions *ExportContextSqlExportOptions `json:"sqlExportOptions,omitempty"`
- // Uri: The path to the file in Google Cloud Storage where the export
- // will be stored. The URI is in the form gs://bucketName/fileName. If
- // the file already exists, the operation fails. If fileType is SQL and
- // the filename ends with .gz, the contents are compressed.
- Uri string `json:"uri,omitempty"`
- // ForceSendFields is a list of field names (e.g. "CsvExportOptions") to
- // unconditionally include in API requests. By default, fields with
- // empty values are omitted from API requests. However, any non-pointer,
- // non-interface field appearing in ForceSendFields will be sent to the
- // server regardless of whether the field is empty or not. This may be
- // used to include empty fields in Patch requests.
- ForceSendFields []string `json:"-"`
- }
- func (s *ExportContext) MarshalJSON() ([]byte, error) {
- type noMethod ExportContext
- raw := noMethod(*s)
- return gensupport.MarshalJSON(raw, s.ForceSendFields)
- }
- // ExportContextCsvExportOptions: Options for exporting data as CSV.
- type ExportContextCsvExportOptions struct {
- // SelectQuery: The select query used to extract the data.
- SelectQuery string `json:"selectQuery,omitempty"`
- // ForceSendFields is a list of field names (e.g. "SelectQuery") to
- // unconditionally include in API requests. By default, fields with
- // empty values are omitted from API requests. However, any non-pointer,
- // non-interface field appearing in ForceSendFields will be sent to the
- // server regardless of whether the field is empty or not. This may be
- // used to include empty fields in Patch requests.
- ForceSendFields []string `json:"-"`
- }
- func (s *ExportContextCsvExportOptions) MarshalJSON() ([]byte, error) {
- type noMethod ExportContextCsvExportOptions
- raw := noMethod(*s)
- return gensupport.MarshalJSON(raw, s.ForceSendFields)
- }
- // ExportContextSqlExportOptions: Options for exporting data as SQL
- // statements.
- type ExportContextSqlExportOptions struct {
- // SchemaOnly: Export only schemas.
- SchemaOnly bool `json:"schemaOnly,omitempty"`
- // Tables: Tables to export, or that were exported, from the specified
- // database. If you specify tables, specify one and only one database.
- Tables []string `json:"tables,omitempty"`
- // ForceSendFields is a list of field names (e.g. "SchemaOnly") to
- // unconditionally include in API requests. By default, fields with
- // empty values are omitted from API requests. However, any non-pointer,
- // non-interface field appearing in ForceSendFields will be sent to the
- // server regardless of whether the field is empty or not. This may be
- // used to include empty fields in Patch requests.
- ForceSendFields []string `json:"-"`
- }
- func (s *ExportContextSqlExportOptions) MarshalJSON() ([]byte, error) {
- type noMethod ExportContextSqlExportOptions
- raw := noMethod(*s)
- return gensupport.MarshalJSON(raw, s.ForceSendFields)
- }
- // FailoverContext: Database instance failover context.
- type FailoverContext struct {
- // Kind: This is always sql#failoverContext.
- Kind string `json:"kind,omitempty"`
- // SettingsVersion: The current settings version of this instance.
- // Request will be rejected if this version doesn't match the current
- // settings version.
- SettingsVersion int64 `json:"settingsVersion,omitempty,string"`
- // ForceSendFields is a list of field names (e.g. "Kind") to
- // unconditionally include in API requests. By default, fields with
- // empty values are omitted from API requests. However, any non-pointer,
- // non-interface field appearing in ForceSendFields will be sent to the
- // server regardless of whether the field is empty or not. This may be
- // used to include empty fields in Patch requests.
- ForceSendFields []string `json:"-"`
- }
- func (s *FailoverContext) MarshalJSON() ([]byte, error) {
- type noMethod FailoverContext
- raw := noMethod(*s)
- return gensupport.MarshalJSON(raw, s.ForceSendFields)
- }
- // Flag: A Google Cloud SQL service flag resource.
- type Flag struct {
- // AllowedStringValues: For STRING flags, a list of strings that the
- // value can be set to.
- AllowedStringValues []string `json:"allowedStringValues,omitempty"`
- // AppliesTo: The database version this flag applies to. Can be
- // MYSQL_5_5, MYSQL_5_6, or both.
- AppliesTo []string `json:"appliesTo,omitempty"`
- // Kind: This is always sql#flag.
- Kind string `json:"kind,omitempty"`
- // MaxValue: For INTEGER flags, the maximum allowed value.
- MaxValue int64 `json:"maxValue,omitempty,string"`
- // MinValue: For INTEGER flags, the minimum allowed value.
- MinValue int64 `json:"minValue,omitempty,string"`
- // Name: This is the name of the flag. Flag names always use
- // underscores, not hyphens, e.g. max_allowed_packet
- Name string `json:"name,omitempty"`
- // RequiresRestart: Indicates whether changing this flag will trigger a
- // database restart. Only applicable to Second Generation instances.
- RequiresRestart bool `json:"requiresRestart,omitempty"`
- // Type: The type of the flag. Flags are typed to being BOOLEAN, STRING,
- // INTEGER or NONE. NONE is used for flags which do not take a value,
- // such as skip_grant_tables.
- Type string `json:"type,omitempty"`
- // ForceSendFields is a list of field names (e.g. "AllowedStringValues")
- // to unconditionally include in API requests. By default, fields with
- // empty values are omitted from API requests. However, any non-pointer,
- // non-interface field appearing in ForceSendFields will be sent to the
- // server regardless of whether the field is empty or not. This may be
- // used to include empty fields in Patch requests.
- ForceSendFields []string `json:"-"`
- }
- func (s *Flag) MarshalJSON() ([]byte, error) {
- type noMethod Flag
- raw := noMethod(*s)
- return gensupport.MarshalJSON(raw, s.ForceSendFields)
- }
- // FlagsListResponse: Flags list response.
- type FlagsListResponse struct {
- // Items: List of flags.
- Items []*Flag `json:"items,omitempty"`
- // Kind: This is always sql#flagsList.
- Kind string `json:"kind,omitempty"`
- // ServerResponse contains the HTTP response code and headers from the
- // server.
- googleapi.ServerResponse `json:"-"`
- // ForceSendFields is a list of field names (e.g. "Items") to
- // unconditionally include in API requests. By default, fields with
- // empty values are omitted from API requests. However, any non-pointer,
- // non-interface field appearing in ForceSendFields will be sent to the
- // server regardless of whether the field is empty or not. This may be
- // used to include empty fields in Patch requests.
- ForceSendFields []string `json:"-"`
- }
- func (s *FlagsListResponse) MarshalJSON() ([]byte, error) {
- type noMethod FlagsListResponse
- raw := noMethod(*s)
- return gensupport.MarshalJSON(raw, s.ForceSendFields)
- }
- // ImportContext: Database instance import context.
- type ImportContext struct {
- // CsvImportOptions: Options for importing data as CSV.
- CsvImportOptions *ImportContextCsvImportOptions `json:"csvImportOptions,omitempty"`
- // Database: The database (for example, guestbook) to which the import
- // is made. If fileType is SQL and no database is specified, it is
- // assumed that the database is specified in the file to be imported. If
- // fileType is CSV, it must be specified.
- Database string `json:"database,omitempty"`
- // FileType: The file type for the specified uri.
- // SQL: The file contains SQL statements.
- // CSV: The file contains CSV data.
- FileType string `json:"fileType,omitempty"`
- // Kind: This is always sql#importContext.
- Kind string `json:"kind,omitempty"`
- // Uri: A path to the file in Google Cloud Storage from which the import
- // is made. The URI is in the form gs://bucketName/fileName. Compressed
- // gzip files (.gz) are supported when fileType is SQL.
- Uri string `json:"uri,omitempty"`
- // ForceSendFields is a list of field names (e.g. "CsvImportOptions") to
- // unconditionally include in API requests. By default, fields with
- // empty values are omitted from API requests. However, any non-pointer,
- // non-interface field appearing in ForceSendFields will be sent to the
- // server regardless of whether the field is empty or not. This may be
- // used to include empty fields in Patch requests.
- ForceSendFields []string `json:"-"`
- }
- func (s *ImportContext) MarshalJSON() ([]byte, error) {
- type noMethod ImportContext
- raw := noMethod(*s)
- return gensupport.MarshalJSON(raw, s.ForceSendFields)
- }
- // ImportContextCsvImportOptions: Options for importing data as CSV.
- type ImportContextCsvImportOptions struct {
- // Columns: The columns to which CSV data is imported. If not specified,
- // all columns of the database table are loaded with CSV data.
- Columns []string `json:"columns,omitempty"`
- // Table: The table to which CSV data is imported.
- Table string `json:"table,omitempty"`
- // ForceSendFields is a list of field names (e.g. "Columns") to
- // unconditionally include in API requests. By default, fields with
- // empty values are omitted from API requests. However, any non-pointer,
- // non-interface field appearing in ForceSendFields will be sent to the
- // server regardless of whether the field is empty or not. This may be
- // used to include empty fields in Patch requests.
- ForceSendFields []string `json:"-"`
- }
- func (s *ImportContextCsvImportOptions) MarshalJSON() ([]byte, error) {
- type noMethod ImportContextCsvImportOptions
- raw := noMethod(*s)
- return gensupport.MarshalJSON(raw, s.ForceSendFields)
- }
- // InstancesCloneRequest: Database instance clone request.
- type InstancesCloneRequest struct {
- // CloneContext: Contains details about the clone operation.
- CloneContext *CloneContext `json:"cloneContext,omitempty"`
- // ForceSendFields is a list of field names (e.g. "CloneContext") to
- // unconditionally include in API requests. By default, fields with
- // empty values are omitted from API requests. However, any non-pointer,
- // non-interface field appearing in ForceSendFields will be sent to the
- // server regardless of whether the field is empty or not. This may be
- // used to include empty fields in Patch requests.
- ForceSendFields []string `json:"-"`
- }
- func (s *InstancesCloneRequest) MarshalJSON() ([]byte, error) {
- type noMethod InstancesCloneRequest
- raw := noMethod(*s)
- return gensupport.MarshalJSON(raw, s.ForceSendFields)
- }
- // InstancesExportRequest: Database instance export request.
- type InstancesExportRequest struct {
- // ExportContext: Contains details about the export operation.
- ExportContext *ExportContext `json:"exportContext,omitempty"`
- // ForceSendFields is a list of field names (e.g. "ExportContext") to
- // unconditionally include in API requests. By default, fields with
- // empty values are omitted from API requests. However, any non-pointer,
- // non-interface field appearing in ForceSendFields will be sent to the
- // server regardless of whether the field is empty or not. This may be
- // used to include empty fields in Patch requests.
- ForceSendFields []string `json:"-"`
- }
- func (s *InstancesExportRequest) MarshalJSON() ([]byte, error) {
- type noMethod InstancesExportRequest
- raw := noMethod(*s)
- return gensupport.MarshalJSON(raw, s.ForceSendFields)
- }
- // InstancesFailoverRequest: Instance failover request.
- type InstancesFailoverRequest struct {
- // FailoverContext: Failover Context.
- FailoverContext *FailoverContext `json:"failoverContext,omitempty"`
- // ForceSendFields is a list of field names (e.g. "FailoverContext") to
- // unconditionally include in API requests. By default, fields with
- // empty values are omitted from API requests. However, any non-pointer,
- // non-interface field appearing in ForceSendFields will be sent to the
- // server regardless of whether the field is empty or not. This may be
- // used to include empty fields in Patch requests.
- ForceSendFields []string `json:"-"`
- }
- func (s *InstancesFailoverRequest) MarshalJSON() ([]byte, error) {
- type noMethod InstancesFailoverRequest
- raw := noMethod(*s)
- return gensupport.MarshalJSON(raw, s.ForceSendFields)
- }
- // InstancesImportRequest: Database instance import request.
- type InstancesImportRequest struct {
- // ImportContext: Contains details about the import operation.
- ImportContext *ImportContext `json:"importContext,omitempty"`
- // ForceSendFields is a list of field names (e.g. "ImportContext") to
- // unconditionally include in API requests. By default, fields with
- // empty values are omitted from API requests. However, any non-pointer,
- // non-interface field appearing in ForceSendFields will be sent to the
- // server regardless of whether the field is empty or not. This may be
- // used to include empty fields in Patch requests.
- ForceSendFields []string `json:"-"`
- }
- func (s *InstancesImportRequest) MarshalJSON() ([]byte, error) {
- type noMethod InstancesImportRequest
- raw := noMethod(*s)
- return gensupport.MarshalJSON(raw, s.ForceSendFields)
- }
- // InstancesListResponse: Database instances list response.
- type InstancesListResponse struct {
- // Items: List of database instance resources.
- Items []*DatabaseInstance `json:"items,omitempty"`
- // Kind: This is always sql#instancesList.
- Kind string `json:"kind,omitempty"`
- // NextPageToken: The continuation token, used to page through large
- // result sets. Provide this value in a subsequent request to return the
- // next page of results.
- NextPageToken string `json:"nextPageToken,omitempty"`
- // ServerResponse contains the HTTP response code and headers from the
- // server.
- googleapi.ServerResponse `json:"-"`
- // ForceSendFields is a list of field names (e.g. "Items") to
- // unconditionally include in API requests. By default, fields with
- // empty values are omitted from API requests. However, any non-pointer,
- // non-interface field appearing in ForceSendFields will be sent to the
- // server regardless of whether the field is empty or not. This may be
- // used to include empty fields in Patch requests.
- ForceSendFields []string `json:"-"`
- }
- func (s *InstancesListResponse) MarshalJSON() ([]byte, error) {
- type noMethod InstancesListResponse
- raw := noMethod(*s)
- return gensupport.MarshalJSON(raw, s.ForceSendFields)
- }
- // InstancesRestoreBackupRequest: Database instance restore backup
- // request.
- type InstancesRestoreBackupRequest struct {
- // RestoreBackupContext: Parameters required to perform the restore
- // backup operation.
- RestoreBackupContext *RestoreBackupContext `json:"restoreBackupContext,omitempty"`
- // ForceSendFields is a list of field names (e.g.
- // "RestoreBackupContext") to unconditionally include in API requests.
- // By default, fields with empty values are omitted from API requests.
- // However, any non-pointer, non-interface field appearing in
- // ForceSendFields will be sent to the server regardless of whether the
- // field is empty or not. This may be used to include empty fields in
- // Patch requests.
- ForceSendFields []string `json:"-"`
- }
- func (s *InstancesRestoreBackupRequest) MarshalJSON() ([]byte, error) {
- type noMethod InstancesRestoreBackupRequest
- raw := noMethod(*s)
- return gensupport.MarshalJSON(raw, s.ForceSendFields)
- }
- // IpConfiguration: IP Management configuration.
- type IpConfiguration struct {
- // AuthorizedNetworks: The list of external networks that are allowed to
- // connect to the instance using the IP. In CIDR notation, also known as
- // 'slash' notation (e.g. 192.168.100.0/24).
- AuthorizedNetworks []*AclEntry `json:"authorizedNetworks,omitempty"`
- // Ipv4Enabled: Whether the instance should be assigned an IP address or
- // not.
- Ipv4Enabled bool `json:"ipv4Enabled,omitempty"`
- // RequireSsl: Whether the mysqld should default to 'REQUIRE X509' for
- // users connecting over IP.
- RequireSsl bool `json:"requireSsl,omitempty"`
- // ForceSendFields is a list of field names (e.g. "AuthorizedNetworks")
- // to unconditionally include in API requests. By default, fields with
- // empty values are omitted from API requests. However, any non-pointer,
- // non-interface field appearing in ForceSendFields will be sent to the
- // server regardless of whether the field is empty or not. This may be
- // used to include empty fields in Patch requests.
- ForceSendFields []string `json:"-"`
- }
- func (s *IpConfiguration) MarshalJSON() ([]byte, error) {
- type noMethod IpConfiguration
- raw := noMethod(*s)
- return gensupport.MarshalJSON(raw, s.ForceSendFields)
- }
- // IpMapping: Database instance IP Mapping.
- type IpMapping struct {
- // IpAddress: The IP address assigned.
- IpAddress string `json:"ipAddress,omitempty"`
- // TimeToRetire: The due time for this IP to be retired in RFC 3339
- // format, for example 2012-11-15T16:19:00.094Z. This field is only
- // available when the IP is scheduled to be retired.
- TimeToRetire string `json:"timeToRetire,omitempty"`
- // ForceSendFields is a list of field names (e.g. "IpAddress") to
- // unconditionally include in API requests. By default, fields with
- // empty values are omitted from API requests. However, any non-pointer,
- // non-interface field appearing in ForceSendFields will be sent to the
- // server regardless of whether the field is empty or not. This may be
- // used to include empty fields in Patch requests.
- ForceSendFields []string `json:"-"`
- }
- func (s *IpMapping) MarshalJSON() ([]byte, error) {
- type noMethod IpMapping
- raw := noMethod(*s)
- return gensupport.MarshalJSON(raw, s.ForceSendFields)
- }
- // LocationPreference: Preferred location. This specifies where a Cloud
- // SQL instance should preferably be located, either in a specific
- // Compute Engine zone, or co-located with an App Engine application.
- // Note that if the preferred location is not available, the instance
- // will be located as close as possible within the region. Only one
- // location may be specified.
- type LocationPreference struct {
- // FollowGaeApplication: The AppEngine application to follow, it must be
- // in the same region as the Cloud SQL instance.
- FollowGaeApplication string `json:"followGaeApplication,omitempty"`
- // Kind: This is always sql#locationPreference.
- Kind string `json:"kind,omitempty"`
- // Zone: The preferred Compute Engine zone (e.g. us-centra1-a,
- // us-central1-b, etc.).
- Zone string `json:"zone,omitempty"`
- // ForceSendFields is a list of field names (e.g.
- // "FollowGaeApplication") to unconditionally include in API requests.
- // By default, fields with empty values are omitted from API requests.
- // However, any non-pointer, non-interface field appearing in
- // ForceSendFields will be sent to the server regardless of whether the
- // field is empty or not. This may be used to include empty fields in
- // Patch requests.
- ForceSendFields []string `json:"-"`
- }
- func (s *LocationPreference) MarshalJSON() ([]byte, error) {
- type noMethod LocationPreference
- raw := noMethod(*s)
- return gensupport.MarshalJSON(raw, s.ForceSendFields)
- }
- // MaintenanceWindow: Maintenance window. This specifies when a v2 Cloud
- // SQL instance should preferably be restarted for system maintenance
- // puruposes.
- type MaintenanceWindow struct {
- // Day: day of week (1-7), starting on Monday.
- Day int64 `json:"day,omitempty"`
- // Hour: hour of day - 0 to 23.
- Hour int64 `json:"hour,omitempty"`
- // Kind: This is always sql#maintenanceWindow.
- Kind string `json:"kind,omitempty"`
- UpdateTrack string `json:"updateTrack,omitempty"`
- // ForceSendFields is a list of field names (e.g. "Day") to
- // unconditionally include in API requests. By default, fields with
- // empty values are omitted from API requests. However, any non-pointer,
- // non-interface field appearing in ForceSendFields will be sent to the
- // server regardless of whether the field is empty or not. This may be
- // used to include empty fields in Patch requests.
- ForceSendFields []string `json:"-"`
- }
- func (s *MaintenanceWindow) MarshalJSON() ([]byte, error) {
- type noMethod MaintenanceWindow
- raw := noMethod(*s)
- return gensupport.MarshalJSON(raw, s.ForceSendFields)
- }
- // MySqlReplicaConfiguration: Read-replica configuration specific to
- // MySQL databases.
- type MySqlReplicaConfiguration struct {
- // CaCertificate: PEM representation of the trusted CA's x509
- // certificate.
- CaCertificate string `json:"caCertificate,omitempty"`
- // ClientCertificate: PEM representation of the slave's x509
- // certificate.
- ClientCertificate string `json:"clientCertificate,omitempty"`
- // ClientKey: PEM representation of the slave's private key. The
- // corresponsing public key is encoded in the client's certificate.
- ClientKey string `json:"clientKey,omitempty"`
- // ConnectRetryInterval: Seconds to wait between connect retries.
- // MySQL's default is 60 seconds.
- ConnectRetryInterval int64 `json:"connectRetryInterval,omitempty"`
- // DumpFilePath: Path to a SQL dump file in Google Cloud Storage from
- // which the slave instance is to be created. The URI is in the form
- // gs://bucketName/fileName. Compressed gzip files (.gz) are also
- // supported. Dumps should have the binlog co-ordinates from which
- // replication should begin. This can be accomplished by setting
- // --master-data to 1 when using mysqldump.
- DumpFilePath string `json:"dumpFilePath,omitempty"`
- // Kind: This is always sql#mysqlReplicaConfiguration.
- Kind string `json:"kind,omitempty"`
- // MasterHeartbeatPeriod: Interval in milliseconds between replication
- // heartbeats.
- MasterHeartbeatPeriod int64 `json:"masterHeartbeatPeriod,omitempty,string"`
- // Password: The password for the replication connection.
- Password string `json:"password,omitempty"`
- // SslCipher: A list of permissible ciphers to use for SSL encryption.
- SslCipher string `json:"sslCipher,omitempty"`
- // Username: The username for the replication connection.
- Username string `json:"username,omitempty"`
- // VerifyServerCertificate: Whether or not to check the master's Common
- // Name value in the certificate that it sends during the SSL handshake.
- VerifyServerCertificate bool `json:"verifyServerCertificate,omitempty"`
- // ForceSendFields is a list of field names (e.g. "CaCertificate") to
- // unconditionally include in API requests. By default, fields with
- // empty values are omitted from API requests. However, any non-pointer,
- // non-interface field appearing in ForceSendFields will be sent to the
- // server regardless of whether the field is empty or not. This may be
- // used to include empty fields in Patch requests.
- ForceSendFields []string `json:"-"`
- }
- func (s *MySqlReplicaConfiguration) MarshalJSON() ([]byte, error) {
- type noMethod MySqlReplicaConfiguration
- raw := noMethod(*s)
- return gensupport.MarshalJSON(raw, s.ForceSendFields)
- }
- // OnPremisesConfiguration: On-premises instance configuration.
- type OnPremisesConfiguration struct {
- // HostPort: The host and port of the on-premises instance in host:port
- // format
- HostPort string `json:"hostPort,omitempty"`
- // Kind: This is always sql#onPremisesConfiguration.
- Kind string `json:"kind,omitempty"`
- // ForceSendFields is a list of field names (e.g. "HostPort") to
- // unconditionally include in API requests. By default, fields with
- // empty values are omitted from API requests. However, any non-pointer,
- // non-interface field appearing in ForceSendFields will be sent to the
- // server regardless of whether the field is empty or not. This may be
- // used to include empty fields in Patch requests.
- ForceSendFields []string `json:"-"`
- }
- func (s *OnPremisesConfiguration) MarshalJSON() ([]byte, error) {
- type noMethod OnPremisesConfiguration
- raw := noMethod(*s)
- return gensupport.MarshalJSON(raw, s.ForceSendFields)
- }
- // Operation: An Operations resource contains information about database
- // instance operations such as create, delete, and restart. Operations
- // resources are created in response to operations that were initiated;
- // you never create them directly.
- type Operation struct {
- // EndTime: The time this operation finished in UTC timezone in RFC 3339
- // format, for example 2012-11-15T16:19:00.094Z.
- EndTime string `json:"endTime,omitempty"`
- // Error: If errors occurred during processing of this operation, this
- // field will be populated.
- Error *OperationErrors `json:"error,omitempty"`
- // ExportContext: The context for export operation, if applicable.
- ExportContext *ExportContext `json:"exportContext,omitempty"`
- // ImportContext: The context for import operation, if applicable.
- ImportContext *ImportContext `json:"importContext,omitempty"`
- // InsertTime: The time this operation was enqueued in UTC timezone in
- // RFC 3339 format, for example 2012-11-15T16:19:00.094Z.
- InsertTime string `json:"insertTime,omitempty"`
- // Kind: This is always sql#operation.
- Kind string `json:"kind,omitempty"`
- // Name: An identifier that uniquely identifies the operation. You can
- // use this identifier to retrieve the Operations resource that has
- // information about the operation.
- Name string `json:"name,omitempty"`
- // OperationType: The type of the operation. Valid values are CREATE,
- // DELETE, UPDATE, RESTART, IMPORT, EXPORT, BACKUP_VOLUME,
- // RESTORE_VOLUME, CREATE_USER, DELETE_USER, CREATE_DATABASE,
- // DELETE_DATABASE .
- OperationType string `json:"operationType,omitempty"`
- // SelfLink: The URI of this resource.
- SelfLink string `json:"selfLink,omitempty"`
- // StartTime: The time this operation actually started in UTC timezone
- // in RFC 3339 format, for example 2012-11-15T16:19:00.094Z.
- StartTime string `json:"startTime,omitempty"`
- // Status: The status of an operation. Valid values are PENDING,
- // RUNNING, DONE, UNKNOWN.
- Status string `json:"status,omitempty"`
- // TargetId: Name of the database instance related to this operation.
- TargetId string `json:"targetId,omitempty"`
- // TargetLink: The URI of the instance related to the operation.
- TargetLink string `json:"targetLink,omitempty"`
- // TargetProject: The project ID of the target instance related to this
- // operation.
- TargetProject string `json:"targetProject,omitempty"`
- // User: The email address of the user who initiated this operation.
- User string `json:"user,omitempty"`
- // ServerResponse contains the HTTP response code and headers from the
- // server.
- googleapi.ServerResponse `json:"-"`
- // ForceSendFields is a list of field names (e.g. "EndTime") to
- // unconditionally include in API requests. By default, fields with
- // empty values are omitted from API requests. However, any non-pointer,
- // non-interface field appearing in ForceSendFields will be sent to the
- // server regardless of whether the field is empty or not. This may be
- // used to include empty fields in Patch requests.
- ForceSendFields []string `json:"-"`
- }
- func (s *Operation) MarshalJSON() ([]byte, error) {
- type noMethod Operation
- raw := noMethod(*s)
- return gensupport.MarshalJSON(raw, s.ForceSendFields)
- }
- // OperationError: Database instance operation error.
- type OperationError struct {
- // Code: Identifies the specific error that occurred.
- Code string `json:"code,omitempty"`
- // Kind: This is always sql#operationError.
- Kind string `json:"kind,omitempty"`
- // Message: Additional information about the error encountered.
- Message string `json:"message,omitempty"`
- // ForceSendFields is a list of field names (e.g. "Code") to
- // unconditionally include in API requests. By default, fields with
- // empty values are omitted from API requests. However, any non-pointer,
- // non-interface field appearing in ForceSendFields will be sent to the
- // server regardless of whether the field is empty or not. This may be
- // used to include empty fields in Patch requests.
- ForceSendFields []string `json:"-"`
- }
- func (s *OperationError) MarshalJSON() ([]byte, error) {
- type noMethod OperationError
- raw := noMethod(*s)
- return gensupport.MarshalJSON(raw, s.ForceSendFields)
- }
- // OperationErrors: Database instance operation errors list wrapper.
- type OperationErrors struct {
- // Errors: The list of errors encountered while processing this
- // operation.
- Errors []*OperationError `json:"errors,omitempty"`
- // Kind: This is always sql#operationErrors.
- Kind string `json:"kind,omitempty"`
- // ForceSendFields is a list of field names (e.g. "Errors") to
- // unconditionally include in API requests. By default, fields with
- // empty values are omitted from API requests. However, any non-pointer,
- // non-interface field appearing in ForceSendFields will be sent to the
- // server regardless of whether the field is empty or not. This may be
- // used to include empty fields in Patch requests.
- ForceSendFields []string `json:"-"`
- }
- func (s *OperationErrors) MarshalJSON() ([]byte, error) {
- type noMethod OperationErrors
- raw := noMethod(*s)
- return gensupport.MarshalJSON(raw, s.ForceSendFields)
- }
- // OperationsListResponse: Database instance list operations response.
- type OperationsListResponse struct {
- // Items: List of operation resources.
- Items []*Operation `json:"items,omitempty"`
- // Kind: This is always sql#operationsList.
- Kind string `json:"kind,omitempty"`
- // NextPageToken: The continuation token, used to page through large
- // result sets. Provide this value in a subsequent request to return the
- // next page of results.
- NextPageToken string `json:"nextPageToken,omitempty"`
- // ServerResponse contains the HTTP response code and headers from the
- // server.
- googleapi.ServerResponse `json:"-"`
- // ForceSendFields is a list of field names (e.g. "Items") to
- // unconditionally include in API requests. By default, fields with
- // empty values are omitted from API requests. However, any non-pointer,
- // non-interface field appearing in ForceSendFields will be sent to the
- // server regardless of whether the field is empty or not. This may be
- // used to include empty fields in Patch requests.
- ForceSendFields []string `json:"-"`
- }
- func (s *OperationsListResponse) MarshalJSON() ([]byte, error) {
- type noMethod OperationsListResponse
- raw := noMethod(*s)
- return gensupport.MarshalJSON(raw, s.ForceSendFields)
- }
- // ReplicaConfiguration: Read-replica configuration for connecting to
- // the master.
- type ReplicaConfiguration struct {
- // FailoverTarget: Specifies if the replica is the failover target. If
- // the field is set to true the replica will be designated as a failover
- // replica. In case the master instance fails, the replica instance will
- // be promoted as the new master instance.
- // Only one replica can be specified as failover target, and the replica
- // has to be in different zone with the master instance.
- FailoverTarget bool `json:"failoverTarget,omitempty"`
- // Kind: This is always sql#replicaConfiguration.
- Kind string `json:"kind,omitempty"`
- // MysqlReplicaConfiguration: MySQL specific configuration when
- // replicating from a MySQL on-premises master. Replication
- // configuration information such as the username, password,
- // certificates, and keys are not stored in the instance metadata. The
- // configuration information is used only to set up the replication
- // connection and is stored by MySQL in a file named master.info in the
- // data directory.
- MysqlReplicaConfiguration *MySqlReplicaConfiguration `json:"mysqlReplicaConfiguration,omitempty"`
- // ForceSendFields is a list of field names (e.g. "FailoverTarget") to
- // unconditionally include in API requests. By default, fields with
- // empty values are omitted from API requests. However, any non-pointer,
- // non-interface field appearing in ForceSendFields will be sent to the
- // server regardless of whether the field is empty or not. This may be
- // used to include empty fields in Patch requests.
- ForceSendFields []string `json:"-"`
- }
- func (s *ReplicaConfiguration) MarshalJSON() ([]byte, error) {
- type noMethod ReplicaConfiguration
- raw := noMethod(*s)
- return gensupport.MarshalJSON(raw, s.ForceSendFields)
- }
- // RestoreBackupContext: Database instance restore from backup context.
- type RestoreBackupContext struct {
- // BackupRunId: The ID of the backup run to restore from.
- BackupRunId int64 `json:"backupRunId,omitempty,string"`
- // InstanceId: The ID of the instance that the backup was taken from.
- InstanceId string `json:"instanceId,omitempty"`
- // Kind: This is always sql#restoreBackupContext.
- Kind string `json:"kind,omitempty"`
- // ForceSendFields is a list of field names (e.g. "BackupRunId") to
- // unconditionally include in API requests. By default, fields with
- // empty values are omitted from API requests. However, any non-pointer,
- // non-interface field appearing in ForceSendFields will be sent to the
- // server regardless of whether the field is empty or not. This may be
- // used to include empty fields in Patch requests.
- ForceSendFields []string `json:"-"`
- }
- func (s *RestoreBackupContext) MarshalJSON() ([]byte, error) {
- type noMethod RestoreBackupContext
- raw := noMethod(*s)
- return gensupport.MarshalJSON(raw, s.ForceSendFields)
- }
- // Settings: Database instance settings.
- type Settings struct {
- // ActivationPolicy: The activation policy for this instance. This
- // specifies when the instance should be activated and is applicable
- // only when the instance state is RUNNABLE. This can be one of the
- // following.
- // ALWAYS: The instance should always be active.
- // NEVER: The instance should never be activated.
- // ON_DEMAND: The instance is activated upon receiving requests.
- ActivationPolicy string `json:"activationPolicy,omitempty"`
- // AuthorizedGaeApplications: The App Engine app IDs that can access
- // this instance.
- AuthorizedGaeApplications []string `json:"authorizedGaeApplications,omitempty"`
- // BackupConfiguration: The daily backup configuration for the instance.
- BackupConfiguration *BackupConfiguration `json:"backupConfiguration,omitempty"`
- // CrashSafeReplicationEnabled: Configuration specific to read replica
- // instances. Indicates whether database flags for crash-safe
- // replication are enabled.
- CrashSafeReplicationEnabled bool `json:"crashSafeReplicationEnabled,omitempty"`
- // DataDiskSizeGb: The size of data disk, in GB. Only supported for 2nd
- // Generation instances. The data disk size minimum is 10GB.
- DataDiskSizeGb int64 `json:"dataDiskSizeGb,omitempty,string"`
- // DataDiskType: The type of data disk. Only supported for 2nd
- // Generation instances. The default type is SSD.
- DataDiskType string `json:"dataDiskType,omitempty"`
- // DatabaseFlags: The database flags passed to the instance at startup.
- DatabaseFlags []*DatabaseFlags `json:"databaseFlags,omitempty"`
- // DatabaseReplicationEnabled: Configuration specific to read replica
- // instances. Indicates whether replication is enabled or not.
- DatabaseReplicationEnabled bool `json:"databaseReplicationEnabled,omitempty"`
- // IpConfiguration: The settings for IP Management. This allows to
- // enable or disable the instance IP and manage which external networks
- // can connect to the instance.
- IpConfiguration *IpConfiguration `json:"ipConfiguration,omitempty"`
- // Kind: This is always sql#settings.
- Kind string `json:"kind,omitempty"`
- // LocationPreference: The location preference settings. This allows the
- // instance to be located as near as possible to either an App Engine
- // app or GCE zone for better performance.
- LocationPreference *LocationPreference `json:"locationPreference,omitempty"`
- // MaintenanceWindow: The maintenance window for this instance. This
- // specifies when the instance may be restarted for maintenance
- // purposes.
- MaintenanceWindow *MaintenanceWindow `json:"maintenanceWindow,omitempty"`
- // PricingPlan: The pricing plan for this instance. This can be either
- // PER_USE or PACKAGE.
- PricingPlan string `json:"pricingPlan,omitempty"`
- // ReplicationType: The type of replication this instance uses. This can
- // be either ASYNCHRONOUS or SYNCHRONOUS.
- ReplicationType string `json:"replicationType,omitempty"`
- // SettingsVersion: The version of instance settings. This is a required
- // field for update method to make sure concurrent updates are handled
- // properly. During update, use the most recent settingsVersion value
- // for this instance and do not try to update this value.
- SettingsVersion int64 `json:"settingsVersion,omitempty,string"`
- // Tier: The tier of service for this instance, for example D1, D2. For
- // more information, see pricing.
- Tier string `json:"tier,omitempty"`
- // ForceSendFields is a list of field names (e.g. "ActivationPolicy") to
- // unconditionally include in API requests. By default, fields with
- // empty values are omitted from API requests. However, any non-pointer,
- // non-interface field appearing in ForceSendFields will be sent to the
- // server regardless of whether the field is empty or not. This may be
- // used to include empty fields in Patch requests.
- ForceSendFields []string `json:"-"`
- }
- func (s *Settings) MarshalJSON() ([]byte, error) {
- type noMethod Settings
- raw := noMethod(*s)
- return gensupport.MarshalJSON(raw, s.ForceSendFields)
- }
- // SslCert: SslCerts Resource
- type SslCert struct {
- // Cert: PEM representation.
- Cert string `json:"cert,omitempty"`
- // CertSerialNumber: Serial number, as extracted from the certificate.
- CertSerialNumber string `json:"certSerialNumber,omitempty"`
- // CommonName: User supplied name. Constrained to [a-zA-Z.-_ ]+.
- CommonName string `json:"commonName,omitempty"`
- // CreateTime: The time when the certificate was created in RFC 3339
- // format, for example 2012-11-15T16:19:00.094Z
- CreateTime string `json:"createTime,omitempty"`
- // ExpirationTime: The time when the certificate expires in RFC 3339
- // format, for example 2012-11-15T16:19:00.094Z.
- ExpirationTime string `json:"expirationTime,omitempty"`
- // Instance: Name of the database instance.
- Instance string `json:"instance,omitempty"`
- // Kind: This is always sql#sslCert.
- Kind string `json:"kind,omitempty"`
- // SelfLink: The URI of this resource.
- SelfLink string `json:"selfLink,omitempty"`
- // Sha1Fingerprint: Sha1 Fingerprint.
- Sha1Fingerprint string `json:"sha1Fingerprint,omitempty"`
- // ServerResponse contains the HTTP response code and headers from the
- // server.
- googleapi.ServerResponse `json:"-"`
- // ForceSendFields is a list of field names (e.g. "Cert") to
- // unconditionally include in API requests. By default, fields with
- // empty values are omitted from API requests. However, any non-pointer,
- // non-interface field appearing in ForceSendFields will be sent to the
- // server regardless of whether the field is empty or not. This may be
- // used to include empty fields in Patch requests.
- ForceSendFields []string `json:"-"`
- }
- func (s *SslCert) MarshalJSON() ([]byte, error) {
- type noMethod SslCert
- raw := noMethod(*s)
- return gensupport.MarshalJSON(raw, s.ForceSendFields)
- }
- // SslCertDetail: SslCertDetail.
- type SslCertDetail struct {
- // CertInfo: The public information about the cert.
- CertInfo *SslCert `json:"certInfo,omitempty"`
- // CertPrivateKey: The private key for the client cert, in pem format.
- // Keep private in order to protect your security.
- CertPrivateKey string `json:"certPrivateKey,omitempty"`
- // ForceSendFields is a list of field names (e.g. "CertInfo") to
- // unconditionally include in API requests. By default, fields with
- // empty values are omitted from API requests. However, any non-pointer,
- // non-interface field appearing in ForceSendFields will be sent to the
- // server regardless of whether the field is empty or not. This may be
- // used to include empty fields in Patch requests.
- ForceSendFields []string `json:"-"`
- }
- func (s *SslCertDetail) MarshalJSON() ([]byte, error) {
- type noMethod SslCertDetail
- raw := noMethod(*s)
- return gensupport.MarshalJSON(raw, s.ForceSendFields)
- }
- // SslCertsCreateEphemeralRequest: SslCerts create ephemeral certificate
- // request.
- type SslCertsCreateEphemeralRequest struct {
- // PublicKey: PEM encoded public key to include in the signed
- // certificate.
- PublicKey string `json:"public_key,omitempty"`
- // ForceSendFields is a list of field names (e.g. "PublicKey") to
- // unconditionally include in API requests. By default, fields with
- // empty values are omitted from API requests. However, any non-pointer,
- // non-interface field appearing in ForceSendFields will be sent to the
- // server regardless of whether the field is empty or not. This may be
- // used to include empty fields in Patch requests.
- ForceSendFields []string `json:"-"`
- }
- func (s *SslCertsCreateEphemeralRequest) MarshalJSON() ([]byte, error) {
- type noMethod SslCertsCreateEphemeralRequest
- raw := noMethod(*s)
- return gensupport.MarshalJSON(raw, s.ForceSendFields)
- }
- // SslCertsInsertRequest: SslCerts insert request.
- type SslCertsInsertRequest struct {
- // CommonName: User supplied name. Must be a distinct name from the
- // other certificates for this instance. New certificates will not be
- // usable until the instance is restarted.
- CommonName string `json:"commonName,omitempty"`
- // ForceSendFields is a list of field names (e.g. "CommonName") to
- // unconditionally include in API requests. By default, fields with
- // empty values are omitted from API requests. However, any non-pointer,
- // non-interface field appearing in ForceSendFields will be sent to the
- // server regardless of whether the field is empty or not. This may be
- // used to include empty fields in Patch requests.
- ForceSendFields []string `json:"-"`
- }
- func (s *SslCertsInsertRequest) MarshalJSON() ([]byte, error) {
- type noMethod SslCertsInsertRequest
- raw := noMethod(*s)
- return gensupport.MarshalJSON(raw, s.ForceSendFields)
- }
- // SslCertsInsertResponse: SslCert insert response.
- type SslCertsInsertResponse struct {
- // ClientCert: The new client certificate and private key. The new
- // certificate will not work until the instance is restarted.
- ClientCert *SslCertDetail `json:"clientCert,omitempty"`
- // Kind: This is always sql#sslCertsInsert.
- Kind string `json:"kind,omitempty"`
- // ServerCaCert: The server Certificate Authority's certificate. If this
- // is missing you can force a new one to be generated by calling
- // resetSslConfig method on instances resource.
- ServerCaCert *SslCert `json:"serverCaCert,omitempty"`
- // ServerResponse contains the HTTP response code and headers from the
- // server.
- googleapi.ServerResponse `json:"-"`
- // ForceSendFields is a list of field names (e.g. "ClientCert") to
- // unconditionally include in API requests. By default, fields with
- // empty values are omitted from API requests. However, any non-pointer,
- // non-interface field appearing in ForceSendFields will be sent to the
- // server regardless of whether the field is empty or not. This may be
- // used to include empty fields in Patch requests.
- ForceSendFields []string `json:"-"`
- }
- func (s *SslCertsInsertResponse) MarshalJSON() ([]byte, error) {
- type noMethod SslCertsInsertResponse
- raw := noMethod(*s)
- return gensupport.MarshalJSON(raw, s.ForceSendFields)
- }
- // SslCertsListResponse: SslCerts list response.
- type SslCertsListResponse struct {
- // Items: List of client certificates for the instance.
- Items []*SslCert `json:"items,omitempty"`
- // Kind: This is always sql#sslCertsList.
- Kind string `json:"kind,omitempty"`
- // ServerResponse contains the HTTP response code and headers from the
- // server.
- googleapi.ServerResponse `json:"-"`
- // ForceSendFields is a list of field names (e.g. "Items") to
- // unconditionally include in API requests. By default, fields with
- // empty values are omitted from API requests. However, any non-pointer,
- // non-interface field appearing in ForceSendFields will be sent to the
- // server regardless of whether the field is empty or not. This may be
- // used to include empty fields in Patch requests.
- ForceSendFields []string `json:"-"`
- }
- func (s *SslCertsListResponse) MarshalJSON() ([]byte, error) {
- type noMethod SslCertsListResponse
- raw := noMethod(*s)
- return gensupport.MarshalJSON(raw, s.ForceSendFields)
- }
- // Tier: A Google Cloud SQL service tier resource.
- type Tier struct {
- // DiskQuota: The maximum disk size of this tier in bytes.
- DiskQuota int64 `json:"DiskQuota,omitempty,string"`
- // RAM: The maximum RAM usage of this tier in bytes.
- RAM int64 `json:"RAM,omitempty,string"`
- // Kind: This is always sql#tier.
- Kind string `json:"kind,omitempty"`
- // Region: The applicable regions for this tier. Can be us-east1,
- // europe-west1 or asia-east1.
- Region []string `json:"region,omitempty"`
- // Tier: An identifier for the service tier, for example D1, D2 etc. For
- // related information, see Pricing.
- Tier string `json:"tier,omitempty"`
- // ForceSendFields is a list of field names (e.g. "DiskQuota") to
- // unconditionally include in API requests. By default, fields with
- // empty values are omitted from API requests. However, any non-pointer,
- // non-interface field appearing in ForceSendFields will be sent to the
- // server regardless of whether the field is empty or not. This may be
- // used to include empty fields in Patch requests.
- ForceSendFields []string `json:"-"`
- }
- func (s *Tier) MarshalJSON() ([]byte, error) {
- type noMethod Tier
- raw := noMethod(*s)
- return gensupport.MarshalJSON(raw, s.ForceSendFields)
- }
- // TiersListResponse: Tiers list response.
- type TiersListResponse struct {
- // Items: List of tiers.
- Items []*Tier `json:"items,omitempty"`
- // Kind: This is always sql#tiersList.
- Kind string `json:"kind,omitempty"`
- // ServerResponse contains the HTTP response code and headers from the
- // server.
- googleapi.ServerResponse `json:"-"`
- // ForceSendFields is a list of field names (e.g. "Items") to
- // unconditionally include in API requests. By default, fields with
- // empty values are omitted from API requests. However, any non-pointer,
- // non-interface field appearing in ForceSendFields will be sent to the
- // server regardless of whether the field is empty or not. This may be
- // used to include empty fields in Patch requests.
- ForceSendFields []string `json:"-"`
- }
- func (s *TiersListResponse) MarshalJSON() ([]byte, error) {
- type noMethod TiersListResponse
- raw := noMethod(*s)
- return gensupport.MarshalJSON(raw, s.ForceSendFields)
- }
- // User: A Cloud SQL user resource.
- type User struct {
- // Etag: HTTP 1.1 Entity tag for the resource.
- Etag string `json:"etag,omitempty"`
- // Host: The host name from which the user can connect. For insert
- // operations, host defaults to an empty string. For update operations,
- // host is specified as part of the request URL. The host name is not
- // mutable with this API.
- Host string `json:"host,omitempty"`
- // Instance: The name of the Cloud SQL instance. This does not include
- // the project ID. Can be omitted for update since it is already
- // specified on the URL.
- Instance string `json:"instance,omitempty"`
- // Kind: This is always sql#user.
- Kind string `json:"kind,omitempty"`
- // Name: The name of the user in the Cloud SQL instance. Can be omitted
- // for update since it is already specified on the URL.
- Name string `json:"name,omitempty"`
- // Password: The password for the user.
- Password string `json:"password,omitempty"`
- // Project: The project ID of the project containing the Cloud SQL
- // database. The Google apps domain is prefixed if applicable. Can be
- // omitted for update since it is already specified on the URL.
- Project string `json:"project,omitempty"`
- // ForceSendFields is a list of field names (e.g. "Etag") to
- // unconditionally include in API requests. By default, fields with
- // empty values are omitted from API requests. However, any non-pointer,
- // non-interface field appearing in ForceSendFields will be sent to the
- // server regardless of whether the field is empty or not. This may be
- // used to include empty fields in Patch requests.
- ForceSendFields []string `json:"-"`
- }
- func (s *User) MarshalJSON() ([]byte, error) {
- type noMethod User
- raw := noMethod(*s)
- return gensupport.MarshalJSON(raw, s.ForceSendFields)
- }
- // UsersListResponse: User list response.
- type UsersListResponse struct {
- // Items: List of user resources in the instance.
- Items []*User `json:"items,omitempty"`
- // Kind: This is always sql#usersList.
- Kind string `json:"kind,omitempty"`
- // NextPageToken: An identifier that uniquely identifies the operation.
- // You can use this identifier to retrieve the Operations resource that
- // has information about the operation.
- NextPageToken string `json:"nextPageToken,omitempty"`
- // ServerResponse contains the HTTP response code and headers from the
- // server.
- googleapi.ServerResponse `json:"-"`
- // ForceSendFields is a list of field names (e.g. "Items") to
- // unconditionally include in API requests. By default, fields with
- // empty values are omitted from API requests. However, any non-pointer,
- // non-interface field appearing in ForceSendFields will be sent to the
- // server regardless of whether the field is empty or not. This may be
- // used to include empty fields in Patch requests.
- ForceSendFields []string `json:"-"`
- }
- func (s *UsersListResponse) MarshalJSON() ([]byte, error) {
- type noMethod UsersListResponse
- raw := noMethod(*s)
- return gensupport.MarshalJSON(raw, s.ForceSendFields)
- }
- // method id "sql.backupRuns.delete":
- type BackupRunsDeleteCall struct {
- s *Service
- project string
- instance string
- id int64
- urlParams_ gensupport.URLParams
- ctx_ context.Context
- }
- // Delete: Deletes the backup taken by a backup run.
- func (r *BackupRunsService) Delete(project string, instance string, id int64) *BackupRunsDeleteCall {
- c := &BackupRunsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
- c.project = project
- c.instance = instance
- c.id = id
- return c
- }
- // Fields allows partial responses to be retrieved. See
- // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
- // for more information.
- func (c *BackupRunsDeleteCall) Fields(s ...googleapi.Field) *BackupRunsDeleteCall {
- c.urlParams_.Set("fields", googleapi.CombineFields(s))
- return c
- }
- // Context sets the context to be used in this call's Do method. Any
- // pending HTTP request will be aborted if the provided context is
- // canceled.
- func (c *BackupRunsDeleteCall) Context(ctx context.Context) *BackupRunsDeleteCall {
- c.ctx_ = ctx
- return c
- }
- func (c *BackupRunsDeleteCall) doRequest(alt string) (*http.Response, error) {
- var body io.Reader = nil
- c.urlParams_.Set("alt", alt)
- urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/instances/{instance}/backupRuns/{id}")
- urls += "?" + c.urlParams_.Encode()
- req, _ := http.NewRequest("DELETE", urls, body)
- googleapi.Expand(req.URL, map[string]string{
- "project": c.project,
- "instance": c.instance,
- "id": strconv.FormatInt(c.id, 10),
- })
- req.Header.Set("User-Agent", c.s.userAgent())
- if c.ctx_ != nil {
- return ctxhttp.Do(c.ctx_, c.s.client, req)
- }
- return c.s.client.Do(req)
- }
- // Do executes the "sql.backupRuns.delete" call.
- // Exactly one of *Operation or error will be non-nil. Any non-2xx
- // status code is an error. Response headers are in either
- // *Operation.ServerResponse.Header or (if a response was returned at
- // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
- // to check whether the returned error was because
- // http.StatusNotModified was returned.
- func (c *BackupRunsDeleteCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
- gensupport.SetOptions(c.urlParams_, opts...)
- res, err := c.doRequest("json")
- if res != nil && res.StatusCode == http.StatusNotModified {
- if res.Body != nil {
- res.Body.Close()
- }
- return nil, &googleapi.Error{
- Code: res.StatusCode,
- Header: res.Header,
- }
- }
- if err != nil {
- return nil, err
- }
- defer googleapi.CloseBody(res)
- if err := googleapi.CheckResponse(res); err != nil {
- return nil, err
- }
- ret := &Operation{
- ServerResponse: googleapi.ServerResponse{
- Header: res.Header,
- HTTPStatusCode: res.StatusCode,
- },
- }
- if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
- return nil, err
- }
- return ret, nil
- // {
- // "description": "Deletes the backup taken by a backup run.",
- // "httpMethod": "DELETE",
- // "id": "sql.backupRuns.delete",
- // "parameterOrder": [
- // "project",
- // "instance",
- // "id"
- // ],
- // "parameters": {
- // "id": {
- // "description": "The ID of the Backup Run to delete. To find a Backup Run ID, use the list method.",
- // "format": "int64",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // },
- // "instance": {
- // "description": "Cloud SQL instance ID. This does not include the project ID.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // },
- // "project": {
- // "description": "Project ID of the project that contains the instance.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // }
- // },
- // "path": "projects/{project}/instances/{instance}/backupRuns/{id}",
- // "response": {
- // "$ref": "Operation"
- // },
- // "scopes": [
- // "https://www.googleapis.com/auth/cloud-platform",
- // "https://www.googleapis.com/auth/sqlservice.admin"
- // ]
- // }
- }
- // method id "sql.backupRuns.get":
- type BackupRunsGetCall struct {
- s *Service
- project string
- instance string
- id int64
- urlParams_ gensupport.URLParams
- ifNoneMatch_ string
- ctx_ context.Context
- }
- // Get: Retrieves a resource containing information about a backup run.
- func (r *BackupRunsService) Get(project string, instance string, id int64) *BackupRunsGetCall {
- c := &BackupRunsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
- c.project = project
- c.instance = instance
- c.id = id
- return c
- }
- // Fields allows partial responses to be retrieved. See
- // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
- // for more information.
- func (c *BackupRunsGetCall) Fields(s ...googleapi.Field) *BackupRunsGetCall {
- c.urlParams_.Set("fields", googleapi.CombineFields(s))
- return c
- }
- // IfNoneMatch sets the optional parameter which makes the operation
- // fail if the object's ETag matches the given value. This is useful for
- // getting updates only after the object has changed since the last
- // request. Use googleapi.IsNotModified to check whether the response
- // error from Do is the result of In-None-Match.
- func (c *BackupRunsGetCall) IfNoneMatch(entityTag string) *BackupRunsGetCall {
- c.ifNoneMatch_ = entityTag
- return c
- }
- // Context sets the context to be used in this call's Do method. Any
- // pending HTTP request will be aborted if the provided context is
- // canceled.
- func (c *BackupRunsGetCall) Context(ctx context.Context) *BackupRunsGetCall {
- c.ctx_ = ctx
- return c
- }
- func (c *BackupRunsGetCall) doRequest(alt string) (*http.Response, error) {
- var body io.Reader = nil
- c.urlParams_.Set("alt", alt)
- urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/instances/{instance}/backupRuns/{id}")
- urls += "?" + c.urlParams_.Encode()
- req, _ := http.NewRequest("GET", urls, body)
- googleapi.Expand(req.URL, map[string]string{
- "project": c.project,
- "instance": c.instance,
- "id": strconv.FormatInt(c.id, 10),
- })
- req.Header.Set("User-Agent", c.s.userAgent())
- if c.ifNoneMatch_ != "" {
- req.Header.Set("If-None-Match", c.ifNoneMatch_)
- }
- if c.ctx_ != nil {
- return ctxhttp.Do(c.ctx_, c.s.client, req)
- }
- return c.s.client.Do(req)
- }
- // Do executes the "sql.backupRuns.get" call.
- // Exactly one of *BackupRun or error will be non-nil. Any non-2xx
- // status code is an error. Response headers are in either
- // *BackupRun.ServerResponse.Header or (if a response was returned at
- // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
- // to check whether the returned error was because
- // http.StatusNotModified was returned.
- func (c *BackupRunsGetCall) Do(opts ...googleapi.CallOption) (*BackupRun, error) {
- gensupport.SetOptions(c.urlParams_, opts...)
- res, err := c.doRequest("json")
- if res != nil && res.StatusCode == http.StatusNotModified {
- if res.Body != nil {
- res.Body.Close()
- }
- return nil, &googleapi.Error{
- Code: res.StatusCode,
- Header: res.Header,
- }
- }
- if err != nil {
- return nil, err
- }
- defer googleapi.CloseBody(res)
- if err := googleapi.CheckResponse(res); err != nil {
- return nil, err
- }
- ret := &BackupRun{
- ServerResponse: googleapi.ServerResponse{
- Header: res.Header,
- HTTPStatusCode: res.StatusCode,
- },
- }
- if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
- return nil, err
- }
- return ret, nil
- // {
- // "description": "Retrieves a resource containing information about a backup run.",
- // "httpMethod": "GET",
- // "id": "sql.backupRuns.get",
- // "parameterOrder": [
- // "project",
- // "instance",
- // "id"
- // ],
- // "parameters": {
- // "id": {
- // "description": "The ID of this Backup Run.",
- // "format": "int64",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // },
- // "instance": {
- // "description": "Cloud SQL instance ID. This does not include the project ID.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // },
- // "project": {
- // "description": "Project ID of the project that contains the instance.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // }
- // },
- // "path": "projects/{project}/instances/{instance}/backupRuns/{id}",
- // "response": {
- // "$ref": "BackupRun"
- // },
- // "scopes": [
- // "https://www.googleapis.com/auth/cloud-platform",
- // "https://www.googleapis.com/auth/sqlservice.admin"
- // ]
- // }
- }
- // method id "sql.backupRuns.list":
- type BackupRunsListCall struct {
- s *Service
- project string
- instance string
- urlParams_ gensupport.URLParams
- ifNoneMatch_ string
- ctx_ context.Context
- }
- // List: Lists all backup runs associated with a given instance and
- // configuration in the reverse chronological order of the enqueued
- // time.
- func (r *BackupRunsService) List(project string, instance string) *BackupRunsListCall {
- c := &BackupRunsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
- c.project = project
- c.instance = instance
- return c
- }
- // MaxResults sets the optional parameter "maxResults": Maximum number
- // of backup runs per response.
- func (c *BackupRunsListCall) MaxResults(maxResults int64) *BackupRunsListCall {
- c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
- return c
- }
- // PageToken sets the optional parameter "pageToken": A
- // previously-returned page token representing part of the larger set of
- // results to view.
- func (c *BackupRunsListCall) PageToken(pageToken string) *BackupRunsListCall {
- c.urlParams_.Set("pageToken", pageToken)
- return c
- }
- // Fields allows partial responses to be retrieved. See
- // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
- // for more information.
- func (c *BackupRunsListCall) Fields(s ...googleapi.Field) *BackupRunsListCall {
- c.urlParams_.Set("fields", googleapi.CombineFields(s))
- return c
- }
- // IfNoneMatch sets the optional parameter which makes the operation
- // fail if the object's ETag matches the given value. This is useful for
- // getting updates only after the object has changed since the last
- // request. Use googleapi.IsNotModified to check whether the response
- // error from Do is the result of In-None-Match.
- func (c *BackupRunsListCall) IfNoneMatch(entityTag string) *BackupRunsListCall {
- c.ifNoneMatch_ = entityTag
- return c
- }
- // Context sets the context to be used in this call's Do method. Any
- // pending HTTP request will be aborted if the provided context is
- // canceled.
- func (c *BackupRunsListCall) Context(ctx context.Context) *BackupRunsListCall {
- c.ctx_ = ctx
- return c
- }
- func (c *BackupRunsListCall) doRequest(alt string) (*http.Response, error) {
- var body io.Reader = nil
- c.urlParams_.Set("alt", alt)
- urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/instances/{instance}/backupRuns")
- urls += "?" + c.urlParams_.Encode()
- req, _ := http.NewRequest("GET", urls, body)
- googleapi.Expand(req.URL, map[string]string{
- "project": c.project,
- "instance": c.instance,
- })
- req.Header.Set("User-Agent", c.s.userAgent())
- if c.ifNoneMatch_ != "" {
- req.Header.Set("If-None-Match", c.ifNoneMatch_)
- }
- if c.ctx_ != nil {
- return ctxhttp.Do(c.ctx_, c.s.client, req)
- }
- return c.s.client.Do(req)
- }
- // Do executes the "sql.backupRuns.list" call.
- // Exactly one of *BackupRunsListResponse or error will be non-nil. Any
- // non-2xx status code is an error. Response headers are in either
- // *BackupRunsListResponse.ServerResponse.Header or (if a response was
- // returned at all) in error.(*googleapi.Error).Header. Use
- // googleapi.IsNotModified to check whether the returned error was
- // because http.StatusNotModified was returned.
- func (c *BackupRunsListCall) Do(opts ...googleapi.CallOption) (*BackupRunsListResponse, error) {
- gensupport.SetOptions(c.urlParams_, opts...)
- res, err := c.doRequest("json")
- if res != nil && res.StatusCode == http.StatusNotModified {
- if res.Body != nil {
- res.Body.Close()
- }
- return nil, &googleapi.Error{
- Code: res.StatusCode,
- Header: res.Header,
- }
- }
- if err != nil {
- return nil, err
- }
- defer googleapi.CloseBody(res)
- if err := googleapi.CheckResponse(res); err != nil {
- return nil, err
- }
- ret := &BackupRunsListResponse{
- ServerResponse: googleapi.ServerResponse{
- Header: res.Header,
- HTTPStatusCode: res.StatusCode,
- },
- }
- if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
- return nil, err
- }
- return ret, nil
- // {
- // "description": "Lists all backup runs associated with a given instance and configuration in the reverse chronological order of the enqueued time.",
- // "httpMethod": "GET",
- // "id": "sql.backupRuns.list",
- // "parameterOrder": [
- // "project",
- // "instance"
- // ],
- // "parameters": {
- // "instance": {
- // "description": "Cloud SQL instance ID. This does not include the project ID.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // },
- // "maxResults": {
- // "description": "Maximum number of backup runs per response.",
- // "format": "int32",
- // "location": "query",
- // "type": "integer"
- // },
- // "pageToken": {
- // "description": "A previously-returned page token representing part of the larger set of results to view.",
- // "location": "query",
- // "type": "string"
- // },
- // "project": {
- // "description": "Project ID of the project that contains the instance.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // }
- // },
- // "path": "projects/{project}/instances/{instance}/backupRuns",
- // "response": {
- // "$ref": "BackupRunsListResponse"
- // },
- // "scopes": [
- // "https://www.googleapis.com/auth/cloud-platform",
- // "https://www.googleapis.com/auth/sqlservice.admin"
- // ]
- // }
- }
- // Pages invokes f for each page of results.
- // A non-nil error returned from f will halt the iteration.
- // The provided context supersedes any context provided to the Context method.
- func (c *BackupRunsListCall) Pages(ctx context.Context, f func(*BackupRunsListResponse) error) error {
- c.ctx_ = ctx
- defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
- for {
- x, err := c.Do()
- if err != nil {
- return err
- }
- if err := f(x); err != nil {
- return err
- }
- if x.NextPageToken == "" {
- return nil
- }
- c.PageToken(x.NextPageToken)
- }
- }
- // method id "sql.databases.delete":
- type DatabasesDeleteCall struct {
- s *Service
- project string
- instance string
- database string
- urlParams_ gensupport.URLParams
- ctx_ context.Context
- }
- // Delete: Deletes a resource containing information about a database
- // inside a Cloud SQL instance.
- func (r *DatabasesService) Delete(project string, instance string, database string) *DatabasesDeleteCall {
- c := &DatabasesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
- c.project = project
- c.instance = instance
- c.database = database
- return c
- }
- // Fields allows partial responses to be retrieved. See
- // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
- // for more information.
- func (c *DatabasesDeleteCall) Fields(s ...googleapi.Field) *DatabasesDeleteCall {
- c.urlParams_.Set("fields", googleapi.CombineFields(s))
- return c
- }
- // Context sets the context to be used in this call's Do method. Any
- // pending HTTP request will be aborted if the provided context is
- // canceled.
- func (c *DatabasesDeleteCall) Context(ctx context.Context) *DatabasesDeleteCall {
- c.ctx_ = ctx
- return c
- }
- func (c *DatabasesDeleteCall) doRequest(alt string) (*http.Response, error) {
- var body io.Reader = nil
- c.urlParams_.Set("alt", alt)
- urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/instances/{instance}/databases/{database}")
- urls += "?" + c.urlParams_.Encode()
- req, _ := http.NewRequest("DELETE", urls, body)
- googleapi.Expand(req.URL, map[string]string{
- "project": c.project,
- "instance": c.instance,
- "database": c.database,
- })
- req.Header.Set("User-Agent", c.s.userAgent())
- if c.ctx_ != nil {
- return ctxhttp.Do(c.ctx_, c.s.client, req)
- }
- return c.s.client.Do(req)
- }
- // Do executes the "sql.databases.delete" call.
- // Exactly one of *Operation or error will be non-nil. Any non-2xx
- // status code is an error. Response headers are in either
- // *Operation.ServerResponse.Header or (if a response was returned at
- // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
- // to check whether the returned error was because
- // http.StatusNotModified was returned.
- func (c *DatabasesDeleteCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
- gensupport.SetOptions(c.urlParams_, opts...)
- res, err := c.doRequest("json")
- if res != nil && res.StatusCode == http.StatusNotModified {
- if res.Body != nil {
- res.Body.Close()
- }
- return nil, &googleapi.Error{
- Code: res.StatusCode,
- Header: res.Header,
- }
- }
- if err != nil {
- return nil, err
- }
- defer googleapi.CloseBody(res)
- if err := googleapi.CheckResponse(res); err != nil {
- return nil, err
- }
- ret := &Operation{
- ServerResponse: googleapi.ServerResponse{
- Header: res.Header,
- HTTPStatusCode: res.StatusCode,
- },
- }
- if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
- return nil, err
- }
- return ret, nil
- // {
- // "description": "Deletes a resource containing information about a database inside a Cloud SQL instance.",
- // "httpMethod": "DELETE",
- // "id": "sql.databases.delete",
- // "parameterOrder": [
- // "project",
- // "instance",
- // "database"
- // ],
- // "parameters": {
- // "database": {
- // "description": "Name of the database to be deleted in the instance.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // },
- // "instance": {
- // "description": "Database instance ID. This does not include the project ID.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // },
- // "project": {
- // "description": "Project ID of the project that contains the instance.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // }
- // },
- // "path": "projects/{project}/instances/{instance}/databases/{database}",
- // "response": {
- // "$ref": "Operation"
- // },
- // "scopes": [
- // "https://www.googleapis.com/auth/cloud-platform",
- // "https://www.googleapis.com/auth/sqlservice.admin"
- // ]
- // }
- }
- // method id "sql.databases.get":
- type DatabasesGetCall struct {
- s *Service
- project string
- instance string
- database string
- urlParams_ gensupport.URLParams
- ifNoneMatch_ string
- ctx_ context.Context
- }
- // Get: Retrieves a resource containing information about a database
- // inside a Cloud SQL instance.
- func (r *DatabasesService) Get(project string, instance string, database string) *DatabasesGetCall {
- c := &DatabasesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
- c.project = project
- c.instance = instance
- c.database = database
- return c
- }
- // Fields allows partial responses to be retrieved. See
- // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
- // for more information.
- func (c *DatabasesGetCall) Fields(s ...googleapi.Field) *DatabasesGetCall {
- c.urlParams_.Set("fields", googleapi.CombineFields(s))
- return c
- }
- // IfNoneMatch sets the optional parameter which makes the operation
- // fail if the object's ETag matches the given value. This is useful for
- // getting updates only after the object has changed since the last
- // request. Use googleapi.IsNotModified to check whether the response
- // error from Do is the result of In-None-Match.
- func (c *DatabasesGetCall) IfNoneMatch(entityTag string) *DatabasesGetCall {
- c.ifNoneMatch_ = entityTag
- return c
- }
- // Context sets the context to be used in this call's Do method. Any
- // pending HTTP request will be aborted if the provided context is
- // canceled.
- func (c *DatabasesGetCall) Context(ctx context.Context) *DatabasesGetCall {
- c.ctx_ = ctx
- return c
- }
- func (c *DatabasesGetCall) doRequest(alt string) (*http.Response, error) {
- var body io.Reader = nil
- c.urlParams_.Set("alt", alt)
- urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/instances/{instance}/databases/{database}")
- urls += "?" + c.urlParams_.Encode()
- req, _ := http.NewRequest("GET", urls, body)
- googleapi.Expand(req.URL, map[string]string{
- "project": c.project,
- "instance": c.instance,
- "database": c.database,
- })
- req.Header.Set("User-Agent", c.s.userAgent())
- if c.ifNoneMatch_ != "" {
- req.Header.Set("If-None-Match", c.ifNoneMatch_)
- }
- if c.ctx_ != nil {
- return ctxhttp.Do(c.ctx_, c.s.client, req)
- }
- return c.s.client.Do(req)
- }
- // Do executes the "sql.databases.get" call.
- // Exactly one of *Database or error will be non-nil. Any non-2xx status
- // code is an error. Response headers are in either
- // *Database.ServerResponse.Header or (if a response was returned at
- // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
- // to check whether the returned error was because
- // http.StatusNotModified was returned.
- func (c *DatabasesGetCall) Do(opts ...googleapi.CallOption) (*Database, error) {
- gensupport.SetOptions(c.urlParams_, opts...)
- res, err := c.doRequest("json")
- if res != nil && res.StatusCode == http.StatusNotModified {
- if res.Body != nil {
- res.Body.Close()
- }
- return nil, &googleapi.Error{
- Code: res.StatusCode,
- Header: res.Header,
- }
- }
- if err != nil {
- return nil, err
- }
- defer googleapi.CloseBody(res)
- if err := googleapi.CheckResponse(res); err != nil {
- return nil, err
- }
- ret := &Database{
- ServerResponse: googleapi.ServerResponse{
- Header: res.Header,
- HTTPStatusCode: res.StatusCode,
- },
- }
- if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
- return nil, err
- }
- return ret, nil
- // {
- // "description": "Retrieves a resource containing information about a database inside a Cloud SQL instance.",
- // "httpMethod": "GET",
- // "id": "sql.databases.get",
- // "parameterOrder": [
- // "project",
- // "instance",
- // "database"
- // ],
- // "parameters": {
- // "database": {
- // "description": "Name of the database in the instance.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // },
- // "instance": {
- // "description": "Database instance ID. This does not include the project ID.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // },
- // "project": {
- // "description": "Project ID of the project that contains the instance.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // }
- // },
- // "path": "projects/{project}/instances/{instance}/databases/{database}",
- // "response": {
- // "$ref": "Database"
- // },
- // "scopes": [
- // "https://www.googleapis.com/auth/cloud-platform",
- // "https://www.googleapis.com/auth/sqlservice.admin"
- // ]
- // }
- }
- // method id "sql.databases.insert":
- type DatabasesInsertCall struct {
- s *Service
- project string
- instance string
- database *Database
- urlParams_ gensupport.URLParams
- ctx_ context.Context
- }
- // Insert: Inserts a resource containing information about a database
- // inside a Cloud SQL instance.
- func (r *DatabasesService) Insert(project string, instance string, database *Database) *DatabasesInsertCall {
- c := &DatabasesInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
- c.project = project
- c.instance = instance
- c.database = database
- return c
- }
- // Fields allows partial responses to be retrieved. See
- // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
- // for more information.
- func (c *DatabasesInsertCall) Fields(s ...googleapi.Field) *DatabasesInsertCall {
- c.urlParams_.Set("fields", googleapi.CombineFields(s))
- return c
- }
- // Context sets the context to be used in this call's Do method. Any
- // pending HTTP request will be aborted if the provided context is
- // canceled.
- func (c *DatabasesInsertCall) Context(ctx context.Context) *DatabasesInsertCall {
- c.ctx_ = ctx
- return c
- }
- func (c *DatabasesInsertCall) doRequest(alt string) (*http.Response, error) {
- var body io.Reader = nil
- body, err := googleapi.WithoutDataWrapper.JSONReader(c.database)
- if err != nil {
- return nil, err
- }
- ctype := "application/json"
- c.urlParams_.Set("alt", alt)
- urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/instances/{instance}/databases")
- urls += "?" + c.urlParams_.Encode()
- req, _ := http.NewRequest("POST", urls, body)
- googleapi.Expand(req.URL, map[string]string{
- "project": c.project,
- "instance": c.instance,
- })
- req.Header.Set("Content-Type", ctype)
- req.Header.Set("User-Agent", c.s.userAgent())
- if c.ctx_ != nil {
- return ctxhttp.Do(c.ctx_, c.s.client, req)
- }
- return c.s.client.Do(req)
- }
- // Do executes the "sql.databases.insert" call.
- // Exactly one of *Operation or error will be non-nil. Any non-2xx
- // status code is an error. Response headers are in either
- // *Operation.ServerResponse.Header or (if a response was returned at
- // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
- // to check whether the returned error was because
- // http.StatusNotModified was returned.
- func (c *DatabasesInsertCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
- gensupport.SetOptions(c.urlParams_, opts...)
- res, err := c.doRequest("json")
- if res != nil && res.StatusCode == http.StatusNotModified {
- if res.Body != nil {
- res.Body.Close()
- }
- return nil, &googleapi.Error{
- Code: res.StatusCode,
- Header: res.Header,
- }
- }
- if err != nil {
- return nil, err
- }
- defer googleapi.CloseBody(res)
- if err := googleapi.CheckResponse(res); err != nil {
- return nil, err
- }
- ret := &Operation{
- ServerResponse: googleapi.ServerResponse{
- Header: res.Header,
- HTTPStatusCode: res.StatusCode,
- },
- }
- if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
- return nil, err
- }
- return ret, nil
- // {
- // "description": "Inserts a resource containing information about a database inside a Cloud SQL instance.",
- // "httpMethod": "POST",
- // "id": "sql.databases.insert",
- // "parameterOrder": [
- // "project",
- // "instance"
- // ],
- // "parameters": {
- // "instance": {
- // "description": "Database instance ID. This does not include the project ID.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // },
- // "project": {
- // "description": "Project ID of the project that contains the instance.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // }
- // },
- // "path": "projects/{project}/instances/{instance}/databases",
- // "request": {
- // "$ref": "Database"
- // },
- // "response": {
- // "$ref": "Operation"
- // },
- // "scopes": [
- // "https://www.googleapis.com/auth/cloud-platform",
- // "https://www.googleapis.com/auth/sqlservice.admin"
- // ]
- // }
- }
- // method id "sql.databases.list":
- type DatabasesListCall struct {
- s *Service
- project string
- instance string
- urlParams_ gensupport.URLParams
- ifNoneMatch_ string
- ctx_ context.Context
- }
- // List: Lists databases in the specified Cloud SQL instance.
- func (r *DatabasesService) List(project string, instance string) *DatabasesListCall {
- c := &DatabasesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
- c.project = project
- c.instance = instance
- return c
- }
- // Fields allows partial responses to be retrieved. See
- // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
- // for more information.
- func (c *DatabasesListCall) Fields(s ...googleapi.Field) *DatabasesListCall {
- c.urlParams_.Set("fields", googleapi.CombineFields(s))
- return c
- }
- // IfNoneMatch sets the optional parameter which makes the operation
- // fail if the object's ETag matches the given value. This is useful for
- // getting updates only after the object has changed since the last
- // request. Use googleapi.IsNotModified to check whether the response
- // error from Do is the result of In-None-Match.
- func (c *DatabasesListCall) IfNoneMatch(entityTag string) *DatabasesListCall {
- c.ifNoneMatch_ = entityTag
- return c
- }
- // Context sets the context to be used in this call's Do method. Any
- // pending HTTP request will be aborted if the provided context is
- // canceled.
- func (c *DatabasesListCall) Context(ctx context.Context) *DatabasesListCall {
- c.ctx_ = ctx
- return c
- }
- func (c *DatabasesListCall) doRequest(alt string) (*http.Response, error) {
- var body io.Reader = nil
- c.urlParams_.Set("alt", alt)
- urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/instances/{instance}/databases")
- urls += "?" + c.urlParams_.Encode()
- req, _ := http.NewRequest("GET", urls, body)
- googleapi.Expand(req.URL, map[string]string{
- "project": c.project,
- "instance": c.instance,
- })
- req.Header.Set("User-Agent", c.s.userAgent())
- if c.ifNoneMatch_ != "" {
- req.Header.Set("If-None-Match", c.ifNoneMatch_)
- }
- if c.ctx_ != nil {
- return ctxhttp.Do(c.ctx_, c.s.client, req)
- }
- return c.s.client.Do(req)
- }
- // Do executes the "sql.databases.list" call.
- // Exactly one of *DatabasesListResponse or error will be non-nil. Any
- // non-2xx status code is an error. Response headers are in either
- // *DatabasesListResponse.ServerResponse.Header or (if a response was
- // returned at all) in error.(*googleapi.Error).Header. Use
- // googleapi.IsNotModified to check whether the returned error was
- // because http.StatusNotModified was returned.
- func (c *DatabasesListCall) Do(opts ...googleapi.CallOption) (*DatabasesListResponse, error) {
- gensupport.SetOptions(c.urlParams_, opts...)
- res, err := c.doRequest("json")
- if res != nil && res.StatusCode == http.StatusNotModified {
- if res.Body != nil {
- res.Body.Close()
- }
- return nil, &googleapi.Error{
- Code: res.StatusCode,
- Header: res.Header,
- }
- }
- if err != nil {
- return nil, err
- }
- defer googleapi.CloseBody(res)
- if err := googleapi.CheckResponse(res); err != nil {
- return nil, err
- }
- ret := &DatabasesListResponse{
- ServerResponse: googleapi.ServerResponse{
- Header: res.Header,
- HTTPStatusCode: res.StatusCode,
- },
- }
- if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
- return nil, err
- }
- return ret, nil
- // {
- // "description": "Lists databases in the specified Cloud SQL instance.",
- // "httpMethod": "GET",
- // "id": "sql.databases.list",
- // "parameterOrder": [
- // "project",
- // "instance"
- // ],
- // "parameters": {
- // "instance": {
- // "description": "Cloud SQL instance ID. This does not include the project ID.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // },
- // "project": {
- // "description": "Project ID of the project for which to list Cloud SQL instances.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // }
- // },
- // "path": "projects/{project}/instances/{instance}/databases",
- // "response": {
- // "$ref": "DatabasesListResponse"
- // },
- // "scopes": [
- // "https://www.googleapis.com/auth/cloud-platform",
- // "https://www.googleapis.com/auth/sqlservice.admin"
- // ]
- // }
- }
- // method id "sql.databases.patch":
- type DatabasesPatchCall struct {
- s *Service
- project string
- instance string
- database string
- database2 *Database
- urlParams_ gensupport.URLParams
- ctx_ context.Context
- }
- // Patch: Updates a resource containing information about a database
- // inside a Cloud SQL instance. This method supports patch semantics.
- func (r *DatabasesService) Patch(project string, instance string, database string, database2 *Database) *DatabasesPatchCall {
- c := &DatabasesPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
- c.project = project
- c.instance = instance
- c.database = database
- c.database2 = database2
- return c
- }
- // Fields allows partial responses to be retrieved. See
- // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
- // for more information.
- func (c *DatabasesPatchCall) Fields(s ...googleapi.Field) *DatabasesPatchCall {
- c.urlParams_.Set("fields", googleapi.CombineFields(s))
- return c
- }
- // Context sets the context to be used in this call's Do method. Any
- // pending HTTP request will be aborted if the provided context is
- // canceled.
- func (c *DatabasesPatchCall) Context(ctx context.Context) *DatabasesPatchCall {
- c.ctx_ = ctx
- return c
- }
- func (c *DatabasesPatchCall) doRequest(alt string) (*http.Response, error) {
- var body io.Reader = nil
- body, err := googleapi.WithoutDataWrapper.JSONReader(c.database2)
- if err != nil {
- return nil, err
- }
- ctype := "application/json"
- c.urlParams_.Set("alt", alt)
- urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/instances/{instance}/databases/{database}")
- urls += "?" + c.urlParams_.Encode()
- req, _ := http.NewRequest("PATCH", urls, body)
- googleapi.Expand(req.URL, map[string]string{
- "project": c.project,
- "instance": c.instance,
- "database": c.database,
- })
- req.Header.Set("Content-Type", ctype)
- req.Header.Set("User-Agent", c.s.userAgent())
- if c.ctx_ != nil {
- return ctxhttp.Do(c.ctx_, c.s.client, req)
- }
- return c.s.client.Do(req)
- }
- // Do executes the "sql.databases.patch" call.
- // Exactly one of *Operation or error will be non-nil. Any non-2xx
- // status code is an error. Response headers are in either
- // *Operation.ServerResponse.Header or (if a response was returned at
- // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
- // to check whether the returned error was because
- // http.StatusNotModified was returned.
- func (c *DatabasesPatchCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
- gensupport.SetOptions(c.urlParams_, opts...)
- res, err := c.doRequest("json")
- if res != nil && res.StatusCode == http.StatusNotModified {
- if res.Body != nil {
- res.Body.Close()
- }
- return nil, &googleapi.Error{
- Code: res.StatusCode,
- Header: res.Header,
- }
- }
- if err != nil {
- return nil, err
- }
- defer googleapi.CloseBody(res)
- if err := googleapi.CheckResponse(res); err != nil {
- return nil, err
- }
- ret := &Operation{
- ServerResponse: googleapi.ServerResponse{
- Header: res.Header,
- HTTPStatusCode: res.StatusCode,
- },
- }
- if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
- return nil, err
- }
- return ret, nil
- // {
- // "description": "Updates a resource containing information about a database inside a Cloud SQL instance. This method supports patch semantics.",
- // "httpMethod": "PATCH",
- // "id": "sql.databases.patch",
- // "parameterOrder": [
- // "project",
- // "instance",
- // "database"
- // ],
- // "parameters": {
- // "database": {
- // "description": "Name of the database to be updated in the instance.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // },
- // "instance": {
- // "description": "Database instance ID. This does not include the project ID.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // },
- // "project": {
- // "description": "Project ID of the project that contains the instance.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // }
- // },
- // "path": "projects/{project}/instances/{instance}/databases/{database}",
- // "request": {
- // "$ref": "Database"
- // },
- // "response": {
- // "$ref": "Operation"
- // },
- // "scopes": [
- // "https://www.googleapis.com/auth/cloud-platform",
- // "https://www.googleapis.com/auth/sqlservice.admin"
- // ]
- // }
- }
- // method id "sql.databases.update":
- type DatabasesUpdateCall struct {
- s *Service
- project string
- instance string
- database string
- database2 *Database
- urlParams_ gensupport.URLParams
- ctx_ context.Context
- }
- // Update: Updates a resource containing information about a database
- // inside a Cloud SQL instance.
- func (r *DatabasesService) Update(project string, instance string, database string, database2 *Database) *DatabasesUpdateCall {
- c := &DatabasesUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
- c.project = project
- c.instance = instance
- c.database = database
- c.database2 = database2
- return c
- }
- // Fields allows partial responses to be retrieved. See
- // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
- // for more information.
- func (c *DatabasesUpdateCall) Fields(s ...googleapi.Field) *DatabasesUpdateCall {
- c.urlParams_.Set("fields", googleapi.CombineFields(s))
- return c
- }
- // Context sets the context to be used in this call's Do method. Any
- // pending HTTP request will be aborted if the provided context is
- // canceled.
- func (c *DatabasesUpdateCall) Context(ctx context.Context) *DatabasesUpdateCall {
- c.ctx_ = ctx
- return c
- }
- func (c *DatabasesUpdateCall) doRequest(alt string) (*http.Response, error) {
- var body io.Reader = nil
- body, err := googleapi.WithoutDataWrapper.JSONReader(c.database2)
- if err != nil {
- return nil, err
- }
- ctype := "application/json"
- c.urlParams_.Set("alt", alt)
- urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/instances/{instance}/databases/{database}")
- urls += "?" + c.urlParams_.Encode()
- req, _ := http.NewRequest("PUT", urls, body)
- googleapi.Expand(req.URL, map[string]string{
- "project": c.project,
- "instance": c.instance,
- "database": c.database,
- })
- req.Header.Set("Content-Type", ctype)
- req.Header.Set("User-Agent", c.s.userAgent())
- if c.ctx_ != nil {
- return ctxhttp.Do(c.ctx_, c.s.client, req)
- }
- return c.s.client.Do(req)
- }
- // Do executes the "sql.databases.update" call.
- // Exactly one of *Operation or error will be non-nil. Any non-2xx
- // status code is an error. Response headers are in either
- // *Operation.ServerResponse.Header or (if a response was returned at
- // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
- // to check whether the returned error was because
- // http.StatusNotModified was returned.
- func (c *DatabasesUpdateCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
- gensupport.SetOptions(c.urlParams_, opts...)
- res, err := c.doRequest("json")
- if res != nil && res.StatusCode == http.StatusNotModified {
- if res.Body != nil {
- res.Body.Close()
- }
- return nil, &googleapi.Error{
- Code: res.StatusCode,
- Header: res.Header,
- }
- }
- if err != nil {
- return nil, err
- }
- defer googleapi.CloseBody(res)
- if err := googleapi.CheckResponse(res); err != nil {
- return nil, err
- }
- ret := &Operation{
- ServerResponse: googleapi.ServerResponse{
- Header: res.Header,
- HTTPStatusCode: res.StatusCode,
- },
- }
- if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
- return nil, err
- }
- return ret, nil
- // {
- // "description": "Updates a resource containing information about a database inside a Cloud SQL instance.",
- // "httpMethod": "PUT",
- // "id": "sql.databases.update",
- // "parameterOrder": [
- // "project",
- // "instance",
- // "database"
- // ],
- // "parameters": {
- // "database": {
- // "description": "Name of the database to be updated in the instance.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // },
- // "instance": {
- // "description": "Database instance ID. This does not include the project ID.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // },
- // "project": {
- // "description": "Project ID of the project that contains the instance.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // }
- // },
- // "path": "projects/{project}/instances/{instance}/databases/{database}",
- // "request": {
- // "$ref": "Database"
- // },
- // "response": {
- // "$ref": "Operation"
- // },
- // "scopes": [
- // "https://www.googleapis.com/auth/cloud-platform",
- // "https://www.googleapis.com/auth/sqlservice.admin"
- // ]
- // }
- }
- // method id "sql.flags.list":
- type FlagsListCall struct {
- s *Service
- urlParams_ gensupport.URLParams
- ifNoneMatch_ string
- ctx_ context.Context
- }
- // List: List all available database flags for Google Cloud SQL
- // instances.
- func (r *FlagsService) List() *FlagsListCall {
- c := &FlagsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
- return c
- }
- // Fields allows partial responses to be retrieved. See
- // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
- // for more information.
- func (c *FlagsListCall) Fields(s ...googleapi.Field) *FlagsListCall {
- c.urlParams_.Set("fields", googleapi.CombineFields(s))
- return c
- }
- // IfNoneMatch sets the optional parameter which makes the operation
- // fail if the object's ETag matches the given value. This is useful for
- // getting updates only after the object has changed since the last
- // request. Use googleapi.IsNotModified to check whether the response
- // error from Do is the result of In-None-Match.
- func (c *FlagsListCall) IfNoneMatch(entityTag string) *FlagsListCall {
- c.ifNoneMatch_ = entityTag
- return c
- }
- // Context sets the context to be used in this call's Do method. Any
- // pending HTTP request will be aborted if the provided context is
- // canceled.
- func (c *FlagsListCall) Context(ctx context.Context) *FlagsListCall {
- c.ctx_ = ctx
- return c
- }
- func (c *FlagsListCall) doRequest(alt string) (*http.Response, error) {
- var body io.Reader = nil
- c.urlParams_.Set("alt", alt)
- urls := googleapi.ResolveRelative(c.s.BasePath, "flags")
- urls += "?" + c.urlParams_.Encode()
- req, _ := http.NewRequest("GET", urls, body)
- googleapi.SetOpaque(req.URL)
- req.Header.Set("User-Agent", c.s.userAgent())
- if c.ifNoneMatch_ != "" {
- req.Header.Set("If-None-Match", c.ifNoneMatch_)
- }
- if c.ctx_ != nil {
- return ctxhttp.Do(c.ctx_, c.s.client, req)
- }
- return c.s.client.Do(req)
- }
- // Do executes the "sql.flags.list" call.
- // Exactly one of *FlagsListResponse or error will be non-nil. Any
- // non-2xx status code is an error. Response headers are in either
- // *FlagsListResponse.ServerResponse.Header or (if a response was
- // returned at all) in error.(*googleapi.Error).Header. Use
- // googleapi.IsNotModified to check whether the returned error was
- // because http.StatusNotModified was returned.
- func (c *FlagsListCall) Do(opts ...googleapi.CallOption) (*FlagsListResponse, error) {
- gensupport.SetOptions(c.urlParams_, opts...)
- res, err := c.doRequest("json")
- if res != nil && res.StatusCode == http.StatusNotModified {
- if res.Body != nil {
- res.Body.Close()
- }
- return nil, &googleapi.Error{
- Code: res.StatusCode,
- Header: res.Header,
- }
- }
- if err != nil {
- return nil, err
- }
- defer googleapi.CloseBody(res)
- if err := googleapi.CheckResponse(res); err != nil {
- return nil, err
- }
- ret := &FlagsListResponse{
- ServerResponse: googleapi.ServerResponse{
- Header: res.Header,
- HTTPStatusCode: res.StatusCode,
- },
- }
- if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
- return nil, err
- }
- return ret, nil
- // {
- // "description": "List all available database flags for Google Cloud SQL instances.",
- // "httpMethod": "GET",
- // "id": "sql.flags.list",
- // "path": "flags",
- // "response": {
- // "$ref": "FlagsListResponse"
- // },
- // "scopes": [
- // "https://www.googleapis.com/auth/cloud-platform",
- // "https://www.googleapis.com/auth/sqlservice.admin"
- // ]
- // }
- }
- // method id "sql.instances.clone":
- type InstancesCloneCall struct {
- s *Service
- project string
- instance string
- instancesclonerequest *InstancesCloneRequest
- urlParams_ gensupport.URLParams
- ctx_ context.Context
- }
- // Clone: Creates a Cloud SQL instance as a clone of the source
- // instance.
- func (r *InstancesService) Clone(project string, instance string, instancesclonerequest *InstancesCloneRequest) *InstancesCloneCall {
- c := &InstancesCloneCall{s: r.s, urlParams_: make(gensupport.URLParams)}
- c.project = project
- c.instance = instance
- c.instancesclonerequest = instancesclonerequest
- return c
- }
- // Fields allows partial responses to be retrieved. See
- // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
- // for more information.
- func (c *InstancesCloneCall) Fields(s ...googleapi.Field) *InstancesCloneCall {
- c.urlParams_.Set("fields", googleapi.CombineFields(s))
- return c
- }
- // Context sets the context to be used in this call's Do method. Any
- // pending HTTP request will be aborted if the provided context is
- // canceled.
- func (c *InstancesCloneCall) Context(ctx context.Context) *InstancesCloneCall {
- c.ctx_ = ctx
- return c
- }
- func (c *InstancesCloneCall) doRequest(alt string) (*http.Response, error) {
- var body io.Reader = nil
- body, err := googleapi.WithoutDataWrapper.JSONReader(c.instancesclonerequest)
- if err != nil {
- return nil, err
- }
- ctype := "application/json"
- c.urlParams_.Set("alt", alt)
- urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/instances/{instance}/clone")
- urls += "?" + c.urlParams_.Encode()
- req, _ := http.NewRequest("POST", urls, body)
- googleapi.Expand(req.URL, map[string]string{
- "project": c.project,
- "instance": c.instance,
- })
- req.Header.Set("Content-Type", ctype)
- req.Header.Set("User-Agent", c.s.userAgent())
- if c.ctx_ != nil {
- return ctxhttp.Do(c.ctx_, c.s.client, req)
- }
- return c.s.client.Do(req)
- }
- // Do executes the "sql.instances.clone" call.
- // Exactly one of *Operation or error will be non-nil. Any non-2xx
- // status code is an error. Response headers are in either
- // *Operation.ServerResponse.Header or (if a response was returned at
- // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
- // to check whether the returned error was because
- // http.StatusNotModified was returned.
- func (c *InstancesCloneCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
- gensupport.SetOptions(c.urlParams_, opts...)
- res, err := c.doRequest("json")
- if res != nil && res.StatusCode == http.StatusNotModified {
- if res.Body != nil {
- res.Body.Close()
- }
- return nil, &googleapi.Error{
- Code: res.StatusCode,
- Header: res.Header,
- }
- }
- if err != nil {
- return nil, err
- }
- defer googleapi.CloseBody(res)
- if err := googleapi.CheckResponse(res); err != nil {
- return nil, err
- }
- ret := &Operation{
- ServerResponse: googleapi.ServerResponse{
- Header: res.Header,
- HTTPStatusCode: res.StatusCode,
- },
- }
- if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
- return nil, err
- }
- return ret, nil
- // {
- // "description": "Creates a Cloud SQL instance as a clone of the source instance.",
- // "httpMethod": "POST",
- // "id": "sql.instances.clone",
- // "parameterOrder": [
- // "project",
- // "instance"
- // ],
- // "parameters": {
- // "instance": {
- // "description": "The ID of the Cloud SQL instance to be cloned (source). This does not include the project ID.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // },
- // "project": {
- // "description": "Project ID of the source as well as the clone Cloud SQL instance.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // }
- // },
- // "path": "projects/{project}/instances/{instance}/clone",
- // "request": {
- // "$ref": "InstancesCloneRequest"
- // },
- // "response": {
- // "$ref": "Operation"
- // },
- // "scopes": [
- // "https://www.googleapis.com/auth/cloud-platform",
- // "https://www.googleapis.com/auth/sqlservice.admin"
- // ]
- // }
- }
- // method id "sql.instances.delete":
- type InstancesDeleteCall struct {
- s *Service
- project string
- instance string
- urlParams_ gensupport.URLParams
- ctx_ context.Context
- }
- // Delete: Deletes a Cloud SQL instance.
- func (r *InstancesService) Delete(project string, instance string) *InstancesDeleteCall {
- c := &InstancesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
- c.project = project
- c.instance = instance
- return c
- }
- // Fields allows partial responses to be retrieved. See
- // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
- // for more information.
- func (c *InstancesDeleteCall) Fields(s ...googleapi.Field) *InstancesDeleteCall {
- c.urlParams_.Set("fields", googleapi.CombineFields(s))
- return c
- }
- // Context sets the context to be used in this call's Do method. Any
- // pending HTTP request will be aborted if the provided context is
- // canceled.
- func (c *InstancesDeleteCall) Context(ctx context.Context) *InstancesDeleteCall {
- c.ctx_ = ctx
- return c
- }
- func (c *InstancesDeleteCall) doRequest(alt string) (*http.Response, error) {
- var body io.Reader = nil
- c.urlParams_.Set("alt", alt)
- urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/instances/{instance}")
- urls += "?" + c.urlParams_.Encode()
- req, _ := http.NewRequest("DELETE", urls, body)
- googleapi.Expand(req.URL, map[string]string{
- "project": c.project,
- "instance": c.instance,
- })
- req.Header.Set("User-Agent", c.s.userAgent())
- if c.ctx_ != nil {
- return ctxhttp.Do(c.ctx_, c.s.client, req)
- }
- return c.s.client.Do(req)
- }
- // Do executes the "sql.instances.delete" call.
- // Exactly one of *Operation or error will be non-nil. Any non-2xx
- // status code is an error. Response headers are in either
- // *Operation.ServerResponse.Header or (if a response was returned at
- // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
- // to check whether the returned error was because
- // http.StatusNotModified was returned.
- func (c *InstancesDeleteCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
- gensupport.SetOptions(c.urlParams_, opts...)
- res, err := c.doRequest("json")
- if res != nil && res.StatusCode == http.StatusNotModified {
- if res.Body != nil {
- res.Body.Close()
- }
- return nil, &googleapi.Error{
- Code: res.StatusCode,
- Header: res.Header,
- }
- }
- if err != nil {
- return nil, err
- }
- defer googleapi.CloseBody(res)
- if err := googleapi.CheckResponse(res); err != nil {
- return nil, err
- }
- ret := &Operation{
- ServerResponse: googleapi.ServerResponse{
- Header: res.Header,
- HTTPStatusCode: res.StatusCode,
- },
- }
- if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
- return nil, err
- }
- return ret, nil
- // {
- // "description": "Deletes a Cloud SQL instance.",
- // "httpMethod": "DELETE",
- // "id": "sql.instances.delete",
- // "parameterOrder": [
- // "project",
- // "instance"
- // ],
- // "parameters": {
- // "instance": {
- // "description": "Cloud SQL instance ID. This does not include the project ID.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // },
- // "project": {
- // "description": "Project ID of the project that contains the instance to be deleted.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // }
- // },
- // "path": "projects/{project}/instances/{instance}",
- // "response": {
- // "$ref": "Operation"
- // },
- // "scopes": [
- // "https://www.googleapis.com/auth/cloud-platform",
- // "https://www.googleapis.com/auth/sqlservice.admin"
- // ]
- // }
- }
- // method id "sql.instances.export":
- type InstancesExportCall struct {
- s *Service
- project string
- instance string
- instancesexportrequest *InstancesExportRequest
- urlParams_ gensupport.URLParams
- ctx_ context.Context
- }
- // Export: Exports data from a Cloud SQL instance to a Google Cloud
- // Storage bucket as a MySQL dump file.
- func (r *InstancesService) Export(project string, instance string, instancesexportrequest *InstancesExportRequest) *InstancesExportCall {
- c := &InstancesExportCall{s: r.s, urlParams_: make(gensupport.URLParams)}
- c.project = project
- c.instance = instance
- c.instancesexportrequest = instancesexportrequest
- return c
- }
- // Fields allows partial responses to be retrieved. See
- // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
- // for more information.
- func (c *InstancesExportCall) Fields(s ...googleapi.Field) *InstancesExportCall {
- c.urlParams_.Set("fields", googleapi.CombineFields(s))
- return c
- }
- // Context sets the context to be used in this call's Do method. Any
- // pending HTTP request will be aborted if the provided context is
- // canceled.
- func (c *InstancesExportCall) Context(ctx context.Context) *InstancesExportCall {
- c.ctx_ = ctx
- return c
- }
- func (c *InstancesExportCall) doRequest(alt string) (*http.Response, error) {
- var body io.Reader = nil
- body, err := googleapi.WithoutDataWrapper.JSONReader(c.instancesexportrequest)
- if err != nil {
- return nil, err
- }
- ctype := "application/json"
- c.urlParams_.Set("alt", alt)
- urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/instances/{instance}/export")
- urls += "?" + c.urlParams_.Encode()
- req, _ := http.NewRequest("POST", urls, body)
- googleapi.Expand(req.URL, map[string]string{
- "project": c.project,
- "instance": c.instance,
- })
- req.Header.Set("Content-Type", ctype)
- req.Header.Set("User-Agent", c.s.userAgent())
- if c.ctx_ != nil {
- return ctxhttp.Do(c.ctx_, c.s.client, req)
- }
- return c.s.client.Do(req)
- }
- // Do executes the "sql.instances.export" call.
- // Exactly one of *Operation or error will be non-nil. Any non-2xx
- // status code is an error. Response headers are in either
- // *Operation.ServerResponse.Header or (if a response was returned at
- // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
- // to check whether the returned error was because
- // http.StatusNotModified was returned.
- func (c *InstancesExportCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
- gensupport.SetOptions(c.urlParams_, opts...)
- res, err := c.doRequest("json")
- if res != nil && res.StatusCode == http.StatusNotModified {
- if res.Body != nil {
- res.Body.Close()
- }
- return nil, &googleapi.Error{
- Code: res.StatusCode,
- Header: res.Header,
- }
- }
- if err != nil {
- return nil, err
- }
- defer googleapi.CloseBody(res)
- if err := googleapi.CheckResponse(res); err != nil {
- return nil, err
- }
- ret := &Operation{
- ServerResponse: googleapi.ServerResponse{
- Header: res.Header,
- HTTPStatusCode: res.StatusCode,
- },
- }
- if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
- return nil, err
- }
- return ret, nil
- // {
- // "description": "Exports data from a Cloud SQL instance to a Google Cloud Storage bucket as a MySQL dump file.",
- // "httpMethod": "POST",
- // "id": "sql.instances.export",
- // "parameterOrder": [
- // "project",
- // "instance"
- // ],
- // "parameters": {
- // "instance": {
- // "description": "Cloud SQL instance ID. This does not include the project ID.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // },
- // "project": {
- // "description": "Project ID of the project that contains the instance to be exported.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // }
- // },
- // "path": "projects/{project}/instances/{instance}/export",
- // "request": {
- // "$ref": "InstancesExportRequest"
- // },
- // "response": {
- // "$ref": "Operation"
- // },
- // "scopes": [
- // "https://www.googleapis.com/auth/cloud-platform"
- // ]
- // }
- }
- // method id "sql.instances.failover":
- type InstancesFailoverCall struct {
- s *Service
- project string
- instance string
- instancesfailoverrequest *InstancesFailoverRequest
- urlParams_ gensupport.URLParams
- ctx_ context.Context
- }
- // Failover: Failover the instance to its failover replica instance.
- func (r *InstancesService) Failover(project string, instance string, instancesfailoverrequest *InstancesFailoverRequest) *InstancesFailoverCall {
- c := &InstancesFailoverCall{s: r.s, urlParams_: make(gensupport.URLParams)}
- c.project = project
- c.instance = instance
- c.instancesfailoverrequest = instancesfailoverrequest
- return c
- }
- // Fields allows partial responses to be retrieved. See
- // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
- // for more information.
- func (c *InstancesFailoverCall) Fields(s ...googleapi.Field) *InstancesFailoverCall {
- c.urlParams_.Set("fields", googleapi.CombineFields(s))
- return c
- }
- // Context sets the context to be used in this call's Do method. Any
- // pending HTTP request will be aborted if the provided context is
- // canceled.
- func (c *InstancesFailoverCall) Context(ctx context.Context) *InstancesFailoverCall {
- c.ctx_ = ctx
- return c
- }
- func (c *InstancesFailoverCall) doRequest(alt string) (*http.Response, error) {
- var body io.Reader = nil
- body, err := googleapi.WithoutDataWrapper.JSONReader(c.instancesfailoverrequest)
- if err != nil {
- return nil, err
- }
- ctype := "application/json"
- c.urlParams_.Set("alt", alt)
- urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/instances/{instance}/failover")
- urls += "?" + c.urlParams_.Encode()
- req, _ := http.NewRequest("POST", urls, body)
- googleapi.Expand(req.URL, map[string]string{
- "project": c.project,
- "instance": c.instance,
- })
- req.Header.Set("Content-Type", ctype)
- req.Header.Set("User-Agent", c.s.userAgent())
- if c.ctx_ != nil {
- return ctxhttp.Do(c.ctx_, c.s.client, req)
- }
- return c.s.client.Do(req)
- }
- // Do executes the "sql.instances.failover" call.
- // Exactly one of *Operation or error will be non-nil. Any non-2xx
- // status code is an error. Response headers are in either
- // *Operation.ServerResponse.Header or (if a response was returned at
- // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
- // to check whether the returned error was because
- // http.StatusNotModified was returned.
- func (c *InstancesFailoverCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
- gensupport.SetOptions(c.urlParams_, opts...)
- res, err := c.doRequest("json")
- if res != nil && res.StatusCode == http.StatusNotModified {
- if res.Body != nil {
- res.Body.Close()
- }
- return nil, &googleapi.Error{
- Code: res.StatusCode,
- Header: res.Header,
- }
- }
- if err != nil {
- return nil, err
- }
- defer googleapi.CloseBody(res)
- if err := googleapi.CheckResponse(res); err != nil {
- return nil, err
- }
- ret := &Operation{
- ServerResponse: googleapi.ServerResponse{
- Header: res.Header,
- HTTPStatusCode: res.StatusCode,
- },
- }
- if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
- return nil, err
- }
- return ret, nil
- // {
- // "description": "Failover the instance to its failover replica instance.",
- // "httpMethod": "POST",
- // "id": "sql.instances.failover",
- // "parameterOrder": [
- // "project",
- // "instance"
- // ],
- // "parameters": {
- // "instance": {
- // "description": "Cloud SQL instance ID. This does not include the project ID.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // },
- // "project": {
- // "description": "ID of the project that contains the read replica.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // }
- // },
- // "path": "projects/{project}/instances/{instance}/failover",
- // "request": {
- // "$ref": "InstancesFailoverRequest"
- // },
- // "response": {
- // "$ref": "Operation"
- // },
- // "scopes": [
- // "https://www.googleapis.com/auth/cloud-platform",
- // "https://www.googleapis.com/auth/sqlservice.admin"
- // ]
- // }
- }
- // method id "sql.instances.get":
- type InstancesGetCall struct {
- s *Service
- project string
- instance string
- urlParams_ gensupport.URLParams
- ifNoneMatch_ string
- ctx_ context.Context
- }
- // Get: Retrieves a resource containing information about a Cloud SQL
- // instance.
- func (r *InstancesService) Get(project string, instance string) *InstancesGetCall {
- c := &InstancesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
- c.project = project
- c.instance = instance
- return c
- }
- // Fields allows partial responses to be retrieved. See
- // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
- // for more information.
- func (c *InstancesGetCall) Fields(s ...googleapi.Field) *InstancesGetCall {
- c.urlParams_.Set("fields", googleapi.CombineFields(s))
- return c
- }
- // IfNoneMatch sets the optional parameter which makes the operation
- // fail if the object's ETag matches the given value. This is useful for
- // getting updates only after the object has changed since the last
- // request. Use googleapi.IsNotModified to check whether the response
- // error from Do is the result of In-None-Match.
- func (c *InstancesGetCall) IfNoneMatch(entityTag string) *InstancesGetCall {
- c.ifNoneMatch_ = entityTag
- return c
- }
- // Context sets the context to be used in this call's Do method. Any
- // pending HTTP request will be aborted if the provided context is
- // canceled.
- func (c *InstancesGetCall) Context(ctx context.Context) *InstancesGetCall {
- c.ctx_ = ctx
- return c
- }
- func (c *InstancesGetCall) doRequest(alt string) (*http.Response, error) {
- var body io.Reader = nil
- c.urlParams_.Set("alt", alt)
- urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/instances/{instance}")
- urls += "?" + c.urlParams_.Encode()
- req, _ := http.NewRequest("GET", urls, body)
- googleapi.Expand(req.URL, map[string]string{
- "project": c.project,
- "instance": c.instance,
- })
- req.Header.Set("User-Agent", c.s.userAgent())
- if c.ifNoneMatch_ != "" {
- req.Header.Set("If-None-Match", c.ifNoneMatch_)
- }
- if c.ctx_ != nil {
- return ctxhttp.Do(c.ctx_, c.s.client, req)
- }
- return c.s.client.Do(req)
- }
- // Do executes the "sql.instances.get" call.
- // Exactly one of *DatabaseInstance or error will be non-nil. Any
- // non-2xx status code is an error. Response headers are in either
- // *DatabaseInstance.ServerResponse.Header or (if a response was
- // returned at all) in error.(*googleapi.Error).Header. Use
- // googleapi.IsNotModified to check whether the returned error was
- // because http.StatusNotModified was returned.
- func (c *InstancesGetCall) Do(opts ...googleapi.CallOption) (*DatabaseInstance, error) {
- gensupport.SetOptions(c.urlParams_, opts...)
- res, err := c.doRequest("json")
- if res != nil && res.StatusCode == http.StatusNotModified {
- if res.Body != nil {
- res.Body.Close()
- }
- return nil, &googleapi.Error{
- Code: res.StatusCode,
- Header: res.Header,
- }
- }
- if err != nil {
- return nil, err
- }
- defer googleapi.CloseBody(res)
- if err := googleapi.CheckResponse(res); err != nil {
- return nil, err
- }
- ret := &DatabaseInstance{
- ServerResponse: googleapi.ServerResponse{
- Header: res.Header,
- HTTPStatusCode: res.StatusCode,
- },
- }
- if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
- return nil, err
- }
- return ret, nil
- // {
- // "description": "Retrieves a resource containing information about a Cloud SQL instance.",
- // "httpMethod": "GET",
- // "id": "sql.instances.get",
- // "parameterOrder": [
- // "project",
- // "instance"
- // ],
- // "parameters": {
- // "instance": {
- // "description": "Database instance ID. This does not include the project ID.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // },
- // "project": {
- // "description": "Project ID of the project that contains the instance.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // }
- // },
- // "path": "projects/{project}/instances/{instance}",
- // "response": {
- // "$ref": "DatabaseInstance"
- // },
- // "scopes": [
- // "https://www.googleapis.com/auth/cloud-platform",
- // "https://www.googleapis.com/auth/sqlservice.admin"
- // ]
- // }
- }
- // method id "sql.instances.import":
- type InstancesImportCall struct {
- s *Service
- project string
- instance string
- instancesimportrequest *InstancesImportRequest
- urlParams_ gensupport.URLParams
- ctx_ context.Context
- }
- // Import: Imports data into a Cloud SQL instance from a MySQL dump file
- // in Google Cloud Storage.
- func (r *InstancesService) Import(project string, instance string, instancesimportrequest *InstancesImportRequest) *InstancesImportCall {
- c := &InstancesImportCall{s: r.s, urlParams_: make(gensupport.URLParams)}
- c.project = project
- c.instance = instance
- c.instancesimportrequest = instancesimportrequest
- return c
- }
- // Fields allows partial responses to be retrieved. See
- // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
- // for more information.
- func (c *InstancesImportCall) Fields(s ...googleapi.Field) *InstancesImportCall {
- c.urlParams_.Set("fields", googleapi.CombineFields(s))
- return c
- }
- // Context sets the context to be used in this call's Do method. Any
- // pending HTTP request will be aborted if the provided context is
- // canceled.
- func (c *InstancesImportCall) Context(ctx context.Context) *InstancesImportCall {
- c.ctx_ = ctx
- return c
- }
- func (c *InstancesImportCall) doRequest(alt string) (*http.Response, error) {
- var body io.Reader = nil
- body, err := googleapi.WithoutDataWrapper.JSONReader(c.instancesimportrequest)
- if err != nil {
- return nil, err
- }
- ctype := "application/json"
- c.urlParams_.Set("alt", alt)
- urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/instances/{instance}/import")
- urls += "?" + c.urlParams_.Encode()
- req, _ := http.NewRequest("POST", urls, body)
- googleapi.Expand(req.URL, map[string]string{
- "project": c.project,
- "instance": c.instance,
- })
- req.Header.Set("Content-Type", ctype)
- req.Header.Set("User-Agent", c.s.userAgent())
- if c.ctx_ != nil {
- return ctxhttp.Do(c.ctx_, c.s.client, req)
- }
- return c.s.client.Do(req)
- }
- // Do executes the "sql.instances.import" call.
- // Exactly one of *Operation or error will be non-nil. Any non-2xx
- // status code is an error. Response headers are in either
- // *Operation.ServerResponse.Header or (if a response was returned at
- // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
- // to check whether the returned error was because
- // http.StatusNotModified was returned.
- func (c *InstancesImportCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
- gensupport.SetOptions(c.urlParams_, opts...)
- res, err := c.doRequest("json")
- if res != nil && res.StatusCode == http.StatusNotModified {
- if res.Body != nil {
- res.Body.Close()
- }
- return nil, &googleapi.Error{
- Code: res.StatusCode,
- Header: res.Header,
- }
- }
- if err != nil {
- return nil, err
- }
- defer googleapi.CloseBody(res)
- if err := googleapi.CheckResponse(res); err != nil {
- return nil, err
- }
- ret := &Operation{
- ServerResponse: googleapi.ServerResponse{
- Header: res.Header,
- HTTPStatusCode: res.StatusCode,
- },
- }
- if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
- return nil, err
- }
- return ret, nil
- // {
- // "description": "Imports data into a Cloud SQL instance from a MySQL dump file in Google Cloud Storage.",
- // "httpMethod": "POST",
- // "id": "sql.instances.import",
- // "parameterOrder": [
- // "project",
- // "instance"
- // ],
- // "parameters": {
- // "instance": {
- // "description": "Cloud SQL instance ID. This does not include the project ID.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // },
- // "project": {
- // "description": "Project ID of the project that contains the instance.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // }
- // },
- // "path": "projects/{project}/instances/{instance}/import",
- // "request": {
- // "$ref": "InstancesImportRequest"
- // },
- // "response": {
- // "$ref": "Operation"
- // },
- // "scopes": [
- // "https://www.googleapis.com/auth/cloud-platform"
- // ]
- // }
- }
- // method id "sql.instances.insert":
- type InstancesInsertCall struct {
- s *Service
- project string
- databaseinstance *DatabaseInstance
- urlParams_ gensupport.URLParams
- ctx_ context.Context
- }
- // Insert: Creates a new Cloud SQL instance.
- func (r *InstancesService) Insert(project string, databaseinstance *DatabaseInstance) *InstancesInsertCall {
- c := &InstancesInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
- c.project = project
- c.databaseinstance = databaseinstance
- return c
- }
- // Fields allows partial responses to be retrieved. See
- // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
- // for more information.
- func (c *InstancesInsertCall) Fields(s ...googleapi.Field) *InstancesInsertCall {
- c.urlParams_.Set("fields", googleapi.CombineFields(s))
- return c
- }
- // Context sets the context to be used in this call's Do method. Any
- // pending HTTP request will be aborted if the provided context is
- // canceled.
- func (c *InstancesInsertCall) Context(ctx context.Context) *InstancesInsertCall {
- c.ctx_ = ctx
- return c
- }
- func (c *InstancesInsertCall) doRequest(alt string) (*http.Response, error) {
- var body io.Reader = nil
- body, err := googleapi.WithoutDataWrapper.JSONReader(c.databaseinstance)
- if err != nil {
- return nil, err
- }
- ctype := "application/json"
- c.urlParams_.Set("alt", alt)
- urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/instances")
- urls += "?" + c.urlParams_.Encode()
- req, _ := http.NewRequest("POST", urls, body)
- googleapi.Expand(req.URL, map[string]string{
- "project": c.project,
- })
- req.Header.Set("Content-Type", ctype)
- req.Header.Set("User-Agent", c.s.userAgent())
- if c.ctx_ != nil {
- return ctxhttp.Do(c.ctx_, c.s.client, req)
- }
- return c.s.client.Do(req)
- }
- // Do executes the "sql.instances.insert" call.
- // Exactly one of *Operation or error will be non-nil. Any non-2xx
- // status code is an error. Response headers are in either
- // *Operation.ServerResponse.Header or (if a response was returned at
- // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
- // to check whether the returned error was because
- // http.StatusNotModified was returned.
- func (c *InstancesInsertCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
- gensupport.SetOptions(c.urlParams_, opts...)
- res, err := c.doRequest("json")
- if res != nil && res.StatusCode == http.StatusNotModified {
- if res.Body != nil {
- res.Body.Close()
- }
- return nil, &googleapi.Error{
- Code: res.StatusCode,
- Header: res.Header,
- }
- }
- if err != nil {
- return nil, err
- }
- defer googleapi.CloseBody(res)
- if err := googleapi.CheckResponse(res); err != nil {
- return nil, err
- }
- ret := &Operation{
- ServerResponse: googleapi.ServerResponse{
- Header: res.Header,
- HTTPStatusCode: res.StatusCode,
- },
- }
- if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
- return nil, err
- }
- return ret, nil
- // {
- // "description": "Creates a new Cloud SQL instance.",
- // "httpMethod": "POST",
- // "id": "sql.instances.insert",
- // "parameterOrder": [
- // "project"
- // ],
- // "parameters": {
- // "project": {
- // "description": "Project ID of the project to which the newly created Cloud SQL instances should belong.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // }
- // },
- // "path": "projects/{project}/instances",
- // "request": {
- // "$ref": "DatabaseInstance"
- // },
- // "response": {
- // "$ref": "Operation"
- // },
- // "scopes": [
- // "https://www.googleapis.com/auth/cloud-platform",
- // "https://www.googleapis.com/auth/sqlservice.admin"
- // ]
- // }
- }
- // method id "sql.instances.list":
- type InstancesListCall struct {
- s *Service
- project string
- urlParams_ gensupport.URLParams
- ifNoneMatch_ string
- ctx_ context.Context
- }
- // List: Lists instances under a given project in the alphabetical order
- // of the instance name.
- func (r *InstancesService) List(project string) *InstancesListCall {
- c := &InstancesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
- c.project = project
- return c
- }
- // MaxResults sets the optional parameter "maxResults": The maximum
- // number of results to return per response.
- func (c *InstancesListCall) MaxResults(maxResults int64) *InstancesListCall {
- c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
- return c
- }
- // PageToken sets the optional parameter "pageToken": A
- // previously-returned page token representing part of the larger set of
- // results to view.
- func (c *InstancesListCall) PageToken(pageToken string) *InstancesListCall {
- c.urlParams_.Set("pageToken", pageToken)
- return c
- }
- // Fields allows partial responses to be retrieved. See
- // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
- // for more information.
- func (c *InstancesListCall) Fields(s ...googleapi.Field) *InstancesListCall {
- c.urlParams_.Set("fields", googleapi.CombineFields(s))
- return c
- }
- // IfNoneMatch sets the optional parameter which makes the operation
- // fail if the object's ETag matches the given value. This is useful for
- // getting updates only after the object has changed since the last
- // request. Use googleapi.IsNotModified to check whether the response
- // error from Do is the result of In-None-Match.
- func (c *InstancesListCall) IfNoneMatch(entityTag string) *InstancesListCall {
- c.ifNoneMatch_ = entityTag
- return c
- }
- // Context sets the context to be used in this call's Do method. Any
- // pending HTTP request will be aborted if the provided context is
- // canceled.
- func (c *InstancesListCall) Context(ctx context.Context) *InstancesListCall {
- c.ctx_ = ctx
- return c
- }
- func (c *InstancesListCall) doRequest(alt string) (*http.Response, error) {
- var body io.Reader = nil
- c.urlParams_.Set("alt", alt)
- urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/instances")
- urls += "?" + c.urlParams_.Encode()
- req, _ := http.NewRequest("GET", urls, body)
- googleapi.Expand(req.URL, map[string]string{
- "project": c.project,
- })
- req.Header.Set("User-Agent", c.s.userAgent())
- if c.ifNoneMatch_ != "" {
- req.Header.Set("If-None-Match", c.ifNoneMatch_)
- }
- if c.ctx_ != nil {
- return ctxhttp.Do(c.ctx_, c.s.client, req)
- }
- return c.s.client.Do(req)
- }
- // Do executes the "sql.instances.list" call.
- // Exactly one of *InstancesListResponse or error will be non-nil. Any
- // non-2xx status code is an error. Response headers are in either
- // *InstancesListResponse.ServerResponse.Header or (if a response was
- // returned at all) in error.(*googleapi.Error).Header. Use
- // googleapi.IsNotModified to check whether the returned error was
- // because http.StatusNotModified was returned.
- func (c *InstancesListCall) Do(opts ...googleapi.CallOption) (*InstancesListResponse, error) {
- gensupport.SetOptions(c.urlParams_, opts...)
- res, err := c.doRequest("json")
- if res != nil && res.StatusCode == http.StatusNotModified {
- if res.Body != nil {
- res.Body.Close()
- }
- return nil, &googleapi.Error{
- Code: res.StatusCode,
- Header: res.Header,
- }
- }
- if err != nil {
- return nil, err
- }
- defer googleapi.CloseBody(res)
- if err := googleapi.CheckResponse(res); err != nil {
- return nil, err
- }
- ret := &InstancesListResponse{
- ServerResponse: googleapi.ServerResponse{
- Header: res.Header,
- HTTPStatusCode: res.StatusCode,
- },
- }
- if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
- return nil, err
- }
- return ret, nil
- // {
- // "description": "Lists instances under a given project in the alphabetical order of the instance name.",
- // "httpMethod": "GET",
- // "id": "sql.instances.list",
- // "parameterOrder": [
- // "project"
- // ],
- // "parameters": {
- // "maxResults": {
- // "description": "The maximum number of results to return per response.",
- // "format": "uint32",
- // "location": "query",
- // "type": "integer"
- // },
- // "pageToken": {
- // "description": "A previously-returned page token representing part of the larger set of results to view.",
- // "location": "query",
- // "type": "string"
- // },
- // "project": {
- // "description": "Project ID of the project for which to list Cloud SQL instances.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // }
- // },
- // "path": "projects/{project}/instances",
- // "response": {
- // "$ref": "InstancesListResponse"
- // },
- // "scopes": [
- // "https://www.googleapis.com/auth/cloud-platform",
- // "https://www.googleapis.com/auth/sqlservice.admin"
- // ]
- // }
- }
- // Pages invokes f for each page of results.
- // A non-nil error returned from f will halt the iteration.
- // The provided context supersedes any context provided to the Context method.
- func (c *InstancesListCall) Pages(ctx context.Context, f func(*InstancesListResponse) error) error {
- c.ctx_ = ctx
- defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
- for {
- x, err := c.Do()
- if err != nil {
- return err
- }
- if err := f(x); err != nil {
- return err
- }
- if x.NextPageToken == "" {
- return nil
- }
- c.PageToken(x.NextPageToken)
- }
- }
- // method id "sql.instances.patch":
- type InstancesPatchCall struct {
- s *Service
- project string
- instance string
- databaseinstance *DatabaseInstance
- urlParams_ gensupport.URLParams
- ctx_ context.Context
- }
- // Patch: 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.
- func (r *InstancesService) Patch(project string, instance string, databaseinstance *DatabaseInstance) *InstancesPatchCall {
- c := &InstancesPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
- c.project = project
- c.instance = instance
- c.databaseinstance = databaseinstance
- return c
- }
- // Fields allows partial responses to be retrieved. See
- // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
- // for more information.
- func (c *InstancesPatchCall) Fields(s ...googleapi.Field) *InstancesPatchCall {
- c.urlParams_.Set("fields", googleapi.CombineFields(s))
- return c
- }
- // Context sets the context to be used in this call's Do method. Any
- // pending HTTP request will be aborted if the provided context is
- // canceled.
- func (c *InstancesPatchCall) Context(ctx context.Context) *InstancesPatchCall {
- c.ctx_ = ctx
- return c
- }
- func (c *InstancesPatchCall) doRequest(alt string) (*http.Response, error) {
- var body io.Reader = nil
- body, err := googleapi.WithoutDataWrapper.JSONReader(c.databaseinstance)
- if err != nil {
- return nil, err
- }
- ctype := "application/json"
- c.urlParams_.Set("alt", alt)
- urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/instances/{instance}")
- urls += "?" + c.urlParams_.Encode()
- req, _ := http.NewRequest("PATCH", urls, body)
- googleapi.Expand(req.URL, map[string]string{
- "project": c.project,
- "instance": c.instance,
- })
- req.Header.Set("Content-Type", ctype)
- req.Header.Set("User-Agent", c.s.userAgent())
- if c.ctx_ != nil {
- return ctxhttp.Do(c.ctx_, c.s.client, req)
- }
- return c.s.client.Do(req)
- }
- // Do executes the "sql.instances.patch" call.
- // Exactly one of *Operation or error will be non-nil. Any non-2xx
- // status code is an error. Response headers are in either
- // *Operation.ServerResponse.Header or (if a response was returned at
- // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
- // to check whether the returned error was because
- // http.StatusNotModified was returned.
- func (c *InstancesPatchCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
- gensupport.SetOptions(c.urlParams_, opts...)
- res, err := c.doRequest("json")
- if res != nil && res.StatusCode == http.StatusNotModified {
- if res.Body != nil {
- res.Body.Close()
- }
- return nil, &googleapi.Error{
- Code: res.StatusCode,
- Header: res.Header,
- }
- }
- if err != nil {
- return nil, err
- }
- defer googleapi.CloseBody(res)
- if err := googleapi.CheckResponse(res); err != nil {
- return nil, err
- }
- ret := &Operation{
- ServerResponse: googleapi.ServerResponse{
- Header: res.Header,
- HTTPStatusCode: res.StatusCode,
- },
- }
- if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
- return nil, err
- }
- return ret, nil
- // {
- // "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.",
- // "httpMethod": "PATCH",
- // "id": "sql.instances.patch",
- // "parameterOrder": [
- // "project",
- // "instance"
- // ],
- // "parameters": {
- // "instance": {
- // "description": "Cloud SQL instance ID. This does not include the project ID.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // },
- // "project": {
- // "description": "Project ID of the project that contains the instance.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // }
- // },
- // "path": "projects/{project}/instances/{instance}",
- // "request": {
- // "$ref": "DatabaseInstance"
- // },
- // "response": {
- // "$ref": "Operation"
- // },
- // "scopes": [
- // "https://www.googleapis.com/auth/cloud-platform",
- // "https://www.googleapis.com/auth/sqlservice.admin"
- // ]
- // }
- }
- // method id "sql.instances.promoteReplica":
- type InstancesPromoteReplicaCall struct {
- s *Service
- project string
- instance string
- urlParams_ gensupport.URLParams
- ctx_ context.Context
- }
- // PromoteReplica: Promotes the read replica instance to be a
- // stand-alone Cloud SQL instance.
- func (r *InstancesService) PromoteReplica(project string, instance string) *InstancesPromoteReplicaCall {
- c := &InstancesPromoteReplicaCall{s: r.s, urlParams_: make(gensupport.URLParams)}
- c.project = project
- c.instance = instance
- return c
- }
- // Fields allows partial responses to be retrieved. See
- // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
- // for more information.
- func (c *InstancesPromoteReplicaCall) Fields(s ...googleapi.Field) *InstancesPromoteReplicaCall {
- c.urlParams_.Set("fields", googleapi.CombineFields(s))
- return c
- }
- // Context sets the context to be used in this call's Do method. Any
- // pending HTTP request will be aborted if the provided context is
- // canceled.
- func (c *InstancesPromoteReplicaCall) Context(ctx context.Context) *InstancesPromoteReplicaCall {
- c.ctx_ = ctx
- return c
- }
- func (c *InstancesPromoteReplicaCall) doRequest(alt string) (*http.Response, error) {
- var body io.Reader = nil
- c.urlParams_.Set("alt", alt)
- urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/instances/{instance}/promoteReplica")
- urls += "?" + c.urlParams_.Encode()
- req, _ := http.NewRequest("POST", urls, body)
- googleapi.Expand(req.URL, map[string]string{
- "project": c.project,
- "instance": c.instance,
- })
- req.Header.Set("User-Agent", c.s.userAgent())
- if c.ctx_ != nil {
- return ctxhttp.Do(c.ctx_, c.s.client, req)
- }
- return c.s.client.Do(req)
- }
- // Do executes the "sql.instances.promoteReplica" call.
- // Exactly one of *Operation or error will be non-nil. Any non-2xx
- // status code is an error. Response headers are in either
- // *Operation.ServerResponse.Header or (if a response was returned at
- // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
- // to check whether the returned error was because
- // http.StatusNotModified was returned.
- func (c *InstancesPromoteReplicaCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
- gensupport.SetOptions(c.urlParams_, opts...)
- res, err := c.doRequest("json")
- if res != nil && res.StatusCode == http.StatusNotModified {
- if res.Body != nil {
- res.Body.Close()
- }
- return nil, &googleapi.Error{
- Code: res.StatusCode,
- Header: res.Header,
- }
- }
- if err != nil {
- return nil, err
- }
- defer googleapi.CloseBody(res)
- if err := googleapi.CheckResponse(res); err != nil {
- return nil, err
- }
- ret := &Operation{
- ServerResponse: googleapi.ServerResponse{
- Header: res.Header,
- HTTPStatusCode: res.StatusCode,
- },
- }
- if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
- return nil, err
- }
- return ret, nil
- // {
- // "description": "Promotes the read replica instance to be a stand-alone Cloud SQL instance.",
- // "httpMethod": "POST",
- // "id": "sql.instances.promoteReplica",
- // "parameterOrder": [
- // "project",
- // "instance"
- // ],
- // "parameters": {
- // "instance": {
- // "description": "Cloud SQL read replica instance name.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // },
- // "project": {
- // "description": "ID of the project that contains the read replica.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // }
- // },
- // "path": "projects/{project}/instances/{instance}/promoteReplica",
- // "response": {
- // "$ref": "Operation"
- // },
- // "scopes": [
- // "https://www.googleapis.com/auth/cloud-platform",
- // "https://www.googleapis.com/auth/sqlservice.admin"
- // ]
- // }
- }
- // method id "sql.instances.resetSslConfig":
- type InstancesResetSslConfigCall struct {
- s *Service
- project string
- instance string
- urlParams_ gensupport.URLParams
- ctx_ context.Context
- }
- // ResetSslConfig: 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.
- func (r *InstancesService) ResetSslConfig(project string, instance string) *InstancesResetSslConfigCall {
- c := &InstancesResetSslConfigCall{s: r.s, urlParams_: make(gensupport.URLParams)}
- c.project = project
- c.instance = instance
- return c
- }
- // Fields allows partial responses to be retrieved. See
- // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
- // for more information.
- func (c *InstancesResetSslConfigCall) Fields(s ...googleapi.Field) *InstancesResetSslConfigCall {
- c.urlParams_.Set("fields", googleapi.CombineFields(s))
- return c
- }
- // Context sets the context to be used in this call's Do method. Any
- // pending HTTP request will be aborted if the provided context is
- // canceled.
- func (c *InstancesResetSslConfigCall) Context(ctx context.Context) *InstancesResetSslConfigCall {
- c.ctx_ = ctx
- return c
- }
- func (c *InstancesResetSslConfigCall) doRequest(alt string) (*http.Response, error) {
- var body io.Reader = nil
- c.urlParams_.Set("alt", alt)
- urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/instances/{instance}/resetSslConfig")
- urls += "?" + c.urlParams_.Encode()
- req, _ := http.NewRequest("POST", urls, body)
- googleapi.Expand(req.URL, map[string]string{
- "project": c.project,
- "instance": c.instance,
- })
- req.Header.Set("User-Agent", c.s.userAgent())
- if c.ctx_ != nil {
- return ctxhttp.Do(c.ctx_, c.s.client, req)
- }
- return c.s.client.Do(req)
- }
- // Do executes the "sql.instances.resetSslConfig" call.
- // Exactly one of *Operation or error will be non-nil. Any non-2xx
- // status code is an error. Response headers are in either
- // *Operation.ServerResponse.Header or (if a response was returned at
- // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
- // to check whether the returned error was because
- // http.StatusNotModified was returned.
- func (c *InstancesResetSslConfigCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
- gensupport.SetOptions(c.urlParams_, opts...)
- res, err := c.doRequest("json")
- if res != nil && res.StatusCode == http.StatusNotModified {
- if res.Body != nil {
- res.Body.Close()
- }
- return nil, &googleapi.Error{
- Code: res.StatusCode,
- Header: res.Header,
- }
- }
- if err != nil {
- return nil, err
- }
- defer googleapi.CloseBody(res)
- if err := googleapi.CheckResponse(res); err != nil {
- return nil, err
- }
- ret := &Operation{
- ServerResponse: googleapi.ServerResponse{
- Header: res.Header,
- HTTPStatusCode: res.StatusCode,
- },
- }
- if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
- return nil, err
- }
- return ret, nil
- // {
- // "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.",
- // "httpMethod": "POST",
- // "id": "sql.instances.resetSslConfig",
- // "parameterOrder": [
- // "project",
- // "instance"
- // ],
- // "parameters": {
- // "instance": {
- // "description": "Cloud SQL instance ID. This does not include the project ID.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // },
- // "project": {
- // "description": "Project ID of the project that contains the instance.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // }
- // },
- // "path": "projects/{project}/instances/{instance}/resetSslConfig",
- // "response": {
- // "$ref": "Operation"
- // },
- // "scopes": [
- // "https://www.googleapis.com/auth/cloud-platform",
- // "https://www.googleapis.com/auth/sqlservice.admin"
- // ]
- // }
- }
- // method id "sql.instances.restart":
- type InstancesRestartCall struct {
- s *Service
- project string
- instance string
- urlParams_ gensupport.URLParams
- ctx_ context.Context
- }
- // Restart: Restarts a Cloud SQL instance.
- func (r *InstancesService) Restart(project string, instance string) *InstancesRestartCall {
- c := &InstancesRestartCall{s: r.s, urlParams_: make(gensupport.URLParams)}
- c.project = project
- c.instance = instance
- return c
- }
- // Fields allows partial responses to be retrieved. See
- // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
- // for more information.
- func (c *InstancesRestartCall) Fields(s ...googleapi.Field) *InstancesRestartCall {
- c.urlParams_.Set("fields", googleapi.CombineFields(s))
- return c
- }
- // Context sets the context to be used in this call's Do method. Any
- // pending HTTP request will be aborted if the provided context is
- // canceled.
- func (c *InstancesRestartCall) Context(ctx context.Context) *InstancesRestartCall {
- c.ctx_ = ctx
- return c
- }
- func (c *InstancesRestartCall) doRequest(alt string) (*http.Response, error) {
- var body io.Reader = nil
- c.urlParams_.Set("alt", alt)
- urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/instances/{instance}/restart")
- urls += "?" + c.urlParams_.Encode()
- req, _ := http.NewRequest("POST", urls, body)
- googleapi.Expand(req.URL, map[string]string{
- "project": c.project,
- "instance": c.instance,
- })
- req.Header.Set("User-Agent", c.s.userAgent())
- if c.ctx_ != nil {
- return ctxhttp.Do(c.ctx_, c.s.client, req)
- }
- return c.s.client.Do(req)
- }
- // Do executes the "sql.instances.restart" call.
- // Exactly one of *Operation or error will be non-nil. Any non-2xx
- // status code is an error. Response headers are in either
- // *Operation.ServerResponse.Header or (if a response was returned at
- // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
- // to check whether the returned error was because
- // http.StatusNotModified was returned.
- func (c *InstancesRestartCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
- gensupport.SetOptions(c.urlParams_, opts...)
- res, err := c.doRequest("json")
- if res != nil && res.StatusCode == http.StatusNotModified {
- if res.Body != nil {
- res.Body.Close()
- }
- return nil, &googleapi.Error{
- Code: res.StatusCode,
- Header: res.Header,
- }
- }
- if err != nil {
- return nil, err
- }
- defer googleapi.CloseBody(res)
- if err := googleapi.CheckResponse(res); err != nil {
- return nil, err
- }
- ret := &Operation{
- ServerResponse: googleapi.ServerResponse{
- Header: res.Header,
- HTTPStatusCode: res.StatusCode,
- },
- }
- if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
- return nil, err
- }
- return ret, nil
- // {
- // "description": "Restarts a Cloud SQL instance.",
- // "httpMethod": "POST",
- // "id": "sql.instances.restart",
- // "parameterOrder": [
- // "project",
- // "instance"
- // ],
- // "parameters": {
- // "instance": {
- // "description": "Cloud SQL instance ID. This does not include the project ID.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // },
- // "project": {
- // "description": "Project ID of the project that contains the instance to be restarted.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // }
- // },
- // "path": "projects/{project}/instances/{instance}/restart",
- // "response": {
- // "$ref": "Operation"
- // },
- // "scopes": [
- // "https://www.googleapis.com/auth/cloud-platform",
- // "https://www.googleapis.com/auth/sqlservice.admin"
- // ]
- // }
- }
- // method id "sql.instances.restoreBackup":
- type InstancesRestoreBackupCall struct {
- s *Service
- project string
- instance string
- instancesrestorebackuprequest *InstancesRestoreBackupRequest
- urlParams_ gensupport.URLParams
- ctx_ context.Context
- }
- // RestoreBackup: Restores a backup of a Cloud SQL instance.
- func (r *InstancesService) RestoreBackup(project string, instance string, instancesrestorebackuprequest *InstancesRestoreBackupRequest) *InstancesRestoreBackupCall {
- c := &InstancesRestoreBackupCall{s: r.s, urlParams_: make(gensupport.URLParams)}
- c.project = project
- c.instance = instance
- c.instancesrestorebackuprequest = instancesrestorebackuprequest
- return c
- }
- // Fields allows partial responses to be retrieved. See
- // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
- // for more information.
- func (c *InstancesRestoreBackupCall) Fields(s ...googleapi.Field) *InstancesRestoreBackupCall {
- c.urlParams_.Set("fields", googleapi.CombineFields(s))
- return c
- }
- // Context sets the context to be used in this call's Do method. Any
- // pending HTTP request will be aborted if the provided context is
- // canceled.
- func (c *InstancesRestoreBackupCall) Context(ctx context.Context) *InstancesRestoreBackupCall {
- c.ctx_ = ctx
- return c
- }
- func (c *InstancesRestoreBackupCall) doRequest(alt string) (*http.Response, error) {
- var body io.Reader = nil
- body, err := googleapi.WithoutDataWrapper.JSONReader(c.instancesrestorebackuprequest)
- if err != nil {
- return nil, err
- }
- ctype := "application/json"
- c.urlParams_.Set("alt", alt)
- urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/instances/{instance}/restoreBackup")
- urls += "?" + c.urlParams_.Encode()
- req, _ := http.NewRequest("POST", urls, body)
- googleapi.Expand(req.URL, map[string]string{
- "project": c.project,
- "instance": c.instance,
- })
- req.Header.Set("Content-Type", ctype)
- req.Header.Set("User-Agent", c.s.userAgent())
- if c.ctx_ != nil {
- return ctxhttp.Do(c.ctx_, c.s.client, req)
- }
- return c.s.client.Do(req)
- }
- // Do executes the "sql.instances.restoreBackup" call.
- // Exactly one of *Operation or error will be non-nil. Any non-2xx
- // status code is an error. Response headers are in either
- // *Operation.ServerResponse.Header or (if a response was returned at
- // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
- // to check whether the returned error was because
- // http.StatusNotModified was returned.
- func (c *InstancesRestoreBackupCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
- gensupport.SetOptions(c.urlParams_, opts...)
- res, err := c.doRequest("json")
- if res != nil && res.StatusCode == http.StatusNotModified {
- if res.Body != nil {
- res.Body.Close()
- }
- return nil, &googleapi.Error{
- Code: res.StatusCode,
- Header: res.Header,
- }
- }
- if err != nil {
- return nil, err
- }
- defer googleapi.CloseBody(res)
- if err := googleapi.CheckResponse(res); err != nil {
- return nil, err
- }
- ret := &Operation{
- ServerResponse: googleapi.ServerResponse{
- Header: res.Header,
- HTTPStatusCode: res.StatusCode,
- },
- }
- if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
- return nil, err
- }
- return ret, nil
- // {
- // "description": "Restores a backup of a Cloud SQL instance.",
- // "httpMethod": "POST",
- // "id": "sql.instances.restoreBackup",
- // "parameterOrder": [
- // "project",
- // "instance"
- // ],
- // "parameters": {
- // "instance": {
- // "description": "Cloud SQL instance ID. This does not include the project ID.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // },
- // "project": {
- // "description": "Project ID of the project that contains the instance.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // }
- // },
- // "path": "projects/{project}/instances/{instance}/restoreBackup",
- // "request": {
- // "$ref": "InstancesRestoreBackupRequest"
- // },
- // "response": {
- // "$ref": "Operation"
- // },
- // "scopes": [
- // "https://www.googleapis.com/auth/cloud-platform",
- // "https://www.googleapis.com/auth/sqlservice.admin"
- // ]
- // }
- }
- // method id "sql.instances.startReplica":
- type InstancesStartReplicaCall struct {
- s *Service
- project string
- instance string
- urlParams_ gensupport.URLParams
- ctx_ context.Context
- }
- // StartReplica: Starts the replication in the read replica instance.
- func (r *InstancesService) StartReplica(project string, instance string) *InstancesStartReplicaCall {
- c := &InstancesStartReplicaCall{s: r.s, urlParams_: make(gensupport.URLParams)}
- c.project = project
- c.instance = instance
- return c
- }
- // Fields allows partial responses to be retrieved. See
- // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
- // for more information.
- func (c *InstancesStartReplicaCall) Fields(s ...googleapi.Field) *InstancesStartReplicaCall {
- c.urlParams_.Set("fields", googleapi.CombineFields(s))
- return c
- }
- // Context sets the context to be used in this call's Do method. Any
- // pending HTTP request will be aborted if the provided context is
- // canceled.
- func (c *InstancesStartReplicaCall) Context(ctx context.Context) *InstancesStartReplicaCall {
- c.ctx_ = ctx
- return c
- }
- func (c *InstancesStartReplicaCall) doRequest(alt string) (*http.Response, error) {
- var body io.Reader = nil
- c.urlParams_.Set("alt", alt)
- urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/instances/{instance}/startReplica")
- urls += "?" + c.urlParams_.Encode()
- req, _ := http.NewRequest("POST", urls, body)
- googleapi.Expand(req.URL, map[string]string{
- "project": c.project,
- "instance": c.instance,
- })
- req.Header.Set("User-Agent", c.s.userAgent())
- if c.ctx_ != nil {
- return ctxhttp.Do(c.ctx_, c.s.client, req)
- }
- return c.s.client.Do(req)
- }
- // Do executes the "sql.instances.startReplica" call.
- // Exactly one of *Operation or error will be non-nil. Any non-2xx
- // status code is an error. Response headers are in either
- // *Operation.ServerResponse.Header or (if a response was returned at
- // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
- // to check whether the returned error was because
- // http.StatusNotModified was returned.
- func (c *InstancesStartReplicaCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
- gensupport.SetOptions(c.urlParams_, opts...)
- res, err := c.doRequest("json")
- if res != nil && res.StatusCode == http.StatusNotModified {
- if res.Body != nil {
- res.Body.Close()
- }
- return nil, &googleapi.Error{
- Code: res.StatusCode,
- Header: res.Header,
- }
- }
- if err != nil {
- return nil, err
- }
- defer googleapi.CloseBody(res)
- if err := googleapi.CheckResponse(res); err != nil {
- return nil, err
- }
- ret := &Operation{
- ServerResponse: googleapi.ServerResponse{
- Header: res.Header,
- HTTPStatusCode: res.StatusCode,
- },
- }
- if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
- return nil, err
- }
- return ret, nil
- // {
- // "description": "Starts the replication in the read replica instance.",
- // "httpMethod": "POST",
- // "id": "sql.instances.startReplica",
- // "parameterOrder": [
- // "project",
- // "instance"
- // ],
- // "parameters": {
- // "instance": {
- // "description": "Cloud SQL read replica instance name.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // },
- // "project": {
- // "description": "ID of the project that contains the read replica.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // }
- // },
- // "path": "projects/{project}/instances/{instance}/startReplica",
- // "response": {
- // "$ref": "Operation"
- // },
- // "scopes": [
- // "https://www.googleapis.com/auth/cloud-platform",
- // "https://www.googleapis.com/auth/sqlservice.admin"
- // ]
- // }
- }
- // method id "sql.instances.stopReplica":
- type InstancesStopReplicaCall struct {
- s *Service
- project string
- instance string
- urlParams_ gensupport.URLParams
- ctx_ context.Context
- }
- // StopReplica: Stops the replication in the read replica instance.
- func (r *InstancesService) StopReplica(project string, instance string) *InstancesStopReplicaCall {
- c := &InstancesStopReplicaCall{s: r.s, urlParams_: make(gensupport.URLParams)}
- c.project = project
- c.instance = instance
- return c
- }
- // Fields allows partial responses to be retrieved. See
- // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
- // for more information.
- func (c *InstancesStopReplicaCall) Fields(s ...googleapi.Field) *InstancesStopReplicaCall {
- c.urlParams_.Set("fields", googleapi.CombineFields(s))
- return c
- }
- // Context sets the context to be used in this call's Do method. Any
- // pending HTTP request will be aborted if the provided context is
- // canceled.
- func (c *InstancesStopReplicaCall) Context(ctx context.Context) *InstancesStopReplicaCall {
- c.ctx_ = ctx
- return c
- }
- func (c *InstancesStopReplicaCall) doRequest(alt string) (*http.Response, error) {
- var body io.Reader = nil
- c.urlParams_.Set("alt", alt)
- urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/instances/{instance}/stopReplica")
- urls += "?" + c.urlParams_.Encode()
- req, _ := http.NewRequest("POST", urls, body)
- googleapi.Expand(req.URL, map[string]string{
- "project": c.project,
- "instance": c.instance,
- })
- req.Header.Set("User-Agent", c.s.userAgent())
- if c.ctx_ != nil {
- return ctxhttp.Do(c.ctx_, c.s.client, req)
- }
- return c.s.client.Do(req)
- }
- // Do executes the "sql.instances.stopReplica" call.
- // Exactly one of *Operation or error will be non-nil. Any non-2xx
- // status code is an error. Response headers are in either
- // *Operation.ServerResponse.Header or (if a response was returned at
- // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
- // to check whether the returned error was because
- // http.StatusNotModified was returned.
- func (c *InstancesStopReplicaCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
- gensupport.SetOptions(c.urlParams_, opts...)
- res, err := c.doRequest("json")
- if res != nil && res.StatusCode == http.StatusNotModified {
- if res.Body != nil {
- res.Body.Close()
- }
- return nil, &googleapi.Error{
- Code: res.StatusCode,
- Header: res.Header,
- }
- }
- if err != nil {
- return nil, err
- }
- defer googleapi.CloseBody(res)
- if err := googleapi.CheckResponse(res); err != nil {
- return nil, err
- }
- ret := &Operation{
- ServerResponse: googleapi.ServerResponse{
- Header: res.Header,
- HTTPStatusCode: res.StatusCode,
- },
- }
- if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
- return nil, err
- }
- return ret, nil
- // {
- // "description": "Stops the replication in the read replica instance.",
- // "httpMethod": "POST",
- // "id": "sql.instances.stopReplica",
- // "parameterOrder": [
- // "project",
- // "instance"
- // ],
- // "parameters": {
- // "instance": {
- // "description": "Cloud SQL read replica instance name.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // },
- // "project": {
- // "description": "ID of the project that contains the read replica.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // }
- // },
- // "path": "projects/{project}/instances/{instance}/stopReplica",
- // "response": {
- // "$ref": "Operation"
- // },
- // "scopes": [
- // "https://www.googleapis.com/auth/cloud-platform",
- // "https://www.googleapis.com/auth/sqlservice.admin"
- // ]
- // }
- }
- // method id "sql.instances.update":
- type InstancesUpdateCall struct {
- s *Service
- project string
- instance string
- databaseinstance *DatabaseInstance
- urlParams_ gensupport.URLParams
- ctx_ context.Context
- }
- // Update: 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.
- func (r *InstancesService) Update(project string, instance string, databaseinstance *DatabaseInstance) *InstancesUpdateCall {
- c := &InstancesUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
- c.project = project
- c.instance = instance
- c.databaseinstance = databaseinstance
- return c
- }
- // Fields allows partial responses to be retrieved. See
- // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
- // for more information.
- func (c *InstancesUpdateCall) Fields(s ...googleapi.Field) *InstancesUpdateCall {
- c.urlParams_.Set("fields", googleapi.CombineFields(s))
- return c
- }
- // Context sets the context to be used in this call's Do method. Any
- // pending HTTP request will be aborted if the provided context is
- // canceled.
- func (c *InstancesUpdateCall) Context(ctx context.Context) *InstancesUpdateCall {
- c.ctx_ = ctx
- return c
- }
- func (c *InstancesUpdateCall) doRequest(alt string) (*http.Response, error) {
- var body io.Reader = nil
- body, err := googleapi.WithoutDataWrapper.JSONReader(c.databaseinstance)
- if err != nil {
- return nil, err
- }
- ctype := "application/json"
- c.urlParams_.Set("alt", alt)
- urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/instances/{instance}")
- urls += "?" + c.urlParams_.Encode()
- req, _ := http.NewRequest("PUT", urls, body)
- googleapi.Expand(req.URL, map[string]string{
- "project": c.project,
- "instance": c.instance,
- })
- req.Header.Set("Content-Type", ctype)
- req.Header.Set("User-Agent", c.s.userAgent())
- if c.ctx_ != nil {
- return ctxhttp.Do(c.ctx_, c.s.client, req)
- }
- return c.s.client.Do(req)
- }
- // Do executes the "sql.instances.update" call.
- // Exactly one of *Operation or error will be non-nil. Any non-2xx
- // status code is an error. Response headers are in either
- // *Operation.ServerResponse.Header or (if a response was returned at
- // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
- // to check whether the returned error was because
- // http.StatusNotModified was returned.
- func (c *InstancesUpdateCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
- gensupport.SetOptions(c.urlParams_, opts...)
- res, err := c.doRequest("json")
- if res != nil && res.StatusCode == http.StatusNotModified {
- if res.Body != nil {
- res.Body.Close()
- }
- return nil, &googleapi.Error{
- Code: res.StatusCode,
- Header: res.Header,
- }
- }
- if err != nil {
- return nil, err
- }
- defer googleapi.CloseBody(res)
- if err := googleapi.CheckResponse(res); err != nil {
- return nil, err
- }
- ret := &Operation{
- ServerResponse: googleapi.ServerResponse{
- Header: res.Header,
- HTTPStatusCode: res.StatusCode,
- },
- }
- if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
- return nil, err
- }
- return ret, nil
- // {
- // "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.",
- // "etagRequired": true,
- // "httpMethod": "PUT",
- // "id": "sql.instances.update",
- // "parameterOrder": [
- // "project",
- // "instance"
- // ],
- // "parameters": {
- // "instance": {
- // "description": "Cloud SQL instance ID. This does not include the project ID.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // },
- // "project": {
- // "description": "Project ID of the project that contains the instance.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // }
- // },
- // "path": "projects/{project}/instances/{instance}",
- // "request": {
- // "$ref": "DatabaseInstance"
- // },
- // "response": {
- // "$ref": "Operation"
- // },
- // "scopes": [
- // "https://www.googleapis.com/auth/cloud-platform",
- // "https://www.googleapis.com/auth/sqlservice.admin"
- // ]
- // }
- }
- // method id "sql.operations.get":
- type OperationsGetCall struct {
- s *Service
- project string
- operation string
- urlParams_ gensupport.URLParams
- ifNoneMatch_ string
- ctx_ context.Context
- }
- // Get: Retrieves an instance operation that has been performed on an
- // instance.
- func (r *OperationsService) Get(project string, operation string) *OperationsGetCall {
- c := &OperationsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
- c.project = project
- c.operation = operation
- return c
- }
- // Fields allows partial responses to be retrieved. See
- // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
- // for more information.
- func (c *OperationsGetCall) Fields(s ...googleapi.Field) *OperationsGetCall {
- c.urlParams_.Set("fields", googleapi.CombineFields(s))
- return c
- }
- // IfNoneMatch sets the optional parameter which makes the operation
- // fail if the object's ETag matches the given value. This is useful for
- // getting updates only after the object has changed since the last
- // request. Use googleapi.IsNotModified to check whether the response
- // error from Do is the result of In-None-Match.
- func (c *OperationsGetCall) IfNoneMatch(entityTag string) *OperationsGetCall {
- c.ifNoneMatch_ = entityTag
- return c
- }
- // Context sets the context to be used in this call's Do method. Any
- // pending HTTP request will be aborted if the provided context is
- // canceled.
- func (c *OperationsGetCall) Context(ctx context.Context) *OperationsGetCall {
- c.ctx_ = ctx
- return c
- }
- func (c *OperationsGetCall) doRequest(alt string) (*http.Response, error) {
- var body io.Reader = nil
- c.urlParams_.Set("alt", alt)
- urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/operations/{operation}")
- urls += "?" + c.urlParams_.Encode()
- req, _ := http.NewRequest("GET", urls, body)
- googleapi.Expand(req.URL, map[string]string{
- "project": c.project,
- "operation": c.operation,
- })
- req.Header.Set("User-Agent", c.s.userAgent())
- if c.ifNoneMatch_ != "" {
- req.Header.Set("If-None-Match", c.ifNoneMatch_)
- }
- if c.ctx_ != nil {
- return ctxhttp.Do(c.ctx_, c.s.client, req)
- }
- return c.s.client.Do(req)
- }
- // Do executes the "sql.operations.get" call.
- // Exactly one of *Operation or error will be non-nil. Any non-2xx
- // status code is an error. Response headers are in either
- // *Operation.ServerResponse.Header or (if a response was returned at
- // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
- // to check whether the returned error was because
- // http.StatusNotModified was returned.
- func (c *OperationsGetCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
- gensupport.SetOptions(c.urlParams_, opts...)
- res, err := c.doRequest("json")
- if res != nil && res.StatusCode == http.StatusNotModified {
- if res.Body != nil {
- res.Body.Close()
- }
- return nil, &googleapi.Error{
- Code: res.StatusCode,
- Header: res.Header,
- }
- }
- if err != nil {
- return nil, err
- }
- defer googleapi.CloseBody(res)
- if err := googleapi.CheckResponse(res); err != nil {
- return nil, err
- }
- ret := &Operation{
- ServerResponse: googleapi.ServerResponse{
- Header: res.Header,
- HTTPStatusCode: res.StatusCode,
- },
- }
- if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
- return nil, err
- }
- return ret, nil
- // {
- // "description": "Retrieves an instance operation that has been performed on an instance.",
- // "httpMethod": "GET",
- // "id": "sql.operations.get",
- // "parameterOrder": [
- // "project",
- // "operation"
- // ],
- // "parameters": {
- // "operation": {
- // "description": "Instance operation ID.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // },
- // "project": {
- // "description": "Project ID of the project that contains the instance.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // }
- // },
- // "path": "projects/{project}/operations/{operation}",
- // "response": {
- // "$ref": "Operation"
- // },
- // "scopes": [
- // "https://www.googleapis.com/auth/cloud-platform",
- // "https://www.googleapis.com/auth/sqlservice.admin"
- // ]
- // }
- }
- // method id "sql.operations.list":
- type OperationsListCall struct {
- s *Service
- project string
- urlParams_ gensupport.URLParams
- ifNoneMatch_ string
- ctx_ context.Context
- }
- // List: Lists all instance operations that have been performed on the
- // given Cloud SQL instance in the reverse chronological order of the
- // start time.
- func (r *OperationsService) List(project string, instance string) *OperationsListCall {
- c := &OperationsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
- c.project = project
- c.urlParams_.Set("instance", instance)
- return c
- }
- // MaxResults sets the optional parameter "maxResults": Maximum number
- // of operations per response.
- func (c *OperationsListCall) MaxResults(maxResults int64) *OperationsListCall {
- c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
- return c
- }
- // PageToken sets the optional parameter "pageToken": A
- // previously-returned page token representing part of the larger set of
- // results to view.
- func (c *OperationsListCall) PageToken(pageToken string) *OperationsListCall {
- c.urlParams_.Set("pageToken", pageToken)
- return c
- }
- // Fields allows partial responses to be retrieved. See
- // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
- // for more information.
- func (c *OperationsListCall) Fields(s ...googleapi.Field) *OperationsListCall {
- c.urlParams_.Set("fields", googleapi.CombineFields(s))
- return c
- }
- // IfNoneMatch sets the optional parameter which makes the operation
- // fail if the object's ETag matches the given value. This is useful for
- // getting updates only after the object has changed since the last
- // request. Use googleapi.IsNotModified to check whether the response
- // error from Do is the result of In-None-Match.
- func (c *OperationsListCall) IfNoneMatch(entityTag string) *OperationsListCall {
- c.ifNoneMatch_ = entityTag
- return c
- }
- // Context sets the context to be used in this call's Do method. Any
- // pending HTTP request will be aborted if the provided context is
- // canceled.
- func (c *OperationsListCall) Context(ctx context.Context) *OperationsListCall {
- c.ctx_ = ctx
- return c
- }
- func (c *OperationsListCall) doRequest(alt string) (*http.Response, error) {
- var body io.Reader = nil
- c.urlParams_.Set("alt", alt)
- urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/operations")
- urls += "?" + c.urlParams_.Encode()
- req, _ := http.NewRequest("GET", urls, body)
- googleapi.Expand(req.URL, map[string]string{
- "project": c.project,
- })
- req.Header.Set("User-Agent", c.s.userAgent())
- if c.ifNoneMatch_ != "" {
- req.Header.Set("If-None-Match", c.ifNoneMatch_)
- }
- if c.ctx_ != nil {
- return ctxhttp.Do(c.ctx_, c.s.client, req)
- }
- return c.s.client.Do(req)
- }
- // Do executes the "sql.operations.list" call.
- // Exactly one of *OperationsListResponse or error will be non-nil. Any
- // non-2xx status code is an error. Response headers are in either
- // *OperationsListResponse.ServerResponse.Header or (if a response was
- // returned at all) in error.(*googleapi.Error).Header. Use
- // googleapi.IsNotModified to check whether the returned error was
- // because http.StatusNotModified was returned.
- func (c *OperationsListCall) Do(opts ...googleapi.CallOption) (*OperationsListResponse, error) {
- gensupport.SetOptions(c.urlParams_, opts...)
- res, err := c.doRequest("json")
- if res != nil && res.StatusCode == http.StatusNotModified {
- if res.Body != nil {
- res.Body.Close()
- }
- return nil, &googleapi.Error{
- Code: res.StatusCode,
- Header: res.Header,
- }
- }
- if err != nil {
- return nil, err
- }
- defer googleapi.CloseBody(res)
- if err := googleapi.CheckResponse(res); err != nil {
- return nil, err
- }
- ret := &OperationsListResponse{
- ServerResponse: googleapi.ServerResponse{
- Header: res.Header,
- HTTPStatusCode: res.StatusCode,
- },
- }
- if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
- return nil, err
- }
- return ret, nil
- // {
- // "description": "Lists all instance operations that have been performed on the given Cloud SQL instance in the reverse chronological order of the start time.",
- // "httpMethod": "GET",
- // "id": "sql.operations.list",
- // "parameterOrder": [
- // "project",
- // "instance"
- // ],
- // "parameters": {
- // "instance": {
- // "description": "Cloud SQL instance ID. This does not include the project ID.",
- // "location": "query",
- // "required": true,
- // "type": "string"
- // },
- // "maxResults": {
- // "description": "Maximum number of operations per response.",
- // "format": "uint32",
- // "location": "query",
- // "type": "integer"
- // },
- // "pageToken": {
- // "description": "A previously-returned page token representing part of the larger set of results to view.",
- // "location": "query",
- // "type": "string"
- // },
- // "project": {
- // "description": "Project ID of the project that contains the instance.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // }
- // },
- // "path": "projects/{project}/operations",
- // "response": {
- // "$ref": "OperationsListResponse"
- // },
- // "scopes": [
- // "https://www.googleapis.com/auth/cloud-platform",
- // "https://www.googleapis.com/auth/sqlservice.admin"
- // ]
- // }
- }
- // Pages invokes f for each page of results.
- // A non-nil error returned from f will halt the iteration.
- // The provided context supersedes any context provided to the Context method.
- func (c *OperationsListCall) Pages(ctx context.Context, f func(*OperationsListResponse) error) error {
- c.ctx_ = ctx
- defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
- for {
- x, err := c.Do()
- if err != nil {
- return err
- }
- if err := f(x); err != nil {
- return err
- }
- if x.NextPageToken == "" {
- return nil
- }
- c.PageToken(x.NextPageToken)
- }
- }
- // method id "sql.sslCerts.createEphemeral":
- type SslCertsCreateEphemeralCall struct {
- s *Service
- project string
- instance string
- sslcertscreateephemeralrequest *SslCertsCreateEphemeralRequest
- urlParams_ gensupport.URLParams
- ctx_ context.Context
- }
- // CreateEphemeral: 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.
- func (r *SslCertsService) CreateEphemeral(project string, instance string, sslcertscreateephemeralrequest *SslCertsCreateEphemeralRequest) *SslCertsCreateEphemeralCall {
- c := &SslCertsCreateEphemeralCall{s: r.s, urlParams_: make(gensupport.URLParams)}
- c.project = project
- c.instance = instance
- c.sslcertscreateephemeralrequest = sslcertscreateephemeralrequest
- return c
- }
- // Fields allows partial responses to be retrieved. See
- // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
- // for more information.
- func (c *SslCertsCreateEphemeralCall) Fields(s ...googleapi.Field) *SslCertsCreateEphemeralCall {
- c.urlParams_.Set("fields", googleapi.CombineFields(s))
- return c
- }
- // Context sets the context to be used in this call's Do method. Any
- // pending HTTP request will be aborted if the provided context is
- // canceled.
- func (c *SslCertsCreateEphemeralCall) Context(ctx context.Context) *SslCertsCreateEphemeralCall {
- c.ctx_ = ctx
- return c
- }
- func (c *SslCertsCreateEphemeralCall) doRequest(alt string) (*http.Response, error) {
- var body io.Reader = nil
- body, err := googleapi.WithoutDataWrapper.JSONReader(c.sslcertscreateephemeralrequest)
- if err != nil {
- return nil, err
- }
- ctype := "application/json"
- c.urlParams_.Set("alt", alt)
- urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/instances/{instance}/createEphemeral")
- urls += "?" + c.urlParams_.Encode()
- req, _ := http.NewRequest("POST", urls, body)
- googleapi.Expand(req.URL, map[string]string{
- "project": c.project,
- "instance": c.instance,
- })
- req.Header.Set("Content-Type", ctype)
- req.Header.Set("User-Agent", c.s.userAgent())
- if c.ctx_ != nil {
- return ctxhttp.Do(c.ctx_, c.s.client, req)
- }
- return c.s.client.Do(req)
- }
- // Do executes the "sql.sslCerts.createEphemeral" call.
- // Exactly one of *SslCert or error will be non-nil. Any non-2xx status
- // code is an error. Response headers are in either
- // *SslCert.ServerResponse.Header or (if a response was returned at all)
- // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
- // check whether the returned error was because http.StatusNotModified
- // was returned.
- func (c *SslCertsCreateEphemeralCall) Do(opts ...googleapi.CallOption) (*SslCert, error) {
- gensupport.SetOptions(c.urlParams_, opts...)
- res, err := c.doRequest("json")
- if res != nil && res.StatusCode == http.StatusNotModified {
- if res.Body != nil {
- res.Body.Close()
- }
- return nil, &googleapi.Error{
- Code: res.StatusCode,
- Header: res.Header,
- }
- }
- if err != nil {
- return nil, err
- }
- defer googleapi.CloseBody(res)
- if err := googleapi.CheckResponse(res); err != nil {
- return nil, err
- }
- ret := &SslCert{
- ServerResponse: googleapi.ServerResponse{
- Header: res.Header,
- HTTPStatusCode: res.StatusCode,
- },
- }
- if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
- return nil, err
- }
- return ret, nil
- // {
- // "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.",
- // "httpMethod": "POST",
- // "id": "sql.sslCerts.createEphemeral",
- // "parameterOrder": [
- // "project",
- // "instance"
- // ],
- // "parameters": {
- // "instance": {
- // "description": "Cloud SQL instance ID. This does not include the project ID.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // },
- // "project": {
- // "description": "Project ID of the Cloud SQL project.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // }
- // },
- // "path": "projects/{project}/instances/{instance}/createEphemeral",
- // "request": {
- // "$ref": "SslCertsCreateEphemeralRequest"
- // },
- // "response": {
- // "$ref": "SslCert"
- // },
- // "scopes": [
- // "https://www.googleapis.com/auth/cloud-platform",
- // "https://www.googleapis.com/auth/sqlservice.admin"
- // ]
- // }
- }
- // method id "sql.sslCerts.delete":
- type SslCertsDeleteCall struct {
- s *Service
- project string
- instance string
- sha1Fingerprint string
- urlParams_ gensupport.URLParams
- ctx_ context.Context
- }
- // Delete: Deletes the SSL certificate. The change will not take effect
- // until the instance is restarted.
- func (r *SslCertsService) Delete(project string, instance string, sha1Fingerprint string) *SslCertsDeleteCall {
- c := &SslCertsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
- c.project = project
- c.instance = instance
- c.sha1Fingerprint = sha1Fingerprint
- return c
- }
- // Fields allows partial responses to be retrieved. See
- // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
- // for more information.
- func (c *SslCertsDeleteCall) Fields(s ...googleapi.Field) *SslCertsDeleteCall {
- c.urlParams_.Set("fields", googleapi.CombineFields(s))
- return c
- }
- // Context sets the context to be used in this call's Do method. Any
- // pending HTTP request will be aborted if the provided context is
- // canceled.
- func (c *SslCertsDeleteCall) Context(ctx context.Context) *SslCertsDeleteCall {
- c.ctx_ = ctx
- return c
- }
- func (c *SslCertsDeleteCall) doRequest(alt string) (*http.Response, error) {
- var body io.Reader = nil
- c.urlParams_.Set("alt", alt)
- urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/instances/{instance}/sslCerts/{sha1Fingerprint}")
- urls += "?" + c.urlParams_.Encode()
- req, _ := http.NewRequest("DELETE", urls, body)
- googleapi.Expand(req.URL, map[string]string{
- "project": c.project,
- "instance": c.instance,
- "sha1Fingerprint": c.sha1Fingerprint,
- })
- req.Header.Set("User-Agent", c.s.userAgent())
- if c.ctx_ != nil {
- return ctxhttp.Do(c.ctx_, c.s.client, req)
- }
- return c.s.client.Do(req)
- }
- // Do executes the "sql.sslCerts.delete" call.
- // Exactly one of *Operation or error will be non-nil. Any non-2xx
- // status code is an error. Response headers are in either
- // *Operation.ServerResponse.Header or (if a response was returned at
- // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
- // to check whether the returned error was because
- // http.StatusNotModified was returned.
- func (c *SslCertsDeleteCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
- gensupport.SetOptions(c.urlParams_, opts...)
- res, err := c.doRequest("json")
- if res != nil && res.StatusCode == http.StatusNotModified {
- if res.Body != nil {
- res.Body.Close()
- }
- return nil, &googleapi.Error{
- Code: res.StatusCode,
- Header: res.Header,
- }
- }
- if err != nil {
- return nil, err
- }
- defer googleapi.CloseBody(res)
- if err := googleapi.CheckResponse(res); err != nil {
- return nil, err
- }
- ret := &Operation{
- ServerResponse: googleapi.ServerResponse{
- Header: res.Header,
- HTTPStatusCode: res.StatusCode,
- },
- }
- if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
- return nil, err
- }
- return ret, nil
- // {
- // "description": "Deletes the SSL certificate. The change will not take effect until the instance is restarted.",
- // "httpMethod": "DELETE",
- // "id": "sql.sslCerts.delete",
- // "parameterOrder": [
- // "project",
- // "instance",
- // "sha1Fingerprint"
- // ],
- // "parameters": {
- // "instance": {
- // "description": "Cloud SQL instance ID. This does not include the project ID.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // },
- // "project": {
- // "description": "Project ID of the project that contains the instance to be deleted.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // },
- // "sha1Fingerprint": {
- // "description": "Sha1 FingerPrint.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // }
- // },
- // "path": "projects/{project}/instances/{instance}/sslCerts/{sha1Fingerprint}",
- // "response": {
- // "$ref": "Operation"
- // },
- // "scopes": [
- // "https://www.googleapis.com/auth/cloud-platform",
- // "https://www.googleapis.com/auth/sqlservice.admin"
- // ]
- // }
- }
- // method id "sql.sslCerts.get":
- type SslCertsGetCall struct {
- s *Service
- project string
- instance string
- sha1Fingerprint string
- urlParams_ gensupport.URLParams
- ifNoneMatch_ string
- ctx_ context.Context
- }
- // Get: 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.
- func (r *SslCertsService) Get(project string, instance string, sha1Fingerprint string) *SslCertsGetCall {
- c := &SslCertsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
- c.project = project
- c.instance = instance
- c.sha1Fingerprint = sha1Fingerprint
- return c
- }
- // Fields allows partial responses to be retrieved. See
- // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
- // for more information.
- func (c *SslCertsGetCall) Fields(s ...googleapi.Field) *SslCertsGetCall {
- c.urlParams_.Set("fields", googleapi.CombineFields(s))
- return c
- }
- // IfNoneMatch sets the optional parameter which makes the operation
- // fail if the object's ETag matches the given value. This is useful for
- // getting updates only after the object has changed since the last
- // request. Use googleapi.IsNotModified to check whether the response
- // error from Do is the result of In-None-Match.
- func (c *SslCertsGetCall) IfNoneMatch(entityTag string) *SslCertsGetCall {
- c.ifNoneMatch_ = entityTag
- return c
- }
- // Context sets the context to be used in this call's Do method. Any
- // pending HTTP request will be aborted if the provided context is
- // canceled.
- func (c *SslCertsGetCall) Context(ctx context.Context) *SslCertsGetCall {
- c.ctx_ = ctx
- return c
- }
- func (c *SslCertsGetCall) doRequest(alt string) (*http.Response, error) {
- var body io.Reader = nil
- c.urlParams_.Set("alt", alt)
- urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/instances/{instance}/sslCerts/{sha1Fingerprint}")
- urls += "?" + c.urlParams_.Encode()
- req, _ := http.NewRequest("GET", urls, body)
- googleapi.Expand(req.URL, map[string]string{
- "project": c.project,
- "instance": c.instance,
- "sha1Fingerprint": c.sha1Fingerprint,
- })
- req.Header.Set("User-Agent", c.s.userAgent())
- if c.ifNoneMatch_ != "" {
- req.Header.Set("If-None-Match", c.ifNoneMatch_)
- }
- if c.ctx_ != nil {
- return ctxhttp.Do(c.ctx_, c.s.client, req)
- }
- return c.s.client.Do(req)
- }
- // Do executes the "sql.sslCerts.get" call.
- // Exactly one of *SslCert or error will be non-nil. Any non-2xx status
- // code is an error. Response headers are in either
- // *SslCert.ServerResponse.Header or (if a response was returned at all)
- // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
- // check whether the returned error was because http.StatusNotModified
- // was returned.
- func (c *SslCertsGetCall) Do(opts ...googleapi.CallOption) (*SslCert, error) {
- gensupport.SetOptions(c.urlParams_, opts...)
- res, err := c.doRequest("json")
- if res != nil && res.StatusCode == http.StatusNotModified {
- if res.Body != nil {
- res.Body.Close()
- }
- return nil, &googleapi.Error{
- Code: res.StatusCode,
- Header: res.Header,
- }
- }
- if err != nil {
- return nil, err
- }
- defer googleapi.CloseBody(res)
- if err := googleapi.CheckResponse(res); err != nil {
- return nil, err
- }
- ret := &SslCert{
- ServerResponse: googleapi.ServerResponse{
- Header: res.Header,
- HTTPStatusCode: res.StatusCode,
- },
- }
- if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
- return nil, err
- }
- return ret, nil
- // {
- // "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.",
- // "httpMethod": "GET",
- // "id": "sql.sslCerts.get",
- // "parameterOrder": [
- // "project",
- // "instance",
- // "sha1Fingerprint"
- // ],
- // "parameters": {
- // "instance": {
- // "description": "Cloud SQL instance ID. This does not include the project ID.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // },
- // "project": {
- // "description": "Project ID of the project that contains the instance.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // },
- // "sha1Fingerprint": {
- // "description": "Sha1 FingerPrint.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // }
- // },
- // "path": "projects/{project}/instances/{instance}/sslCerts/{sha1Fingerprint}",
- // "response": {
- // "$ref": "SslCert"
- // },
- // "scopes": [
- // "https://www.googleapis.com/auth/cloud-platform",
- // "https://www.googleapis.com/auth/sqlservice.admin"
- // ]
- // }
- }
- // method id "sql.sslCerts.insert":
- type SslCertsInsertCall struct {
- s *Service
- project string
- instance string
- sslcertsinsertrequest *SslCertsInsertRequest
- urlParams_ gensupport.URLParams
- ctx_ context.Context
- }
- // Insert: 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.
- func (r *SslCertsService) Insert(project string, instance string, sslcertsinsertrequest *SslCertsInsertRequest) *SslCertsInsertCall {
- c := &SslCertsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
- c.project = project
- c.instance = instance
- c.sslcertsinsertrequest = sslcertsinsertrequest
- return c
- }
- // Fields allows partial responses to be retrieved. See
- // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
- // for more information.
- func (c *SslCertsInsertCall) Fields(s ...googleapi.Field) *SslCertsInsertCall {
- c.urlParams_.Set("fields", googleapi.CombineFields(s))
- return c
- }
- // Context sets the context to be used in this call's Do method. Any
- // pending HTTP request will be aborted if the provided context is
- // canceled.
- func (c *SslCertsInsertCall) Context(ctx context.Context) *SslCertsInsertCall {
- c.ctx_ = ctx
- return c
- }
- func (c *SslCertsInsertCall) doRequest(alt string) (*http.Response, error) {
- var body io.Reader = nil
- body, err := googleapi.WithoutDataWrapper.JSONReader(c.sslcertsinsertrequest)
- if err != nil {
- return nil, err
- }
- ctype := "application/json"
- c.urlParams_.Set("alt", alt)
- urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/instances/{instance}/sslCerts")
- urls += "?" + c.urlParams_.Encode()
- req, _ := http.NewRequest("POST", urls, body)
- googleapi.Expand(req.URL, map[string]string{
- "project": c.project,
- "instance": c.instance,
- })
- req.Header.Set("Content-Type", ctype)
- req.Header.Set("User-Agent", c.s.userAgent())
- if c.ctx_ != nil {
- return ctxhttp.Do(c.ctx_, c.s.client, req)
- }
- return c.s.client.Do(req)
- }
- // Do executes the "sql.sslCerts.insert" call.
- // Exactly one of *SslCertsInsertResponse or error will be non-nil. Any
- // non-2xx status code is an error. Response headers are in either
- // *SslCertsInsertResponse.ServerResponse.Header or (if a response was
- // returned at all) in error.(*googleapi.Error).Header. Use
- // googleapi.IsNotModified to check whether the returned error was
- // because http.StatusNotModified was returned.
- func (c *SslCertsInsertCall) Do(opts ...googleapi.CallOption) (*SslCertsInsertResponse, error) {
- gensupport.SetOptions(c.urlParams_, opts...)
- res, err := c.doRequest("json")
- if res != nil && res.StatusCode == http.StatusNotModified {
- if res.Body != nil {
- res.Body.Close()
- }
- return nil, &googleapi.Error{
- Code: res.StatusCode,
- Header: res.Header,
- }
- }
- if err != nil {
- return nil, err
- }
- defer googleapi.CloseBody(res)
- if err := googleapi.CheckResponse(res); err != nil {
- return nil, err
- }
- ret := &SslCertsInsertResponse{
- ServerResponse: googleapi.ServerResponse{
- Header: res.Header,
- HTTPStatusCode: res.StatusCode,
- },
- }
- if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
- return nil, err
- }
- return ret, nil
- // {
- // "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.",
- // "httpMethod": "POST",
- // "id": "sql.sslCerts.insert",
- // "parameterOrder": [
- // "project",
- // "instance"
- // ],
- // "parameters": {
- // "instance": {
- // "description": "Cloud SQL instance ID. This does not include the project ID.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // },
- // "project": {
- // "description": "Project ID of the project to which the newly created Cloud SQL instances should belong.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // }
- // },
- // "path": "projects/{project}/instances/{instance}/sslCerts",
- // "request": {
- // "$ref": "SslCertsInsertRequest"
- // },
- // "response": {
- // "$ref": "SslCertsInsertResponse"
- // },
- // "scopes": [
- // "https://www.googleapis.com/auth/cloud-platform",
- // "https://www.googleapis.com/auth/sqlservice.admin"
- // ]
- // }
- }
- // method id "sql.sslCerts.list":
- type SslCertsListCall struct {
- s *Service
- project string
- instance string
- urlParams_ gensupport.URLParams
- ifNoneMatch_ string
- ctx_ context.Context
- }
- // List: Lists all of the current SSL certificates for the instance.
- func (r *SslCertsService) List(project string, instance string) *SslCertsListCall {
- c := &SslCertsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
- c.project = project
- c.instance = instance
- return c
- }
- // Fields allows partial responses to be retrieved. See
- // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
- // for more information.
- func (c *SslCertsListCall) Fields(s ...googleapi.Field) *SslCertsListCall {
- c.urlParams_.Set("fields", googleapi.CombineFields(s))
- return c
- }
- // IfNoneMatch sets the optional parameter which makes the operation
- // fail if the object's ETag matches the given value. This is useful for
- // getting updates only after the object has changed since the last
- // request. Use googleapi.IsNotModified to check whether the response
- // error from Do is the result of In-None-Match.
- func (c *SslCertsListCall) IfNoneMatch(entityTag string) *SslCertsListCall {
- c.ifNoneMatch_ = entityTag
- return c
- }
- // Context sets the context to be used in this call's Do method. Any
- // pending HTTP request will be aborted if the provided context is
- // canceled.
- func (c *SslCertsListCall) Context(ctx context.Context) *SslCertsListCall {
- c.ctx_ = ctx
- return c
- }
- func (c *SslCertsListCall) doRequest(alt string) (*http.Response, error) {
- var body io.Reader = nil
- c.urlParams_.Set("alt", alt)
- urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/instances/{instance}/sslCerts")
- urls += "?" + c.urlParams_.Encode()
- req, _ := http.NewRequest("GET", urls, body)
- googleapi.Expand(req.URL, map[string]string{
- "project": c.project,
- "instance": c.instance,
- })
- req.Header.Set("User-Agent", c.s.userAgent())
- if c.ifNoneMatch_ != "" {
- req.Header.Set("If-None-Match", c.ifNoneMatch_)
- }
- if c.ctx_ != nil {
- return ctxhttp.Do(c.ctx_, c.s.client, req)
- }
- return c.s.client.Do(req)
- }
- // Do executes the "sql.sslCerts.list" call.
- // Exactly one of *SslCertsListResponse or error will be non-nil. Any
- // non-2xx status code is an error. Response headers are in either
- // *SslCertsListResponse.ServerResponse.Header or (if a response was
- // returned at all) in error.(*googleapi.Error).Header. Use
- // googleapi.IsNotModified to check whether the returned error was
- // because http.StatusNotModified was returned.
- func (c *SslCertsListCall) Do(opts ...googleapi.CallOption) (*SslCertsListResponse, error) {
- gensupport.SetOptions(c.urlParams_, opts...)
- res, err := c.doRequest("json")
- if res != nil && res.StatusCode == http.StatusNotModified {
- if res.Body != nil {
- res.Body.Close()
- }
- return nil, &googleapi.Error{
- Code: res.StatusCode,
- Header: res.Header,
- }
- }
- if err != nil {
- return nil, err
- }
- defer googleapi.CloseBody(res)
- if err := googleapi.CheckResponse(res); err != nil {
- return nil, err
- }
- ret := &SslCertsListResponse{
- ServerResponse: googleapi.ServerResponse{
- Header: res.Header,
- HTTPStatusCode: res.StatusCode,
- },
- }
- if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
- return nil, err
- }
- return ret, nil
- // {
- // "description": "Lists all of the current SSL certificates for the instance.",
- // "httpMethod": "GET",
- // "id": "sql.sslCerts.list",
- // "parameterOrder": [
- // "project",
- // "instance"
- // ],
- // "parameters": {
- // "instance": {
- // "description": "Cloud SQL instance ID. This does not include the project ID.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // },
- // "project": {
- // "description": "Project ID of the project for which to list Cloud SQL instances.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // }
- // },
- // "path": "projects/{project}/instances/{instance}/sslCerts",
- // "response": {
- // "$ref": "SslCertsListResponse"
- // },
- // "scopes": [
- // "https://www.googleapis.com/auth/cloud-platform",
- // "https://www.googleapis.com/auth/sqlservice.admin"
- // ]
- // }
- }
- // method id "sql.tiers.list":
- type TiersListCall struct {
- s *Service
- project string
- urlParams_ gensupport.URLParams
- ifNoneMatch_ string
- ctx_ context.Context
- }
- // List: Lists all available service tiers for Google Cloud SQL, for
- // example D1, D2. For related information, see Pricing.
- func (r *TiersService) List(project string) *TiersListCall {
- c := &TiersListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
- c.project = project
- return c
- }
- // Fields allows partial responses to be retrieved. See
- // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
- // for more information.
- func (c *TiersListCall) Fields(s ...googleapi.Field) *TiersListCall {
- c.urlParams_.Set("fields", googleapi.CombineFields(s))
- return c
- }
- // IfNoneMatch sets the optional parameter which makes the operation
- // fail if the object's ETag matches the given value. This is useful for
- // getting updates only after the object has changed since the last
- // request. Use googleapi.IsNotModified to check whether the response
- // error from Do is the result of In-None-Match.
- func (c *TiersListCall) IfNoneMatch(entityTag string) *TiersListCall {
- c.ifNoneMatch_ = entityTag
- return c
- }
- // Context sets the context to be used in this call's Do method. Any
- // pending HTTP request will be aborted if the provided context is
- // canceled.
- func (c *TiersListCall) Context(ctx context.Context) *TiersListCall {
- c.ctx_ = ctx
- return c
- }
- func (c *TiersListCall) doRequest(alt string) (*http.Response, error) {
- var body io.Reader = nil
- c.urlParams_.Set("alt", alt)
- urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/tiers")
- urls += "?" + c.urlParams_.Encode()
- req, _ := http.NewRequest("GET", urls, body)
- googleapi.Expand(req.URL, map[string]string{
- "project": c.project,
- })
- req.Header.Set("User-Agent", c.s.userAgent())
- if c.ifNoneMatch_ != "" {
- req.Header.Set("If-None-Match", c.ifNoneMatch_)
- }
- if c.ctx_ != nil {
- return ctxhttp.Do(c.ctx_, c.s.client, req)
- }
- return c.s.client.Do(req)
- }
- // Do executes the "sql.tiers.list" call.
- // Exactly one of *TiersListResponse or error will be non-nil. Any
- // non-2xx status code is an error. Response headers are in either
- // *TiersListResponse.ServerResponse.Header or (if a response was
- // returned at all) in error.(*googleapi.Error).Header. Use
- // googleapi.IsNotModified to check whether the returned error was
- // because http.StatusNotModified was returned.
- func (c *TiersListCall) Do(opts ...googleapi.CallOption) (*TiersListResponse, error) {
- gensupport.SetOptions(c.urlParams_, opts...)
- res, err := c.doRequest("json")
- if res != nil && res.StatusCode == http.StatusNotModified {
- if res.Body != nil {
- res.Body.Close()
- }
- return nil, &googleapi.Error{
- Code: res.StatusCode,
- Header: res.Header,
- }
- }
- if err != nil {
- return nil, err
- }
- defer googleapi.CloseBody(res)
- if err := googleapi.CheckResponse(res); err != nil {
- return nil, err
- }
- ret := &TiersListResponse{
- ServerResponse: googleapi.ServerResponse{
- Header: res.Header,
- HTTPStatusCode: res.StatusCode,
- },
- }
- if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
- return nil, err
- }
- return ret, nil
- // {
- // "description": "Lists all available service tiers for Google Cloud SQL, for example D1, D2. For related information, see Pricing.",
- // "httpMethod": "GET",
- // "id": "sql.tiers.list",
- // "parameterOrder": [
- // "project"
- // ],
- // "parameters": {
- // "project": {
- // "description": "Project ID of the project for which to list tiers.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // }
- // },
- // "path": "projects/{project}/tiers",
- // "response": {
- // "$ref": "TiersListResponse"
- // },
- // "scopes": [
- // "https://www.googleapis.com/auth/cloud-platform",
- // "https://www.googleapis.com/auth/sqlservice.admin"
- // ]
- // }
- }
- // method id "sql.users.delete":
- type UsersDeleteCall struct {
- s *Service
- project string
- instance string
- urlParams_ gensupport.URLParams
- ctx_ context.Context
- }
- // Delete: Deletes a user from a Cloud SQL instance.
- func (r *UsersService) Delete(project string, instance string, host string, name string) *UsersDeleteCall {
- c := &UsersDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
- c.project = project
- c.instance = instance
- c.urlParams_.Set("host", host)
- c.urlParams_.Set("name", name)
- return c
- }
- // Fields allows partial responses to be retrieved. See
- // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
- // for more information.
- func (c *UsersDeleteCall) Fields(s ...googleapi.Field) *UsersDeleteCall {
- c.urlParams_.Set("fields", googleapi.CombineFields(s))
- return c
- }
- // Context sets the context to be used in this call's Do method. Any
- // pending HTTP request will be aborted if the provided context is
- // canceled.
- func (c *UsersDeleteCall) Context(ctx context.Context) *UsersDeleteCall {
- c.ctx_ = ctx
- return c
- }
- func (c *UsersDeleteCall) doRequest(alt string) (*http.Response, error) {
- var body io.Reader = nil
- c.urlParams_.Set("alt", alt)
- urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/instances/{instance}/users")
- urls += "?" + c.urlParams_.Encode()
- req, _ := http.NewRequest("DELETE", urls, body)
- googleapi.Expand(req.URL, map[string]string{
- "project": c.project,
- "instance": c.instance,
- })
- req.Header.Set("User-Agent", c.s.userAgent())
- if c.ctx_ != nil {
- return ctxhttp.Do(c.ctx_, c.s.client, req)
- }
- return c.s.client.Do(req)
- }
- // Do executes the "sql.users.delete" call.
- // Exactly one of *Operation or error will be non-nil. Any non-2xx
- // status code is an error. Response headers are in either
- // *Operation.ServerResponse.Header or (if a response was returned at
- // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
- // to check whether the returned error was because
- // http.StatusNotModified was returned.
- func (c *UsersDeleteCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
- gensupport.SetOptions(c.urlParams_, opts...)
- res, err := c.doRequest("json")
- if res != nil && res.StatusCode == http.StatusNotModified {
- if res.Body != nil {
- res.Body.Close()
- }
- return nil, &googleapi.Error{
- Code: res.StatusCode,
- Header: res.Header,
- }
- }
- if err != nil {
- return nil, err
- }
- defer googleapi.CloseBody(res)
- if err := googleapi.CheckResponse(res); err != nil {
- return nil, err
- }
- ret := &Operation{
- ServerResponse: googleapi.ServerResponse{
- Header: res.Header,
- HTTPStatusCode: res.StatusCode,
- },
- }
- if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
- return nil, err
- }
- return ret, nil
- // {
- // "description": "Deletes a user from a Cloud SQL instance.",
- // "httpMethod": "DELETE",
- // "id": "sql.users.delete",
- // "parameterOrder": [
- // "project",
- // "instance",
- // "host",
- // "name"
- // ],
- // "parameters": {
- // "host": {
- // "description": "Host of the user in the instance.",
- // "location": "query",
- // "required": true,
- // "type": "string"
- // },
- // "instance": {
- // "description": "Database instance ID. This does not include the project ID.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // },
- // "name": {
- // "description": "Name of the user in the instance.",
- // "location": "query",
- // "required": true,
- // "type": "string"
- // },
- // "project": {
- // "description": "Project ID of the project that contains the instance.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // }
- // },
- // "path": "projects/{project}/instances/{instance}/users",
- // "response": {
- // "$ref": "Operation"
- // },
- // "scopes": [
- // "https://www.googleapis.com/auth/cloud-platform",
- // "https://www.googleapis.com/auth/sqlservice.admin"
- // ]
- // }
- }
- // method id "sql.users.insert":
- type UsersInsertCall struct {
- s *Service
- project string
- instance string
- user *User
- urlParams_ gensupport.URLParams
- ctx_ context.Context
- }
- // Insert: Creates a new user in a Cloud SQL instance.
- func (r *UsersService) Insert(project string, instance string, user *User) *UsersInsertCall {
- c := &UsersInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
- c.project = project
- c.instance = instance
- c.user = user
- return c
- }
- // Fields allows partial responses to be retrieved. See
- // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
- // for more information.
- func (c *UsersInsertCall) Fields(s ...googleapi.Field) *UsersInsertCall {
- c.urlParams_.Set("fields", googleapi.CombineFields(s))
- return c
- }
- // Context sets the context to be used in this call's Do method. Any
- // pending HTTP request will be aborted if the provided context is
- // canceled.
- func (c *UsersInsertCall) Context(ctx context.Context) *UsersInsertCall {
- c.ctx_ = ctx
- return c
- }
- func (c *UsersInsertCall) doRequest(alt string) (*http.Response, error) {
- var body io.Reader = nil
- body, err := googleapi.WithoutDataWrapper.JSONReader(c.user)
- if err != nil {
- return nil, err
- }
- ctype := "application/json"
- c.urlParams_.Set("alt", alt)
- urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/instances/{instance}/users")
- urls += "?" + c.urlParams_.Encode()
- req, _ := http.NewRequest("POST", urls, body)
- googleapi.Expand(req.URL, map[string]string{
- "project": c.project,
- "instance": c.instance,
- })
- req.Header.Set("Content-Type", ctype)
- req.Header.Set("User-Agent", c.s.userAgent())
- if c.ctx_ != nil {
- return ctxhttp.Do(c.ctx_, c.s.client, req)
- }
- return c.s.client.Do(req)
- }
- // Do executes the "sql.users.insert" call.
- // Exactly one of *Operation or error will be non-nil. Any non-2xx
- // status code is an error. Response headers are in either
- // *Operation.ServerResponse.Header or (if a response was returned at
- // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
- // to check whether the returned error was because
- // http.StatusNotModified was returned.
- func (c *UsersInsertCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
- gensupport.SetOptions(c.urlParams_, opts...)
- res, err := c.doRequest("json")
- if res != nil && res.StatusCode == http.StatusNotModified {
- if res.Body != nil {
- res.Body.Close()
- }
- return nil, &googleapi.Error{
- Code: res.StatusCode,
- Header: res.Header,
- }
- }
- if err != nil {
- return nil, err
- }
- defer googleapi.CloseBody(res)
- if err := googleapi.CheckResponse(res); err != nil {
- return nil, err
- }
- ret := &Operation{
- ServerResponse: googleapi.ServerResponse{
- Header: res.Header,
- HTTPStatusCode: res.StatusCode,
- },
- }
- if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
- return nil, err
- }
- return ret, nil
- // {
- // "description": "Creates a new user in a Cloud SQL instance.",
- // "httpMethod": "POST",
- // "id": "sql.users.insert",
- // "parameterOrder": [
- // "project",
- // "instance"
- // ],
- // "parameters": {
- // "instance": {
- // "description": "Database instance ID. This does not include the project ID.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // },
- // "project": {
- // "description": "Project ID of the project that contains the instance.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // }
- // },
- // "path": "projects/{project}/instances/{instance}/users",
- // "request": {
- // "$ref": "User"
- // },
- // "response": {
- // "$ref": "Operation"
- // },
- // "scopes": [
- // "https://www.googleapis.com/auth/cloud-platform",
- // "https://www.googleapis.com/auth/sqlservice.admin"
- // ]
- // }
- }
- // method id "sql.users.list":
- type UsersListCall struct {
- s *Service
- project string
- instance string
- urlParams_ gensupport.URLParams
- ifNoneMatch_ string
- ctx_ context.Context
- }
- // List: Lists users in the specified Cloud SQL instance.
- func (r *UsersService) List(project string, instance string) *UsersListCall {
- c := &UsersListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
- c.project = project
- c.instance = instance
- return c
- }
- // Fields allows partial responses to be retrieved. See
- // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
- // for more information.
- func (c *UsersListCall) Fields(s ...googleapi.Field) *UsersListCall {
- c.urlParams_.Set("fields", googleapi.CombineFields(s))
- return c
- }
- // IfNoneMatch sets the optional parameter which makes the operation
- // fail if the object's ETag matches the given value. This is useful for
- // getting updates only after the object has changed since the last
- // request. Use googleapi.IsNotModified to check whether the response
- // error from Do is the result of In-None-Match.
- func (c *UsersListCall) IfNoneMatch(entityTag string) *UsersListCall {
- c.ifNoneMatch_ = entityTag
- return c
- }
- // Context sets the context to be used in this call's Do method. Any
- // pending HTTP request will be aborted if the provided context is
- // canceled.
- func (c *UsersListCall) Context(ctx context.Context) *UsersListCall {
- c.ctx_ = ctx
- return c
- }
- func (c *UsersListCall) doRequest(alt string) (*http.Response, error) {
- var body io.Reader = nil
- c.urlParams_.Set("alt", alt)
- urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/instances/{instance}/users")
- urls += "?" + c.urlParams_.Encode()
- req, _ := http.NewRequest("GET", urls, body)
- googleapi.Expand(req.URL, map[string]string{
- "project": c.project,
- "instance": c.instance,
- })
- req.Header.Set("User-Agent", c.s.userAgent())
- if c.ifNoneMatch_ != "" {
- req.Header.Set("If-None-Match", c.ifNoneMatch_)
- }
- if c.ctx_ != nil {
- return ctxhttp.Do(c.ctx_, c.s.client, req)
- }
- return c.s.client.Do(req)
- }
- // Do executes the "sql.users.list" call.
- // Exactly one of *UsersListResponse or error will be non-nil. Any
- // non-2xx status code is an error. Response headers are in either
- // *UsersListResponse.ServerResponse.Header or (if a response was
- // returned at all) in error.(*googleapi.Error).Header. Use
- // googleapi.IsNotModified to check whether the returned error was
- // because http.StatusNotModified was returned.
- func (c *UsersListCall) Do(opts ...googleapi.CallOption) (*UsersListResponse, error) {
- gensupport.SetOptions(c.urlParams_, opts...)
- res, err := c.doRequest("json")
- if res != nil && res.StatusCode == http.StatusNotModified {
- if res.Body != nil {
- res.Body.Close()
- }
- return nil, &googleapi.Error{
- Code: res.StatusCode,
- Header: res.Header,
- }
- }
- if err != nil {
- return nil, err
- }
- defer googleapi.CloseBody(res)
- if err := googleapi.CheckResponse(res); err != nil {
- return nil, err
- }
- ret := &UsersListResponse{
- ServerResponse: googleapi.ServerResponse{
- Header: res.Header,
- HTTPStatusCode: res.StatusCode,
- },
- }
- if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
- return nil, err
- }
- return ret, nil
- // {
- // "description": "Lists users in the specified Cloud SQL instance.",
- // "httpMethod": "GET",
- // "id": "sql.users.list",
- // "parameterOrder": [
- // "project",
- // "instance"
- // ],
- // "parameters": {
- // "instance": {
- // "description": "Database instance ID. This does not include the project ID.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // },
- // "project": {
- // "description": "Project ID of the project that contains the instance.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // }
- // },
- // "path": "projects/{project}/instances/{instance}/users",
- // "response": {
- // "$ref": "UsersListResponse"
- // },
- // "scopes": [
- // "https://www.googleapis.com/auth/cloud-platform",
- // "https://www.googleapis.com/auth/sqlservice.admin"
- // ]
- // }
- }
- // method id "sql.users.update":
- type UsersUpdateCall struct {
- s *Service
- project string
- instance string
- user *User
- urlParams_ gensupport.URLParams
- ctx_ context.Context
- }
- // Update: Updates an existing user in a Cloud SQL instance.
- func (r *UsersService) Update(project string, instance string, host string, name string, user *User) *UsersUpdateCall {
- c := &UsersUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
- c.project = project
- c.instance = instance
- c.urlParams_.Set("host", host)
- c.urlParams_.Set("name", name)
- c.user = user
- return c
- }
- // Fields allows partial responses to be retrieved. See
- // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
- // for more information.
- func (c *UsersUpdateCall) Fields(s ...googleapi.Field) *UsersUpdateCall {
- c.urlParams_.Set("fields", googleapi.CombineFields(s))
- return c
- }
- // Context sets the context to be used in this call's Do method. Any
- // pending HTTP request will be aborted if the provided context is
- // canceled.
- func (c *UsersUpdateCall) Context(ctx context.Context) *UsersUpdateCall {
- c.ctx_ = ctx
- return c
- }
- func (c *UsersUpdateCall) doRequest(alt string) (*http.Response, error) {
- var body io.Reader = nil
- body, err := googleapi.WithoutDataWrapper.JSONReader(c.user)
- if err != nil {
- return nil, err
- }
- ctype := "application/json"
- c.urlParams_.Set("alt", alt)
- urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/instances/{instance}/users")
- urls += "?" + c.urlParams_.Encode()
- req, _ := http.NewRequest("PUT", urls, body)
- googleapi.Expand(req.URL, map[string]string{
- "project": c.project,
- "instance": c.instance,
- })
- req.Header.Set("Content-Type", ctype)
- req.Header.Set("User-Agent", c.s.userAgent())
- if c.ctx_ != nil {
- return ctxhttp.Do(c.ctx_, c.s.client, req)
- }
- return c.s.client.Do(req)
- }
- // Do executes the "sql.users.update" call.
- // Exactly one of *Operation or error will be non-nil. Any non-2xx
- // status code is an error. Response headers are in either
- // *Operation.ServerResponse.Header or (if a response was returned at
- // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
- // to check whether the returned error was because
- // http.StatusNotModified was returned.
- func (c *UsersUpdateCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
- gensupport.SetOptions(c.urlParams_, opts...)
- res, err := c.doRequest("json")
- if res != nil && res.StatusCode == http.StatusNotModified {
- if res.Body != nil {
- res.Body.Close()
- }
- return nil, &googleapi.Error{
- Code: res.StatusCode,
- Header: res.Header,
- }
- }
- if err != nil {
- return nil, err
- }
- defer googleapi.CloseBody(res)
- if err := googleapi.CheckResponse(res); err != nil {
- return nil, err
- }
- ret := &Operation{
- ServerResponse: googleapi.ServerResponse{
- Header: res.Header,
- HTTPStatusCode: res.StatusCode,
- },
- }
- if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
- return nil, err
- }
- return ret, nil
- // {
- // "description": "Updates an existing user in a Cloud SQL instance.",
- // "httpMethod": "PUT",
- // "id": "sql.users.update",
- // "parameterOrder": [
- // "project",
- // "instance",
- // "host",
- // "name"
- // ],
- // "parameters": {
- // "host": {
- // "description": "Host of the user in the instance.",
- // "location": "query",
- // "required": true,
- // "type": "string"
- // },
- // "instance": {
- // "description": "Database instance ID. This does not include the project ID.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // },
- // "name": {
- // "description": "Name of the user in the instance.",
- // "location": "query",
- // "required": true,
- // "type": "string"
- // },
- // "project": {
- // "description": "Project ID of the project that contains the instance.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // }
- // },
- // "path": "projects/{project}/instances/{instance}/users",
- // "request": {
- // "$ref": "User"
- // },
- // "response": {
- // "$ref": "Operation"
- // },
- // "scopes": [
- // "https://www.googleapis.com/auth/cloud-platform",
- // "https://www.googleapis.com/auth/sqlservice.admin"
- // ]
- // }
- }
|