storage-gen.go 267 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685
  1. // Package storage provides access to the Cloud Storage JSON API.
  2. //
  3. // See https://developers.google.com/storage/docs/json_api/
  4. //
  5. // Usage example:
  6. //
  7. // import "google.golang.org/api/storage/v1"
  8. // ...
  9. // storageService, err := storage.New(oauthHttpClient)
  10. package storage // import "google.golang.org/api/storage/v1"
  11. import (
  12. "bytes"
  13. "encoding/json"
  14. "errors"
  15. "fmt"
  16. context "golang.org/x/net/context"
  17. ctxhttp "golang.org/x/net/context/ctxhttp"
  18. gensupport "google.golang.org/api/gensupport"
  19. googleapi "google.golang.org/api/googleapi"
  20. "io"
  21. "net/http"
  22. "net/url"
  23. "strconv"
  24. "strings"
  25. )
  26. // Always reference these packages, just in case the auto-generated code
  27. // below doesn't.
  28. var _ = bytes.NewBuffer
  29. var _ = strconv.Itoa
  30. var _ = fmt.Sprintf
  31. var _ = json.NewDecoder
  32. var _ = io.Copy
  33. var _ = url.Parse
  34. var _ = gensupport.MarshalJSON
  35. var _ = googleapi.Version
  36. var _ = errors.New
  37. var _ = strings.Replace
  38. var _ = context.Canceled
  39. var _ = ctxhttp.Do
  40. const apiId = "storage:v1"
  41. const apiName = "storage"
  42. const apiVersion = "v1"
  43. const basePath = "https://www.googleapis.com/storage/v1/"
  44. // OAuth2 scopes used by this API.
  45. const (
  46. // View and manage your data across Google Cloud Platform services
  47. CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform"
  48. // View your data across Google Cloud Platform services
  49. CloudPlatformReadOnlyScope = "https://www.googleapis.com/auth/cloud-platform.read-only"
  50. // Manage your data and permissions in Google Cloud Storage
  51. DevstorageFullControlScope = "https://www.googleapis.com/auth/devstorage.full_control"
  52. // View your data in Google Cloud Storage
  53. DevstorageReadOnlyScope = "https://www.googleapis.com/auth/devstorage.read_only"
  54. // Manage your data in Google Cloud Storage
  55. DevstorageReadWriteScope = "https://www.googleapis.com/auth/devstorage.read_write"
  56. )
  57. func New(client *http.Client) (*Service, error) {
  58. if client == nil {
  59. return nil, errors.New("client is nil")
  60. }
  61. s := &Service{client: client, BasePath: basePath}
  62. s.BucketAccessControls = NewBucketAccessControlsService(s)
  63. s.Buckets = NewBucketsService(s)
  64. s.Channels = NewChannelsService(s)
  65. s.DefaultObjectAccessControls = NewDefaultObjectAccessControlsService(s)
  66. s.ObjectAccessControls = NewObjectAccessControlsService(s)
  67. s.Objects = NewObjectsService(s)
  68. return s, nil
  69. }
  70. type Service struct {
  71. client *http.Client
  72. BasePath string // API endpoint base URL
  73. UserAgent string // optional additional User-Agent fragment
  74. BucketAccessControls *BucketAccessControlsService
  75. Buckets *BucketsService
  76. Channels *ChannelsService
  77. DefaultObjectAccessControls *DefaultObjectAccessControlsService
  78. ObjectAccessControls *ObjectAccessControlsService
  79. Objects *ObjectsService
  80. }
  81. func (s *Service) userAgent() string {
  82. if s.UserAgent == "" {
  83. return googleapi.UserAgent
  84. }
  85. return googleapi.UserAgent + " " + s.UserAgent
  86. }
  87. func NewBucketAccessControlsService(s *Service) *BucketAccessControlsService {
  88. rs := &BucketAccessControlsService{s: s}
  89. return rs
  90. }
  91. type BucketAccessControlsService struct {
  92. s *Service
  93. }
  94. func NewBucketsService(s *Service) *BucketsService {
  95. rs := &BucketsService{s: s}
  96. return rs
  97. }
  98. type BucketsService struct {
  99. s *Service
  100. }
  101. func NewChannelsService(s *Service) *ChannelsService {
  102. rs := &ChannelsService{s: s}
  103. return rs
  104. }
  105. type ChannelsService struct {
  106. s *Service
  107. }
  108. func NewDefaultObjectAccessControlsService(s *Service) *DefaultObjectAccessControlsService {
  109. rs := &DefaultObjectAccessControlsService{s: s}
  110. return rs
  111. }
  112. type DefaultObjectAccessControlsService struct {
  113. s *Service
  114. }
  115. func NewObjectAccessControlsService(s *Service) *ObjectAccessControlsService {
  116. rs := &ObjectAccessControlsService{s: s}
  117. return rs
  118. }
  119. type ObjectAccessControlsService struct {
  120. s *Service
  121. }
  122. func NewObjectsService(s *Service) *ObjectsService {
  123. rs := &ObjectsService{s: s}
  124. return rs
  125. }
  126. type ObjectsService struct {
  127. s *Service
  128. }
  129. // Bucket: A bucket.
  130. type Bucket struct {
  131. // Acl: Access controls on the bucket.
  132. Acl []*BucketAccessControl `json:"acl,omitempty"`
  133. // Cors: The bucket's Cross-Origin Resource Sharing (CORS)
  134. // configuration.
  135. Cors []*BucketCors `json:"cors,omitempty"`
  136. // DefaultObjectAcl: Default access controls to apply to new objects
  137. // when no ACL is provided.
  138. DefaultObjectAcl []*ObjectAccessControl `json:"defaultObjectAcl,omitempty"`
  139. // Etag: HTTP 1.1 Entity tag for the bucket.
  140. Etag string `json:"etag,omitempty"`
  141. // Id: The ID of the bucket.
  142. Id string `json:"id,omitempty"`
  143. // Kind: The kind of item this is. For buckets, this is always
  144. // storage#bucket.
  145. Kind string `json:"kind,omitempty"`
  146. // Lifecycle: The bucket's lifecycle configuration. See lifecycle
  147. // management for more information.
  148. Lifecycle *BucketLifecycle `json:"lifecycle,omitempty"`
  149. // Location: The location of the bucket. Object data for objects in the
  150. // bucket resides in physical storage within this region. Defaults to
  151. // US. See the developer's guide for the authoritative list.
  152. Location string `json:"location,omitempty"`
  153. // Logging: The bucket's logging configuration, which defines the
  154. // destination bucket and optional name prefix for the current bucket's
  155. // logs.
  156. Logging *BucketLogging `json:"logging,omitempty"`
  157. // Metageneration: The metadata generation of this bucket.
  158. Metageneration int64 `json:"metageneration,omitempty,string"`
  159. // Name: The name of the bucket.
  160. Name string `json:"name,omitempty"`
  161. // Owner: The owner of the bucket. This is always the project team's
  162. // owner group.
  163. Owner *BucketOwner `json:"owner,omitempty"`
  164. // ProjectNumber: The project number of the project the bucket belongs
  165. // to.
  166. ProjectNumber uint64 `json:"projectNumber,omitempty,string"`
  167. // SelfLink: The URI of this bucket.
  168. SelfLink string `json:"selfLink,omitempty"`
  169. // StorageClass: The bucket's storage class. This defines how objects in
  170. // the bucket are stored and determines the SLA and the cost of storage.
  171. // Values include STANDARD, NEARLINE and DURABLE_REDUCED_AVAILABILITY.
  172. // Defaults to STANDARD. For more information, see storage classes.
  173. StorageClass string `json:"storageClass,omitempty"`
  174. // TimeCreated: The creation time of the bucket in RFC 3339 format.
  175. TimeCreated string `json:"timeCreated,omitempty"`
  176. // Updated: The modification time of the bucket in RFC 3339 format.
  177. Updated string `json:"updated,omitempty"`
  178. // Versioning: The bucket's versioning configuration.
  179. Versioning *BucketVersioning `json:"versioning,omitempty"`
  180. // Website: The bucket's website configuration.
  181. Website *BucketWebsite `json:"website,omitempty"`
  182. // ServerResponse contains the HTTP response code and headers from the
  183. // server.
  184. googleapi.ServerResponse `json:"-"`
  185. // ForceSendFields is a list of field names (e.g. "Acl") to
  186. // unconditionally include in API requests. By default, fields with
  187. // empty values are omitted from API requests. However, any non-pointer,
  188. // non-interface field appearing in ForceSendFields will be sent to the
  189. // server regardless of whether the field is empty or not. This may be
  190. // used to include empty fields in Patch requests.
  191. ForceSendFields []string `json:"-"`
  192. }
  193. func (s *Bucket) MarshalJSON() ([]byte, error) {
  194. type noMethod Bucket
  195. raw := noMethod(*s)
  196. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  197. }
  198. type BucketCors struct {
  199. // MaxAgeSeconds: The value, in seconds, to return in the
  200. // Access-Control-Max-Age header used in preflight responses.
  201. MaxAgeSeconds int64 `json:"maxAgeSeconds,omitempty"`
  202. // Method: The list of HTTP methods on which to include CORS response
  203. // headers, (GET, OPTIONS, POST, etc) Note: "*" is permitted in the list
  204. // of methods, and means "any method".
  205. Method []string `json:"method,omitempty"`
  206. // Origin: The list of Origins eligible to receive CORS response
  207. // headers. Note: "*" is permitted in the list of origins, and means
  208. // "any Origin".
  209. Origin []string `json:"origin,omitempty"`
  210. // ResponseHeader: The list of HTTP headers other than the simple
  211. // response headers to give permission for the user-agent to share
  212. // across domains.
  213. ResponseHeader []string `json:"responseHeader,omitempty"`
  214. // ForceSendFields is a list of field names (e.g. "MaxAgeSeconds") to
  215. // unconditionally include in API requests. By default, fields with
  216. // empty values are omitted from API requests. However, any non-pointer,
  217. // non-interface field appearing in ForceSendFields will be sent to the
  218. // server regardless of whether the field is empty or not. This may be
  219. // used to include empty fields in Patch requests.
  220. ForceSendFields []string `json:"-"`
  221. }
  222. func (s *BucketCors) MarshalJSON() ([]byte, error) {
  223. type noMethod BucketCors
  224. raw := noMethod(*s)
  225. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  226. }
  227. // BucketLifecycle: The bucket's lifecycle configuration. See lifecycle
  228. // management for more information.
  229. type BucketLifecycle struct {
  230. // Rule: A lifecycle management rule, which is made of an action to take
  231. // and the condition(s) under which the action will be taken.
  232. Rule []*BucketLifecycleRule `json:"rule,omitempty"`
  233. // ForceSendFields is a list of field names (e.g. "Rule") to
  234. // unconditionally include in API requests. By default, fields with
  235. // empty values are omitted from API requests. However, any non-pointer,
  236. // non-interface field appearing in ForceSendFields will be sent to the
  237. // server regardless of whether the field is empty or not. This may be
  238. // used to include empty fields in Patch requests.
  239. ForceSendFields []string `json:"-"`
  240. }
  241. func (s *BucketLifecycle) MarshalJSON() ([]byte, error) {
  242. type noMethod BucketLifecycle
  243. raw := noMethod(*s)
  244. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  245. }
  246. type BucketLifecycleRule struct {
  247. // Action: The action to take.
  248. Action *BucketLifecycleRuleAction `json:"action,omitempty"`
  249. // Condition: The condition(s) under which the action will be taken.
  250. Condition *BucketLifecycleRuleCondition `json:"condition,omitempty"`
  251. // ForceSendFields is a list of field names (e.g. "Action") to
  252. // unconditionally include in API requests. By default, fields with
  253. // empty values are omitted from API requests. However, any non-pointer,
  254. // non-interface field appearing in ForceSendFields will be sent to the
  255. // server regardless of whether the field is empty or not. This may be
  256. // used to include empty fields in Patch requests.
  257. ForceSendFields []string `json:"-"`
  258. }
  259. func (s *BucketLifecycleRule) MarshalJSON() ([]byte, error) {
  260. type noMethod BucketLifecycleRule
  261. raw := noMethod(*s)
  262. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  263. }
  264. // BucketLifecycleRuleAction: The action to take.
  265. type BucketLifecycleRuleAction struct {
  266. // Type: Type of the action. Currently, only Delete is supported.
  267. Type string `json:"type,omitempty"`
  268. // ForceSendFields is a list of field names (e.g. "Type") to
  269. // unconditionally include in API requests. By default, fields with
  270. // empty values are omitted from API requests. However, any non-pointer,
  271. // non-interface field appearing in ForceSendFields will be sent to the
  272. // server regardless of whether the field is empty or not. This may be
  273. // used to include empty fields in Patch requests.
  274. ForceSendFields []string `json:"-"`
  275. }
  276. func (s *BucketLifecycleRuleAction) MarshalJSON() ([]byte, error) {
  277. type noMethod BucketLifecycleRuleAction
  278. raw := noMethod(*s)
  279. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  280. }
  281. // BucketLifecycleRuleCondition: The condition(s) under which the action
  282. // will be taken.
  283. type BucketLifecycleRuleCondition struct {
  284. // Age: Age of an object (in days). This condition is satisfied when an
  285. // object reaches the specified age.
  286. Age int64 `json:"age,omitempty"`
  287. // CreatedBefore: A date in RFC 3339 format with only the date part (for
  288. // instance, "2013-01-15"). This condition is satisfied when an object
  289. // is created before midnight of the specified date in UTC.
  290. CreatedBefore string `json:"createdBefore,omitempty"`
  291. // IsLive: Relevant only for versioned objects. If the value is true,
  292. // this condition matches live objects; if the value is false, it
  293. // matches archived objects.
  294. IsLive bool `json:"isLive,omitempty"`
  295. // NumNewerVersions: Relevant only for versioned objects. If the value
  296. // is N, this condition is satisfied when there are at least N versions
  297. // (including the live version) newer than this version of the object.
  298. NumNewerVersions int64 `json:"numNewerVersions,omitempty"`
  299. // ForceSendFields is a list of field names (e.g. "Age") to
  300. // unconditionally include in API requests. By default, fields with
  301. // empty values are omitted from API requests. However, any non-pointer,
  302. // non-interface field appearing in ForceSendFields will be sent to the
  303. // server regardless of whether the field is empty or not. This may be
  304. // used to include empty fields in Patch requests.
  305. ForceSendFields []string `json:"-"`
  306. }
  307. func (s *BucketLifecycleRuleCondition) MarshalJSON() ([]byte, error) {
  308. type noMethod BucketLifecycleRuleCondition
  309. raw := noMethod(*s)
  310. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  311. }
  312. // BucketLogging: The bucket's logging configuration, which defines the
  313. // destination bucket and optional name prefix for the current bucket's
  314. // logs.
  315. type BucketLogging struct {
  316. // LogBucket: The destination bucket where the current bucket's logs
  317. // should be placed.
  318. LogBucket string `json:"logBucket,omitempty"`
  319. // LogObjectPrefix: A prefix for log object names.
  320. LogObjectPrefix string `json:"logObjectPrefix,omitempty"`
  321. // ForceSendFields is a list of field names (e.g. "LogBucket") to
  322. // unconditionally include in API requests. By default, fields with
  323. // empty values are omitted from API requests. However, any non-pointer,
  324. // non-interface field appearing in ForceSendFields will be sent to the
  325. // server regardless of whether the field is empty or not. This may be
  326. // used to include empty fields in Patch requests.
  327. ForceSendFields []string `json:"-"`
  328. }
  329. func (s *BucketLogging) MarshalJSON() ([]byte, error) {
  330. type noMethod BucketLogging
  331. raw := noMethod(*s)
  332. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  333. }
  334. // BucketOwner: The owner of the bucket. This is always the project
  335. // team's owner group.
  336. type BucketOwner struct {
  337. // Entity: The entity, in the form project-owner-projectId.
  338. Entity string `json:"entity,omitempty"`
  339. // EntityId: The ID for the entity.
  340. EntityId string `json:"entityId,omitempty"`
  341. // ForceSendFields is a list of field names (e.g. "Entity") to
  342. // unconditionally include in API requests. By default, fields with
  343. // empty values are omitted from API requests. However, any non-pointer,
  344. // non-interface field appearing in ForceSendFields will be sent to the
  345. // server regardless of whether the field is empty or not. This may be
  346. // used to include empty fields in Patch requests.
  347. ForceSendFields []string `json:"-"`
  348. }
  349. func (s *BucketOwner) MarshalJSON() ([]byte, error) {
  350. type noMethod BucketOwner
  351. raw := noMethod(*s)
  352. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  353. }
  354. // BucketVersioning: The bucket's versioning configuration.
  355. type BucketVersioning struct {
  356. // Enabled: While set to true, versioning is fully enabled for this
  357. // bucket.
  358. Enabled bool `json:"enabled,omitempty"`
  359. // ForceSendFields is a list of field names (e.g. "Enabled") to
  360. // unconditionally include in API requests. By default, fields with
  361. // empty values are omitted from API requests. However, any non-pointer,
  362. // non-interface field appearing in ForceSendFields will be sent to the
  363. // server regardless of whether the field is empty or not. This may be
  364. // used to include empty fields in Patch requests.
  365. ForceSendFields []string `json:"-"`
  366. }
  367. func (s *BucketVersioning) MarshalJSON() ([]byte, error) {
  368. type noMethod BucketVersioning
  369. raw := noMethod(*s)
  370. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  371. }
  372. // BucketWebsite: The bucket's website configuration.
  373. type BucketWebsite struct {
  374. // MainPageSuffix: Behaves as the bucket's directory index where missing
  375. // objects are treated as potential directories.
  376. MainPageSuffix string `json:"mainPageSuffix,omitempty"`
  377. // NotFoundPage: The custom object to return when a requested resource
  378. // is not found.
  379. NotFoundPage string `json:"notFoundPage,omitempty"`
  380. // ForceSendFields is a list of field names (e.g. "MainPageSuffix") to
  381. // unconditionally include in API requests. By default, fields with
  382. // empty values are omitted from API requests. However, any non-pointer,
  383. // non-interface field appearing in ForceSendFields will be sent to the
  384. // server regardless of whether the field is empty or not. This may be
  385. // used to include empty fields in Patch requests.
  386. ForceSendFields []string `json:"-"`
  387. }
  388. func (s *BucketWebsite) MarshalJSON() ([]byte, error) {
  389. type noMethod BucketWebsite
  390. raw := noMethod(*s)
  391. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  392. }
  393. // BucketAccessControl: An access-control entry.
  394. type BucketAccessControl struct {
  395. // Bucket: The name of the bucket.
  396. Bucket string `json:"bucket,omitempty"`
  397. // Domain: The domain associated with the entity, if any.
  398. Domain string `json:"domain,omitempty"`
  399. // Email: The email address associated with the entity, if any.
  400. Email string `json:"email,omitempty"`
  401. // Entity: The entity holding the permission, in one of the following
  402. // forms:
  403. // - user-userId
  404. // - user-email
  405. // - group-groupId
  406. // - group-email
  407. // - domain-domain
  408. // - project-team-projectId
  409. // - allUsers
  410. // - allAuthenticatedUsers Examples:
  411. // - The user liz@example.com would be user-liz@example.com.
  412. // - The group example@googlegroups.com would be
  413. // group-example@googlegroups.com.
  414. // - To refer to all members of the Google Apps for Business domain
  415. // example.com, the entity would be domain-example.com.
  416. Entity string `json:"entity,omitempty"`
  417. // EntityId: The ID for the entity, if any.
  418. EntityId string `json:"entityId,omitempty"`
  419. // Etag: HTTP 1.1 Entity tag for the access-control entry.
  420. Etag string `json:"etag,omitempty"`
  421. // Id: The ID of the access-control entry.
  422. Id string `json:"id,omitempty"`
  423. // Kind: The kind of item this is. For bucket access control entries,
  424. // this is always storage#bucketAccessControl.
  425. Kind string `json:"kind,omitempty"`
  426. // ProjectTeam: The project team associated with the entity, if any.
  427. ProjectTeam *BucketAccessControlProjectTeam `json:"projectTeam,omitempty"`
  428. // Role: The access permission for the entity. Can be READER, WRITER, or
  429. // OWNER.
  430. Role string `json:"role,omitempty"`
  431. // SelfLink: The link to this access-control entry.
  432. SelfLink string `json:"selfLink,omitempty"`
  433. // ServerResponse contains the HTTP response code and headers from the
  434. // server.
  435. googleapi.ServerResponse `json:"-"`
  436. // ForceSendFields is a list of field names (e.g. "Bucket") to
  437. // unconditionally include in API requests. By default, fields with
  438. // empty values are omitted from API requests. However, any non-pointer,
  439. // non-interface field appearing in ForceSendFields will be sent to the
  440. // server regardless of whether the field is empty or not. This may be
  441. // used to include empty fields in Patch requests.
  442. ForceSendFields []string `json:"-"`
  443. }
  444. func (s *BucketAccessControl) MarshalJSON() ([]byte, error) {
  445. type noMethod BucketAccessControl
  446. raw := noMethod(*s)
  447. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  448. }
  449. // BucketAccessControlProjectTeam: The project team associated with the
  450. // entity, if any.
  451. type BucketAccessControlProjectTeam struct {
  452. // ProjectNumber: The project number.
  453. ProjectNumber string `json:"projectNumber,omitempty"`
  454. // Team: The team. Can be owners, editors, or viewers.
  455. Team string `json:"team,omitempty"`
  456. // ForceSendFields is a list of field names (e.g. "ProjectNumber") to
  457. // unconditionally include in API requests. By default, fields with
  458. // empty values are omitted from API requests. However, any non-pointer,
  459. // non-interface field appearing in ForceSendFields will be sent to the
  460. // server regardless of whether the field is empty or not. This may be
  461. // used to include empty fields in Patch requests.
  462. ForceSendFields []string `json:"-"`
  463. }
  464. func (s *BucketAccessControlProjectTeam) MarshalJSON() ([]byte, error) {
  465. type noMethod BucketAccessControlProjectTeam
  466. raw := noMethod(*s)
  467. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  468. }
  469. // BucketAccessControls: An access-control list.
  470. type BucketAccessControls struct {
  471. // Items: The list of items.
  472. Items []*BucketAccessControl `json:"items,omitempty"`
  473. // Kind: The kind of item this is. For lists of bucket access control
  474. // entries, this is always storage#bucketAccessControls.
  475. Kind string `json:"kind,omitempty"`
  476. // ServerResponse contains the HTTP response code and headers from the
  477. // server.
  478. googleapi.ServerResponse `json:"-"`
  479. // ForceSendFields is a list of field names (e.g. "Items") to
  480. // unconditionally include in API requests. By default, fields with
  481. // empty values are omitted from API requests. However, any non-pointer,
  482. // non-interface field appearing in ForceSendFields will be sent to the
  483. // server regardless of whether the field is empty or not. This may be
  484. // used to include empty fields in Patch requests.
  485. ForceSendFields []string `json:"-"`
  486. }
  487. func (s *BucketAccessControls) MarshalJSON() ([]byte, error) {
  488. type noMethod BucketAccessControls
  489. raw := noMethod(*s)
  490. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  491. }
  492. // Buckets: A list of buckets.
  493. type Buckets struct {
  494. // Items: The list of items.
  495. Items []*Bucket `json:"items,omitempty"`
  496. // Kind: The kind of item this is. For lists of buckets, this is always
  497. // storage#buckets.
  498. Kind string `json:"kind,omitempty"`
  499. // NextPageToken: The continuation token, used to page through large
  500. // result sets. Provide this value in a subsequent request to return the
  501. // next page of results.
  502. NextPageToken string `json:"nextPageToken,omitempty"`
  503. // ServerResponse contains the HTTP response code and headers from the
  504. // server.
  505. googleapi.ServerResponse `json:"-"`
  506. // ForceSendFields is a list of field names (e.g. "Items") to
  507. // unconditionally include in API requests. By default, fields with
  508. // empty values are omitted from API requests. However, any non-pointer,
  509. // non-interface field appearing in ForceSendFields will be sent to the
  510. // server regardless of whether the field is empty or not. This may be
  511. // used to include empty fields in Patch requests.
  512. ForceSendFields []string `json:"-"`
  513. }
  514. func (s *Buckets) MarshalJSON() ([]byte, error) {
  515. type noMethod Buckets
  516. raw := noMethod(*s)
  517. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  518. }
  519. // Channel: An notification channel used to watch for resource changes.
  520. type Channel struct {
  521. // Address: The address where notifications are delivered for this
  522. // channel.
  523. Address string `json:"address,omitempty"`
  524. // Expiration: Date and time of notification channel expiration,
  525. // expressed as a Unix timestamp, in milliseconds. Optional.
  526. Expiration int64 `json:"expiration,omitempty,string"`
  527. // Id: A UUID or similar unique string that identifies this channel.
  528. Id string `json:"id,omitempty"`
  529. // Kind: Identifies this as a notification channel used to watch for
  530. // changes to a resource. Value: the fixed string "api#channel".
  531. Kind string `json:"kind,omitempty"`
  532. // Params: Additional parameters controlling delivery channel behavior.
  533. // Optional.
  534. Params map[string]string `json:"params,omitempty"`
  535. // Payload: A Boolean value to indicate whether payload is wanted.
  536. // Optional.
  537. Payload bool `json:"payload,omitempty"`
  538. // ResourceId: An opaque ID that identifies the resource being watched
  539. // on this channel. Stable across different API versions.
  540. ResourceId string `json:"resourceId,omitempty"`
  541. // ResourceUri: A version-specific identifier for the watched resource.
  542. ResourceUri string `json:"resourceUri,omitempty"`
  543. // Token: An arbitrary string delivered to the target address with each
  544. // notification delivered over this channel. Optional.
  545. Token string `json:"token,omitempty"`
  546. // Type: The type of delivery mechanism used for this channel.
  547. Type string `json:"type,omitempty"`
  548. // ServerResponse contains the HTTP response code and headers from the
  549. // server.
  550. googleapi.ServerResponse `json:"-"`
  551. // ForceSendFields is a list of field names (e.g. "Address") to
  552. // unconditionally include in API requests. By default, fields with
  553. // empty values are omitted from API requests. However, any non-pointer,
  554. // non-interface field appearing in ForceSendFields will be sent to the
  555. // server regardless of whether the field is empty or not. This may be
  556. // used to include empty fields in Patch requests.
  557. ForceSendFields []string `json:"-"`
  558. }
  559. func (s *Channel) MarshalJSON() ([]byte, error) {
  560. type noMethod Channel
  561. raw := noMethod(*s)
  562. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  563. }
  564. // ComposeRequest: A Compose request.
  565. type ComposeRequest struct {
  566. // Destination: Properties of the resulting object.
  567. Destination *Object `json:"destination,omitempty"`
  568. // Kind: The kind of item this is.
  569. Kind string `json:"kind,omitempty"`
  570. // SourceObjects: The list of source objects that will be concatenated
  571. // into a single object.
  572. SourceObjects []*ComposeRequestSourceObjects `json:"sourceObjects,omitempty"`
  573. // ForceSendFields is a list of field names (e.g. "Destination") to
  574. // unconditionally include in API requests. By default, fields with
  575. // empty values are omitted from API requests. However, any non-pointer,
  576. // non-interface field appearing in ForceSendFields will be sent to the
  577. // server regardless of whether the field is empty or not. This may be
  578. // used to include empty fields in Patch requests.
  579. ForceSendFields []string `json:"-"`
  580. }
  581. func (s *ComposeRequest) MarshalJSON() ([]byte, error) {
  582. type noMethod ComposeRequest
  583. raw := noMethod(*s)
  584. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  585. }
  586. type ComposeRequestSourceObjects struct {
  587. // Generation: The generation of this object to use as the source.
  588. Generation int64 `json:"generation,omitempty,string"`
  589. // Name: The source object's name. The source object's bucket is
  590. // implicitly the destination bucket.
  591. Name string `json:"name,omitempty"`
  592. // ObjectPreconditions: Conditions that must be met for this operation
  593. // to execute.
  594. ObjectPreconditions *ComposeRequestSourceObjectsObjectPreconditions `json:"objectPreconditions,omitempty"`
  595. // ForceSendFields is a list of field names (e.g. "Generation") to
  596. // unconditionally include in API requests. By default, fields with
  597. // empty values are omitted from API requests. However, any non-pointer,
  598. // non-interface field appearing in ForceSendFields will be sent to the
  599. // server regardless of whether the field is empty or not. This may be
  600. // used to include empty fields in Patch requests.
  601. ForceSendFields []string `json:"-"`
  602. }
  603. func (s *ComposeRequestSourceObjects) MarshalJSON() ([]byte, error) {
  604. type noMethod ComposeRequestSourceObjects
  605. raw := noMethod(*s)
  606. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  607. }
  608. // ComposeRequestSourceObjectsObjectPreconditions: Conditions that must
  609. // be met for this operation to execute.
  610. type ComposeRequestSourceObjectsObjectPreconditions struct {
  611. // IfGenerationMatch: Only perform the composition if the generation of
  612. // the source object that would be used matches this value. If this
  613. // value and a generation are both specified, they must be the same
  614. // value or the call will fail.
  615. IfGenerationMatch int64 `json:"ifGenerationMatch,omitempty,string"`
  616. // ForceSendFields is a list of field names (e.g. "IfGenerationMatch")
  617. // to unconditionally include in API requests. By default, fields with
  618. // empty values are omitted from API requests. However, any non-pointer,
  619. // non-interface field appearing in ForceSendFields will be sent to the
  620. // server regardless of whether the field is empty or not. This may be
  621. // used to include empty fields in Patch requests.
  622. ForceSendFields []string `json:"-"`
  623. }
  624. func (s *ComposeRequestSourceObjectsObjectPreconditions) MarshalJSON() ([]byte, error) {
  625. type noMethod ComposeRequestSourceObjectsObjectPreconditions
  626. raw := noMethod(*s)
  627. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  628. }
  629. // Object: An object.
  630. type Object struct {
  631. // Acl: Access controls on the object.
  632. Acl []*ObjectAccessControl `json:"acl,omitempty"`
  633. // Bucket: The name of the bucket containing this object.
  634. Bucket string `json:"bucket,omitempty"`
  635. // CacheControl: Cache-Control directive for the object data.
  636. CacheControl string `json:"cacheControl,omitempty"`
  637. // ComponentCount: Number of underlying components that make up this
  638. // object. Components are accumulated by compose operations.
  639. ComponentCount int64 `json:"componentCount,omitempty"`
  640. // ContentDisposition: Content-Disposition of the object data.
  641. ContentDisposition string `json:"contentDisposition,omitempty"`
  642. // ContentEncoding: Content-Encoding of the object data.
  643. ContentEncoding string `json:"contentEncoding,omitempty"`
  644. // ContentLanguage: Content-Language of the object data.
  645. ContentLanguage string `json:"contentLanguage,omitempty"`
  646. // ContentType: Content-Type of the object data.
  647. ContentType string `json:"contentType,omitempty"`
  648. // Crc32c: CRC32c checksum, as described in RFC 4960, Appendix B;
  649. // encoded using base64 in big-endian byte order. For more information
  650. // about using the CRC32c checksum, see Hashes and ETags: Best
  651. // Practices.
  652. Crc32c string `json:"crc32c,omitempty"`
  653. // CustomerEncryption: Metadata of customer-supplied encryption key, if
  654. // the object is encrypted by such a key.
  655. CustomerEncryption *ObjectCustomerEncryption `json:"customerEncryption,omitempty"`
  656. // Etag: HTTP 1.1 Entity tag for the object.
  657. Etag string `json:"etag,omitempty"`
  658. // Generation: The content generation of this object. Used for object
  659. // versioning.
  660. Generation int64 `json:"generation,omitempty,string"`
  661. // Id: The ID of the object.
  662. Id string `json:"id,omitempty"`
  663. // Kind: The kind of item this is. For objects, this is always
  664. // storage#object.
  665. Kind string `json:"kind,omitempty"`
  666. // Md5Hash: MD5 hash of the data; encoded using base64. For more
  667. // information about using the MD5 hash, see Hashes and ETags: Best
  668. // Practices.
  669. Md5Hash string `json:"md5Hash,omitempty"`
  670. // MediaLink: Media download link.
  671. MediaLink string `json:"mediaLink,omitempty"`
  672. // Metadata: User-provided metadata, in key/value pairs.
  673. Metadata map[string]string `json:"metadata,omitempty"`
  674. // Metageneration: The version of the metadata for this object at this
  675. // generation. Used for preconditions and for detecting changes in
  676. // metadata. A metageneration number is only meaningful in the context
  677. // of a particular generation of a particular object.
  678. Metageneration int64 `json:"metageneration,omitempty,string"`
  679. // Name: The name of this object. Required if not specified by URL
  680. // parameter.
  681. Name string `json:"name,omitempty"`
  682. // Owner: The owner of the object. This will always be the uploader of
  683. // the object.
  684. Owner *ObjectOwner `json:"owner,omitempty"`
  685. // SelfLink: The link to this object.
  686. SelfLink string `json:"selfLink,omitempty"`
  687. // Size: Content-Length of the data in bytes.
  688. Size uint64 `json:"size,omitempty,string"`
  689. // StorageClass: Storage class of the object.
  690. StorageClass string `json:"storageClass,omitempty"`
  691. // TimeCreated: The creation time of the object in RFC 3339 format.
  692. TimeCreated string `json:"timeCreated,omitempty"`
  693. // TimeDeleted: The deletion time of the object in RFC 3339 format. Will
  694. // be returned if and only if this version of the object has been
  695. // deleted.
  696. TimeDeleted string `json:"timeDeleted,omitempty"`
  697. // Updated: The modification time of the object metadata in RFC 3339
  698. // format.
  699. Updated string `json:"updated,omitempty"`
  700. // ServerResponse contains the HTTP response code and headers from the
  701. // server.
  702. googleapi.ServerResponse `json:"-"`
  703. // ForceSendFields is a list of field names (e.g. "Acl") to
  704. // unconditionally include in API requests. By default, fields with
  705. // empty values are omitted from API requests. However, any non-pointer,
  706. // non-interface field appearing in ForceSendFields will be sent to the
  707. // server regardless of whether the field is empty or not. This may be
  708. // used to include empty fields in Patch requests.
  709. ForceSendFields []string `json:"-"`
  710. }
  711. func (s *Object) MarshalJSON() ([]byte, error) {
  712. type noMethod Object
  713. raw := noMethod(*s)
  714. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  715. }
  716. // ObjectCustomerEncryption: Metadata of customer-supplied encryption
  717. // key, if the object is encrypted by such a key.
  718. type ObjectCustomerEncryption struct {
  719. // EncryptionAlgorithm: The encryption algorithm.
  720. EncryptionAlgorithm string `json:"encryptionAlgorithm,omitempty"`
  721. // KeySha256: SHA256 hash value of the encryption key.
  722. KeySha256 string `json:"keySha256,omitempty"`
  723. // ForceSendFields is a list of field names (e.g. "EncryptionAlgorithm")
  724. // to unconditionally include in API requests. By default, fields with
  725. // empty values are omitted from API requests. However, any non-pointer,
  726. // non-interface field appearing in ForceSendFields will be sent to the
  727. // server regardless of whether the field is empty or not. This may be
  728. // used to include empty fields in Patch requests.
  729. ForceSendFields []string `json:"-"`
  730. }
  731. func (s *ObjectCustomerEncryption) MarshalJSON() ([]byte, error) {
  732. type noMethod ObjectCustomerEncryption
  733. raw := noMethod(*s)
  734. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  735. }
  736. // ObjectOwner: The owner of the object. This will always be the
  737. // uploader of the object.
  738. type ObjectOwner struct {
  739. // Entity: The entity, in the form user-userId.
  740. Entity string `json:"entity,omitempty"`
  741. // EntityId: The ID for the entity.
  742. EntityId string `json:"entityId,omitempty"`
  743. // ForceSendFields is a list of field names (e.g. "Entity") to
  744. // unconditionally include in API requests. By default, fields with
  745. // empty values are omitted from API requests. However, any non-pointer,
  746. // non-interface field appearing in ForceSendFields will be sent to the
  747. // server regardless of whether the field is empty or not. This may be
  748. // used to include empty fields in Patch requests.
  749. ForceSendFields []string `json:"-"`
  750. }
  751. func (s *ObjectOwner) MarshalJSON() ([]byte, error) {
  752. type noMethod ObjectOwner
  753. raw := noMethod(*s)
  754. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  755. }
  756. // ObjectAccessControl: An access-control entry.
  757. type ObjectAccessControl struct {
  758. // Bucket: The name of the bucket.
  759. Bucket string `json:"bucket,omitempty"`
  760. // Domain: The domain associated with the entity, if any.
  761. Domain string `json:"domain,omitempty"`
  762. // Email: The email address associated with the entity, if any.
  763. Email string `json:"email,omitempty"`
  764. // Entity: The entity holding the permission, in one of the following
  765. // forms:
  766. // - user-userId
  767. // - user-email
  768. // - group-groupId
  769. // - group-email
  770. // - domain-domain
  771. // - project-team-projectId
  772. // - allUsers
  773. // - allAuthenticatedUsers Examples:
  774. // - The user liz@example.com would be user-liz@example.com.
  775. // - The group example@googlegroups.com would be
  776. // group-example@googlegroups.com.
  777. // - To refer to all members of the Google Apps for Business domain
  778. // example.com, the entity would be domain-example.com.
  779. Entity string `json:"entity,omitempty"`
  780. // EntityId: The ID for the entity, if any.
  781. EntityId string `json:"entityId,omitempty"`
  782. // Etag: HTTP 1.1 Entity tag for the access-control entry.
  783. Etag string `json:"etag,omitempty"`
  784. // Generation: The content generation of the object.
  785. Generation int64 `json:"generation,omitempty,string"`
  786. // Id: The ID of the access-control entry.
  787. Id string `json:"id,omitempty"`
  788. // Kind: The kind of item this is. For object access control entries,
  789. // this is always storage#objectAccessControl.
  790. Kind string `json:"kind,omitempty"`
  791. // Object: The name of the object.
  792. Object string `json:"object,omitempty"`
  793. // ProjectTeam: The project team associated with the entity, if any.
  794. ProjectTeam *ObjectAccessControlProjectTeam `json:"projectTeam,omitempty"`
  795. // Role: The access permission for the entity. Can be READER or OWNER.
  796. Role string `json:"role,omitempty"`
  797. // SelfLink: The link to this access-control entry.
  798. SelfLink string `json:"selfLink,omitempty"`
  799. // ServerResponse contains the HTTP response code and headers from the
  800. // server.
  801. googleapi.ServerResponse `json:"-"`
  802. // ForceSendFields is a list of field names (e.g. "Bucket") to
  803. // unconditionally include in API requests. By default, fields with
  804. // empty values are omitted from API requests. However, any non-pointer,
  805. // non-interface field appearing in ForceSendFields will be sent to the
  806. // server regardless of whether the field is empty or not. This may be
  807. // used to include empty fields in Patch requests.
  808. ForceSendFields []string `json:"-"`
  809. }
  810. func (s *ObjectAccessControl) MarshalJSON() ([]byte, error) {
  811. type noMethod ObjectAccessControl
  812. raw := noMethod(*s)
  813. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  814. }
  815. // ObjectAccessControlProjectTeam: The project team associated with the
  816. // entity, if any.
  817. type ObjectAccessControlProjectTeam struct {
  818. // ProjectNumber: The project number.
  819. ProjectNumber string `json:"projectNumber,omitempty"`
  820. // Team: The team. Can be owners, editors, or viewers.
  821. Team string `json:"team,omitempty"`
  822. // ForceSendFields is a list of field names (e.g. "ProjectNumber") to
  823. // unconditionally include in API requests. By default, fields with
  824. // empty values are omitted from API requests. However, any non-pointer,
  825. // non-interface field appearing in ForceSendFields will be sent to the
  826. // server regardless of whether the field is empty or not. This may be
  827. // used to include empty fields in Patch requests.
  828. ForceSendFields []string `json:"-"`
  829. }
  830. func (s *ObjectAccessControlProjectTeam) MarshalJSON() ([]byte, error) {
  831. type noMethod ObjectAccessControlProjectTeam
  832. raw := noMethod(*s)
  833. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  834. }
  835. // ObjectAccessControls: An access-control list.
  836. type ObjectAccessControls struct {
  837. // Items: The list of items.
  838. Items []interface{} `json:"items,omitempty"`
  839. // Kind: The kind of item this is. For lists of object access control
  840. // entries, this is always storage#objectAccessControls.
  841. Kind string `json:"kind,omitempty"`
  842. // ServerResponse contains the HTTP response code and headers from the
  843. // server.
  844. googleapi.ServerResponse `json:"-"`
  845. // ForceSendFields is a list of field names (e.g. "Items") to
  846. // unconditionally include in API requests. By default, fields with
  847. // empty values are omitted from API requests. However, any non-pointer,
  848. // non-interface field appearing in ForceSendFields will be sent to the
  849. // server regardless of whether the field is empty or not. This may be
  850. // used to include empty fields in Patch requests.
  851. ForceSendFields []string `json:"-"`
  852. }
  853. func (s *ObjectAccessControls) MarshalJSON() ([]byte, error) {
  854. type noMethod ObjectAccessControls
  855. raw := noMethod(*s)
  856. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  857. }
  858. // Objects: A list of objects.
  859. type Objects struct {
  860. // Items: The list of items.
  861. Items []*Object `json:"items,omitempty"`
  862. // Kind: The kind of item this is. For lists of objects, this is always
  863. // storage#objects.
  864. Kind string `json:"kind,omitempty"`
  865. // NextPageToken: The continuation token, used to page through large
  866. // result sets. Provide this value in a subsequent request to return the
  867. // next page of results.
  868. NextPageToken string `json:"nextPageToken,omitempty"`
  869. // Prefixes: The list of prefixes of objects matching-but-not-listed up
  870. // to and including the requested delimiter.
  871. Prefixes []string `json:"prefixes,omitempty"`
  872. // ServerResponse contains the HTTP response code and headers from the
  873. // server.
  874. googleapi.ServerResponse `json:"-"`
  875. // ForceSendFields is a list of field names (e.g. "Items") to
  876. // unconditionally include in API requests. By default, fields with
  877. // empty values are omitted from API requests. However, any non-pointer,
  878. // non-interface field appearing in ForceSendFields will be sent to the
  879. // server regardless of whether the field is empty or not. This may be
  880. // used to include empty fields in Patch requests.
  881. ForceSendFields []string `json:"-"`
  882. }
  883. func (s *Objects) MarshalJSON() ([]byte, error) {
  884. type noMethod Objects
  885. raw := noMethod(*s)
  886. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  887. }
  888. // RewriteResponse: A rewrite response.
  889. type RewriteResponse struct {
  890. // Done: true if the copy is finished; otherwise, false if the copy is
  891. // in progress. This property is always present in the response.
  892. Done bool `json:"done,omitempty"`
  893. // Kind: The kind of item this is.
  894. Kind string `json:"kind,omitempty"`
  895. // ObjectSize: The total size of the object being copied in bytes. This
  896. // property is always present in the response.
  897. ObjectSize uint64 `json:"objectSize,omitempty,string"`
  898. // Resource: A resource containing the metadata for the copied-to
  899. // object. This property is present in the response only when copying
  900. // completes.
  901. Resource *Object `json:"resource,omitempty"`
  902. // RewriteToken: A token to use in subsequent requests to continue
  903. // copying data. This token is present in the response only when there
  904. // is more data to copy.
  905. RewriteToken string `json:"rewriteToken,omitempty"`
  906. // TotalBytesRewritten: The total bytes written so far, which can be
  907. // used to provide a waiting user with a progress indicator. This
  908. // property is always present in the response.
  909. TotalBytesRewritten uint64 `json:"totalBytesRewritten,omitempty,string"`
  910. // ServerResponse contains the HTTP response code and headers from the
  911. // server.
  912. googleapi.ServerResponse `json:"-"`
  913. // ForceSendFields is a list of field names (e.g. "Done") to
  914. // unconditionally include in API requests. By default, fields with
  915. // empty values are omitted from API requests. However, any non-pointer,
  916. // non-interface field appearing in ForceSendFields will be sent to the
  917. // server regardless of whether the field is empty or not. This may be
  918. // used to include empty fields in Patch requests.
  919. ForceSendFields []string `json:"-"`
  920. }
  921. func (s *RewriteResponse) MarshalJSON() ([]byte, error) {
  922. type noMethod RewriteResponse
  923. raw := noMethod(*s)
  924. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  925. }
  926. // method id "storage.bucketAccessControls.delete":
  927. type BucketAccessControlsDeleteCall struct {
  928. s *Service
  929. bucket string
  930. entity string
  931. urlParams_ gensupport.URLParams
  932. ctx_ context.Context
  933. }
  934. // Delete: Permanently deletes the ACL entry for the specified entity on
  935. // the specified bucket.
  936. func (r *BucketAccessControlsService) Delete(bucket string, entity string) *BucketAccessControlsDeleteCall {
  937. c := &BucketAccessControlsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  938. c.bucket = bucket
  939. c.entity = entity
  940. return c
  941. }
  942. // Fields allows partial responses to be retrieved. See
  943. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  944. // for more information.
  945. func (c *BucketAccessControlsDeleteCall) Fields(s ...googleapi.Field) *BucketAccessControlsDeleteCall {
  946. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  947. return c
  948. }
  949. // Context sets the context to be used in this call's Do method. Any
  950. // pending HTTP request will be aborted if the provided context is
  951. // canceled.
  952. func (c *BucketAccessControlsDeleteCall) Context(ctx context.Context) *BucketAccessControlsDeleteCall {
  953. c.ctx_ = ctx
  954. return c
  955. }
  956. func (c *BucketAccessControlsDeleteCall) doRequest(alt string) (*http.Response, error) {
  957. var body io.Reader = nil
  958. c.urlParams_.Set("alt", alt)
  959. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/acl/{entity}")
  960. urls += "?" + c.urlParams_.Encode()
  961. req, _ := http.NewRequest("DELETE", urls, body)
  962. googleapi.Expand(req.URL, map[string]string{
  963. "bucket": c.bucket,
  964. "entity": c.entity,
  965. })
  966. req.Header.Set("User-Agent", c.s.userAgent())
  967. if c.ctx_ != nil {
  968. return ctxhttp.Do(c.ctx_, c.s.client, req)
  969. }
  970. return c.s.client.Do(req)
  971. }
  972. // Do executes the "storage.bucketAccessControls.delete" call.
  973. func (c *BucketAccessControlsDeleteCall) Do(opts ...googleapi.CallOption) error {
  974. gensupport.SetOptions(c.urlParams_, opts...)
  975. res, err := c.doRequest("json")
  976. if err != nil {
  977. return err
  978. }
  979. defer googleapi.CloseBody(res)
  980. if err := googleapi.CheckResponse(res); err != nil {
  981. return err
  982. }
  983. return nil
  984. // {
  985. // "description": "Permanently deletes the ACL entry for the specified entity on the specified bucket.",
  986. // "httpMethod": "DELETE",
  987. // "id": "storage.bucketAccessControls.delete",
  988. // "parameterOrder": [
  989. // "bucket",
  990. // "entity"
  991. // ],
  992. // "parameters": {
  993. // "bucket": {
  994. // "description": "Name of a bucket.",
  995. // "location": "path",
  996. // "required": true,
  997. // "type": "string"
  998. // },
  999. // "entity": {
  1000. // "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.",
  1001. // "location": "path",
  1002. // "required": true,
  1003. // "type": "string"
  1004. // }
  1005. // },
  1006. // "path": "b/{bucket}/acl/{entity}",
  1007. // "scopes": [
  1008. // "https://www.googleapis.com/auth/cloud-platform",
  1009. // "https://www.googleapis.com/auth/devstorage.full_control"
  1010. // ]
  1011. // }
  1012. }
  1013. // method id "storage.bucketAccessControls.get":
  1014. type BucketAccessControlsGetCall struct {
  1015. s *Service
  1016. bucket string
  1017. entity string
  1018. urlParams_ gensupport.URLParams
  1019. ifNoneMatch_ string
  1020. ctx_ context.Context
  1021. }
  1022. // Get: Returns the ACL entry for the specified entity on the specified
  1023. // bucket.
  1024. func (r *BucketAccessControlsService) Get(bucket string, entity string) *BucketAccessControlsGetCall {
  1025. c := &BucketAccessControlsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1026. c.bucket = bucket
  1027. c.entity = entity
  1028. return c
  1029. }
  1030. // Fields allows partial responses to be retrieved. See
  1031. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1032. // for more information.
  1033. func (c *BucketAccessControlsGetCall) Fields(s ...googleapi.Field) *BucketAccessControlsGetCall {
  1034. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1035. return c
  1036. }
  1037. // IfNoneMatch sets the optional parameter which makes the operation
  1038. // fail if the object's ETag matches the given value. This is useful for
  1039. // getting updates only after the object has changed since the last
  1040. // request. Use googleapi.IsNotModified to check whether the response
  1041. // error from Do is the result of In-None-Match.
  1042. func (c *BucketAccessControlsGetCall) IfNoneMatch(entityTag string) *BucketAccessControlsGetCall {
  1043. c.ifNoneMatch_ = entityTag
  1044. return c
  1045. }
  1046. // Context sets the context to be used in this call's Do method. Any
  1047. // pending HTTP request will be aborted if the provided context is
  1048. // canceled.
  1049. func (c *BucketAccessControlsGetCall) Context(ctx context.Context) *BucketAccessControlsGetCall {
  1050. c.ctx_ = ctx
  1051. return c
  1052. }
  1053. func (c *BucketAccessControlsGetCall) doRequest(alt string) (*http.Response, error) {
  1054. var body io.Reader = nil
  1055. c.urlParams_.Set("alt", alt)
  1056. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/acl/{entity}")
  1057. urls += "?" + c.urlParams_.Encode()
  1058. req, _ := http.NewRequest("GET", urls, body)
  1059. googleapi.Expand(req.URL, map[string]string{
  1060. "bucket": c.bucket,
  1061. "entity": c.entity,
  1062. })
  1063. req.Header.Set("User-Agent", c.s.userAgent())
  1064. if c.ifNoneMatch_ != "" {
  1065. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  1066. }
  1067. if c.ctx_ != nil {
  1068. return ctxhttp.Do(c.ctx_, c.s.client, req)
  1069. }
  1070. return c.s.client.Do(req)
  1071. }
  1072. // Do executes the "storage.bucketAccessControls.get" call.
  1073. // Exactly one of *BucketAccessControl or error will be non-nil. Any
  1074. // non-2xx status code is an error. Response headers are in either
  1075. // *BucketAccessControl.ServerResponse.Header or (if a response was
  1076. // returned at all) in error.(*googleapi.Error).Header. Use
  1077. // googleapi.IsNotModified to check whether the returned error was
  1078. // because http.StatusNotModified was returned.
  1079. func (c *BucketAccessControlsGetCall) Do(opts ...googleapi.CallOption) (*BucketAccessControl, error) {
  1080. gensupport.SetOptions(c.urlParams_, opts...)
  1081. res, err := c.doRequest("json")
  1082. if res != nil && res.StatusCode == http.StatusNotModified {
  1083. if res.Body != nil {
  1084. res.Body.Close()
  1085. }
  1086. return nil, &googleapi.Error{
  1087. Code: res.StatusCode,
  1088. Header: res.Header,
  1089. }
  1090. }
  1091. if err != nil {
  1092. return nil, err
  1093. }
  1094. defer googleapi.CloseBody(res)
  1095. if err := googleapi.CheckResponse(res); err != nil {
  1096. return nil, err
  1097. }
  1098. ret := &BucketAccessControl{
  1099. ServerResponse: googleapi.ServerResponse{
  1100. Header: res.Header,
  1101. HTTPStatusCode: res.StatusCode,
  1102. },
  1103. }
  1104. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  1105. return nil, err
  1106. }
  1107. return ret, nil
  1108. // {
  1109. // "description": "Returns the ACL entry for the specified entity on the specified bucket.",
  1110. // "httpMethod": "GET",
  1111. // "id": "storage.bucketAccessControls.get",
  1112. // "parameterOrder": [
  1113. // "bucket",
  1114. // "entity"
  1115. // ],
  1116. // "parameters": {
  1117. // "bucket": {
  1118. // "description": "Name of a bucket.",
  1119. // "location": "path",
  1120. // "required": true,
  1121. // "type": "string"
  1122. // },
  1123. // "entity": {
  1124. // "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.",
  1125. // "location": "path",
  1126. // "required": true,
  1127. // "type": "string"
  1128. // }
  1129. // },
  1130. // "path": "b/{bucket}/acl/{entity}",
  1131. // "response": {
  1132. // "$ref": "BucketAccessControl"
  1133. // },
  1134. // "scopes": [
  1135. // "https://www.googleapis.com/auth/cloud-platform",
  1136. // "https://www.googleapis.com/auth/devstorage.full_control"
  1137. // ]
  1138. // }
  1139. }
  1140. // method id "storage.bucketAccessControls.insert":
  1141. type BucketAccessControlsInsertCall struct {
  1142. s *Service
  1143. bucket string
  1144. bucketaccesscontrol *BucketAccessControl
  1145. urlParams_ gensupport.URLParams
  1146. ctx_ context.Context
  1147. }
  1148. // Insert: Creates a new ACL entry on the specified bucket.
  1149. func (r *BucketAccessControlsService) Insert(bucket string, bucketaccesscontrol *BucketAccessControl) *BucketAccessControlsInsertCall {
  1150. c := &BucketAccessControlsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1151. c.bucket = bucket
  1152. c.bucketaccesscontrol = bucketaccesscontrol
  1153. return c
  1154. }
  1155. // Fields allows partial responses to be retrieved. See
  1156. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1157. // for more information.
  1158. func (c *BucketAccessControlsInsertCall) Fields(s ...googleapi.Field) *BucketAccessControlsInsertCall {
  1159. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1160. return c
  1161. }
  1162. // Context sets the context to be used in this call's Do method. Any
  1163. // pending HTTP request will be aborted if the provided context is
  1164. // canceled.
  1165. func (c *BucketAccessControlsInsertCall) Context(ctx context.Context) *BucketAccessControlsInsertCall {
  1166. c.ctx_ = ctx
  1167. return c
  1168. }
  1169. func (c *BucketAccessControlsInsertCall) doRequest(alt string) (*http.Response, error) {
  1170. var body io.Reader = nil
  1171. body, err := googleapi.WithoutDataWrapper.JSONReader(c.bucketaccesscontrol)
  1172. if err != nil {
  1173. return nil, err
  1174. }
  1175. ctype := "application/json"
  1176. c.urlParams_.Set("alt", alt)
  1177. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/acl")
  1178. urls += "?" + c.urlParams_.Encode()
  1179. req, _ := http.NewRequest("POST", urls, body)
  1180. googleapi.Expand(req.URL, map[string]string{
  1181. "bucket": c.bucket,
  1182. })
  1183. req.Header.Set("Content-Type", ctype)
  1184. req.Header.Set("User-Agent", c.s.userAgent())
  1185. if c.ctx_ != nil {
  1186. return ctxhttp.Do(c.ctx_, c.s.client, req)
  1187. }
  1188. return c.s.client.Do(req)
  1189. }
  1190. // Do executes the "storage.bucketAccessControls.insert" call.
  1191. // Exactly one of *BucketAccessControl or error will be non-nil. Any
  1192. // non-2xx status code is an error. Response headers are in either
  1193. // *BucketAccessControl.ServerResponse.Header or (if a response was
  1194. // returned at all) in error.(*googleapi.Error).Header. Use
  1195. // googleapi.IsNotModified to check whether the returned error was
  1196. // because http.StatusNotModified was returned.
  1197. func (c *BucketAccessControlsInsertCall) Do(opts ...googleapi.CallOption) (*BucketAccessControl, error) {
  1198. gensupport.SetOptions(c.urlParams_, opts...)
  1199. res, err := c.doRequest("json")
  1200. if res != nil && res.StatusCode == http.StatusNotModified {
  1201. if res.Body != nil {
  1202. res.Body.Close()
  1203. }
  1204. return nil, &googleapi.Error{
  1205. Code: res.StatusCode,
  1206. Header: res.Header,
  1207. }
  1208. }
  1209. if err != nil {
  1210. return nil, err
  1211. }
  1212. defer googleapi.CloseBody(res)
  1213. if err := googleapi.CheckResponse(res); err != nil {
  1214. return nil, err
  1215. }
  1216. ret := &BucketAccessControl{
  1217. ServerResponse: googleapi.ServerResponse{
  1218. Header: res.Header,
  1219. HTTPStatusCode: res.StatusCode,
  1220. },
  1221. }
  1222. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  1223. return nil, err
  1224. }
  1225. return ret, nil
  1226. // {
  1227. // "description": "Creates a new ACL entry on the specified bucket.",
  1228. // "httpMethod": "POST",
  1229. // "id": "storage.bucketAccessControls.insert",
  1230. // "parameterOrder": [
  1231. // "bucket"
  1232. // ],
  1233. // "parameters": {
  1234. // "bucket": {
  1235. // "description": "Name of a bucket.",
  1236. // "location": "path",
  1237. // "required": true,
  1238. // "type": "string"
  1239. // }
  1240. // },
  1241. // "path": "b/{bucket}/acl",
  1242. // "request": {
  1243. // "$ref": "BucketAccessControl"
  1244. // },
  1245. // "response": {
  1246. // "$ref": "BucketAccessControl"
  1247. // },
  1248. // "scopes": [
  1249. // "https://www.googleapis.com/auth/cloud-platform",
  1250. // "https://www.googleapis.com/auth/devstorage.full_control"
  1251. // ]
  1252. // }
  1253. }
  1254. // method id "storage.bucketAccessControls.list":
  1255. type BucketAccessControlsListCall struct {
  1256. s *Service
  1257. bucket string
  1258. urlParams_ gensupport.URLParams
  1259. ifNoneMatch_ string
  1260. ctx_ context.Context
  1261. }
  1262. // List: Retrieves ACL entries on the specified bucket.
  1263. func (r *BucketAccessControlsService) List(bucket string) *BucketAccessControlsListCall {
  1264. c := &BucketAccessControlsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1265. c.bucket = bucket
  1266. return c
  1267. }
  1268. // Fields allows partial responses to be retrieved. See
  1269. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1270. // for more information.
  1271. func (c *BucketAccessControlsListCall) Fields(s ...googleapi.Field) *BucketAccessControlsListCall {
  1272. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1273. return c
  1274. }
  1275. // IfNoneMatch sets the optional parameter which makes the operation
  1276. // fail if the object's ETag matches the given value. This is useful for
  1277. // getting updates only after the object has changed since the last
  1278. // request. Use googleapi.IsNotModified to check whether the response
  1279. // error from Do is the result of In-None-Match.
  1280. func (c *BucketAccessControlsListCall) IfNoneMatch(entityTag string) *BucketAccessControlsListCall {
  1281. c.ifNoneMatch_ = entityTag
  1282. return c
  1283. }
  1284. // Context sets the context to be used in this call's Do method. Any
  1285. // pending HTTP request will be aborted if the provided context is
  1286. // canceled.
  1287. func (c *BucketAccessControlsListCall) Context(ctx context.Context) *BucketAccessControlsListCall {
  1288. c.ctx_ = ctx
  1289. return c
  1290. }
  1291. func (c *BucketAccessControlsListCall) doRequest(alt string) (*http.Response, error) {
  1292. var body io.Reader = nil
  1293. c.urlParams_.Set("alt", alt)
  1294. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/acl")
  1295. urls += "?" + c.urlParams_.Encode()
  1296. req, _ := http.NewRequest("GET", urls, body)
  1297. googleapi.Expand(req.URL, map[string]string{
  1298. "bucket": c.bucket,
  1299. })
  1300. req.Header.Set("User-Agent", c.s.userAgent())
  1301. if c.ifNoneMatch_ != "" {
  1302. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  1303. }
  1304. if c.ctx_ != nil {
  1305. return ctxhttp.Do(c.ctx_, c.s.client, req)
  1306. }
  1307. return c.s.client.Do(req)
  1308. }
  1309. // Do executes the "storage.bucketAccessControls.list" call.
  1310. // Exactly one of *BucketAccessControls or error will be non-nil. Any
  1311. // non-2xx status code is an error. Response headers are in either
  1312. // *BucketAccessControls.ServerResponse.Header or (if a response was
  1313. // returned at all) in error.(*googleapi.Error).Header. Use
  1314. // googleapi.IsNotModified to check whether the returned error was
  1315. // because http.StatusNotModified was returned.
  1316. func (c *BucketAccessControlsListCall) Do(opts ...googleapi.CallOption) (*BucketAccessControls, error) {
  1317. gensupport.SetOptions(c.urlParams_, opts...)
  1318. res, err := c.doRequest("json")
  1319. if res != nil && res.StatusCode == http.StatusNotModified {
  1320. if res.Body != nil {
  1321. res.Body.Close()
  1322. }
  1323. return nil, &googleapi.Error{
  1324. Code: res.StatusCode,
  1325. Header: res.Header,
  1326. }
  1327. }
  1328. if err != nil {
  1329. return nil, err
  1330. }
  1331. defer googleapi.CloseBody(res)
  1332. if err := googleapi.CheckResponse(res); err != nil {
  1333. return nil, err
  1334. }
  1335. ret := &BucketAccessControls{
  1336. ServerResponse: googleapi.ServerResponse{
  1337. Header: res.Header,
  1338. HTTPStatusCode: res.StatusCode,
  1339. },
  1340. }
  1341. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  1342. return nil, err
  1343. }
  1344. return ret, nil
  1345. // {
  1346. // "description": "Retrieves ACL entries on the specified bucket.",
  1347. // "httpMethod": "GET",
  1348. // "id": "storage.bucketAccessControls.list",
  1349. // "parameterOrder": [
  1350. // "bucket"
  1351. // ],
  1352. // "parameters": {
  1353. // "bucket": {
  1354. // "description": "Name of a bucket.",
  1355. // "location": "path",
  1356. // "required": true,
  1357. // "type": "string"
  1358. // }
  1359. // },
  1360. // "path": "b/{bucket}/acl",
  1361. // "response": {
  1362. // "$ref": "BucketAccessControls"
  1363. // },
  1364. // "scopes": [
  1365. // "https://www.googleapis.com/auth/cloud-platform",
  1366. // "https://www.googleapis.com/auth/devstorage.full_control"
  1367. // ]
  1368. // }
  1369. }
  1370. // method id "storage.bucketAccessControls.patch":
  1371. type BucketAccessControlsPatchCall struct {
  1372. s *Service
  1373. bucket string
  1374. entity string
  1375. bucketaccesscontrol *BucketAccessControl
  1376. urlParams_ gensupport.URLParams
  1377. ctx_ context.Context
  1378. }
  1379. // Patch: Updates an ACL entry on the specified bucket. This method
  1380. // supports patch semantics.
  1381. func (r *BucketAccessControlsService) Patch(bucket string, entity string, bucketaccesscontrol *BucketAccessControl) *BucketAccessControlsPatchCall {
  1382. c := &BucketAccessControlsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1383. c.bucket = bucket
  1384. c.entity = entity
  1385. c.bucketaccesscontrol = bucketaccesscontrol
  1386. return c
  1387. }
  1388. // Fields allows partial responses to be retrieved. See
  1389. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1390. // for more information.
  1391. func (c *BucketAccessControlsPatchCall) Fields(s ...googleapi.Field) *BucketAccessControlsPatchCall {
  1392. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1393. return c
  1394. }
  1395. // Context sets the context to be used in this call's Do method. Any
  1396. // pending HTTP request will be aborted if the provided context is
  1397. // canceled.
  1398. func (c *BucketAccessControlsPatchCall) Context(ctx context.Context) *BucketAccessControlsPatchCall {
  1399. c.ctx_ = ctx
  1400. return c
  1401. }
  1402. func (c *BucketAccessControlsPatchCall) doRequest(alt string) (*http.Response, error) {
  1403. var body io.Reader = nil
  1404. body, err := googleapi.WithoutDataWrapper.JSONReader(c.bucketaccesscontrol)
  1405. if err != nil {
  1406. return nil, err
  1407. }
  1408. ctype := "application/json"
  1409. c.urlParams_.Set("alt", alt)
  1410. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/acl/{entity}")
  1411. urls += "?" + c.urlParams_.Encode()
  1412. req, _ := http.NewRequest("PATCH", urls, body)
  1413. googleapi.Expand(req.URL, map[string]string{
  1414. "bucket": c.bucket,
  1415. "entity": c.entity,
  1416. })
  1417. req.Header.Set("Content-Type", ctype)
  1418. req.Header.Set("User-Agent", c.s.userAgent())
  1419. if c.ctx_ != nil {
  1420. return ctxhttp.Do(c.ctx_, c.s.client, req)
  1421. }
  1422. return c.s.client.Do(req)
  1423. }
  1424. // Do executes the "storage.bucketAccessControls.patch" call.
  1425. // Exactly one of *BucketAccessControl or error will be non-nil. Any
  1426. // non-2xx status code is an error. Response headers are in either
  1427. // *BucketAccessControl.ServerResponse.Header or (if a response was
  1428. // returned at all) in error.(*googleapi.Error).Header. Use
  1429. // googleapi.IsNotModified to check whether the returned error was
  1430. // because http.StatusNotModified was returned.
  1431. func (c *BucketAccessControlsPatchCall) Do(opts ...googleapi.CallOption) (*BucketAccessControl, error) {
  1432. gensupport.SetOptions(c.urlParams_, opts...)
  1433. res, err := c.doRequest("json")
  1434. if res != nil && res.StatusCode == http.StatusNotModified {
  1435. if res.Body != nil {
  1436. res.Body.Close()
  1437. }
  1438. return nil, &googleapi.Error{
  1439. Code: res.StatusCode,
  1440. Header: res.Header,
  1441. }
  1442. }
  1443. if err != nil {
  1444. return nil, err
  1445. }
  1446. defer googleapi.CloseBody(res)
  1447. if err := googleapi.CheckResponse(res); err != nil {
  1448. return nil, err
  1449. }
  1450. ret := &BucketAccessControl{
  1451. ServerResponse: googleapi.ServerResponse{
  1452. Header: res.Header,
  1453. HTTPStatusCode: res.StatusCode,
  1454. },
  1455. }
  1456. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  1457. return nil, err
  1458. }
  1459. return ret, nil
  1460. // {
  1461. // "description": "Updates an ACL entry on the specified bucket. This method supports patch semantics.",
  1462. // "httpMethod": "PATCH",
  1463. // "id": "storage.bucketAccessControls.patch",
  1464. // "parameterOrder": [
  1465. // "bucket",
  1466. // "entity"
  1467. // ],
  1468. // "parameters": {
  1469. // "bucket": {
  1470. // "description": "Name of a bucket.",
  1471. // "location": "path",
  1472. // "required": true,
  1473. // "type": "string"
  1474. // },
  1475. // "entity": {
  1476. // "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.",
  1477. // "location": "path",
  1478. // "required": true,
  1479. // "type": "string"
  1480. // }
  1481. // },
  1482. // "path": "b/{bucket}/acl/{entity}",
  1483. // "request": {
  1484. // "$ref": "BucketAccessControl"
  1485. // },
  1486. // "response": {
  1487. // "$ref": "BucketAccessControl"
  1488. // },
  1489. // "scopes": [
  1490. // "https://www.googleapis.com/auth/cloud-platform",
  1491. // "https://www.googleapis.com/auth/devstorage.full_control"
  1492. // ]
  1493. // }
  1494. }
  1495. // method id "storage.bucketAccessControls.update":
  1496. type BucketAccessControlsUpdateCall struct {
  1497. s *Service
  1498. bucket string
  1499. entity string
  1500. bucketaccesscontrol *BucketAccessControl
  1501. urlParams_ gensupport.URLParams
  1502. ctx_ context.Context
  1503. }
  1504. // Update: Updates an ACL entry on the specified bucket.
  1505. func (r *BucketAccessControlsService) Update(bucket string, entity string, bucketaccesscontrol *BucketAccessControl) *BucketAccessControlsUpdateCall {
  1506. c := &BucketAccessControlsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1507. c.bucket = bucket
  1508. c.entity = entity
  1509. c.bucketaccesscontrol = bucketaccesscontrol
  1510. return c
  1511. }
  1512. // Fields allows partial responses to be retrieved. See
  1513. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1514. // for more information.
  1515. func (c *BucketAccessControlsUpdateCall) Fields(s ...googleapi.Field) *BucketAccessControlsUpdateCall {
  1516. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1517. return c
  1518. }
  1519. // Context sets the context to be used in this call's Do method. Any
  1520. // pending HTTP request will be aborted if the provided context is
  1521. // canceled.
  1522. func (c *BucketAccessControlsUpdateCall) Context(ctx context.Context) *BucketAccessControlsUpdateCall {
  1523. c.ctx_ = ctx
  1524. return c
  1525. }
  1526. func (c *BucketAccessControlsUpdateCall) doRequest(alt string) (*http.Response, error) {
  1527. var body io.Reader = nil
  1528. body, err := googleapi.WithoutDataWrapper.JSONReader(c.bucketaccesscontrol)
  1529. if err != nil {
  1530. return nil, err
  1531. }
  1532. ctype := "application/json"
  1533. c.urlParams_.Set("alt", alt)
  1534. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/acl/{entity}")
  1535. urls += "?" + c.urlParams_.Encode()
  1536. req, _ := http.NewRequest("PUT", urls, body)
  1537. googleapi.Expand(req.URL, map[string]string{
  1538. "bucket": c.bucket,
  1539. "entity": c.entity,
  1540. })
  1541. req.Header.Set("Content-Type", ctype)
  1542. req.Header.Set("User-Agent", c.s.userAgent())
  1543. if c.ctx_ != nil {
  1544. return ctxhttp.Do(c.ctx_, c.s.client, req)
  1545. }
  1546. return c.s.client.Do(req)
  1547. }
  1548. // Do executes the "storage.bucketAccessControls.update" call.
  1549. // Exactly one of *BucketAccessControl or error will be non-nil. Any
  1550. // non-2xx status code is an error. Response headers are in either
  1551. // *BucketAccessControl.ServerResponse.Header or (if a response was
  1552. // returned at all) in error.(*googleapi.Error).Header. Use
  1553. // googleapi.IsNotModified to check whether the returned error was
  1554. // because http.StatusNotModified was returned.
  1555. func (c *BucketAccessControlsUpdateCall) Do(opts ...googleapi.CallOption) (*BucketAccessControl, error) {
  1556. gensupport.SetOptions(c.urlParams_, opts...)
  1557. res, err := c.doRequest("json")
  1558. if res != nil && res.StatusCode == http.StatusNotModified {
  1559. if res.Body != nil {
  1560. res.Body.Close()
  1561. }
  1562. return nil, &googleapi.Error{
  1563. Code: res.StatusCode,
  1564. Header: res.Header,
  1565. }
  1566. }
  1567. if err != nil {
  1568. return nil, err
  1569. }
  1570. defer googleapi.CloseBody(res)
  1571. if err := googleapi.CheckResponse(res); err != nil {
  1572. return nil, err
  1573. }
  1574. ret := &BucketAccessControl{
  1575. ServerResponse: googleapi.ServerResponse{
  1576. Header: res.Header,
  1577. HTTPStatusCode: res.StatusCode,
  1578. },
  1579. }
  1580. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  1581. return nil, err
  1582. }
  1583. return ret, nil
  1584. // {
  1585. // "description": "Updates an ACL entry on the specified bucket.",
  1586. // "httpMethod": "PUT",
  1587. // "id": "storage.bucketAccessControls.update",
  1588. // "parameterOrder": [
  1589. // "bucket",
  1590. // "entity"
  1591. // ],
  1592. // "parameters": {
  1593. // "bucket": {
  1594. // "description": "Name of a bucket.",
  1595. // "location": "path",
  1596. // "required": true,
  1597. // "type": "string"
  1598. // },
  1599. // "entity": {
  1600. // "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.",
  1601. // "location": "path",
  1602. // "required": true,
  1603. // "type": "string"
  1604. // }
  1605. // },
  1606. // "path": "b/{bucket}/acl/{entity}",
  1607. // "request": {
  1608. // "$ref": "BucketAccessControl"
  1609. // },
  1610. // "response": {
  1611. // "$ref": "BucketAccessControl"
  1612. // },
  1613. // "scopes": [
  1614. // "https://www.googleapis.com/auth/cloud-platform",
  1615. // "https://www.googleapis.com/auth/devstorage.full_control"
  1616. // ]
  1617. // }
  1618. }
  1619. // method id "storage.buckets.delete":
  1620. type BucketsDeleteCall struct {
  1621. s *Service
  1622. bucket string
  1623. urlParams_ gensupport.URLParams
  1624. ctx_ context.Context
  1625. }
  1626. // Delete: Permanently deletes an empty bucket.
  1627. func (r *BucketsService) Delete(bucket string) *BucketsDeleteCall {
  1628. c := &BucketsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1629. c.bucket = bucket
  1630. return c
  1631. }
  1632. // IfMetagenerationMatch sets the optional parameter
  1633. // "ifMetagenerationMatch": If set, only deletes the bucket if its
  1634. // metageneration matches this value.
  1635. func (c *BucketsDeleteCall) IfMetagenerationMatch(ifMetagenerationMatch int64) *BucketsDeleteCall {
  1636. c.urlParams_.Set("ifMetagenerationMatch", fmt.Sprint(ifMetagenerationMatch))
  1637. return c
  1638. }
  1639. // IfMetagenerationNotMatch sets the optional parameter
  1640. // "ifMetagenerationNotMatch": If set, only deletes the bucket if its
  1641. // metageneration does not match this value.
  1642. func (c *BucketsDeleteCall) IfMetagenerationNotMatch(ifMetagenerationNotMatch int64) *BucketsDeleteCall {
  1643. c.urlParams_.Set("ifMetagenerationNotMatch", fmt.Sprint(ifMetagenerationNotMatch))
  1644. return c
  1645. }
  1646. // Fields allows partial responses to be retrieved. See
  1647. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1648. // for more information.
  1649. func (c *BucketsDeleteCall) Fields(s ...googleapi.Field) *BucketsDeleteCall {
  1650. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1651. return c
  1652. }
  1653. // Context sets the context to be used in this call's Do method. Any
  1654. // pending HTTP request will be aborted if the provided context is
  1655. // canceled.
  1656. func (c *BucketsDeleteCall) Context(ctx context.Context) *BucketsDeleteCall {
  1657. c.ctx_ = ctx
  1658. return c
  1659. }
  1660. func (c *BucketsDeleteCall) doRequest(alt string) (*http.Response, error) {
  1661. var body io.Reader = nil
  1662. c.urlParams_.Set("alt", alt)
  1663. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}")
  1664. urls += "?" + c.urlParams_.Encode()
  1665. req, _ := http.NewRequest("DELETE", urls, body)
  1666. googleapi.Expand(req.URL, map[string]string{
  1667. "bucket": c.bucket,
  1668. })
  1669. req.Header.Set("User-Agent", c.s.userAgent())
  1670. if c.ctx_ != nil {
  1671. return ctxhttp.Do(c.ctx_, c.s.client, req)
  1672. }
  1673. return c.s.client.Do(req)
  1674. }
  1675. // Do executes the "storage.buckets.delete" call.
  1676. func (c *BucketsDeleteCall) Do(opts ...googleapi.CallOption) error {
  1677. gensupport.SetOptions(c.urlParams_, opts...)
  1678. res, err := c.doRequest("json")
  1679. if err != nil {
  1680. return err
  1681. }
  1682. defer googleapi.CloseBody(res)
  1683. if err := googleapi.CheckResponse(res); err != nil {
  1684. return err
  1685. }
  1686. return nil
  1687. // {
  1688. // "description": "Permanently deletes an empty bucket.",
  1689. // "httpMethod": "DELETE",
  1690. // "id": "storage.buckets.delete",
  1691. // "parameterOrder": [
  1692. // "bucket"
  1693. // ],
  1694. // "parameters": {
  1695. // "bucket": {
  1696. // "description": "Name of a bucket.",
  1697. // "location": "path",
  1698. // "required": true,
  1699. // "type": "string"
  1700. // },
  1701. // "ifMetagenerationMatch": {
  1702. // "description": "If set, only deletes the bucket if its metageneration matches this value.",
  1703. // "format": "int64",
  1704. // "location": "query",
  1705. // "type": "string"
  1706. // },
  1707. // "ifMetagenerationNotMatch": {
  1708. // "description": "If set, only deletes the bucket if its metageneration does not match this value.",
  1709. // "format": "int64",
  1710. // "location": "query",
  1711. // "type": "string"
  1712. // }
  1713. // },
  1714. // "path": "b/{bucket}",
  1715. // "scopes": [
  1716. // "https://www.googleapis.com/auth/cloud-platform",
  1717. // "https://www.googleapis.com/auth/devstorage.full_control",
  1718. // "https://www.googleapis.com/auth/devstorage.read_write"
  1719. // ]
  1720. // }
  1721. }
  1722. // method id "storage.buckets.get":
  1723. type BucketsGetCall struct {
  1724. s *Service
  1725. bucket string
  1726. urlParams_ gensupport.URLParams
  1727. ifNoneMatch_ string
  1728. ctx_ context.Context
  1729. }
  1730. // Get: Returns metadata for the specified bucket.
  1731. func (r *BucketsService) Get(bucket string) *BucketsGetCall {
  1732. c := &BucketsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1733. c.bucket = bucket
  1734. return c
  1735. }
  1736. // IfMetagenerationMatch sets the optional parameter
  1737. // "ifMetagenerationMatch": Makes the return of the bucket metadata
  1738. // conditional on whether the bucket's current metageneration matches
  1739. // the given value.
  1740. func (c *BucketsGetCall) IfMetagenerationMatch(ifMetagenerationMatch int64) *BucketsGetCall {
  1741. c.urlParams_.Set("ifMetagenerationMatch", fmt.Sprint(ifMetagenerationMatch))
  1742. return c
  1743. }
  1744. // IfMetagenerationNotMatch sets the optional parameter
  1745. // "ifMetagenerationNotMatch": Makes the return of the bucket metadata
  1746. // conditional on whether the bucket's current metageneration does not
  1747. // match the given value.
  1748. func (c *BucketsGetCall) IfMetagenerationNotMatch(ifMetagenerationNotMatch int64) *BucketsGetCall {
  1749. c.urlParams_.Set("ifMetagenerationNotMatch", fmt.Sprint(ifMetagenerationNotMatch))
  1750. return c
  1751. }
  1752. // Projection sets the optional parameter "projection": Set of
  1753. // properties to return. Defaults to noAcl.
  1754. //
  1755. // Possible values:
  1756. // "full" - Include all properties.
  1757. // "noAcl" - Omit acl and defaultObjectAcl properties.
  1758. func (c *BucketsGetCall) Projection(projection string) *BucketsGetCall {
  1759. c.urlParams_.Set("projection", projection)
  1760. return c
  1761. }
  1762. // Fields allows partial responses to be retrieved. See
  1763. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1764. // for more information.
  1765. func (c *BucketsGetCall) Fields(s ...googleapi.Field) *BucketsGetCall {
  1766. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1767. return c
  1768. }
  1769. // IfNoneMatch sets the optional parameter which makes the operation
  1770. // fail if the object's ETag matches the given value. This is useful for
  1771. // getting updates only after the object has changed since the last
  1772. // request. Use googleapi.IsNotModified to check whether the response
  1773. // error from Do is the result of In-None-Match.
  1774. func (c *BucketsGetCall) IfNoneMatch(entityTag string) *BucketsGetCall {
  1775. c.ifNoneMatch_ = entityTag
  1776. return c
  1777. }
  1778. // Context sets the context to be used in this call's Do method. Any
  1779. // pending HTTP request will be aborted if the provided context is
  1780. // canceled.
  1781. func (c *BucketsGetCall) Context(ctx context.Context) *BucketsGetCall {
  1782. c.ctx_ = ctx
  1783. return c
  1784. }
  1785. func (c *BucketsGetCall) doRequest(alt string) (*http.Response, error) {
  1786. var body io.Reader = nil
  1787. c.urlParams_.Set("alt", alt)
  1788. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}")
  1789. urls += "?" + c.urlParams_.Encode()
  1790. req, _ := http.NewRequest("GET", urls, body)
  1791. googleapi.Expand(req.URL, map[string]string{
  1792. "bucket": c.bucket,
  1793. })
  1794. req.Header.Set("User-Agent", c.s.userAgent())
  1795. if c.ifNoneMatch_ != "" {
  1796. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  1797. }
  1798. if c.ctx_ != nil {
  1799. return ctxhttp.Do(c.ctx_, c.s.client, req)
  1800. }
  1801. return c.s.client.Do(req)
  1802. }
  1803. // Do executes the "storage.buckets.get" call.
  1804. // Exactly one of *Bucket or error will be non-nil. Any non-2xx status
  1805. // code is an error. Response headers are in either
  1806. // *Bucket.ServerResponse.Header or (if a response was returned at all)
  1807. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1808. // check whether the returned error was because http.StatusNotModified
  1809. // was returned.
  1810. func (c *BucketsGetCall) Do(opts ...googleapi.CallOption) (*Bucket, error) {
  1811. gensupport.SetOptions(c.urlParams_, opts...)
  1812. res, err := c.doRequest("json")
  1813. if res != nil && res.StatusCode == http.StatusNotModified {
  1814. if res.Body != nil {
  1815. res.Body.Close()
  1816. }
  1817. return nil, &googleapi.Error{
  1818. Code: res.StatusCode,
  1819. Header: res.Header,
  1820. }
  1821. }
  1822. if err != nil {
  1823. return nil, err
  1824. }
  1825. defer googleapi.CloseBody(res)
  1826. if err := googleapi.CheckResponse(res); err != nil {
  1827. return nil, err
  1828. }
  1829. ret := &Bucket{
  1830. ServerResponse: googleapi.ServerResponse{
  1831. Header: res.Header,
  1832. HTTPStatusCode: res.StatusCode,
  1833. },
  1834. }
  1835. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  1836. return nil, err
  1837. }
  1838. return ret, nil
  1839. // {
  1840. // "description": "Returns metadata for the specified bucket.",
  1841. // "httpMethod": "GET",
  1842. // "id": "storage.buckets.get",
  1843. // "parameterOrder": [
  1844. // "bucket"
  1845. // ],
  1846. // "parameters": {
  1847. // "bucket": {
  1848. // "description": "Name of a bucket.",
  1849. // "location": "path",
  1850. // "required": true,
  1851. // "type": "string"
  1852. // },
  1853. // "ifMetagenerationMatch": {
  1854. // "description": "Makes the return of the bucket metadata conditional on whether the bucket's current metageneration matches the given value.",
  1855. // "format": "int64",
  1856. // "location": "query",
  1857. // "type": "string"
  1858. // },
  1859. // "ifMetagenerationNotMatch": {
  1860. // "description": "Makes the return of the bucket metadata conditional on whether the bucket's current metageneration does not match the given value.",
  1861. // "format": "int64",
  1862. // "location": "query",
  1863. // "type": "string"
  1864. // },
  1865. // "projection": {
  1866. // "description": "Set of properties to return. Defaults to noAcl.",
  1867. // "enum": [
  1868. // "full",
  1869. // "noAcl"
  1870. // ],
  1871. // "enumDescriptions": [
  1872. // "Include all properties.",
  1873. // "Omit acl and defaultObjectAcl properties."
  1874. // ],
  1875. // "location": "query",
  1876. // "type": "string"
  1877. // }
  1878. // },
  1879. // "path": "b/{bucket}",
  1880. // "response": {
  1881. // "$ref": "Bucket"
  1882. // },
  1883. // "scopes": [
  1884. // "https://www.googleapis.com/auth/cloud-platform",
  1885. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  1886. // "https://www.googleapis.com/auth/devstorage.full_control",
  1887. // "https://www.googleapis.com/auth/devstorage.read_only",
  1888. // "https://www.googleapis.com/auth/devstorage.read_write"
  1889. // ]
  1890. // }
  1891. }
  1892. // method id "storage.buckets.insert":
  1893. type BucketsInsertCall struct {
  1894. s *Service
  1895. bucket *Bucket
  1896. urlParams_ gensupport.URLParams
  1897. ctx_ context.Context
  1898. }
  1899. // Insert: Creates a new bucket.
  1900. func (r *BucketsService) Insert(projectid string, bucket *Bucket) *BucketsInsertCall {
  1901. c := &BucketsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1902. c.urlParams_.Set("project", projectid)
  1903. c.bucket = bucket
  1904. return c
  1905. }
  1906. // PredefinedAcl sets the optional parameter "predefinedAcl": Apply a
  1907. // predefined set of access controls to this bucket.
  1908. //
  1909. // Possible values:
  1910. // "authenticatedRead" - Project team owners get OWNER access, and
  1911. // allAuthenticatedUsers get READER access.
  1912. // "private" - Project team owners get OWNER access.
  1913. // "projectPrivate" - Project team members get access according to
  1914. // their roles.
  1915. // "publicRead" - Project team owners get OWNER access, and allUsers
  1916. // get READER access.
  1917. // "publicReadWrite" - Project team owners get OWNER access, and
  1918. // allUsers get WRITER access.
  1919. func (c *BucketsInsertCall) PredefinedAcl(predefinedAcl string) *BucketsInsertCall {
  1920. c.urlParams_.Set("predefinedAcl", predefinedAcl)
  1921. return c
  1922. }
  1923. // PredefinedDefaultObjectAcl sets the optional parameter
  1924. // "predefinedDefaultObjectAcl": Apply a predefined set of default
  1925. // object access controls to this bucket.
  1926. //
  1927. // Possible values:
  1928. // "authenticatedRead" - Object owner gets OWNER access, and
  1929. // allAuthenticatedUsers get READER access.
  1930. // "bucketOwnerFullControl" - Object owner gets OWNER access, and
  1931. // project team owners get OWNER access.
  1932. // "bucketOwnerRead" - Object owner gets OWNER access, and project
  1933. // team owners get READER access.
  1934. // "private" - Object owner gets OWNER access.
  1935. // "projectPrivate" - Object owner gets OWNER access, and project team
  1936. // members get access according to their roles.
  1937. // "publicRead" - Object owner gets OWNER access, and allUsers get
  1938. // READER access.
  1939. func (c *BucketsInsertCall) PredefinedDefaultObjectAcl(predefinedDefaultObjectAcl string) *BucketsInsertCall {
  1940. c.urlParams_.Set("predefinedDefaultObjectAcl", predefinedDefaultObjectAcl)
  1941. return c
  1942. }
  1943. // Projection sets the optional parameter "projection": Set of
  1944. // properties to return. Defaults to noAcl, unless the bucket resource
  1945. // specifies acl or defaultObjectAcl properties, when it defaults to
  1946. // full.
  1947. //
  1948. // Possible values:
  1949. // "full" - Include all properties.
  1950. // "noAcl" - Omit acl and defaultObjectAcl properties.
  1951. func (c *BucketsInsertCall) Projection(projection string) *BucketsInsertCall {
  1952. c.urlParams_.Set("projection", projection)
  1953. return c
  1954. }
  1955. // Fields allows partial responses to be retrieved. See
  1956. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1957. // for more information.
  1958. func (c *BucketsInsertCall) Fields(s ...googleapi.Field) *BucketsInsertCall {
  1959. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1960. return c
  1961. }
  1962. // Context sets the context to be used in this call's Do method. Any
  1963. // pending HTTP request will be aborted if the provided context is
  1964. // canceled.
  1965. func (c *BucketsInsertCall) Context(ctx context.Context) *BucketsInsertCall {
  1966. c.ctx_ = ctx
  1967. return c
  1968. }
  1969. func (c *BucketsInsertCall) doRequest(alt string) (*http.Response, error) {
  1970. var body io.Reader = nil
  1971. body, err := googleapi.WithoutDataWrapper.JSONReader(c.bucket)
  1972. if err != nil {
  1973. return nil, err
  1974. }
  1975. ctype := "application/json"
  1976. c.urlParams_.Set("alt", alt)
  1977. urls := googleapi.ResolveRelative(c.s.BasePath, "b")
  1978. urls += "?" + c.urlParams_.Encode()
  1979. req, _ := http.NewRequest("POST", urls, body)
  1980. googleapi.SetOpaque(req.URL)
  1981. req.Header.Set("Content-Type", ctype)
  1982. req.Header.Set("User-Agent", c.s.userAgent())
  1983. if c.ctx_ != nil {
  1984. return ctxhttp.Do(c.ctx_, c.s.client, req)
  1985. }
  1986. return c.s.client.Do(req)
  1987. }
  1988. // Do executes the "storage.buckets.insert" call.
  1989. // Exactly one of *Bucket or error will be non-nil. Any non-2xx status
  1990. // code is an error. Response headers are in either
  1991. // *Bucket.ServerResponse.Header or (if a response was returned at all)
  1992. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1993. // check whether the returned error was because http.StatusNotModified
  1994. // was returned.
  1995. func (c *BucketsInsertCall) Do(opts ...googleapi.CallOption) (*Bucket, error) {
  1996. gensupport.SetOptions(c.urlParams_, opts...)
  1997. res, err := c.doRequest("json")
  1998. if res != nil && res.StatusCode == http.StatusNotModified {
  1999. if res.Body != nil {
  2000. res.Body.Close()
  2001. }
  2002. return nil, &googleapi.Error{
  2003. Code: res.StatusCode,
  2004. Header: res.Header,
  2005. }
  2006. }
  2007. if err != nil {
  2008. return nil, err
  2009. }
  2010. defer googleapi.CloseBody(res)
  2011. if err := googleapi.CheckResponse(res); err != nil {
  2012. return nil, err
  2013. }
  2014. ret := &Bucket{
  2015. ServerResponse: googleapi.ServerResponse{
  2016. Header: res.Header,
  2017. HTTPStatusCode: res.StatusCode,
  2018. },
  2019. }
  2020. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  2021. return nil, err
  2022. }
  2023. return ret, nil
  2024. // {
  2025. // "description": "Creates a new bucket.",
  2026. // "httpMethod": "POST",
  2027. // "id": "storage.buckets.insert",
  2028. // "parameterOrder": [
  2029. // "project"
  2030. // ],
  2031. // "parameters": {
  2032. // "predefinedAcl": {
  2033. // "description": "Apply a predefined set of access controls to this bucket.",
  2034. // "enum": [
  2035. // "authenticatedRead",
  2036. // "private",
  2037. // "projectPrivate",
  2038. // "publicRead",
  2039. // "publicReadWrite"
  2040. // ],
  2041. // "enumDescriptions": [
  2042. // "Project team owners get OWNER access, and allAuthenticatedUsers get READER access.",
  2043. // "Project team owners get OWNER access.",
  2044. // "Project team members get access according to their roles.",
  2045. // "Project team owners get OWNER access, and allUsers get READER access.",
  2046. // "Project team owners get OWNER access, and allUsers get WRITER access."
  2047. // ],
  2048. // "location": "query",
  2049. // "type": "string"
  2050. // },
  2051. // "predefinedDefaultObjectAcl": {
  2052. // "description": "Apply a predefined set of default object access controls to this bucket.",
  2053. // "enum": [
  2054. // "authenticatedRead",
  2055. // "bucketOwnerFullControl",
  2056. // "bucketOwnerRead",
  2057. // "private",
  2058. // "projectPrivate",
  2059. // "publicRead"
  2060. // ],
  2061. // "enumDescriptions": [
  2062. // "Object owner gets OWNER access, and allAuthenticatedUsers get READER access.",
  2063. // "Object owner gets OWNER access, and project team owners get OWNER access.",
  2064. // "Object owner gets OWNER access, and project team owners get READER access.",
  2065. // "Object owner gets OWNER access.",
  2066. // "Object owner gets OWNER access, and project team members get access according to their roles.",
  2067. // "Object owner gets OWNER access, and allUsers get READER access."
  2068. // ],
  2069. // "location": "query",
  2070. // "type": "string"
  2071. // },
  2072. // "project": {
  2073. // "description": "A valid API project identifier.",
  2074. // "location": "query",
  2075. // "required": true,
  2076. // "type": "string"
  2077. // },
  2078. // "projection": {
  2079. // "description": "Set of properties to return. Defaults to noAcl, unless the bucket resource specifies acl or defaultObjectAcl properties, when it defaults to full.",
  2080. // "enum": [
  2081. // "full",
  2082. // "noAcl"
  2083. // ],
  2084. // "enumDescriptions": [
  2085. // "Include all properties.",
  2086. // "Omit acl and defaultObjectAcl properties."
  2087. // ],
  2088. // "location": "query",
  2089. // "type": "string"
  2090. // }
  2091. // },
  2092. // "path": "b",
  2093. // "request": {
  2094. // "$ref": "Bucket"
  2095. // },
  2096. // "response": {
  2097. // "$ref": "Bucket"
  2098. // },
  2099. // "scopes": [
  2100. // "https://www.googleapis.com/auth/cloud-platform",
  2101. // "https://www.googleapis.com/auth/devstorage.full_control",
  2102. // "https://www.googleapis.com/auth/devstorage.read_write"
  2103. // ]
  2104. // }
  2105. }
  2106. // method id "storage.buckets.list":
  2107. type BucketsListCall struct {
  2108. s *Service
  2109. urlParams_ gensupport.URLParams
  2110. ifNoneMatch_ string
  2111. ctx_ context.Context
  2112. }
  2113. // List: Retrieves a list of buckets for a given project.
  2114. func (r *BucketsService) List(projectid string) *BucketsListCall {
  2115. c := &BucketsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2116. c.urlParams_.Set("project", projectid)
  2117. return c
  2118. }
  2119. // MaxResults sets the optional parameter "maxResults": Maximum number
  2120. // of buckets to return.
  2121. func (c *BucketsListCall) MaxResults(maxResults int64) *BucketsListCall {
  2122. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  2123. return c
  2124. }
  2125. // PageToken sets the optional parameter "pageToken": A
  2126. // previously-returned page token representing part of the larger set of
  2127. // results to view.
  2128. func (c *BucketsListCall) PageToken(pageToken string) *BucketsListCall {
  2129. c.urlParams_.Set("pageToken", pageToken)
  2130. return c
  2131. }
  2132. // Prefix sets the optional parameter "prefix": Filter results to
  2133. // buckets whose names begin with this prefix.
  2134. func (c *BucketsListCall) Prefix(prefix string) *BucketsListCall {
  2135. c.urlParams_.Set("prefix", prefix)
  2136. return c
  2137. }
  2138. // Projection sets the optional parameter "projection": Set of
  2139. // properties to return. Defaults to noAcl.
  2140. //
  2141. // Possible values:
  2142. // "full" - Include all properties.
  2143. // "noAcl" - Omit acl and defaultObjectAcl properties.
  2144. func (c *BucketsListCall) Projection(projection string) *BucketsListCall {
  2145. c.urlParams_.Set("projection", projection)
  2146. return c
  2147. }
  2148. // Fields allows partial responses to be retrieved. See
  2149. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2150. // for more information.
  2151. func (c *BucketsListCall) Fields(s ...googleapi.Field) *BucketsListCall {
  2152. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2153. return c
  2154. }
  2155. // IfNoneMatch sets the optional parameter which makes the operation
  2156. // fail if the object's ETag matches the given value. This is useful for
  2157. // getting updates only after the object has changed since the last
  2158. // request. Use googleapi.IsNotModified to check whether the response
  2159. // error from Do is the result of In-None-Match.
  2160. func (c *BucketsListCall) IfNoneMatch(entityTag string) *BucketsListCall {
  2161. c.ifNoneMatch_ = entityTag
  2162. return c
  2163. }
  2164. // Context sets the context to be used in this call's Do method. Any
  2165. // pending HTTP request will be aborted if the provided context is
  2166. // canceled.
  2167. func (c *BucketsListCall) Context(ctx context.Context) *BucketsListCall {
  2168. c.ctx_ = ctx
  2169. return c
  2170. }
  2171. func (c *BucketsListCall) doRequest(alt string) (*http.Response, error) {
  2172. var body io.Reader = nil
  2173. c.urlParams_.Set("alt", alt)
  2174. urls := googleapi.ResolveRelative(c.s.BasePath, "b")
  2175. urls += "?" + c.urlParams_.Encode()
  2176. req, _ := http.NewRequest("GET", urls, body)
  2177. googleapi.SetOpaque(req.URL)
  2178. req.Header.Set("User-Agent", c.s.userAgent())
  2179. if c.ifNoneMatch_ != "" {
  2180. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  2181. }
  2182. if c.ctx_ != nil {
  2183. return ctxhttp.Do(c.ctx_, c.s.client, req)
  2184. }
  2185. return c.s.client.Do(req)
  2186. }
  2187. // Do executes the "storage.buckets.list" call.
  2188. // Exactly one of *Buckets or error will be non-nil. Any non-2xx status
  2189. // code is an error. Response headers are in either
  2190. // *Buckets.ServerResponse.Header or (if a response was returned at all)
  2191. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2192. // check whether the returned error was because http.StatusNotModified
  2193. // was returned.
  2194. func (c *BucketsListCall) Do(opts ...googleapi.CallOption) (*Buckets, error) {
  2195. gensupport.SetOptions(c.urlParams_, opts...)
  2196. res, err := c.doRequest("json")
  2197. if res != nil && res.StatusCode == http.StatusNotModified {
  2198. if res.Body != nil {
  2199. res.Body.Close()
  2200. }
  2201. return nil, &googleapi.Error{
  2202. Code: res.StatusCode,
  2203. Header: res.Header,
  2204. }
  2205. }
  2206. if err != nil {
  2207. return nil, err
  2208. }
  2209. defer googleapi.CloseBody(res)
  2210. if err := googleapi.CheckResponse(res); err != nil {
  2211. return nil, err
  2212. }
  2213. ret := &Buckets{
  2214. ServerResponse: googleapi.ServerResponse{
  2215. Header: res.Header,
  2216. HTTPStatusCode: res.StatusCode,
  2217. },
  2218. }
  2219. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  2220. return nil, err
  2221. }
  2222. return ret, nil
  2223. // {
  2224. // "description": "Retrieves a list of buckets for a given project.",
  2225. // "httpMethod": "GET",
  2226. // "id": "storage.buckets.list",
  2227. // "parameterOrder": [
  2228. // "project"
  2229. // ],
  2230. // "parameters": {
  2231. // "maxResults": {
  2232. // "description": "Maximum number of buckets to return.",
  2233. // "format": "uint32",
  2234. // "location": "query",
  2235. // "minimum": "0",
  2236. // "type": "integer"
  2237. // },
  2238. // "pageToken": {
  2239. // "description": "A previously-returned page token representing part of the larger set of results to view.",
  2240. // "location": "query",
  2241. // "type": "string"
  2242. // },
  2243. // "prefix": {
  2244. // "description": "Filter results to buckets whose names begin with this prefix.",
  2245. // "location": "query",
  2246. // "type": "string"
  2247. // },
  2248. // "project": {
  2249. // "description": "A valid API project identifier.",
  2250. // "location": "query",
  2251. // "required": true,
  2252. // "type": "string"
  2253. // },
  2254. // "projection": {
  2255. // "description": "Set of properties to return. Defaults to noAcl.",
  2256. // "enum": [
  2257. // "full",
  2258. // "noAcl"
  2259. // ],
  2260. // "enumDescriptions": [
  2261. // "Include all properties.",
  2262. // "Omit acl and defaultObjectAcl properties."
  2263. // ],
  2264. // "location": "query",
  2265. // "type": "string"
  2266. // }
  2267. // },
  2268. // "path": "b",
  2269. // "response": {
  2270. // "$ref": "Buckets"
  2271. // },
  2272. // "scopes": [
  2273. // "https://www.googleapis.com/auth/cloud-platform",
  2274. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  2275. // "https://www.googleapis.com/auth/devstorage.full_control",
  2276. // "https://www.googleapis.com/auth/devstorage.read_only",
  2277. // "https://www.googleapis.com/auth/devstorage.read_write"
  2278. // ]
  2279. // }
  2280. }
  2281. // Pages invokes f for each page of results.
  2282. // A non-nil error returned from f will halt the iteration.
  2283. // The provided context supersedes any context provided to the Context method.
  2284. func (c *BucketsListCall) Pages(ctx context.Context, f func(*Buckets) error) error {
  2285. c.ctx_ = ctx
  2286. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  2287. for {
  2288. x, err := c.Do()
  2289. if err != nil {
  2290. return err
  2291. }
  2292. if err := f(x); err != nil {
  2293. return err
  2294. }
  2295. if x.NextPageToken == "" {
  2296. return nil
  2297. }
  2298. c.PageToken(x.NextPageToken)
  2299. }
  2300. }
  2301. // method id "storage.buckets.patch":
  2302. type BucketsPatchCall struct {
  2303. s *Service
  2304. bucket string
  2305. bucket2 *Bucket
  2306. urlParams_ gensupport.URLParams
  2307. ctx_ context.Context
  2308. }
  2309. // Patch: Updates a bucket. This method supports patch semantics.
  2310. func (r *BucketsService) Patch(bucket string, bucket2 *Bucket) *BucketsPatchCall {
  2311. c := &BucketsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2312. c.bucket = bucket
  2313. c.bucket2 = bucket2
  2314. return c
  2315. }
  2316. // IfMetagenerationMatch sets the optional parameter
  2317. // "ifMetagenerationMatch": Makes the return of the bucket metadata
  2318. // conditional on whether the bucket's current metageneration matches
  2319. // the given value.
  2320. func (c *BucketsPatchCall) IfMetagenerationMatch(ifMetagenerationMatch int64) *BucketsPatchCall {
  2321. c.urlParams_.Set("ifMetagenerationMatch", fmt.Sprint(ifMetagenerationMatch))
  2322. return c
  2323. }
  2324. // IfMetagenerationNotMatch sets the optional parameter
  2325. // "ifMetagenerationNotMatch": Makes the return of the bucket metadata
  2326. // conditional on whether the bucket's current metageneration does not
  2327. // match the given value.
  2328. func (c *BucketsPatchCall) IfMetagenerationNotMatch(ifMetagenerationNotMatch int64) *BucketsPatchCall {
  2329. c.urlParams_.Set("ifMetagenerationNotMatch", fmt.Sprint(ifMetagenerationNotMatch))
  2330. return c
  2331. }
  2332. // PredefinedAcl sets the optional parameter "predefinedAcl": Apply a
  2333. // predefined set of access controls to this bucket.
  2334. //
  2335. // Possible values:
  2336. // "authenticatedRead" - Project team owners get OWNER access, and
  2337. // allAuthenticatedUsers get READER access.
  2338. // "private" - Project team owners get OWNER access.
  2339. // "projectPrivate" - Project team members get access according to
  2340. // their roles.
  2341. // "publicRead" - Project team owners get OWNER access, and allUsers
  2342. // get READER access.
  2343. // "publicReadWrite" - Project team owners get OWNER access, and
  2344. // allUsers get WRITER access.
  2345. func (c *BucketsPatchCall) PredefinedAcl(predefinedAcl string) *BucketsPatchCall {
  2346. c.urlParams_.Set("predefinedAcl", predefinedAcl)
  2347. return c
  2348. }
  2349. // PredefinedDefaultObjectAcl sets the optional parameter
  2350. // "predefinedDefaultObjectAcl": Apply a predefined set of default
  2351. // object access controls to this bucket.
  2352. //
  2353. // Possible values:
  2354. // "authenticatedRead" - Object owner gets OWNER access, and
  2355. // allAuthenticatedUsers get READER access.
  2356. // "bucketOwnerFullControl" - Object owner gets OWNER access, and
  2357. // project team owners get OWNER access.
  2358. // "bucketOwnerRead" - Object owner gets OWNER access, and project
  2359. // team owners get READER access.
  2360. // "private" - Object owner gets OWNER access.
  2361. // "projectPrivate" - Object owner gets OWNER access, and project team
  2362. // members get access according to their roles.
  2363. // "publicRead" - Object owner gets OWNER access, and allUsers get
  2364. // READER access.
  2365. func (c *BucketsPatchCall) PredefinedDefaultObjectAcl(predefinedDefaultObjectAcl string) *BucketsPatchCall {
  2366. c.urlParams_.Set("predefinedDefaultObjectAcl", predefinedDefaultObjectAcl)
  2367. return c
  2368. }
  2369. // Projection sets the optional parameter "projection": Set of
  2370. // properties to return. Defaults to full.
  2371. //
  2372. // Possible values:
  2373. // "full" - Include all properties.
  2374. // "noAcl" - Omit acl and defaultObjectAcl properties.
  2375. func (c *BucketsPatchCall) Projection(projection string) *BucketsPatchCall {
  2376. c.urlParams_.Set("projection", projection)
  2377. return c
  2378. }
  2379. // Fields allows partial responses to be retrieved. See
  2380. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2381. // for more information.
  2382. func (c *BucketsPatchCall) Fields(s ...googleapi.Field) *BucketsPatchCall {
  2383. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2384. return c
  2385. }
  2386. // Context sets the context to be used in this call's Do method. Any
  2387. // pending HTTP request will be aborted if the provided context is
  2388. // canceled.
  2389. func (c *BucketsPatchCall) Context(ctx context.Context) *BucketsPatchCall {
  2390. c.ctx_ = ctx
  2391. return c
  2392. }
  2393. func (c *BucketsPatchCall) doRequest(alt string) (*http.Response, error) {
  2394. var body io.Reader = nil
  2395. body, err := googleapi.WithoutDataWrapper.JSONReader(c.bucket2)
  2396. if err != nil {
  2397. return nil, err
  2398. }
  2399. ctype := "application/json"
  2400. c.urlParams_.Set("alt", alt)
  2401. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}")
  2402. urls += "?" + c.urlParams_.Encode()
  2403. req, _ := http.NewRequest("PATCH", urls, body)
  2404. googleapi.Expand(req.URL, map[string]string{
  2405. "bucket": c.bucket,
  2406. })
  2407. req.Header.Set("Content-Type", ctype)
  2408. req.Header.Set("User-Agent", c.s.userAgent())
  2409. if c.ctx_ != nil {
  2410. return ctxhttp.Do(c.ctx_, c.s.client, req)
  2411. }
  2412. return c.s.client.Do(req)
  2413. }
  2414. // Do executes the "storage.buckets.patch" call.
  2415. // Exactly one of *Bucket or error will be non-nil. Any non-2xx status
  2416. // code is an error. Response headers are in either
  2417. // *Bucket.ServerResponse.Header or (if a response was returned at all)
  2418. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2419. // check whether the returned error was because http.StatusNotModified
  2420. // was returned.
  2421. func (c *BucketsPatchCall) Do(opts ...googleapi.CallOption) (*Bucket, error) {
  2422. gensupport.SetOptions(c.urlParams_, opts...)
  2423. res, err := c.doRequest("json")
  2424. if res != nil && res.StatusCode == http.StatusNotModified {
  2425. if res.Body != nil {
  2426. res.Body.Close()
  2427. }
  2428. return nil, &googleapi.Error{
  2429. Code: res.StatusCode,
  2430. Header: res.Header,
  2431. }
  2432. }
  2433. if err != nil {
  2434. return nil, err
  2435. }
  2436. defer googleapi.CloseBody(res)
  2437. if err := googleapi.CheckResponse(res); err != nil {
  2438. return nil, err
  2439. }
  2440. ret := &Bucket{
  2441. ServerResponse: googleapi.ServerResponse{
  2442. Header: res.Header,
  2443. HTTPStatusCode: res.StatusCode,
  2444. },
  2445. }
  2446. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  2447. return nil, err
  2448. }
  2449. return ret, nil
  2450. // {
  2451. // "description": "Updates a bucket. This method supports patch semantics.",
  2452. // "httpMethod": "PATCH",
  2453. // "id": "storage.buckets.patch",
  2454. // "parameterOrder": [
  2455. // "bucket"
  2456. // ],
  2457. // "parameters": {
  2458. // "bucket": {
  2459. // "description": "Name of a bucket.",
  2460. // "location": "path",
  2461. // "required": true,
  2462. // "type": "string"
  2463. // },
  2464. // "ifMetagenerationMatch": {
  2465. // "description": "Makes the return of the bucket metadata conditional on whether the bucket's current metageneration matches the given value.",
  2466. // "format": "int64",
  2467. // "location": "query",
  2468. // "type": "string"
  2469. // },
  2470. // "ifMetagenerationNotMatch": {
  2471. // "description": "Makes the return of the bucket metadata conditional on whether the bucket's current metageneration does not match the given value.",
  2472. // "format": "int64",
  2473. // "location": "query",
  2474. // "type": "string"
  2475. // },
  2476. // "predefinedAcl": {
  2477. // "description": "Apply a predefined set of access controls to this bucket.",
  2478. // "enum": [
  2479. // "authenticatedRead",
  2480. // "private",
  2481. // "projectPrivate",
  2482. // "publicRead",
  2483. // "publicReadWrite"
  2484. // ],
  2485. // "enumDescriptions": [
  2486. // "Project team owners get OWNER access, and allAuthenticatedUsers get READER access.",
  2487. // "Project team owners get OWNER access.",
  2488. // "Project team members get access according to their roles.",
  2489. // "Project team owners get OWNER access, and allUsers get READER access.",
  2490. // "Project team owners get OWNER access, and allUsers get WRITER access."
  2491. // ],
  2492. // "location": "query",
  2493. // "type": "string"
  2494. // },
  2495. // "predefinedDefaultObjectAcl": {
  2496. // "description": "Apply a predefined set of default object access controls to this bucket.",
  2497. // "enum": [
  2498. // "authenticatedRead",
  2499. // "bucketOwnerFullControl",
  2500. // "bucketOwnerRead",
  2501. // "private",
  2502. // "projectPrivate",
  2503. // "publicRead"
  2504. // ],
  2505. // "enumDescriptions": [
  2506. // "Object owner gets OWNER access, and allAuthenticatedUsers get READER access.",
  2507. // "Object owner gets OWNER access, and project team owners get OWNER access.",
  2508. // "Object owner gets OWNER access, and project team owners get READER access.",
  2509. // "Object owner gets OWNER access.",
  2510. // "Object owner gets OWNER access, and project team members get access according to their roles.",
  2511. // "Object owner gets OWNER access, and allUsers get READER access."
  2512. // ],
  2513. // "location": "query",
  2514. // "type": "string"
  2515. // },
  2516. // "projection": {
  2517. // "description": "Set of properties to return. Defaults to full.",
  2518. // "enum": [
  2519. // "full",
  2520. // "noAcl"
  2521. // ],
  2522. // "enumDescriptions": [
  2523. // "Include all properties.",
  2524. // "Omit acl and defaultObjectAcl properties."
  2525. // ],
  2526. // "location": "query",
  2527. // "type": "string"
  2528. // }
  2529. // },
  2530. // "path": "b/{bucket}",
  2531. // "request": {
  2532. // "$ref": "Bucket"
  2533. // },
  2534. // "response": {
  2535. // "$ref": "Bucket"
  2536. // },
  2537. // "scopes": [
  2538. // "https://www.googleapis.com/auth/cloud-platform",
  2539. // "https://www.googleapis.com/auth/devstorage.full_control",
  2540. // "https://www.googleapis.com/auth/devstorage.read_write"
  2541. // ]
  2542. // }
  2543. }
  2544. // method id "storage.buckets.update":
  2545. type BucketsUpdateCall struct {
  2546. s *Service
  2547. bucket string
  2548. bucket2 *Bucket
  2549. urlParams_ gensupport.URLParams
  2550. ctx_ context.Context
  2551. }
  2552. // Update: Updates a bucket.
  2553. func (r *BucketsService) Update(bucket string, bucket2 *Bucket) *BucketsUpdateCall {
  2554. c := &BucketsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2555. c.bucket = bucket
  2556. c.bucket2 = bucket2
  2557. return c
  2558. }
  2559. // IfMetagenerationMatch sets the optional parameter
  2560. // "ifMetagenerationMatch": Makes the return of the bucket metadata
  2561. // conditional on whether the bucket's current metageneration matches
  2562. // the given value.
  2563. func (c *BucketsUpdateCall) IfMetagenerationMatch(ifMetagenerationMatch int64) *BucketsUpdateCall {
  2564. c.urlParams_.Set("ifMetagenerationMatch", fmt.Sprint(ifMetagenerationMatch))
  2565. return c
  2566. }
  2567. // IfMetagenerationNotMatch sets the optional parameter
  2568. // "ifMetagenerationNotMatch": Makes the return of the bucket metadata
  2569. // conditional on whether the bucket's current metageneration does not
  2570. // match the given value.
  2571. func (c *BucketsUpdateCall) IfMetagenerationNotMatch(ifMetagenerationNotMatch int64) *BucketsUpdateCall {
  2572. c.urlParams_.Set("ifMetagenerationNotMatch", fmt.Sprint(ifMetagenerationNotMatch))
  2573. return c
  2574. }
  2575. // PredefinedAcl sets the optional parameter "predefinedAcl": Apply a
  2576. // predefined set of access controls to this bucket.
  2577. //
  2578. // Possible values:
  2579. // "authenticatedRead" - Project team owners get OWNER access, and
  2580. // allAuthenticatedUsers get READER access.
  2581. // "private" - Project team owners get OWNER access.
  2582. // "projectPrivate" - Project team members get access according to
  2583. // their roles.
  2584. // "publicRead" - Project team owners get OWNER access, and allUsers
  2585. // get READER access.
  2586. // "publicReadWrite" - Project team owners get OWNER access, and
  2587. // allUsers get WRITER access.
  2588. func (c *BucketsUpdateCall) PredefinedAcl(predefinedAcl string) *BucketsUpdateCall {
  2589. c.urlParams_.Set("predefinedAcl", predefinedAcl)
  2590. return c
  2591. }
  2592. // PredefinedDefaultObjectAcl sets the optional parameter
  2593. // "predefinedDefaultObjectAcl": Apply a predefined set of default
  2594. // object access controls to this bucket.
  2595. //
  2596. // Possible values:
  2597. // "authenticatedRead" - Object owner gets OWNER access, and
  2598. // allAuthenticatedUsers get READER access.
  2599. // "bucketOwnerFullControl" - Object owner gets OWNER access, and
  2600. // project team owners get OWNER access.
  2601. // "bucketOwnerRead" - Object owner gets OWNER access, and project
  2602. // team owners get READER access.
  2603. // "private" - Object owner gets OWNER access.
  2604. // "projectPrivate" - Object owner gets OWNER access, and project team
  2605. // members get access according to their roles.
  2606. // "publicRead" - Object owner gets OWNER access, and allUsers get
  2607. // READER access.
  2608. func (c *BucketsUpdateCall) PredefinedDefaultObjectAcl(predefinedDefaultObjectAcl string) *BucketsUpdateCall {
  2609. c.urlParams_.Set("predefinedDefaultObjectAcl", predefinedDefaultObjectAcl)
  2610. return c
  2611. }
  2612. // Projection sets the optional parameter "projection": Set of
  2613. // properties to return. Defaults to full.
  2614. //
  2615. // Possible values:
  2616. // "full" - Include all properties.
  2617. // "noAcl" - Omit acl and defaultObjectAcl properties.
  2618. func (c *BucketsUpdateCall) Projection(projection string) *BucketsUpdateCall {
  2619. c.urlParams_.Set("projection", projection)
  2620. return c
  2621. }
  2622. // Fields allows partial responses to be retrieved. See
  2623. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2624. // for more information.
  2625. func (c *BucketsUpdateCall) Fields(s ...googleapi.Field) *BucketsUpdateCall {
  2626. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2627. return c
  2628. }
  2629. // Context sets the context to be used in this call's Do method. Any
  2630. // pending HTTP request will be aborted if the provided context is
  2631. // canceled.
  2632. func (c *BucketsUpdateCall) Context(ctx context.Context) *BucketsUpdateCall {
  2633. c.ctx_ = ctx
  2634. return c
  2635. }
  2636. func (c *BucketsUpdateCall) doRequest(alt string) (*http.Response, error) {
  2637. var body io.Reader = nil
  2638. body, err := googleapi.WithoutDataWrapper.JSONReader(c.bucket2)
  2639. if err != nil {
  2640. return nil, err
  2641. }
  2642. ctype := "application/json"
  2643. c.urlParams_.Set("alt", alt)
  2644. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}")
  2645. urls += "?" + c.urlParams_.Encode()
  2646. req, _ := http.NewRequest("PUT", urls, body)
  2647. googleapi.Expand(req.URL, map[string]string{
  2648. "bucket": c.bucket,
  2649. })
  2650. req.Header.Set("Content-Type", ctype)
  2651. req.Header.Set("User-Agent", c.s.userAgent())
  2652. if c.ctx_ != nil {
  2653. return ctxhttp.Do(c.ctx_, c.s.client, req)
  2654. }
  2655. return c.s.client.Do(req)
  2656. }
  2657. // Do executes the "storage.buckets.update" call.
  2658. // Exactly one of *Bucket or error will be non-nil. Any non-2xx status
  2659. // code is an error. Response headers are in either
  2660. // *Bucket.ServerResponse.Header or (if a response was returned at all)
  2661. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2662. // check whether the returned error was because http.StatusNotModified
  2663. // was returned.
  2664. func (c *BucketsUpdateCall) Do(opts ...googleapi.CallOption) (*Bucket, error) {
  2665. gensupport.SetOptions(c.urlParams_, opts...)
  2666. res, err := c.doRequest("json")
  2667. if res != nil && res.StatusCode == http.StatusNotModified {
  2668. if res.Body != nil {
  2669. res.Body.Close()
  2670. }
  2671. return nil, &googleapi.Error{
  2672. Code: res.StatusCode,
  2673. Header: res.Header,
  2674. }
  2675. }
  2676. if err != nil {
  2677. return nil, err
  2678. }
  2679. defer googleapi.CloseBody(res)
  2680. if err := googleapi.CheckResponse(res); err != nil {
  2681. return nil, err
  2682. }
  2683. ret := &Bucket{
  2684. ServerResponse: googleapi.ServerResponse{
  2685. Header: res.Header,
  2686. HTTPStatusCode: res.StatusCode,
  2687. },
  2688. }
  2689. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  2690. return nil, err
  2691. }
  2692. return ret, nil
  2693. // {
  2694. // "description": "Updates a bucket.",
  2695. // "httpMethod": "PUT",
  2696. // "id": "storage.buckets.update",
  2697. // "parameterOrder": [
  2698. // "bucket"
  2699. // ],
  2700. // "parameters": {
  2701. // "bucket": {
  2702. // "description": "Name of a bucket.",
  2703. // "location": "path",
  2704. // "required": true,
  2705. // "type": "string"
  2706. // },
  2707. // "ifMetagenerationMatch": {
  2708. // "description": "Makes the return of the bucket metadata conditional on whether the bucket's current metageneration matches the given value.",
  2709. // "format": "int64",
  2710. // "location": "query",
  2711. // "type": "string"
  2712. // },
  2713. // "ifMetagenerationNotMatch": {
  2714. // "description": "Makes the return of the bucket metadata conditional on whether the bucket's current metageneration does not match the given value.",
  2715. // "format": "int64",
  2716. // "location": "query",
  2717. // "type": "string"
  2718. // },
  2719. // "predefinedAcl": {
  2720. // "description": "Apply a predefined set of access controls to this bucket.",
  2721. // "enum": [
  2722. // "authenticatedRead",
  2723. // "private",
  2724. // "projectPrivate",
  2725. // "publicRead",
  2726. // "publicReadWrite"
  2727. // ],
  2728. // "enumDescriptions": [
  2729. // "Project team owners get OWNER access, and allAuthenticatedUsers get READER access.",
  2730. // "Project team owners get OWNER access.",
  2731. // "Project team members get access according to their roles.",
  2732. // "Project team owners get OWNER access, and allUsers get READER access.",
  2733. // "Project team owners get OWNER access, and allUsers get WRITER access."
  2734. // ],
  2735. // "location": "query",
  2736. // "type": "string"
  2737. // },
  2738. // "predefinedDefaultObjectAcl": {
  2739. // "description": "Apply a predefined set of default object access controls to this bucket.",
  2740. // "enum": [
  2741. // "authenticatedRead",
  2742. // "bucketOwnerFullControl",
  2743. // "bucketOwnerRead",
  2744. // "private",
  2745. // "projectPrivate",
  2746. // "publicRead"
  2747. // ],
  2748. // "enumDescriptions": [
  2749. // "Object owner gets OWNER access, and allAuthenticatedUsers get READER access.",
  2750. // "Object owner gets OWNER access, and project team owners get OWNER access.",
  2751. // "Object owner gets OWNER access, and project team owners get READER access.",
  2752. // "Object owner gets OWNER access.",
  2753. // "Object owner gets OWNER access, and project team members get access according to their roles.",
  2754. // "Object owner gets OWNER access, and allUsers get READER access."
  2755. // ],
  2756. // "location": "query",
  2757. // "type": "string"
  2758. // },
  2759. // "projection": {
  2760. // "description": "Set of properties to return. Defaults to full.",
  2761. // "enum": [
  2762. // "full",
  2763. // "noAcl"
  2764. // ],
  2765. // "enumDescriptions": [
  2766. // "Include all properties.",
  2767. // "Omit acl and defaultObjectAcl properties."
  2768. // ],
  2769. // "location": "query",
  2770. // "type": "string"
  2771. // }
  2772. // },
  2773. // "path": "b/{bucket}",
  2774. // "request": {
  2775. // "$ref": "Bucket"
  2776. // },
  2777. // "response": {
  2778. // "$ref": "Bucket"
  2779. // },
  2780. // "scopes": [
  2781. // "https://www.googleapis.com/auth/cloud-platform",
  2782. // "https://www.googleapis.com/auth/devstorage.full_control",
  2783. // "https://www.googleapis.com/auth/devstorage.read_write"
  2784. // ]
  2785. // }
  2786. }
  2787. // method id "storage.channels.stop":
  2788. type ChannelsStopCall struct {
  2789. s *Service
  2790. channel *Channel
  2791. urlParams_ gensupport.URLParams
  2792. ctx_ context.Context
  2793. }
  2794. // Stop: Stop watching resources through this channel
  2795. func (r *ChannelsService) Stop(channel *Channel) *ChannelsStopCall {
  2796. c := &ChannelsStopCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2797. c.channel = channel
  2798. return c
  2799. }
  2800. // Fields allows partial responses to be retrieved. See
  2801. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2802. // for more information.
  2803. func (c *ChannelsStopCall) Fields(s ...googleapi.Field) *ChannelsStopCall {
  2804. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2805. return c
  2806. }
  2807. // Context sets the context to be used in this call's Do method. Any
  2808. // pending HTTP request will be aborted if the provided context is
  2809. // canceled.
  2810. func (c *ChannelsStopCall) Context(ctx context.Context) *ChannelsStopCall {
  2811. c.ctx_ = ctx
  2812. return c
  2813. }
  2814. func (c *ChannelsStopCall) doRequest(alt string) (*http.Response, error) {
  2815. var body io.Reader = nil
  2816. body, err := googleapi.WithoutDataWrapper.JSONReader(c.channel)
  2817. if err != nil {
  2818. return nil, err
  2819. }
  2820. ctype := "application/json"
  2821. c.urlParams_.Set("alt", alt)
  2822. urls := googleapi.ResolveRelative(c.s.BasePath, "channels/stop")
  2823. urls += "?" + c.urlParams_.Encode()
  2824. req, _ := http.NewRequest("POST", urls, body)
  2825. googleapi.SetOpaque(req.URL)
  2826. req.Header.Set("Content-Type", ctype)
  2827. req.Header.Set("User-Agent", c.s.userAgent())
  2828. if c.ctx_ != nil {
  2829. return ctxhttp.Do(c.ctx_, c.s.client, req)
  2830. }
  2831. return c.s.client.Do(req)
  2832. }
  2833. // Do executes the "storage.channels.stop" call.
  2834. func (c *ChannelsStopCall) Do(opts ...googleapi.CallOption) error {
  2835. gensupport.SetOptions(c.urlParams_, opts...)
  2836. res, err := c.doRequest("json")
  2837. if err != nil {
  2838. return err
  2839. }
  2840. defer googleapi.CloseBody(res)
  2841. if err := googleapi.CheckResponse(res); err != nil {
  2842. return err
  2843. }
  2844. return nil
  2845. // {
  2846. // "description": "Stop watching resources through this channel",
  2847. // "httpMethod": "POST",
  2848. // "id": "storage.channels.stop",
  2849. // "path": "channels/stop",
  2850. // "request": {
  2851. // "$ref": "Channel",
  2852. // "parameterName": "resource"
  2853. // },
  2854. // "scopes": [
  2855. // "https://www.googleapis.com/auth/cloud-platform",
  2856. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  2857. // "https://www.googleapis.com/auth/devstorage.full_control",
  2858. // "https://www.googleapis.com/auth/devstorage.read_only",
  2859. // "https://www.googleapis.com/auth/devstorage.read_write"
  2860. // ]
  2861. // }
  2862. }
  2863. // method id "storage.defaultObjectAccessControls.delete":
  2864. type DefaultObjectAccessControlsDeleteCall struct {
  2865. s *Service
  2866. bucket string
  2867. entity string
  2868. urlParams_ gensupport.URLParams
  2869. ctx_ context.Context
  2870. }
  2871. // Delete: Permanently deletes the default object ACL entry for the
  2872. // specified entity on the specified bucket.
  2873. func (r *DefaultObjectAccessControlsService) Delete(bucket string, entity string) *DefaultObjectAccessControlsDeleteCall {
  2874. c := &DefaultObjectAccessControlsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2875. c.bucket = bucket
  2876. c.entity = entity
  2877. return c
  2878. }
  2879. // Fields allows partial responses to be retrieved. See
  2880. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2881. // for more information.
  2882. func (c *DefaultObjectAccessControlsDeleteCall) Fields(s ...googleapi.Field) *DefaultObjectAccessControlsDeleteCall {
  2883. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2884. return c
  2885. }
  2886. // Context sets the context to be used in this call's Do method. Any
  2887. // pending HTTP request will be aborted if the provided context is
  2888. // canceled.
  2889. func (c *DefaultObjectAccessControlsDeleteCall) Context(ctx context.Context) *DefaultObjectAccessControlsDeleteCall {
  2890. c.ctx_ = ctx
  2891. return c
  2892. }
  2893. func (c *DefaultObjectAccessControlsDeleteCall) doRequest(alt string) (*http.Response, error) {
  2894. var body io.Reader = nil
  2895. c.urlParams_.Set("alt", alt)
  2896. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/defaultObjectAcl/{entity}")
  2897. urls += "?" + c.urlParams_.Encode()
  2898. req, _ := http.NewRequest("DELETE", urls, body)
  2899. googleapi.Expand(req.URL, map[string]string{
  2900. "bucket": c.bucket,
  2901. "entity": c.entity,
  2902. })
  2903. req.Header.Set("User-Agent", c.s.userAgent())
  2904. if c.ctx_ != nil {
  2905. return ctxhttp.Do(c.ctx_, c.s.client, req)
  2906. }
  2907. return c.s.client.Do(req)
  2908. }
  2909. // Do executes the "storage.defaultObjectAccessControls.delete" call.
  2910. func (c *DefaultObjectAccessControlsDeleteCall) Do(opts ...googleapi.CallOption) error {
  2911. gensupport.SetOptions(c.urlParams_, opts...)
  2912. res, err := c.doRequest("json")
  2913. if err != nil {
  2914. return err
  2915. }
  2916. defer googleapi.CloseBody(res)
  2917. if err := googleapi.CheckResponse(res); err != nil {
  2918. return err
  2919. }
  2920. return nil
  2921. // {
  2922. // "description": "Permanently deletes the default object ACL entry for the specified entity on the specified bucket.",
  2923. // "httpMethod": "DELETE",
  2924. // "id": "storage.defaultObjectAccessControls.delete",
  2925. // "parameterOrder": [
  2926. // "bucket",
  2927. // "entity"
  2928. // ],
  2929. // "parameters": {
  2930. // "bucket": {
  2931. // "description": "Name of a bucket.",
  2932. // "location": "path",
  2933. // "required": true,
  2934. // "type": "string"
  2935. // },
  2936. // "entity": {
  2937. // "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.",
  2938. // "location": "path",
  2939. // "required": true,
  2940. // "type": "string"
  2941. // }
  2942. // },
  2943. // "path": "b/{bucket}/defaultObjectAcl/{entity}",
  2944. // "scopes": [
  2945. // "https://www.googleapis.com/auth/cloud-platform",
  2946. // "https://www.googleapis.com/auth/devstorage.full_control"
  2947. // ]
  2948. // }
  2949. }
  2950. // method id "storage.defaultObjectAccessControls.get":
  2951. type DefaultObjectAccessControlsGetCall struct {
  2952. s *Service
  2953. bucket string
  2954. entity string
  2955. urlParams_ gensupport.URLParams
  2956. ifNoneMatch_ string
  2957. ctx_ context.Context
  2958. }
  2959. // Get: Returns the default object ACL entry for the specified entity on
  2960. // the specified bucket.
  2961. func (r *DefaultObjectAccessControlsService) Get(bucket string, entity string) *DefaultObjectAccessControlsGetCall {
  2962. c := &DefaultObjectAccessControlsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2963. c.bucket = bucket
  2964. c.entity = entity
  2965. return c
  2966. }
  2967. // Fields allows partial responses to be retrieved. See
  2968. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2969. // for more information.
  2970. func (c *DefaultObjectAccessControlsGetCall) Fields(s ...googleapi.Field) *DefaultObjectAccessControlsGetCall {
  2971. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2972. return c
  2973. }
  2974. // IfNoneMatch sets the optional parameter which makes the operation
  2975. // fail if the object's ETag matches the given value. This is useful for
  2976. // getting updates only after the object has changed since the last
  2977. // request. Use googleapi.IsNotModified to check whether the response
  2978. // error from Do is the result of In-None-Match.
  2979. func (c *DefaultObjectAccessControlsGetCall) IfNoneMatch(entityTag string) *DefaultObjectAccessControlsGetCall {
  2980. c.ifNoneMatch_ = entityTag
  2981. return c
  2982. }
  2983. // Context sets the context to be used in this call's Do method. Any
  2984. // pending HTTP request will be aborted if the provided context is
  2985. // canceled.
  2986. func (c *DefaultObjectAccessControlsGetCall) Context(ctx context.Context) *DefaultObjectAccessControlsGetCall {
  2987. c.ctx_ = ctx
  2988. return c
  2989. }
  2990. func (c *DefaultObjectAccessControlsGetCall) doRequest(alt string) (*http.Response, error) {
  2991. var body io.Reader = nil
  2992. c.urlParams_.Set("alt", alt)
  2993. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/defaultObjectAcl/{entity}")
  2994. urls += "?" + c.urlParams_.Encode()
  2995. req, _ := http.NewRequest("GET", urls, body)
  2996. googleapi.Expand(req.URL, map[string]string{
  2997. "bucket": c.bucket,
  2998. "entity": c.entity,
  2999. })
  3000. req.Header.Set("User-Agent", c.s.userAgent())
  3001. if c.ifNoneMatch_ != "" {
  3002. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  3003. }
  3004. if c.ctx_ != nil {
  3005. return ctxhttp.Do(c.ctx_, c.s.client, req)
  3006. }
  3007. return c.s.client.Do(req)
  3008. }
  3009. // Do executes the "storage.defaultObjectAccessControls.get" call.
  3010. // Exactly one of *ObjectAccessControl or error will be non-nil. Any
  3011. // non-2xx status code is an error. Response headers are in either
  3012. // *ObjectAccessControl.ServerResponse.Header or (if a response was
  3013. // returned at all) in error.(*googleapi.Error).Header. Use
  3014. // googleapi.IsNotModified to check whether the returned error was
  3015. // because http.StatusNotModified was returned.
  3016. func (c *DefaultObjectAccessControlsGetCall) Do(opts ...googleapi.CallOption) (*ObjectAccessControl, error) {
  3017. gensupport.SetOptions(c.urlParams_, opts...)
  3018. res, err := c.doRequest("json")
  3019. if res != nil && res.StatusCode == http.StatusNotModified {
  3020. if res.Body != nil {
  3021. res.Body.Close()
  3022. }
  3023. return nil, &googleapi.Error{
  3024. Code: res.StatusCode,
  3025. Header: res.Header,
  3026. }
  3027. }
  3028. if err != nil {
  3029. return nil, err
  3030. }
  3031. defer googleapi.CloseBody(res)
  3032. if err := googleapi.CheckResponse(res); err != nil {
  3033. return nil, err
  3034. }
  3035. ret := &ObjectAccessControl{
  3036. ServerResponse: googleapi.ServerResponse{
  3037. Header: res.Header,
  3038. HTTPStatusCode: res.StatusCode,
  3039. },
  3040. }
  3041. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  3042. return nil, err
  3043. }
  3044. return ret, nil
  3045. // {
  3046. // "description": "Returns the default object ACL entry for the specified entity on the specified bucket.",
  3047. // "httpMethod": "GET",
  3048. // "id": "storage.defaultObjectAccessControls.get",
  3049. // "parameterOrder": [
  3050. // "bucket",
  3051. // "entity"
  3052. // ],
  3053. // "parameters": {
  3054. // "bucket": {
  3055. // "description": "Name of a bucket.",
  3056. // "location": "path",
  3057. // "required": true,
  3058. // "type": "string"
  3059. // },
  3060. // "entity": {
  3061. // "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.",
  3062. // "location": "path",
  3063. // "required": true,
  3064. // "type": "string"
  3065. // }
  3066. // },
  3067. // "path": "b/{bucket}/defaultObjectAcl/{entity}",
  3068. // "response": {
  3069. // "$ref": "ObjectAccessControl"
  3070. // },
  3071. // "scopes": [
  3072. // "https://www.googleapis.com/auth/cloud-platform",
  3073. // "https://www.googleapis.com/auth/devstorage.full_control"
  3074. // ]
  3075. // }
  3076. }
  3077. // method id "storage.defaultObjectAccessControls.insert":
  3078. type DefaultObjectAccessControlsInsertCall struct {
  3079. s *Service
  3080. bucket string
  3081. objectaccesscontrol *ObjectAccessControl
  3082. urlParams_ gensupport.URLParams
  3083. ctx_ context.Context
  3084. }
  3085. // Insert: Creates a new default object ACL entry on the specified
  3086. // bucket.
  3087. func (r *DefaultObjectAccessControlsService) Insert(bucket string, objectaccesscontrol *ObjectAccessControl) *DefaultObjectAccessControlsInsertCall {
  3088. c := &DefaultObjectAccessControlsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3089. c.bucket = bucket
  3090. c.objectaccesscontrol = objectaccesscontrol
  3091. return c
  3092. }
  3093. // Fields allows partial responses to be retrieved. See
  3094. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3095. // for more information.
  3096. func (c *DefaultObjectAccessControlsInsertCall) Fields(s ...googleapi.Field) *DefaultObjectAccessControlsInsertCall {
  3097. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3098. return c
  3099. }
  3100. // Context sets the context to be used in this call's Do method. Any
  3101. // pending HTTP request will be aborted if the provided context is
  3102. // canceled.
  3103. func (c *DefaultObjectAccessControlsInsertCall) Context(ctx context.Context) *DefaultObjectAccessControlsInsertCall {
  3104. c.ctx_ = ctx
  3105. return c
  3106. }
  3107. func (c *DefaultObjectAccessControlsInsertCall) doRequest(alt string) (*http.Response, error) {
  3108. var body io.Reader = nil
  3109. body, err := googleapi.WithoutDataWrapper.JSONReader(c.objectaccesscontrol)
  3110. if err != nil {
  3111. return nil, err
  3112. }
  3113. ctype := "application/json"
  3114. c.urlParams_.Set("alt", alt)
  3115. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/defaultObjectAcl")
  3116. urls += "?" + c.urlParams_.Encode()
  3117. req, _ := http.NewRequest("POST", urls, body)
  3118. googleapi.Expand(req.URL, map[string]string{
  3119. "bucket": c.bucket,
  3120. })
  3121. req.Header.Set("Content-Type", ctype)
  3122. req.Header.Set("User-Agent", c.s.userAgent())
  3123. if c.ctx_ != nil {
  3124. return ctxhttp.Do(c.ctx_, c.s.client, req)
  3125. }
  3126. return c.s.client.Do(req)
  3127. }
  3128. // Do executes the "storage.defaultObjectAccessControls.insert" call.
  3129. // Exactly one of *ObjectAccessControl or error will be non-nil. Any
  3130. // non-2xx status code is an error. Response headers are in either
  3131. // *ObjectAccessControl.ServerResponse.Header or (if a response was
  3132. // returned at all) in error.(*googleapi.Error).Header. Use
  3133. // googleapi.IsNotModified to check whether the returned error was
  3134. // because http.StatusNotModified was returned.
  3135. func (c *DefaultObjectAccessControlsInsertCall) Do(opts ...googleapi.CallOption) (*ObjectAccessControl, error) {
  3136. gensupport.SetOptions(c.urlParams_, opts...)
  3137. res, err := c.doRequest("json")
  3138. if res != nil && res.StatusCode == http.StatusNotModified {
  3139. if res.Body != nil {
  3140. res.Body.Close()
  3141. }
  3142. return nil, &googleapi.Error{
  3143. Code: res.StatusCode,
  3144. Header: res.Header,
  3145. }
  3146. }
  3147. if err != nil {
  3148. return nil, err
  3149. }
  3150. defer googleapi.CloseBody(res)
  3151. if err := googleapi.CheckResponse(res); err != nil {
  3152. return nil, err
  3153. }
  3154. ret := &ObjectAccessControl{
  3155. ServerResponse: googleapi.ServerResponse{
  3156. Header: res.Header,
  3157. HTTPStatusCode: res.StatusCode,
  3158. },
  3159. }
  3160. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  3161. return nil, err
  3162. }
  3163. return ret, nil
  3164. // {
  3165. // "description": "Creates a new default object ACL entry on the specified bucket.",
  3166. // "httpMethod": "POST",
  3167. // "id": "storage.defaultObjectAccessControls.insert",
  3168. // "parameterOrder": [
  3169. // "bucket"
  3170. // ],
  3171. // "parameters": {
  3172. // "bucket": {
  3173. // "description": "Name of a bucket.",
  3174. // "location": "path",
  3175. // "required": true,
  3176. // "type": "string"
  3177. // }
  3178. // },
  3179. // "path": "b/{bucket}/defaultObjectAcl",
  3180. // "request": {
  3181. // "$ref": "ObjectAccessControl"
  3182. // },
  3183. // "response": {
  3184. // "$ref": "ObjectAccessControl"
  3185. // },
  3186. // "scopes": [
  3187. // "https://www.googleapis.com/auth/cloud-platform",
  3188. // "https://www.googleapis.com/auth/devstorage.full_control"
  3189. // ]
  3190. // }
  3191. }
  3192. // method id "storage.defaultObjectAccessControls.list":
  3193. type DefaultObjectAccessControlsListCall struct {
  3194. s *Service
  3195. bucket string
  3196. urlParams_ gensupport.URLParams
  3197. ifNoneMatch_ string
  3198. ctx_ context.Context
  3199. }
  3200. // List: Retrieves default object ACL entries on the specified bucket.
  3201. func (r *DefaultObjectAccessControlsService) List(bucket string) *DefaultObjectAccessControlsListCall {
  3202. c := &DefaultObjectAccessControlsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3203. c.bucket = bucket
  3204. return c
  3205. }
  3206. // IfMetagenerationMatch sets the optional parameter
  3207. // "ifMetagenerationMatch": If present, only return default ACL listing
  3208. // if the bucket's current metageneration matches this value.
  3209. func (c *DefaultObjectAccessControlsListCall) IfMetagenerationMatch(ifMetagenerationMatch int64) *DefaultObjectAccessControlsListCall {
  3210. c.urlParams_.Set("ifMetagenerationMatch", fmt.Sprint(ifMetagenerationMatch))
  3211. return c
  3212. }
  3213. // IfMetagenerationNotMatch sets the optional parameter
  3214. // "ifMetagenerationNotMatch": If present, only return default ACL
  3215. // listing if the bucket's current metageneration does not match the
  3216. // given value.
  3217. func (c *DefaultObjectAccessControlsListCall) IfMetagenerationNotMatch(ifMetagenerationNotMatch int64) *DefaultObjectAccessControlsListCall {
  3218. c.urlParams_.Set("ifMetagenerationNotMatch", fmt.Sprint(ifMetagenerationNotMatch))
  3219. return c
  3220. }
  3221. // Fields allows partial responses to be retrieved. See
  3222. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3223. // for more information.
  3224. func (c *DefaultObjectAccessControlsListCall) Fields(s ...googleapi.Field) *DefaultObjectAccessControlsListCall {
  3225. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3226. return c
  3227. }
  3228. // IfNoneMatch sets the optional parameter which makes the operation
  3229. // fail if the object's ETag matches the given value. This is useful for
  3230. // getting updates only after the object has changed since the last
  3231. // request. Use googleapi.IsNotModified to check whether the response
  3232. // error from Do is the result of In-None-Match.
  3233. func (c *DefaultObjectAccessControlsListCall) IfNoneMatch(entityTag string) *DefaultObjectAccessControlsListCall {
  3234. c.ifNoneMatch_ = entityTag
  3235. return c
  3236. }
  3237. // Context sets the context to be used in this call's Do method. Any
  3238. // pending HTTP request will be aborted if the provided context is
  3239. // canceled.
  3240. func (c *DefaultObjectAccessControlsListCall) Context(ctx context.Context) *DefaultObjectAccessControlsListCall {
  3241. c.ctx_ = ctx
  3242. return c
  3243. }
  3244. func (c *DefaultObjectAccessControlsListCall) doRequest(alt string) (*http.Response, error) {
  3245. var body io.Reader = nil
  3246. c.urlParams_.Set("alt", alt)
  3247. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/defaultObjectAcl")
  3248. urls += "?" + c.urlParams_.Encode()
  3249. req, _ := http.NewRequest("GET", urls, body)
  3250. googleapi.Expand(req.URL, map[string]string{
  3251. "bucket": c.bucket,
  3252. })
  3253. req.Header.Set("User-Agent", c.s.userAgent())
  3254. if c.ifNoneMatch_ != "" {
  3255. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  3256. }
  3257. if c.ctx_ != nil {
  3258. return ctxhttp.Do(c.ctx_, c.s.client, req)
  3259. }
  3260. return c.s.client.Do(req)
  3261. }
  3262. // Do executes the "storage.defaultObjectAccessControls.list" call.
  3263. // Exactly one of *ObjectAccessControls or error will be non-nil. Any
  3264. // non-2xx status code is an error. Response headers are in either
  3265. // *ObjectAccessControls.ServerResponse.Header or (if a response was
  3266. // returned at all) in error.(*googleapi.Error).Header. Use
  3267. // googleapi.IsNotModified to check whether the returned error was
  3268. // because http.StatusNotModified was returned.
  3269. func (c *DefaultObjectAccessControlsListCall) Do(opts ...googleapi.CallOption) (*ObjectAccessControls, error) {
  3270. gensupport.SetOptions(c.urlParams_, opts...)
  3271. res, err := c.doRequest("json")
  3272. if res != nil && res.StatusCode == http.StatusNotModified {
  3273. if res.Body != nil {
  3274. res.Body.Close()
  3275. }
  3276. return nil, &googleapi.Error{
  3277. Code: res.StatusCode,
  3278. Header: res.Header,
  3279. }
  3280. }
  3281. if err != nil {
  3282. return nil, err
  3283. }
  3284. defer googleapi.CloseBody(res)
  3285. if err := googleapi.CheckResponse(res); err != nil {
  3286. return nil, err
  3287. }
  3288. ret := &ObjectAccessControls{
  3289. ServerResponse: googleapi.ServerResponse{
  3290. Header: res.Header,
  3291. HTTPStatusCode: res.StatusCode,
  3292. },
  3293. }
  3294. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  3295. return nil, err
  3296. }
  3297. return ret, nil
  3298. // {
  3299. // "description": "Retrieves default object ACL entries on the specified bucket.",
  3300. // "httpMethod": "GET",
  3301. // "id": "storage.defaultObjectAccessControls.list",
  3302. // "parameterOrder": [
  3303. // "bucket"
  3304. // ],
  3305. // "parameters": {
  3306. // "bucket": {
  3307. // "description": "Name of a bucket.",
  3308. // "location": "path",
  3309. // "required": true,
  3310. // "type": "string"
  3311. // },
  3312. // "ifMetagenerationMatch": {
  3313. // "description": "If present, only return default ACL listing if the bucket's current metageneration matches this value.",
  3314. // "format": "int64",
  3315. // "location": "query",
  3316. // "type": "string"
  3317. // },
  3318. // "ifMetagenerationNotMatch": {
  3319. // "description": "If present, only return default ACL listing if the bucket's current metageneration does not match the given value.",
  3320. // "format": "int64",
  3321. // "location": "query",
  3322. // "type": "string"
  3323. // }
  3324. // },
  3325. // "path": "b/{bucket}/defaultObjectAcl",
  3326. // "response": {
  3327. // "$ref": "ObjectAccessControls"
  3328. // },
  3329. // "scopes": [
  3330. // "https://www.googleapis.com/auth/cloud-platform",
  3331. // "https://www.googleapis.com/auth/devstorage.full_control"
  3332. // ]
  3333. // }
  3334. }
  3335. // method id "storage.defaultObjectAccessControls.patch":
  3336. type DefaultObjectAccessControlsPatchCall struct {
  3337. s *Service
  3338. bucket string
  3339. entity string
  3340. objectaccesscontrol *ObjectAccessControl
  3341. urlParams_ gensupport.URLParams
  3342. ctx_ context.Context
  3343. }
  3344. // Patch: Updates a default object ACL entry on the specified bucket.
  3345. // This method supports patch semantics.
  3346. func (r *DefaultObjectAccessControlsService) Patch(bucket string, entity string, objectaccesscontrol *ObjectAccessControl) *DefaultObjectAccessControlsPatchCall {
  3347. c := &DefaultObjectAccessControlsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3348. c.bucket = bucket
  3349. c.entity = entity
  3350. c.objectaccesscontrol = objectaccesscontrol
  3351. return c
  3352. }
  3353. // Fields allows partial responses to be retrieved. See
  3354. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3355. // for more information.
  3356. func (c *DefaultObjectAccessControlsPatchCall) Fields(s ...googleapi.Field) *DefaultObjectAccessControlsPatchCall {
  3357. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3358. return c
  3359. }
  3360. // Context sets the context to be used in this call's Do method. Any
  3361. // pending HTTP request will be aborted if the provided context is
  3362. // canceled.
  3363. func (c *DefaultObjectAccessControlsPatchCall) Context(ctx context.Context) *DefaultObjectAccessControlsPatchCall {
  3364. c.ctx_ = ctx
  3365. return c
  3366. }
  3367. func (c *DefaultObjectAccessControlsPatchCall) doRequest(alt string) (*http.Response, error) {
  3368. var body io.Reader = nil
  3369. body, err := googleapi.WithoutDataWrapper.JSONReader(c.objectaccesscontrol)
  3370. if err != nil {
  3371. return nil, err
  3372. }
  3373. ctype := "application/json"
  3374. c.urlParams_.Set("alt", alt)
  3375. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/defaultObjectAcl/{entity}")
  3376. urls += "?" + c.urlParams_.Encode()
  3377. req, _ := http.NewRequest("PATCH", urls, body)
  3378. googleapi.Expand(req.URL, map[string]string{
  3379. "bucket": c.bucket,
  3380. "entity": c.entity,
  3381. })
  3382. req.Header.Set("Content-Type", ctype)
  3383. req.Header.Set("User-Agent", c.s.userAgent())
  3384. if c.ctx_ != nil {
  3385. return ctxhttp.Do(c.ctx_, c.s.client, req)
  3386. }
  3387. return c.s.client.Do(req)
  3388. }
  3389. // Do executes the "storage.defaultObjectAccessControls.patch" call.
  3390. // Exactly one of *ObjectAccessControl or error will be non-nil. Any
  3391. // non-2xx status code is an error. Response headers are in either
  3392. // *ObjectAccessControl.ServerResponse.Header or (if a response was
  3393. // returned at all) in error.(*googleapi.Error).Header. Use
  3394. // googleapi.IsNotModified to check whether the returned error was
  3395. // because http.StatusNotModified was returned.
  3396. func (c *DefaultObjectAccessControlsPatchCall) Do(opts ...googleapi.CallOption) (*ObjectAccessControl, error) {
  3397. gensupport.SetOptions(c.urlParams_, opts...)
  3398. res, err := c.doRequest("json")
  3399. if res != nil && res.StatusCode == http.StatusNotModified {
  3400. if res.Body != nil {
  3401. res.Body.Close()
  3402. }
  3403. return nil, &googleapi.Error{
  3404. Code: res.StatusCode,
  3405. Header: res.Header,
  3406. }
  3407. }
  3408. if err != nil {
  3409. return nil, err
  3410. }
  3411. defer googleapi.CloseBody(res)
  3412. if err := googleapi.CheckResponse(res); err != nil {
  3413. return nil, err
  3414. }
  3415. ret := &ObjectAccessControl{
  3416. ServerResponse: googleapi.ServerResponse{
  3417. Header: res.Header,
  3418. HTTPStatusCode: res.StatusCode,
  3419. },
  3420. }
  3421. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  3422. return nil, err
  3423. }
  3424. return ret, nil
  3425. // {
  3426. // "description": "Updates a default object ACL entry on the specified bucket. This method supports patch semantics.",
  3427. // "httpMethod": "PATCH",
  3428. // "id": "storage.defaultObjectAccessControls.patch",
  3429. // "parameterOrder": [
  3430. // "bucket",
  3431. // "entity"
  3432. // ],
  3433. // "parameters": {
  3434. // "bucket": {
  3435. // "description": "Name of a bucket.",
  3436. // "location": "path",
  3437. // "required": true,
  3438. // "type": "string"
  3439. // },
  3440. // "entity": {
  3441. // "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.",
  3442. // "location": "path",
  3443. // "required": true,
  3444. // "type": "string"
  3445. // }
  3446. // },
  3447. // "path": "b/{bucket}/defaultObjectAcl/{entity}",
  3448. // "request": {
  3449. // "$ref": "ObjectAccessControl"
  3450. // },
  3451. // "response": {
  3452. // "$ref": "ObjectAccessControl"
  3453. // },
  3454. // "scopes": [
  3455. // "https://www.googleapis.com/auth/cloud-platform",
  3456. // "https://www.googleapis.com/auth/devstorage.full_control"
  3457. // ]
  3458. // }
  3459. }
  3460. // method id "storage.defaultObjectAccessControls.update":
  3461. type DefaultObjectAccessControlsUpdateCall struct {
  3462. s *Service
  3463. bucket string
  3464. entity string
  3465. objectaccesscontrol *ObjectAccessControl
  3466. urlParams_ gensupport.URLParams
  3467. ctx_ context.Context
  3468. }
  3469. // Update: Updates a default object ACL entry on the specified bucket.
  3470. func (r *DefaultObjectAccessControlsService) Update(bucket string, entity string, objectaccesscontrol *ObjectAccessControl) *DefaultObjectAccessControlsUpdateCall {
  3471. c := &DefaultObjectAccessControlsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3472. c.bucket = bucket
  3473. c.entity = entity
  3474. c.objectaccesscontrol = objectaccesscontrol
  3475. return c
  3476. }
  3477. // Fields allows partial responses to be retrieved. See
  3478. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3479. // for more information.
  3480. func (c *DefaultObjectAccessControlsUpdateCall) Fields(s ...googleapi.Field) *DefaultObjectAccessControlsUpdateCall {
  3481. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3482. return c
  3483. }
  3484. // Context sets the context to be used in this call's Do method. Any
  3485. // pending HTTP request will be aborted if the provided context is
  3486. // canceled.
  3487. func (c *DefaultObjectAccessControlsUpdateCall) Context(ctx context.Context) *DefaultObjectAccessControlsUpdateCall {
  3488. c.ctx_ = ctx
  3489. return c
  3490. }
  3491. func (c *DefaultObjectAccessControlsUpdateCall) doRequest(alt string) (*http.Response, error) {
  3492. var body io.Reader = nil
  3493. body, err := googleapi.WithoutDataWrapper.JSONReader(c.objectaccesscontrol)
  3494. if err != nil {
  3495. return nil, err
  3496. }
  3497. ctype := "application/json"
  3498. c.urlParams_.Set("alt", alt)
  3499. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/defaultObjectAcl/{entity}")
  3500. urls += "?" + c.urlParams_.Encode()
  3501. req, _ := http.NewRequest("PUT", urls, body)
  3502. googleapi.Expand(req.URL, map[string]string{
  3503. "bucket": c.bucket,
  3504. "entity": c.entity,
  3505. })
  3506. req.Header.Set("Content-Type", ctype)
  3507. req.Header.Set("User-Agent", c.s.userAgent())
  3508. if c.ctx_ != nil {
  3509. return ctxhttp.Do(c.ctx_, c.s.client, req)
  3510. }
  3511. return c.s.client.Do(req)
  3512. }
  3513. // Do executes the "storage.defaultObjectAccessControls.update" call.
  3514. // Exactly one of *ObjectAccessControl or error will be non-nil. Any
  3515. // non-2xx status code is an error. Response headers are in either
  3516. // *ObjectAccessControl.ServerResponse.Header or (if a response was
  3517. // returned at all) in error.(*googleapi.Error).Header. Use
  3518. // googleapi.IsNotModified to check whether the returned error was
  3519. // because http.StatusNotModified was returned.
  3520. func (c *DefaultObjectAccessControlsUpdateCall) Do(opts ...googleapi.CallOption) (*ObjectAccessControl, error) {
  3521. gensupport.SetOptions(c.urlParams_, opts...)
  3522. res, err := c.doRequest("json")
  3523. if res != nil && res.StatusCode == http.StatusNotModified {
  3524. if res.Body != nil {
  3525. res.Body.Close()
  3526. }
  3527. return nil, &googleapi.Error{
  3528. Code: res.StatusCode,
  3529. Header: res.Header,
  3530. }
  3531. }
  3532. if err != nil {
  3533. return nil, err
  3534. }
  3535. defer googleapi.CloseBody(res)
  3536. if err := googleapi.CheckResponse(res); err != nil {
  3537. return nil, err
  3538. }
  3539. ret := &ObjectAccessControl{
  3540. ServerResponse: googleapi.ServerResponse{
  3541. Header: res.Header,
  3542. HTTPStatusCode: res.StatusCode,
  3543. },
  3544. }
  3545. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  3546. return nil, err
  3547. }
  3548. return ret, nil
  3549. // {
  3550. // "description": "Updates a default object ACL entry on the specified bucket.",
  3551. // "httpMethod": "PUT",
  3552. // "id": "storage.defaultObjectAccessControls.update",
  3553. // "parameterOrder": [
  3554. // "bucket",
  3555. // "entity"
  3556. // ],
  3557. // "parameters": {
  3558. // "bucket": {
  3559. // "description": "Name of a bucket.",
  3560. // "location": "path",
  3561. // "required": true,
  3562. // "type": "string"
  3563. // },
  3564. // "entity": {
  3565. // "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.",
  3566. // "location": "path",
  3567. // "required": true,
  3568. // "type": "string"
  3569. // }
  3570. // },
  3571. // "path": "b/{bucket}/defaultObjectAcl/{entity}",
  3572. // "request": {
  3573. // "$ref": "ObjectAccessControl"
  3574. // },
  3575. // "response": {
  3576. // "$ref": "ObjectAccessControl"
  3577. // },
  3578. // "scopes": [
  3579. // "https://www.googleapis.com/auth/cloud-platform",
  3580. // "https://www.googleapis.com/auth/devstorage.full_control"
  3581. // ]
  3582. // }
  3583. }
  3584. // method id "storage.objectAccessControls.delete":
  3585. type ObjectAccessControlsDeleteCall struct {
  3586. s *Service
  3587. bucket string
  3588. object string
  3589. entity string
  3590. urlParams_ gensupport.URLParams
  3591. ctx_ context.Context
  3592. }
  3593. // Delete: Permanently deletes the ACL entry for the specified entity on
  3594. // the specified object.
  3595. func (r *ObjectAccessControlsService) Delete(bucket string, object string, entity string) *ObjectAccessControlsDeleteCall {
  3596. c := &ObjectAccessControlsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3597. c.bucket = bucket
  3598. c.object = object
  3599. c.entity = entity
  3600. return c
  3601. }
  3602. // Generation sets the optional parameter "generation": If present,
  3603. // selects a specific revision of this object (as opposed to the latest
  3604. // version, the default).
  3605. func (c *ObjectAccessControlsDeleteCall) Generation(generation int64) *ObjectAccessControlsDeleteCall {
  3606. c.urlParams_.Set("generation", fmt.Sprint(generation))
  3607. return c
  3608. }
  3609. // Fields allows partial responses to be retrieved. See
  3610. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3611. // for more information.
  3612. func (c *ObjectAccessControlsDeleteCall) Fields(s ...googleapi.Field) *ObjectAccessControlsDeleteCall {
  3613. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3614. return c
  3615. }
  3616. // Context sets the context to be used in this call's Do method. Any
  3617. // pending HTTP request will be aborted if the provided context is
  3618. // canceled.
  3619. func (c *ObjectAccessControlsDeleteCall) Context(ctx context.Context) *ObjectAccessControlsDeleteCall {
  3620. c.ctx_ = ctx
  3621. return c
  3622. }
  3623. func (c *ObjectAccessControlsDeleteCall) doRequest(alt string) (*http.Response, error) {
  3624. var body io.Reader = nil
  3625. c.urlParams_.Set("alt", alt)
  3626. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}/acl/{entity}")
  3627. urls += "?" + c.urlParams_.Encode()
  3628. req, _ := http.NewRequest("DELETE", urls, body)
  3629. googleapi.Expand(req.URL, map[string]string{
  3630. "bucket": c.bucket,
  3631. "object": c.object,
  3632. "entity": c.entity,
  3633. })
  3634. req.Header.Set("User-Agent", c.s.userAgent())
  3635. if c.ctx_ != nil {
  3636. return ctxhttp.Do(c.ctx_, c.s.client, req)
  3637. }
  3638. return c.s.client.Do(req)
  3639. }
  3640. // Do executes the "storage.objectAccessControls.delete" call.
  3641. func (c *ObjectAccessControlsDeleteCall) Do(opts ...googleapi.CallOption) error {
  3642. gensupport.SetOptions(c.urlParams_, opts...)
  3643. res, err := c.doRequest("json")
  3644. if err != nil {
  3645. return err
  3646. }
  3647. defer googleapi.CloseBody(res)
  3648. if err := googleapi.CheckResponse(res); err != nil {
  3649. return err
  3650. }
  3651. return nil
  3652. // {
  3653. // "description": "Permanently deletes the ACL entry for the specified entity on the specified object.",
  3654. // "httpMethod": "DELETE",
  3655. // "id": "storage.objectAccessControls.delete",
  3656. // "parameterOrder": [
  3657. // "bucket",
  3658. // "object",
  3659. // "entity"
  3660. // ],
  3661. // "parameters": {
  3662. // "bucket": {
  3663. // "description": "Name of a bucket.",
  3664. // "location": "path",
  3665. // "required": true,
  3666. // "type": "string"
  3667. // },
  3668. // "entity": {
  3669. // "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.",
  3670. // "location": "path",
  3671. // "required": true,
  3672. // "type": "string"
  3673. // },
  3674. // "generation": {
  3675. // "description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).",
  3676. // "format": "int64",
  3677. // "location": "query",
  3678. // "type": "string"
  3679. // },
  3680. // "object": {
  3681. // "description": "Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
  3682. // "location": "path",
  3683. // "required": true,
  3684. // "type": "string"
  3685. // }
  3686. // },
  3687. // "path": "b/{bucket}/o/{object}/acl/{entity}",
  3688. // "scopes": [
  3689. // "https://www.googleapis.com/auth/cloud-platform",
  3690. // "https://www.googleapis.com/auth/devstorage.full_control"
  3691. // ]
  3692. // }
  3693. }
  3694. // method id "storage.objectAccessControls.get":
  3695. type ObjectAccessControlsGetCall struct {
  3696. s *Service
  3697. bucket string
  3698. object string
  3699. entity string
  3700. urlParams_ gensupport.URLParams
  3701. ifNoneMatch_ string
  3702. ctx_ context.Context
  3703. }
  3704. // Get: Returns the ACL entry for the specified entity on the specified
  3705. // object.
  3706. func (r *ObjectAccessControlsService) Get(bucket string, object string, entity string) *ObjectAccessControlsGetCall {
  3707. c := &ObjectAccessControlsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3708. c.bucket = bucket
  3709. c.object = object
  3710. c.entity = entity
  3711. return c
  3712. }
  3713. // Generation sets the optional parameter "generation": If present,
  3714. // selects a specific revision of this object (as opposed to the latest
  3715. // version, the default).
  3716. func (c *ObjectAccessControlsGetCall) Generation(generation int64) *ObjectAccessControlsGetCall {
  3717. c.urlParams_.Set("generation", fmt.Sprint(generation))
  3718. return c
  3719. }
  3720. // Fields allows partial responses to be retrieved. See
  3721. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3722. // for more information.
  3723. func (c *ObjectAccessControlsGetCall) Fields(s ...googleapi.Field) *ObjectAccessControlsGetCall {
  3724. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3725. return c
  3726. }
  3727. // IfNoneMatch sets the optional parameter which makes the operation
  3728. // fail if the object's ETag matches the given value. This is useful for
  3729. // getting updates only after the object has changed since the last
  3730. // request. Use googleapi.IsNotModified to check whether the response
  3731. // error from Do is the result of In-None-Match.
  3732. func (c *ObjectAccessControlsGetCall) IfNoneMatch(entityTag string) *ObjectAccessControlsGetCall {
  3733. c.ifNoneMatch_ = entityTag
  3734. return c
  3735. }
  3736. // Context sets the context to be used in this call's Do method. Any
  3737. // pending HTTP request will be aborted if the provided context is
  3738. // canceled.
  3739. func (c *ObjectAccessControlsGetCall) Context(ctx context.Context) *ObjectAccessControlsGetCall {
  3740. c.ctx_ = ctx
  3741. return c
  3742. }
  3743. func (c *ObjectAccessControlsGetCall) doRequest(alt string) (*http.Response, error) {
  3744. var body io.Reader = nil
  3745. c.urlParams_.Set("alt", alt)
  3746. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}/acl/{entity}")
  3747. urls += "?" + c.urlParams_.Encode()
  3748. req, _ := http.NewRequest("GET", urls, body)
  3749. googleapi.Expand(req.URL, map[string]string{
  3750. "bucket": c.bucket,
  3751. "object": c.object,
  3752. "entity": c.entity,
  3753. })
  3754. req.Header.Set("User-Agent", c.s.userAgent())
  3755. if c.ifNoneMatch_ != "" {
  3756. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  3757. }
  3758. if c.ctx_ != nil {
  3759. return ctxhttp.Do(c.ctx_, c.s.client, req)
  3760. }
  3761. return c.s.client.Do(req)
  3762. }
  3763. // Do executes the "storage.objectAccessControls.get" call.
  3764. // Exactly one of *ObjectAccessControl or error will be non-nil. Any
  3765. // non-2xx status code is an error. Response headers are in either
  3766. // *ObjectAccessControl.ServerResponse.Header or (if a response was
  3767. // returned at all) in error.(*googleapi.Error).Header. Use
  3768. // googleapi.IsNotModified to check whether the returned error was
  3769. // because http.StatusNotModified was returned.
  3770. func (c *ObjectAccessControlsGetCall) Do(opts ...googleapi.CallOption) (*ObjectAccessControl, error) {
  3771. gensupport.SetOptions(c.urlParams_, opts...)
  3772. res, err := c.doRequest("json")
  3773. if res != nil && res.StatusCode == http.StatusNotModified {
  3774. if res.Body != nil {
  3775. res.Body.Close()
  3776. }
  3777. return nil, &googleapi.Error{
  3778. Code: res.StatusCode,
  3779. Header: res.Header,
  3780. }
  3781. }
  3782. if err != nil {
  3783. return nil, err
  3784. }
  3785. defer googleapi.CloseBody(res)
  3786. if err := googleapi.CheckResponse(res); err != nil {
  3787. return nil, err
  3788. }
  3789. ret := &ObjectAccessControl{
  3790. ServerResponse: googleapi.ServerResponse{
  3791. Header: res.Header,
  3792. HTTPStatusCode: res.StatusCode,
  3793. },
  3794. }
  3795. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  3796. return nil, err
  3797. }
  3798. return ret, nil
  3799. // {
  3800. // "description": "Returns the ACL entry for the specified entity on the specified object.",
  3801. // "httpMethod": "GET",
  3802. // "id": "storage.objectAccessControls.get",
  3803. // "parameterOrder": [
  3804. // "bucket",
  3805. // "object",
  3806. // "entity"
  3807. // ],
  3808. // "parameters": {
  3809. // "bucket": {
  3810. // "description": "Name of a bucket.",
  3811. // "location": "path",
  3812. // "required": true,
  3813. // "type": "string"
  3814. // },
  3815. // "entity": {
  3816. // "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.",
  3817. // "location": "path",
  3818. // "required": true,
  3819. // "type": "string"
  3820. // },
  3821. // "generation": {
  3822. // "description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).",
  3823. // "format": "int64",
  3824. // "location": "query",
  3825. // "type": "string"
  3826. // },
  3827. // "object": {
  3828. // "description": "Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
  3829. // "location": "path",
  3830. // "required": true,
  3831. // "type": "string"
  3832. // }
  3833. // },
  3834. // "path": "b/{bucket}/o/{object}/acl/{entity}",
  3835. // "response": {
  3836. // "$ref": "ObjectAccessControl"
  3837. // },
  3838. // "scopes": [
  3839. // "https://www.googleapis.com/auth/cloud-platform",
  3840. // "https://www.googleapis.com/auth/devstorage.full_control"
  3841. // ]
  3842. // }
  3843. }
  3844. // method id "storage.objectAccessControls.insert":
  3845. type ObjectAccessControlsInsertCall struct {
  3846. s *Service
  3847. bucket string
  3848. object string
  3849. objectaccesscontrol *ObjectAccessControl
  3850. urlParams_ gensupport.URLParams
  3851. ctx_ context.Context
  3852. }
  3853. // Insert: Creates a new ACL entry on the specified object.
  3854. func (r *ObjectAccessControlsService) Insert(bucket string, object string, objectaccesscontrol *ObjectAccessControl) *ObjectAccessControlsInsertCall {
  3855. c := &ObjectAccessControlsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3856. c.bucket = bucket
  3857. c.object = object
  3858. c.objectaccesscontrol = objectaccesscontrol
  3859. return c
  3860. }
  3861. // Generation sets the optional parameter "generation": If present,
  3862. // selects a specific revision of this object (as opposed to the latest
  3863. // version, the default).
  3864. func (c *ObjectAccessControlsInsertCall) Generation(generation int64) *ObjectAccessControlsInsertCall {
  3865. c.urlParams_.Set("generation", fmt.Sprint(generation))
  3866. return c
  3867. }
  3868. // Fields allows partial responses to be retrieved. See
  3869. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3870. // for more information.
  3871. func (c *ObjectAccessControlsInsertCall) Fields(s ...googleapi.Field) *ObjectAccessControlsInsertCall {
  3872. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3873. return c
  3874. }
  3875. // Context sets the context to be used in this call's Do method. Any
  3876. // pending HTTP request will be aborted if the provided context is
  3877. // canceled.
  3878. func (c *ObjectAccessControlsInsertCall) Context(ctx context.Context) *ObjectAccessControlsInsertCall {
  3879. c.ctx_ = ctx
  3880. return c
  3881. }
  3882. func (c *ObjectAccessControlsInsertCall) doRequest(alt string) (*http.Response, error) {
  3883. var body io.Reader = nil
  3884. body, err := googleapi.WithoutDataWrapper.JSONReader(c.objectaccesscontrol)
  3885. if err != nil {
  3886. return nil, err
  3887. }
  3888. ctype := "application/json"
  3889. c.urlParams_.Set("alt", alt)
  3890. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}/acl")
  3891. urls += "?" + c.urlParams_.Encode()
  3892. req, _ := http.NewRequest("POST", urls, body)
  3893. googleapi.Expand(req.URL, map[string]string{
  3894. "bucket": c.bucket,
  3895. "object": c.object,
  3896. })
  3897. req.Header.Set("Content-Type", ctype)
  3898. req.Header.Set("User-Agent", c.s.userAgent())
  3899. if c.ctx_ != nil {
  3900. return ctxhttp.Do(c.ctx_, c.s.client, req)
  3901. }
  3902. return c.s.client.Do(req)
  3903. }
  3904. // Do executes the "storage.objectAccessControls.insert" call.
  3905. // Exactly one of *ObjectAccessControl or error will be non-nil. Any
  3906. // non-2xx status code is an error. Response headers are in either
  3907. // *ObjectAccessControl.ServerResponse.Header or (if a response was
  3908. // returned at all) in error.(*googleapi.Error).Header. Use
  3909. // googleapi.IsNotModified to check whether the returned error was
  3910. // because http.StatusNotModified was returned.
  3911. func (c *ObjectAccessControlsInsertCall) Do(opts ...googleapi.CallOption) (*ObjectAccessControl, error) {
  3912. gensupport.SetOptions(c.urlParams_, opts...)
  3913. res, err := c.doRequest("json")
  3914. if res != nil && res.StatusCode == http.StatusNotModified {
  3915. if res.Body != nil {
  3916. res.Body.Close()
  3917. }
  3918. return nil, &googleapi.Error{
  3919. Code: res.StatusCode,
  3920. Header: res.Header,
  3921. }
  3922. }
  3923. if err != nil {
  3924. return nil, err
  3925. }
  3926. defer googleapi.CloseBody(res)
  3927. if err := googleapi.CheckResponse(res); err != nil {
  3928. return nil, err
  3929. }
  3930. ret := &ObjectAccessControl{
  3931. ServerResponse: googleapi.ServerResponse{
  3932. Header: res.Header,
  3933. HTTPStatusCode: res.StatusCode,
  3934. },
  3935. }
  3936. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  3937. return nil, err
  3938. }
  3939. return ret, nil
  3940. // {
  3941. // "description": "Creates a new ACL entry on the specified object.",
  3942. // "httpMethod": "POST",
  3943. // "id": "storage.objectAccessControls.insert",
  3944. // "parameterOrder": [
  3945. // "bucket",
  3946. // "object"
  3947. // ],
  3948. // "parameters": {
  3949. // "bucket": {
  3950. // "description": "Name of a bucket.",
  3951. // "location": "path",
  3952. // "required": true,
  3953. // "type": "string"
  3954. // },
  3955. // "generation": {
  3956. // "description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).",
  3957. // "format": "int64",
  3958. // "location": "query",
  3959. // "type": "string"
  3960. // },
  3961. // "object": {
  3962. // "description": "Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
  3963. // "location": "path",
  3964. // "required": true,
  3965. // "type": "string"
  3966. // }
  3967. // },
  3968. // "path": "b/{bucket}/o/{object}/acl",
  3969. // "request": {
  3970. // "$ref": "ObjectAccessControl"
  3971. // },
  3972. // "response": {
  3973. // "$ref": "ObjectAccessControl"
  3974. // },
  3975. // "scopes": [
  3976. // "https://www.googleapis.com/auth/cloud-platform",
  3977. // "https://www.googleapis.com/auth/devstorage.full_control"
  3978. // ]
  3979. // }
  3980. }
  3981. // method id "storage.objectAccessControls.list":
  3982. type ObjectAccessControlsListCall struct {
  3983. s *Service
  3984. bucket string
  3985. object string
  3986. urlParams_ gensupport.URLParams
  3987. ifNoneMatch_ string
  3988. ctx_ context.Context
  3989. }
  3990. // List: Retrieves ACL entries on the specified object.
  3991. func (r *ObjectAccessControlsService) List(bucket string, object string) *ObjectAccessControlsListCall {
  3992. c := &ObjectAccessControlsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3993. c.bucket = bucket
  3994. c.object = object
  3995. return c
  3996. }
  3997. // Generation sets the optional parameter "generation": If present,
  3998. // selects a specific revision of this object (as opposed to the latest
  3999. // version, the default).
  4000. func (c *ObjectAccessControlsListCall) Generation(generation int64) *ObjectAccessControlsListCall {
  4001. c.urlParams_.Set("generation", fmt.Sprint(generation))
  4002. return c
  4003. }
  4004. // Fields allows partial responses to be retrieved. See
  4005. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4006. // for more information.
  4007. func (c *ObjectAccessControlsListCall) Fields(s ...googleapi.Field) *ObjectAccessControlsListCall {
  4008. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4009. return c
  4010. }
  4011. // IfNoneMatch sets the optional parameter which makes the operation
  4012. // fail if the object's ETag matches the given value. This is useful for
  4013. // getting updates only after the object has changed since the last
  4014. // request. Use googleapi.IsNotModified to check whether the response
  4015. // error from Do is the result of In-None-Match.
  4016. func (c *ObjectAccessControlsListCall) IfNoneMatch(entityTag string) *ObjectAccessControlsListCall {
  4017. c.ifNoneMatch_ = entityTag
  4018. return c
  4019. }
  4020. // Context sets the context to be used in this call's Do method. Any
  4021. // pending HTTP request will be aborted if the provided context is
  4022. // canceled.
  4023. func (c *ObjectAccessControlsListCall) Context(ctx context.Context) *ObjectAccessControlsListCall {
  4024. c.ctx_ = ctx
  4025. return c
  4026. }
  4027. func (c *ObjectAccessControlsListCall) doRequest(alt string) (*http.Response, error) {
  4028. var body io.Reader = nil
  4029. c.urlParams_.Set("alt", alt)
  4030. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}/acl")
  4031. urls += "?" + c.urlParams_.Encode()
  4032. req, _ := http.NewRequest("GET", urls, body)
  4033. googleapi.Expand(req.URL, map[string]string{
  4034. "bucket": c.bucket,
  4035. "object": c.object,
  4036. })
  4037. req.Header.Set("User-Agent", c.s.userAgent())
  4038. if c.ifNoneMatch_ != "" {
  4039. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  4040. }
  4041. if c.ctx_ != nil {
  4042. return ctxhttp.Do(c.ctx_, c.s.client, req)
  4043. }
  4044. return c.s.client.Do(req)
  4045. }
  4046. // Do executes the "storage.objectAccessControls.list" call.
  4047. // Exactly one of *ObjectAccessControls or error will be non-nil. Any
  4048. // non-2xx status code is an error. Response headers are in either
  4049. // *ObjectAccessControls.ServerResponse.Header or (if a response was
  4050. // returned at all) in error.(*googleapi.Error).Header. Use
  4051. // googleapi.IsNotModified to check whether the returned error was
  4052. // because http.StatusNotModified was returned.
  4053. func (c *ObjectAccessControlsListCall) Do(opts ...googleapi.CallOption) (*ObjectAccessControls, error) {
  4054. gensupport.SetOptions(c.urlParams_, opts...)
  4055. res, err := c.doRequest("json")
  4056. if res != nil && res.StatusCode == http.StatusNotModified {
  4057. if res.Body != nil {
  4058. res.Body.Close()
  4059. }
  4060. return nil, &googleapi.Error{
  4061. Code: res.StatusCode,
  4062. Header: res.Header,
  4063. }
  4064. }
  4065. if err != nil {
  4066. return nil, err
  4067. }
  4068. defer googleapi.CloseBody(res)
  4069. if err := googleapi.CheckResponse(res); err != nil {
  4070. return nil, err
  4071. }
  4072. ret := &ObjectAccessControls{
  4073. ServerResponse: googleapi.ServerResponse{
  4074. Header: res.Header,
  4075. HTTPStatusCode: res.StatusCode,
  4076. },
  4077. }
  4078. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  4079. return nil, err
  4080. }
  4081. return ret, nil
  4082. // {
  4083. // "description": "Retrieves ACL entries on the specified object.",
  4084. // "httpMethod": "GET",
  4085. // "id": "storage.objectAccessControls.list",
  4086. // "parameterOrder": [
  4087. // "bucket",
  4088. // "object"
  4089. // ],
  4090. // "parameters": {
  4091. // "bucket": {
  4092. // "description": "Name of a bucket.",
  4093. // "location": "path",
  4094. // "required": true,
  4095. // "type": "string"
  4096. // },
  4097. // "generation": {
  4098. // "description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).",
  4099. // "format": "int64",
  4100. // "location": "query",
  4101. // "type": "string"
  4102. // },
  4103. // "object": {
  4104. // "description": "Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
  4105. // "location": "path",
  4106. // "required": true,
  4107. // "type": "string"
  4108. // }
  4109. // },
  4110. // "path": "b/{bucket}/o/{object}/acl",
  4111. // "response": {
  4112. // "$ref": "ObjectAccessControls"
  4113. // },
  4114. // "scopes": [
  4115. // "https://www.googleapis.com/auth/cloud-platform",
  4116. // "https://www.googleapis.com/auth/devstorage.full_control"
  4117. // ]
  4118. // }
  4119. }
  4120. // method id "storage.objectAccessControls.patch":
  4121. type ObjectAccessControlsPatchCall struct {
  4122. s *Service
  4123. bucket string
  4124. object string
  4125. entity string
  4126. objectaccesscontrol *ObjectAccessControl
  4127. urlParams_ gensupport.URLParams
  4128. ctx_ context.Context
  4129. }
  4130. // Patch: Updates an ACL entry on the specified object. This method
  4131. // supports patch semantics.
  4132. func (r *ObjectAccessControlsService) Patch(bucket string, object string, entity string, objectaccesscontrol *ObjectAccessControl) *ObjectAccessControlsPatchCall {
  4133. c := &ObjectAccessControlsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4134. c.bucket = bucket
  4135. c.object = object
  4136. c.entity = entity
  4137. c.objectaccesscontrol = objectaccesscontrol
  4138. return c
  4139. }
  4140. // Generation sets the optional parameter "generation": If present,
  4141. // selects a specific revision of this object (as opposed to the latest
  4142. // version, the default).
  4143. func (c *ObjectAccessControlsPatchCall) Generation(generation int64) *ObjectAccessControlsPatchCall {
  4144. c.urlParams_.Set("generation", fmt.Sprint(generation))
  4145. return c
  4146. }
  4147. // Fields allows partial responses to be retrieved. See
  4148. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4149. // for more information.
  4150. func (c *ObjectAccessControlsPatchCall) Fields(s ...googleapi.Field) *ObjectAccessControlsPatchCall {
  4151. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4152. return c
  4153. }
  4154. // Context sets the context to be used in this call's Do method. Any
  4155. // pending HTTP request will be aborted if the provided context is
  4156. // canceled.
  4157. func (c *ObjectAccessControlsPatchCall) Context(ctx context.Context) *ObjectAccessControlsPatchCall {
  4158. c.ctx_ = ctx
  4159. return c
  4160. }
  4161. func (c *ObjectAccessControlsPatchCall) doRequest(alt string) (*http.Response, error) {
  4162. var body io.Reader = nil
  4163. body, err := googleapi.WithoutDataWrapper.JSONReader(c.objectaccesscontrol)
  4164. if err != nil {
  4165. return nil, err
  4166. }
  4167. ctype := "application/json"
  4168. c.urlParams_.Set("alt", alt)
  4169. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}/acl/{entity}")
  4170. urls += "?" + c.urlParams_.Encode()
  4171. req, _ := http.NewRequest("PATCH", urls, body)
  4172. googleapi.Expand(req.URL, map[string]string{
  4173. "bucket": c.bucket,
  4174. "object": c.object,
  4175. "entity": c.entity,
  4176. })
  4177. req.Header.Set("Content-Type", ctype)
  4178. req.Header.Set("User-Agent", c.s.userAgent())
  4179. if c.ctx_ != nil {
  4180. return ctxhttp.Do(c.ctx_, c.s.client, req)
  4181. }
  4182. return c.s.client.Do(req)
  4183. }
  4184. // Do executes the "storage.objectAccessControls.patch" call.
  4185. // Exactly one of *ObjectAccessControl or error will be non-nil. Any
  4186. // non-2xx status code is an error. Response headers are in either
  4187. // *ObjectAccessControl.ServerResponse.Header or (if a response was
  4188. // returned at all) in error.(*googleapi.Error).Header. Use
  4189. // googleapi.IsNotModified to check whether the returned error was
  4190. // because http.StatusNotModified was returned.
  4191. func (c *ObjectAccessControlsPatchCall) Do(opts ...googleapi.CallOption) (*ObjectAccessControl, error) {
  4192. gensupport.SetOptions(c.urlParams_, opts...)
  4193. res, err := c.doRequest("json")
  4194. if res != nil && res.StatusCode == http.StatusNotModified {
  4195. if res.Body != nil {
  4196. res.Body.Close()
  4197. }
  4198. return nil, &googleapi.Error{
  4199. Code: res.StatusCode,
  4200. Header: res.Header,
  4201. }
  4202. }
  4203. if err != nil {
  4204. return nil, err
  4205. }
  4206. defer googleapi.CloseBody(res)
  4207. if err := googleapi.CheckResponse(res); err != nil {
  4208. return nil, err
  4209. }
  4210. ret := &ObjectAccessControl{
  4211. ServerResponse: googleapi.ServerResponse{
  4212. Header: res.Header,
  4213. HTTPStatusCode: res.StatusCode,
  4214. },
  4215. }
  4216. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  4217. return nil, err
  4218. }
  4219. return ret, nil
  4220. // {
  4221. // "description": "Updates an ACL entry on the specified object. This method supports patch semantics.",
  4222. // "httpMethod": "PATCH",
  4223. // "id": "storage.objectAccessControls.patch",
  4224. // "parameterOrder": [
  4225. // "bucket",
  4226. // "object",
  4227. // "entity"
  4228. // ],
  4229. // "parameters": {
  4230. // "bucket": {
  4231. // "description": "Name of a bucket.",
  4232. // "location": "path",
  4233. // "required": true,
  4234. // "type": "string"
  4235. // },
  4236. // "entity": {
  4237. // "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.",
  4238. // "location": "path",
  4239. // "required": true,
  4240. // "type": "string"
  4241. // },
  4242. // "generation": {
  4243. // "description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).",
  4244. // "format": "int64",
  4245. // "location": "query",
  4246. // "type": "string"
  4247. // },
  4248. // "object": {
  4249. // "description": "Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
  4250. // "location": "path",
  4251. // "required": true,
  4252. // "type": "string"
  4253. // }
  4254. // },
  4255. // "path": "b/{bucket}/o/{object}/acl/{entity}",
  4256. // "request": {
  4257. // "$ref": "ObjectAccessControl"
  4258. // },
  4259. // "response": {
  4260. // "$ref": "ObjectAccessControl"
  4261. // },
  4262. // "scopes": [
  4263. // "https://www.googleapis.com/auth/cloud-platform",
  4264. // "https://www.googleapis.com/auth/devstorage.full_control"
  4265. // ]
  4266. // }
  4267. }
  4268. // method id "storage.objectAccessControls.update":
  4269. type ObjectAccessControlsUpdateCall struct {
  4270. s *Service
  4271. bucket string
  4272. object string
  4273. entity string
  4274. objectaccesscontrol *ObjectAccessControl
  4275. urlParams_ gensupport.URLParams
  4276. ctx_ context.Context
  4277. }
  4278. // Update: Updates an ACL entry on the specified object.
  4279. func (r *ObjectAccessControlsService) Update(bucket string, object string, entity string, objectaccesscontrol *ObjectAccessControl) *ObjectAccessControlsUpdateCall {
  4280. c := &ObjectAccessControlsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4281. c.bucket = bucket
  4282. c.object = object
  4283. c.entity = entity
  4284. c.objectaccesscontrol = objectaccesscontrol
  4285. return c
  4286. }
  4287. // Generation sets the optional parameter "generation": If present,
  4288. // selects a specific revision of this object (as opposed to the latest
  4289. // version, the default).
  4290. func (c *ObjectAccessControlsUpdateCall) Generation(generation int64) *ObjectAccessControlsUpdateCall {
  4291. c.urlParams_.Set("generation", fmt.Sprint(generation))
  4292. return c
  4293. }
  4294. // Fields allows partial responses to be retrieved. See
  4295. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4296. // for more information.
  4297. func (c *ObjectAccessControlsUpdateCall) Fields(s ...googleapi.Field) *ObjectAccessControlsUpdateCall {
  4298. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4299. return c
  4300. }
  4301. // Context sets the context to be used in this call's Do method. Any
  4302. // pending HTTP request will be aborted if the provided context is
  4303. // canceled.
  4304. func (c *ObjectAccessControlsUpdateCall) Context(ctx context.Context) *ObjectAccessControlsUpdateCall {
  4305. c.ctx_ = ctx
  4306. return c
  4307. }
  4308. func (c *ObjectAccessControlsUpdateCall) doRequest(alt string) (*http.Response, error) {
  4309. var body io.Reader = nil
  4310. body, err := googleapi.WithoutDataWrapper.JSONReader(c.objectaccesscontrol)
  4311. if err != nil {
  4312. return nil, err
  4313. }
  4314. ctype := "application/json"
  4315. c.urlParams_.Set("alt", alt)
  4316. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}/acl/{entity}")
  4317. urls += "?" + c.urlParams_.Encode()
  4318. req, _ := http.NewRequest("PUT", urls, body)
  4319. googleapi.Expand(req.URL, map[string]string{
  4320. "bucket": c.bucket,
  4321. "object": c.object,
  4322. "entity": c.entity,
  4323. })
  4324. req.Header.Set("Content-Type", ctype)
  4325. req.Header.Set("User-Agent", c.s.userAgent())
  4326. if c.ctx_ != nil {
  4327. return ctxhttp.Do(c.ctx_, c.s.client, req)
  4328. }
  4329. return c.s.client.Do(req)
  4330. }
  4331. // Do executes the "storage.objectAccessControls.update" call.
  4332. // Exactly one of *ObjectAccessControl or error will be non-nil. Any
  4333. // non-2xx status code is an error. Response headers are in either
  4334. // *ObjectAccessControl.ServerResponse.Header or (if a response was
  4335. // returned at all) in error.(*googleapi.Error).Header. Use
  4336. // googleapi.IsNotModified to check whether the returned error was
  4337. // because http.StatusNotModified was returned.
  4338. func (c *ObjectAccessControlsUpdateCall) Do(opts ...googleapi.CallOption) (*ObjectAccessControl, error) {
  4339. gensupport.SetOptions(c.urlParams_, opts...)
  4340. res, err := c.doRequest("json")
  4341. if res != nil && res.StatusCode == http.StatusNotModified {
  4342. if res.Body != nil {
  4343. res.Body.Close()
  4344. }
  4345. return nil, &googleapi.Error{
  4346. Code: res.StatusCode,
  4347. Header: res.Header,
  4348. }
  4349. }
  4350. if err != nil {
  4351. return nil, err
  4352. }
  4353. defer googleapi.CloseBody(res)
  4354. if err := googleapi.CheckResponse(res); err != nil {
  4355. return nil, err
  4356. }
  4357. ret := &ObjectAccessControl{
  4358. ServerResponse: googleapi.ServerResponse{
  4359. Header: res.Header,
  4360. HTTPStatusCode: res.StatusCode,
  4361. },
  4362. }
  4363. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  4364. return nil, err
  4365. }
  4366. return ret, nil
  4367. // {
  4368. // "description": "Updates an ACL entry on the specified object.",
  4369. // "httpMethod": "PUT",
  4370. // "id": "storage.objectAccessControls.update",
  4371. // "parameterOrder": [
  4372. // "bucket",
  4373. // "object",
  4374. // "entity"
  4375. // ],
  4376. // "parameters": {
  4377. // "bucket": {
  4378. // "description": "Name of a bucket.",
  4379. // "location": "path",
  4380. // "required": true,
  4381. // "type": "string"
  4382. // },
  4383. // "entity": {
  4384. // "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.",
  4385. // "location": "path",
  4386. // "required": true,
  4387. // "type": "string"
  4388. // },
  4389. // "generation": {
  4390. // "description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).",
  4391. // "format": "int64",
  4392. // "location": "query",
  4393. // "type": "string"
  4394. // },
  4395. // "object": {
  4396. // "description": "Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
  4397. // "location": "path",
  4398. // "required": true,
  4399. // "type": "string"
  4400. // }
  4401. // },
  4402. // "path": "b/{bucket}/o/{object}/acl/{entity}",
  4403. // "request": {
  4404. // "$ref": "ObjectAccessControl"
  4405. // },
  4406. // "response": {
  4407. // "$ref": "ObjectAccessControl"
  4408. // },
  4409. // "scopes": [
  4410. // "https://www.googleapis.com/auth/cloud-platform",
  4411. // "https://www.googleapis.com/auth/devstorage.full_control"
  4412. // ]
  4413. // }
  4414. }
  4415. // method id "storage.objects.compose":
  4416. type ObjectsComposeCall struct {
  4417. s *Service
  4418. destinationBucket string
  4419. destinationObject string
  4420. composerequest *ComposeRequest
  4421. urlParams_ gensupport.URLParams
  4422. ctx_ context.Context
  4423. }
  4424. // Compose: Concatenates a list of existing objects into a new object in
  4425. // the same bucket.
  4426. func (r *ObjectsService) Compose(destinationBucket string, destinationObject string, composerequest *ComposeRequest) *ObjectsComposeCall {
  4427. c := &ObjectsComposeCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4428. c.destinationBucket = destinationBucket
  4429. c.destinationObject = destinationObject
  4430. c.composerequest = composerequest
  4431. return c
  4432. }
  4433. // DestinationPredefinedAcl sets the optional parameter
  4434. // "destinationPredefinedAcl": Apply a predefined set of access controls
  4435. // to the destination object.
  4436. //
  4437. // Possible values:
  4438. // "authenticatedRead" - Object owner gets OWNER access, and
  4439. // allAuthenticatedUsers get READER access.
  4440. // "bucketOwnerFullControl" - Object owner gets OWNER access, and
  4441. // project team owners get OWNER access.
  4442. // "bucketOwnerRead" - Object owner gets OWNER access, and project
  4443. // team owners get READER access.
  4444. // "private" - Object owner gets OWNER access.
  4445. // "projectPrivate" - Object owner gets OWNER access, and project team
  4446. // members get access according to their roles.
  4447. // "publicRead" - Object owner gets OWNER access, and allUsers get
  4448. // READER access.
  4449. func (c *ObjectsComposeCall) DestinationPredefinedAcl(destinationPredefinedAcl string) *ObjectsComposeCall {
  4450. c.urlParams_.Set("destinationPredefinedAcl", destinationPredefinedAcl)
  4451. return c
  4452. }
  4453. // IfGenerationMatch sets the optional parameter "ifGenerationMatch":
  4454. // Makes the operation conditional on whether the object's current
  4455. // generation matches the given value.
  4456. func (c *ObjectsComposeCall) IfGenerationMatch(ifGenerationMatch int64) *ObjectsComposeCall {
  4457. c.urlParams_.Set("ifGenerationMatch", fmt.Sprint(ifGenerationMatch))
  4458. return c
  4459. }
  4460. // IfMetagenerationMatch sets the optional parameter
  4461. // "ifMetagenerationMatch": Makes the operation conditional on whether
  4462. // the object's current metageneration matches the given value.
  4463. func (c *ObjectsComposeCall) IfMetagenerationMatch(ifMetagenerationMatch int64) *ObjectsComposeCall {
  4464. c.urlParams_.Set("ifMetagenerationMatch", fmt.Sprint(ifMetagenerationMatch))
  4465. return c
  4466. }
  4467. // Fields allows partial responses to be retrieved. See
  4468. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4469. // for more information.
  4470. func (c *ObjectsComposeCall) Fields(s ...googleapi.Field) *ObjectsComposeCall {
  4471. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4472. return c
  4473. }
  4474. // Context sets the context to be used in this call's Do and Download
  4475. // methods. Any pending HTTP request will be aborted if the provided
  4476. // context is canceled.
  4477. func (c *ObjectsComposeCall) Context(ctx context.Context) *ObjectsComposeCall {
  4478. c.ctx_ = ctx
  4479. return c
  4480. }
  4481. func (c *ObjectsComposeCall) doRequest(alt string) (*http.Response, error) {
  4482. var body io.Reader = nil
  4483. body, err := googleapi.WithoutDataWrapper.JSONReader(c.composerequest)
  4484. if err != nil {
  4485. return nil, err
  4486. }
  4487. ctype := "application/json"
  4488. c.urlParams_.Set("alt", alt)
  4489. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{destinationBucket}/o/{destinationObject}/compose")
  4490. urls += "?" + c.urlParams_.Encode()
  4491. req, _ := http.NewRequest("POST", urls, body)
  4492. googleapi.Expand(req.URL, map[string]string{
  4493. "destinationBucket": c.destinationBucket,
  4494. "destinationObject": c.destinationObject,
  4495. })
  4496. req.Header.Set("Content-Type", ctype)
  4497. req.Header.Set("User-Agent", c.s.userAgent())
  4498. if c.ctx_ != nil {
  4499. return ctxhttp.Do(c.ctx_, c.s.client, req)
  4500. }
  4501. return c.s.client.Do(req)
  4502. }
  4503. // Download fetches the API endpoint's "media" value, instead of the normal
  4504. // API response value. If the returned error is nil, the Response is guaranteed to
  4505. // have a 2xx status code. Callers must close the Response.Body as usual.
  4506. func (c *ObjectsComposeCall) Download(opts ...googleapi.CallOption) (*http.Response, error) {
  4507. gensupport.SetOptions(c.urlParams_, opts...)
  4508. res, err := c.doRequest("media")
  4509. if err != nil {
  4510. return nil, err
  4511. }
  4512. if err := googleapi.CheckMediaResponse(res); err != nil {
  4513. res.Body.Close()
  4514. return nil, err
  4515. }
  4516. return res, nil
  4517. }
  4518. // Do executes the "storage.objects.compose" call.
  4519. // Exactly one of *Object or error will be non-nil. Any non-2xx status
  4520. // code is an error. Response headers are in either
  4521. // *Object.ServerResponse.Header or (if a response was returned at all)
  4522. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  4523. // check whether the returned error was because http.StatusNotModified
  4524. // was returned.
  4525. func (c *ObjectsComposeCall) Do(opts ...googleapi.CallOption) (*Object, error) {
  4526. gensupport.SetOptions(c.urlParams_, opts...)
  4527. res, err := c.doRequest("json")
  4528. if res != nil && res.StatusCode == http.StatusNotModified {
  4529. if res.Body != nil {
  4530. res.Body.Close()
  4531. }
  4532. return nil, &googleapi.Error{
  4533. Code: res.StatusCode,
  4534. Header: res.Header,
  4535. }
  4536. }
  4537. if err != nil {
  4538. return nil, err
  4539. }
  4540. defer googleapi.CloseBody(res)
  4541. if err := googleapi.CheckResponse(res); err != nil {
  4542. return nil, err
  4543. }
  4544. ret := &Object{
  4545. ServerResponse: googleapi.ServerResponse{
  4546. Header: res.Header,
  4547. HTTPStatusCode: res.StatusCode,
  4548. },
  4549. }
  4550. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  4551. return nil, err
  4552. }
  4553. return ret, nil
  4554. // {
  4555. // "description": "Concatenates a list of existing objects into a new object in the same bucket.",
  4556. // "httpMethod": "POST",
  4557. // "id": "storage.objects.compose",
  4558. // "parameterOrder": [
  4559. // "destinationBucket",
  4560. // "destinationObject"
  4561. // ],
  4562. // "parameters": {
  4563. // "destinationBucket": {
  4564. // "description": "Name of the bucket in which to store the new object.",
  4565. // "location": "path",
  4566. // "required": true,
  4567. // "type": "string"
  4568. // },
  4569. // "destinationObject": {
  4570. // "description": "Name of the new object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
  4571. // "location": "path",
  4572. // "required": true,
  4573. // "type": "string"
  4574. // },
  4575. // "destinationPredefinedAcl": {
  4576. // "description": "Apply a predefined set of access controls to the destination object.",
  4577. // "enum": [
  4578. // "authenticatedRead",
  4579. // "bucketOwnerFullControl",
  4580. // "bucketOwnerRead",
  4581. // "private",
  4582. // "projectPrivate",
  4583. // "publicRead"
  4584. // ],
  4585. // "enumDescriptions": [
  4586. // "Object owner gets OWNER access, and allAuthenticatedUsers get READER access.",
  4587. // "Object owner gets OWNER access, and project team owners get OWNER access.",
  4588. // "Object owner gets OWNER access, and project team owners get READER access.",
  4589. // "Object owner gets OWNER access.",
  4590. // "Object owner gets OWNER access, and project team members get access according to their roles.",
  4591. // "Object owner gets OWNER access, and allUsers get READER access."
  4592. // ],
  4593. // "location": "query",
  4594. // "type": "string"
  4595. // },
  4596. // "ifGenerationMatch": {
  4597. // "description": "Makes the operation conditional on whether the object's current generation matches the given value.",
  4598. // "format": "int64",
  4599. // "location": "query",
  4600. // "type": "string"
  4601. // },
  4602. // "ifMetagenerationMatch": {
  4603. // "description": "Makes the operation conditional on whether the object's current metageneration matches the given value.",
  4604. // "format": "int64",
  4605. // "location": "query",
  4606. // "type": "string"
  4607. // }
  4608. // },
  4609. // "path": "b/{destinationBucket}/o/{destinationObject}/compose",
  4610. // "request": {
  4611. // "$ref": "ComposeRequest"
  4612. // },
  4613. // "response": {
  4614. // "$ref": "Object"
  4615. // },
  4616. // "scopes": [
  4617. // "https://www.googleapis.com/auth/cloud-platform",
  4618. // "https://www.googleapis.com/auth/devstorage.full_control",
  4619. // "https://www.googleapis.com/auth/devstorage.read_write"
  4620. // ],
  4621. // "supportsMediaDownload": true,
  4622. // "useMediaDownloadService": true
  4623. // }
  4624. }
  4625. // method id "storage.objects.copy":
  4626. type ObjectsCopyCall struct {
  4627. s *Service
  4628. sourceBucket string
  4629. sourceObject string
  4630. destinationBucket string
  4631. destinationObject string
  4632. object *Object
  4633. urlParams_ gensupport.URLParams
  4634. ctx_ context.Context
  4635. }
  4636. // Copy: Copies a source object to a destination object. Optionally
  4637. // overrides metadata.
  4638. func (r *ObjectsService) Copy(sourceBucket string, sourceObject string, destinationBucket string, destinationObject string, object *Object) *ObjectsCopyCall {
  4639. c := &ObjectsCopyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4640. c.sourceBucket = sourceBucket
  4641. c.sourceObject = sourceObject
  4642. c.destinationBucket = destinationBucket
  4643. c.destinationObject = destinationObject
  4644. c.object = object
  4645. return c
  4646. }
  4647. // DestinationPredefinedAcl sets the optional parameter
  4648. // "destinationPredefinedAcl": Apply a predefined set of access controls
  4649. // to the destination object.
  4650. //
  4651. // Possible values:
  4652. // "authenticatedRead" - Object owner gets OWNER access, and
  4653. // allAuthenticatedUsers get READER access.
  4654. // "bucketOwnerFullControl" - Object owner gets OWNER access, and
  4655. // project team owners get OWNER access.
  4656. // "bucketOwnerRead" - Object owner gets OWNER access, and project
  4657. // team owners get READER access.
  4658. // "private" - Object owner gets OWNER access.
  4659. // "projectPrivate" - Object owner gets OWNER access, and project team
  4660. // members get access according to their roles.
  4661. // "publicRead" - Object owner gets OWNER access, and allUsers get
  4662. // READER access.
  4663. func (c *ObjectsCopyCall) DestinationPredefinedAcl(destinationPredefinedAcl string) *ObjectsCopyCall {
  4664. c.urlParams_.Set("destinationPredefinedAcl", destinationPredefinedAcl)
  4665. return c
  4666. }
  4667. // IfGenerationMatch sets the optional parameter "ifGenerationMatch":
  4668. // Makes the operation conditional on whether the destination object's
  4669. // current generation matches the given value.
  4670. func (c *ObjectsCopyCall) IfGenerationMatch(ifGenerationMatch int64) *ObjectsCopyCall {
  4671. c.urlParams_.Set("ifGenerationMatch", fmt.Sprint(ifGenerationMatch))
  4672. return c
  4673. }
  4674. // IfGenerationNotMatch sets the optional parameter
  4675. // "ifGenerationNotMatch": Makes the operation conditional on whether
  4676. // the destination object's current generation does not match the given
  4677. // value.
  4678. func (c *ObjectsCopyCall) IfGenerationNotMatch(ifGenerationNotMatch int64) *ObjectsCopyCall {
  4679. c.urlParams_.Set("ifGenerationNotMatch", fmt.Sprint(ifGenerationNotMatch))
  4680. return c
  4681. }
  4682. // IfMetagenerationMatch sets the optional parameter
  4683. // "ifMetagenerationMatch": Makes the operation conditional on whether
  4684. // the destination object's current metageneration matches the given
  4685. // value.
  4686. func (c *ObjectsCopyCall) IfMetagenerationMatch(ifMetagenerationMatch int64) *ObjectsCopyCall {
  4687. c.urlParams_.Set("ifMetagenerationMatch", fmt.Sprint(ifMetagenerationMatch))
  4688. return c
  4689. }
  4690. // IfMetagenerationNotMatch sets the optional parameter
  4691. // "ifMetagenerationNotMatch": Makes the operation conditional on
  4692. // whether the destination object's current metageneration does not
  4693. // match the given value.
  4694. func (c *ObjectsCopyCall) IfMetagenerationNotMatch(ifMetagenerationNotMatch int64) *ObjectsCopyCall {
  4695. c.urlParams_.Set("ifMetagenerationNotMatch", fmt.Sprint(ifMetagenerationNotMatch))
  4696. return c
  4697. }
  4698. // IfSourceGenerationMatch sets the optional parameter
  4699. // "ifSourceGenerationMatch": Makes the operation conditional on whether
  4700. // the source object's generation matches the given value.
  4701. func (c *ObjectsCopyCall) IfSourceGenerationMatch(ifSourceGenerationMatch int64) *ObjectsCopyCall {
  4702. c.urlParams_.Set("ifSourceGenerationMatch", fmt.Sprint(ifSourceGenerationMatch))
  4703. return c
  4704. }
  4705. // IfSourceGenerationNotMatch sets the optional parameter
  4706. // "ifSourceGenerationNotMatch": Makes the operation conditional on
  4707. // whether the source object's generation does not match the given
  4708. // value.
  4709. func (c *ObjectsCopyCall) IfSourceGenerationNotMatch(ifSourceGenerationNotMatch int64) *ObjectsCopyCall {
  4710. c.urlParams_.Set("ifSourceGenerationNotMatch", fmt.Sprint(ifSourceGenerationNotMatch))
  4711. return c
  4712. }
  4713. // IfSourceMetagenerationMatch sets the optional parameter
  4714. // "ifSourceMetagenerationMatch": Makes the operation conditional on
  4715. // whether the source object's current metageneration matches the given
  4716. // value.
  4717. func (c *ObjectsCopyCall) IfSourceMetagenerationMatch(ifSourceMetagenerationMatch int64) *ObjectsCopyCall {
  4718. c.urlParams_.Set("ifSourceMetagenerationMatch", fmt.Sprint(ifSourceMetagenerationMatch))
  4719. return c
  4720. }
  4721. // IfSourceMetagenerationNotMatch sets the optional parameter
  4722. // "ifSourceMetagenerationNotMatch": Makes the operation conditional on
  4723. // whether the source object's current metageneration does not match the
  4724. // given value.
  4725. func (c *ObjectsCopyCall) IfSourceMetagenerationNotMatch(ifSourceMetagenerationNotMatch int64) *ObjectsCopyCall {
  4726. c.urlParams_.Set("ifSourceMetagenerationNotMatch", fmt.Sprint(ifSourceMetagenerationNotMatch))
  4727. return c
  4728. }
  4729. // Projection sets the optional parameter "projection": Set of
  4730. // properties to return. Defaults to noAcl, unless the object resource
  4731. // specifies the acl property, when it defaults to full.
  4732. //
  4733. // Possible values:
  4734. // "full" - Include all properties.
  4735. // "noAcl" - Omit the acl property.
  4736. func (c *ObjectsCopyCall) Projection(projection string) *ObjectsCopyCall {
  4737. c.urlParams_.Set("projection", projection)
  4738. return c
  4739. }
  4740. // SourceGeneration sets the optional parameter "sourceGeneration": If
  4741. // present, selects a specific revision of the source object (as opposed
  4742. // to the latest version, the default).
  4743. func (c *ObjectsCopyCall) SourceGeneration(sourceGeneration int64) *ObjectsCopyCall {
  4744. c.urlParams_.Set("sourceGeneration", fmt.Sprint(sourceGeneration))
  4745. return c
  4746. }
  4747. // Fields allows partial responses to be retrieved. See
  4748. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4749. // for more information.
  4750. func (c *ObjectsCopyCall) Fields(s ...googleapi.Field) *ObjectsCopyCall {
  4751. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4752. return c
  4753. }
  4754. // Context sets the context to be used in this call's Do and Download
  4755. // methods. Any pending HTTP request will be aborted if the provided
  4756. // context is canceled.
  4757. func (c *ObjectsCopyCall) Context(ctx context.Context) *ObjectsCopyCall {
  4758. c.ctx_ = ctx
  4759. return c
  4760. }
  4761. func (c *ObjectsCopyCall) doRequest(alt string) (*http.Response, error) {
  4762. var body io.Reader = nil
  4763. body, err := googleapi.WithoutDataWrapper.JSONReader(c.object)
  4764. if err != nil {
  4765. return nil, err
  4766. }
  4767. ctype := "application/json"
  4768. c.urlParams_.Set("alt", alt)
  4769. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{sourceBucket}/o/{sourceObject}/copyTo/b/{destinationBucket}/o/{destinationObject}")
  4770. urls += "?" + c.urlParams_.Encode()
  4771. req, _ := http.NewRequest("POST", urls, body)
  4772. googleapi.Expand(req.URL, map[string]string{
  4773. "sourceBucket": c.sourceBucket,
  4774. "sourceObject": c.sourceObject,
  4775. "destinationBucket": c.destinationBucket,
  4776. "destinationObject": c.destinationObject,
  4777. })
  4778. req.Header.Set("Content-Type", ctype)
  4779. req.Header.Set("User-Agent", c.s.userAgent())
  4780. if c.ctx_ != nil {
  4781. return ctxhttp.Do(c.ctx_, c.s.client, req)
  4782. }
  4783. return c.s.client.Do(req)
  4784. }
  4785. // Download fetches the API endpoint's "media" value, instead of the normal
  4786. // API response value. If the returned error is nil, the Response is guaranteed to
  4787. // have a 2xx status code. Callers must close the Response.Body as usual.
  4788. func (c *ObjectsCopyCall) Download(opts ...googleapi.CallOption) (*http.Response, error) {
  4789. gensupport.SetOptions(c.urlParams_, opts...)
  4790. res, err := c.doRequest("media")
  4791. if err != nil {
  4792. return nil, err
  4793. }
  4794. if err := googleapi.CheckMediaResponse(res); err != nil {
  4795. res.Body.Close()
  4796. return nil, err
  4797. }
  4798. return res, nil
  4799. }
  4800. // Do executes the "storage.objects.copy" call.
  4801. // Exactly one of *Object or error will be non-nil. Any non-2xx status
  4802. // code is an error. Response headers are in either
  4803. // *Object.ServerResponse.Header or (if a response was returned at all)
  4804. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  4805. // check whether the returned error was because http.StatusNotModified
  4806. // was returned.
  4807. func (c *ObjectsCopyCall) Do(opts ...googleapi.CallOption) (*Object, error) {
  4808. gensupport.SetOptions(c.urlParams_, opts...)
  4809. res, err := c.doRequest("json")
  4810. if res != nil && res.StatusCode == http.StatusNotModified {
  4811. if res.Body != nil {
  4812. res.Body.Close()
  4813. }
  4814. return nil, &googleapi.Error{
  4815. Code: res.StatusCode,
  4816. Header: res.Header,
  4817. }
  4818. }
  4819. if err != nil {
  4820. return nil, err
  4821. }
  4822. defer googleapi.CloseBody(res)
  4823. if err := googleapi.CheckResponse(res); err != nil {
  4824. return nil, err
  4825. }
  4826. ret := &Object{
  4827. ServerResponse: googleapi.ServerResponse{
  4828. Header: res.Header,
  4829. HTTPStatusCode: res.StatusCode,
  4830. },
  4831. }
  4832. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  4833. return nil, err
  4834. }
  4835. return ret, nil
  4836. // {
  4837. // "description": "Copies a source object to a destination object. Optionally overrides metadata.",
  4838. // "httpMethod": "POST",
  4839. // "id": "storage.objects.copy",
  4840. // "parameterOrder": [
  4841. // "sourceBucket",
  4842. // "sourceObject",
  4843. // "destinationBucket",
  4844. // "destinationObject"
  4845. // ],
  4846. // "parameters": {
  4847. // "destinationBucket": {
  4848. // "description": "Name of the bucket in which to store the new object. Overrides the provided object metadata's bucket value, if any.For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
  4849. // "location": "path",
  4850. // "required": true,
  4851. // "type": "string"
  4852. // },
  4853. // "destinationObject": {
  4854. // "description": "Name of the new object. Required when the object metadata is not otherwise provided. Overrides the object metadata's name value, if any.",
  4855. // "location": "path",
  4856. // "required": true,
  4857. // "type": "string"
  4858. // },
  4859. // "destinationPredefinedAcl": {
  4860. // "description": "Apply a predefined set of access controls to the destination object.",
  4861. // "enum": [
  4862. // "authenticatedRead",
  4863. // "bucketOwnerFullControl",
  4864. // "bucketOwnerRead",
  4865. // "private",
  4866. // "projectPrivate",
  4867. // "publicRead"
  4868. // ],
  4869. // "enumDescriptions": [
  4870. // "Object owner gets OWNER access, and allAuthenticatedUsers get READER access.",
  4871. // "Object owner gets OWNER access, and project team owners get OWNER access.",
  4872. // "Object owner gets OWNER access, and project team owners get READER access.",
  4873. // "Object owner gets OWNER access.",
  4874. // "Object owner gets OWNER access, and project team members get access according to their roles.",
  4875. // "Object owner gets OWNER access, and allUsers get READER access."
  4876. // ],
  4877. // "location": "query",
  4878. // "type": "string"
  4879. // },
  4880. // "ifGenerationMatch": {
  4881. // "description": "Makes the operation conditional on whether the destination object's current generation matches the given value.",
  4882. // "format": "int64",
  4883. // "location": "query",
  4884. // "type": "string"
  4885. // },
  4886. // "ifGenerationNotMatch": {
  4887. // "description": "Makes the operation conditional on whether the destination object's current generation does not match the given value.",
  4888. // "format": "int64",
  4889. // "location": "query",
  4890. // "type": "string"
  4891. // },
  4892. // "ifMetagenerationMatch": {
  4893. // "description": "Makes the operation conditional on whether the destination object's current metageneration matches the given value.",
  4894. // "format": "int64",
  4895. // "location": "query",
  4896. // "type": "string"
  4897. // },
  4898. // "ifMetagenerationNotMatch": {
  4899. // "description": "Makes the operation conditional on whether the destination object's current metageneration does not match the given value.",
  4900. // "format": "int64",
  4901. // "location": "query",
  4902. // "type": "string"
  4903. // },
  4904. // "ifSourceGenerationMatch": {
  4905. // "description": "Makes the operation conditional on whether the source object's generation matches the given value.",
  4906. // "format": "int64",
  4907. // "location": "query",
  4908. // "type": "string"
  4909. // },
  4910. // "ifSourceGenerationNotMatch": {
  4911. // "description": "Makes the operation conditional on whether the source object's generation does not match the given value.",
  4912. // "format": "int64",
  4913. // "location": "query",
  4914. // "type": "string"
  4915. // },
  4916. // "ifSourceMetagenerationMatch": {
  4917. // "description": "Makes the operation conditional on whether the source object's current metageneration matches the given value.",
  4918. // "format": "int64",
  4919. // "location": "query",
  4920. // "type": "string"
  4921. // },
  4922. // "ifSourceMetagenerationNotMatch": {
  4923. // "description": "Makes the operation conditional on whether the source object's current metageneration does not match the given value.",
  4924. // "format": "int64",
  4925. // "location": "query",
  4926. // "type": "string"
  4927. // },
  4928. // "projection": {
  4929. // "description": "Set of properties to return. Defaults to noAcl, unless the object resource specifies the acl property, when it defaults to full.",
  4930. // "enum": [
  4931. // "full",
  4932. // "noAcl"
  4933. // ],
  4934. // "enumDescriptions": [
  4935. // "Include all properties.",
  4936. // "Omit the acl property."
  4937. // ],
  4938. // "location": "query",
  4939. // "type": "string"
  4940. // },
  4941. // "sourceBucket": {
  4942. // "description": "Name of the bucket in which to find the source object.",
  4943. // "location": "path",
  4944. // "required": true,
  4945. // "type": "string"
  4946. // },
  4947. // "sourceGeneration": {
  4948. // "description": "If present, selects a specific revision of the source object (as opposed to the latest version, the default).",
  4949. // "format": "int64",
  4950. // "location": "query",
  4951. // "type": "string"
  4952. // },
  4953. // "sourceObject": {
  4954. // "description": "Name of the source object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
  4955. // "location": "path",
  4956. // "required": true,
  4957. // "type": "string"
  4958. // }
  4959. // },
  4960. // "path": "b/{sourceBucket}/o/{sourceObject}/copyTo/b/{destinationBucket}/o/{destinationObject}",
  4961. // "request": {
  4962. // "$ref": "Object"
  4963. // },
  4964. // "response": {
  4965. // "$ref": "Object"
  4966. // },
  4967. // "scopes": [
  4968. // "https://www.googleapis.com/auth/cloud-platform",
  4969. // "https://www.googleapis.com/auth/devstorage.full_control",
  4970. // "https://www.googleapis.com/auth/devstorage.read_write"
  4971. // ],
  4972. // "supportsMediaDownload": true,
  4973. // "useMediaDownloadService": true
  4974. // }
  4975. }
  4976. // method id "storage.objects.delete":
  4977. type ObjectsDeleteCall struct {
  4978. s *Service
  4979. bucket string
  4980. object string
  4981. urlParams_ gensupport.URLParams
  4982. ctx_ context.Context
  4983. }
  4984. // Delete: Deletes an object and its metadata. Deletions are permanent
  4985. // if versioning is not enabled for the bucket, or if the generation
  4986. // parameter is used.
  4987. func (r *ObjectsService) Delete(bucket string, object string) *ObjectsDeleteCall {
  4988. c := &ObjectsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4989. c.bucket = bucket
  4990. c.object = object
  4991. return c
  4992. }
  4993. // Generation sets the optional parameter "generation": If present,
  4994. // permanently deletes a specific revision of this object (as opposed to
  4995. // the latest version, the default).
  4996. func (c *ObjectsDeleteCall) Generation(generation int64) *ObjectsDeleteCall {
  4997. c.urlParams_.Set("generation", fmt.Sprint(generation))
  4998. return c
  4999. }
  5000. // IfGenerationMatch sets the optional parameter "ifGenerationMatch":
  5001. // Makes the operation conditional on whether the object's current
  5002. // generation matches the given value.
  5003. func (c *ObjectsDeleteCall) IfGenerationMatch(ifGenerationMatch int64) *ObjectsDeleteCall {
  5004. c.urlParams_.Set("ifGenerationMatch", fmt.Sprint(ifGenerationMatch))
  5005. return c
  5006. }
  5007. // IfGenerationNotMatch sets the optional parameter
  5008. // "ifGenerationNotMatch": Makes the operation conditional on whether
  5009. // the object's current generation does not match the given value.
  5010. func (c *ObjectsDeleteCall) IfGenerationNotMatch(ifGenerationNotMatch int64) *ObjectsDeleteCall {
  5011. c.urlParams_.Set("ifGenerationNotMatch", fmt.Sprint(ifGenerationNotMatch))
  5012. return c
  5013. }
  5014. // IfMetagenerationMatch sets the optional parameter
  5015. // "ifMetagenerationMatch": Makes the operation conditional on whether
  5016. // the object's current metageneration matches the given value.
  5017. func (c *ObjectsDeleteCall) IfMetagenerationMatch(ifMetagenerationMatch int64) *ObjectsDeleteCall {
  5018. c.urlParams_.Set("ifMetagenerationMatch", fmt.Sprint(ifMetagenerationMatch))
  5019. return c
  5020. }
  5021. // IfMetagenerationNotMatch sets the optional parameter
  5022. // "ifMetagenerationNotMatch": Makes the operation conditional on
  5023. // whether the object's current metageneration does not match the given
  5024. // value.
  5025. func (c *ObjectsDeleteCall) IfMetagenerationNotMatch(ifMetagenerationNotMatch int64) *ObjectsDeleteCall {
  5026. c.urlParams_.Set("ifMetagenerationNotMatch", fmt.Sprint(ifMetagenerationNotMatch))
  5027. return c
  5028. }
  5029. // Fields allows partial responses to be retrieved. See
  5030. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5031. // for more information.
  5032. func (c *ObjectsDeleteCall) Fields(s ...googleapi.Field) *ObjectsDeleteCall {
  5033. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5034. return c
  5035. }
  5036. // Context sets the context to be used in this call's Do method. Any
  5037. // pending HTTP request will be aborted if the provided context is
  5038. // canceled.
  5039. func (c *ObjectsDeleteCall) Context(ctx context.Context) *ObjectsDeleteCall {
  5040. c.ctx_ = ctx
  5041. return c
  5042. }
  5043. func (c *ObjectsDeleteCall) doRequest(alt string) (*http.Response, error) {
  5044. var body io.Reader = nil
  5045. c.urlParams_.Set("alt", alt)
  5046. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}")
  5047. urls += "?" + c.urlParams_.Encode()
  5048. req, _ := http.NewRequest("DELETE", urls, body)
  5049. googleapi.Expand(req.URL, map[string]string{
  5050. "bucket": c.bucket,
  5051. "object": c.object,
  5052. })
  5053. req.Header.Set("User-Agent", c.s.userAgent())
  5054. if c.ctx_ != nil {
  5055. return ctxhttp.Do(c.ctx_, c.s.client, req)
  5056. }
  5057. return c.s.client.Do(req)
  5058. }
  5059. // Do executes the "storage.objects.delete" call.
  5060. func (c *ObjectsDeleteCall) Do(opts ...googleapi.CallOption) error {
  5061. gensupport.SetOptions(c.urlParams_, opts...)
  5062. res, err := c.doRequest("json")
  5063. if err != nil {
  5064. return err
  5065. }
  5066. defer googleapi.CloseBody(res)
  5067. if err := googleapi.CheckResponse(res); err != nil {
  5068. return err
  5069. }
  5070. return nil
  5071. // {
  5072. // "description": "Deletes an object and its metadata. Deletions are permanent if versioning is not enabled for the bucket, or if the generation parameter is used.",
  5073. // "httpMethod": "DELETE",
  5074. // "id": "storage.objects.delete",
  5075. // "parameterOrder": [
  5076. // "bucket",
  5077. // "object"
  5078. // ],
  5079. // "parameters": {
  5080. // "bucket": {
  5081. // "description": "Name of the bucket in which the object resides.",
  5082. // "location": "path",
  5083. // "required": true,
  5084. // "type": "string"
  5085. // },
  5086. // "generation": {
  5087. // "description": "If present, permanently deletes a specific revision of this object (as opposed to the latest version, the default).",
  5088. // "format": "int64",
  5089. // "location": "query",
  5090. // "type": "string"
  5091. // },
  5092. // "ifGenerationMatch": {
  5093. // "description": "Makes the operation conditional on whether the object's current generation matches the given value.",
  5094. // "format": "int64",
  5095. // "location": "query",
  5096. // "type": "string"
  5097. // },
  5098. // "ifGenerationNotMatch": {
  5099. // "description": "Makes the operation conditional on whether the object's current generation does not match the given value.",
  5100. // "format": "int64",
  5101. // "location": "query",
  5102. // "type": "string"
  5103. // },
  5104. // "ifMetagenerationMatch": {
  5105. // "description": "Makes the operation conditional on whether the object's current metageneration matches the given value.",
  5106. // "format": "int64",
  5107. // "location": "query",
  5108. // "type": "string"
  5109. // },
  5110. // "ifMetagenerationNotMatch": {
  5111. // "description": "Makes the operation conditional on whether the object's current metageneration does not match the given value.",
  5112. // "format": "int64",
  5113. // "location": "query",
  5114. // "type": "string"
  5115. // },
  5116. // "object": {
  5117. // "description": "Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
  5118. // "location": "path",
  5119. // "required": true,
  5120. // "type": "string"
  5121. // }
  5122. // },
  5123. // "path": "b/{bucket}/o/{object}",
  5124. // "scopes": [
  5125. // "https://www.googleapis.com/auth/cloud-platform",
  5126. // "https://www.googleapis.com/auth/devstorage.full_control",
  5127. // "https://www.googleapis.com/auth/devstorage.read_write"
  5128. // ]
  5129. // }
  5130. }
  5131. // method id "storage.objects.get":
  5132. type ObjectsGetCall struct {
  5133. s *Service
  5134. bucket string
  5135. object string
  5136. urlParams_ gensupport.URLParams
  5137. ifNoneMatch_ string
  5138. ctx_ context.Context
  5139. }
  5140. // Get: Retrieves an object or its metadata.
  5141. func (r *ObjectsService) Get(bucket string, object string) *ObjectsGetCall {
  5142. c := &ObjectsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5143. c.bucket = bucket
  5144. c.object = object
  5145. return c
  5146. }
  5147. // Generation sets the optional parameter "generation": If present,
  5148. // selects a specific revision of this object (as opposed to the latest
  5149. // version, the default).
  5150. func (c *ObjectsGetCall) Generation(generation int64) *ObjectsGetCall {
  5151. c.urlParams_.Set("generation", fmt.Sprint(generation))
  5152. return c
  5153. }
  5154. // IfGenerationMatch sets the optional parameter "ifGenerationMatch":
  5155. // Makes the operation conditional on whether the object's generation
  5156. // matches the given value.
  5157. func (c *ObjectsGetCall) IfGenerationMatch(ifGenerationMatch int64) *ObjectsGetCall {
  5158. c.urlParams_.Set("ifGenerationMatch", fmt.Sprint(ifGenerationMatch))
  5159. return c
  5160. }
  5161. // IfGenerationNotMatch sets the optional parameter
  5162. // "ifGenerationNotMatch": Makes the operation conditional on whether
  5163. // the object's generation does not match the given value.
  5164. func (c *ObjectsGetCall) IfGenerationNotMatch(ifGenerationNotMatch int64) *ObjectsGetCall {
  5165. c.urlParams_.Set("ifGenerationNotMatch", fmt.Sprint(ifGenerationNotMatch))
  5166. return c
  5167. }
  5168. // IfMetagenerationMatch sets the optional parameter
  5169. // "ifMetagenerationMatch": Makes the operation conditional on whether
  5170. // the object's current metageneration matches the given value.
  5171. func (c *ObjectsGetCall) IfMetagenerationMatch(ifMetagenerationMatch int64) *ObjectsGetCall {
  5172. c.urlParams_.Set("ifMetagenerationMatch", fmt.Sprint(ifMetagenerationMatch))
  5173. return c
  5174. }
  5175. // IfMetagenerationNotMatch sets the optional parameter
  5176. // "ifMetagenerationNotMatch": Makes the operation conditional on
  5177. // whether the object's current metageneration does not match the given
  5178. // value.
  5179. func (c *ObjectsGetCall) IfMetagenerationNotMatch(ifMetagenerationNotMatch int64) *ObjectsGetCall {
  5180. c.urlParams_.Set("ifMetagenerationNotMatch", fmt.Sprint(ifMetagenerationNotMatch))
  5181. return c
  5182. }
  5183. // Projection sets the optional parameter "projection": Set of
  5184. // properties to return. Defaults to noAcl.
  5185. //
  5186. // Possible values:
  5187. // "full" - Include all properties.
  5188. // "noAcl" - Omit the acl property.
  5189. func (c *ObjectsGetCall) Projection(projection string) *ObjectsGetCall {
  5190. c.urlParams_.Set("projection", projection)
  5191. return c
  5192. }
  5193. // Fields allows partial responses to be retrieved. See
  5194. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5195. // for more information.
  5196. func (c *ObjectsGetCall) Fields(s ...googleapi.Field) *ObjectsGetCall {
  5197. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5198. return c
  5199. }
  5200. // IfNoneMatch sets the optional parameter which makes the operation
  5201. // fail if the object's ETag matches the given value. This is useful for
  5202. // getting updates only after the object has changed since the last
  5203. // request. Use googleapi.IsNotModified to check whether the response
  5204. // error from Do is the result of In-None-Match.
  5205. func (c *ObjectsGetCall) IfNoneMatch(entityTag string) *ObjectsGetCall {
  5206. c.ifNoneMatch_ = entityTag
  5207. return c
  5208. }
  5209. // Context sets the context to be used in this call's Do and Download
  5210. // methods. Any pending HTTP request will be aborted if the provided
  5211. // context is canceled.
  5212. func (c *ObjectsGetCall) Context(ctx context.Context) *ObjectsGetCall {
  5213. c.ctx_ = ctx
  5214. return c
  5215. }
  5216. func (c *ObjectsGetCall) doRequest(alt string) (*http.Response, error) {
  5217. var body io.Reader = nil
  5218. c.urlParams_.Set("alt", alt)
  5219. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}")
  5220. urls += "?" + c.urlParams_.Encode()
  5221. req, _ := http.NewRequest("GET", urls, body)
  5222. googleapi.Expand(req.URL, map[string]string{
  5223. "bucket": c.bucket,
  5224. "object": c.object,
  5225. })
  5226. req.Header.Set("User-Agent", c.s.userAgent())
  5227. if c.ifNoneMatch_ != "" {
  5228. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  5229. }
  5230. if c.ctx_ != nil {
  5231. return ctxhttp.Do(c.ctx_, c.s.client, req)
  5232. }
  5233. return c.s.client.Do(req)
  5234. }
  5235. // Download fetches the API endpoint's "media" value, instead of the normal
  5236. // API response value. If the returned error is nil, the Response is guaranteed to
  5237. // have a 2xx status code. Callers must close the Response.Body as usual.
  5238. func (c *ObjectsGetCall) Download(opts ...googleapi.CallOption) (*http.Response, error) {
  5239. gensupport.SetOptions(c.urlParams_, opts...)
  5240. res, err := c.doRequest("media")
  5241. if err != nil {
  5242. return nil, err
  5243. }
  5244. if err := googleapi.CheckMediaResponse(res); err != nil {
  5245. res.Body.Close()
  5246. return nil, err
  5247. }
  5248. return res, nil
  5249. }
  5250. // Do executes the "storage.objects.get" call.
  5251. // Exactly one of *Object or error will be non-nil. Any non-2xx status
  5252. // code is an error. Response headers are in either
  5253. // *Object.ServerResponse.Header or (if a response was returned at all)
  5254. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  5255. // check whether the returned error was because http.StatusNotModified
  5256. // was returned.
  5257. func (c *ObjectsGetCall) Do(opts ...googleapi.CallOption) (*Object, error) {
  5258. gensupport.SetOptions(c.urlParams_, opts...)
  5259. res, err := c.doRequest("json")
  5260. if res != nil && res.StatusCode == http.StatusNotModified {
  5261. if res.Body != nil {
  5262. res.Body.Close()
  5263. }
  5264. return nil, &googleapi.Error{
  5265. Code: res.StatusCode,
  5266. Header: res.Header,
  5267. }
  5268. }
  5269. if err != nil {
  5270. return nil, err
  5271. }
  5272. defer googleapi.CloseBody(res)
  5273. if err := googleapi.CheckResponse(res); err != nil {
  5274. return nil, err
  5275. }
  5276. ret := &Object{
  5277. ServerResponse: googleapi.ServerResponse{
  5278. Header: res.Header,
  5279. HTTPStatusCode: res.StatusCode,
  5280. },
  5281. }
  5282. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  5283. return nil, err
  5284. }
  5285. return ret, nil
  5286. // {
  5287. // "description": "Retrieves an object or its metadata.",
  5288. // "httpMethod": "GET",
  5289. // "id": "storage.objects.get",
  5290. // "parameterOrder": [
  5291. // "bucket",
  5292. // "object"
  5293. // ],
  5294. // "parameters": {
  5295. // "bucket": {
  5296. // "description": "Name of the bucket in which the object resides.",
  5297. // "location": "path",
  5298. // "required": true,
  5299. // "type": "string"
  5300. // },
  5301. // "generation": {
  5302. // "description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).",
  5303. // "format": "int64",
  5304. // "location": "query",
  5305. // "type": "string"
  5306. // },
  5307. // "ifGenerationMatch": {
  5308. // "description": "Makes the operation conditional on whether the object's generation matches the given value.",
  5309. // "format": "int64",
  5310. // "location": "query",
  5311. // "type": "string"
  5312. // },
  5313. // "ifGenerationNotMatch": {
  5314. // "description": "Makes the operation conditional on whether the object's generation does not match the given value.",
  5315. // "format": "int64",
  5316. // "location": "query",
  5317. // "type": "string"
  5318. // },
  5319. // "ifMetagenerationMatch": {
  5320. // "description": "Makes the operation conditional on whether the object's current metageneration matches the given value.",
  5321. // "format": "int64",
  5322. // "location": "query",
  5323. // "type": "string"
  5324. // },
  5325. // "ifMetagenerationNotMatch": {
  5326. // "description": "Makes the operation conditional on whether the object's current metageneration does not match the given value.",
  5327. // "format": "int64",
  5328. // "location": "query",
  5329. // "type": "string"
  5330. // },
  5331. // "object": {
  5332. // "description": "Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
  5333. // "location": "path",
  5334. // "required": true,
  5335. // "type": "string"
  5336. // },
  5337. // "projection": {
  5338. // "description": "Set of properties to return. Defaults to noAcl.",
  5339. // "enum": [
  5340. // "full",
  5341. // "noAcl"
  5342. // ],
  5343. // "enumDescriptions": [
  5344. // "Include all properties.",
  5345. // "Omit the acl property."
  5346. // ],
  5347. // "location": "query",
  5348. // "type": "string"
  5349. // }
  5350. // },
  5351. // "path": "b/{bucket}/o/{object}",
  5352. // "response": {
  5353. // "$ref": "Object"
  5354. // },
  5355. // "scopes": [
  5356. // "https://www.googleapis.com/auth/cloud-platform",
  5357. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  5358. // "https://www.googleapis.com/auth/devstorage.full_control",
  5359. // "https://www.googleapis.com/auth/devstorage.read_only",
  5360. // "https://www.googleapis.com/auth/devstorage.read_write"
  5361. // ],
  5362. // "supportsMediaDownload": true,
  5363. // "useMediaDownloadService": true
  5364. // }
  5365. }
  5366. // method id "storage.objects.insert":
  5367. type ObjectsInsertCall struct {
  5368. s *Service
  5369. bucket string
  5370. object *Object
  5371. urlParams_ gensupport.URLParams
  5372. media_ io.Reader
  5373. resumableBuffer_ *gensupport.ResumableBuffer
  5374. mediaType_ string
  5375. mediaSize_ int64 // mediaSize, if known. Used only for calls to progressUpdater_.
  5376. progressUpdater_ googleapi.ProgressUpdater
  5377. ctx_ context.Context
  5378. }
  5379. // Insert: Stores a new object and metadata.
  5380. func (r *ObjectsService) Insert(bucket string, object *Object) *ObjectsInsertCall {
  5381. c := &ObjectsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5382. c.bucket = bucket
  5383. c.object = object
  5384. return c
  5385. }
  5386. // ContentEncoding sets the optional parameter "contentEncoding": If
  5387. // set, sets the contentEncoding property of the final object to this
  5388. // value. Setting this parameter is equivalent to setting the
  5389. // contentEncoding metadata property. This can be useful when uploading
  5390. // an object with uploadType=media to indicate the encoding of the
  5391. // content being uploaded.
  5392. func (c *ObjectsInsertCall) ContentEncoding(contentEncoding string) *ObjectsInsertCall {
  5393. c.urlParams_.Set("contentEncoding", contentEncoding)
  5394. return c
  5395. }
  5396. // IfGenerationMatch sets the optional parameter "ifGenerationMatch":
  5397. // Makes the operation conditional on whether the object's current
  5398. // generation matches the given value.
  5399. func (c *ObjectsInsertCall) IfGenerationMatch(ifGenerationMatch int64) *ObjectsInsertCall {
  5400. c.urlParams_.Set("ifGenerationMatch", fmt.Sprint(ifGenerationMatch))
  5401. return c
  5402. }
  5403. // IfGenerationNotMatch sets the optional parameter
  5404. // "ifGenerationNotMatch": Makes the operation conditional on whether
  5405. // the object's current generation does not match the given value.
  5406. func (c *ObjectsInsertCall) IfGenerationNotMatch(ifGenerationNotMatch int64) *ObjectsInsertCall {
  5407. c.urlParams_.Set("ifGenerationNotMatch", fmt.Sprint(ifGenerationNotMatch))
  5408. return c
  5409. }
  5410. // IfMetagenerationMatch sets the optional parameter
  5411. // "ifMetagenerationMatch": Makes the operation conditional on whether
  5412. // the object's current metageneration matches the given value.
  5413. func (c *ObjectsInsertCall) IfMetagenerationMatch(ifMetagenerationMatch int64) *ObjectsInsertCall {
  5414. c.urlParams_.Set("ifMetagenerationMatch", fmt.Sprint(ifMetagenerationMatch))
  5415. return c
  5416. }
  5417. // IfMetagenerationNotMatch sets the optional parameter
  5418. // "ifMetagenerationNotMatch": Makes the operation conditional on
  5419. // whether the object's current metageneration does not match the given
  5420. // value.
  5421. func (c *ObjectsInsertCall) IfMetagenerationNotMatch(ifMetagenerationNotMatch int64) *ObjectsInsertCall {
  5422. c.urlParams_.Set("ifMetagenerationNotMatch", fmt.Sprint(ifMetagenerationNotMatch))
  5423. return c
  5424. }
  5425. // Name sets the optional parameter "name": Name of the object. Required
  5426. // when the object metadata is not otherwise provided. Overrides the
  5427. // object metadata's name value, if any. For information about how to
  5428. // URL encode object names to be path safe, see Encoding URI Path Parts.
  5429. func (c *ObjectsInsertCall) Name(name string) *ObjectsInsertCall {
  5430. c.urlParams_.Set("name", name)
  5431. return c
  5432. }
  5433. // PredefinedAcl sets the optional parameter "predefinedAcl": Apply a
  5434. // predefined set of access controls to this object.
  5435. //
  5436. // Possible values:
  5437. // "authenticatedRead" - Object owner gets OWNER access, and
  5438. // allAuthenticatedUsers get READER access.
  5439. // "bucketOwnerFullControl" - Object owner gets OWNER access, and
  5440. // project team owners get OWNER access.
  5441. // "bucketOwnerRead" - Object owner gets OWNER access, and project
  5442. // team owners get READER access.
  5443. // "private" - Object owner gets OWNER access.
  5444. // "projectPrivate" - Object owner gets OWNER access, and project team
  5445. // members get access according to their roles.
  5446. // "publicRead" - Object owner gets OWNER access, and allUsers get
  5447. // READER access.
  5448. func (c *ObjectsInsertCall) PredefinedAcl(predefinedAcl string) *ObjectsInsertCall {
  5449. c.urlParams_.Set("predefinedAcl", predefinedAcl)
  5450. return c
  5451. }
  5452. // Projection sets the optional parameter "projection": Set of
  5453. // properties to return. Defaults to noAcl, unless the object resource
  5454. // specifies the acl property, when it defaults to full.
  5455. //
  5456. // Possible values:
  5457. // "full" - Include all properties.
  5458. // "noAcl" - Omit the acl property.
  5459. func (c *ObjectsInsertCall) Projection(projection string) *ObjectsInsertCall {
  5460. c.urlParams_.Set("projection", projection)
  5461. return c
  5462. }
  5463. // Media specifies the media to upload in one or more chunks. The chunk
  5464. // size may be controlled by supplying a MediaOption generated by
  5465. // googleapi.ChunkSize. The chunk size defaults to
  5466. // googleapi.DefaultUploadChunkSize.
  5467. // At most one of Media and ResumableMedia may be set.
  5468. func (c *ObjectsInsertCall) Media(r io.Reader, options ...googleapi.MediaOption) *ObjectsInsertCall {
  5469. opts := googleapi.ProcessMediaOptions(options)
  5470. chunkSize := opts.ChunkSize
  5471. r, c.mediaType_ = gensupport.DetermineContentType(r, opts.ContentType)
  5472. c.media_, c.resumableBuffer_ = gensupport.PrepareUpload(r, chunkSize)
  5473. return c
  5474. }
  5475. // ResumableMedia specifies the media to upload in chunks and can be
  5476. // canceled with ctx.
  5477. //
  5478. // Deprecated: use Media instead.
  5479. //
  5480. // At most one of Media and ResumableMedia may be set. mediaType
  5481. // identifies the MIME media type of the upload, such as "image/png". If
  5482. // mediaType is "", it will be auto-detected. The provided ctx will
  5483. // supersede any context previously provided to the Context method.
  5484. func (c *ObjectsInsertCall) ResumableMedia(ctx context.Context, r io.ReaderAt, size int64, mediaType string) *ObjectsInsertCall {
  5485. c.ctx_ = ctx
  5486. rdr := gensupport.ReaderAtToReader(r, size)
  5487. rdr, c.mediaType_ = gensupport.DetermineContentType(rdr, mediaType)
  5488. c.resumableBuffer_ = gensupport.NewResumableBuffer(rdr, googleapi.DefaultUploadChunkSize)
  5489. c.media_ = nil
  5490. c.mediaSize_ = size
  5491. return c
  5492. }
  5493. // ProgressUpdater provides a callback function that will be called
  5494. // after every chunk. It should be a low-latency function in order to
  5495. // not slow down the upload operation. This should only be called when
  5496. // using ResumableMedia (as opposed to Media).
  5497. func (c *ObjectsInsertCall) ProgressUpdater(pu googleapi.ProgressUpdater) *ObjectsInsertCall {
  5498. c.progressUpdater_ = pu
  5499. return c
  5500. }
  5501. // Fields allows partial responses to be retrieved. See
  5502. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5503. // for more information.
  5504. func (c *ObjectsInsertCall) Fields(s ...googleapi.Field) *ObjectsInsertCall {
  5505. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5506. return c
  5507. }
  5508. // Context sets the context to be used in this call's Do method. Any
  5509. // pending HTTP request will be aborted if the provided context is
  5510. // canceled.
  5511. // This context will supersede any context previously provided to the
  5512. // ResumableMedia method.
  5513. func (c *ObjectsInsertCall) Context(ctx context.Context) *ObjectsInsertCall {
  5514. c.ctx_ = ctx
  5515. return c
  5516. }
  5517. func (c *ObjectsInsertCall) doRequest(alt string) (*http.Response, error) {
  5518. var body io.Reader = nil
  5519. body, err := googleapi.WithoutDataWrapper.JSONReader(c.object)
  5520. if err != nil {
  5521. return nil, err
  5522. }
  5523. ctype := "application/json"
  5524. c.urlParams_.Set("alt", alt)
  5525. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o")
  5526. if c.media_ != nil || c.resumableBuffer_ != nil {
  5527. urls = strings.Replace(urls, "https://www.googleapis.com/", "https://www.googleapis.com/upload/", 1)
  5528. protocol := "multipart"
  5529. if c.resumableBuffer_ != nil {
  5530. protocol = "resumable"
  5531. }
  5532. c.urlParams_.Set("uploadType", protocol)
  5533. }
  5534. urls += "?" + c.urlParams_.Encode()
  5535. if c.media_ != nil {
  5536. var combined io.ReadCloser
  5537. combined, ctype = gensupport.CombineBodyMedia(body, ctype, c.media_, c.mediaType_)
  5538. defer combined.Close()
  5539. body = combined
  5540. }
  5541. req, _ := http.NewRequest("POST", urls, body)
  5542. googleapi.Expand(req.URL, map[string]string{
  5543. "bucket": c.bucket,
  5544. })
  5545. if c.resumableBuffer_ != nil {
  5546. req.Header.Set("X-Upload-Content-Type", c.mediaType_)
  5547. }
  5548. req.Header.Set("Content-Type", ctype)
  5549. req.Header.Set("User-Agent", c.s.userAgent())
  5550. if c.ctx_ != nil {
  5551. return ctxhttp.Do(c.ctx_, c.s.client, req)
  5552. }
  5553. return c.s.client.Do(req)
  5554. }
  5555. // Do executes the "storage.objects.insert" call.
  5556. // Exactly one of *Object or error will be non-nil. Any non-2xx status
  5557. // code is an error. Response headers are in either
  5558. // *Object.ServerResponse.Header or (if a response was returned at all)
  5559. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  5560. // check whether the returned error was because http.StatusNotModified
  5561. // was returned.
  5562. func (c *ObjectsInsertCall) Do(opts ...googleapi.CallOption) (*Object, error) {
  5563. gensupport.SetOptions(c.urlParams_, opts...)
  5564. res, err := gensupport.Retry(c.ctx_, func() (*http.Response, error) {
  5565. return c.doRequest("json")
  5566. }, gensupport.DefaultBackoffStrategy())
  5567. if res != nil && res.StatusCode == http.StatusNotModified {
  5568. if res.Body != nil {
  5569. res.Body.Close()
  5570. }
  5571. return nil, &googleapi.Error{
  5572. Code: res.StatusCode,
  5573. Header: res.Header,
  5574. }
  5575. }
  5576. if err != nil {
  5577. return nil, err
  5578. }
  5579. defer googleapi.CloseBody(res)
  5580. if err := googleapi.CheckResponse(res); err != nil {
  5581. return nil, err
  5582. }
  5583. if c.resumableBuffer_ != nil {
  5584. loc := res.Header.Get("Location")
  5585. rx := &gensupport.ResumableUpload{
  5586. Client: c.s.client,
  5587. UserAgent: c.s.userAgent(),
  5588. URI: loc,
  5589. Media: c.resumableBuffer_,
  5590. MediaType: c.mediaType_,
  5591. Callback: func(curr int64) {
  5592. if c.progressUpdater_ != nil {
  5593. c.progressUpdater_(curr, c.mediaSize_)
  5594. }
  5595. },
  5596. }
  5597. ctx := c.ctx_
  5598. if ctx == nil {
  5599. ctx = context.TODO()
  5600. }
  5601. res, err = rx.Upload(ctx)
  5602. if err != nil {
  5603. return nil, err
  5604. }
  5605. defer res.Body.Close()
  5606. if err := googleapi.CheckResponse(res); err != nil {
  5607. return nil, err
  5608. }
  5609. }
  5610. ret := &Object{
  5611. ServerResponse: googleapi.ServerResponse{
  5612. Header: res.Header,
  5613. HTTPStatusCode: res.StatusCode,
  5614. },
  5615. }
  5616. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  5617. return nil, err
  5618. }
  5619. return ret, nil
  5620. // {
  5621. // "description": "Stores a new object and metadata.",
  5622. // "httpMethod": "POST",
  5623. // "id": "storage.objects.insert",
  5624. // "mediaUpload": {
  5625. // "accept": [
  5626. // "*/*"
  5627. // ],
  5628. // "protocols": {
  5629. // "resumable": {
  5630. // "multipart": true,
  5631. // "path": "/resumable/upload/storage/v1/b/{bucket}/o"
  5632. // },
  5633. // "simple": {
  5634. // "multipart": true,
  5635. // "path": "/upload/storage/v1/b/{bucket}/o"
  5636. // }
  5637. // }
  5638. // },
  5639. // "parameterOrder": [
  5640. // "bucket"
  5641. // ],
  5642. // "parameters": {
  5643. // "bucket": {
  5644. // "description": "Name of the bucket in which to store the new object. Overrides the provided object metadata's bucket value, if any.",
  5645. // "location": "path",
  5646. // "required": true,
  5647. // "type": "string"
  5648. // },
  5649. // "contentEncoding": {
  5650. // "description": "If set, sets the contentEncoding property of the final object to this value. Setting this parameter is equivalent to setting the contentEncoding metadata property. This can be useful when uploading an object with uploadType=media to indicate the encoding of the content being uploaded.",
  5651. // "location": "query",
  5652. // "type": "string"
  5653. // },
  5654. // "ifGenerationMatch": {
  5655. // "description": "Makes the operation conditional on whether the object's current generation matches the given value.",
  5656. // "format": "int64",
  5657. // "location": "query",
  5658. // "type": "string"
  5659. // },
  5660. // "ifGenerationNotMatch": {
  5661. // "description": "Makes the operation conditional on whether the object's current generation does not match the given value.",
  5662. // "format": "int64",
  5663. // "location": "query",
  5664. // "type": "string"
  5665. // },
  5666. // "ifMetagenerationMatch": {
  5667. // "description": "Makes the operation conditional on whether the object's current metageneration matches the given value.",
  5668. // "format": "int64",
  5669. // "location": "query",
  5670. // "type": "string"
  5671. // },
  5672. // "ifMetagenerationNotMatch": {
  5673. // "description": "Makes the operation conditional on whether the object's current metageneration does not match the given value.",
  5674. // "format": "int64",
  5675. // "location": "query",
  5676. // "type": "string"
  5677. // },
  5678. // "name": {
  5679. // "description": "Name of the object. Required when the object metadata is not otherwise provided. Overrides the object metadata's name value, if any. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
  5680. // "location": "query",
  5681. // "type": "string"
  5682. // },
  5683. // "predefinedAcl": {
  5684. // "description": "Apply a predefined set of access controls to this object.",
  5685. // "enum": [
  5686. // "authenticatedRead",
  5687. // "bucketOwnerFullControl",
  5688. // "bucketOwnerRead",
  5689. // "private",
  5690. // "projectPrivate",
  5691. // "publicRead"
  5692. // ],
  5693. // "enumDescriptions": [
  5694. // "Object owner gets OWNER access, and allAuthenticatedUsers get READER access.",
  5695. // "Object owner gets OWNER access, and project team owners get OWNER access.",
  5696. // "Object owner gets OWNER access, and project team owners get READER access.",
  5697. // "Object owner gets OWNER access.",
  5698. // "Object owner gets OWNER access, and project team members get access according to their roles.",
  5699. // "Object owner gets OWNER access, and allUsers get READER access."
  5700. // ],
  5701. // "location": "query",
  5702. // "type": "string"
  5703. // },
  5704. // "projection": {
  5705. // "description": "Set of properties to return. Defaults to noAcl, unless the object resource specifies the acl property, when it defaults to full.",
  5706. // "enum": [
  5707. // "full",
  5708. // "noAcl"
  5709. // ],
  5710. // "enumDescriptions": [
  5711. // "Include all properties.",
  5712. // "Omit the acl property."
  5713. // ],
  5714. // "location": "query",
  5715. // "type": "string"
  5716. // }
  5717. // },
  5718. // "path": "b/{bucket}/o",
  5719. // "request": {
  5720. // "$ref": "Object"
  5721. // },
  5722. // "response": {
  5723. // "$ref": "Object"
  5724. // },
  5725. // "scopes": [
  5726. // "https://www.googleapis.com/auth/cloud-platform",
  5727. // "https://www.googleapis.com/auth/devstorage.full_control",
  5728. // "https://www.googleapis.com/auth/devstorage.read_write"
  5729. // ],
  5730. // "supportsMediaDownload": true,
  5731. // "supportsMediaUpload": true,
  5732. // "useMediaDownloadService": true
  5733. // }
  5734. }
  5735. // method id "storage.objects.list":
  5736. type ObjectsListCall struct {
  5737. s *Service
  5738. bucket string
  5739. urlParams_ gensupport.URLParams
  5740. ifNoneMatch_ string
  5741. ctx_ context.Context
  5742. }
  5743. // List: Retrieves a list of objects matching the criteria.
  5744. func (r *ObjectsService) List(bucket string) *ObjectsListCall {
  5745. c := &ObjectsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5746. c.bucket = bucket
  5747. return c
  5748. }
  5749. // Delimiter sets the optional parameter "delimiter": Returns results in
  5750. // a directory-like mode. items will contain only objects whose names,
  5751. // aside from the prefix, do not contain delimiter. Objects whose names,
  5752. // aside from the prefix, contain delimiter will have their name,
  5753. // truncated after the delimiter, returned in prefixes. Duplicate
  5754. // prefixes are omitted.
  5755. func (c *ObjectsListCall) Delimiter(delimiter string) *ObjectsListCall {
  5756. c.urlParams_.Set("delimiter", delimiter)
  5757. return c
  5758. }
  5759. // MaxResults sets the optional parameter "maxResults": Maximum number
  5760. // of items plus prefixes to return. As duplicate prefixes are omitted,
  5761. // fewer total results may be returned than requested. The default value
  5762. // of this parameter is 1,000 items.
  5763. func (c *ObjectsListCall) MaxResults(maxResults int64) *ObjectsListCall {
  5764. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  5765. return c
  5766. }
  5767. // PageToken sets the optional parameter "pageToken": A
  5768. // previously-returned page token representing part of the larger set of
  5769. // results to view.
  5770. func (c *ObjectsListCall) PageToken(pageToken string) *ObjectsListCall {
  5771. c.urlParams_.Set("pageToken", pageToken)
  5772. return c
  5773. }
  5774. // Prefix sets the optional parameter "prefix": Filter results to
  5775. // objects whose names begin with this prefix.
  5776. func (c *ObjectsListCall) Prefix(prefix string) *ObjectsListCall {
  5777. c.urlParams_.Set("prefix", prefix)
  5778. return c
  5779. }
  5780. // Projection sets the optional parameter "projection": Set of
  5781. // properties to return. Defaults to noAcl.
  5782. //
  5783. // Possible values:
  5784. // "full" - Include all properties.
  5785. // "noAcl" - Omit the acl property.
  5786. func (c *ObjectsListCall) Projection(projection string) *ObjectsListCall {
  5787. c.urlParams_.Set("projection", projection)
  5788. return c
  5789. }
  5790. // Versions sets the optional parameter "versions": If true, lists all
  5791. // versions of an object as distinct results. The default is false. For
  5792. // more information, see Object Versioning.
  5793. func (c *ObjectsListCall) Versions(versions bool) *ObjectsListCall {
  5794. c.urlParams_.Set("versions", fmt.Sprint(versions))
  5795. return c
  5796. }
  5797. // Fields allows partial responses to be retrieved. See
  5798. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5799. // for more information.
  5800. func (c *ObjectsListCall) Fields(s ...googleapi.Field) *ObjectsListCall {
  5801. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5802. return c
  5803. }
  5804. // IfNoneMatch sets the optional parameter which makes the operation
  5805. // fail if the object's ETag matches the given value. This is useful for
  5806. // getting updates only after the object has changed since the last
  5807. // request. Use googleapi.IsNotModified to check whether the response
  5808. // error from Do is the result of In-None-Match.
  5809. func (c *ObjectsListCall) IfNoneMatch(entityTag string) *ObjectsListCall {
  5810. c.ifNoneMatch_ = entityTag
  5811. return c
  5812. }
  5813. // Context sets the context to be used in this call's Do method. Any
  5814. // pending HTTP request will be aborted if the provided context is
  5815. // canceled.
  5816. func (c *ObjectsListCall) Context(ctx context.Context) *ObjectsListCall {
  5817. c.ctx_ = ctx
  5818. return c
  5819. }
  5820. func (c *ObjectsListCall) doRequest(alt string) (*http.Response, error) {
  5821. var body io.Reader = nil
  5822. c.urlParams_.Set("alt", alt)
  5823. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o")
  5824. urls += "?" + c.urlParams_.Encode()
  5825. req, _ := http.NewRequest("GET", urls, body)
  5826. googleapi.Expand(req.URL, map[string]string{
  5827. "bucket": c.bucket,
  5828. })
  5829. req.Header.Set("User-Agent", c.s.userAgent())
  5830. if c.ifNoneMatch_ != "" {
  5831. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  5832. }
  5833. if c.ctx_ != nil {
  5834. return ctxhttp.Do(c.ctx_, c.s.client, req)
  5835. }
  5836. return c.s.client.Do(req)
  5837. }
  5838. // Do executes the "storage.objects.list" call.
  5839. // Exactly one of *Objects or error will be non-nil. Any non-2xx status
  5840. // code is an error. Response headers are in either
  5841. // *Objects.ServerResponse.Header or (if a response was returned at all)
  5842. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  5843. // check whether the returned error was because http.StatusNotModified
  5844. // was returned.
  5845. func (c *ObjectsListCall) Do(opts ...googleapi.CallOption) (*Objects, error) {
  5846. gensupport.SetOptions(c.urlParams_, opts...)
  5847. res, err := c.doRequest("json")
  5848. if res != nil && res.StatusCode == http.StatusNotModified {
  5849. if res.Body != nil {
  5850. res.Body.Close()
  5851. }
  5852. return nil, &googleapi.Error{
  5853. Code: res.StatusCode,
  5854. Header: res.Header,
  5855. }
  5856. }
  5857. if err != nil {
  5858. return nil, err
  5859. }
  5860. defer googleapi.CloseBody(res)
  5861. if err := googleapi.CheckResponse(res); err != nil {
  5862. return nil, err
  5863. }
  5864. ret := &Objects{
  5865. ServerResponse: googleapi.ServerResponse{
  5866. Header: res.Header,
  5867. HTTPStatusCode: res.StatusCode,
  5868. },
  5869. }
  5870. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  5871. return nil, err
  5872. }
  5873. return ret, nil
  5874. // {
  5875. // "description": "Retrieves a list of objects matching the criteria.",
  5876. // "httpMethod": "GET",
  5877. // "id": "storage.objects.list",
  5878. // "parameterOrder": [
  5879. // "bucket"
  5880. // ],
  5881. // "parameters": {
  5882. // "bucket": {
  5883. // "description": "Name of the bucket in which to look for objects.",
  5884. // "location": "path",
  5885. // "required": true,
  5886. // "type": "string"
  5887. // },
  5888. // "delimiter": {
  5889. // "description": "Returns results in a directory-like mode. items will contain only objects whose names, aside from the prefix, do not contain delimiter. Objects whose names, aside from the prefix, contain delimiter will have their name, truncated after the delimiter, returned in prefixes. Duplicate prefixes are omitted.",
  5890. // "location": "query",
  5891. // "type": "string"
  5892. // },
  5893. // "maxResults": {
  5894. // "description": "Maximum number of items plus prefixes to return. As duplicate prefixes are omitted, fewer total results may be returned than requested. The default value of this parameter is 1,000 items.",
  5895. // "format": "uint32",
  5896. // "location": "query",
  5897. // "minimum": "0",
  5898. // "type": "integer"
  5899. // },
  5900. // "pageToken": {
  5901. // "description": "A previously-returned page token representing part of the larger set of results to view.",
  5902. // "location": "query",
  5903. // "type": "string"
  5904. // },
  5905. // "prefix": {
  5906. // "description": "Filter results to objects whose names begin with this prefix.",
  5907. // "location": "query",
  5908. // "type": "string"
  5909. // },
  5910. // "projection": {
  5911. // "description": "Set of properties to return. Defaults to noAcl.",
  5912. // "enum": [
  5913. // "full",
  5914. // "noAcl"
  5915. // ],
  5916. // "enumDescriptions": [
  5917. // "Include all properties.",
  5918. // "Omit the acl property."
  5919. // ],
  5920. // "location": "query",
  5921. // "type": "string"
  5922. // },
  5923. // "versions": {
  5924. // "description": "If true, lists all versions of an object as distinct results. The default is false. For more information, see Object Versioning.",
  5925. // "location": "query",
  5926. // "type": "boolean"
  5927. // }
  5928. // },
  5929. // "path": "b/{bucket}/o",
  5930. // "response": {
  5931. // "$ref": "Objects"
  5932. // },
  5933. // "scopes": [
  5934. // "https://www.googleapis.com/auth/cloud-platform",
  5935. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  5936. // "https://www.googleapis.com/auth/devstorage.full_control",
  5937. // "https://www.googleapis.com/auth/devstorage.read_only",
  5938. // "https://www.googleapis.com/auth/devstorage.read_write"
  5939. // ],
  5940. // "supportsSubscription": true
  5941. // }
  5942. }
  5943. // Pages invokes f for each page of results.
  5944. // A non-nil error returned from f will halt the iteration.
  5945. // The provided context supersedes any context provided to the Context method.
  5946. func (c *ObjectsListCall) Pages(ctx context.Context, f func(*Objects) error) error {
  5947. c.ctx_ = ctx
  5948. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  5949. for {
  5950. x, err := c.Do()
  5951. if err != nil {
  5952. return err
  5953. }
  5954. if err := f(x); err != nil {
  5955. return err
  5956. }
  5957. if x.NextPageToken == "" {
  5958. return nil
  5959. }
  5960. c.PageToken(x.NextPageToken)
  5961. }
  5962. }
  5963. // method id "storage.objects.patch":
  5964. type ObjectsPatchCall struct {
  5965. s *Service
  5966. bucket string
  5967. object string
  5968. object2 *Object
  5969. urlParams_ gensupport.URLParams
  5970. ctx_ context.Context
  5971. }
  5972. // Patch: Updates an object's metadata. This method supports patch
  5973. // semantics.
  5974. func (r *ObjectsService) Patch(bucket string, object string, object2 *Object) *ObjectsPatchCall {
  5975. c := &ObjectsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5976. c.bucket = bucket
  5977. c.object = object
  5978. c.object2 = object2
  5979. return c
  5980. }
  5981. // Generation sets the optional parameter "generation": If present,
  5982. // selects a specific revision of this object (as opposed to the latest
  5983. // version, the default).
  5984. func (c *ObjectsPatchCall) Generation(generation int64) *ObjectsPatchCall {
  5985. c.urlParams_.Set("generation", fmt.Sprint(generation))
  5986. return c
  5987. }
  5988. // IfGenerationMatch sets the optional parameter "ifGenerationMatch":
  5989. // Makes the operation conditional on whether the object's current
  5990. // generation matches the given value.
  5991. func (c *ObjectsPatchCall) IfGenerationMatch(ifGenerationMatch int64) *ObjectsPatchCall {
  5992. c.urlParams_.Set("ifGenerationMatch", fmt.Sprint(ifGenerationMatch))
  5993. return c
  5994. }
  5995. // IfGenerationNotMatch sets the optional parameter
  5996. // "ifGenerationNotMatch": Makes the operation conditional on whether
  5997. // the object's current generation does not match the given value.
  5998. func (c *ObjectsPatchCall) IfGenerationNotMatch(ifGenerationNotMatch int64) *ObjectsPatchCall {
  5999. c.urlParams_.Set("ifGenerationNotMatch", fmt.Sprint(ifGenerationNotMatch))
  6000. return c
  6001. }
  6002. // IfMetagenerationMatch sets the optional parameter
  6003. // "ifMetagenerationMatch": Makes the operation conditional on whether
  6004. // the object's current metageneration matches the given value.
  6005. func (c *ObjectsPatchCall) IfMetagenerationMatch(ifMetagenerationMatch int64) *ObjectsPatchCall {
  6006. c.urlParams_.Set("ifMetagenerationMatch", fmt.Sprint(ifMetagenerationMatch))
  6007. return c
  6008. }
  6009. // IfMetagenerationNotMatch sets the optional parameter
  6010. // "ifMetagenerationNotMatch": Makes the operation conditional on
  6011. // whether the object's current metageneration does not match the given
  6012. // value.
  6013. func (c *ObjectsPatchCall) IfMetagenerationNotMatch(ifMetagenerationNotMatch int64) *ObjectsPatchCall {
  6014. c.urlParams_.Set("ifMetagenerationNotMatch", fmt.Sprint(ifMetagenerationNotMatch))
  6015. return c
  6016. }
  6017. // PredefinedAcl sets the optional parameter "predefinedAcl": Apply a
  6018. // predefined set of access controls to this object.
  6019. //
  6020. // Possible values:
  6021. // "authenticatedRead" - Object owner gets OWNER access, and
  6022. // allAuthenticatedUsers get READER access.
  6023. // "bucketOwnerFullControl" - Object owner gets OWNER access, and
  6024. // project team owners get OWNER access.
  6025. // "bucketOwnerRead" - Object owner gets OWNER access, and project
  6026. // team owners get READER access.
  6027. // "private" - Object owner gets OWNER access.
  6028. // "projectPrivate" - Object owner gets OWNER access, and project team
  6029. // members get access according to their roles.
  6030. // "publicRead" - Object owner gets OWNER access, and allUsers get
  6031. // READER access.
  6032. func (c *ObjectsPatchCall) PredefinedAcl(predefinedAcl string) *ObjectsPatchCall {
  6033. c.urlParams_.Set("predefinedAcl", predefinedAcl)
  6034. return c
  6035. }
  6036. // Projection sets the optional parameter "projection": Set of
  6037. // properties to return. Defaults to full.
  6038. //
  6039. // Possible values:
  6040. // "full" - Include all properties.
  6041. // "noAcl" - Omit the acl property.
  6042. func (c *ObjectsPatchCall) Projection(projection string) *ObjectsPatchCall {
  6043. c.urlParams_.Set("projection", projection)
  6044. return c
  6045. }
  6046. // Fields allows partial responses to be retrieved. See
  6047. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6048. // for more information.
  6049. func (c *ObjectsPatchCall) Fields(s ...googleapi.Field) *ObjectsPatchCall {
  6050. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6051. return c
  6052. }
  6053. // Context sets the context to be used in this call's Do method. Any
  6054. // pending HTTP request will be aborted if the provided context is
  6055. // canceled.
  6056. func (c *ObjectsPatchCall) Context(ctx context.Context) *ObjectsPatchCall {
  6057. c.ctx_ = ctx
  6058. return c
  6059. }
  6060. func (c *ObjectsPatchCall) doRequest(alt string) (*http.Response, error) {
  6061. var body io.Reader = nil
  6062. body, err := googleapi.WithoutDataWrapper.JSONReader(c.object2)
  6063. if err != nil {
  6064. return nil, err
  6065. }
  6066. ctype := "application/json"
  6067. c.urlParams_.Set("alt", alt)
  6068. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}")
  6069. urls += "?" + c.urlParams_.Encode()
  6070. req, _ := http.NewRequest("PATCH", urls, body)
  6071. googleapi.Expand(req.URL, map[string]string{
  6072. "bucket": c.bucket,
  6073. "object": c.object,
  6074. })
  6075. req.Header.Set("Content-Type", ctype)
  6076. req.Header.Set("User-Agent", c.s.userAgent())
  6077. if c.ctx_ != nil {
  6078. return ctxhttp.Do(c.ctx_, c.s.client, req)
  6079. }
  6080. return c.s.client.Do(req)
  6081. }
  6082. // Do executes the "storage.objects.patch" call.
  6083. // Exactly one of *Object or error will be non-nil. Any non-2xx status
  6084. // code is an error. Response headers are in either
  6085. // *Object.ServerResponse.Header or (if a response was returned at all)
  6086. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  6087. // check whether the returned error was because http.StatusNotModified
  6088. // was returned.
  6089. func (c *ObjectsPatchCall) Do(opts ...googleapi.CallOption) (*Object, error) {
  6090. gensupport.SetOptions(c.urlParams_, opts...)
  6091. res, err := c.doRequest("json")
  6092. if res != nil && res.StatusCode == http.StatusNotModified {
  6093. if res.Body != nil {
  6094. res.Body.Close()
  6095. }
  6096. return nil, &googleapi.Error{
  6097. Code: res.StatusCode,
  6098. Header: res.Header,
  6099. }
  6100. }
  6101. if err != nil {
  6102. return nil, err
  6103. }
  6104. defer googleapi.CloseBody(res)
  6105. if err := googleapi.CheckResponse(res); err != nil {
  6106. return nil, err
  6107. }
  6108. ret := &Object{
  6109. ServerResponse: googleapi.ServerResponse{
  6110. Header: res.Header,
  6111. HTTPStatusCode: res.StatusCode,
  6112. },
  6113. }
  6114. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  6115. return nil, err
  6116. }
  6117. return ret, nil
  6118. // {
  6119. // "description": "Updates an object's metadata. This method supports patch semantics.",
  6120. // "httpMethod": "PATCH",
  6121. // "id": "storage.objects.patch",
  6122. // "parameterOrder": [
  6123. // "bucket",
  6124. // "object"
  6125. // ],
  6126. // "parameters": {
  6127. // "bucket": {
  6128. // "description": "Name of the bucket in which the object resides.",
  6129. // "location": "path",
  6130. // "required": true,
  6131. // "type": "string"
  6132. // },
  6133. // "generation": {
  6134. // "description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).",
  6135. // "format": "int64",
  6136. // "location": "query",
  6137. // "type": "string"
  6138. // },
  6139. // "ifGenerationMatch": {
  6140. // "description": "Makes the operation conditional on whether the object's current generation matches the given value.",
  6141. // "format": "int64",
  6142. // "location": "query",
  6143. // "type": "string"
  6144. // },
  6145. // "ifGenerationNotMatch": {
  6146. // "description": "Makes the operation conditional on whether the object's current generation does not match the given value.",
  6147. // "format": "int64",
  6148. // "location": "query",
  6149. // "type": "string"
  6150. // },
  6151. // "ifMetagenerationMatch": {
  6152. // "description": "Makes the operation conditional on whether the object's current metageneration matches the given value.",
  6153. // "format": "int64",
  6154. // "location": "query",
  6155. // "type": "string"
  6156. // },
  6157. // "ifMetagenerationNotMatch": {
  6158. // "description": "Makes the operation conditional on whether the object's current metageneration does not match the given value.",
  6159. // "format": "int64",
  6160. // "location": "query",
  6161. // "type": "string"
  6162. // },
  6163. // "object": {
  6164. // "description": "Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
  6165. // "location": "path",
  6166. // "required": true,
  6167. // "type": "string"
  6168. // },
  6169. // "predefinedAcl": {
  6170. // "description": "Apply a predefined set of access controls to this object.",
  6171. // "enum": [
  6172. // "authenticatedRead",
  6173. // "bucketOwnerFullControl",
  6174. // "bucketOwnerRead",
  6175. // "private",
  6176. // "projectPrivate",
  6177. // "publicRead"
  6178. // ],
  6179. // "enumDescriptions": [
  6180. // "Object owner gets OWNER access, and allAuthenticatedUsers get READER access.",
  6181. // "Object owner gets OWNER access, and project team owners get OWNER access.",
  6182. // "Object owner gets OWNER access, and project team owners get READER access.",
  6183. // "Object owner gets OWNER access.",
  6184. // "Object owner gets OWNER access, and project team members get access according to their roles.",
  6185. // "Object owner gets OWNER access, and allUsers get READER access."
  6186. // ],
  6187. // "location": "query",
  6188. // "type": "string"
  6189. // },
  6190. // "projection": {
  6191. // "description": "Set of properties to return. Defaults to full.",
  6192. // "enum": [
  6193. // "full",
  6194. // "noAcl"
  6195. // ],
  6196. // "enumDescriptions": [
  6197. // "Include all properties.",
  6198. // "Omit the acl property."
  6199. // ],
  6200. // "location": "query",
  6201. // "type": "string"
  6202. // }
  6203. // },
  6204. // "path": "b/{bucket}/o/{object}",
  6205. // "request": {
  6206. // "$ref": "Object"
  6207. // },
  6208. // "response": {
  6209. // "$ref": "Object"
  6210. // },
  6211. // "scopes": [
  6212. // "https://www.googleapis.com/auth/cloud-platform",
  6213. // "https://www.googleapis.com/auth/devstorage.full_control",
  6214. // "https://www.googleapis.com/auth/devstorage.read_write"
  6215. // ]
  6216. // }
  6217. }
  6218. // method id "storage.objects.rewrite":
  6219. type ObjectsRewriteCall struct {
  6220. s *Service
  6221. sourceBucket string
  6222. sourceObject string
  6223. destinationBucket string
  6224. destinationObject string
  6225. object *Object
  6226. urlParams_ gensupport.URLParams
  6227. ctx_ context.Context
  6228. }
  6229. // Rewrite: Rewrites a source object to a destination object. Optionally
  6230. // overrides metadata.
  6231. func (r *ObjectsService) Rewrite(sourceBucket string, sourceObject string, destinationBucket string, destinationObject string, object *Object) *ObjectsRewriteCall {
  6232. c := &ObjectsRewriteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6233. c.sourceBucket = sourceBucket
  6234. c.sourceObject = sourceObject
  6235. c.destinationBucket = destinationBucket
  6236. c.destinationObject = destinationObject
  6237. c.object = object
  6238. return c
  6239. }
  6240. // DestinationPredefinedAcl sets the optional parameter
  6241. // "destinationPredefinedAcl": Apply a predefined set of access controls
  6242. // to the destination object.
  6243. //
  6244. // Possible values:
  6245. // "authenticatedRead" - Object owner gets OWNER access, and
  6246. // allAuthenticatedUsers get READER access.
  6247. // "bucketOwnerFullControl" - Object owner gets OWNER access, and
  6248. // project team owners get OWNER access.
  6249. // "bucketOwnerRead" - Object owner gets OWNER access, and project
  6250. // team owners get READER access.
  6251. // "private" - Object owner gets OWNER access.
  6252. // "projectPrivate" - Object owner gets OWNER access, and project team
  6253. // members get access according to their roles.
  6254. // "publicRead" - Object owner gets OWNER access, and allUsers get
  6255. // READER access.
  6256. func (c *ObjectsRewriteCall) DestinationPredefinedAcl(destinationPredefinedAcl string) *ObjectsRewriteCall {
  6257. c.urlParams_.Set("destinationPredefinedAcl", destinationPredefinedAcl)
  6258. return c
  6259. }
  6260. // IfGenerationMatch sets the optional parameter "ifGenerationMatch":
  6261. // Makes the operation conditional on whether the destination object's
  6262. // current generation matches the given value.
  6263. func (c *ObjectsRewriteCall) IfGenerationMatch(ifGenerationMatch int64) *ObjectsRewriteCall {
  6264. c.urlParams_.Set("ifGenerationMatch", fmt.Sprint(ifGenerationMatch))
  6265. return c
  6266. }
  6267. // IfGenerationNotMatch sets the optional parameter
  6268. // "ifGenerationNotMatch": Makes the operation conditional on whether
  6269. // the destination object's current generation does not match the given
  6270. // value.
  6271. func (c *ObjectsRewriteCall) IfGenerationNotMatch(ifGenerationNotMatch int64) *ObjectsRewriteCall {
  6272. c.urlParams_.Set("ifGenerationNotMatch", fmt.Sprint(ifGenerationNotMatch))
  6273. return c
  6274. }
  6275. // IfMetagenerationMatch sets the optional parameter
  6276. // "ifMetagenerationMatch": Makes the operation conditional on whether
  6277. // the destination object's current metageneration matches the given
  6278. // value.
  6279. func (c *ObjectsRewriteCall) IfMetagenerationMatch(ifMetagenerationMatch int64) *ObjectsRewriteCall {
  6280. c.urlParams_.Set("ifMetagenerationMatch", fmt.Sprint(ifMetagenerationMatch))
  6281. return c
  6282. }
  6283. // IfMetagenerationNotMatch sets the optional parameter
  6284. // "ifMetagenerationNotMatch": Makes the operation conditional on
  6285. // whether the destination object's current metageneration does not
  6286. // match the given value.
  6287. func (c *ObjectsRewriteCall) IfMetagenerationNotMatch(ifMetagenerationNotMatch int64) *ObjectsRewriteCall {
  6288. c.urlParams_.Set("ifMetagenerationNotMatch", fmt.Sprint(ifMetagenerationNotMatch))
  6289. return c
  6290. }
  6291. // IfSourceGenerationMatch sets the optional parameter
  6292. // "ifSourceGenerationMatch": Makes the operation conditional on whether
  6293. // the source object's generation matches the given value.
  6294. func (c *ObjectsRewriteCall) IfSourceGenerationMatch(ifSourceGenerationMatch int64) *ObjectsRewriteCall {
  6295. c.urlParams_.Set("ifSourceGenerationMatch", fmt.Sprint(ifSourceGenerationMatch))
  6296. return c
  6297. }
  6298. // IfSourceGenerationNotMatch sets the optional parameter
  6299. // "ifSourceGenerationNotMatch": Makes the operation conditional on
  6300. // whether the source object's generation does not match the given
  6301. // value.
  6302. func (c *ObjectsRewriteCall) IfSourceGenerationNotMatch(ifSourceGenerationNotMatch int64) *ObjectsRewriteCall {
  6303. c.urlParams_.Set("ifSourceGenerationNotMatch", fmt.Sprint(ifSourceGenerationNotMatch))
  6304. return c
  6305. }
  6306. // IfSourceMetagenerationMatch sets the optional parameter
  6307. // "ifSourceMetagenerationMatch": Makes the operation conditional on
  6308. // whether the source object's current metageneration matches the given
  6309. // value.
  6310. func (c *ObjectsRewriteCall) IfSourceMetagenerationMatch(ifSourceMetagenerationMatch int64) *ObjectsRewriteCall {
  6311. c.urlParams_.Set("ifSourceMetagenerationMatch", fmt.Sprint(ifSourceMetagenerationMatch))
  6312. return c
  6313. }
  6314. // IfSourceMetagenerationNotMatch sets the optional parameter
  6315. // "ifSourceMetagenerationNotMatch": Makes the operation conditional on
  6316. // whether the source object's current metageneration does not match the
  6317. // given value.
  6318. func (c *ObjectsRewriteCall) IfSourceMetagenerationNotMatch(ifSourceMetagenerationNotMatch int64) *ObjectsRewriteCall {
  6319. c.urlParams_.Set("ifSourceMetagenerationNotMatch", fmt.Sprint(ifSourceMetagenerationNotMatch))
  6320. return c
  6321. }
  6322. // MaxBytesRewrittenPerCall sets the optional parameter
  6323. // "maxBytesRewrittenPerCall": The maximum number of bytes that will be
  6324. // rewritten per rewrite request. Most callers shouldn't need to specify
  6325. // this parameter - it is primarily in place to support testing. If
  6326. // specified the value must be an integral multiple of 1 MiB (1048576).
  6327. // Also, this only applies to requests where the source and destination
  6328. // span locations and/or storage classes. Finally, this value must not
  6329. // change across rewrite calls else you'll get an error that the
  6330. // rewriteToken is invalid.
  6331. func (c *ObjectsRewriteCall) MaxBytesRewrittenPerCall(maxBytesRewrittenPerCall int64) *ObjectsRewriteCall {
  6332. c.urlParams_.Set("maxBytesRewrittenPerCall", fmt.Sprint(maxBytesRewrittenPerCall))
  6333. return c
  6334. }
  6335. // Projection sets the optional parameter "projection": Set of
  6336. // properties to return. Defaults to noAcl, unless the object resource
  6337. // specifies the acl property, when it defaults to full.
  6338. //
  6339. // Possible values:
  6340. // "full" - Include all properties.
  6341. // "noAcl" - Omit the acl property.
  6342. func (c *ObjectsRewriteCall) Projection(projection string) *ObjectsRewriteCall {
  6343. c.urlParams_.Set("projection", projection)
  6344. return c
  6345. }
  6346. // RewriteToken sets the optional parameter "rewriteToken": Include this
  6347. // field (from the previous rewrite response) on each rewrite request
  6348. // after the first one, until the rewrite response 'done' flag is true.
  6349. // Calls that provide a rewriteToken can omit all other request fields,
  6350. // but if included those fields must match the values provided in the
  6351. // first rewrite request.
  6352. func (c *ObjectsRewriteCall) RewriteToken(rewriteToken string) *ObjectsRewriteCall {
  6353. c.urlParams_.Set("rewriteToken", rewriteToken)
  6354. return c
  6355. }
  6356. // SourceGeneration sets the optional parameter "sourceGeneration": If
  6357. // present, selects a specific revision of the source object (as opposed
  6358. // to the latest version, the default).
  6359. func (c *ObjectsRewriteCall) SourceGeneration(sourceGeneration int64) *ObjectsRewriteCall {
  6360. c.urlParams_.Set("sourceGeneration", fmt.Sprint(sourceGeneration))
  6361. return c
  6362. }
  6363. // Fields allows partial responses to be retrieved. See
  6364. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6365. // for more information.
  6366. func (c *ObjectsRewriteCall) Fields(s ...googleapi.Field) *ObjectsRewriteCall {
  6367. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6368. return c
  6369. }
  6370. // Context sets the context to be used in this call's Do method. Any
  6371. // pending HTTP request will be aborted if the provided context is
  6372. // canceled.
  6373. func (c *ObjectsRewriteCall) Context(ctx context.Context) *ObjectsRewriteCall {
  6374. c.ctx_ = ctx
  6375. return c
  6376. }
  6377. func (c *ObjectsRewriteCall) doRequest(alt string) (*http.Response, error) {
  6378. var body io.Reader = nil
  6379. body, err := googleapi.WithoutDataWrapper.JSONReader(c.object)
  6380. if err != nil {
  6381. return nil, err
  6382. }
  6383. ctype := "application/json"
  6384. c.urlParams_.Set("alt", alt)
  6385. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{sourceBucket}/o/{sourceObject}/rewriteTo/b/{destinationBucket}/o/{destinationObject}")
  6386. urls += "?" + c.urlParams_.Encode()
  6387. req, _ := http.NewRequest("POST", urls, body)
  6388. googleapi.Expand(req.URL, map[string]string{
  6389. "sourceBucket": c.sourceBucket,
  6390. "sourceObject": c.sourceObject,
  6391. "destinationBucket": c.destinationBucket,
  6392. "destinationObject": c.destinationObject,
  6393. })
  6394. req.Header.Set("Content-Type", ctype)
  6395. req.Header.Set("User-Agent", c.s.userAgent())
  6396. if c.ctx_ != nil {
  6397. return ctxhttp.Do(c.ctx_, c.s.client, req)
  6398. }
  6399. return c.s.client.Do(req)
  6400. }
  6401. // Do executes the "storage.objects.rewrite" call.
  6402. // Exactly one of *RewriteResponse or error will be non-nil. Any non-2xx
  6403. // status code is an error. Response headers are in either
  6404. // *RewriteResponse.ServerResponse.Header or (if a response was returned
  6405. // at all) in error.(*googleapi.Error).Header. Use
  6406. // googleapi.IsNotModified to check whether the returned error was
  6407. // because http.StatusNotModified was returned.
  6408. func (c *ObjectsRewriteCall) Do(opts ...googleapi.CallOption) (*RewriteResponse, error) {
  6409. gensupport.SetOptions(c.urlParams_, opts...)
  6410. res, err := c.doRequest("json")
  6411. if res != nil && res.StatusCode == http.StatusNotModified {
  6412. if res.Body != nil {
  6413. res.Body.Close()
  6414. }
  6415. return nil, &googleapi.Error{
  6416. Code: res.StatusCode,
  6417. Header: res.Header,
  6418. }
  6419. }
  6420. if err != nil {
  6421. return nil, err
  6422. }
  6423. defer googleapi.CloseBody(res)
  6424. if err := googleapi.CheckResponse(res); err != nil {
  6425. return nil, err
  6426. }
  6427. ret := &RewriteResponse{
  6428. ServerResponse: googleapi.ServerResponse{
  6429. Header: res.Header,
  6430. HTTPStatusCode: res.StatusCode,
  6431. },
  6432. }
  6433. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  6434. return nil, err
  6435. }
  6436. return ret, nil
  6437. // {
  6438. // "description": "Rewrites a source object to a destination object. Optionally overrides metadata.",
  6439. // "httpMethod": "POST",
  6440. // "id": "storage.objects.rewrite",
  6441. // "parameterOrder": [
  6442. // "sourceBucket",
  6443. // "sourceObject",
  6444. // "destinationBucket",
  6445. // "destinationObject"
  6446. // ],
  6447. // "parameters": {
  6448. // "destinationBucket": {
  6449. // "description": "Name of the bucket in which to store the new object. Overrides the provided object metadata's bucket value, if any.",
  6450. // "location": "path",
  6451. // "required": true,
  6452. // "type": "string"
  6453. // },
  6454. // "destinationObject": {
  6455. // "description": "Name of the new object. Required when the object metadata is not otherwise provided. Overrides the object metadata's name value, if any. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
  6456. // "location": "path",
  6457. // "required": true,
  6458. // "type": "string"
  6459. // },
  6460. // "destinationPredefinedAcl": {
  6461. // "description": "Apply a predefined set of access controls to the destination object.",
  6462. // "enum": [
  6463. // "authenticatedRead",
  6464. // "bucketOwnerFullControl",
  6465. // "bucketOwnerRead",
  6466. // "private",
  6467. // "projectPrivate",
  6468. // "publicRead"
  6469. // ],
  6470. // "enumDescriptions": [
  6471. // "Object owner gets OWNER access, and allAuthenticatedUsers get READER access.",
  6472. // "Object owner gets OWNER access, and project team owners get OWNER access.",
  6473. // "Object owner gets OWNER access, and project team owners get READER access.",
  6474. // "Object owner gets OWNER access.",
  6475. // "Object owner gets OWNER access, and project team members get access according to their roles.",
  6476. // "Object owner gets OWNER access, and allUsers get READER access."
  6477. // ],
  6478. // "location": "query",
  6479. // "type": "string"
  6480. // },
  6481. // "ifGenerationMatch": {
  6482. // "description": "Makes the operation conditional on whether the destination object's current generation matches the given value.",
  6483. // "format": "int64",
  6484. // "location": "query",
  6485. // "type": "string"
  6486. // },
  6487. // "ifGenerationNotMatch": {
  6488. // "description": "Makes the operation conditional on whether the destination object's current generation does not match the given value.",
  6489. // "format": "int64",
  6490. // "location": "query",
  6491. // "type": "string"
  6492. // },
  6493. // "ifMetagenerationMatch": {
  6494. // "description": "Makes the operation conditional on whether the destination object's current metageneration matches the given value.",
  6495. // "format": "int64",
  6496. // "location": "query",
  6497. // "type": "string"
  6498. // },
  6499. // "ifMetagenerationNotMatch": {
  6500. // "description": "Makes the operation conditional on whether the destination object's current metageneration does not match the given value.",
  6501. // "format": "int64",
  6502. // "location": "query",
  6503. // "type": "string"
  6504. // },
  6505. // "ifSourceGenerationMatch": {
  6506. // "description": "Makes the operation conditional on whether the source object's generation matches the given value.",
  6507. // "format": "int64",
  6508. // "location": "query",
  6509. // "type": "string"
  6510. // },
  6511. // "ifSourceGenerationNotMatch": {
  6512. // "description": "Makes the operation conditional on whether the source object's generation does not match the given value.",
  6513. // "format": "int64",
  6514. // "location": "query",
  6515. // "type": "string"
  6516. // },
  6517. // "ifSourceMetagenerationMatch": {
  6518. // "description": "Makes the operation conditional on whether the source object's current metageneration matches the given value.",
  6519. // "format": "int64",
  6520. // "location": "query",
  6521. // "type": "string"
  6522. // },
  6523. // "ifSourceMetagenerationNotMatch": {
  6524. // "description": "Makes the operation conditional on whether the source object's current metageneration does not match the given value.",
  6525. // "format": "int64",
  6526. // "location": "query",
  6527. // "type": "string"
  6528. // },
  6529. // "maxBytesRewrittenPerCall": {
  6530. // "description": "The maximum number of bytes that will be rewritten per rewrite request. Most callers shouldn't need to specify this parameter - it is primarily in place to support testing. If specified the value must be an integral multiple of 1 MiB (1048576). Also, this only applies to requests where the source and destination span locations and/or storage classes. Finally, this value must not change across rewrite calls else you'll get an error that the rewriteToken is invalid.",
  6531. // "format": "int64",
  6532. // "location": "query",
  6533. // "type": "string"
  6534. // },
  6535. // "projection": {
  6536. // "description": "Set of properties to return. Defaults to noAcl, unless the object resource specifies the acl property, when it defaults to full.",
  6537. // "enum": [
  6538. // "full",
  6539. // "noAcl"
  6540. // ],
  6541. // "enumDescriptions": [
  6542. // "Include all properties.",
  6543. // "Omit the acl property."
  6544. // ],
  6545. // "location": "query",
  6546. // "type": "string"
  6547. // },
  6548. // "rewriteToken": {
  6549. // "description": "Include this field (from the previous rewrite response) on each rewrite request after the first one, until the rewrite response 'done' flag is true. Calls that provide a rewriteToken can omit all other request fields, but if included those fields must match the values provided in the first rewrite request.",
  6550. // "location": "query",
  6551. // "type": "string"
  6552. // },
  6553. // "sourceBucket": {
  6554. // "description": "Name of the bucket in which to find the source object.",
  6555. // "location": "path",
  6556. // "required": true,
  6557. // "type": "string"
  6558. // },
  6559. // "sourceGeneration": {
  6560. // "description": "If present, selects a specific revision of the source object (as opposed to the latest version, the default).",
  6561. // "format": "int64",
  6562. // "location": "query",
  6563. // "type": "string"
  6564. // },
  6565. // "sourceObject": {
  6566. // "description": "Name of the source object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
  6567. // "location": "path",
  6568. // "required": true,
  6569. // "type": "string"
  6570. // }
  6571. // },
  6572. // "path": "b/{sourceBucket}/o/{sourceObject}/rewriteTo/b/{destinationBucket}/o/{destinationObject}",
  6573. // "request": {
  6574. // "$ref": "Object"
  6575. // },
  6576. // "response": {
  6577. // "$ref": "RewriteResponse"
  6578. // },
  6579. // "scopes": [
  6580. // "https://www.googleapis.com/auth/cloud-platform",
  6581. // "https://www.googleapis.com/auth/devstorage.full_control",
  6582. // "https://www.googleapis.com/auth/devstorage.read_write"
  6583. // ]
  6584. // }
  6585. }
  6586. // method id "storage.objects.update":
  6587. type ObjectsUpdateCall struct {
  6588. s *Service
  6589. bucket string
  6590. object string
  6591. object2 *Object
  6592. urlParams_ gensupport.URLParams
  6593. ctx_ context.Context
  6594. }
  6595. // Update: Updates an object's metadata.
  6596. func (r *ObjectsService) Update(bucket string, object string, object2 *Object) *ObjectsUpdateCall {
  6597. c := &ObjectsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6598. c.bucket = bucket
  6599. c.object = object
  6600. c.object2 = object2
  6601. return c
  6602. }
  6603. // Generation sets the optional parameter "generation": If present,
  6604. // selects a specific revision of this object (as opposed to the latest
  6605. // version, the default).
  6606. func (c *ObjectsUpdateCall) Generation(generation int64) *ObjectsUpdateCall {
  6607. c.urlParams_.Set("generation", fmt.Sprint(generation))
  6608. return c
  6609. }
  6610. // IfGenerationMatch sets the optional parameter "ifGenerationMatch":
  6611. // Makes the operation conditional on whether the object's current
  6612. // generation matches the given value.
  6613. func (c *ObjectsUpdateCall) IfGenerationMatch(ifGenerationMatch int64) *ObjectsUpdateCall {
  6614. c.urlParams_.Set("ifGenerationMatch", fmt.Sprint(ifGenerationMatch))
  6615. return c
  6616. }
  6617. // IfGenerationNotMatch sets the optional parameter
  6618. // "ifGenerationNotMatch": Makes the operation conditional on whether
  6619. // the object's current generation does not match the given value.
  6620. func (c *ObjectsUpdateCall) IfGenerationNotMatch(ifGenerationNotMatch int64) *ObjectsUpdateCall {
  6621. c.urlParams_.Set("ifGenerationNotMatch", fmt.Sprint(ifGenerationNotMatch))
  6622. return c
  6623. }
  6624. // IfMetagenerationMatch sets the optional parameter
  6625. // "ifMetagenerationMatch": Makes the operation conditional on whether
  6626. // the object's current metageneration matches the given value.
  6627. func (c *ObjectsUpdateCall) IfMetagenerationMatch(ifMetagenerationMatch int64) *ObjectsUpdateCall {
  6628. c.urlParams_.Set("ifMetagenerationMatch", fmt.Sprint(ifMetagenerationMatch))
  6629. return c
  6630. }
  6631. // IfMetagenerationNotMatch sets the optional parameter
  6632. // "ifMetagenerationNotMatch": Makes the operation conditional on
  6633. // whether the object's current metageneration does not match the given
  6634. // value.
  6635. func (c *ObjectsUpdateCall) IfMetagenerationNotMatch(ifMetagenerationNotMatch int64) *ObjectsUpdateCall {
  6636. c.urlParams_.Set("ifMetagenerationNotMatch", fmt.Sprint(ifMetagenerationNotMatch))
  6637. return c
  6638. }
  6639. // PredefinedAcl sets the optional parameter "predefinedAcl": Apply a
  6640. // predefined set of access controls to this object.
  6641. //
  6642. // Possible values:
  6643. // "authenticatedRead" - Object owner gets OWNER access, and
  6644. // allAuthenticatedUsers get READER access.
  6645. // "bucketOwnerFullControl" - Object owner gets OWNER access, and
  6646. // project team owners get OWNER access.
  6647. // "bucketOwnerRead" - Object owner gets OWNER access, and project
  6648. // team owners get READER access.
  6649. // "private" - Object owner gets OWNER access.
  6650. // "projectPrivate" - Object owner gets OWNER access, and project team
  6651. // members get access according to their roles.
  6652. // "publicRead" - Object owner gets OWNER access, and allUsers get
  6653. // READER access.
  6654. func (c *ObjectsUpdateCall) PredefinedAcl(predefinedAcl string) *ObjectsUpdateCall {
  6655. c.urlParams_.Set("predefinedAcl", predefinedAcl)
  6656. return c
  6657. }
  6658. // Projection sets the optional parameter "projection": Set of
  6659. // properties to return. Defaults to full.
  6660. //
  6661. // Possible values:
  6662. // "full" - Include all properties.
  6663. // "noAcl" - Omit the acl property.
  6664. func (c *ObjectsUpdateCall) Projection(projection string) *ObjectsUpdateCall {
  6665. c.urlParams_.Set("projection", projection)
  6666. return c
  6667. }
  6668. // Fields allows partial responses to be retrieved. See
  6669. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6670. // for more information.
  6671. func (c *ObjectsUpdateCall) Fields(s ...googleapi.Field) *ObjectsUpdateCall {
  6672. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6673. return c
  6674. }
  6675. // Context sets the context to be used in this call's Do and Download
  6676. // methods. Any pending HTTP request will be aborted if the provided
  6677. // context is canceled.
  6678. func (c *ObjectsUpdateCall) Context(ctx context.Context) *ObjectsUpdateCall {
  6679. c.ctx_ = ctx
  6680. return c
  6681. }
  6682. func (c *ObjectsUpdateCall) doRequest(alt string) (*http.Response, error) {
  6683. var body io.Reader = nil
  6684. body, err := googleapi.WithoutDataWrapper.JSONReader(c.object2)
  6685. if err != nil {
  6686. return nil, err
  6687. }
  6688. ctype := "application/json"
  6689. c.urlParams_.Set("alt", alt)
  6690. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}")
  6691. urls += "?" + c.urlParams_.Encode()
  6692. req, _ := http.NewRequest("PUT", urls, body)
  6693. googleapi.Expand(req.URL, map[string]string{
  6694. "bucket": c.bucket,
  6695. "object": c.object,
  6696. })
  6697. req.Header.Set("Content-Type", ctype)
  6698. req.Header.Set("User-Agent", c.s.userAgent())
  6699. if c.ctx_ != nil {
  6700. return ctxhttp.Do(c.ctx_, c.s.client, req)
  6701. }
  6702. return c.s.client.Do(req)
  6703. }
  6704. // Download fetches the API endpoint's "media" value, instead of the normal
  6705. // API response value. If the returned error is nil, the Response is guaranteed to
  6706. // have a 2xx status code. Callers must close the Response.Body as usual.
  6707. func (c *ObjectsUpdateCall) Download(opts ...googleapi.CallOption) (*http.Response, error) {
  6708. gensupport.SetOptions(c.urlParams_, opts...)
  6709. res, err := c.doRequest("media")
  6710. if err != nil {
  6711. return nil, err
  6712. }
  6713. if err := googleapi.CheckMediaResponse(res); err != nil {
  6714. res.Body.Close()
  6715. return nil, err
  6716. }
  6717. return res, nil
  6718. }
  6719. // Do executes the "storage.objects.update" call.
  6720. // Exactly one of *Object or error will be non-nil. Any non-2xx status
  6721. // code is an error. Response headers are in either
  6722. // *Object.ServerResponse.Header or (if a response was returned at all)
  6723. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  6724. // check whether the returned error was because http.StatusNotModified
  6725. // was returned.
  6726. func (c *ObjectsUpdateCall) Do(opts ...googleapi.CallOption) (*Object, error) {
  6727. gensupport.SetOptions(c.urlParams_, opts...)
  6728. res, err := c.doRequest("json")
  6729. if res != nil && res.StatusCode == http.StatusNotModified {
  6730. if res.Body != nil {
  6731. res.Body.Close()
  6732. }
  6733. return nil, &googleapi.Error{
  6734. Code: res.StatusCode,
  6735. Header: res.Header,
  6736. }
  6737. }
  6738. if err != nil {
  6739. return nil, err
  6740. }
  6741. defer googleapi.CloseBody(res)
  6742. if err := googleapi.CheckResponse(res); err != nil {
  6743. return nil, err
  6744. }
  6745. ret := &Object{
  6746. ServerResponse: googleapi.ServerResponse{
  6747. Header: res.Header,
  6748. HTTPStatusCode: res.StatusCode,
  6749. },
  6750. }
  6751. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  6752. return nil, err
  6753. }
  6754. return ret, nil
  6755. // {
  6756. // "description": "Updates an object's metadata.",
  6757. // "httpMethod": "PUT",
  6758. // "id": "storage.objects.update",
  6759. // "parameterOrder": [
  6760. // "bucket",
  6761. // "object"
  6762. // ],
  6763. // "parameters": {
  6764. // "bucket": {
  6765. // "description": "Name of the bucket in which the object resides.",
  6766. // "location": "path",
  6767. // "required": true,
  6768. // "type": "string"
  6769. // },
  6770. // "generation": {
  6771. // "description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).",
  6772. // "format": "int64",
  6773. // "location": "query",
  6774. // "type": "string"
  6775. // },
  6776. // "ifGenerationMatch": {
  6777. // "description": "Makes the operation conditional on whether the object's current generation matches the given value.",
  6778. // "format": "int64",
  6779. // "location": "query",
  6780. // "type": "string"
  6781. // },
  6782. // "ifGenerationNotMatch": {
  6783. // "description": "Makes the operation conditional on whether the object's current generation does not match the given value.",
  6784. // "format": "int64",
  6785. // "location": "query",
  6786. // "type": "string"
  6787. // },
  6788. // "ifMetagenerationMatch": {
  6789. // "description": "Makes the operation conditional on whether the object's current metageneration matches the given value.",
  6790. // "format": "int64",
  6791. // "location": "query",
  6792. // "type": "string"
  6793. // },
  6794. // "ifMetagenerationNotMatch": {
  6795. // "description": "Makes the operation conditional on whether the object's current metageneration does not match the given value.",
  6796. // "format": "int64",
  6797. // "location": "query",
  6798. // "type": "string"
  6799. // },
  6800. // "object": {
  6801. // "description": "Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
  6802. // "location": "path",
  6803. // "required": true,
  6804. // "type": "string"
  6805. // },
  6806. // "predefinedAcl": {
  6807. // "description": "Apply a predefined set of access controls to this object.",
  6808. // "enum": [
  6809. // "authenticatedRead",
  6810. // "bucketOwnerFullControl",
  6811. // "bucketOwnerRead",
  6812. // "private",
  6813. // "projectPrivate",
  6814. // "publicRead"
  6815. // ],
  6816. // "enumDescriptions": [
  6817. // "Object owner gets OWNER access, and allAuthenticatedUsers get READER access.",
  6818. // "Object owner gets OWNER access, and project team owners get OWNER access.",
  6819. // "Object owner gets OWNER access, and project team owners get READER access.",
  6820. // "Object owner gets OWNER access.",
  6821. // "Object owner gets OWNER access, and project team members get access according to their roles.",
  6822. // "Object owner gets OWNER access, and allUsers get READER access."
  6823. // ],
  6824. // "location": "query",
  6825. // "type": "string"
  6826. // },
  6827. // "projection": {
  6828. // "description": "Set of properties to return. Defaults to full.",
  6829. // "enum": [
  6830. // "full",
  6831. // "noAcl"
  6832. // ],
  6833. // "enumDescriptions": [
  6834. // "Include all properties.",
  6835. // "Omit the acl property."
  6836. // ],
  6837. // "location": "query",
  6838. // "type": "string"
  6839. // }
  6840. // },
  6841. // "path": "b/{bucket}/o/{object}",
  6842. // "request": {
  6843. // "$ref": "Object"
  6844. // },
  6845. // "response": {
  6846. // "$ref": "Object"
  6847. // },
  6848. // "scopes": [
  6849. // "https://www.googleapis.com/auth/cloud-platform",
  6850. // "https://www.googleapis.com/auth/devstorage.full_control",
  6851. // "https://www.googleapis.com/auth/devstorage.read_write"
  6852. // ],
  6853. // "supportsMediaDownload": true,
  6854. // "useMediaDownloadService": true
  6855. // }
  6856. }
  6857. // method id "storage.objects.watchAll":
  6858. type ObjectsWatchAllCall struct {
  6859. s *Service
  6860. bucket string
  6861. channel *Channel
  6862. urlParams_ gensupport.URLParams
  6863. ctx_ context.Context
  6864. }
  6865. // WatchAll: Watch for changes on all objects in a bucket.
  6866. func (r *ObjectsService) WatchAll(bucket string, channel *Channel) *ObjectsWatchAllCall {
  6867. c := &ObjectsWatchAllCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6868. c.bucket = bucket
  6869. c.channel = channel
  6870. return c
  6871. }
  6872. // Delimiter sets the optional parameter "delimiter": Returns results in
  6873. // a directory-like mode. items will contain only objects whose names,
  6874. // aside from the prefix, do not contain delimiter. Objects whose names,
  6875. // aside from the prefix, contain delimiter will have their name,
  6876. // truncated after the delimiter, returned in prefixes. Duplicate
  6877. // prefixes are omitted.
  6878. func (c *ObjectsWatchAllCall) Delimiter(delimiter string) *ObjectsWatchAllCall {
  6879. c.urlParams_.Set("delimiter", delimiter)
  6880. return c
  6881. }
  6882. // MaxResults sets the optional parameter "maxResults": Maximum number
  6883. // of items plus prefixes to return. As duplicate prefixes are omitted,
  6884. // fewer total results may be returned than requested. The default value
  6885. // of this parameter is 1,000 items.
  6886. func (c *ObjectsWatchAllCall) MaxResults(maxResults int64) *ObjectsWatchAllCall {
  6887. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  6888. return c
  6889. }
  6890. // PageToken sets the optional parameter "pageToken": A
  6891. // previously-returned page token representing part of the larger set of
  6892. // results to view.
  6893. func (c *ObjectsWatchAllCall) PageToken(pageToken string) *ObjectsWatchAllCall {
  6894. c.urlParams_.Set("pageToken", pageToken)
  6895. return c
  6896. }
  6897. // Prefix sets the optional parameter "prefix": Filter results to
  6898. // objects whose names begin with this prefix.
  6899. func (c *ObjectsWatchAllCall) Prefix(prefix string) *ObjectsWatchAllCall {
  6900. c.urlParams_.Set("prefix", prefix)
  6901. return c
  6902. }
  6903. // Projection sets the optional parameter "projection": Set of
  6904. // properties to return. Defaults to noAcl.
  6905. //
  6906. // Possible values:
  6907. // "full" - Include all properties.
  6908. // "noAcl" - Omit the acl property.
  6909. func (c *ObjectsWatchAllCall) Projection(projection string) *ObjectsWatchAllCall {
  6910. c.urlParams_.Set("projection", projection)
  6911. return c
  6912. }
  6913. // Versions sets the optional parameter "versions": If true, lists all
  6914. // versions of an object as distinct results. The default is false. For
  6915. // more information, see Object Versioning.
  6916. func (c *ObjectsWatchAllCall) Versions(versions bool) *ObjectsWatchAllCall {
  6917. c.urlParams_.Set("versions", fmt.Sprint(versions))
  6918. return c
  6919. }
  6920. // Fields allows partial responses to be retrieved. See
  6921. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6922. // for more information.
  6923. func (c *ObjectsWatchAllCall) Fields(s ...googleapi.Field) *ObjectsWatchAllCall {
  6924. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6925. return c
  6926. }
  6927. // Context sets the context to be used in this call's Do method. Any
  6928. // pending HTTP request will be aborted if the provided context is
  6929. // canceled.
  6930. func (c *ObjectsWatchAllCall) Context(ctx context.Context) *ObjectsWatchAllCall {
  6931. c.ctx_ = ctx
  6932. return c
  6933. }
  6934. func (c *ObjectsWatchAllCall) doRequest(alt string) (*http.Response, error) {
  6935. var body io.Reader = nil
  6936. body, err := googleapi.WithoutDataWrapper.JSONReader(c.channel)
  6937. if err != nil {
  6938. return nil, err
  6939. }
  6940. ctype := "application/json"
  6941. c.urlParams_.Set("alt", alt)
  6942. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/watch")
  6943. urls += "?" + c.urlParams_.Encode()
  6944. req, _ := http.NewRequest("POST", urls, body)
  6945. googleapi.Expand(req.URL, map[string]string{
  6946. "bucket": c.bucket,
  6947. })
  6948. req.Header.Set("Content-Type", ctype)
  6949. req.Header.Set("User-Agent", c.s.userAgent())
  6950. if c.ctx_ != nil {
  6951. return ctxhttp.Do(c.ctx_, c.s.client, req)
  6952. }
  6953. return c.s.client.Do(req)
  6954. }
  6955. // Do executes the "storage.objects.watchAll" call.
  6956. // Exactly one of *Channel or error will be non-nil. Any non-2xx status
  6957. // code is an error. Response headers are in either
  6958. // *Channel.ServerResponse.Header or (if a response was returned at all)
  6959. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  6960. // check whether the returned error was because http.StatusNotModified
  6961. // was returned.
  6962. func (c *ObjectsWatchAllCall) Do(opts ...googleapi.CallOption) (*Channel, error) {
  6963. gensupport.SetOptions(c.urlParams_, opts...)
  6964. res, err := c.doRequest("json")
  6965. if res != nil && res.StatusCode == http.StatusNotModified {
  6966. if res.Body != nil {
  6967. res.Body.Close()
  6968. }
  6969. return nil, &googleapi.Error{
  6970. Code: res.StatusCode,
  6971. Header: res.Header,
  6972. }
  6973. }
  6974. if err != nil {
  6975. return nil, err
  6976. }
  6977. defer googleapi.CloseBody(res)
  6978. if err := googleapi.CheckResponse(res); err != nil {
  6979. return nil, err
  6980. }
  6981. ret := &Channel{
  6982. ServerResponse: googleapi.ServerResponse{
  6983. Header: res.Header,
  6984. HTTPStatusCode: res.StatusCode,
  6985. },
  6986. }
  6987. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  6988. return nil, err
  6989. }
  6990. return ret, nil
  6991. // {
  6992. // "description": "Watch for changes on all objects in a bucket.",
  6993. // "httpMethod": "POST",
  6994. // "id": "storage.objects.watchAll",
  6995. // "parameterOrder": [
  6996. // "bucket"
  6997. // ],
  6998. // "parameters": {
  6999. // "bucket": {
  7000. // "description": "Name of the bucket in which to look for objects.",
  7001. // "location": "path",
  7002. // "required": true,
  7003. // "type": "string"
  7004. // },
  7005. // "delimiter": {
  7006. // "description": "Returns results in a directory-like mode. items will contain only objects whose names, aside from the prefix, do not contain delimiter. Objects whose names, aside from the prefix, contain delimiter will have their name, truncated after the delimiter, returned in prefixes. Duplicate prefixes are omitted.",
  7007. // "location": "query",
  7008. // "type": "string"
  7009. // },
  7010. // "maxResults": {
  7011. // "description": "Maximum number of items plus prefixes to return. As duplicate prefixes are omitted, fewer total results may be returned than requested. The default value of this parameter is 1,000 items.",
  7012. // "format": "uint32",
  7013. // "location": "query",
  7014. // "minimum": "0",
  7015. // "type": "integer"
  7016. // },
  7017. // "pageToken": {
  7018. // "description": "A previously-returned page token representing part of the larger set of results to view.",
  7019. // "location": "query",
  7020. // "type": "string"
  7021. // },
  7022. // "prefix": {
  7023. // "description": "Filter results to objects whose names begin with this prefix.",
  7024. // "location": "query",
  7025. // "type": "string"
  7026. // },
  7027. // "projection": {
  7028. // "description": "Set of properties to return. Defaults to noAcl.",
  7029. // "enum": [
  7030. // "full",
  7031. // "noAcl"
  7032. // ],
  7033. // "enumDescriptions": [
  7034. // "Include all properties.",
  7035. // "Omit the acl property."
  7036. // ],
  7037. // "location": "query",
  7038. // "type": "string"
  7039. // },
  7040. // "versions": {
  7041. // "description": "If true, lists all versions of an object as distinct results. The default is false. For more information, see Object Versioning.",
  7042. // "location": "query",
  7043. // "type": "boolean"
  7044. // }
  7045. // },
  7046. // "path": "b/{bucket}/o/watch",
  7047. // "request": {
  7048. // "$ref": "Channel",
  7049. // "parameterName": "resource"
  7050. // },
  7051. // "response": {
  7052. // "$ref": "Channel"
  7053. // },
  7054. // "scopes": [
  7055. // "https://www.googleapis.com/auth/cloud-platform",
  7056. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  7057. // "https://www.googleapis.com/auth/devstorage.full_control",
  7058. // "https://www.googleapis.com/auth/devstorage.read_only",
  7059. // "https://www.googleapis.com/auth/devstorage.read_write"
  7060. // ],
  7061. // "supportsSubscription": true
  7062. // }
  7063. }