storage-gen.go 396 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173
  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.Notifications = NewNotificationsService(s)
  67. s.ObjectAccessControls = NewObjectAccessControlsService(s)
  68. s.Objects = NewObjectsService(s)
  69. s.Projects = NewProjectsService(s)
  70. return s, nil
  71. }
  72. type Service struct {
  73. client *http.Client
  74. BasePath string // API endpoint base URL
  75. UserAgent string // optional additional User-Agent fragment
  76. BucketAccessControls *BucketAccessControlsService
  77. Buckets *BucketsService
  78. Channels *ChannelsService
  79. DefaultObjectAccessControls *DefaultObjectAccessControlsService
  80. Notifications *NotificationsService
  81. ObjectAccessControls *ObjectAccessControlsService
  82. Objects *ObjectsService
  83. Projects *ProjectsService
  84. }
  85. func (s *Service) userAgent() string {
  86. if s.UserAgent == "" {
  87. return googleapi.UserAgent
  88. }
  89. return googleapi.UserAgent + " " + s.UserAgent
  90. }
  91. func NewBucketAccessControlsService(s *Service) *BucketAccessControlsService {
  92. rs := &BucketAccessControlsService{s: s}
  93. return rs
  94. }
  95. type BucketAccessControlsService struct {
  96. s *Service
  97. }
  98. func NewBucketsService(s *Service) *BucketsService {
  99. rs := &BucketsService{s: s}
  100. return rs
  101. }
  102. type BucketsService struct {
  103. s *Service
  104. }
  105. func NewChannelsService(s *Service) *ChannelsService {
  106. rs := &ChannelsService{s: s}
  107. return rs
  108. }
  109. type ChannelsService struct {
  110. s *Service
  111. }
  112. func NewDefaultObjectAccessControlsService(s *Service) *DefaultObjectAccessControlsService {
  113. rs := &DefaultObjectAccessControlsService{s: s}
  114. return rs
  115. }
  116. type DefaultObjectAccessControlsService struct {
  117. s *Service
  118. }
  119. func NewNotificationsService(s *Service) *NotificationsService {
  120. rs := &NotificationsService{s: s}
  121. return rs
  122. }
  123. type NotificationsService struct {
  124. s *Service
  125. }
  126. func NewObjectAccessControlsService(s *Service) *ObjectAccessControlsService {
  127. rs := &ObjectAccessControlsService{s: s}
  128. return rs
  129. }
  130. type ObjectAccessControlsService struct {
  131. s *Service
  132. }
  133. func NewObjectsService(s *Service) *ObjectsService {
  134. rs := &ObjectsService{s: s}
  135. return rs
  136. }
  137. type ObjectsService struct {
  138. s *Service
  139. }
  140. func NewProjectsService(s *Service) *ProjectsService {
  141. rs := &ProjectsService{s: s}
  142. rs.ServiceAccount = NewProjectsServiceAccountService(s)
  143. return rs
  144. }
  145. type ProjectsService struct {
  146. s *Service
  147. ServiceAccount *ProjectsServiceAccountService
  148. }
  149. func NewProjectsServiceAccountService(s *Service) *ProjectsServiceAccountService {
  150. rs := &ProjectsServiceAccountService{s: s}
  151. return rs
  152. }
  153. type ProjectsServiceAccountService struct {
  154. s *Service
  155. }
  156. // Bucket: A bucket.
  157. type Bucket struct {
  158. // Acl: Access controls on the bucket.
  159. Acl []*BucketAccessControl `json:"acl,omitempty"`
  160. // Billing: The bucket's billing configuration.
  161. Billing *BucketBilling `json:"billing,omitempty"`
  162. // Cors: The bucket's Cross-Origin Resource Sharing (CORS)
  163. // configuration.
  164. Cors []*BucketCors `json:"cors,omitempty"`
  165. // DefaultEventBasedHold: Defines the default value for Event-Based hold
  166. // on newly created objects in this bucket. Event-Based hold is a way to
  167. // retain objects indefinitely until an event occurs, signified by the
  168. // hold's release. After being released, such objects will be subject to
  169. // bucket-level retention (if any). One sample use case of this flag is
  170. // for banks to hold loan documents for at least 3 years after loan is
  171. // paid in full. Here bucket-level retention is 3 years and the event is
  172. // loan being paid in full. In this example these objects will be held
  173. // intact for any number of years until the event has occurred (hold is
  174. // released) and then 3 more years after that. Objects under Event-Based
  175. // hold cannot be deleted, overwritten or archived until the hold is
  176. // removed.
  177. DefaultEventBasedHold bool `json:"defaultEventBasedHold,omitempty"`
  178. // DefaultObjectAcl: Default access controls to apply to new objects
  179. // when no ACL is provided.
  180. DefaultObjectAcl []*ObjectAccessControl `json:"defaultObjectAcl,omitempty"`
  181. // Encryption: Encryption configuration used by default for newly
  182. // inserted objects, when no encryption config is specified.
  183. Encryption *BucketEncryption `json:"encryption,omitempty"`
  184. // Etag: HTTP 1.1 Entity tag for the bucket.
  185. Etag string `json:"etag,omitempty"`
  186. // Id: The ID of the bucket. For buckets, the id and name properties are
  187. // the same.
  188. Id string `json:"id,omitempty"`
  189. // Kind: The kind of item this is. For buckets, this is always
  190. // storage#bucket.
  191. Kind string `json:"kind,omitempty"`
  192. // Labels: User-provided labels, in key/value pairs.
  193. Labels map[string]string `json:"labels,omitempty"`
  194. // Lifecycle: The bucket's lifecycle configuration. See lifecycle
  195. // management for more information.
  196. Lifecycle *BucketLifecycle `json:"lifecycle,omitempty"`
  197. // Location: The location of the bucket. Object data for objects in the
  198. // bucket resides in physical storage within this region. Defaults to
  199. // US. See the developer's guide for the authoritative list.
  200. Location string `json:"location,omitempty"`
  201. // Logging: The bucket's logging configuration, which defines the
  202. // destination bucket and optional name prefix for the current bucket's
  203. // logs.
  204. Logging *BucketLogging `json:"logging,omitempty"`
  205. // Metageneration: The metadata generation of this bucket.
  206. Metageneration int64 `json:"metageneration,omitempty,string"`
  207. // Name: The name of the bucket.
  208. Name string `json:"name,omitempty"`
  209. // Owner: The owner of the bucket. This is always the project team's
  210. // owner group.
  211. Owner *BucketOwner `json:"owner,omitempty"`
  212. // ProjectNumber: The project number of the project the bucket belongs
  213. // to.
  214. ProjectNumber uint64 `json:"projectNumber,omitempty,string"`
  215. // RetentionPolicy: Defines the retention policy for a bucket. The
  216. // Retention policy enforces a minimum retention time for all objects
  217. // contained in the bucket, based on their creation time. Any attempt to
  218. // overwrite or delete objects younger than the retention period will
  219. // result in a PERMISSION_DENIED error. An unlocked retention policy can
  220. // be modified or removed from the bucket via the UpdateBucketMetadata
  221. // RPC. A locked retention policy cannot be removed or shortened in
  222. // duration for the lifetime of the bucket. Attempting to remove or
  223. // decrease period of a locked retention policy will result in a
  224. // PERMISSION_DENIED error.
  225. RetentionPolicy *BucketRetentionPolicy `json:"retentionPolicy,omitempty"`
  226. // SelfLink: The URI of this bucket.
  227. SelfLink string `json:"selfLink,omitempty"`
  228. // StorageClass: The bucket's default storage class, used whenever no
  229. // storageClass is specified for a newly-created object. This defines
  230. // how objects in the bucket are stored and determines the SLA and the
  231. // cost of storage. Values include MULTI_REGIONAL, REGIONAL, STANDARD,
  232. // NEARLINE, COLDLINE, and DURABLE_REDUCED_AVAILABILITY. If this value
  233. // is not specified when the bucket is created, it will default to
  234. // STANDARD. For more information, see storage classes.
  235. StorageClass string `json:"storageClass,omitempty"`
  236. // TimeCreated: The creation time of the bucket in RFC 3339 format.
  237. TimeCreated string `json:"timeCreated,omitempty"`
  238. // Updated: The modification time of the bucket in RFC 3339 format.
  239. Updated string `json:"updated,omitempty"`
  240. // Versioning: The bucket's versioning configuration.
  241. Versioning *BucketVersioning `json:"versioning,omitempty"`
  242. // Website: The bucket's website configuration, controlling how the
  243. // service behaves when accessing bucket contents as a web site. See the
  244. // Static Website Examples for more information.
  245. Website *BucketWebsite `json:"website,omitempty"`
  246. // ServerResponse contains the HTTP response code and headers from the
  247. // server.
  248. googleapi.ServerResponse `json:"-"`
  249. // ForceSendFields is a list of field names (e.g. "Acl") to
  250. // unconditionally include in API requests. By default, fields with
  251. // empty values are omitted from API requests. However, any non-pointer,
  252. // non-interface field appearing in ForceSendFields will be sent to the
  253. // server regardless of whether the field is empty or not. This may be
  254. // used to include empty fields in Patch requests.
  255. ForceSendFields []string `json:"-"`
  256. // NullFields is a list of field names (e.g. "Acl") to include in API
  257. // requests with the JSON null value. By default, fields with empty
  258. // values are omitted from API requests. However, any field with an
  259. // empty value appearing in NullFields will be sent to the server as
  260. // null. It is an error if a field in this list has a non-empty value.
  261. // This may be used to include null fields in Patch requests.
  262. NullFields []string `json:"-"`
  263. }
  264. func (s *Bucket) MarshalJSON() ([]byte, error) {
  265. type NoMethod Bucket
  266. raw := NoMethod(*s)
  267. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  268. }
  269. // BucketBilling: The bucket's billing configuration.
  270. type BucketBilling struct {
  271. // RequesterPays: When set to true, Requester Pays is enabled for this
  272. // bucket.
  273. RequesterPays bool `json:"requesterPays,omitempty"`
  274. // ForceSendFields is a list of field names (e.g. "RequesterPays") to
  275. // unconditionally include in API requests. By default, fields with
  276. // empty values are omitted from API requests. However, any non-pointer,
  277. // non-interface field appearing in ForceSendFields will be sent to the
  278. // server regardless of whether the field is empty or not. This may be
  279. // used to include empty fields in Patch requests.
  280. ForceSendFields []string `json:"-"`
  281. // NullFields is a list of field names (e.g. "RequesterPays") to include
  282. // in API requests with the JSON null value. By default, fields with
  283. // empty values are omitted from API requests. However, any field with
  284. // an empty value appearing in NullFields will be sent to the server as
  285. // null. It is an error if a field in this list has a non-empty value.
  286. // This may be used to include null fields in Patch requests.
  287. NullFields []string `json:"-"`
  288. }
  289. func (s *BucketBilling) MarshalJSON() ([]byte, error) {
  290. type NoMethod BucketBilling
  291. raw := NoMethod(*s)
  292. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  293. }
  294. type BucketCors struct {
  295. // MaxAgeSeconds: The value, in seconds, to return in the
  296. // Access-Control-Max-Age header used in preflight responses.
  297. MaxAgeSeconds int64 `json:"maxAgeSeconds,omitempty"`
  298. // Method: The list of HTTP methods on which to include CORS response
  299. // headers, (GET, OPTIONS, POST, etc) Note: "*" is permitted in the list
  300. // of methods, and means "any method".
  301. Method []string `json:"method,omitempty"`
  302. // Origin: The list of Origins eligible to receive CORS response
  303. // headers. Note: "*" is permitted in the list of origins, and means
  304. // "any Origin".
  305. Origin []string `json:"origin,omitempty"`
  306. // ResponseHeader: The list of HTTP headers other than the simple
  307. // response headers to give permission for the user-agent to share
  308. // across domains.
  309. ResponseHeader []string `json:"responseHeader,omitempty"`
  310. // ForceSendFields is a list of field names (e.g. "MaxAgeSeconds") to
  311. // unconditionally include in API requests. By default, fields with
  312. // empty values are omitted from API requests. However, any non-pointer,
  313. // non-interface field appearing in ForceSendFields will be sent to the
  314. // server regardless of whether the field is empty or not. This may be
  315. // used to include empty fields in Patch requests.
  316. ForceSendFields []string `json:"-"`
  317. // NullFields is a list of field names (e.g. "MaxAgeSeconds") to include
  318. // in API requests with the JSON null value. By default, fields with
  319. // empty values are omitted from API requests. However, any field with
  320. // an empty value appearing in NullFields will be sent to the server as
  321. // null. It is an error if a field in this list has a non-empty value.
  322. // This may be used to include null fields in Patch requests.
  323. NullFields []string `json:"-"`
  324. }
  325. func (s *BucketCors) MarshalJSON() ([]byte, error) {
  326. type NoMethod BucketCors
  327. raw := NoMethod(*s)
  328. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  329. }
  330. // BucketEncryption: Encryption configuration used by default for newly
  331. // inserted objects, when no encryption config is specified.
  332. type BucketEncryption struct {
  333. // DefaultKmsKeyName: A Cloud KMS key that will be used to encrypt
  334. // objects inserted into this bucket, if no encryption method is
  335. // specified. Limited availability; usable only by enabled projects.
  336. DefaultKmsKeyName string `json:"defaultKmsKeyName,omitempty"`
  337. // ForceSendFields is a list of field names (e.g. "DefaultKmsKeyName")
  338. // to unconditionally include in API requests. By default, fields with
  339. // empty values are omitted from API requests. However, any non-pointer,
  340. // non-interface field appearing in ForceSendFields will be sent to the
  341. // server regardless of whether the field is empty or not. This may be
  342. // used to include empty fields in Patch requests.
  343. ForceSendFields []string `json:"-"`
  344. // NullFields is a list of field names (e.g. "DefaultKmsKeyName") to
  345. // include in API requests with the JSON null value. By default, fields
  346. // with empty values are omitted from API requests. However, any field
  347. // with an empty value appearing in NullFields will be sent to the
  348. // server as null. It is an error if a field in this list has a
  349. // non-empty value. This may be used to include null fields in Patch
  350. // requests.
  351. NullFields []string `json:"-"`
  352. }
  353. func (s *BucketEncryption) MarshalJSON() ([]byte, error) {
  354. type NoMethod BucketEncryption
  355. raw := NoMethod(*s)
  356. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  357. }
  358. // BucketLifecycle: The bucket's lifecycle configuration. See lifecycle
  359. // management for more information.
  360. type BucketLifecycle struct {
  361. // Rule: A lifecycle management rule, which is made of an action to take
  362. // and the condition(s) under which the action will be taken.
  363. Rule []*BucketLifecycleRule `json:"rule,omitempty"`
  364. // ForceSendFields is a list of field names (e.g. "Rule") to
  365. // unconditionally include in API requests. By default, fields with
  366. // empty values are omitted from API requests. However, any non-pointer,
  367. // non-interface field appearing in ForceSendFields will be sent to the
  368. // server regardless of whether the field is empty or not. This may be
  369. // used to include empty fields in Patch requests.
  370. ForceSendFields []string `json:"-"`
  371. // NullFields is a list of field names (e.g. "Rule") to include in API
  372. // requests with the JSON null value. By default, fields with empty
  373. // values are omitted from API requests. However, any field with an
  374. // empty value appearing in NullFields will be sent to the server as
  375. // null. It is an error if a field in this list has a non-empty value.
  376. // This may be used to include null fields in Patch requests.
  377. NullFields []string `json:"-"`
  378. }
  379. func (s *BucketLifecycle) MarshalJSON() ([]byte, error) {
  380. type NoMethod BucketLifecycle
  381. raw := NoMethod(*s)
  382. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  383. }
  384. type BucketLifecycleRule struct {
  385. // Action: The action to take.
  386. Action *BucketLifecycleRuleAction `json:"action,omitempty"`
  387. // Condition: The condition(s) under which the action will be taken.
  388. Condition *BucketLifecycleRuleCondition `json:"condition,omitempty"`
  389. // ForceSendFields is a list of field names (e.g. "Action") to
  390. // unconditionally include in API requests. By default, fields with
  391. // empty values are omitted from API requests. However, any non-pointer,
  392. // non-interface field appearing in ForceSendFields will be sent to the
  393. // server regardless of whether the field is empty or not. This may be
  394. // used to include empty fields in Patch requests.
  395. ForceSendFields []string `json:"-"`
  396. // NullFields is a list of field names (e.g. "Action") to include in API
  397. // requests with the JSON null value. By default, fields with empty
  398. // values are omitted from API requests. However, any field with an
  399. // empty value appearing in NullFields will be sent to the server as
  400. // null. It is an error if a field in this list has a non-empty value.
  401. // This may be used to include null fields in Patch requests.
  402. NullFields []string `json:"-"`
  403. }
  404. func (s *BucketLifecycleRule) MarshalJSON() ([]byte, error) {
  405. type NoMethod BucketLifecycleRule
  406. raw := NoMethod(*s)
  407. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  408. }
  409. // BucketLifecycleRuleAction: The action to take.
  410. type BucketLifecycleRuleAction struct {
  411. // StorageClass: Target storage class. Required iff the type of the
  412. // action is SetStorageClass.
  413. StorageClass string `json:"storageClass,omitempty"`
  414. // Type: Type of the action. Currently, only Delete and SetStorageClass
  415. // are supported.
  416. Type string `json:"type,omitempty"`
  417. // ForceSendFields is a list of field names (e.g. "StorageClass") to
  418. // unconditionally include in API requests. By default, fields with
  419. // empty values are omitted from API requests. However, any non-pointer,
  420. // non-interface field appearing in ForceSendFields will be sent to the
  421. // server regardless of whether the field is empty or not. This may be
  422. // used to include empty fields in Patch requests.
  423. ForceSendFields []string `json:"-"`
  424. // NullFields is a list of field names (e.g. "StorageClass") to include
  425. // in API requests with the JSON null value. By default, fields with
  426. // empty values are omitted from API requests. However, any field with
  427. // an empty value appearing in NullFields will be sent to the server as
  428. // null. It is an error if a field in this list has a non-empty value.
  429. // This may be used to include null fields in Patch requests.
  430. NullFields []string `json:"-"`
  431. }
  432. func (s *BucketLifecycleRuleAction) MarshalJSON() ([]byte, error) {
  433. type NoMethod BucketLifecycleRuleAction
  434. raw := NoMethod(*s)
  435. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  436. }
  437. // BucketLifecycleRuleCondition: The condition(s) under which the action
  438. // will be taken.
  439. type BucketLifecycleRuleCondition struct {
  440. // Age: Age of an object (in days). This condition is satisfied when an
  441. // object reaches the specified age.
  442. Age int64 `json:"age,omitempty"`
  443. // CreatedBefore: A date in RFC 3339 format with only the date part (for
  444. // instance, "2013-01-15"). This condition is satisfied when an object
  445. // is created before midnight of the specified date in UTC.
  446. CreatedBefore string `json:"createdBefore,omitempty"`
  447. // IsLive: Relevant only for versioned objects. If the value is true,
  448. // this condition matches live objects; if the value is false, it
  449. // matches archived objects.
  450. IsLive *bool `json:"isLive,omitempty"`
  451. // MatchesStorageClass: Objects having any of the storage classes
  452. // specified by this condition will be matched. Values include
  453. // MULTI_REGIONAL, REGIONAL, NEARLINE, COLDLINE, STANDARD, and
  454. // DURABLE_REDUCED_AVAILABILITY.
  455. MatchesStorageClass []string `json:"matchesStorageClass,omitempty"`
  456. // NumNewerVersions: Relevant only for versioned objects. If the value
  457. // is N, this condition is satisfied when there are at least N versions
  458. // (including the live version) newer than this version of the object.
  459. NumNewerVersions int64 `json:"numNewerVersions,omitempty"`
  460. // ForceSendFields is a list of field names (e.g. "Age") to
  461. // unconditionally include in API requests. By default, fields with
  462. // empty values are omitted from API requests. However, any non-pointer,
  463. // non-interface field appearing in ForceSendFields will be sent to the
  464. // server regardless of whether the field is empty or not. This may be
  465. // used to include empty fields in Patch requests.
  466. ForceSendFields []string `json:"-"`
  467. // NullFields is a list of field names (e.g. "Age") to include in API
  468. // requests with the JSON null value. By default, fields with empty
  469. // values are omitted from API requests. However, any field with an
  470. // empty value appearing in NullFields will be sent to the server as
  471. // null. It is an error if a field in this list has a non-empty value.
  472. // This may be used to include null fields in Patch requests.
  473. NullFields []string `json:"-"`
  474. }
  475. func (s *BucketLifecycleRuleCondition) MarshalJSON() ([]byte, error) {
  476. type NoMethod BucketLifecycleRuleCondition
  477. raw := NoMethod(*s)
  478. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  479. }
  480. // BucketLogging: The bucket's logging configuration, which defines the
  481. // destination bucket and optional name prefix for the current bucket's
  482. // logs.
  483. type BucketLogging struct {
  484. // LogBucket: The destination bucket where the current bucket's logs
  485. // should be placed.
  486. LogBucket string `json:"logBucket,omitempty"`
  487. // LogObjectPrefix: A prefix for log object names.
  488. LogObjectPrefix string `json:"logObjectPrefix,omitempty"`
  489. // ForceSendFields is a list of field names (e.g. "LogBucket") to
  490. // unconditionally include in API requests. By default, fields with
  491. // empty values are omitted from API requests. However, any non-pointer,
  492. // non-interface field appearing in ForceSendFields will be sent to the
  493. // server regardless of whether the field is empty or not. This may be
  494. // used to include empty fields in Patch requests.
  495. ForceSendFields []string `json:"-"`
  496. // NullFields is a list of field names (e.g. "LogBucket") to include in
  497. // API requests with the JSON null value. By default, fields with empty
  498. // values are omitted from API requests. However, any field with an
  499. // empty value appearing in NullFields will be sent to the server as
  500. // null. It is an error if a field in this list has a non-empty value.
  501. // This may be used to include null fields in Patch requests.
  502. NullFields []string `json:"-"`
  503. }
  504. func (s *BucketLogging) MarshalJSON() ([]byte, error) {
  505. type NoMethod BucketLogging
  506. raw := NoMethod(*s)
  507. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  508. }
  509. // BucketOwner: The owner of the bucket. This is always the project
  510. // team's owner group.
  511. type BucketOwner struct {
  512. // Entity: The entity, in the form project-owner-projectId.
  513. Entity string `json:"entity,omitempty"`
  514. // EntityId: The ID for the entity.
  515. EntityId string `json:"entityId,omitempty"`
  516. // ForceSendFields is a list of field names (e.g. "Entity") to
  517. // unconditionally include in API requests. By default, fields with
  518. // empty values are omitted from API requests. However, any non-pointer,
  519. // non-interface field appearing in ForceSendFields will be sent to the
  520. // server regardless of whether the field is empty or not. This may be
  521. // used to include empty fields in Patch requests.
  522. ForceSendFields []string `json:"-"`
  523. // NullFields is a list of field names (e.g. "Entity") to include in API
  524. // requests with the JSON null value. By default, fields with empty
  525. // values are omitted from API requests. However, any field with an
  526. // empty value appearing in NullFields will be sent to the server as
  527. // null. It is an error if a field in this list has a non-empty value.
  528. // This may be used to include null fields in Patch requests.
  529. NullFields []string `json:"-"`
  530. }
  531. func (s *BucketOwner) MarshalJSON() ([]byte, error) {
  532. type NoMethod BucketOwner
  533. raw := NoMethod(*s)
  534. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  535. }
  536. // BucketRetentionPolicy: Defines the retention policy for a bucket. The
  537. // Retention policy enforces a minimum retention time for all objects
  538. // contained in the bucket, based on their creation time. Any attempt to
  539. // overwrite or delete objects younger than the retention period will
  540. // result in a PERMISSION_DENIED error. An unlocked retention policy can
  541. // be modified or removed from the bucket via the UpdateBucketMetadata
  542. // RPC. A locked retention policy cannot be removed or shortened in
  543. // duration for the lifetime of the bucket. Attempting to remove or
  544. // decrease period of a locked retention policy will result in a
  545. // PERMISSION_DENIED error.
  546. type BucketRetentionPolicy struct {
  547. // EffectiveTime: The time from which policy was enforced and effective.
  548. // RFC 3339 format.
  549. EffectiveTime string `json:"effectiveTime,omitempty"`
  550. // IsLocked: Once locked, an object retention policy cannot be modified.
  551. IsLocked bool `json:"isLocked,omitempty"`
  552. // RetentionPeriod: Specifies the duration that objects need to be
  553. // retained. Retention duration must be greater than zero and less than
  554. // 100 years. Note that enforcement of retention periods less than a day
  555. // is not guaranteed. Such periods should only be used for testing
  556. // purposes.
  557. RetentionPeriod int64 `json:"retentionPeriod,omitempty,string"`
  558. // ForceSendFields is a list of field names (e.g. "EffectiveTime") to
  559. // unconditionally include in API requests. By default, fields with
  560. // empty values are omitted from API requests. However, any non-pointer,
  561. // non-interface field appearing in ForceSendFields will be sent to the
  562. // server regardless of whether the field is empty or not. This may be
  563. // used to include empty fields in Patch requests.
  564. ForceSendFields []string `json:"-"`
  565. // NullFields is a list of field names (e.g. "EffectiveTime") to include
  566. // in API requests with the JSON null value. By default, fields with
  567. // empty values are omitted from API requests. However, any field with
  568. // an empty value appearing in NullFields will be sent to the server as
  569. // null. It is an error if a field in this list has a non-empty value.
  570. // This may be used to include null fields in Patch requests.
  571. NullFields []string `json:"-"`
  572. }
  573. func (s *BucketRetentionPolicy) MarshalJSON() ([]byte, error) {
  574. type NoMethod BucketRetentionPolicy
  575. raw := NoMethod(*s)
  576. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  577. }
  578. // BucketVersioning: The bucket's versioning configuration.
  579. type BucketVersioning struct {
  580. // Enabled: While set to true, versioning is fully enabled for this
  581. // bucket.
  582. Enabled bool `json:"enabled,omitempty"`
  583. // ForceSendFields is a list of field names (e.g. "Enabled") to
  584. // unconditionally include in API requests. By default, fields with
  585. // empty values are omitted from API requests. However, any non-pointer,
  586. // non-interface field appearing in ForceSendFields will be sent to the
  587. // server regardless of whether the field is empty or not. This may be
  588. // used to include empty fields in Patch requests.
  589. ForceSendFields []string `json:"-"`
  590. // NullFields is a list of field names (e.g. "Enabled") to include in
  591. // API requests with the JSON null value. By default, fields with empty
  592. // values are omitted from API requests. However, any field with an
  593. // empty value appearing in NullFields will be sent to the server as
  594. // null. It is an error if a field in this list has a non-empty value.
  595. // This may be used to include null fields in Patch requests.
  596. NullFields []string `json:"-"`
  597. }
  598. func (s *BucketVersioning) MarshalJSON() ([]byte, error) {
  599. type NoMethod BucketVersioning
  600. raw := NoMethod(*s)
  601. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  602. }
  603. // BucketWebsite: The bucket's website configuration, controlling how
  604. // the service behaves when accessing bucket contents as a web site. See
  605. // the Static Website Examples for more information.
  606. type BucketWebsite struct {
  607. // MainPageSuffix: If the requested object path is missing, the service
  608. // will ensure the path has a trailing '/', append this suffix, and
  609. // attempt to retrieve the resulting object. This allows the creation of
  610. // index.html objects to represent directory pages.
  611. MainPageSuffix string `json:"mainPageSuffix,omitempty"`
  612. // NotFoundPage: If the requested object path is missing, and any
  613. // mainPageSuffix object is missing, if applicable, the service will
  614. // return the named object from this bucket as the content for a 404 Not
  615. // Found result.
  616. NotFoundPage string `json:"notFoundPage,omitempty"`
  617. // ForceSendFields is a list of field names (e.g. "MainPageSuffix") to
  618. // unconditionally include in API requests. By default, fields with
  619. // empty values are omitted from API requests. However, any non-pointer,
  620. // non-interface field appearing in ForceSendFields will be sent to the
  621. // server regardless of whether the field is empty or not. This may be
  622. // used to include empty fields in Patch requests.
  623. ForceSendFields []string `json:"-"`
  624. // NullFields is a list of field names (e.g. "MainPageSuffix") to
  625. // include in API requests with the JSON null value. By default, fields
  626. // with empty values are omitted from API requests. However, any field
  627. // with an empty value appearing in NullFields will be sent to the
  628. // server as null. It is an error if a field in this list has a
  629. // non-empty value. This may be used to include null fields in Patch
  630. // requests.
  631. NullFields []string `json:"-"`
  632. }
  633. func (s *BucketWebsite) MarshalJSON() ([]byte, error) {
  634. type NoMethod BucketWebsite
  635. raw := NoMethod(*s)
  636. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  637. }
  638. // BucketAccessControl: An access-control entry.
  639. type BucketAccessControl struct {
  640. // Bucket: The name of the bucket.
  641. Bucket string `json:"bucket,omitempty"`
  642. // Domain: The domain associated with the entity, if any.
  643. Domain string `json:"domain,omitempty"`
  644. // Email: The email address associated with the entity, if any.
  645. Email string `json:"email,omitempty"`
  646. // Entity: The entity holding the permission, in one of the following
  647. // forms:
  648. // - user-userId
  649. // - user-email
  650. // - group-groupId
  651. // - group-email
  652. // - domain-domain
  653. // - project-team-projectId
  654. // - allUsers
  655. // - allAuthenticatedUsers Examples:
  656. // - The user liz@example.com would be user-liz@example.com.
  657. // - The group example@googlegroups.com would be
  658. // group-example@googlegroups.com.
  659. // - To refer to all members of the Google Apps for Business domain
  660. // example.com, the entity would be domain-example.com.
  661. Entity string `json:"entity,omitempty"`
  662. // EntityId: The ID for the entity, if any.
  663. EntityId string `json:"entityId,omitempty"`
  664. // Etag: HTTP 1.1 Entity tag for the access-control entry.
  665. Etag string `json:"etag,omitempty"`
  666. // Id: The ID of the access-control entry.
  667. Id string `json:"id,omitempty"`
  668. // Kind: The kind of item this is. For bucket access control entries,
  669. // this is always storage#bucketAccessControl.
  670. Kind string `json:"kind,omitempty"`
  671. // ProjectTeam: The project team associated with the entity, if any.
  672. ProjectTeam *BucketAccessControlProjectTeam `json:"projectTeam,omitempty"`
  673. // Role: The access permission for the entity.
  674. Role string `json:"role,omitempty"`
  675. // SelfLink: The link to this access-control entry.
  676. SelfLink string `json:"selfLink,omitempty"`
  677. // ServerResponse contains the HTTP response code and headers from the
  678. // server.
  679. googleapi.ServerResponse `json:"-"`
  680. // ForceSendFields is a list of field names (e.g. "Bucket") to
  681. // unconditionally include in API requests. By default, fields with
  682. // empty values are omitted from API requests. However, any non-pointer,
  683. // non-interface field appearing in ForceSendFields will be sent to the
  684. // server regardless of whether the field is empty or not. This may be
  685. // used to include empty fields in Patch requests.
  686. ForceSendFields []string `json:"-"`
  687. // NullFields is a list of field names (e.g. "Bucket") to include in API
  688. // requests with the JSON null value. By default, fields with empty
  689. // values are omitted from API requests. However, any field with an
  690. // empty value appearing in NullFields will be sent to the server as
  691. // null. It is an error if a field in this list has a non-empty value.
  692. // This may be used to include null fields in Patch requests.
  693. NullFields []string `json:"-"`
  694. }
  695. func (s *BucketAccessControl) MarshalJSON() ([]byte, error) {
  696. type NoMethod BucketAccessControl
  697. raw := NoMethod(*s)
  698. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  699. }
  700. // BucketAccessControlProjectTeam: The project team associated with the
  701. // entity, if any.
  702. type BucketAccessControlProjectTeam struct {
  703. // ProjectNumber: The project number.
  704. ProjectNumber string `json:"projectNumber,omitempty"`
  705. // Team: The team.
  706. Team string `json:"team,omitempty"`
  707. // ForceSendFields is a list of field names (e.g. "ProjectNumber") to
  708. // unconditionally include in API requests. By default, fields with
  709. // empty values are omitted from API requests. However, any non-pointer,
  710. // non-interface field appearing in ForceSendFields will be sent to the
  711. // server regardless of whether the field is empty or not. This may be
  712. // used to include empty fields in Patch requests.
  713. ForceSendFields []string `json:"-"`
  714. // NullFields is a list of field names (e.g. "ProjectNumber") to include
  715. // in API requests with the JSON null value. By default, fields with
  716. // empty values are omitted from API requests. However, any field with
  717. // an empty value appearing in NullFields will be sent to the server as
  718. // null. It is an error if a field in this list has a non-empty value.
  719. // This may be used to include null fields in Patch requests.
  720. NullFields []string `json:"-"`
  721. }
  722. func (s *BucketAccessControlProjectTeam) MarshalJSON() ([]byte, error) {
  723. type NoMethod BucketAccessControlProjectTeam
  724. raw := NoMethod(*s)
  725. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  726. }
  727. // BucketAccessControls: An access-control list.
  728. type BucketAccessControls struct {
  729. // Items: The list of items.
  730. Items []*BucketAccessControl `json:"items,omitempty"`
  731. // Kind: The kind of item this is. For lists of bucket access control
  732. // entries, this is always storage#bucketAccessControls.
  733. Kind string `json:"kind,omitempty"`
  734. // ServerResponse contains the HTTP response code and headers from the
  735. // server.
  736. googleapi.ServerResponse `json:"-"`
  737. // ForceSendFields is a list of field names (e.g. "Items") to
  738. // unconditionally include in API requests. By default, fields with
  739. // empty values are omitted from API requests. However, any non-pointer,
  740. // non-interface field appearing in ForceSendFields will be sent to the
  741. // server regardless of whether the field is empty or not. This may be
  742. // used to include empty fields in Patch requests.
  743. ForceSendFields []string `json:"-"`
  744. // NullFields is a list of field names (e.g. "Items") to include in API
  745. // requests with the JSON null value. By default, fields with empty
  746. // values are omitted from API requests. However, any field with an
  747. // empty value appearing in NullFields will be sent to the server as
  748. // null. It is an error if a field in this list has a non-empty value.
  749. // This may be used to include null fields in Patch requests.
  750. NullFields []string `json:"-"`
  751. }
  752. func (s *BucketAccessControls) MarshalJSON() ([]byte, error) {
  753. type NoMethod BucketAccessControls
  754. raw := NoMethod(*s)
  755. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  756. }
  757. // Buckets: A list of buckets.
  758. type Buckets struct {
  759. // Items: The list of items.
  760. Items []*Bucket `json:"items,omitempty"`
  761. // Kind: The kind of item this is. For lists of buckets, this is always
  762. // storage#buckets.
  763. Kind string `json:"kind,omitempty"`
  764. // NextPageToken: The continuation token, used to page through large
  765. // result sets. Provide this value in a subsequent request to return the
  766. // next page of results.
  767. NextPageToken string `json:"nextPageToken,omitempty"`
  768. // ServerResponse contains the HTTP response code and headers from the
  769. // server.
  770. googleapi.ServerResponse `json:"-"`
  771. // ForceSendFields is a list of field names (e.g. "Items") to
  772. // unconditionally include in API requests. By default, fields with
  773. // empty values are omitted from API requests. However, any non-pointer,
  774. // non-interface field appearing in ForceSendFields will be sent to the
  775. // server regardless of whether the field is empty or not. This may be
  776. // used to include empty fields in Patch requests.
  777. ForceSendFields []string `json:"-"`
  778. // NullFields is a list of field names (e.g. "Items") to include in API
  779. // requests with the JSON null value. By default, fields with empty
  780. // values are omitted from API requests. However, any field with an
  781. // empty value appearing in NullFields will be sent to the server as
  782. // null. It is an error if a field in this list has a non-empty value.
  783. // This may be used to include null fields in Patch requests.
  784. NullFields []string `json:"-"`
  785. }
  786. func (s *Buckets) MarshalJSON() ([]byte, error) {
  787. type NoMethod Buckets
  788. raw := NoMethod(*s)
  789. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  790. }
  791. // Channel: An notification channel used to watch for resource changes.
  792. type Channel struct {
  793. // Address: The address where notifications are delivered for this
  794. // channel.
  795. Address string `json:"address,omitempty"`
  796. // Expiration: Date and time of notification channel expiration,
  797. // expressed as a Unix timestamp, in milliseconds. Optional.
  798. Expiration int64 `json:"expiration,omitempty,string"`
  799. // Id: A UUID or similar unique string that identifies this channel.
  800. Id string `json:"id,omitempty"`
  801. // Kind: Identifies this as a notification channel used to watch for
  802. // changes to a resource. Value: the fixed string "api#channel".
  803. Kind string `json:"kind,omitempty"`
  804. // Params: Additional parameters controlling delivery channel behavior.
  805. // Optional.
  806. Params map[string]string `json:"params,omitempty"`
  807. // Payload: A Boolean value to indicate whether payload is wanted.
  808. // Optional.
  809. Payload bool `json:"payload,omitempty"`
  810. // ResourceId: An opaque ID that identifies the resource being watched
  811. // on this channel. Stable across different API versions.
  812. ResourceId string `json:"resourceId,omitempty"`
  813. // ResourceUri: A version-specific identifier for the watched resource.
  814. ResourceUri string `json:"resourceUri,omitempty"`
  815. // Token: An arbitrary string delivered to the target address with each
  816. // notification delivered over this channel. Optional.
  817. Token string `json:"token,omitempty"`
  818. // Type: The type of delivery mechanism used for this channel.
  819. Type string `json:"type,omitempty"`
  820. // ServerResponse contains the HTTP response code and headers from the
  821. // server.
  822. googleapi.ServerResponse `json:"-"`
  823. // ForceSendFields is a list of field names (e.g. "Address") to
  824. // unconditionally include in API requests. By default, fields with
  825. // empty values are omitted from API requests. However, any non-pointer,
  826. // non-interface field appearing in ForceSendFields will be sent to the
  827. // server regardless of whether the field is empty or not. This may be
  828. // used to include empty fields in Patch requests.
  829. ForceSendFields []string `json:"-"`
  830. // NullFields is a list of field names (e.g. "Address") to include in
  831. // API requests with the JSON null value. By default, fields with empty
  832. // values are omitted from API requests. However, any field with an
  833. // empty value appearing in NullFields will be sent to the server as
  834. // null. It is an error if a field in this list has a non-empty value.
  835. // This may be used to include null fields in Patch requests.
  836. NullFields []string `json:"-"`
  837. }
  838. func (s *Channel) MarshalJSON() ([]byte, error) {
  839. type NoMethod Channel
  840. raw := NoMethod(*s)
  841. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  842. }
  843. // ComposeRequest: A Compose request.
  844. type ComposeRequest struct {
  845. // Destination: Properties of the resulting object.
  846. Destination *Object `json:"destination,omitempty"`
  847. // Kind: The kind of item this is.
  848. Kind string `json:"kind,omitempty"`
  849. // SourceObjects: The list of source objects that will be concatenated
  850. // into a single object.
  851. SourceObjects []*ComposeRequestSourceObjects `json:"sourceObjects,omitempty"`
  852. // ForceSendFields is a list of field names (e.g. "Destination") to
  853. // unconditionally include in API requests. By default, fields with
  854. // empty values are omitted from API requests. However, any non-pointer,
  855. // non-interface field appearing in ForceSendFields will be sent to the
  856. // server regardless of whether the field is empty or not. This may be
  857. // used to include empty fields in Patch requests.
  858. ForceSendFields []string `json:"-"`
  859. // NullFields is a list of field names (e.g. "Destination") to include
  860. // in API requests with the JSON null value. By default, fields with
  861. // empty values are omitted from API requests. However, any field with
  862. // an empty value appearing in NullFields will be sent to the server as
  863. // null. It is an error if a field in this list has a non-empty value.
  864. // This may be used to include null fields in Patch requests.
  865. NullFields []string `json:"-"`
  866. }
  867. func (s *ComposeRequest) MarshalJSON() ([]byte, error) {
  868. type NoMethod ComposeRequest
  869. raw := NoMethod(*s)
  870. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  871. }
  872. type ComposeRequestSourceObjects struct {
  873. // Generation: The generation of this object to use as the source.
  874. Generation int64 `json:"generation,omitempty,string"`
  875. // Name: The source object's name. The source object's bucket is
  876. // implicitly the destination bucket.
  877. Name string `json:"name,omitempty"`
  878. // ObjectPreconditions: Conditions that must be met for this operation
  879. // to execute.
  880. ObjectPreconditions *ComposeRequestSourceObjectsObjectPreconditions `json:"objectPreconditions,omitempty"`
  881. // ForceSendFields is a list of field names (e.g. "Generation") to
  882. // unconditionally include in API requests. By default, fields with
  883. // empty values are omitted from API requests. However, any non-pointer,
  884. // non-interface field appearing in ForceSendFields will be sent to the
  885. // server regardless of whether the field is empty or not. This may be
  886. // used to include empty fields in Patch requests.
  887. ForceSendFields []string `json:"-"`
  888. // NullFields is a list of field names (e.g. "Generation") to include in
  889. // API requests with the JSON null value. By default, fields with empty
  890. // values are omitted from API requests. However, any field with an
  891. // empty value appearing in NullFields will be sent to the server as
  892. // null. It is an error if a field in this list has a non-empty value.
  893. // This may be used to include null fields in Patch requests.
  894. NullFields []string `json:"-"`
  895. }
  896. func (s *ComposeRequestSourceObjects) MarshalJSON() ([]byte, error) {
  897. type NoMethod ComposeRequestSourceObjects
  898. raw := NoMethod(*s)
  899. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  900. }
  901. // ComposeRequestSourceObjectsObjectPreconditions: Conditions that must
  902. // be met for this operation to execute.
  903. type ComposeRequestSourceObjectsObjectPreconditions struct {
  904. // IfGenerationMatch: Only perform the composition if the generation of
  905. // the source object that would be used matches this value. If this
  906. // value and a generation are both specified, they must be the same
  907. // value or the call will fail.
  908. IfGenerationMatch int64 `json:"ifGenerationMatch,omitempty,string"`
  909. // ForceSendFields is a list of field names (e.g. "IfGenerationMatch")
  910. // to unconditionally include in API requests. By default, fields with
  911. // empty values are omitted from API requests. However, any non-pointer,
  912. // non-interface field appearing in ForceSendFields will be sent to the
  913. // server regardless of whether the field is empty or not. This may be
  914. // used to include empty fields in Patch requests.
  915. ForceSendFields []string `json:"-"`
  916. // NullFields is a list of field names (e.g. "IfGenerationMatch") to
  917. // include in API requests with the JSON null value. By default, fields
  918. // with empty values are omitted from API requests. However, any field
  919. // with an empty value appearing in NullFields will be sent to the
  920. // server as null. It is an error if a field in this list has a
  921. // non-empty value. This may be used to include null fields in Patch
  922. // requests.
  923. NullFields []string `json:"-"`
  924. }
  925. func (s *ComposeRequestSourceObjectsObjectPreconditions) MarshalJSON() ([]byte, error) {
  926. type NoMethod ComposeRequestSourceObjectsObjectPreconditions
  927. raw := NoMethod(*s)
  928. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  929. }
  930. // Notification: A subscription to receive Google PubSub notifications.
  931. type Notification struct {
  932. // CustomAttributes: An optional list of additional attributes to attach
  933. // to each Cloud PubSub message published for this notification
  934. // subscription.
  935. CustomAttributes map[string]string `json:"custom_attributes,omitempty"`
  936. // Etag: HTTP 1.1 Entity tag for this subscription notification.
  937. Etag string `json:"etag,omitempty"`
  938. // EventTypes: If present, only send notifications about listed event
  939. // types. If empty, sent notifications for all event types.
  940. EventTypes []string `json:"event_types,omitempty"`
  941. // Id: The ID of the notification.
  942. Id string `json:"id,omitempty"`
  943. // Kind: The kind of item this is. For notifications, this is always
  944. // storage#notification.
  945. Kind string `json:"kind,omitempty"`
  946. // ObjectNamePrefix: If present, only apply this notification
  947. // configuration to object names that begin with this prefix.
  948. ObjectNamePrefix string `json:"object_name_prefix,omitempty"`
  949. // PayloadFormat: The desired content of the Payload.
  950. PayloadFormat string `json:"payload_format,omitempty"`
  951. // SelfLink: The canonical URL of this notification.
  952. SelfLink string `json:"selfLink,omitempty"`
  953. // Topic: The Cloud PubSub topic to which this subscription publishes.
  954. // Formatted as:
  955. // '//pubsub.googleapis.com/projects/{project-identifier}/topics/{my-topi
  956. // c}'
  957. Topic string `json:"topic,omitempty"`
  958. // ServerResponse contains the HTTP response code and headers from the
  959. // server.
  960. googleapi.ServerResponse `json:"-"`
  961. // ForceSendFields is a list of field names (e.g. "CustomAttributes") to
  962. // unconditionally include in API requests. By default, fields with
  963. // empty values are omitted from API requests. However, any non-pointer,
  964. // non-interface field appearing in ForceSendFields will be sent to the
  965. // server regardless of whether the field is empty or not. This may be
  966. // used to include empty fields in Patch requests.
  967. ForceSendFields []string `json:"-"`
  968. // NullFields is a list of field names (e.g. "CustomAttributes") to
  969. // include in API requests with the JSON null value. By default, fields
  970. // with empty values are omitted from API requests. However, any field
  971. // with an empty value appearing in NullFields will be sent to the
  972. // server as null. It is an error if a field in this list has a
  973. // non-empty value. This may be used to include null fields in Patch
  974. // requests.
  975. NullFields []string `json:"-"`
  976. }
  977. func (s *Notification) MarshalJSON() ([]byte, error) {
  978. type NoMethod Notification
  979. raw := NoMethod(*s)
  980. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  981. }
  982. // Notifications: A list of notification subscriptions.
  983. type Notifications struct {
  984. // Items: The list of items.
  985. Items []*Notification `json:"items,omitempty"`
  986. // Kind: The kind of item this is. For lists of notifications, this is
  987. // always storage#notifications.
  988. Kind string `json:"kind,omitempty"`
  989. // ServerResponse contains the HTTP response code and headers from the
  990. // server.
  991. googleapi.ServerResponse `json:"-"`
  992. // ForceSendFields is a list of field names (e.g. "Items") to
  993. // unconditionally include in API requests. By default, fields with
  994. // empty values are omitted from API requests. However, any non-pointer,
  995. // non-interface field appearing in ForceSendFields will be sent to the
  996. // server regardless of whether the field is empty or not. This may be
  997. // used to include empty fields in Patch requests.
  998. ForceSendFields []string `json:"-"`
  999. // NullFields is a list of field names (e.g. "Items") to include in API
  1000. // requests with the JSON null value. By default, fields with empty
  1001. // values are omitted from API requests. However, any field with an
  1002. // empty value appearing in NullFields will be sent to the server as
  1003. // null. It is an error if a field in this list has a non-empty value.
  1004. // This may be used to include null fields in Patch requests.
  1005. NullFields []string `json:"-"`
  1006. }
  1007. func (s *Notifications) MarshalJSON() ([]byte, error) {
  1008. type NoMethod Notifications
  1009. raw := NoMethod(*s)
  1010. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1011. }
  1012. // Object: An object.
  1013. type Object struct {
  1014. // Acl: Access controls on the object.
  1015. Acl []*ObjectAccessControl `json:"acl,omitempty"`
  1016. // Bucket: The name of the bucket containing this object.
  1017. Bucket string `json:"bucket,omitempty"`
  1018. // CacheControl: Cache-Control directive for the object data. If
  1019. // omitted, and the object is accessible to all anonymous users, the
  1020. // default will be public, max-age=3600.
  1021. CacheControl string `json:"cacheControl,omitempty"`
  1022. // ComponentCount: Number of underlying components that make up this
  1023. // object. Components are accumulated by compose operations.
  1024. ComponentCount int64 `json:"componentCount,omitempty"`
  1025. // ContentDisposition: Content-Disposition of the object data.
  1026. ContentDisposition string `json:"contentDisposition,omitempty"`
  1027. // ContentEncoding: Content-Encoding of the object data.
  1028. ContentEncoding string `json:"contentEncoding,omitempty"`
  1029. // ContentLanguage: Content-Language of the object data.
  1030. ContentLanguage string `json:"contentLanguage,omitempty"`
  1031. // ContentType: Content-Type of the object data. If an object is stored
  1032. // without a Content-Type, it is served as application/octet-stream.
  1033. ContentType string `json:"contentType,omitempty"`
  1034. // Crc32c: CRC32c checksum, as described in RFC 4960, Appendix B;
  1035. // encoded using base64 in big-endian byte order. For more information
  1036. // about using the CRC32c checksum, see Hashes and ETags: Best
  1037. // Practices.
  1038. Crc32c string `json:"crc32c,omitempty"`
  1039. // CustomerEncryption: Metadata of customer-supplied encryption key, if
  1040. // the object is encrypted by such a key.
  1041. CustomerEncryption *ObjectCustomerEncryption `json:"customerEncryption,omitempty"`
  1042. // Etag: HTTP 1.1 Entity tag for the object.
  1043. Etag string `json:"etag,omitempty"`
  1044. // EventBasedHold: Defines the Event-Based hold for an object.
  1045. // Event-Based hold is a way to retain objects indefinitely until an
  1046. // event occurs, signified by the hold's release. After being released,
  1047. // such objects will be subject to bucket-level retention (if any). One
  1048. // sample use case of this flag is for banks to hold loan documents for
  1049. // at least 3 years after loan is paid in full. Here bucket-level
  1050. // retention is 3 years and the event is loan being paid in full. In
  1051. // this example these objects will be held intact for any number of
  1052. // years until the event has occurred (hold is released) and then 3 more
  1053. // years after that.
  1054. EventBasedHold bool `json:"eventBasedHold,omitempty"`
  1055. // Generation: The content generation of this object. Used for object
  1056. // versioning.
  1057. Generation int64 `json:"generation,omitempty,string"`
  1058. // Id: The ID of the object, including the bucket name, object name, and
  1059. // generation number.
  1060. Id string `json:"id,omitempty"`
  1061. // Kind: The kind of item this is. For objects, this is always
  1062. // storage#object.
  1063. Kind string `json:"kind,omitempty"`
  1064. // KmsKeyName: Cloud KMS Key used to encrypt this object, if the object
  1065. // is encrypted by such a key. Limited availability; usable only by
  1066. // enabled projects.
  1067. KmsKeyName string `json:"kmsKeyName,omitempty"`
  1068. // Md5Hash: MD5 hash of the data; encoded using base64. For more
  1069. // information about using the MD5 hash, see Hashes and ETags: Best
  1070. // Practices.
  1071. Md5Hash string `json:"md5Hash,omitempty"`
  1072. // MediaLink: Media download link.
  1073. MediaLink string `json:"mediaLink,omitempty"`
  1074. // Metadata: User-provided metadata, in key/value pairs.
  1075. Metadata map[string]string `json:"metadata,omitempty"`
  1076. // Metageneration: The version of the metadata for this object at this
  1077. // generation. Used for preconditions and for detecting changes in
  1078. // metadata. A metageneration number is only meaningful in the context
  1079. // of a particular generation of a particular object.
  1080. Metageneration int64 `json:"metageneration,omitempty,string"`
  1081. // Name: The name of the object. Required if not specified by URL
  1082. // parameter.
  1083. Name string `json:"name,omitempty"`
  1084. // Owner: The owner of the object. This will always be the uploader of
  1085. // the object.
  1086. Owner *ObjectOwner `json:"owner,omitempty"`
  1087. // RetentionExpirationTime: Specifies the earliest time that the
  1088. // object's retention period expires. This value is server-determined
  1089. // and is in RFC 3339 format. Note 1: This field is not provided for
  1090. // objects with an active Event-Based hold, since retention expiration
  1091. // is unknown until the hold is removed. Note 2: This value can be
  1092. // provided even when TemporaryHold is set (so that the user can reason
  1093. // about policy without having to first unset the TemporaryHold).
  1094. RetentionExpirationTime string `json:"retentionExpirationTime,omitempty"`
  1095. // SelfLink: The link to this object.
  1096. SelfLink string `json:"selfLink,omitempty"`
  1097. // Size: Content-Length of the data in bytes.
  1098. Size uint64 `json:"size,omitempty,string"`
  1099. // StorageClass: Storage class of the object.
  1100. StorageClass string `json:"storageClass,omitempty"`
  1101. // TemporaryHold: Defines the temporary hold for an object. This flag is
  1102. // used to enforce a temporary hold on an object. While it is set to
  1103. // true, the object is protected against deletion and overwrites. A
  1104. // common use case of this flag is regulatory investigations where
  1105. // objects need to be retained while the investigation is ongoing.
  1106. TemporaryHold bool `json:"temporaryHold,omitempty"`
  1107. // TimeCreated: The creation time of the object in RFC 3339 format.
  1108. TimeCreated string `json:"timeCreated,omitempty"`
  1109. // TimeDeleted: The deletion time of the object in RFC 3339 format. Will
  1110. // be returned if and only if this version of the object has been
  1111. // deleted.
  1112. TimeDeleted string `json:"timeDeleted,omitempty"`
  1113. // TimeStorageClassUpdated: The time at which the object's storage class
  1114. // was last changed. When the object is initially created, it will be
  1115. // set to timeCreated.
  1116. TimeStorageClassUpdated string `json:"timeStorageClassUpdated,omitempty"`
  1117. // Updated: The modification time of the object metadata in RFC 3339
  1118. // format.
  1119. Updated string `json:"updated,omitempty"`
  1120. // ServerResponse contains the HTTP response code and headers from the
  1121. // server.
  1122. googleapi.ServerResponse `json:"-"`
  1123. // ForceSendFields is a list of field names (e.g. "Acl") to
  1124. // unconditionally include in API requests. By default, fields with
  1125. // empty values are omitted from API requests. However, any non-pointer,
  1126. // non-interface field appearing in ForceSendFields will be sent to the
  1127. // server regardless of whether the field is empty or not. This may be
  1128. // used to include empty fields in Patch requests.
  1129. ForceSendFields []string `json:"-"`
  1130. // NullFields is a list of field names (e.g. "Acl") to include in API
  1131. // requests with the JSON null value. By default, fields with empty
  1132. // values are omitted from API requests. However, any field with an
  1133. // empty value appearing in NullFields will be sent to the server as
  1134. // null. It is an error if a field in this list has a non-empty value.
  1135. // This may be used to include null fields in Patch requests.
  1136. NullFields []string `json:"-"`
  1137. }
  1138. func (s *Object) MarshalJSON() ([]byte, error) {
  1139. type NoMethod Object
  1140. raw := NoMethod(*s)
  1141. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1142. }
  1143. // ObjectCustomerEncryption: Metadata of customer-supplied encryption
  1144. // key, if the object is encrypted by such a key.
  1145. type ObjectCustomerEncryption struct {
  1146. // EncryptionAlgorithm: The encryption algorithm.
  1147. EncryptionAlgorithm string `json:"encryptionAlgorithm,omitempty"`
  1148. // KeySha256: SHA256 hash value of the encryption key.
  1149. KeySha256 string `json:"keySha256,omitempty"`
  1150. // ForceSendFields is a list of field names (e.g. "EncryptionAlgorithm")
  1151. // to unconditionally include in API requests. By default, fields with
  1152. // empty values are omitted from API requests. However, any non-pointer,
  1153. // non-interface field appearing in ForceSendFields will be sent to the
  1154. // server regardless of whether the field is empty or not. This may be
  1155. // used to include empty fields in Patch requests.
  1156. ForceSendFields []string `json:"-"`
  1157. // NullFields is a list of field names (e.g. "EncryptionAlgorithm") to
  1158. // include in API requests with the JSON null value. By default, fields
  1159. // with empty values are omitted from API requests. However, any field
  1160. // with an empty value appearing in NullFields will be sent to the
  1161. // server as null. It is an error if a field in this list has a
  1162. // non-empty value. This may be used to include null fields in Patch
  1163. // requests.
  1164. NullFields []string `json:"-"`
  1165. }
  1166. func (s *ObjectCustomerEncryption) MarshalJSON() ([]byte, error) {
  1167. type NoMethod ObjectCustomerEncryption
  1168. raw := NoMethod(*s)
  1169. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1170. }
  1171. // ObjectOwner: The owner of the object. This will always be the
  1172. // uploader of the object.
  1173. type ObjectOwner struct {
  1174. // Entity: The entity, in the form user-userId.
  1175. Entity string `json:"entity,omitempty"`
  1176. // EntityId: The ID for the entity.
  1177. EntityId string `json:"entityId,omitempty"`
  1178. // ForceSendFields is a list of field names (e.g. "Entity") to
  1179. // unconditionally include in API requests. By default, fields with
  1180. // empty values are omitted from API requests. However, any non-pointer,
  1181. // non-interface field appearing in ForceSendFields will be sent to the
  1182. // server regardless of whether the field is empty or not. This may be
  1183. // used to include empty fields in Patch requests.
  1184. ForceSendFields []string `json:"-"`
  1185. // NullFields is a list of field names (e.g. "Entity") to include in API
  1186. // requests with the JSON null value. By default, fields with empty
  1187. // values are omitted from API requests. However, any field with an
  1188. // empty value appearing in NullFields will be sent to the server as
  1189. // null. It is an error if a field in this list has a non-empty value.
  1190. // This may be used to include null fields in Patch requests.
  1191. NullFields []string `json:"-"`
  1192. }
  1193. func (s *ObjectOwner) MarshalJSON() ([]byte, error) {
  1194. type NoMethod ObjectOwner
  1195. raw := NoMethod(*s)
  1196. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1197. }
  1198. // ObjectAccessControl: An access-control entry.
  1199. type ObjectAccessControl struct {
  1200. // Bucket: The name of the bucket.
  1201. Bucket string `json:"bucket,omitempty"`
  1202. // Domain: The domain associated with the entity, if any.
  1203. Domain string `json:"domain,omitempty"`
  1204. // Email: The email address associated with the entity, if any.
  1205. Email string `json:"email,omitempty"`
  1206. // Entity: The entity holding the permission, in one of the following
  1207. // forms:
  1208. // - user-userId
  1209. // - user-email
  1210. // - group-groupId
  1211. // - group-email
  1212. // - domain-domain
  1213. // - project-team-projectId
  1214. // - allUsers
  1215. // - allAuthenticatedUsers Examples:
  1216. // - The user liz@example.com would be user-liz@example.com.
  1217. // - The group example@googlegroups.com would be
  1218. // group-example@googlegroups.com.
  1219. // - To refer to all members of the Google Apps for Business domain
  1220. // example.com, the entity would be domain-example.com.
  1221. Entity string `json:"entity,omitempty"`
  1222. // EntityId: The ID for the entity, if any.
  1223. EntityId string `json:"entityId,omitempty"`
  1224. // Etag: HTTP 1.1 Entity tag for the access-control entry.
  1225. Etag string `json:"etag,omitempty"`
  1226. // Generation: The content generation of the object, if applied to an
  1227. // object.
  1228. Generation int64 `json:"generation,omitempty,string"`
  1229. // Id: The ID of the access-control entry.
  1230. Id string `json:"id,omitempty"`
  1231. // Kind: The kind of item this is. For object access control entries,
  1232. // this is always storage#objectAccessControl.
  1233. Kind string `json:"kind,omitempty"`
  1234. // Object: The name of the object, if applied to an object.
  1235. Object string `json:"object,omitempty"`
  1236. // ProjectTeam: The project team associated with the entity, if any.
  1237. ProjectTeam *ObjectAccessControlProjectTeam `json:"projectTeam,omitempty"`
  1238. // Role: The access permission for the entity.
  1239. Role string `json:"role,omitempty"`
  1240. // SelfLink: The link to this access-control entry.
  1241. SelfLink string `json:"selfLink,omitempty"`
  1242. // ServerResponse contains the HTTP response code and headers from the
  1243. // server.
  1244. googleapi.ServerResponse `json:"-"`
  1245. // ForceSendFields is a list of field names (e.g. "Bucket") to
  1246. // unconditionally include in API requests. By default, fields with
  1247. // empty values are omitted from API requests. However, any non-pointer,
  1248. // non-interface field appearing in ForceSendFields will be sent to the
  1249. // server regardless of whether the field is empty or not. This may be
  1250. // used to include empty fields in Patch requests.
  1251. ForceSendFields []string `json:"-"`
  1252. // NullFields is a list of field names (e.g. "Bucket") to include in API
  1253. // requests with the JSON null value. By default, fields with empty
  1254. // values are omitted from API requests. However, any field with an
  1255. // empty value appearing in NullFields will be sent to the server as
  1256. // null. It is an error if a field in this list has a non-empty value.
  1257. // This may be used to include null fields in Patch requests.
  1258. NullFields []string `json:"-"`
  1259. }
  1260. func (s *ObjectAccessControl) MarshalJSON() ([]byte, error) {
  1261. type NoMethod ObjectAccessControl
  1262. raw := NoMethod(*s)
  1263. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1264. }
  1265. // ObjectAccessControlProjectTeam: The project team associated with the
  1266. // entity, if any.
  1267. type ObjectAccessControlProjectTeam struct {
  1268. // ProjectNumber: The project number.
  1269. ProjectNumber string `json:"projectNumber,omitempty"`
  1270. // Team: The team.
  1271. Team string `json:"team,omitempty"`
  1272. // ForceSendFields is a list of field names (e.g. "ProjectNumber") to
  1273. // unconditionally include in API requests. By default, fields with
  1274. // empty values are omitted from API requests. However, any non-pointer,
  1275. // non-interface field appearing in ForceSendFields will be sent to the
  1276. // server regardless of whether the field is empty or not. This may be
  1277. // used to include empty fields in Patch requests.
  1278. ForceSendFields []string `json:"-"`
  1279. // NullFields is a list of field names (e.g. "ProjectNumber") to include
  1280. // in API requests with the JSON null value. By default, fields with
  1281. // empty values are omitted from API requests. However, any field with
  1282. // an empty value appearing in NullFields will be sent to the server as
  1283. // null. It is an error if a field in this list has a non-empty value.
  1284. // This may be used to include null fields in Patch requests.
  1285. NullFields []string `json:"-"`
  1286. }
  1287. func (s *ObjectAccessControlProjectTeam) MarshalJSON() ([]byte, error) {
  1288. type NoMethod ObjectAccessControlProjectTeam
  1289. raw := NoMethod(*s)
  1290. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1291. }
  1292. // ObjectAccessControls: An access-control list.
  1293. type ObjectAccessControls struct {
  1294. // Items: The list of items.
  1295. Items []*ObjectAccessControl `json:"items,omitempty"`
  1296. // Kind: The kind of item this is. For lists of object access control
  1297. // entries, this is always storage#objectAccessControls.
  1298. Kind string `json:"kind,omitempty"`
  1299. // ServerResponse contains the HTTP response code and headers from the
  1300. // server.
  1301. googleapi.ServerResponse `json:"-"`
  1302. // ForceSendFields is a list of field names (e.g. "Items") to
  1303. // unconditionally include in API requests. By default, fields with
  1304. // empty values are omitted from API requests. However, any non-pointer,
  1305. // non-interface field appearing in ForceSendFields will be sent to the
  1306. // server regardless of whether the field is empty or not. This may be
  1307. // used to include empty fields in Patch requests.
  1308. ForceSendFields []string `json:"-"`
  1309. // NullFields is a list of field names (e.g. "Items") to include in API
  1310. // requests with the JSON null value. By default, fields with empty
  1311. // values are omitted from API requests. However, any field with an
  1312. // empty value appearing in NullFields will be sent to the server as
  1313. // null. It is an error if a field in this list has a non-empty value.
  1314. // This may be used to include null fields in Patch requests.
  1315. NullFields []string `json:"-"`
  1316. }
  1317. func (s *ObjectAccessControls) MarshalJSON() ([]byte, error) {
  1318. type NoMethod ObjectAccessControls
  1319. raw := NoMethod(*s)
  1320. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1321. }
  1322. // Objects: A list of objects.
  1323. type Objects struct {
  1324. // Items: The list of items.
  1325. Items []*Object `json:"items,omitempty"`
  1326. // Kind: The kind of item this is. For lists of objects, this is always
  1327. // storage#objects.
  1328. Kind string `json:"kind,omitempty"`
  1329. // NextPageToken: The continuation token, used to page through large
  1330. // result sets. Provide this value in a subsequent request to return the
  1331. // next page of results.
  1332. NextPageToken string `json:"nextPageToken,omitempty"`
  1333. // Prefixes: The list of prefixes of objects matching-but-not-listed up
  1334. // to and including the requested delimiter.
  1335. Prefixes []string `json:"prefixes,omitempty"`
  1336. // ServerResponse contains the HTTP response code and headers from the
  1337. // server.
  1338. googleapi.ServerResponse `json:"-"`
  1339. // ForceSendFields is a list of field names (e.g. "Items") to
  1340. // unconditionally include in API requests. By default, fields with
  1341. // empty values are omitted from API requests. However, any non-pointer,
  1342. // non-interface field appearing in ForceSendFields will be sent to the
  1343. // server regardless of whether the field is empty or not. This may be
  1344. // used to include empty fields in Patch requests.
  1345. ForceSendFields []string `json:"-"`
  1346. // NullFields is a list of field names (e.g. "Items") to include in API
  1347. // requests with the JSON null value. By default, fields with empty
  1348. // values are omitted from API requests. However, any field with an
  1349. // empty value appearing in NullFields will be sent to the server as
  1350. // null. It is an error if a field in this list has a non-empty value.
  1351. // This may be used to include null fields in Patch requests.
  1352. NullFields []string `json:"-"`
  1353. }
  1354. func (s *Objects) MarshalJSON() ([]byte, error) {
  1355. type NoMethod Objects
  1356. raw := NoMethod(*s)
  1357. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1358. }
  1359. // Policy: A bucket/object IAM policy.
  1360. type Policy struct {
  1361. // Bindings: An association between a role, which comes with a set of
  1362. // permissions, and members who may assume that role.
  1363. Bindings []*PolicyBindings `json:"bindings,omitempty"`
  1364. // Etag: HTTP 1.1 Entity tag for the policy.
  1365. Etag string `json:"etag,omitempty"`
  1366. // Kind: The kind of item this is. For policies, this is always
  1367. // storage#policy. This field is ignored on input.
  1368. Kind string `json:"kind,omitempty"`
  1369. // ResourceId: The ID of the resource to which this policy belongs. Will
  1370. // be of the form projects/_/buckets/bucket for buckets, and
  1371. // projects/_/buckets/bucket/objects/object for objects. A specific
  1372. // generation may be specified by appending #generationNumber to the end
  1373. // of the object name, e.g.
  1374. // projects/_/buckets/my-bucket/objects/data.txt#17. The current
  1375. // generation can be denoted with #0. This field is ignored on input.
  1376. ResourceId string `json:"resourceId,omitempty"`
  1377. // ServerResponse contains the HTTP response code and headers from the
  1378. // server.
  1379. googleapi.ServerResponse `json:"-"`
  1380. // ForceSendFields is a list of field names (e.g. "Bindings") to
  1381. // unconditionally include in API requests. By default, fields with
  1382. // empty values are omitted from API requests. However, any non-pointer,
  1383. // non-interface field appearing in ForceSendFields will be sent to the
  1384. // server regardless of whether the field is empty or not. This may be
  1385. // used to include empty fields in Patch requests.
  1386. ForceSendFields []string `json:"-"`
  1387. // NullFields is a list of field names (e.g. "Bindings") to include in
  1388. // API requests with the JSON null value. By default, fields with empty
  1389. // values are omitted from API requests. However, any field with an
  1390. // empty value appearing in NullFields will be sent to the server as
  1391. // null. It is an error if a field in this list has a non-empty value.
  1392. // This may be used to include null fields in Patch requests.
  1393. NullFields []string `json:"-"`
  1394. }
  1395. func (s *Policy) MarshalJSON() ([]byte, error) {
  1396. type NoMethod Policy
  1397. raw := NoMethod(*s)
  1398. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1399. }
  1400. type PolicyBindings struct {
  1401. Condition interface{} `json:"condition,omitempty"`
  1402. // Members: A collection of identifiers for members who may assume the
  1403. // provided role. Recognized identifiers are as follows:
  1404. // - allUsers — A special identifier that represents anyone on the
  1405. // internet; with or without a Google account.
  1406. // - allAuthenticatedUsers — A special identifier that represents
  1407. // anyone who is authenticated with a Google account or a service
  1408. // account.
  1409. // - user:emailid — An email address that represents a specific
  1410. // account. For example, user:alice@gmail.com or user:joe@example.com.
  1411. //
  1412. // - serviceAccount:emailid — An email address that represents a
  1413. // service account. For example,
  1414. // serviceAccount:my-other-app@appspot.gserviceaccount.com .
  1415. // - group:emailid — An email address that represents a Google group.
  1416. // For example, group:admins@example.com.
  1417. // - domain:domain — A Google Apps domain name that represents all the
  1418. // users of that domain. For example, domain:google.com or
  1419. // domain:example.com.
  1420. // - projectOwner:projectid — Owners of the given project. For
  1421. // example, projectOwner:my-example-project
  1422. // - projectEditor:projectid — Editors of the given project. For
  1423. // example, projectEditor:my-example-project
  1424. // - projectViewer:projectid — Viewers of the given project. For
  1425. // example, projectViewer:my-example-project
  1426. Members []string `json:"members,omitempty"`
  1427. // Role: The role to which members belong. Two types of roles are
  1428. // supported: new IAM roles, which grant permissions that do not map
  1429. // directly to those provided by ACLs, and legacy IAM roles, which do
  1430. // map directly to ACL permissions. All roles are of the format
  1431. // roles/storage.specificRole.
  1432. // The new IAM roles are:
  1433. // - roles/storage.admin — Full control of Google Cloud Storage
  1434. // resources.
  1435. // - roles/storage.objectViewer — Read-Only access to Google Cloud
  1436. // Storage objects.
  1437. // - roles/storage.objectCreator — Access to create objects in Google
  1438. // Cloud Storage.
  1439. // - roles/storage.objectAdmin — Full control of Google Cloud Storage
  1440. // objects. The legacy IAM roles are:
  1441. // - roles/storage.legacyObjectReader — Read-only access to objects
  1442. // without listing. Equivalent to an ACL entry on an object with the
  1443. // READER role.
  1444. // - roles/storage.legacyObjectOwner — Read/write access to existing
  1445. // objects without listing. Equivalent to an ACL entry on an object with
  1446. // the OWNER role.
  1447. // - roles/storage.legacyBucketReader — Read access to buckets with
  1448. // object listing. Equivalent to an ACL entry on a bucket with the
  1449. // READER role.
  1450. // - roles/storage.legacyBucketWriter — Read access to buckets with
  1451. // object listing/creation/deletion. Equivalent to an ACL entry on a
  1452. // bucket with the WRITER role.
  1453. // - roles/storage.legacyBucketOwner — Read and write access to
  1454. // existing buckets with object listing/creation/deletion. Equivalent to
  1455. // an ACL entry on a bucket with the OWNER role.
  1456. Role string `json:"role,omitempty"`
  1457. // ForceSendFields is a list of field names (e.g. "Condition") to
  1458. // unconditionally include in API requests. By default, fields with
  1459. // empty values are omitted from API requests. However, any non-pointer,
  1460. // non-interface field appearing in ForceSendFields will be sent to the
  1461. // server regardless of whether the field is empty or not. This may be
  1462. // used to include empty fields in Patch requests.
  1463. ForceSendFields []string `json:"-"`
  1464. // NullFields is a list of field names (e.g. "Condition") to include in
  1465. // API requests with the JSON null value. By default, fields with empty
  1466. // values are omitted from API requests. However, any field with an
  1467. // empty value appearing in NullFields will be sent to the server as
  1468. // null. It is an error if a field in this list has a non-empty value.
  1469. // This may be used to include null fields in Patch requests.
  1470. NullFields []string `json:"-"`
  1471. }
  1472. func (s *PolicyBindings) MarshalJSON() ([]byte, error) {
  1473. type NoMethod PolicyBindings
  1474. raw := NoMethod(*s)
  1475. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1476. }
  1477. // RewriteResponse: A rewrite response.
  1478. type RewriteResponse struct {
  1479. // Done: true if the copy is finished; otherwise, false if the copy is
  1480. // in progress. This property is always present in the response.
  1481. Done bool `json:"done,omitempty"`
  1482. // Kind: The kind of item this is.
  1483. Kind string `json:"kind,omitempty"`
  1484. // ObjectSize: The total size of the object being copied in bytes. This
  1485. // property is always present in the response.
  1486. ObjectSize int64 `json:"objectSize,omitempty,string"`
  1487. // Resource: A resource containing the metadata for the copied-to
  1488. // object. This property is present in the response only when copying
  1489. // completes.
  1490. Resource *Object `json:"resource,omitempty"`
  1491. // RewriteToken: A token to use in subsequent requests to continue
  1492. // copying data. This token is present in the response only when there
  1493. // is more data to copy.
  1494. RewriteToken string `json:"rewriteToken,omitempty"`
  1495. // TotalBytesRewritten: The total bytes written so far, which can be
  1496. // used to provide a waiting user with a progress indicator. This
  1497. // property is always present in the response.
  1498. TotalBytesRewritten int64 `json:"totalBytesRewritten,omitempty,string"`
  1499. // ServerResponse contains the HTTP response code and headers from the
  1500. // server.
  1501. googleapi.ServerResponse `json:"-"`
  1502. // ForceSendFields is a list of field names (e.g. "Done") to
  1503. // unconditionally include in API requests. By default, fields with
  1504. // empty values are omitted from API requests. However, any non-pointer,
  1505. // non-interface field appearing in ForceSendFields will be sent to the
  1506. // server regardless of whether the field is empty or not. This may be
  1507. // used to include empty fields in Patch requests.
  1508. ForceSendFields []string `json:"-"`
  1509. // NullFields is a list of field names (e.g. "Done") to include in API
  1510. // requests with the JSON null value. By default, fields with empty
  1511. // values are omitted from API requests. However, any field with an
  1512. // empty value appearing in NullFields will be sent to the server as
  1513. // null. It is an error if a field in this list has a non-empty value.
  1514. // This may be used to include null fields in Patch requests.
  1515. NullFields []string `json:"-"`
  1516. }
  1517. func (s *RewriteResponse) MarshalJSON() ([]byte, error) {
  1518. type NoMethod RewriteResponse
  1519. raw := NoMethod(*s)
  1520. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1521. }
  1522. // ServiceAccount: A subscription to receive Google PubSub
  1523. // notifications.
  1524. type ServiceAccount struct {
  1525. // EmailAddress: The ID of the notification.
  1526. EmailAddress string `json:"email_address,omitempty"`
  1527. // Kind: The kind of item this is. For notifications, this is always
  1528. // storage#notification.
  1529. Kind string `json:"kind,omitempty"`
  1530. // ServerResponse contains the HTTP response code and headers from the
  1531. // server.
  1532. googleapi.ServerResponse `json:"-"`
  1533. // ForceSendFields is a list of field names (e.g. "EmailAddress") to
  1534. // unconditionally include in API requests. By default, fields with
  1535. // empty values are omitted from API requests. However, any non-pointer,
  1536. // non-interface field appearing in ForceSendFields will be sent to the
  1537. // server regardless of whether the field is empty or not. This may be
  1538. // used to include empty fields in Patch requests.
  1539. ForceSendFields []string `json:"-"`
  1540. // NullFields is a list of field names (e.g. "EmailAddress") to include
  1541. // in API requests with the JSON null value. By default, fields with
  1542. // empty values are omitted from API requests. However, any field with
  1543. // an empty value appearing in NullFields will be sent to the server as
  1544. // null. It is an error if a field in this list has a non-empty value.
  1545. // This may be used to include null fields in Patch requests.
  1546. NullFields []string `json:"-"`
  1547. }
  1548. func (s *ServiceAccount) MarshalJSON() ([]byte, error) {
  1549. type NoMethod ServiceAccount
  1550. raw := NoMethod(*s)
  1551. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1552. }
  1553. // TestIamPermissionsResponse: A
  1554. // storage.(buckets|objects).testIamPermissions response.
  1555. type TestIamPermissionsResponse struct {
  1556. // Kind: The kind of item this is.
  1557. Kind string `json:"kind,omitempty"`
  1558. // Permissions: The permissions held by the caller. Permissions are
  1559. // always of the format storage.resource.capability, where resource is
  1560. // one of buckets or objects. The supported permissions are as follows:
  1561. //
  1562. // - storage.buckets.delete — Delete bucket.
  1563. // - storage.buckets.get — Read bucket metadata.
  1564. // - storage.buckets.getIamPolicy — Read bucket IAM policy.
  1565. // - storage.buckets.create — Create bucket.
  1566. // - storage.buckets.list — List buckets.
  1567. // - storage.buckets.setIamPolicy — Update bucket IAM policy.
  1568. // - storage.buckets.update — Update bucket metadata.
  1569. // - storage.objects.delete — Delete object.
  1570. // - storage.objects.get — Read object data and metadata.
  1571. // - storage.objects.getIamPolicy — Read object IAM policy.
  1572. // - storage.objects.create — Create object.
  1573. // - storage.objects.list — List objects.
  1574. // - storage.objects.setIamPolicy — Update object IAM policy.
  1575. // - storage.objects.update — Update object metadata.
  1576. Permissions []string `json:"permissions,omitempty"`
  1577. // ServerResponse contains the HTTP response code and headers from the
  1578. // server.
  1579. googleapi.ServerResponse `json:"-"`
  1580. // ForceSendFields is a list of field names (e.g. "Kind") to
  1581. // unconditionally include in API requests. By default, fields with
  1582. // empty values are omitted from API requests. However, any non-pointer,
  1583. // non-interface field appearing in ForceSendFields will be sent to the
  1584. // server regardless of whether the field is empty or not. This may be
  1585. // used to include empty fields in Patch requests.
  1586. ForceSendFields []string `json:"-"`
  1587. // NullFields is a list of field names (e.g. "Kind") to include in API
  1588. // requests with the JSON null value. By default, fields with empty
  1589. // values are omitted from API requests. However, any field with an
  1590. // empty value appearing in NullFields will be sent to the server as
  1591. // null. It is an error if a field in this list has a non-empty value.
  1592. // This may be used to include null fields in Patch requests.
  1593. NullFields []string `json:"-"`
  1594. }
  1595. func (s *TestIamPermissionsResponse) MarshalJSON() ([]byte, error) {
  1596. type NoMethod TestIamPermissionsResponse
  1597. raw := NoMethod(*s)
  1598. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1599. }
  1600. // method id "storage.bucketAccessControls.delete":
  1601. type BucketAccessControlsDeleteCall struct {
  1602. s *Service
  1603. bucket string
  1604. entity string
  1605. urlParams_ gensupport.URLParams
  1606. ctx_ context.Context
  1607. header_ http.Header
  1608. }
  1609. // Delete: Permanently deletes the ACL entry for the specified entity on
  1610. // the specified bucket.
  1611. func (r *BucketAccessControlsService) Delete(bucket string, entity string) *BucketAccessControlsDeleteCall {
  1612. c := &BucketAccessControlsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1613. c.bucket = bucket
  1614. c.entity = entity
  1615. return c
  1616. }
  1617. // UserProject sets the optional parameter "userProject": The project to
  1618. // be billed for this request. Required for Requester Pays buckets.
  1619. func (c *BucketAccessControlsDeleteCall) UserProject(userProject string) *BucketAccessControlsDeleteCall {
  1620. c.urlParams_.Set("userProject", userProject)
  1621. return c
  1622. }
  1623. // Fields allows partial responses to be retrieved. See
  1624. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1625. // for more information.
  1626. func (c *BucketAccessControlsDeleteCall) Fields(s ...googleapi.Field) *BucketAccessControlsDeleteCall {
  1627. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1628. return c
  1629. }
  1630. // Context sets the context to be used in this call's Do method. Any
  1631. // pending HTTP request will be aborted if the provided context is
  1632. // canceled.
  1633. func (c *BucketAccessControlsDeleteCall) Context(ctx context.Context) *BucketAccessControlsDeleteCall {
  1634. c.ctx_ = ctx
  1635. return c
  1636. }
  1637. // Header returns an http.Header that can be modified by the caller to
  1638. // add HTTP headers to the request.
  1639. func (c *BucketAccessControlsDeleteCall) Header() http.Header {
  1640. if c.header_ == nil {
  1641. c.header_ = make(http.Header)
  1642. }
  1643. return c.header_
  1644. }
  1645. func (c *BucketAccessControlsDeleteCall) doRequest(alt string) (*http.Response, error) {
  1646. reqHeaders := make(http.Header)
  1647. for k, v := range c.header_ {
  1648. reqHeaders[k] = v
  1649. }
  1650. reqHeaders.Set("User-Agent", c.s.userAgent())
  1651. var body io.Reader = nil
  1652. c.urlParams_.Set("alt", alt)
  1653. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/acl/{entity}")
  1654. urls += "?" + c.urlParams_.Encode()
  1655. req, _ := http.NewRequest("DELETE", urls, body)
  1656. req.Header = reqHeaders
  1657. googleapi.Expand(req.URL, map[string]string{
  1658. "bucket": c.bucket,
  1659. "entity": c.entity,
  1660. })
  1661. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1662. }
  1663. // Do executes the "storage.bucketAccessControls.delete" call.
  1664. func (c *BucketAccessControlsDeleteCall) Do(opts ...googleapi.CallOption) error {
  1665. gensupport.SetOptions(c.urlParams_, opts...)
  1666. res, err := c.doRequest("json")
  1667. if err != nil {
  1668. return err
  1669. }
  1670. defer googleapi.CloseBody(res)
  1671. if err := googleapi.CheckResponse(res); err != nil {
  1672. return err
  1673. }
  1674. return nil
  1675. // {
  1676. // "description": "Permanently deletes the ACL entry for the specified entity on the specified bucket.",
  1677. // "httpMethod": "DELETE",
  1678. // "id": "storage.bucketAccessControls.delete",
  1679. // "parameterOrder": [
  1680. // "bucket",
  1681. // "entity"
  1682. // ],
  1683. // "parameters": {
  1684. // "bucket": {
  1685. // "description": "Name of a bucket.",
  1686. // "location": "path",
  1687. // "required": true,
  1688. // "type": "string"
  1689. // },
  1690. // "entity": {
  1691. // "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.",
  1692. // "location": "path",
  1693. // "required": true,
  1694. // "type": "string"
  1695. // },
  1696. // "userProject": {
  1697. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  1698. // "location": "query",
  1699. // "type": "string"
  1700. // }
  1701. // },
  1702. // "path": "b/{bucket}/acl/{entity}",
  1703. // "scopes": [
  1704. // "https://www.googleapis.com/auth/cloud-platform",
  1705. // "https://www.googleapis.com/auth/devstorage.full_control"
  1706. // ]
  1707. // }
  1708. }
  1709. // method id "storage.bucketAccessControls.get":
  1710. type BucketAccessControlsGetCall struct {
  1711. s *Service
  1712. bucket string
  1713. entity string
  1714. urlParams_ gensupport.URLParams
  1715. ifNoneMatch_ string
  1716. ctx_ context.Context
  1717. header_ http.Header
  1718. }
  1719. // Get: Returns the ACL entry for the specified entity on the specified
  1720. // bucket.
  1721. func (r *BucketAccessControlsService) Get(bucket string, entity string) *BucketAccessControlsGetCall {
  1722. c := &BucketAccessControlsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1723. c.bucket = bucket
  1724. c.entity = entity
  1725. return c
  1726. }
  1727. // UserProject sets the optional parameter "userProject": The project to
  1728. // be billed for this request. Required for Requester Pays buckets.
  1729. func (c *BucketAccessControlsGetCall) UserProject(userProject string) *BucketAccessControlsGetCall {
  1730. c.urlParams_.Set("userProject", userProject)
  1731. return c
  1732. }
  1733. // Fields allows partial responses to be retrieved. See
  1734. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1735. // for more information.
  1736. func (c *BucketAccessControlsGetCall) Fields(s ...googleapi.Field) *BucketAccessControlsGetCall {
  1737. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1738. return c
  1739. }
  1740. // IfNoneMatch sets the optional parameter which makes the operation
  1741. // fail if the object's ETag matches the given value. This is useful for
  1742. // getting updates only after the object has changed since the last
  1743. // request. Use googleapi.IsNotModified to check whether the response
  1744. // error from Do is the result of In-None-Match.
  1745. func (c *BucketAccessControlsGetCall) IfNoneMatch(entityTag string) *BucketAccessControlsGetCall {
  1746. c.ifNoneMatch_ = entityTag
  1747. return c
  1748. }
  1749. // Context sets the context to be used in this call's Do method. Any
  1750. // pending HTTP request will be aborted if the provided context is
  1751. // canceled.
  1752. func (c *BucketAccessControlsGetCall) Context(ctx context.Context) *BucketAccessControlsGetCall {
  1753. c.ctx_ = ctx
  1754. return c
  1755. }
  1756. // Header returns an http.Header that can be modified by the caller to
  1757. // add HTTP headers to the request.
  1758. func (c *BucketAccessControlsGetCall) Header() http.Header {
  1759. if c.header_ == nil {
  1760. c.header_ = make(http.Header)
  1761. }
  1762. return c.header_
  1763. }
  1764. func (c *BucketAccessControlsGetCall) doRequest(alt string) (*http.Response, error) {
  1765. reqHeaders := make(http.Header)
  1766. for k, v := range c.header_ {
  1767. reqHeaders[k] = v
  1768. }
  1769. reqHeaders.Set("User-Agent", c.s.userAgent())
  1770. if c.ifNoneMatch_ != "" {
  1771. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1772. }
  1773. var body io.Reader = nil
  1774. c.urlParams_.Set("alt", alt)
  1775. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/acl/{entity}")
  1776. urls += "?" + c.urlParams_.Encode()
  1777. req, _ := http.NewRequest("GET", urls, body)
  1778. req.Header = reqHeaders
  1779. googleapi.Expand(req.URL, map[string]string{
  1780. "bucket": c.bucket,
  1781. "entity": c.entity,
  1782. })
  1783. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1784. }
  1785. // Do executes the "storage.bucketAccessControls.get" call.
  1786. // Exactly one of *BucketAccessControl or error will be non-nil. Any
  1787. // non-2xx status code is an error. Response headers are in either
  1788. // *BucketAccessControl.ServerResponse.Header or (if a response was
  1789. // returned at all) in error.(*googleapi.Error).Header. Use
  1790. // googleapi.IsNotModified to check whether the returned error was
  1791. // because http.StatusNotModified was returned.
  1792. func (c *BucketAccessControlsGetCall) Do(opts ...googleapi.CallOption) (*BucketAccessControl, error) {
  1793. gensupport.SetOptions(c.urlParams_, opts...)
  1794. res, err := c.doRequest("json")
  1795. if res != nil && res.StatusCode == http.StatusNotModified {
  1796. if res.Body != nil {
  1797. res.Body.Close()
  1798. }
  1799. return nil, &googleapi.Error{
  1800. Code: res.StatusCode,
  1801. Header: res.Header,
  1802. }
  1803. }
  1804. if err != nil {
  1805. return nil, err
  1806. }
  1807. defer googleapi.CloseBody(res)
  1808. if err := googleapi.CheckResponse(res); err != nil {
  1809. return nil, err
  1810. }
  1811. ret := &BucketAccessControl{
  1812. ServerResponse: googleapi.ServerResponse{
  1813. Header: res.Header,
  1814. HTTPStatusCode: res.StatusCode,
  1815. },
  1816. }
  1817. target := &ret
  1818. if err := gensupport.DecodeResponse(target, res); err != nil {
  1819. return nil, err
  1820. }
  1821. return ret, nil
  1822. // {
  1823. // "description": "Returns the ACL entry for the specified entity on the specified bucket.",
  1824. // "httpMethod": "GET",
  1825. // "id": "storage.bucketAccessControls.get",
  1826. // "parameterOrder": [
  1827. // "bucket",
  1828. // "entity"
  1829. // ],
  1830. // "parameters": {
  1831. // "bucket": {
  1832. // "description": "Name of a bucket.",
  1833. // "location": "path",
  1834. // "required": true,
  1835. // "type": "string"
  1836. // },
  1837. // "entity": {
  1838. // "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.",
  1839. // "location": "path",
  1840. // "required": true,
  1841. // "type": "string"
  1842. // },
  1843. // "userProject": {
  1844. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  1845. // "location": "query",
  1846. // "type": "string"
  1847. // }
  1848. // },
  1849. // "path": "b/{bucket}/acl/{entity}",
  1850. // "response": {
  1851. // "$ref": "BucketAccessControl"
  1852. // },
  1853. // "scopes": [
  1854. // "https://www.googleapis.com/auth/cloud-platform",
  1855. // "https://www.googleapis.com/auth/devstorage.full_control"
  1856. // ]
  1857. // }
  1858. }
  1859. // method id "storage.bucketAccessControls.insert":
  1860. type BucketAccessControlsInsertCall struct {
  1861. s *Service
  1862. bucket string
  1863. bucketaccesscontrol *BucketAccessControl
  1864. urlParams_ gensupport.URLParams
  1865. ctx_ context.Context
  1866. header_ http.Header
  1867. }
  1868. // Insert: Creates a new ACL entry on the specified bucket.
  1869. func (r *BucketAccessControlsService) Insert(bucket string, bucketaccesscontrol *BucketAccessControl) *BucketAccessControlsInsertCall {
  1870. c := &BucketAccessControlsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1871. c.bucket = bucket
  1872. c.bucketaccesscontrol = bucketaccesscontrol
  1873. return c
  1874. }
  1875. // UserProject sets the optional parameter "userProject": The project to
  1876. // be billed for this request. Required for Requester Pays buckets.
  1877. func (c *BucketAccessControlsInsertCall) UserProject(userProject string) *BucketAccessControlsInsertCall {
  1878. c.urlParams_.Set("userProject", userProject)
  1879. return c
  1880. }
  1881. // Fields allows partial responses to be retrieved. See
  1882. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1883. // for more information.
  1884. func (c *BucketAccessControlsInsertCall) Fields(s ...googleapi.Field) *BucketAccessControlsInsertCall {
  1885. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1886. return c
  1887. }
  1888. // Context sets the context to be used in this call's Do method. Any
  1889. // pending HTTP request will be aborted if the provided context is
  1890. // canceled.
  1891. func (c *BucketAccessControlsInsertCall) Context(ctx context.Context) *BucketAccessControlsInsertCall {
  1892. c.ctx_ = ctx
  1893. return c
  1894. }
  1895. // Header returns an http.Header that can be modified by the caller to
  1896. // add HTTP headers to the request.
  1897. func (c *BucketAccessControlsInsertCall) Header() http.Header {
  1898. if c.header_ == nil {
  1899. c.header_ = make(http.Header)
  1900. }
  1901. return c.header_
  1902. }
  1903. func (c *BucketAccessControlsInsertCall) doRequest(alt string) (*http.Response, error) {
  1904. reqHeaders := make(http.Header)
  1905. for k, v := range c.header_ {
  1906. reqHeaders[k] = v
  1907. }
  1908. reqHeaders.Set("User-Agent", c.s.userAgent())
  1909. var body io.Reader = nil
  1910. body, err := googleapi.WithoutDataWrapper.JSONReader(c.bucketaccesscontrol)
  1911. if err != nil {
  1912. return nil, err
  1913. }
  1914. reqHeaders.Set("Content-Type", "application/json")
  1915. c.urlParams_.Set("alt", alt)
  1916. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/acl")
  1917. urls += "?" + c.urlParams_.Encode()
  1918. req, _ := http.NewRequest("POST", urls, body)
  1919. req.Header = reqHeaders
  1920. googleapi.Expand(req.URL, map[string]string{
  1921. "bucket": c.bucket,
  1922. })
  1923. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1924. }
  1925. // Do executes the "storage.bucketAccessControls.insert" call.
  1926. // Exactly one of *BucketAccessControl or error will be non-nil. Any
  1927. // non-2xx status code is an error. Response headers are in either
  1928. // *BucketAccessControl.ServerResponse.Header or (if a response was
  1929. // returned at all) in error.(*googleapi.Error).Header. Use
  1930. // googleapi.IsNotModified to check whether the returned error was
  1931. // because http.StatusNotModified was returned.
  1932. func (c *BucketAccessControlsInsertCall) Do(opts ...googleapi.CallOption) (*BucketAccessControl, error) {
  1933. gensupport.SetOptions(c.urlParams_, opts...)
  1934. res, err := c.doRequest("json")
  1935. if res != nil && res.StatusCode == http.StatusNotModified {
  1936. if res.Body != nil {
  1937. res.Body.Close()
  1938. }
  1939. return nil, &googleapi.Error{
  1940. Code: res.StatusCode,
  1941. Header: res.Header,
  1942. }
  1943. }
  1944. if err != nil {
  1945. return nil, err
  1946. }
  1947. defer googleapi.CloseBody(res)
  1948. if err := googleapi.CheckResponse(res); err != nil {
  1949. return nil, err
  1950. }
  1951. ret := &BucketAccessControl{
  1952. ServerResponse: googleapi.ServerResponse{
  1953. Header: res.Header,
  1954. HTTPStatusCode: res.StatusCode,
  1955. },
  1956. }
  1957. target := &ret
  1958. if err := gensupport.DecodeResponse(target, res); err != nil {
  1959. return nil, err
  1960. }
  1961. return ret, nil
  1962. // {
  1963. // "description": "Creates a new ACL entry on the specified bucket.",
  1964. // "httpMethod": "POST",
  1965. // "id": "storage.bucketAccessControls.insert",
  1966. // "parameterOrder": [
  1967. // "bucket"
  1968. // ],
  1969. // "parameters": {
  1970. // "bucket": {
  1971. // "description": "Name of a bucket.",
  1972. // "location": "path",
  1973. // "required": true,
  1974. // "type": "string"
  1975. // },
  1976. // "userProject": {
  1977. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  1978. // "location": "query",
  1979. // "type": "string"
  1980. // }
  1981. // },
  1982. // "path": "b/{bucket}/acl",
  1983. // "request": {
  1984. // "$ref": "BucketAccessControl"
  1985. // },
  1986. // "response": {
  1987. // "$ref": "BucketAccessControl"
  1988. // },
  1989. // "scopes": [
  1990. // "https://www.googleapis.com/auth/cloud-platform",
  1991. // "https://www.googleapis.com/auth/devstorage.full_control"
  1992. // ]
  1993. // }
  1994. }
  1995. // method id "storage.bucketAccessControls.list":
  1996. type BucketAccessControlsListCall struct {
  1997. s *Service
  1998. bucket string
  1999. urlParams_ gensupport.URLParams
  2000. ifNoneMatch_ string
  2001. ctx_ context.Context
  2002. header_ http.Header
  2003. }
  2004. // List: Retrieves ACL entries on the specified bucket.
  2005. func (r *BucketAccessControlsService) List(bucket string) *BucketAccessControlsListCall {
  2006. c := &BucketAccessControlsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2007. c.bucket = bucket
  2008. return c
  2009. }
  2010. // UserProject sets the optional parameter "userProject": The project to
  2011. // be billed for this request. Required for Requester Pays buckets.
  2012. func (c *BucketAccessControlsListCall) UserProject(userProject string) *BucketAccessControlsListCall {
  2013. c.urlParams_.Set("userProject", userProject)
  2014. return c
  2015. }
  2016. // Fields allows partial responses to be retrieved. See
  2017. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2018. // for more information.
  2019. func (c *BucketAccessControlsListCall) Fields(s ...googleapi.Field) *BucketAccessControlsListCall {
  2020. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2021. return c
  2022. }
  2023. // IfNoneMatch sets the optional parameter which makes the operation
  2024. // fail if the object's ETag matches the given value. This is useful for
  2025. // getting updates only after the object has changed since the last
  2026. // request. Use googleapi.IsNotModified to check whether the response
  2027. // error from Do is the result of In-None-Match.
  2028. func (c *BucketAccessControlsListCall) IfNoneMatch(entityTag string) *BucketAccessControlsListCall {
  2029. c.ifNoneMatch_ = entityTag
  2030. return c
  2031. }
  2032. // Context sets the context to be used in this call's Do method. Any
  2033. // pending HTTP request will be aborted if the provided context is
  2034. // canceled.
  2035. func (c *BucketAccessControlsListCall) Context(ctx context.Context) *BucketAccessControlsListCall {
  2036. c.ctx_ = ctx
  2037. return c
  2038. }
  2039. // Header returns an http.Header that can be modified by the caller to
  2040. // add HTTP headers to the request.
  2041. func (c *BucketAccessControlsListCall) Header() http.Header {
  2042. if c.header_ == nil {
  2043. c.header_ = make(http.Header)
  2044. }
  2045. return c.header_
  2046. }
  2047. func (c *BucketAccessControlsListCall) doRequest(alt string) (*http.Response, error) {
  2048. reqHeaders := make(http.Header)
  2049. for k, v := range c.header_ {
  2050. reqHeaders[k] = v
  2051. }
  2052. reqHeaders.Set("User-Agent", c.s.userAgent())
  2053. if c.ifNoneMatch_ != "" {
  2054. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2055. }
  2056. var body io.Reader = nil
  2057. c.urlParams_.Set("alt", alt)
  2058. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/acl")
  2059. urls += "?" + c.urlParams_.Encode()
  2060. req, _ := http.NewRequest("GET", urls, body)
  2061. req.Header = reqHeaders
  2062. googleapi.Expand(req.URL, map[string]string{
  2063. "bucket": c.bucket,
  2064. })
  2065. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2066. }
  2067. // Do executes the "storage.bucketAccessControls.list" call.
  2068. // Exactly one of *BucketAccessControls or error will be non-nil. Any
  2069. // non-2xx status code is an error. Response headers are in either
  2070. // *BucketAccessControls.ServerResponse.Header or (if a response was
  2071. // returned at all) in error.(*googleapi.Error).Header. Use
  2072. // googleapi.IsNotModified to check whether the returned error was
  2073. // because http.StatusNotModified was returned.
  2074. func (c *BucketAccessControlsListCall) Do(opts ...googleapi.CallOption) (*BucketAccessControls, error) {
  2075. gensupport.SetOptions(c.urlParams_, opts...)
  2076. res, err := c.doRequest("json")
  2077. if res != nil && res.StatusCode == http.StatusNotModified {
  2078. if res.Body != nil {
  2079. res.Body.Close()
  2080. }
  2081. return nil, &googleapi.Error{
  2082. Code: res.StatusCode,
  2083. Header: res.Header,
  2084. }
  2085. }
  2086. if err != nil {
  2087. return nil, err
  2088. }
  2089. defer googleapi.CloseBody(res)
  2090. if err := googleapi.CheckResponse(res); err != nil {
  2091. return nil, err
  2092. }
  2093. ret := &BucketAccessControls{
  2094. ServerResponse: googleapi.ServerResponse{
  2095. Header: res.Header,
  2096. HTTPStatusCode: res.StatusCode,
  2097. },
  2098. }
  2099. target := &ret
  2100. if err := gensupport.DecodeResponse(target, res); err != nil {
  2101. return nil, err
  2102. }
  2103. return ret, nil
  2104. // {
  2105. // "description": "Retrieves ACL entries on the specified bucket.",
  2106. // "httpMethod": "GET",
  2107. // "id": "storage.bucketAccessControls.list",
  2108. // "parameterOrder": [
  2109. // "bucket"
  2110. // ],
  2111. // "parameters": {
  2112. // "bucket": {
  2113. // "description": "Name of a bucket.",
  2114. // "location": "path",
  2115. // "required": true,
  2116. // "type": "string"
  2117. // },
  2118. // "userProject": {
  2119. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  2120. // "location": "query",
  2121. // "type": "string"
  2122. // }
  2123. // },
  2124. // "path": "b/{bucket}/acl",
  2125. // "response": {
  2126. // "$ref": "BucketAccessControls"
  2127. // },
  2128. // "scopes": [
  2129. // "https://www.googleapis.com/auth/cloud-platform",
  2130. // "https://www.googleapis.com/auth/devstorage.full_control"
  2131. // ]
  2132. // }
  2133. }
  2134. // method id "storage.bucketAccessControls.patch":
  2135. type BucketAccessControlsPatchCall struct {
  2136. s *Service
  2137. bucket string
  2138. entity string
  2139. bucketaccesscontrol *BucketAccessControl
  2140. urlParams_ gensupport.URLParams
  2141. ctx_ context.Context
  2142. header_ http.Header
  2143. }
  2144. // Patch: Updates an ACL entry on the specified bucket. This method
  2145. // supports patch semantics.
  2146. func (r *BucketAccessControlsService) Patch(bucket string, entity string, bucketaccesscontrol *BucketAccessControl) *BucketAccessControlsPatchCall {
  2147. c := &BucketAccessControlsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2148. c.bucket = bucket
  2149. c.entity = entity
  2150. c.bucketaccesscontrol = bucketaccesscontrol
  2151. return c
  2152. }
  2153. // UserProject sets the optional parameter "userProject": The project to
  2154. // be billed for this request. Required for Requester Pays buckets.
  2155. func (c *BucketAccessControlsPatchCall) UserProject(userProject string) *BucketAccessControlsPatchCall {
  2156. c.urlParams_.Set("userProject", userProject)
  2157. return c
  2158. }
  2159. // Fields allows partial responses to be retrieved. See
  2160. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2161. // for more information.
  2162. func (c *BucketAccessControlsPatchCall) Fields(s ...googleapi.Field) *BucketAccessControlsPatchCall {
  2163. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2164. return c
  2165. }
  2166. // Context sets the context to be used in this call's Do method. Any
  2167. // pending HTTP request will be aborted if the provided context is
  2168. // canceled.
  2169. func (c *BucketAccessControlsPatchCall) Context(ctx context.Context) *BucketAccessControlsPatchCall {
  2170. c.ctx_ = ctx
  2171. return c
  2172. }
  2173. // Header returns an http.Header that can be modified by the caller to
  2174. // add HTTP headers to the request.
  2175. func (c *BucketAccessControlsPatchCall) Header() http.Header {
  2176. if c.header_ == nil {
  2177. c.header_ = make(http.Header)
  2178. }
  2179. return c.header_
  2180. }
  2181. func (c *BucketAccessControlsPatchCall) doRequest(alt string) (*http.Response, error) {
  2182. reqHeaders := make(http.Header)
  2183. for k, v := range c.header_ {
  2184. reqHeaders[k] = v
  2185. }
  2186. reqHeaders.Set("User-Agent", c.s.userAgent())
  2187. var body io.Reader = nil
  2188. body, err := googleapi.WithoutDataWrapper.JSONReader(c.bucketaccesscontrol)
  2189. if err != nil {
  2190. return nil, err
  2191. }
  2192. reqHeaders.Set("Content-Type", "application/json")
  2193. c.urlParams_.Set("alt", alt)
  2194. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/acl/{entity}")
  2195. urls += "?" + c.urlParams_.Encode()
  2196. req, _ := http.NewRequest("PATCH", urls, body)
  2197. req.Header = reqHeaders
  2198. googleapi.Expand(req.URL, map[string]string{
  2199. "bucket": c.bucket,
  2200. "entity": c.entity,
  2201. })
  2202. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2203. }
  2204. // Do executes the "storage.bucketAccessControls.patch" call.
  2205. // Exactly one of *BucketAccessControl or error will be non-nil. Any
  2206. // non-2xx status code is an error. Response headers are in either
  2207. // *BucketAccessControl.ServerResponse.Header or (if a response was
  2208. // returned at all) in error.(*googleapi.Error).Header. Use
  2209. // googleapi.IsNotModified to check whether the returned error was
  2210. // because http.StatusNotModified was returned.
  2211. func (c *BucketAccessControlsPatchCall) Do(opts ...googleapi.CallOption) (*BucketAccessControl, error) {
  2212. gensupport.SetOptions(c.urlParams_, opts...)
  2213. res, err := c.doRequest("json")
  2214. if res != nil && res.StatusCode == http.StatusNotModified {
  2215. if res.Body != nil {
  2216. res.Body.Close()
  2217. }
  2218. return nil, &googleapi.Error{
  2219. Code: res.StatusCode,
  2220. Header: res.Header,
  2221. }
  2222. }
  2223. if err != nil {
  2224. return nil, err
  2225. }
  2226. defer googleapi.CloseBody(res)
  2227. if err := googleapi.CheckResponse(res); err != nil {
  2228. return nil, err
  2229. }
  2230. ret := &BucketAccessControl{
  2231. ServerResponse: googleapi.ServerResponse{
  2232. Header: res.Header,
  2233. HTTPStatusCode: res.StatusCode,
  2234. },
  2235. }
  2236. target := &ret
  2237. if err := gensupport.DecodeResponse(target, res); err != nil {
  2238. return nil, err
  2239. }
  2240. return ret, nil
  2241. // {
  2242. // "description": "Updates an ACL entry on the specified bucket. This method supports patch semantics.",
  2243. // "httpMethod": "PATCH",
  2244. // "id": "storage.bucketAccessControls.patch",
  2245. // "parameterOrder": [
  2246. // "bucket",
  2247. // "entity"
  2248. // ],
  2249. // "parameters": {
  2250. // "bucket": {
  2251. // "description": "Name of a bucket.",
  2252. // "location": "path",
  2253. // "required": true,
  2254. // "type": "string"
  2255. // },
  2256. // "entity": {
  2257. // "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.",
  2258. // "location": "path",
  2259. // "required": true,
  2260. // "type": "string"
  2261. // },
  2262. // "userProject": {
  2263. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  2264. // "location": "query",
  2265. // "type": "string"
  2266. // }
  2267. // },
  2268. // "path": "b/{bucket}/acl/{entity}",
  2269. // "request": {
  2270. // "$ref": "BucketAccessControl"
  2271. // },
  2272. // "response": {
  2273. // "$ref": "BucketAccessControl"
  2274. // },
  2275. // "scopes": [
  2276. // "https://www.googleapis.com/auth/cloud-platform",
  2277. // "https://www.googleapis.com/auth/devstorage.full_control"
  2278. // ]
  2279. // }
  2280. }
  2281. // method id "storage.bucketAccessControls.update":
  2282. type BucketAccessControlsUpdateCall struct {
  2283. s *Service
  2284. bucket string
  2285. entity string
  2286. bucketaccesscontrol *BucketAccessControl
  2287. urlParams_ gensupport.URLParams
  2288. ctx_ context.Context
  2289. header_ http.Header
  2290. }
  2291. // Update: Updates an ACL entry on the specified bucket.
  2292. func (r *BucketAccessControlsService) Update(bucket string, entity string, bucketaccesscontrol *BucketAccessControl) *BucketAccessControlsUpdateCall {
  2293. c := &BucketAccessControlsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2294. c.bucket = bucket
  2295. c.entity = entity
  2296. c.bucketaccesscontrol = bucketaccesscontrol
  2297. return c
  2298. }
  2299. // UserProject sets the optional parameter "userProject": The project to
  2300. // be billed for this request. Required for Requester Pays buckets.
  2301. func (c *BucketAccessControlsUpdateCall) UserProject(userProject string) *BucketAccessControlsUpdateCall {
  2302. c.urlParams_.Set("userProject", userProject)
  2303. return c
  2304. }
  2305. // Fields allows partial responses to be retrieved. See
  2306. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2307. // for more information.
  2308. func (c *BucketAccessControlsUpdateCall) Fields(s ...googleapi.Field) *BucketAccessControlsUpdateCall {
  2309. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2310. return c
  2311. }
  2312. // Context sets the context to be used in this call's Do method. Any
  2313. // pending HTTP request will be aborted if the provided context is
  2314. // canceled.
  2315. func (c *BucketAccessControlsUpdateCall) Context(ctx context.Context) *BucketAccessControlsUpdateCall {
  2316. c.ctx_ = ctx
  2317. return c
  2318. }
  2319. // Header returns an http.Header that can be modified by the caller to
  2320. // add HTTP headers to the request.
  2321. func (c *BucketAccessControlsUpdateCall) Header() http.Header {
  2322. if c.header_ == nil {
  2323. c.header_ = make(http.Header)
  2324. }
  2325. return c.header_
  2326. }
  2327. func (c *BucketAccessControlsUpdateCall) doRequest(alt string) (*http.Response, error) {
  2328. reqHeaders := make(http.Header)
  2329. for k, v := range c.header_ {
  2330. reqHeaders[k] = v
  2331. }
  2332. reqHeaders.Set("User-Agent", c.s.userAgent())
  2333. var body io.Reader = nil
  2334. body, err := googleapi.WithoutDataWrapper.JSONReader(c.bucketaccesscontrol)
  2335. if err != nil {
  2336. return nil, err
  2337. }
  2338. reqHeaders.Set("Content-Type", "application/json")
  2339. c.urlParams_.Set("alt", alt)
  2340. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/acl/{entity}")
  2341. urls += "?" + c.urlParams_.Encode()
  2342. req, _ := http.NewRequest("PUT", urls, body)
  2343. req.Header = reqHeaders
  2344. googleapi.Expand(req.URL, map[string]string{
  2345. "bucket": c.bucket,
  2346. "entity": c.entity,
  2347. })
  2348. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2349. }
  2350. // Do executes the "storage.bucketAccessControls.update" call.
  2351. // Exactly one of *BucketAccessControl or error will be non-nil. Any
  2352. // non-2xx status code is an error. Response headers are in either
  2353. // *BucketAccessControl.ServerResponse.Header or (if a response was
  2354. // returned at all) in error.(*googleapi.Error).Header. Use
  2355. // googleapi.IsNotModified to check whether the returned error was
  2356. // because http.StatusNotModified was returned.
  2357. func (c *BucketAccessControlsUpdateCall) Do(opts ...googleapi.CallOption) (*BucketAccessControl, error) {
  2358. gensupport.SetOptions(c.urlParams_, opts...)
  2359. res, err := c.doRequest("json")
  2360. if res != nil && res.StatusCode == http.StatusNotModified {
  2361. if res.Body != nil {
  2362. res.Body.Close()
  2363. }
  2364. return nil, &googleapi.Error{
  2365. Code: res.StatusCode,
  2366. Header: res.Header,
  2367. }
  2368. }
  2369. if err != nil {
  2370. return nil, err
  2371. }
  2372. defer googleapi.CloseBody(res)
  2373. if err := googleapi.CheckResponse(res); err != nil {
  2374. return nil, err
  2375. }
  2376. ret := &BucketAccessControl{
  2377. ServerResponse: googleapi.ServerResponse{
  2378. Header: res.Header,
  2379. HTTPStatusCode: res.StatusCode,
  2380. },
  2381. }
  2382. target := &ret
  2383. if err := gensupport.DecodeResponse(target, res); err != nil {
  2384. return nil, err
  2385. }
  2386. return ret, nil
  2387. // {
  2388. // "description": "Updates an ACL entry on the specified bucket.",
  2389. // "httpMethod": "PUT",
  2390. // "id": "storage.bucketAccessControls.update",
  2391. // "parameterOrder": [
  2392. // "bucket",
  2393. // "entity"
  2394. // ],
  2395. // "parameters": {
  2396. // "bucket": {
  2397. // "description": "Name of a bucket.",
  2398. // "location": "path",
  2399. // "required": true,
  2400. // "type": "string"
  2401. // },
  2402. // "entity": {
  2403. // "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.",
  2404. // "location": "path",
  2405. // "required": true,
  2406. // "type": "string"
  2407. // },
  2408. // "userProject": {
  2409. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  2410. // "location": "query",
  2411. // "type": "string"
  2412. // }
  2413. // },
  2414. // "path": "b/{bucket}/acl/{entity}",
  2415. // "request": {
  2416. // "$ref": "BucketAccessControl"
  2417. // },
  2418. // "response": {
  2419. // "$ref": "BucketAccessControl"
  2420. // },
  2421. // "scopes": [
  2422. // "https://www.googleapis.com/auth/cloud-platform",
  2423. // "https://www.googleapis.com/auth/devstorage.full_control"
  2424. // ]
  2425. // }
  2426. }
  2427. // method id "storage.buckets.delete":
  2428. type BucketsDeleteCall struct {
  2429. s *Service
  2430. bucket string
  2431. urlParams_ gensupport.URLParams
  2432. ctx_ context.Context
  2433. header_ http.Header
  2434. }
  2435. // Delete: Permanently deletes an empty bucket.
  2436. func (r *BucketsService) Delete(bucket string) *BucketsDeleteCall {
  2437. c := &BucketsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2438. c.bucket = bucket
  2439. return c
  2440. }
  2441. // IfMetagenerationMatch sets the optional parameter
  2442. // "ifMetagenerationMatch": If set, only deletes the bucket if its
  2443. // metageneration matches this value.
  2444. func (c *BucketsDeleteCall) IfMetagenerationMatch(ifMetagenerationMatch int64) *BucketsDeleteCall {
  2445. c.urlParams_.Set("ifMetagenerationMatch", fmt.Sprint(ifMetagenerationMatch))
  2446. return c
  2447. }
  2448. // IfMetagenerationNotMatch sets the optional parameter
  2449. // "ifMetagenerationNotMatch": If set, only deletes the bucket if its
  2450. // metageneration does not match this value.
  2451. func (c *BucketsDeleteCall) IfMetagenerationNotMatch(ifMetagenerationNotMatch int64) *BucketsDeleteCall {
  2452. c.urlParams_.Set("ifMetagenerationNotMatch", fmt.Sprint(ifMetagenerationNotMatch))
  2453. return c
  2454. }
  2455. // UserProject sets the optional parameter "userProject": The project to
  2456. // be billed for this request. Required for Requester Pays buckets.
  2457. func (c *BucketsDeleteCall) UserProject(userProject string) *BucketsDeleteCall {
  2458. c.urlParams_.Set("userProject", userProject)
  2459. return c
  2460. }
  2461. // Fields allows partial responses to be retrieved. See
  2462. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2463. // for more information.
  2464. func (c *BucketsDeleteCall) Fields(s ...googleapi.Field) *BucketsDeleteCall {
  2465. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2466. return c
  2467. }
  2468. // Context sets the context to be used in this call's Do method. Any
  2469. // pending HTTP request will be aborted if the provided context is
  2470. // canceled.
  2471. func (c *BucketsDeleteCall) Context(ctx context.Context) *BucketsDeleteCall {
  2472. c.ctx_ = ctx
  2473. return c
  2474. }
  2475. // Header returns an http.Header that can be modified by the caller to
  2476. // add HTTP headers to the request.
  2477. func (c *BucketsDeleteCall) Header() http.Header {
  2478. if c.header_ == nil {
  2479. c.header_ = make(http.Header)
  2480. }
  2481. return c.header_
  2482. }
  2483. func (c *BucketsDeleteCall) doRequest(alt string) (*http.Response, error) {
  2484. reqHeaders := make(http.Header)
  2485. for k, v := range c.header_ {
  2486. reqHeaders[k] = v
  2487. }
  2488. reqHeaders.Set("User-Agent", c.s.userAgent())
  2489. var body io.Reader = nil
  2490. c.urlParams_.Set("alt", alt)
  2491. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}")
  2492. urls += "?" + c.urlParams_.Encode()
  2493. req, _ := http.NewRequest("DELETE", urls, body)
  2494. req.Header = reqHeaders
  2495. googleapi.Expand(req.URL, map[string]string{
  2496. "bucket": c.bucket,
  2497. })
  2498. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2499. }
  2500. // Do executes the "storage.buckets.delete" call.
  2501. func (c *BucketsDeleteCall) Do(opts ...googleapi.CallOption) error {
  2502. gensupport.SetOptions(c.urlParams_, opts...)
  2503. res, err := c.doRequest("json")
  2504. if err != nil {
  2505. return err
  2506. }
  2507. defer googleapi.CloseBody(res)
  2508. if err := googleapi.CheckResponse(res); err != nil {
  2509. return err
  2510. }
  2511. return nil
  2512. // {
  2513. // "description": "Permanently deletes an empty bucket.",
  2514. // "httpMethod": "DELETE",
  2515. // "id": "storage.buckets.delete",
  2516. // "parameterOrder": [
  2517. // "bucket"
  2518. // ],
  2519. // "parameters": {
  2520. // "bucket": {
  2521. // "description": "Name of a bucket.",
  2522. // "location": "path",
  2523. // "required": true,
  2524. // "type": "string"
  2525. // },
  2526. // "ifMetagenerationMatch": {
  2527. // "description": "If set, only deletes the bucket if its metageneration matches this value.",
  2528. // "format": "int64",
  2529. // "location": "query",
  2530. // "type": "string"
  2531. // },
  2532. // "ifMetagenerationNotMatch": {
  2533. // "description": "If set, only deletes the bucket if its metageneration does not match this value.",
  2534. // "format": "int64",
  2535. // "location": "query",
  2536. // "type": "string"
  2537. // },
  2538. // "userProject": {
  2539. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  2540. // "location": "query",
  2541. // "type": "string"
  2542. // }
  2543. // },
  2544. // "path": "b/{bucket}",
  2545. // "scopes": [
  2546. // "https://www.googleapis.com/auth/cloud-platform",
  2547. // "https://www.googleapis.com/auth/devstorage.full_control",
  2548. // "https://www.googleapis.com/auth/devstorage.read_write"
  2549. // ]
  2550. // }
  2551. }
  2552. // method id "storage.buckets.get":
  2553. type BucketsGetCall struct {
  2554. s *Service
  2555. bucket string
  2556. urlParams_ gensupport.URLParams
  2557. ifNoneMatch_ string
  2558. ctx_ context.Context
  2559. header_ http.Header
  2560. }
  2561. // Get: Returns metadata for the specified bucket.
  2562. func (r *BucketsService) Get(bucket string) *BucketsGetCall {
  2563. c := &BucketsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2564. c.bucket = bucket
  2565. return c
  2566. }
  2567. // IfMetagenerationMatch sets the optional parameter
  2568. // "ifMetagenerationMatch": Makes the return of the bucket metadata
  2569. // conditional on whether the bucket's current metageneration matches
  2570. // the given value.
  2571. func (c *BucketsGetCall) IfMetagenerationMatch(ifMetagenerationMatch int64) *BucketsGetCall {
  2572. c.urlParams_.Set("ifMetagenerationMatch", fmt.Sprint(ifMetagenerationMatch))
  2573. return c
  2574. }
  2575. // IfMetagenerationNotMatch sets the optional parameter
  2576. // "ifMetagenerationNotMatch": Makes the return of the bucket metadata
  2577. // conditional on whether the bucket's current metageneration does not
  2578. // match the given value.
  2579. func (c *BucketsGetCall) IfMetagenerationNotMatch(ifMetagenerationNotMatch int64) *BucketsGetCall {
  2580. c.urlParams_.Set("ifMetagenerationNotMatch", fmt.Sprint(ifMetagenerationNotMatch))
  2581. return c
  2582. }
  2583. // Projection sets the optional parameter "projection": Set of
  2584. // properties to return. Defaults to noAcl.
  2585. //
  2586. // Possible values:
  2587. // "full" - Include all properties.
  2588. // "noAcl" - Omit owner, acl and defaultObjectAcl properties.
  2589. func (c *BucketsGetCall) Projection(projection string) *BucketsGetCall {
  2590. c.urlParams_.Set("projection", projection)
  2591. return c
  2592. }
  2593. // UserProject sets the optional parameter "userProject": The project to
  2594. // be billed for this request. Required for Requester Pays buckets.
  2595. func (c *BucketsGetCall) UserProject(userProject string) *BucketsGetCall {
  2596. c.urlParams_.Set("userProject", userProject)
  2597. return c
  2598. }
  2599. // Fields allows partial responses to be retrieved. See
  2600. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2601. // for more information.
  2602. func (c *BucketsGetCall) Fields(s ...googleapi.Field) *BucketsGetCall {
  2603. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2604. return c
  2605. }
  2606. // IfNoneMatch sets the optional parameter which makes the operation
  2607. // fail if the object's ETag matches the given value. This is useful for
  2608. // getting updates only after the object has changed since the last
  2609. // request. Use googleapi.IsNotModified to check whether the response
  2610. // error from Do is the result of In-None-Match.
  2611. func (c *BucketsGetCall) IfNoneMatch(entityTag string) *BucketsGetCall {
  2612. c.ifNoneMatch_ = entityTag
  2613. return c
  2614. }
  2615. // Context sets the context to be used in this call's Do method. Any
  2616. // pending HTTP request will be aborted if the provided context is
  2617. // canceled.
  2618. func (c *BucketsGetCall) Context(ctx context.Context) *BucketsGetCall {
  2619. c.ctx_ = ctx
  2620. return c
  2621. }
  2622. // Header returns an http.Header that can be modified by the caller to
  2623. // add HTTP headers to the request.
  2624. func (c *BucketsGetCall) Header() http.Header {
  2625. if c.header_ == nil {
  2626. c.header_ = make(http.Header)
  2627. }
  2628. return c.header_
  2629. }
  2630. func (c *BucketsGetCall) doRequest(alt string) (*http.Response, error) {
  2631. reqHeaders := make(http.Header)
  2632. for k, v := range c.header_ {
  2633. reqHeaders[k] = v
  2634. }
  2635. reqHeaders.Set("User-Agent", c.s.userAgent())
  2636. if c.ifNoneMatch_ != "" {
  2637. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2638. }
  2639. var body io.Reader = nil
  2640. c.urlParams_.Set("alt", alt)
  2641. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}")
  2642. urls += "?" + c.urlParams_.Encode()
  2643. req, _ := http.NewRequest("GET", urls, body)
  2644. req.Header = reqHeaders
  2645. googleapi.Expand(req.URL, map[string]string{
  2646. "bucket": c.bucket,
  2647. })
  2648. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2649. }
  2650. // Do executes the "storage.buckets.get" call.
  2651. // Exactly one of *Bucket or error will be non-nil. Any non-2xx status
  2652. // code is an error. Response headers are in either
  2653. // *Bucket.ServerResponse.Header or (if a response was returned at all)
  2654. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2655. // check whether the returned error was because http.StatusNotModified
  2656. // was returned.
  2657. func (c *BucketsGetCall) Do(opts ...googleapi.CallOption) (*Bucket, error) {
  2658. gensupport.SetOptions(c.urlParams_, opts...)
  2659. res, err := c.doRequest("json")
  2660. if res != nil && res.StatusCode == http.StatusNotModified {
  2661. if res.Body != nil {
  2662. res.Body.Close()
  2663. }
  2664. return nil, &googleapi.Error{
  2665. Code: res.StatusCode,
  2666. Header: res.Header,
  2667. }
  2668. }
  2669. if err != nil {
  2670. return nil, err
  2671. }
  2672. defer googleapi.CloseBody(res)
  2673. if err := googleapi.CheckResponse(res); err != nil {
  2674. return nil, err
  2675. }
  2676. ret := &Bucket{
  2677. ServerResponse: googleapi.ServerResponse{
  2678. Header: res.Header,
  2679. HTTPStatusCode: res.StatusCode,
  2680. },
  2681. }
  2682. target := &ret
  2683. if err := gensupport.DecodeResponse(target, res); err != nil {
  2684. return nil, err
  2685. }
  2686. return ret, nil
  2687. // {
  2688. // "description": "Returns metadata for the specified bucket.",
  2689. // "httpMethod": "GET",
  2690. // "id": "storage.buckets.get",
  2691. // "parameterOrder": [
  2692. // "bucket"
  2693. // ],
  2694. // "parameters": {
  2695. // "bucket": {
  2696. // "description": "Name of a bucket.",
  2697. // "location": "path",
  2698. // "required": true,
  2699. // "type": "string"
  2700. // },
  2701. // "ifMetagenerationMatch": {
  2702. // "description": "Makes the return of the bucket metadata conditional on whether the bucket's current metageneration matches the given value.",
  2703. // "format": "int64",
  2704. // "location": "query",
  2705. // "type": "string"
  2706. // },
  2707. // "ifMetagenerationNotMatch": {
  2708. // "description": "Makes the return of the bucket metadata conditional on whether the bucket's current metageneration does not match the given value.",
  2709. // "format": "int64",
  2710. // "location": "query",
  2711. // "type": "string"
  2712. // },
  2713. // "projection": {
  2714. // "description": "Set of properties to return. Defaults to noAcl.",
  2715. // "enum": [
  2716. // "full",
  2717. // "noAcl"
  2718. // ],
  2719. // "enumDescriptions": [
  2720. // "Include all properties.",
  2721. // "Omit owner, acl and defaultObjectAcl properties."
  2722. // ],
  2723. // "location": "query",
  2724. // "type": "string"
  2725. // },
  2726. // "userProject": {
  2727. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  2728. // "location": "query",
  2729. // "type": "string"
  2730. // }
  2731. // },
  2732. // "path": "b/{bucket}",
  2733. // "response": {
  2734. // "$ref": "Bucket"
  2735. // },
  2736. // "scopes": [
  2737. // "https://www.googleapis.com/auth/cloud-platform",
  2738. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  2739. // "https://www.googleapis.com/auth/devstorage.full_control",
  2740. // "https://www.googleapis.com/auth/devstorage.read_only",
  2741. // "https://www.googleapis.com/auth/devstorage.read_write"
  2742. // ]
  2743. // }
  2744. }
  2745. // method id "storage.buckets.getIamPolicy":
  2746. type BucketsGetIamPolicyCall struct {
  2747. s *Service
  2748. bucket string
  2749. urlParams_ gensupport.URLParams
  2750. ifNoneMatch_ string
  2751. ctx_ context.Context
  2752. header_ http.Header
  2753. }
  2754. // GetIamPolicy: Returns an IAM policy for the specified bucket.
  2755. func (r *BucketsService) GetIamPolicy(bucket string) *BucketsGetIamPolicyCall {
  2756. c := &BucketsGetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2757. c.bucket = bucket
  2758. return c
  2759. }
  2760. // UserProject sets the optional parameter "userProject": The project to
  2761. // be billed for this request. Required for Requester Pays buckets.
  2762. func (c *BucketsGetIamPolicyCall) UserProject(userProject string) *BucketsGetIamPolicyCall {
  2763. c.urlParams_.Set("userProject", userProject)
  2764. return c
  2765. }
  2766. // Fields allows partial responses to be retrieved. See
  2767. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2768. // for more information.
  2769. func (c *BucketsGetIamPolicyCall) Fields(s ...googleapi.Field) *BucketsGetIamPolicyCall {
  2770. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2771. return c
  2772. }
  2773. // IfNoneMatch sets the optional parameter which makes the operation
  2774. // fail if the object's ETag matches the given value. This is useful for
  2775. // getting updates only after the object has changed since the last
  2776. // request. Use googleapi.IsNotModified to check whether the response
  2777. // error from Do is the result of In-None-Match.
  2778. func (c *BucketsGetIamPolicyCall) IfNoneMatch(entityTag string) *BucketsGetIamPolicyCall {
  2779. c.ifNoneMatch_ = entityTag
  2780. return c
  2781. }
  2782. // Context sets the context to be used in this call's Do method. Any
  2783. // pending HTTP request will be aborted if the provided context is
  2784. // canceled.
  2785. func (c *BucketsGetIamPolicyCall) Context(ctx context.Context) *BucketsGetIamPolicyCall {
  2786. c.ctx_ = ctx
  2787. return c
  2788. }
  2789. // Header returns an http.Header that can be modified by the caller to
  2790. // add HTTP headers to the request.
  2791. func (c *BucketsGetIamPolicyCall) Header() http.Header {
  2792. if c.header_ == nil {
  2793. c.header_ = make(http.Header)
  2794. }
  2795. return c.header_
  2796. }
  2797. func (c *BucketsGetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
  2798. reqHeaders := make(http.Header)
  2799. for k, v := range c.header_ {
  2800. reqHeaders[k] = v
  2801. }
  2802. reqHeaders.Set("User-Agent", c.s.userAgent())
  2803. if c.ifNoneMatch_ != "" {
  2804. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2805. }
  2806. var body io.Reader = nil
  2807. c.urlParams_.Set("alt", alt)
  2808. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/iam")
  2809. urls += "?" + c.urlParams_.Encode()
  2810. req, _ := http.NewRequest("GET", urls, body)
  2811. req.Header = reqHeaders
  2812. googleapi.Expand(req.URL, map[string]string{
  2813. "bucket": c.bucket,
  2814. })
  2815. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2816. }
  2817. // Do executes the "storage.buckets.getIamPolicy" call.
  2818. // Exactly one of *Policy or error will be non-nil. Any non-2xx status
  2819. // code is an error. Response headers are in either
  2820. // *Policy.ServerResponse.Header or (if a response was returned at all)
  2821. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2822. // check whether the returned error was because http.StatusNotModified
  2823. // was returned.
  2824. func (c *BucketsGetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) {
  2825. gensupport.SetOptions(c.urlParams_, opts...)
  2826. res, err := c.doRequest("json")
  2827. if res != nil && res.StatusCode == http.StatusNotModified {
  2828. if res.Body != nil {
  2829. res.Body.Close()
  2830. }
  2831. return nil, &googleapi.Error{
  2832. Code: res.StatusCode,
  2833. Header: res.Header,
  2834. }
  2835. }
  2836. if err != nil {
  2837. return nil, err
  2838. }
  2839. defer googleapi.CloseBody(res)
  2840. if err := googleapi.CheckResponse(res); err != nil {
  2841. return nil, err
  2842. }
  2843. ret := &Policy{
  2844. ServerResponse: googleapi.ServerResponse{
  2845. Header: res.Header,
  2846. HTTPStatusCode: res.StatusCode,
  2847. },
  2848. }
  2849. target := &ret
  2850. if err := gensupport.DecodeResponse(target, res); err != nil {
  2851. return nil, err
  2852. }
  2853. return ret, nil
  2854. // {
  2855. // "description": "Returns an IAM policy for the specified bucket.",
  2856. // "httpMethod": "GET",
  2857. // "id": "storage.buckets.getIamPolicy",
  2858. // "parameterOrder": [
  2859. // "bucket"
  2860. // ],
  2861. // "parameters": {
  2862. // "bucket": {
  2863. // "description": "Name of a bucket.",
  2864. // "location": "path",
  2865. // "required": true,
  2866. // "type": "string"
  2867. // },
  2868. // "userProject": {
  2869. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  2870. // "location": "query",
  2871. // "type": "string"
  2872. // }
  2873. // },
  2874. // "path": "b/{bucket}/iam",
  2875. // "response": {
  2876. // "$ref": "Policy"
  2877. // },
  2878. // "scopes": [
  2879. // "https://www.googleapis.com/auth/cloud-platform",
  2880. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  2881. // "https://www.googleapis.com/auth/devstorage.full_control",
  2882. // "https://www.googleapis.com/auth/devstorage.read_only",
  2883. // "https://www.googleapis.com/auth/devstorage.read_write"
  2884. // ]
  2885. // }
  2886. }
  2887. // method id "storage.buckets.insert":
  2888. type BucketsInsertCall struct {
  2889. s *Service
  2890. bucket *Bucket
  2891. urlParams_ gensupport.URLParams
  2892. ctx_ context.Context
  2893. header_ http.Header
  2894. }
  2895. // Insert: Creates a new bucket.
  2896. func (r *BucketsService) Insert(projectid string, bucket *Bucket) *BucketsInsertCall {
  2897. c := &BucketsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2898. c.urlParams_.Set("project", projectid)
  2899. c.bucket = bucket
  2900. return c
  2901. }
  2902. // PredefinedAcl sets the optional parameter "predefinedAcl": Apply a
  2903. // predefined set of access controls to this bucket.
  2904. //
  2905. // Possible values:
  2906. // "authenticatedRead" - Project team owners get OWNER access, and
  2907. // allAuthenticatedUsers get READER access.
  2908. // "private" - Project team owners get OWNER access.
  2909. // "projectPrivate" - Project team members get access according to
  2910. // their roles.
  2911. // "publicRead" - Project team owners get OWNER access, and allUsers
  2912. // get READER access.
  2913. // "publicReadWrite" - Project team owners get OWNER access, and
  2914. // allUsers get WRITER access.
  2915. func (c *BucketsInsertCall) PredefinedAcl(predefinedAcl string) *BucketsInsertCall {
  2916. c.urlParams_.Set("predefinedAcl", predefinedAcl)
  2917. return c
  2918. }
  2919. // PredefinedDefaultObjectAcl sets the optional parameter
  2920. // "predefinedDefaultObjectAcl": Apply a predefined set of default
  2921. // object access controls to this bucket.
  2922. //
  2923. // Possible values:
  2924. // "authenticatedRead" - Object owner gets OWNER access, and
  2925. // allAuthenticatedUsers get READER access.
  2926. // "bucketOwnerFullControl" - Object owner gets OWNER access, and
  2927. // project team owners get OWNER access.
  2928. // "bucketOwnerRead" - Object owner gets OWNER access, and project
  2929. // team owners get READER access.
  2930. // "private" - Object owner gets OWNER access.
  2931. // "projectPrivate" - Object owner gets OWNER access, and project team
  2932. // members get access according to their roles.
  2933. // "publicRead" - Object owner gets OWNER access, and allUsers get
  2934. // READER access.
  2935. func (c *BucketsInsertCall) PredefinedDefaultObjectAcl(predefinedDefaultObjectAcl string) *BucketsInsertCall {
  2936. c.urlParams_.Set("predefinedDefaultObjectAcl", predefinedDefaultObjectAcl)
  2937. return c
  2938. }
  2939. // Projection sets the optional parameter "projection": Set of
  2940. // properties to return. Defaults to noAcl, unless the bucket resource
  2941. // specifies acl or defaultObjectAcl properties, when it defaults to
  2942. // full.
  2943. //
  2944. // Possible values:
  2945. // "full" - Include all properties.
  2946. // "noAcl" - Omit owner, acl and defaultObjectAcl properties.
  2947. func (c *BucketsInsertCall) Projection(projection string) *BucketsInsertCall {
  2948. c.urlParams_.Set("projection", projection)
  2949. return c
  2950. }
  2951. // UserProject sets the optional parameter "userProject": The project to
  2952. // be billed for this request.
  2953. func (c *BucketsInsertCall) UserProject(userProject string) *BucketsInsertCall {
  2954. c.urlParams_.Set("userProject", userProject)
  2955. return c
  2956. }
  2957. // Fields allows partial responses to be retrieved. See
  2958. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2959. // for more information.
  2960. func (c *BucketsInsertCall) Fields(s ...googleapi.Field) *BucketsInsertCall {
  2961. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2962. return c
  2963. }
  2964. // Context sets the context to be used in this call's Do method. Any
  2965. // pending HTTP request will be aborted if the provided context is
  2966. // canceled.
  2967. func (c *BucketsInsertCall) Context(ctx context.Context) *BucketsInsertCall {
  2968. c.ctx_ = ctx
  2969. return c
  2970. }
  2971. // Header returns an http.Header that can be modified by the caller to
  2972. // add HTTP headers to the request.
  2973. func (c *BucketsInsertCall) Header() http.Header {
  2974. if c.header_ == nil {
  2975. c.header_ = make(http.Header)
  2976. }
  2977. return c.header_
  2978. }
  2979. func (c *BucketsInsertCall) doRequest(alt string) (*http.Response, error) {
  2980. reqHeaders := make(http.Header)
  2981. for k, v := range c.header_ {
  2982. reqHeaders[k] = v
  2983. }
  2984. reqHeaders.Set("User-Agent", c.s.userAgent())
  2985. var body io.Reader = nil
  2986. body, err := googleapi.WithoutDataWrapper.JSONReader(c.bucket)
  2987. if err != nil {
  2988. return nil, err
  2989. }
  2990. reqHeaders.Set("Content-Type", "application/json")
  2991. c.urlParams_.Set("alt", alt)
  2992. urls := googleapi.ResolveRelative(c.s.BasePath, "b")
  2993. urls += "?" + c.urlParams_.Encode()
  2994. req, _ := http.NewRequest("POST", urls, body)
  2995. req.Header = reqHeaders
  2996. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2997. }
  2998. // Do executes the "storage.buckets.insert" call.
  2999. // Exactly one of *Bucket or error will be non-nil. Any non-2xx status
  3000. // code is an error. Response headers are in either
  3001. // *Bucket.ServerResponse.Header or (if a response was returned at all)
  3002. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3003. // check whether the returned error was because http.StatusNotModified
  3004. // was returned.
  3005. func (c *BucketsInsertCall) Do(opts ...googleapi.CallOption) (*Bucket, error) {
  3006. gensupport.SetOptions(c.urlParams_, opts...)
  3007. res, err := c.doRequest("json")
  3008. if res != nil && res.StatusCode == http.StatusNotModified {
  3009. if res.Body != nil {
  3010. res.Body.Close()
  3011. }
  3012. return nil, &googleapi.Error{
  3013. Code: res.StatusCode,
  3014. Header: res.Header,
  3015. }
  3016. }
  3017. if err != nil {
  3018. return nil, err
  3019. }
  3020. defer googleapi.CloseBody(res)
  3021. if err := googleapi.CheckResponse(res); err != nil {
  3022. return nil, err
  3023. }
  3024. ret := &Bucket{
  3025. ServerResponse: googleapi.ServerResponse{
  3026. Header: res.Header,
  3027. HTTPStatusCode: res.StatusCode,
  3028. },
  3029. }
  3030. target := &ret
  3031. if err := gensupport.DecodeResponse(target, res); err != nil {
  3032. return nil, err
  3033. }
  3034. return ret, nil
  3035. // {
  3036. // "description": "Creates a new bucket.",
  3037. // "httpMethod": "POST",
  3038. // "id": "storage.buckets.insert",
  3039. // "parameterOrder": [
  3040. // "project"
  3041. // ],
  3042. // "parameters": {
  3043. // "predefinedAcl": {
  3044. // "description": "Apply a predefined set of access controls to this bucket.",
  3045. // "enum": [
  3046. // "authenticatedRead",
  3047. // "private",
  3048. // "projectPrivate",
  3049. // "publicRead",
  3050. // "publicReadWrite"
  3051. // ],
  3052. // "enumDescriptions": [
  3053. // "Project team owners get OWNER access, and allAuthenticatedUsers get READER access.",
  3054. // "Project team owners get OWNER access.",
  3055. // "Project team members get access according to their roles.",
  3056. // "Project team owners get OWNER access, and allUsers get READER access.",
  3057. // "Project team owners get OWNER access, and allUsers get WRITER access."
  3058. // ],
  3059. // "location": "query",
  3060. // "type": "string"
  3061. // },
  3062. // "predefinedDefaultObjectAcl": {
  3063. // "description": "Apply a predefined set of default object access controls to this bucket.",
  3064. // "enum": [
  3065. // "authenticatedRead",
  3066. // "bucketOwnerFullControl",
  3067. // "bucketOwnerRead",
  3068. // "private",
  3069. // "projectPrivate",
  3070. // "publicRead"
  3071. // ],
  3072. // "enumDescriptions": [
  3073. // "Object owner gets OWNER access, and allAuthenticatedUsers get READER access.",
  3074. // "Object owner gets OWNER access, and project team owners get OWNER access.",
  3075. // "Object owner gets OWNER access, and project team owners get READER access.",
  3076. // "Object owner gets OWNER access.",
  3077. // "Object owner gets OWNER access, and project team members get access according to their roles.",
  3078. // "Object owner gets OWNER access, and allUsers get READER access."
  3079. // ],
  3080. // "location": "query",
  3081. // "type": "string"
  3082. // },
  3083. // "project": {
  3084. // "description": "A valid API project identifier.",
  3085. // "location": "query",
  3086. // "required": true,
  3087. // "type": "string"
  3088. // },
  3089. // "projection": {
  3090. // "description": "Set of properties to return. Defaults to noAcl, unless the bucket resource specifies acl or defaultObjectAcl properties, when it defaults to full.",
  3091. // "enum": [
  3092. // "full",
  3093. // "noAcl"
  3094. // ],
  3095. // "enumDescriptions": [
  3096. // "Include all properties.",
  3097. // "Omit owner, acl and defaultObjectAcl properties."
  3098. // ],
  3099. // "location": "query",
  3100. // "type": "string"
  3101. // },
  3102. // "userProject": {
  3103. // "description": "The project to be billed for this request.",
  3104. // "location": "query",
  3105. // "type": "string"
  3106. // }
  3107. // },
  3108. // "path": "b",
  3109. // "request": {
  3110. // "$ref": "Bucket"
  3111. // },
  3112. // "response": {
  3113. // "$ref": "Bucket"
  3114. // },
  3115. // "scopes": [
  3116. // "https://www.googleapis.com/auth/cloud-platform",
  3117. // "https://www.googleapis.com/auth/devstorage.full_control",
  3118. // "https://www.googleapis.com/auth/devstorage.read_write"
  3119. // ]
  3120. // }
  3121. }
  3122. // method id "storage.buckets.list":
  3123. type BucketsListCall struct {
  3124. s *Service
  3125. urlParams_ gensupport.URLParams
  3126. ifNoneMatch_ string
  3127. ctx_ context.Context
  3128. header_ http.Header
  3129. }
  3130. // List: Retrieves a list of buckets for a given project.
  3131. func (r *BucketsService) List(projectid string) *BucketsListCall {
  3132. c := &BucketsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3133. c.urlParams_.Set("project", projectid)
  3134. return c
  3135. }
  3136. // MaxResults sets the optional parameter "maxResults": Maximum number
  3137. // of buckets to return in a single response. The service will use this
  3138. // parameter or 1,000 items, whichever is smaller.
  3139. func (c *BucketsListCall) MaxResults(maxResults int64) *BucketsListCall {
  3140. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  3141. return c
  3142. }
  3143. // PageToken sets the optional parameter "pageToken": A
  3144. // previously-returned page token representing part of the larger set of
  3145. // results to view.
  3146. func (c *BucketsListCall) PageToken(pageToken string) *BucketsListCall {
  3147. c.urlParams_.Set("pageToken", pageToken)
  3148. return c
  3149. }
  3150. // Prefix sets the optional parameter "prefix": Filter results to
  3151. // buckets whose names begin with this prefix.
  3152. func (c *BucketsListCall) Prefix(prefix string) *BucketsListCall {
  3153. c.urlParams_.Set("prefix", prefix)
  3154. return c
  3155. }
  3156. // Projection sets the optional parameter "projection": Set of
  3157. // properties to return. Defaults to noAcl.
  3158. //
  3159. // Possible values:
  3160. // "full" - Include all properties.
  3161. // "noAcl" - Omit owner, acl and defaultObjectAcl properties.
  3162. func (c *BucketsListCall) Projection(projection string) *BucketsListCall {
  3163. c.urlParams_.Set("projection", projection)
  3164. return c
  3165. }
  3166. // UserProject sets the optional parameter "userProject": The project to
  3167. // be billed for this request.
  3168. func (c *BucketsListCall) UserProject(userProject string) *BucketsListCall {
  3169. c.urlParams_.Set("userProject", userProject)
  3170. return c
  3171. }
  3172. // Fields allows partial responses to be retrieved. See
  3173. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3174. // for more information.
  3175. func (c *BucketsListCall) Fields(s ...googleapi.Field) *BucketsListCall {
  3176. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3177. return c
  3178. }
  3179. // IfNoneMatch sets the optional parameter which makes the operation
  3180. // fail if the object's ETag matches the given value. This is useful for
  3181. // getting updates only after the object has changed since the last
  3182. // request. Use googleapi.IsNotModified to check whether the response
  3183. // error from Do is the result of In-None-Match.
  3184. func (c *BucketsListCall) IfNoneMatch(entityTag string) *BucketsListCall {
  3185. c.ifNoneMatch_ = entityTag
  3186. return c
  3187. }
  3188. // Context sets the context to be used in this call's Do method. Any
  3189. // pending HTTP request will be aborted if the provided context is
  3190. // canceled.
  3191. func (c *BucketsListCall) Context(ctx context.Context) *BucketsListCall {
  3192. c.ctx_ = ctx
  3193. return c
  3194. }
  3195. // Header returns an http.Header that can be modified by the caller to
  3196. // add HTTP headers to the request.
  3197. func (c *BucketsListCall) Header() http.Header {
  3198. if c.header_ == nil {
  3199. c.header_ = make(http.Header)
  3200. }
  3201. return c.header_
  3202. }
  3203. func (c *BucketsListCall) doRequest(alt string) (*http.Response, error) {
  3204. reqHeaders := make(http.Header)
  3205. for k, v := range c.header_ {
  3206. reqHeaders[k] = v
  3207. }
  3208. reqHeaders.Set("User-Agent", c.s.userAgent())
  3209. if c.ifNoneMatch_ != "" {
  3210. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3211. }
  3212. var body io.Reader = nil
  3213. c.urlParams_.Set("alt", alt)
  3214. urls := googleapi.ResolveRelative(c.s.BasePath, "b")
  3215. urls += "?" + c.urlParams_.Encode()
  3216. req, _ := http.NewRequest("GET", urls, body)
  3217. req.Header = reqHeaders
  3218. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3219. }
  3220. // Do executes the "storage.buckets.list" call.
  3221. // Exactly one of *Buckets or error will be non-nil. Any non-2xx status
  3222. // code is an error. Response headers are in either
  3223. // *Buckets.ServerResponse.Header or (if a response was returned at all)
  3224. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3225. // check whether the returned error was because http.StatusNotModified
  3226. // was returned.
  3227. func (c *BucketsListCall) Do(opts ...googleapi.CallOption) (*Buckets, error) {
  3228. gensupport.SetOptions(c.urlParams_, opts...)
  3229. res, err := c.doRequest("json")
  3230. if res != nil && res.StatusCode == http.StatusNotModified {
  3231. if res.Body != nil {
  3232. res.Body.Close()
  3233. }
  3234. return nil, &googleapi.Error{
  3235. Code: res.StatusCode,
  3236. Header: res.Header,
  3237. }
  3238. }
  3239. if err != nil {
  3240. return nil, err
  3241. }
  3242. defer googleapi.CloseBody(res)
  3243. if err := googleapi.CheckResponse(res); err != nil {
  3244. return nil, err
  3245. }
  3246. ret := &Buckets{
  3247. ServerResponse: googleapi.ServerResponse{
  3248. Header: res.Header,
  3249. HTTPStatusCode: res.StatusCode,
  3250. },
  3251. }
  3252. target := &ret
  3253. if err := gensupport.DecodeResponse(target, res); err != nil {
  3254. return nil, err
  3255. }
  3256. return ret, nil
  3257. // {
  3258. // "description": "Retrieves a list of buckets for a given project.",
  3259. // "httpMethod": "GET",
  3260. // "id": "storage.buckets.list",
  3261. // "parameterOrder": [
  3262. // "project"
  3263. // ],
  3264. // "parameters": {
  3265. // "maxResults": {
  3266. // "default": "1000",
  3267. // "description": "Maximum number of buckets to return in a single response. The service will use this parameter or 1,000 items, whichever is smaller.",
  3268. // "format": "uint32",
  3269. // "location": "query",
  3270. // "minimum": "0",
  3271. // "type": "integer"
  3272. // },
  3273. // "pageToken": {
  3274. // "description": "A previously-returned page token representing part of the larger set of results to view.",
  3275. // "location": "query",
  3276. // "type": "string"
  3277. // },
  3278. // "prefix": {
  3279. // "description": "Filter results to buckets whose names begin with this prefix.",
  3280. // "location": "query",
  3281. // "type": "string"
  3282. // },
  3283. // "project": {
  3284. // "description": "A valid API project identifier.",
  3285. // "location": "query",
  3286. // "required": true,
  3287. // "type": "string"
  3288. // },
  3289. // "projection": {
  3290. // "description": "Set of properties to return. Defaults to noAcl.",
  3291. // "enum": [
  3292. // "full",
  3293. // "noAcl"
  3294. // ],
  3295. // "enumDescriptions": [
  3296. // "Include all properties.",
  3297. // "Omit owner, acl and defaultObjectAcl properties."
  3298. // ],
  3299. // "location": "query",
  3300. // "type": "string"
  3301. // },
  3302. // "userProject": {
  3303. // "description": "The project to be billed for this request.",
  3304. // "location": "query",
  3305. // "type": "string"
  3306. // }
  3307. // },
  3308. // "path": "b",
  3309. // "response": {
  3310. // "$ref": "Buckets"
  3311. // },
  3312. // "scopes": [
  3313. // "https://www.googleapis.com/auth/cloud-platform",
  3314. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  3315. // "https://www.googleapis.com/auth/devstorage.full_control",
  3316. // "https://www.googleapis.com/auth/devstorage.read_only",
  3317. // "https://www.googleapis.com/auth/devstorage.read_write"
  3318. // ]
  3319. // }
  3320. }
  3321. // Pages invokes f for each page of results.
  3322. // A non-nil error returned from f will halt the iteration.
  3323. // The provided context supersedes any context provided to the Context method.
  3324. func (c *BucketsListCall) Pages(ctx context.Context, f func(*Buckets) error) error {
  3325. c.ctx_ = ctx
  3326. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  3327. for {
  3328. x, err := c.Do()
  3329. if err != nil {
  3330. return err
  3331. }
  3332. if err := f(x); err != nil {
  3333. return err
  3334. }
  3335. if x.NextPageToken == "" {
  3336. return nil
  3337. }
  3338. c.PageToken(x.NextPageToken)
  3339. }
  3340. }
  3341. // method id "storage.buckets.lockRetentionPolicy":
  3342. type BucketsLockRetentionPolicyCall struct {
  3343. s *Service
  3344. bucket string
  3345. urlParams_ gensupport.URLParams
  3346. ctx_ context.Context
  3347. header_ http.Header
  3348. }
  3349. // LockRetentionPolicy: Locks retention policy on a bucket.
  3350. func (r *BucketsService) LockRetentionPolicy(bucket string, ifMetagenerationMatch int64) *BucketsLockRetentionPolicyCall {
  3351. c := &BucketsLockRetentionPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3352. c.bucket = bucket
  3353. c.urlParams_.Set("ifMetagenerationMatch", fmt.Sprint(ifMetagenerationMatch))
  3354. return c
  3355. }
  3356. // UserProject sets the optional parameter "userProject": The project to
  3357. // be billed for this request. Required for Requester Pays buckets.
  3358. func (c *BucketsLockRetentionPolicyCall) UserProject(userProject string) *BucketsLockRetentionPolicyCall {
  3359. c.urlParams_.Set("userProject", userProject)
  3360. return c
  3361. }
  3362. // Fields allows partial responses to be retrieved. See
  3363. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3364. // for more information.
  3365. func (c *BucketsLockRetentionPolicyCall) Fields(s ...googleapi.Field) *BucketsLockRetentionPolicyCall {
  3366. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3367. return c
  3368. }
  3369. // Context sets the context to be used in this call's Do method. Any
  3370. // pending HTTP request will be aborted if the provided context is
  3371. // canceled.
  3372. func (c *BucketsLockRetentionPolicyCall) Context(ctx context.Context) *BucketsLockRetentionPolicyCall {
  3373. c.ctx_ = ctx
  3374. return c
  3375. }
  3376. // Header returns an http.Header that can be modified by the caller to
  3377. // add HTTP headers to the request.
  3378. func (c *BucketsLockRetentionPolicyCall) Header() http.Header {
  3379. if c.header_ == nil {
  3380. c.header_ = make(http.Header)
  3381. }
  3382. return c.header_
  3383. }
  3384. func (c *BucketsLockRetentionPolicyCall) doRequest(alt string) (*http.Response, error) {
  3385. reqHeaders := make(http.Header)
  3386. for k, v := range c.header_ {
  3387. reqHeaders[k] = v
  3388. }
  3389. reqHeaders.Set("User-Agent", c.s.userAgent())
  3390. var body io.Reader = nil
  3391. c.urlParams_.Set("alt", alt)
  3392. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/lockRetentionPolicy")
  3393. urls += "?" + c.urlParams_.Encode()
  3394. req, _ := http.NewRequest("POST", urls, body)
  3395. req.Header = reqHeaders
  3396. googleapi.Expand(req.URL, map[string]string{
  3397. "bucket": c.bucket,
  3398. })
  3399. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3400. }
  3401. // Do executes the "storage.buckets.lockRetentionPolicy" call.
  3402. // Exactly one of *Bucket or error will be non-nil. Any non-2xx status
  3403. // code is an error. Response headers are in either
  3404. // *Bucket.ServerResponse.Header or (if a response was returned at all)
  3405. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3406. // check whether the returned error was because http.StatusNotModified
  3407. // was returned.
  3408. func (c *BucketsLockRetentionPolicyCall) Do(opts ...googleapi.CallOption) (*Bucket, error) {
  3409. gensupport.SetOptions(c.urlParams_, opts...)
  3410. res, err := c.doRequest("json")
  3411. if res != nil && res.StatusCode == http.StatusNotModified {
  3412. if res.Body != nil {
  3413. res.Body.Close()
  3414. }
  3415. return nil, &googleapi.Error{
  3416. Code: res.StatusCode,
  3417. Header: res.Header,
  3418. }
  3419. }
  3420. if err != nil {
  3421. return nil, err
  3422. }
  3423. defer googleapi.CloseBody(res)
  3424. if err := googleapi.CheckResponse(res); err != nil {
  3425. return nil, err
  3426. }
  3427. ret := &Bucket{
  3428. ServerResponse: googleapi.ServerResponse{
  3429. Header: res.Header,
  3430. HTTPStatusCode: res.StatusCode,
  3431. },
  3432. }
  3433. target := &ret
  3434. if err := gensupport.DecodeResponse(target, res); err != nil {
  3435. return nil, err
  3436. }
  3437. return ret, nil
  3438. // {
  3439. // "description": "Locks retention policy on a bucket.",
  3440. // "httpMethod": "POST",
  3441. // "id": "storage.buckets.lockRetentionPolicy",
  3442. // "parameterOrder": [
  3443. // "bucket",
  3444. // "ifMetagenerationMatch"
  3445. // ],
  3446. // "parameters": {
  3447. // "bucket": {
  3448. // "description": "Name of a bucket.",
  3449. // "location": "path",
  3450. // "required": true,
  3451. // "type": "string"
  3452. // },
  3453. // "ifMetagenerationMatch": {
  3454. // "description": "Makes the operation conditional on whether bucket's current metageneration matches the given value.",
  3455. // "format": "int64",
  3456. // "location": "query",
  3457. // "required": true,
  3458. // "type": "string"
  3459. // },
  3460. // "userProject": {
  3461. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  3462. // "location": "query",
  3463. // "type": "string"
  3464. // }
  3465. // },
  3466. // "path": "b/{bucket}/lockRetentionPolicy",
  3467. // "response": {
  3468. // "$ref": "Bucket"
  3469. // },
  3470. // "scopes": [
  3471. // "https://www.googleapis.com/auth/cloud-platform",
  3472. // "https://www.googleapis.com/auth/devstorage.full_control",
  3473. // "https://www.googleapis.com/auth/devstorage.read_write"
  3474. // ]
  3475. // }
  3476. }
  3477. // method id "storage.buckets.patch":
  3478. type BucketsPatchCall struct {
  3479. s *Service
  3480. bucket string
  3481. bucket2 *Bucket
  3482. urlParams_ gensupport.URLParams
  3483. ctx_ context.Context
  3484. header_ http.Header
  3485. }
  3486. // Patch: Updates a bucket. Changes to the bucket will be readable
  3487. // immediately after writing, but configuration changes may take time to
  3488. // propagate. This method supports patch semantics.
  3489. func (r *BucketsService) Patch(bucket string, bucket2 *Bucket) *BucketsPatchCall {
  3490. c := &BucketsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3491. c.bucket = bucket
  3492. c.bucket2 = bucket2
  3493. return c
  3494. }
  3495. // IfMetagenerationMatch sets the optional parameter
  3496. // "ifMetagenerationMatch": Makes the return of the bucket metadata
  3497. // conditional on whether the bucket's current metageneration matches
  3498. // the given value.
  3499. func (c *BucketsPatchCall) IfMetagenerationMatch(ifMetagenerationMatch int64) *BucketsPatchCall {
  3500. c.urlParams_.Set("ifMetagenerationMatch", fmt.Sprint(ifMetagenerationMatch))
  3501. return c
  3502. }
  3503. // IfMetagenerationNotMatch sets the optional parameter
  3504. // "ifMetagenerationNotMatch": Makes the return of the bucket metadata
  3505. // conditional on whether the bucket's current metageneration does not
  3506. // match the given value.
  3507. func (c *BucketsPatchCall) IfMetagenerationNotMatch(ifMetagenerationNotMatch int64) *BucketsPatchCall {
  3508. c.urlParams_.Set("ifMetagenerationNotMatch", fmt.Sprint(ifMetagenerationNotMatch))
  3509. return c
  3510. }
  3511. // PredefinedAcl sets the optional parameter "predefinedAcl": Apply a
  3512. // predefined set of access controls to this bucket.
  3513. //
  3514. // Possible values:
  3515. // "authenticatedRead" - Project team owners get OWNER access, and
  3516. // allAuthenticatedUsers get READER access.
  3517. // "private" - Project team owners get OWNER access.
  3518. // "projectPrivate" - Project team members get access according to
  3519. // their roles.
  3520. // "publicRead" - Project team owners get OWNER access, and allUsers
  3521. // get READER access.
  3522. // "publicReadWrite" - Project team owners get OWNER access, and
  3523. // allUsers get WRITER access.
  3524. func (c *BucketsPatchCall) PredefinedAcl(predefinedAcl string) *BucketsPatchCall {
  3525. c.urlParams_.Set("predefinedAcl", predefinedAcl)
  3526. return c
  3527. }
  3528. // PredefinedDefaultObjectAcl sets the optional parameter
  3529. // "predefinedDefaultObjectAcl": Apply a predefined set of default
  3530. // object access controls to this bucket.
  3531. //
  3532. // Possible values:
  3533. // "authenticatedRead" - Object owner gets OWNER access, and
  3534. // allAuthenticatedUsers get READER access.
  3535. // "bucketOwnerFullControl" - Object owner gets OWNER access, and
  3536. // project team owners get OWNER access.
  3537. // "bucketOwnerRead" - Object owner gets OWNER access, and project
  3538. // team owners get READER access.
  3539. // "private" - Object owner gets OWNER access.
  3540. // "projectPrivate" - Object owner gets OWNER access, and project team
  3541. // members get access according to their roles.
  3542. // "publicRead" - Object owner gets OWNER access, and allUsers get
  3543. // READER access.
  3544. func (c *BucketsPatchCall) PredefinedDefaultObjectAcl(predefinedDefaultObjectAcl string) *BucketsPatchCall {
  3545. c.urlParams_.Set("predefinedDefaultObjectAcl", predefinedDefaultObjectAcl)
  3546. return c
  3547. }
  3548. // Projection sets the optional parameter "projection": Set of
  3549. // properties to return. Defaults to full.
  3550. //
  3551. // Possible values:
  3552. // "full" - Include all properties.
  3553. // "noAcl" - Omit owner, acl and defaultObjectAcl properties.
  3554. func (c *BucketsPatchCall) Projection(projection string) *BucketsPatchCall {
  3555. c.urlParams_.Set("projection", projection)
  3556. return c
  3557. }
  3558. // UserProject sets the optional parameter "userProject": The project to
  3559. // be billed for this request. Required for Requester Pays buckets.
  3560. func (c *BucketsPatchCall) UserProject(userProject string) *BucketsPatchCall {
  3561. c.urlParams_.Set("userProject", userProject)
  3562. return c
  3563. }
  3564. // Fields allows partial responses to be retrieved. See
  3565. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3566. // for more information.
  3567. func (c *BucketsPatchCall) Fields(s ...googleapi.Field) *BucketsPatchCall {
  3568. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3569. return c
  3570. }
  3571. // Context sets the context to be used in this call's Do method. Any
  3572. // pending HTTP request will be aborted if the provided context is
  3573. // canceled.
  3574. func (c *BucketsPatchCall) Context(ctx context.Context) *BucketsPatchCall {
  3575. c.ctx_ = ctx
  3576. return c
  3577. }
  3578. // Header returns an http.Header that can be modified by the caller to
  3579. // add HTTP headers to the request.
  3580. func (c *BucketsPatchCall) Header() http.Header {
  3581. if c.header_ == nil {
  3582. c.header_ = make(http.Header)
  3583. }
  3584. return c.header_
  3585. }
  3586. func (c *BucketsPatchCall) doRequest(alt string) (*http.Response, error) {
  3587. reqHeaders := make(http.Header)
  3588. for k, v := range c.header_ {
  3589. reqHeaders[k] = v
  3590. }
  3591. reqHeaders.Set("User-Agent", c.s.userAgent())
  3592. var body io.Reader = nil
  3593. body, err := googleapi.WithoutDataWrapper.JSONReader(c.bucket2)
  3594. if err != nil {
  3595. return nil, err
  3596. }
  3597. reqHeaders.Set("Content-Type", "application/json")
  3598. c.urlParams_.Set("alt", alt)
  3599. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}")
  3600. urls += "?" + c.urlParams_.Encode()
  3601. req, _ := http.NewRequest("PATCH", urls, body)
  3602. req.Header = reqHeaders
  3603. googleapi.Expand(req.URL, map[string]string{
  3604. "bucket": c.bucket,
  3605. })
  3606. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3607. }
  3608. // Do executes the "storage.buckets.patch" call.
  3609. // Exactly one of *Bucket or error will be non-nil. Any non-2xx status
  3610. // code is an error. Response headers are in either
  3611. // *Bucket.ServerResponse.Header or (if a response was returned at all)
  3612. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3613. // check whether the returned error was because http.StatusNotModified
  3614. // was returned.
  3615. func (c *BucketsPatchCall) Do(opts ...googleapi.CallOption) (*Bucket, error) {
  3616. gensupport.SetOptions(c.urlParams_, opts...)
  3617. res, err := c.doRequest("json")
  3618. if res != nil && res.StatusCode == http.StatusNotModified {
  3619. if res.Body != nil {
  3620. res.Body.Close()
  3621. }
  3622. return nil, &googleapi.Error{
  3623. Code: res.StatusCode,
  3624. Header: res.Header,
  3625. }
  3626. }
  3627. if err != nil {
  3628. return nil, err
  3629. }
  3630. defer googleapi.CloseBody(res)
  3631. if err := googleapi.CheckResponse(res); err != nil {
  3632. return nil, err
  3633. }
  3634. ret := &Bucket{
  3635. ServerResponse: googleapi.ServerResponse{
  3636. Header: res.Header,
  3637. HTTPStatusCode: res.StatusCode,
  3638. },
  3639. }
  3640. target := &ret
  3641. if err := gensupport.DecodeResponse(target, res); err != nil {
  3642. return nil, err
  3643. }
  3644. return ret, nil
  3645. // {
  3646. // "description": "Updates a bucket. Changes to the bucket will be readable immediately after writing, but configuration changes may take time to propagate. This method supports patch semantics.",
  3647. // "httpMethod": "PATCH",
  3648. // "id": "storage.buckets.patch",
  3649. // "parameterOrder": [
  3650. // "bucket"
  3651. // ],
  3652. // "parameters": {
  3653. // "bucket": {
  3654. // "description": "Name of a bucket.",
  3655. // "location": "path",
  3656. // "required": true,
  3657. // "type": "string"
  3658. // },
  3659. // "ifMetagenerationMatch": {
  3660. // "description": "Makes the return of the bucket metadata conditional on whether the bucket's current metageneration matches the given value.",
  3661. // "format": "int64",
  3662. // "location": "query",
  3663. // "type": "string"
  3664. // },
  3665. // "ifMetagenerationNotMatch": {
  3666. // "description": "Makes the return of the bucket metadata conditional on whether the bucket's current metageneration does not match the given value.",
  3667. // "format": "int64",
  3668. // "location": "query",
  3669. // "type": "string"
  3670. // },
  3671. // "predefinedAcl": {
  3672. // "description": "Apply a predefined set of access controls to this bucket.",
  3673. // "enum": [
  3674. // "authenticatedRead",
  3675. // "private",
  3676. // "projectPrivate",
  3677. // "publicRead",
  3678. // "publicReadWrite"
  3679. // ],
  3680. // "enumDescriptions": [
  3681. // "Project team owners get OWNER access, and allAuthenticatedUsers get READER access.",
  3682. // "Project team owners get OWNER access.",
  3683. // "Project team members get access according to their roles.",
  3684. // "Project team owners get OWNER access, and allUsers get READER access.",
  3685. // "Project team owners get OWNER access, and allUsers get WRITER access."
  3686. // ],
  3687. // "location": "query",
  3688. // "type": "string"
  3689. // },
  3690. // "predefinedDefaultObjectAcl": {
  3691. // "description": "Apply a predefined set of default object access controls to this bucket.",
  3692. // "enum": [
  3693. // "authenticatedRead",
  3694. // "bucketOwnerFullControl",
  3695. // "bucketOwnerRead",
  3696. // "private",
  3697. // "projectPrivate",
  3698. // "publicRead"
  3699. // ],
  3700. // "enumDescriptions": [
  3701. // "Object owner gets OWNER access, and allAuthenticatedUsers get READER access.",
  3702. // "Object owner gets OWNER access, and project team owners get OWNER access.",
  3703. // "Object owner gets OWNER access, and project team owners get READER access.",
  3704. // "Object owner gets OWNER access.",
  3705. // "Object owner gets OWNER access, and project team members get access according to their roles.",
  3706. // "Object owner gets OWNER access, and allUsers get READER access."
  3707. // ],
  3708. // "location": "query",
  3709. // "type": "string"
  3710. // },
  3711. // "projection": {
  3712. // "description": "Set of properties to return. Defaults to full.",
  3713. // "enum": [
  3714. // "full",
  3715. // "noAcl"
  3716. // ],
  3717. // "enumDescriptions": [
  3718. // "Include all properties.",
  3719. // "Omit owner, acl and defaultObjectAcl properties."
  3720. // ],
  3721. // "location": "query",
  3722. // "type": "string"
  3723. // },
  3724. // "userProject": {
  3725. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  3726. // "location": "query",
  3727. // "type": "string"
  3728. // }
  3729. // },
  3730. // "path": "b/{bucket}",
  3731. // "request": {
  3732. // "$ref": "Bucket"
  3733. // },
  3734. // "response": {
  3735. // "$ref": "Bucket"
  3736. // },
  3737. // "scopes": [
  3738. // "https://www.googleapis.com/auth/cloud-platform",
  3739. // "https://www.googleapis.com/auth/devstorage.full_control"
  3740. // ]
  3741. // }
  3742. }
  3743. // method id "storage.buckets.setIamPolicy":
  3744. type BucketsSetIamPolicyCall struct {
  3745. s *Service
  3746. bucket string
  3747. policy *Policy
  3748. urlParams_ gensupport.URLParams
  3749. ctx_ context.Context
  3750. header_ http.Header
  3751. }
  3752. // SetIamPolicy: Updates an IAM policy for the specified bucket.
  3753. func (r *BucketsService) SetIamPolicy(bucket string, policy *Policy) *BucketsSetIamPolicyCall {
  3754. c := &BucketsSetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3755. c.bucket = bucket
  3756. c.policy = policy
  3757. return c
  3758. }
  3759. // UserProject sets the optional parameter "userProject": The project to
  3760. // be billed for this request. Required for Requester Pays buckets.
  3761. func (c *BucketsSetIamPolicyCall) UserProject(userProject string) *BucketsSetIamPolicyCall {
  3762. c.urlParams_.Set("userProject", userProject)
  3763. return c
  3764. }
  3765. // Fields allows partial responses to be retrieved. See
  3766. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3767. // for more information.
  3768. func (c *BucketsSetIamPolicyCall) Fields(s ...googleapi.Field) *BucketsSetIamPolicyCall {
  3769. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3770. return c
  3771. }
  3772. // Context sets the context to be used in this call's Do method. Any
  3773. // pending HTTP request will be aborted if the provided context is
  3774. // canceled.
  3775. func (c *BucketsSetIamPolicyCall) Context(ctx context.Context) *BucketsSetIamPolicyCall {
  3776. c.ctx_ = ctx
  3777. return c
  3778. }
  3779. // Header returns an http.Header that can be modified by the caller to
  3780. // add HTTP headers to the request.
  3781. func (c *BucketsSetIamPolicyCall) Header() http.Header {
  3782. if c.header_ == nil {
  3783. c.header_ = make(http.Header)
  3784. }
  3785. return c.header_
  3786. }
  3787. func (c *BucketsSetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
  3788. reqHeaders := make(http.Header)
  3789. for k, v := range c.header_ {
  3790. reqHeaders[k] = v
  3791. }
  3792. reqHeaders.Set("User-Agent", c.s.userAgent())
  3793. var body io.Reader = nil
  3794. body, err := googleapi.WithoutDataWrapper.JSONReader(c.policy)
  3795. if err != nil {
  3796. return nil, err
  3797. }
  3798. reqHeaders.Set("Content-Type", "application/json")
  3799. c.urlParams_.Set("alt", alt)
  3800. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/iam")
  3801. urls += "?" + c.urlParams_.Encode()
  3802. req, _ := http.NewRequest("PUT", urls, body)
  3803. req.Header = reqHeaders
  3804. googleapi.Expand(req.URL, map[string]string{
  3805. "bucket": c.bucket,
  3806. })
  3807. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3808. }
  3809. // Do executes the "storage.buckets.setIamPolicy" call.
  3810. // Exactly one of *Policy or error will be non-nil. Any non-2xx status
  3811. // code is an error. Response headers are in either
  3812. // *Policy.ServerResponse.Header or (if a response was returned at all)
  3813. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3814. // check whether the returned error was because http.StatusNotModified
  3815. // was returned.
  3816. func (c *BucketsSetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) {
  3817. gensupport.SetOptions(c.urlParams_, opts...)
  3818. res, err := c.doRequest("json")
  3819. if res != nil && res.StatusCode == http.StatusNotModified {
  3820. if res.Body != nil {
  3821. res.Body.Close()
  3822. }
  3823. return nil, &googleapi.Error{
  3824. Code: res.StatusCode,
  3825. Header: res.Header,
  3826. }
  3827. }
  3828. if err != nil {
  3829. return nil, err
  3830. }
  3831. defer googleapi.CloseBody(res)
  3832. if err := googleapi.CheckResponse(res); err != nil {
  3833. return nil, err
  3834. }
  3835. ret := &Policy{
  3836. ServerResponse: googleapi.ServerResponse{
  3837. Header: res.Header,
  3838. HTTPStatusCode: res.StatusCode,
  3839. },
  3840. }
  3841. target := &ret
  3842. if err := gensupport.DecodeResponse(target, res); err != nil {
  3843. return nil, err
  3844. }
  3845. return ret, nil
  3846. // {
  3847. // "description": "Updates an IAM policy for the specified bucket.",
  3848. // "httpMethod": "PUT",
  3849. // "id": "storage.buckets.setIamPolicy",
  3850. // "parameterOrder": [
  3851. // "bucket"
  3852. // ],
  3853. // "parameters": {
  3854. // "bucket": {
  3855. // "description": "Name of a bucket.",
  3856. // "location": "path",
  3857. // "required": true,
  3858. // "type": "string"
  3859. // },
  3860. // "userProject": {
  3861. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  3862. // "location": "query",
  3863. // "type": "string"
  3864. // }
  3865. // },
  3866. // "path": "b/{bucket}/iam",
  3867. // "request": {
  3868. // "$ref": "Policy"
  3869. // },
  3870. // "response": {
  3871. // "$ref": "Policy"
  3872. // },
  3873. // "scopes": [
  3874. // "https://www.googleapis.com/auth/cloud-platform",
  3875. // "https://www.googleapis.com/auth/devstorage.full_control",
  3876. // "https://www.googleapis.com/auth/devstorage.read_write"
  3877. // ]
  3878. // }
  3879. }
  3880. // method id "storage.buckets.testIamPermissions":
  3881. type BucketsTestIamPermissionsCall struct {
  3882. s *Service
  3883. bucket string
  3884. urlParams_ gensupport.URLParams
  3885. ifNoneMatch_ string
  3886. ctx_ context.Context
  3887. header_ http.Header
  3888. }
  3889. // TestIamPermissions: Tests a set of permissions on the given bucket to
  3890. // see which, if any, are held by the caller.
  3891. func (r *BucketsService) TestIamPermissions(bucket string, permissions []string) *BucketsTestIamPermissionsCall {
  3892. c := &BucketsTestIamPermissionsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3893. c.bucket = bucket
  3894. c.urlParams_.SetMulti("permissions", append([]string{}, permissions...))
  3895. return c
  3896. }
  3897. // UserProject sets the optional parameter "userProject": The project to
  3898. // be billed for this request. Required for Requester Pays buckets.
  3899. func (c *BucketsTestIamPermissionsCall) UserProject(userProject string) *BucketsTestIamPermissionsCall {
  3900. c.urlParams_.Set("userProject", userProject)
  3901. return c
  3902. }
  3903. // Fields allows partial responses to be retrieved. See
  3904. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3905. // for more information.
  3906. func (c *BucketsTestIamPermissionsCall) Fields(s ...googleapi.Field) *BucketsTestIamPermissionsCall {
  3907. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3908. return c
  3909. }
  3910. // IfNoneMatch sets the optional parameter which makes the operation
  3911. // fail if the object's ETag matches the given value. This is useful for
  3912. // getting updates only after the object has changed since the last
  3913. // request. Use googleapi.IsNotModified to check whether the response
  3914. // error from Do is the result of In-None-Match.
  3915. func (c *BucketsTestIamPermissionsCall) IfNoneMatch(entityTag string) *BucketsTestIamPermissionsCall {
  3916. c.ifNoneMatch_ = entityTag
  3917. return c
  3918. }
  3919. // Context sets the context to be used in this call's Do method. Any
  3920. // pending HTTP request will be aborted if the provided context is
  3921. // canceled.
  3922. func (c *BucketsTestIamPermissionsCall) Context(ctx context.Context) *BucketsTestIamPermissionsCall {
  3923. c.ctx_ = ctx
  3924. return c
  3925. }
  3926. // Header returns an http.Header that can be modified by the caller to
  3927. // add HTTP headers to the request.
  3928. func (c *BucketsTestIamPermissionsCall) Header() http.Header {
  3929. if c.header_ == nil {
  3930. c.header_ = make(http.Header)
  3931. }
  3932. return c.header_
  3933. }
  3934. func (c *BucketsTestIamPermissionsCall) doRequest(alt string) (*http.Response, error) {
  3935. reqHeaders := make(http.Header)
  3936. for k, v := range c.header_ {
  3937. reqHeaders[k] = v
  3938. }
  3939. reqHeaders.Set("User-Agent", c.s.userAgent())
  3940. if c.ifNoneMatch_ != "" {
  3941. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3942. }
  3943. var body io.Reader = nil
  3944. c.urlParams_.Set("alt", alt)
  3945. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/iam/testPermissions")
  3946. urls += "?" + c.urlParams_.Encode()
  3947. req, _ := http.NewRequest("GET", urls, body)
  3948. req.Header = reqHeaders
  3949. googleapi.Expand(req.URL, map[string]string{
  3950. "bucket": c.bucket,
  3951. })
  3952. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3953. }
  3954. // Do executes the "storage.buckets.testIamPermissions" call.
  3955. // Exactly one of *TestIamPermissionsResponse or error will be non-nil.
  3956. // Any non-2xx status code is an error. Response headers are in either
  3957. // *TestIamPermissionsResponse.ServerResponse.Header or (if a response
  3958. // was returned at all) in error.(*googleapi.Error).Header. Use
  3959. // googleapi.IsNotModified to check whether the returned error was
  3960. // because http.StatusNotModified was returned.
  3961. func (c *BucketsTestIamPermissionsCall) Do(opts ...googleapi.CallOption) (*TestIamPermissionsResponse, error) {
  3962. gensupport.SetOptions(c.urlParams_, opts...)
  3963. res, err := c.doRequest("json")
  3964. if res != nil && res.StatusCode == http.StatusNotModified {
  3965. if res.Body != nil {
  3966. res.Body.Close()
  3967. }
  3968. return nil, &googleapi.Error{
  3969. Code: res.StatusCode,
  3970. Header: res.Header,
  3971. }
  3972. }
  3973. if err != nil {
  3974. return nil, err
  3975. }
  3976. defer googleapi.CloseBody(res)
  3977. if err := googleapi.CheckResponse(res); err != nil {
  3978. return nil, err
  3979. }
  3980. ret := &TestIamPermissionsResponse{
  3981. ServerResponse: googleapi.ServerResponse{
  3982. Header: res.Header,
  3983. HTTPStatusCode: res.StatusCode,
  3984. },
  3985. }
  3986. target := &ret
  3987. if err := gensupport.DecodeResponse(target, res); err != nil {
  3988. return nil, err
  3989. }
  3990. return ret, nil
  3991. // {
  3992. // "description": "Tests a set of permissions on the given bucket to see which, if any, are held by the caller.",
  3993. // "httpMethod": "GET",
  3994. // "id": "storage.buckets.testIamPermissions",
  3995. // "parameterOrder": [
  3996. // "bucket",
  3997. // "permissions"
  3998. // ],
  3999. // "parameters": {
  4000. // "bucket": {
  4001. // "description": "Name of a bucket.",
  4002. // "location": "path",
  4003. // "required": true,
  4004. // "type": "string"
  4005. // },
  4006. // "permissions": {
  4007. // "description": "Permissions to test.",
  4008. // "location": "query",
  4009. // "repeated": true,
  4010. // "required": true,
  4011. // "type": "string"
  4012. // },
  4013. // "userProject": {
  4014. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  4015. // "location": "query",
  4016. // "type": "string"
  4017. // }
  4018. // },
  4019. // "path": "b/{bucket}/iam/testPermissions",
  4020. // "response": {
  4021. // "$ref": "TestIamPermissionsResponse"
  4022. // },
  4023. // "scopes": [
  4024. // "https://www.googleapis.com/auth/cloud-platform",
  4025. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  4026. // "https://www.googleapis.com/auth/devstorage.full_control",
  4027. // "https://www.googleapis.com/auth/devstorage.read_only",
  4028. // "https://www.googleapis.com/auth/devstorage.read_write"
  4029. // ]
  4030. // }
  4031. }
  4032. // method id "storage.buckets.update":
  4033. type BucketsUpdateCall struct {
  4034. s *Service
  4035. bucket string
  4036. bucket2 *Bucket
  4037. urlParams_ gensupport.URLParams
  4038. ctx_ context.Context
  4039. header_ http.Header
  4040. }
  4041. // Update: Updates a bucket. Changes to the bucket will be readable
  4042. // immediately after writing, but configuration changes may take time to
  4043. // propagate.
  4044. func (r *BucketsService) Update(bucket string, bucket2 *Bucket) *BucketsUpdateCall {
  4045. c := &BucketsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4046. c.bucket = bucket
  4047. c.bucket2 = bucket2
  4048. return c
  4049. }
  4050. // IfMetagenerationMatch sets the optional parameter
  4051. // "ifMetagenerationMatch": Makes the return of the bucket metadata
  4052. // conditional on whether the bucket's current metageneration matches
  4053. // the given value.
  4054. func (c *BucketsUpdateCall) IfMetagenerationMatch(ifMetagenerationMatch int64) *BucketsUpdateCall {
  4055. c.urlParams_.Set("ifMetagenerationMatch", fmt.Sprint(ifMetagenerationMatch))
  4056. return c
  4057. }
  4058. // IfMetagenerationNotMatch sets the optional parameter
  4059. // "ifMetagenerationNotMatch": Makes the return of the bucket metadata
  4060. // conditional on whether the bucket's current metageneration does not
  4061. // match the given value.
  4062. func (c *BucketsUpdateCall) IfMetagenerationNotMatch(ifMetagenerationNotMatch int64) *BucketsUpdateCall {
  4063. c.urlParams_.Set("ifMetagenerationNotMatch", fmt.Sprint(ifMetagenerationNotMatch))
  4064. return c
  4065. }
  4066. // PredefinedAcl sets the optional parameter "predefinedAcl": Apply a
  4067. // predefined set of access controls to this bucket.
  4068. //
  4069. // Possible values:
  4070. // "authenticatedRead" - Project team owners get OWNER access, and
  4071. // allAuthenticatedUsers get READER access.
  4072. // "private" - Project team owners get OWNER access.
  4073. // "projectPrivate" - Project team members get access according to
  4074. // their roles.
  4075. // "publicRead" - Project team owners get OWNER access, and allUsers
  4076. // get READER access.
  4077. // "publicReadWrite" - Project team owners get OWNER access, and
  4078. // allUsers get WRITER access.
  4079. func (c *BucketsUpdateCall) PredefinedAcl(predefinedAcl string) *BucketsUpdateCall {
  4080. c.urlParams_.Set("predefinedAcl", predefinedAcl)
  4081. return c
  4082. }
  4083. // PredefinedDefaultObjectAcl sets the optional parameter
  4084. // "predefinedDefaultObjectAcl": Apply a predefined set of default
  4085. // object access controls to this bucket.
  4086. //
  4087. // Possible values:
  4088. // "authenticatedRead" - Object owner gets OWNER access, and
  4089. // allAuthenticatedUsers get READER access.
  4090. // "bucketOwnerFullControl" - Object owner gets OWNER access, and
  4091. // project team owners get OWNER access.
  4092. // "bucketOwnerRead" - Object owner gets OWNER access, and project
  4093. // team owners get READER access.
  4094. // "private" - Object owner gets OWNER access.
  4095. // "projectPrivate" - Object owner gets OWNER access, and project team
  4096. // members get access according to their roles.
  4097. // "publicRead" - Object owner gets OWNER access, and allUsers get
  4098. // READER access.
  4099. func (c *BucketsUpdateCall) PredefinedDefaultObjectAcl(predefinedDefaultObjectAcl string) *BucketsUpdateCall {
  4100. c.urlParams_.Set("predefinedDefaultObjectAcl", predefinedDefaultObjectAcl)
  4101. return c
  4102. }
  4103. // Projection sets the optional parameter "projection": Set of
  4104. // properties to return. Defaults to full.
  4105. //
  4106. // Possible values:
  4107. // "full" - Include all properties.
  4108. // "noAcl" - Omit owner, acl and defaultObjectAcl properties.
  4109. func (c *BucketsUpdateCall) Projection(projection string) *BucketsUpdateCall {
  4110. c.urlParams_.Set("projection", projection)
  4111. return c
  4112. }
  4113. // UserProject sets the optional parameter "userProject": The project to
  4114. // be billed for this request. Required for Requester Pays buckets.
  4115. func (c *BucketsUpdateCall) UserProject(userProject string) *BucketsUpdateCall {
  4116. c.urlParams_.Set("userProject", userProject)
  4117. return c
  4118. }
  4119. // Fields allows partial responses to be retrieved. See
  4120. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4121. // for more information.
  4122. func (c *BucketsUpdateCall) Fields(s ...googleapi.Field) *BucketsUpdateCall {
  4123. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4124. return c
  4125. }
  4126. // Context sets the context to be used in this call's Do method. Any
  4127. // pending HTTP request will be aborted if the provided context is
  4128. // canceled.
  4129. func (c *BucketsUpdateCall) Context(ctx context.Context) *BucketsUpdateCall {
  4130. c.ctx_ = ctx
  4131. return c
  4132. }
  4133. // Header returns an http.Header that can be modified by the caller to
  4134. // add HTTP headers to the request.
  4135. func (c *BucketsUpdateCall) Header() http.Header {
  4136. if c.header_ == nil {
  4137. c.header_ = make(http.Header)
  4138. }
  4139. return c.header_
  4140. }
  4141. func (c *BucketsUpdateCall) doRequest(alt string) (*http.Response, error) {
  4142. reqHeaders := make(http.Header)
  4143. for k, v := range c.header_ {
  4144. reqHeaders[k] = v
  4145. }
  4146. reqHeaders.Set("User-Agent", c.s.userAgent())
  4147. var body io.Reader = nil
  4148. body, err := googleapi.WithoutDataWrapper.JSONReader(c.bucket2)
  4149. if err != nil {
  4150. return nil, err
  4151. }
  4152. reqHeaders.Set("Content-Type", "application/json")
  4153. c.urlParams_.Set("alt", alt)
  4154. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}")
  4155. urls += "?" + c.urlParams_.Encode()
  4156. req, _ := http.NewRequest("PUT", urls, body)
  4157. req.Header = reqHeaders
  4158. googleapi.Expand(req.URL, map[string]string{
  4159. "bucket": c.bucket,
  4160. })
  4161. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4162. }
  4163. // Do executes the "storage.buckets.update" call.
  4164. // Exactly one of *Bucket or error will be non-nil. Any non-2xx status
  4165. // code is an error. Response headers are in either
  4166. // *Bucket.ServerResponse.Header or (if a response was returned at all)
  4167. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  4168. // check whether the returned error was because http.StatusNotModified
  4169. // was returned.
  4170. func (c *BucketsUpdateCall) Do(opts ...googleapi.CallOption) (*Bucket, error) {
  4171. gensupport.SetOptions(c.urlParams_, opts...)
  4172. res, err := c.doRequest("json")
  4173. if res != nil && res.StatusCode == http.StatusNotModified {
  4174. if res.Body != nil {
  4175. res.Body.Close()
  4176. }
  4177. return nil, &googleapi.Error{
  4178. Code: res.StatusCode,
  4179. Header: res.Header,
  4180. }
  4181. }
  4182. if err != nil {
  4183. return nil, err
  4184. }
  4185. defer googleapi.CloseBody(res)
  4186. if err := googleapi.CheckResponse(res); err != nil {
  4187. return nil, err
  4188. }
  4189. ret := &Bucket{
  4190. ServerResponse: googleapi.ServerResponse{
  4191. Header: res.Header,
  4192. HTTPStatusCode: res.StatusCode,
  4193. },
  4194. }
  4195. target := &ret
  4196. if err := gensupport.DecodeResponse(target, res); err != nil {
  4197. return nil, err
  4198. }
  4199. return ret, nil
  4200. // {
  4201. // "description": "Updates a bucket. Changes to the bucket will be readable immediately after writing, but configuration changes may take time to propagate.",
  4202. // "httpMethod": "PUT",
  4203. // "id": "storage.buckets.update",
  4204. // "parameterOrder": [
  4205. // "bucket"
  4206. // ],
  4207. // "parameters": {
  4208. // "bucket": {
  4209. // "description": "Name of a bucket.",
  4210. // "location": "path",
  4211. // "required": true,
  4212. // "type": "string"
  4213. // },
  4214. // "ifMetagenerationMatch": {
  4215. // "description": "Makes the return of the bucket metadata conditional on whether the bucket's current metageneration matches the given value.",
  4216. // "format": "int64",
  4217. // "location": "query",
  4218. // "type": "string"
  4219. // },
  4220. // "ifMetagenerationNotMatch": {
  4221. // "description": "Makes the return of the bucket metadata conditional on whether the bucket's current metageneration does not match the given value.",
  4222. // "format": "int64",
  4223. // "location": "query",
  4224. // "type": "string"
  4225. // },
  4226. // "predefinedAcl": {
  4227. // "description": "Apply a predefined set of access controls to this bucket.",
  4228. // "enum": [
  4229. // "authenticatedRead",
  4230. // "private",
  4231. // "projectPrivate",
  4232. // "publicRead",
  4233. // "publicReadWrite"
  4234. // ],
  4235. // "enumDescriptions": [
  4236. // "Project team owners get OWNER access, and allAuthenticatedUsers get READER access.",
  4237. // "Project team owners get OWNER access.",
  4238. // "Project team members get access according to their roles.",
  4239. // "Project team owners get OWNER access, and allUsers get READER access.",
  4240. // "Project team owners get OWNER access, and allUsers get WRITER access."
  4241. // ],
  4242. // "location": "query",
  4243. // "type": "string"
  4244. // },
  4245. // "predefinedDefaultObjectAcl": {
  4246. // "description": "Apply a predefined set of default object access controls to this bucket.",
  4247. // "enum": [
  4248. // "authenticatedRead",
  4249. // "bucketOwnerFullControl",
  4250. // "bucketOwnerRead",
  4251. // "private",
  4252. // "projectPrivate",
  4253. // "publicRead"
  4254. // ],
  4255. // "enumDescriptions": [
  4256. // "Object owner gets OWNER access, and allAuthenticatedUsers get READER access.",
  4257. // "Object owner gets OWNER access, and project team owners get OWNER access.",
  4258. // "Object owner gets OWNER access, and project team owners get READER access.",
  4259. // "Object owner gets OWNER access.",
  4260. // "Object owner gets OWNER access, and project team members get access according to their roles.",
  4261. // "Object owner gets OWNER access, and allUsers get READER access."
  4262. // ],
  4263. // "location": "query",
  4264. // "type": "string"
  4265. // },
  4266. // "projection": {
  4267. // "description": "Set of properties to return. Defaults to full.",
  4268. // "enum": [
  4269. // "full",
  4270. // "noAcl"
  4271. // ],
  4272. // "enumDescriptions": [
  4273. // "Include all properties.",
  4274. // "Omit owner, acl and defaultObjectAcl properties."
  4275. // ],
  4276. // "location": "query",
  4277. // "type": "string"
  4278. // },
  4279. // "userProject": {
  4280. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  4281. // "location": "query",
  4282. // "type": "string"
  4283. // }
  4284. // },
  4285. // "path": "b/{bucket}",
  4286. // "request": {
  4287. // "$ref": "Bucket"
  4288. // },
  4289. // "response": {
  4290. // "$ref": "Bucket"
  4291. // },
  4292. // "scopes": [
  4293. // "https://www.googleapis.com/auth/cloud-platform",
  4294. // "https://www.googleapis.com/auth/devstorage.full_control"
  4295. // ]
  4296. // }
  4297. }
  4298. // method id "storage.channels.stop":
  4299. type ChannelsStopCall struct {
  4300. s *Service
  4301. channel *Channel
  4302. urlParams_ gensupport.URLParams
  4303. ctx_ context.Context
  4304. header_ http.Header
  4305. }
  4306. // Stop: Stop watching resources through this channel
  4307. func (r *ChannelsService) Stop(channel *Channel) *ChannelsStopCall {
  4308. c := &ChannelsStopCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4309. c.channel = channel
  4310. return c
  4311. }
  4312. // Fields allows partial responses to be retrieved. See
  4313. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4314. // for more information.
  4315. func (c *ChannelsStopCall) Fields(s ...googleapi.Field) *ChannelsStopCall {
  4316. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4317. return c
  4318. }
  4319. // Context sets the context to be used in this call's Do method. Any
  4320. // pending HTTP request will be aborted if the provided context is
  4321. // canceled.
  4322. func (c *ChannelsStopCall) Context(ctx context.Context) *ChannelsStopCall {
  4323. c.ctx_ = ctx
  4324. return c
  4325. }
  4326. // Header returns an http.Header that can be modified by the caller to
  4327. // add HTTP headers to the request.
  4328. func (c *ChannelsStopCall) Header() http.Header {
  4329. if c.header_ == nil {
  4330. c.header_ = make(http.Header)
  4331. }
  4332. return c.header_
  4333. }
  4334. func (c *ChannelsStopCall) doRequest(alt string) (*http.Response, error) {
  4335. reqHeaders := make(http.Header)
  4336. for k, v := range c.header_ {
  4337. reqHeaders[k] = v
  4338. }
  4339. reqHeaders.Set("User-Agent", c.s.userAgent())
  4340. var body io.Reader = nil
  4341. body, err := googleapi.WithoutDataWrapper.JSONReader(c.channel)
  4342. if err != nil {
  4343. return nil, err
  4344. }
  4345. reqHeaders.Set("Content-Type", "application/json")
  4346. c.urlParams_.Set("alt", alt)
  4347. urls := googleapi.ResolveRelative(c.s.BasePath, "channels/stop")
  4348. urls += "?" + c.urlParams_.Encode()
  4349. req, _ := http.NewRequest("POST", urls, body)
  4350. req.Header = reqHeaders
  4351. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4352. }
  4353. // Do executes the "storage.channels.stop" call.
  4354. func (c *ChannelsStopCall) Do(opts ...googleapi.CallOption) error {
  4355. gensupport.SetOptions(c.urlParams_, opts...)
  4356. res, err := c.doRequest("json")
  4357. if err != nil {
  4358. return err
  4359. }
  4360. defer googleapi.CloseBody(res)
  4361. if err := googleapi.CheckResponse(res); err != nil {
  4362. return err
  4363. }
  4364. return nil
  4365. // {
  4366. // "description": "Stop watching resources through this channel",
  4367. // "httpMethod": "POST",
  4368. // "id": "storage.channels.stop",
  4369. // "path": "channels/stop",
  4370. // "request": {
  4371. // "$ref": "Channel",
  4372. // "parameterName": "resource"
  4373. // },
  4374. // "scopes": [
  4375. // "https://www.googleapis.com/auth/cloud-platform",
  4376. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  4377. // "https://www.googleapis.com/auth/devstorage.full_control",
  4378. // "https://www.googleapis.com/auth/devstorage.read_only",
  4379. // "https://www.googleapis.com/auth/devstorage.read_write"
  4380. // ]
  4381. // }
  4382. }
  4383. // method id "storage.defaultObjectAccessControls.delete":
  4384. type DefaultObjectAccessControlsDeleteCall struct {
  4385. s *Service
  4386. bucket string
  4387. entity string
  4388. urlParams_ gensupport.URLParams
  4389. ctx_ context.Context
  4390. header_ http.Header
  4391. }
  4392. // Delete: Permanently deletes the default object ACL entry for the
  4393. // specified entity on the specified bucket.
  4394. func (r *DefaultObjectAccessControlsService) Delete(bucket string, entity string) *DefaultObjectAccessControlsDeleteCall {
  4395. c := &DefaultObjectAccessControlsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4396. c.bucket = bucket
  4397. c.entity = entity
  4398. return c
  4399. }
  4400. // UserProject sets the optional parameter "userProject": The project to
  4401. // be billed for this request. Required for Requester Pays buckets.
  4402. func (c *DefaultObjectAccessControlsDeleteCall) UserProject(userProject string) *DefaultObjectAccessControlsDeleteCall {
  4403. c.urlParams_.Set("userProject", userProject)
  4404. return c
  4405. }
  4406. // Fields allows partial responses to be retrieved. See
  4407. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4408. // for more information.
  4409. func (c *DefaultObjectAccessControlsDeleteCall) Fields(s ...googleapi.Field) *DefaultObjectAccessControlsDeleteCall {
  4410. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4411. return c
  4412. }
  4413. // Context sets the context to be used in this call's Do method. Any
  4414. // pending HTTP request will be aborted if the provided context is
  4415. // canceled.
  4416. func (c *DefaultObjectAccessControlsDeleteCall) Context(ctx context.Context) *DefaultObjectAccessControlsDeleteCall {
  4417. c.ctx_ = ctx
  4418. return c
  4419. }
  4420. // Header returns an http.Header that can be modified by the caller to
  4421. // add HTTP headers to the request.
  4422. func (c *DefaultObjectAccessControlsDeleteCall) Header() http.Header {
  4423. if c.header_ == nil {
  4424. c.header_ = make(http.Header)
  4425. }
  4426. return c.header_
  4427. }
  4428. func (c *DefaultObjectAccessControlsDeleteCall) doRequest(alt string) (*http.Response, error) {
  4429. reqHeaders := make(http.Header)
  4430. for k, v := range c.header_ {
  4431. reqHeaders[k] = v
  4432. }
  4433. reqHeaders.Set("User-Agent", c.s.userAgent())
  4434. var body io.Reader = nil
  4435. c.urlParams_.Set("alt", alt)
  4436. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/defaultObjectAcl/{entity}")
  4437. urls += "?" + c.urlParams_.Encode()
  4438. req, _ := http.NewRequest("DELETE", urls, body)
  4439. req.Header = reqHeaders
  4440. googleapi.Expand(req.URL, map[string]string{
  4441. "bucket": c.bucket,
  4442. "entity": c.entity,
  4443. })
  4444. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4445. }
  4446. // Do executes the "storage.defaultObjectAccessControls.delete" call.
  4447. func (c *DefaultObjectAccessControlsDeleteCall) Do(opts ...googleapi.CallOption) error {
  4448. gensupport.SetOptions(c.urlParams_, opts...)
  4449. res, err := c.doRequest("json")
  4450. if err != nil {
  4451. return err
  4452. }
  4453. defer googleapi.CloseBody(res)
  4454. if err := googleapi.CheckResponse(res); err != nil {
  4455. return err
  4456. }
  4457. return nil
  4458. // {
  4459. // "description": "Permanently deletes the default object ACL entry for the specified entity on the specified bucket.",
  4460. // "httpMethod": "DELETE",
  4461. // "id": "storage.defaultObjectAccessControls.delete",
  4462. // "parameterOrder": [
  4463. // "bucket",
  4464. // "entity"
  4465. // ],
  4466. // "parameters": {
  4467. // "bucket": {
  4468. // "description": "Name of a bucket.",
  4469. // "location": "path",
  4470. // "required": true,
  4471. // "type": "string"
  4472. // },
  4473. // "entity": {
  4474. // "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.",
  4475. // "location": "path",
  4476. // "required": true,
  4477. // "type": "string"
  4478. // },
  4479. // "userProject": {
  4480. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  4481. // "location": "query",
  4482. // "type": "string"
  4483. // }
  4484. // },
  4485. // "path": "b/{bucket}/defaultObjectAcl/{entity}",
  4486. // "scopes": [
  4487. // "https://www.googleapis.com/auth/cloud-platform",
  4488. // "https://www.googleapis.com/auth/devstorage.full_control"
  4489. // ]
  4490. // }
  4491. }
  4492. // method id "storage.defaultObjectAccessControls.get":
  4493. type DefaultObjectAccessControlsGetCall struct {
  4494. s *Service
  4495. bucket string
  4496. entity string
  4497. urlParams_ gensupport.URLParams
  4498. ifNoneMatch_ string
  4499. ctx_ context.Context
  4500. header_ http.Header
  4501. }
  4502. // Get: Returns the default object ACL entry for the specified entity on
  4503. // the specified bucket.
  4504. func (r *DefaultObjectAccessControlsService) Get(bucket string, entity string) *DefaultObjectAccessControlsGetCall {
  4505. c := &DefaultObjectAccessControlsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4506. c.bucket = bucket
  4507. c.entity = entity
  4508. return c
  4509. }
  4510. // UserProject sets the optional parameter "userProject": The project to
  4511. // be billed for this request. Required for Requester Pays buckets.
  4512. func (c *DefaultObjectAccessControlsGetCall) UserProject(userProject string) *DefaultObjectAccessControlsGetCall {
  4513. c.urlParams_.Set("userProject", userProject)
  4514. return c
  4515. }
  4516. // Fields allows partial responses to be retrieved. See
  4517. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4518. // for more information.
  4519. func (c *DefaultObjectAccessControlsGetCall) Fields(s ...googleapi.Field) *DefaultObjectAccessControlsGetCall {
  4520. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4521. return c
  4522. }
  4523. // IfNoneMatch sets the optional parameter which makes the operation
  4524. // fail if the object's ETag matches the given value. This is useful for
  4525. // getting updates only after the object has changed since the last
  4526. // request. Use googleapi.IsNotModified to check whether the response
  4527. // error from Do is the result of In-None-Match.
  4528. func (c *DefaultObjectAccessControlsGetCall) IfNoneMatch(entityTag string) *DefaultObjectAccessControlsGetCall {
  4529. c.ifNoneMatch_ = entityTag
  4530. return c
  4531. }
  4532. // Context sets the context to be used in this call's Do method. Any
  4533. // pending HTTP request will be aborted if the provided context is
  4534. // canceled.
  4535. func (c *DefaultObjectAccessControlsGetCall) Context(ctx context.Context) *DefaultObjectAccessControlsGetCall {
  4536. c.ctx_ = ctx
  4537. return c
  4538. }
  4539. // Header returns an http.Header that can be modified by the caller to
  4540. // add HTTP headers to the request.
  4541. func (c *DefaultObjectAccessControlsGetCall) Header() http.Header {
  4542. if c.header_ == nil {
  4543. c.header_ = make(http.Header)
  4544. }
  4545. return c.header_
  4546. }
  4547. func (c *DefaultObjectAccessControlsGetCall) doRequest(alt string) (*http.Response, error) {
  4548. reqHeaders := make(http.Header)
  4549. for k, v := range c.header_ {
  4550. reqHeaders[k] = v
  4551. }
  4552. reqHeaders.Set("User-Agent", c.s.userAgent())
  4553. if c.ifNoneMatch_ != "" {
  4554. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  4555. }
  4556. var body io.Reader = nil
  4557. c.urlParams_.Set("alt", alt)
  4558. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/defaultObjectAcl/{entity}")
  4559. urls += "?" + c.urlParams_.Encode()
  4560. req, _ := http.NewRequest("GET", urls, body)
  4561. req.Header = reqHeaders
  4562. googleapi.Expand(req.URL, map[string]string{
  4563. "bucket": c.bucket,
  4564. "entity": c.entity,
  4565. })
  4566. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4567. }
  4568. // Do executes the "storage.defaultObjectAccessControls.get" call.
  4569. // Exactly one of *ObjectAccessControl or error will be non-nil. Any
  4570. // non-2xx status code is an error. Response headers are in either
  4571. // *ObjectAccessControl.ServerResponse.Header or (if a response was
  4572. // returned at all) in error.(*googleapi.Error).Header. Use
  4573. // googleapi.IsNotModified to check whether the returned error was
  4574. // because http.StatusNotModified was returned.
  4575. func (c *DefaultObjectAccessControlsGetCall) Do(opts ...googleapi.CallOption) (*ObjectAccessControl, error) {
  4576. gensupport.SetOptions(c.urlParams_, opts...)
  4577. res, err := c.doRequest("json")
  4578. if res != nil && res.StatusCode == http.StatusNotModified {
  4579. if res.Body != nil {
  4580. res.Body.Close()
  4581. }
  4582. return nil, &googleapi.Error{
  4583. Code: res.StatusCode,
  4584. Header: res.Header,
  4585. }
  4586. }
  4587. if err != nil {
  4588. return nil, err
  4589. }
  4590. defer googleapi.CloseBody(res)
  4591. if err := googleapi.CheckResponse(res); err != nil {
  4592. return nil, err
  4593. }
  4594. ret := &ObjectAccessControl{
  4595. ServerResponse: googleapi.ServerResponse{
  4596. Header: res.Header,
  4597. HTTPStatusCode: res.StatusCode,
  4598. },
  4599. }
  4600. target := &ret
  4601. if err := gensupport.DecodeResponse(target, res); err != nil {
  4602. return nil, err
  4603. }
  4604. return ret, nil
  4605. // {
  4606. // "description": "Returns the default object ACL entry for the specified entity on the specified bucket.",
  4607. // "httpMethod": "GET",
  4608. // "id": "storage.defaultObjectAccessControls.get",
  4609. // "parameterOrder": [
  4610. // "bucket",
  4611. // "entity"
  4612. // ],
  4613. // "parameters": {
  4614. // "bucket": {
  4615. // "description": "Name of a bucket.",
  4616. // "location": "path",
  4617. // "required": true,
  4618. // "type": "string"
  4619. // },
  4620. // "entity": {
  4621. // "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.",
  4622. // "location": "path",
  4623. // "required": true,
  4624. // "type": "string"
  4625. // },
  4626. // "userProject": {
  4627. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  4628. // "location": "query",
  4629. // "type": "string"
  4630. // }
  4631. // },
  4632. // "path": "b/{bucket}/defaultObjectAcl/{entity}",
  4633. // "response": {
  4634. // "$ref": "ObjectAccessControl"
  4635. // },
  4636. // "scopes": [
  4637. // "https://www.googleapis.com/auth/cloud-platform",
  4638. // "https://www.googleapis.com/auth/devstorage.full_control"
  4639. // ]
  4640. // }
  4641. }
  4642. // method id "storage.defaultObjectAccessControls.insert":
  4643. type DefaultObjectAccessControlsInsertCall struct {
  4644. s *Service
  4645. bucket string
  4646. objectaccesscontrol *ObjectAccessControl
  4647. urlParams_ gensupport.URLParams
  4648. ctx_ context.Context
  4649. header_ http.Header
  4650. }
  4651. // Insert: Creates a new default object ACL entry on the specified
  4652. // bucket.
  4653. func (r *DefaultObjectAccessControlsService) Insert(bucket string, objectaccesscontrol *ObjectAccessControl) *DefaultObjectAccessControlsInsertCall {
  4654. c := &DefaultObjectAccessControlsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4655. c.bucket = bucket
  4656. c.objectaccesscontrol = objectaccesscontrol
  4657. return c
  4658. }
  4659. // UserProject sets the optional parameter "userProject": The project to
  4660. // be billed for this request. Required for Requester Pays buckets.
  4661. func (c *DefaultObjectAccessControlsInsertCall) UserProject(userProject string) *DefaultObjectAccessControlsInsertCall {
  4662. c.urlParams_.Set("userProject", userProject)
  4663. return c
  4664. }
  4665. // Fields allows partial responses to be retrieved. See
  4666. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4667. // for more information.
  4668. func (c *DefaultObjectAccessControlsInsertCall) Fields(s ...googleapi.Field) *DefaultObjectAccessControlsInsertCall {
  4669. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4670. return c
  4671. }
  4672. // Context sets the context to be used in this call's Do method. Any
  4673. // pending HTTP request will be aborted if the provided context is
  4674. // canceled.
  4675. func (c *DefaultObjectAccessControlsInsertCall) Context(ctx context.Context) *DefaultObjectAccessControlsInsertCall {
  4676. c.ctx_ = ctx
  4677. return c
  4678. }
  4679. // Header returns an http.Header that can be modified by the caller to
  4680. // add HTTP headers to the request.
  4681. func (c *DefaultObjectAccessControlsInsertCall) Header() http.Header {
  4682. if c.header_ == nil {
  4683. c.header_ = make(http.Header)
  4684. }
  4685. return c.header_
  4686. }
  4687. func (c *DefaultObjectAccessControlsInsertCall) doRequest(alt string) (*http.Response, error) {
  4688. reqHeaders := make(http.Header)
  4689. for k, v := range c.header_ {
  4690. reqHeaders[k] = v
  4691. }
  4692. reqHeaders.Set("User-Agent", c.s.userAgent())
  4693. var body io.Reader = nil
  4694. body, err := googleapi.WithoutDataWrapper.JSONReader(c.objectaccesscontrol)
  4695. if err != nil {
  4696. return nil, err
  4697. }
  4698. reqHeaders.Set("Content-Type", "application/json")
  4699. c.urlParams_.Set("alt", alt)
  4700. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/defaultObjectAcl")
  4701. urls += "?" + c.urlParams_.Encode()
  4702. req, _ := http.NewRequest("POST", urls, body)
  4703. req.Header = reqHeaders
  4704. googleapi.Expand(req.URL, map[string]string{
  4705. "bucket": c.bucket,
  4706. })
  4707. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4708. }
  4709. // Do executes the "storage.defaultObjectAccessControls.insert" call.
  4710. // Exactly one of *ObjectAccessControl or error will be non-nil. Any
  4711. // non-2xx status code is an error. Response headers are in either
  4712. // *ObjectAccessControl.ServerResponse.Header or (if a response was
  4713. // returned at all) in error.(*googleapi.Error).Header. Use
  4714. // googleapi.IsNotModified to check whether the returned error was
  4715. // because http.StatusNotModified was returned.
  4716. func (c *DefaultObjectAccessControlsInsertCall) Do(opts ...googleapi.CallOption) (*ObjectAccessControl, error) {
  4717. gensupport.SetOptions(c.urlParams_, opts...)
  4718. res, err := c.doRequest("json")
  4719. if res != nil && res.StatusCode == http.StatusNotModified {
  4720. if res.Body != nil {
  4721. res.Body.Close()
  4722. }
  4723. return nil, &googleapi.Error{
  4724. Code: res.StatusCode,
  4725. Header: res.Header,
  4726. }
  4727. }
  4728. if err != nil {
  4729. return nil, err
  4730. }
  4731. defer googleapi.CloseBody(res)
  4732. if err := googleapi.CheckResponse(res); err != nil {
  4733. return nil, err
  4734. }
  4735. ret := &ObjectAccessControl{
  4736. ServerResponse: googleapi.ServerResponse{
  4737. Header: res.Header,
  4738. HTTPStatusCode: res.StatusCode,
  4739. },
  4740. }
  4741. target := &ret
  4742. if err := gensupport.DecodeResponse(target, res); err != nil {
  4743. return nil, err
  4744. }
  4745. return ret, nil
  4746. // {
  4747. // "description": "Creates a new default object ACL entry on the specified bucket.",
  4748. // "httpMethod": "POST",
  4749. // "id": "storage.defaultObjectAccessControls.insert",
  4750. // "parameterOrder": [
  4751. // "bucket"
  4752. // ],
  4753. // "parameters": {
  4754. // "bucket": {
  4755. // "description": "Name of a bucket.",
  4756. // "location": "path",
  4757. // "required": true,
  4758. // "type": "string"
  4759. // },
  4760. // "userProject": {
  4761. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  4762. // "location": "query",
  4763. // "type": "string"
  4764. // }
  4765. // },
  4766. // "path": "b/{bucket}/defaultObjectAcl",
  4767. // "request": {
  4768. // "$ref": "ObjectAccessControl"
  4769. // },
  4770. // "response": {
  4771. // "$ref": "ObjectAccessControl"
  4772. // },
  4773. // "scopes": [
  4774. // "https://www.googleapis.com/auth/cloud-platform",
  4775. // "https://www.googleapis.com/auth/devstorage.full_control"
  4776. // ]
  4777. // }
  4778. }
  4779. // method id "storage.defaultObjectAccessControls.list":
  4780. type DefaultObjectAccessControlsListCall struct {
  4781. s *Service
  4782. bucket string
  4783. urlParams_ gensupport.URLParams
  4784. ifNoneMatch_ string
  4785. ctx_ context.Context
  4786. header_ http.Header
  4787. }
  4788. // List: Retrieves default object ACL entries on the specified bucket.
  4789. func (r *DefaultObjectAccessControlsService) List(bucket string) *DefaultObjectAccessControlsListCall {
  4790. c := &DefaultObjectAccessControlsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4791. c.bucket = bucket
  4792. return c
  4793. }
  4794. // IfMetagenerationMatch sets the optional parameter
  4795. // "ifMetagenerationMatch": If present, only return default ACL listing
  4796. // if the bucket's current metageneration matches this value.
  4797. func (c *DefaultObjectAccessControlsListCall) IfMetagenerationMatch(ifMetagenerationMatch int64) *DefaultObjectAccessControlsListCall {
  4798. c.urlParams_.Set("ifMetagenerationMatch", fmt.Sprint(ifMetagenerationMatch))
  4799. return c
  4800. }
  4801. // IfMetagenerationNotMatch sets the optional parameter
  4802. // "ifMetagenerationNotMatch": If present, only return default ACL
  4803. // listing if the bucket's current metageneration does not match the
  4804. // given value.
  4805. func (c *DefaultObjectAccessControlsListCall) IfMetagenerationNotMatch(ifMetagenerationNotMatch int64) *DefaultObjectAccessControlsListCall {
  4806. c.urlParams_.Set("ifMetagenerationNotMatch", fmt.Sprint(ifMetagenerationNotMatch))
  4807. return c
  4808. }
  4809. // UserProject sets the optional parameter "userProject": The project to
  4810. // be billed for this request. Required for Requester Pays buckets.
  4811. func (c *DefaultObjectAccessControlsListCall) UserProject(userProject string) *DefaultObjectAccessControlsListCall {
  4812. c.urlParams_.Set("userProject", userProject)
  4813. return c
  4814. }
  4815. // Fields allows partial responses to be retrieved. See
  4816. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4817. // for more information.
  4818. func (c *DefaultObjectAccessControlsListCall) Fields(s ...googleapi.Field) *DefaultObjectAccessControlsListCall {
  4819. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4820. return c
  4821. }
  4822. // IfNoneMatch sets the optional parameter which makes the operation
  4823. // fail if the object's ETag matches the given value. This is useful for
  4824. // getting updates only after the object has changed since the last
  4825. // request. Use googleapi.IsNotModified to check whether the response
  4826. // error from Do is the result of In-None-Match.
  4827. func (c *DefaultObjectAccessControlsListCall) IfNoneMatch(entityTag string) *DefaultObjectAccessControlsListCall {
  4828. c.ifNoneMatch_ = entityTag
  4829. return c
  4830. }
  4831. // Context sets the context to be used in this call's Do method. Any
  4832. // pending HTTP request will be aborted if the provided context is
  4833. // canceled.
  4834. func (c *DefaultObjectAccessControlsListCall) Context(ctx context.Context) *DefaultObjectAccessControlsListCall {
  4835. c.ctx_ = ctx
  4836. return c
  4837. }
  4838. // Header returns an http.Header that can be modified by the caller to
  4839. // add HTTP headers to the request.
  4840. func (c *DefaultObjectAccessControlsListCall) Header() http.Header {
  4841. if c.header_ == nil {
  4842. c.header_ = make(http.Header)
  4843. }
  4844. return c.header_
  4845. }
  4846. func (c *DefaultObjectAccessControlsListCall) doRequest(alt string) (*http.Response, error) {
  4847. reqHeaders := make(http.Header)
  4848. for k, v := range c.header_ {
  4849. reqHeaders[k] = v
  4850. }
  4851. reqHeaders.Set("User-Agent", c.s.userAgent())
  4852. if c.ifNoneMatch_ != "" {
  4853. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  4854. }
  4855. var body io.Reader = nil
  4856. c.urlParams_.Set("alt", alt)
  4857. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/defaultObjectAcl")
  4858. urls += "?" + c.urlParams_.Encode()
  4859. req, _ := http.NewRequest("GET", urls, body)
  4860. req.Header = reqHeaders
  4861. googleapi.Expand(req.URL, map[string]string{
  4862. "bucket": c.bucket,
  4863. })
  4864. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4865. }
  4866. // Do executes the "storage.defaultObjectAccessControls.list" call.
  4867. // Exactly one of *ObjectAccessControls or error will be non-nil. Any
  4868. // non-2xx status code is an error. Response headers are in either
  4869. // *ObjectAccessControls.ServerResponse.Header or (if a response was
  4870. // returned at all) in error.(*googleapi.Error).Header. Use
  4871. // googleapi.IsNotModified to check whether the returned error was
  4872. // because http.StatusNotModified was returned.
  4873. func (c *DefaultObjectAccessControlsListCall) Do(opts ...googleapi.CallOption) (*ObjectAccessControls, error) {
  4874. gensupport.SetOptions(c.urlParams_, opts...)
  4875. res, err := c.doRequest("json")
  4876. if res != nil && res.StatusCode == http.StatusNotModified {
  4877. if res.Body != nil {
  4878. res.Body.Close()
  4879. }
  4880. return nil, &googleapi.Error{
  4881. Code: res.StatusCode,
  4882. Header: res.Header,
  4883. }
  4884. }
  4885. if err != nil {
  4886. return nil, err
  4887. }
  4888. defer googleapi.CloseBody(res)
  4889. if err := googleapi.CheckResponse(res); err != nil {
  4890. return nil, err
  4891. }
  4892. ret := &ObjectAccessControls{
  4893. ServerResponse: googleapi.ServerResponse{
  4894. Header: res.Header,
  4895. HTTPStatusCode: res.StatusCode,
  4896. },
  4897. }
  4898. target := &ret
  4899. if err := gensupport.DecodeResponse(target, res); err != nil {
  4900. return nil, err
  4901. }
  4902. return ret, nil
  4903. // {
  4904. // "description": "Retrieves default object ACL entries on the specified bucket.",
  4905. // "httpMethod": "GET",
  4906. // "id": "storage.defaultObjectAccessControls.list",
  4907. // "parameterOrder": [
  4908. // "bucket"
  4909. // ],
  4910. // "parameters": {
  4911. // "bucket": {
  4912. // "description": "Name of a bucket.",
  4913. // "location": "path",
  4914. // "required": true,
  4915. // "type": "string"
  4916. // },
  4917. // "ifMetagenerationMatch": {
  4918. // "description": "If present, only return default ACL listing if the bucket's current metageneration matches this value.",
  4919. // "format": "int64",
  4920. // "location": "query",
  4921. // "type": "string"
  4922. // },
  4923. // "ifMetagenerationNotMatch": {
  4924. // "description": "If present, only return default ACL listing if the bucket's current metageneration does not match the given value.",
  4925. // "format": "int64",
  4926. // "location": "query",
  4927. // "type": "string"
  4928. // },
  4929. // "userProject": {
  4930. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  4931. // "location": "query",
  4932. // "type": "string"
  4933. // }
  4934. // },
  4935. // "path": "b/{bucket}/defaultObjectAcl",
  4936. // "response": {
  4937. // "$ref": "ObjectAccessControls"
  4938. // },
  4939. // "scopes": [
  4940. // "https://www.googleapis.com/auth/cloud-platform",
  4941. // "https://www.googleapis.com/auth/devstorage.full_control"
  4942. // ]
  4943. // }
  4944. }
  4945. // method id "storage.defaultObjectAccessControls.patch":
  4946. type DefaultObjectAccessControlsPatchCall struct {
  4947. s *Service
  4948. bucket string
  4949. entity string
  4950. objectaccesscontrol *ObjectAccessControl
  4951. urlParams_ gensupport.URLParams
  4952. ctx_ context.Context
  4953. header_ http.Header
  4954. }
  4955. // Patch: Updates a default object ACL entry on the specified bucket.
  4956. // This method supports patch semantics.
  4957. func (r *DefaultObjectAccessControlsService) Patch(bucket string, entity string, objectaccesscontrol *ObjectAccessControl) *DefaultObjectAccessControlsPatchCall {
  4958. c := &DefaultObjectAccessControlsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4959. c.bucket = bucket
  4960. c.entity = entity
  4961. c.objectaccesscontrol = objectaccesscontrol
  4962. return c
  4963. }
  4964. // UserProject sets the optional parameter "userProject": The project to
  4965. // be billed for this request. Required for Requester Pays buckets.
  4966. func (c *DefaultObjectAccessControlsPatchCall) UserProject(userProject string) *DefaultObjectAccessControlsPatchCall {
  4967. c.urlParams_.Set("userProject", userProject)
  4968. return c
  4969. }
  4970. // Fields allows partial responses to be retrieved. See
  4971. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4972. // for more information.
  4973. func (c *DefaultObjectAccessControlsPatchCall) Fields(s ...googleapi.Field) *DefaultObjectAccessControlsPatchCall {
  4974. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4975. return c
  4976. }
  4977. // Context sets the context to be used in this call's Do method. Any
  4978. // pending HTTP request will be aborted if the provided context is
  4979. // canceled.
  4980. func (c *DefaultObjectAccessControlsPatchCall) Context(ctx context.Context) *DefaultObjectAccessControlsPatchCall {
  4981. c.ctx_ = ctx
  4982. return c
  4983. }
  4984. // Header returns an http.Header that can be modified by the caller to
  4985. // add HTTP headers to the request.
  4986. func (c *DefaultObjectAccessControlsPatchCall) Header() http.Header {
  4987. if c.header_ == nil {
  4988. c.header_ = make(http.Header)
  4989. }
  4990. return c.header_
  4991. }
  4992. func (c *DefaultObjectAccessControlsPatchCall) doRequest(alt string) (*http.Response, error) {
  4993. reqHeaders := make(http.Header)
  4994. for k, v := range c.header_ {
  4995. reqHeaders[k] = v
  4996. }
  4997. reqHeaders.Set("User-Agent", c.s.userAgent())
  4998. var body io.Reader = nil
  4999. body, err := googleapi.WithoutDataWrapper.JSONReader(c.objectaccesscontrol)
  5000. if err != nil {
  5001. return nil, err
  5002. }
  5003. reqHeaders.Set("Content-Type", "application/json")
  5004. c.urlParams_.Set("alt", alt)
  5005. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/defaultObjectAcl/{entity}")
  5006. urls += "?" + c.urlParams_.Encode()
  5007. req, _ := http.NewRequest("PATCH", urls, body)
  5008. req.Header = reqHeaders
  5009. googleapi.Expand(req.URL, map[string]string{
  5010. "bucket": c.bucket,
  5011. "entity": c.entity,
  5012. })
  5013. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5014. }
  5015. // Do executes the "storage.defaultObjectAccessControls.patch" call.
  5016. // Exactly one of *ObjectAccessControl or error will be non-nil. Any
  5017. // non-2xx status code is an error. Response headers are in either
  5018. // *ObjectAccessControl.ServerResponse.Header or (if a response was
  5019. // returned at all) in error.(*googleapi.Error).Header. Use
  5020. // googleapi.IsNotModified to check whether the returned error was
  5021. // because http.StatusNotModified was returned.
  5022. func (c *DefaultObjectAccessControlsPatchCall) Do(opts ...googleapi.CallOption) (*ObjectAccessControl, error) {
  5023. gensupport.SetOptions(c.urlParams_, opts...)
  5024. res, err := c.doRequest("json")
  5025. if res != nil && res.StatusCode == http.StatusNotModified {
  5026. if res.Body != nil {
  5027. res.Body.Close()
  5028. }
  5029. return nil, &googleapi.Error{
  5030. Code: res.StatusCode,
  5031. Header: res.Header,
  5032. }
  5033. }
  5034. if err != nil {
  5035. return nil, err
  5036. }
  5037. defer googleapi.CloseBody(res)
  5038. if err := googleapi.CheckResponse(res); err != nil {
  5039. return nil, err
  5040. }
  5041. ret := &ObjectAccessControl{
  5042. ServerResponse: googleapi.ServerResponse{
  5043. Header: res.Header,
  5044. HTTPStatusCode: res.StatusCode,
  5045. },
  5046. }
  5047. target := &ret
  5048. if err := gensupport.DecodeResponse(target, res); err != nil {
  5049. return nil, err
  5050. }
  5051. return ret, nil
  5052. // {
  5053. // "description": "Updates a default object ACL entry on the specified bucket. This method supports patch semantics.",
  5054. // "httpMethod": "PATCH",
  5055. // "id": "storage.defaultObjectAccessControls.patch",
  5056. // "parameterOrder": [
  5057. // "bucket",
  5058. // "entity"
  5059. // ],
  5060. // "parameters": {
  5061. // "bucket": {
  5062. // "description": "Name of a bucket.",
  5063. // "location": "path",
  5064. // "required": true,
  5065. // "type": "string"
  5066. // },
  5067. // "entity": {
  5068. // "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.",
  5069. // "location": "path",
  5070. // "required": true,
  5071. // "type": "string"
  5072. // },
  5073. // "userProject": {
  5074. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  5075. // "location": "query",
  5076. // "type": "string"
  5077. // }
  5078. // },
  5079. // "path": "b/{bucket}/defaultObjectAcl/{entity}",
  5080. // "request": {
  5081. // "$ref": "ObjectAccessControl"
  5082. // },
  5083. // "response": {
  5084. // "$ref": "ObjectAccessControl"
  5085. // },
  5086. // "scopes": [
  5087. // "https://www.googleapis.com/auth/cloud-platform",
  5088. // "https://www.googleapis.com/auth/devstorage.full_control"
  5089. // ]
  5090. // }
  5091. }
  5092. // method id "storage.defaultObjectAccessControls.update":
  5093. type DefaultObjectAccessControlsUpdateCall struct {
  5094. s *Service
  5095. bucket string
  5096. entity string
  5097. objectaccesscontrol *ObjectAccessControl
  5098. urlParams_ gensupport.URLParams
  5099. ctx_ context.Context
  5100. header_ http.Header
  5101. }
  5102. // Update: Updates a default object ACL entry on the specified bucket.
  5103. func (r *DefaultObjectAccessControlsService) Update(bucket string, entity string, objectaccesscontrol *ObjectAccessControl) *DefaultObjectAccessControlsUpdateCall {
  5104. c := &DefaultObjectAccessControlsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5105. c.bucket = bucket
  5106. c.entity = entity
  5107. c.objectaccesscontrol = objectaccesscontrol
  5108. return c
  5109. }
  5110. // UserProject sets the optional parameter "userProject": The project to
  5111. // be billed for this request. Required for Requester Pays buckets.
  5112. func (c *DefaultObjectAccessControlsUpdateCall) UserProject(userProject string) *DefaultObjectAccessControlsUpdateCall {
  5113. c.urlParams_.Set("userProject", userProject)
  5114. return c
  5115. }
  5116. // Fields allows partial responses to be retrieved. See
  5117. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5118. // for more information.
  5119. func (c *DefaultObjectAccessControlsUpdateCall) Fields(s ...googleapi.Field) *DefaultObjectAccessControlsUpdateCall {
  5120. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5121. return c
  5122. }
  5123. // Context sets the context to be used in this call's Do method. Any
  5124. // pending HTTP request will be aborted if the provided context is
  5125. // canceled.
  5126. func (c *DefaultObjectAccessControlsUpdateCall) Context(ctx context.Context) *DefaultObjectAccessControlsUpdateCall {
  5127. c.ctx_ = ctx
  5128. return c
  5129. }
  5130. // Header returns an http.Header that can be modified by the caller to
  5131. // add HTTP headers to the request.
  5132. func (c *DefaultObjectAccessControlsUpdateCall) Header() http.Header {
  5133. if c.header_ == nil {
  5134. c.header_ = make(http.Header)
  5135. }
  5136. return c.header_
  5137. }
  5138. func (c *DefaultObjectAccessControlsUpdateCall) doRequest(alt string) (*http.Response, error) {
  5139. reqHeaders := make(http.Header)
  5140. for k, v := range c.header_ {
  5141. reqHeaders[k] = v
  5142. }
  5143. reqHeaders.Set("User-Agent", c.s.userAgent())
  5144. var body io.Reader = nil
  5145. body, err := googleapi.WithoutDataWrapper.JSONReader(c.objectaccesscontrol)
  5146. if err != nil {
  5147. return nil, err
  5148. }
  5149. reqHeaders.Set("Content-Type", "application/json")
  5150. c.urlParams_.Set("alt", alt)
  5151. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/defaultObjectAcl/{entity}")
  5152. urls += "?" + c.urlParams_.Encode()
  5153. req, _ := http.NewRequest("PUT", urls, body)
  5154. req.Header = reqHeaders
  5155. googleapi.Expand(req.URL, map[string]string{
  5156. "bucket": c.bucket,
  5157. "entity": c.entity,
  5158. })
  5159. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5160. }
  5161. // Do executes the "storage.defaultObjectAccessControls.update" call.
  5162. // Exactly one of *ObjectAccessControl or error will be non-nil. Any
  5163. // non-2xx status code is an error. Response headers are in either
  5164. // *ObjectAccessControl.ServerResponse.Header or (if a response was
  5165. // returned at all) in error.(*googleapi.Error).Header. Use
  5166. // googleapi.IsNotModified to check whether the returned error was
  5167. // because http.StatusNotModified was returned.
  5168. func (c *DefaultObjectAccessControlsUpdateCall) Do(opts ...googleapi.CallOption) (*ObjectAccessControl, error) {
  5169. gensupport.SetOptions(c.urlParams_, opts...)
  5170. res, err := c.doRequest("json")
  5171. if res != nil && res.StatusCode == http.StatusNotModified {
  5172. if res.Body != nil {
  5173. res.Body.Close()
  5174. }
  5175. return nil, &googleapi.Error{
  5176. Code: res.StatusCode,
  5177. Header: res.Header,
  5178. }
  5179. }
  5180. if err != nil {
  5181. return nil, err
  5182. }
  5183. defer googleapi.CloseBody(res)
  5184. if err := googleapi.CheckResponse(res); err != nil {
  5185. return nil, err
  5186. }
  5187. ret := &ObjectAccessControl{
  5188. ServerResponse: googleapi.ServerResponse{
  5189. Header: res.Header,
  5190. HTTPStatusCode: res.StatusCode,
  5191. },
  5192. }
  5193. target := &ret
  5194. if err := gensupport.DecodeResponse(target, res); err != nil {
  5195. return nil, err
  5196. }
  5197. return ret, nil
  5198. // {
  5199. // "description": "Updates a default object ACL entry on the specified bucket.",
  5200. // "httpMethod": "PUT",
  5201. // "id": "storage.defaultObjectAccessControls.update",
  5202. // "parameterOrder": [
  5203. // "bucket",
  5204. // "entity"
  5205. // ],
  5206. // "parameters": {
  5207. // "bucket": {
  5208. // "description": "Name of a bucket.",
  5209. // "location": "path",
  5210. // "required": true,
  5211. // "type": "string"
  5212. // },
  5213. // "entity": {
  5214. // "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.",
  5215. // "location": "path",
  5216. // "required": true,
  5217. // "type": "string"
  5218. // },
  5219. // "userProject": {
  5220. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  5221. // "location": "query",
  5222. // "type": "string"
  5223. // }
  5224. // },
  5225. // "path": "b/{bucket}/defaultObjectAcl/{entity}",
  5226. // "request": {
  5227. // "$ref": "ObjectAccessControl"
  5228. // },
  5229. // "response": {
  5230. // "$ref": "ObjectAccessControl"
  5231. // },
  5232. // "scopes": [
  5233. // "https://www.googleapis.com/auth/cloud-platform",
  5234. // "https://www.googleapis.com/auth/devstorage.full_control"
  5235. // ]
  5236. // }
  5237. }
  5238. // method id "storage.notifications.delete":
  5239. type NotificationsDeleteCall struct {
  5240. s *Service
  5241. bucket string
  5242. notification string
  5243. urlParams_ gensupport.URLParams
  5244. ctx_ context.Context
  5245. header_ http.Header
  5246. }
  5247. // Delete: Permanently deletes a notification subscription.
  5248. func (r *NotificationsService) Delete(bucket string, notification string) *NotificationsDeleteCall {
  5249. c := &NotificationsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5250. c.bucket = bucket
  5251. c.notification = notification
  5252. return c
  5253. }
  5254. // UserProject sets the optional parameter "userProject": The project to
  5255. // be billed for this request. Required for Requester Pays buckets.
  5256. func (c *NotificationsDeleteCall) UserProject(userProject string) *NotificationsDeleteCall {
  5257. c.urlParams_.Set("userProject", userProject)
  5258. return c
  5259. }
  5260. // Fields allows partial responses to be retrieved. See
  5261. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5262. // for more information.
  5263. func (c *NotificationsDeleteCall) Fields(s ...googleapi.Field) *NotificationsDeleteCall {
  5264. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5265. return c
  5266. }
  5267. // Context sets the context to be used in this call's Do method. Any
  5268. // pending HTTP request will be aborted if the provided context is
  5269. // canceled.
  5270. func (c *NotificationsDeleteCall) Context(ctx context.Context) *NotificationsDeleteCall {
  5271. c.ctx_ = ctx
  5272. return c
  5273. }
  5274. // Header returns an http.Header that can be modified by the caller to
  5275. // add HTTP headers to the request.
  5276. func (c *NotificationsDeleteCall) Header() http.Header {
  5277. if c.header_ == nil {
  5278. c.header_ = make(http.Header)
  5279. }
  5280. return c.header_
  5281. }
  5282. func (c *NotificationsDeleteCall) doRequest(alt string) (*http.Response, error) {
  5283. reqHeaders := make(http.Header)
  5284. for k, v := range c.header_ {
  5285. reqHeaders[k] = v
  5286. }
  5287. reqHeaders.Set("User-Agent", c.s.userAgent())
  5288. var body io.Reader = nil
  5289. c.urlParams_.Set("alt", alt)
  5290. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/notificationConfigs/{notification}")
  5291. urls += "?" + c.urlParams_.Encode()
  5292. req, _ := http.NewRequest("DELETE", urls, body)
  5293. req.Header = reqHeaders
  5294. googleapi.Expand(req.URL, map[string]string{
  5295. "bucket": c.bucket,
  5296. "notification": c.notification,
  5297. })
  5298. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5299. }
  5300. // Do executes the "storage.notifications.delete" call.
  5301. func (c *NotificationsDeleteCall) Do(opts ...googleapi.CallOption) error {
  5302. gensupport.SetOptions(c.urlParams_, opts...)
  5303. res, err := c.doRequest("json")
  5304. if err != nil {
  5305. return err
  5306. }
  5307. defer googleapi.CloseBody(res)
  5308. if err := googleapi.CheckResponse(res); err != nil {
  5309. return err
  5310. }
  5311. return nil
  5312. // {
  5313. // "description": "Permanently deletes a notification subscription.",
  5314. // "httpMethod": "DELETE",
  5315. // "id": "storage.notifications.delete",
  5316. // "parameterOrder": [
  5317. // "bucket",
  5318. // "notification"
  5319. // ],
  5320. // "parameters": {
  5321. // "bucket": {
  5322. // "description": "The parent bucket of the notification.",
  5323. // "location": "path",
  5324. // "required": true,
  5325. // "type": "string"
  5326. // },
  5327. // "notification": {
  5328. // "description": "ID of the notification to delete.",
  5329. // "location": "path",
  5330. // "required": true,
  5331. // "type": "string"
  5332. // },
  5333. // "userProject": {
  5334. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  5335. // "location": "query",
  5336. // "type": "string"
  5337. // }
  5338. // },
  5339. // "path": "b/{bucket}/notificationConfigs/{notification}",
  5340. // "scopes": [
  5341. // "https://www.googleapis.com/auth/cloud-platform",
  5342. // "https://www.googleapis.com/auth/devstorage.full_control",
  5343. // "https://www.googleapis.com/auth/devstorage.read_write"
  5344. // ]
  5345. // }
  5346. }
  5347. // method id "storage.notifications.get":
  5348. type NotificationsGetCall struct {
  5349. s *Service
  5350. bucket string
  5351. notification string
  5352. urlParams_ gensupport.URLParams
  5353. ifNoneMatch_ string
  5354. ctx_ context.Context
  5355. header_ http.Header
  5356. }
  5357. // Get: View a notification configuration.
  5358. func (r *NotificationsService) Get(bucket string, notification string) *NotificationsGetCall {
  5359. c := &NotificationsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5360. c.bucket = bucket
  5361. c.notification = notification
  5362. return c
  5363. }
  5364. // UserProject sets the optional parameter "userProject": The project to
  5365. // be billed for this request. Required for Requester Pays buckets.
  5366. func (c *NotificationsGetCall) UserProject(userProject string) *NotificationsGetCall {
  5367. c.urlParams_.Set("userProject", userProject)
  5368. return c
  5369. }
  5370. // Fields allows partial responses to be retrieved. See
  5371. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5372. // for more information.
  5373. func (c *NotificationsGetCall) Fields(s ...googleapi.Field) *NotificationsGetCall {
  5374. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5375. return c
  5376. }
  5377. // IfNoneMatch sets the optional parameter which makes the operation
  5378. // fail if the object's ETag matches the given value. This is useful for
  5379. // getting updates only after the object has changed since the last
  5380. // request. Use googleapi.IsNotModified to check whether the response
  5381. // error from Do is the result of In-None-Match.
  5382. func (c *NotificationsGetCall) IfNoneMatch(entityTag string) *NotificationsGetCall {
  5383. c.ifNoneMatch_ = entityTag
  5384. return c
  5385. }
  5386. // Context sets the context to be used in this call's Do method. Any
  5387. // pending HTTP request will be aborted if the provided context is
  5388. // canceled.
  5389. func (c *NotificationsGetCall) Context(ctx context.Context) *NotificationsGetCall {
  5390. c.ctx_ = ctx
  5391. return c
  5392. }
  5393. // Header returns an http.Header that can be modified by the caller to
  5394. // add HTTP headers to the request.
  5395. func (c *NotificationsGetCall) Header() http.Header {
  5396. if c.header_ == nil {
  5397. c.header_ = make(http.Header)
  5398. }
  5399. return c.header_
  5400. }
  5401. func (c *NotificationsGetCall) doRequest(alt string) (*http.Response, error) {
  5402. reqHeaders := make(http.Header)
  5403. for k, v := range c.header_ {
  5404. reqHeaders[k] = v
  5405. }
  5406. reqHeaders.Set("User-Agent", c.s.userAgent())
  5407. if c.ifNoneMatch_ != "" {
  5408. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  5409. }
  5410. var body io.Reader = nil
  5411. c.urlParams_.Set("alt", alt)
  5412. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/notificationConfigs/{notification}")
  5413. urls += "?" + c.urlParams_.Encode()
  5414. req, _ := http.NewRequest("GET", urls, body)
  5415. req.Header = reqHeaders
  5416. googleapi.Expand(req.URL, map[string]string{
  5417. "bucket": c.bucket,
  5418. "notification": c.notification,
  5419. })
  5420. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5421. }
  5422. // Do executes the "storage.notifications.get" call.
  5423. // Exactly one of *Notification or error will be non-nil. Any non-2xx
  5424. // status code is an error. Response headers are in either
  5425. // *Notification.ServerResponse.Header or (if a response was returned at
  5426. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  5427. // to check whether the returned error was because
  5428. // http.StatusNotModified was returned.
  5429. func (c *NotificationsGetCall) Do(opts ...googleapi.CallOption) (*Notification, error) {
  5430. gensupport.SetOptions(c.urlParams_, opts...)
  5431. res, err := c.doRequest("json")
  5432. if res != nil && res.StatusCode == http.StatusNotModified {
  5433. if res.Body != nil {
  5434. res.Body.Close()
  5435. }
  5436. return nil, &googleapi.Error{
  5437. Code: res.StatusCode,
  5438. Header: res.Header,
  5439. }
  5440. }
  5441. if err != nil {
  5442. return nil, err
  5443. }
  5444. defer googleapi.CloseBody(res)
  5445. if err := googleapi.CheckResponse(res); err != nil {
  5446. return nil, err
  5447. }
  5448. ret := &Notification{
  5449. ServerResponse: googleapi.ServerResponse{
  5450. Header: res.Header,
  5451. HTTPStatusCode: res.StatusCode,
  5452. },
  5453. }
  5454. target := &ret
  5455. if err := gensupport.DecodeResponse(target, res); err != nil {
  5456. return nil, err
  5457. }
  5458. return ret, nil
  5459. // {
  5460. // "description": "View a notification configuration.",
  5461. // "httpMethod": "GET",
  5462. // "id": "storage.notifications.get",
  5463. // "parameterOrder": [
  5464. // "bucket",
  5465. // "notification"
  5466. // ],
  5467. // "parameters": {
  5468. // "bucket": {
  5469. // "description": "The parent bucket of the notification.",
  5470. // "location": "path",
  5471. // "required": true,
  5472. // "type": "string"
  5473. // },
  5474. // "notification": {
  5475. // "description": "Notification ID",
  5476. // "location": "path",
  5477. // "required": true,
  5478. // "type": "string"
  5479. // },
  5480. // "userProject": {
  5481. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  5482. // "location": "query",
  5483. // "type": "string"
  5484. // }
  5485. // },
  5486. // "path": "b/{bucket}/notificationConfigs/{notification}",
  5487. // "response": {
  5488. // "$ref": "Notification"
  5489. // },
  5490. // "scopes": [
  5491. // "https://www.googleapis.com/auth/cloud-platform",
  5492. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  5493. // "https://www.googleapis.com/auth/devstorage.full_control",
  5494. // "https://www.googleapis.com/auth/devstorage.read_only",
  5495. // "https://www.googleapis.com/auth/devstorage.read_write"
  5496. // ]
  5497. // }
  5498. }
  5499. // method id "storage.notifications.insert":
  5500. type NotificationsInsertCall struct {
  5501. s *Service
  5502. bucket string
  5503. notification *Notification
  5504. urlParams_ gensupport.URLParams
  5505. ctx_ context.Context
  5506. header_ http.Header
  5507. }
  5508. // Insert: Creates a notification subscription for a given bucket.
  5509. func (r *NotificationsService) Insert(bucket string, notification *Notification) *NotificationsInsertCall {
  5510. c := &NotificationsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5511. c.bucket = bucket
  5512. c.notification = notification
  5513. return c
  5514. }
  5515. // UserProject sets the optional parameter "userProject": The project to
  5516. // be billed for this request. Required for Requester Pays buckets.
  5517. func (c *NotificationsInsertCall) UserProject(userProject string) *NotificationsInsertCall {
  5518. c.urlParams_.Set("userProject", userProject)
  5519. return c
  5520. }
  5521. // Fields allows partial responses to be retrieved. See
  5522. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5523. // for more information.
  5524. func (c *NotificationsInsertCall) Fields(s ...googleapi.Field) *NotificationsInsertCall {
  5525. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5526. return c
  5527. }
  5528. // Context sets the context to be used in this call's Do method. Any
  5529. // pending HTTP request will be aborted if the provided context is
  5530. // canceled.
  5531. func (c *NotificationsInsertCall) Context(ctx context.Context) *NotificationsInsertCall {
  5532. c.ctx_ = ctx
  5533. return c
  5534. }
  5535. // Header returns an http.Header that can be modified by the caller to
  5536. // add HTTP headers to the request.
  5537. func (c *NotificationsInsertCall) Header() http.Header {
  5538. if c.header_ == nil {
  5539. c.header_ = make(http.Header)
  5540. }
  5541. return c.header_
  5542. }
  5543. func (c *NotificationsInsertCall) doRequest(alt string) (*http.Response, error) {
  5544. reqHeaders := make(http.Header)
  5545. for k, v := range c.header_ {
  5546. reqHeaders[k] = v
  5547. }
  5548. reqHeaders.Set("User-Agent", c.s.userAgent())
  5549. var body io.Reader = nil
  5550. body, err := googleapi.WithoutDataWrapper.JSONReader(c.notification)
  5551. if err != nil {
  5552. return nil, err
  5553. }
  5554. reqHeaders.Set("Content-Type", "application/json")
  5555. c.urlParams_.Set("alt", alt)
  5556. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/notificationConfigs")
  5557. urls += "?" + c.urlParams_.Encode()
  5558. req, _ := http.NewRequest("POST", urls, body)
  5559. req.Header = reqHeaders
  5560. googleapi.Expand(req.URL, map[string]string{
  5561. "bucket": c.bucket,
  5562. })
  5563. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5564. }
  5565. // Do executes the "storage.notifications.insert" call.
  5566. // Exactly one of *Notification or error will be non-nil. Any non-2xx
  5567. // status code is an error. Response headers are in either
  5568. // *Notification.ServerResponse.Header or (if a response was returned at
  5569. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  5570. // to check whether the returned error was because
  5571. // http.StatusNotModified was returned.
  5572. func (c *NotificationsInsertCall) Do(opts ...googleapi.CallOption) (*Notification, error) {
  5573. gensupport.SetOptions(c.urlParams_, opts...)
  5574. res, err := c.doRequest("json")
  5575. if res != nil && res.StatusCode == http.StatusNotModified {
  5576. if res.Body != nil {
  5577. res.Body.Close()
  5578. }
  5579. return nil, &googleapi.Error{
  5580. Code: res.StatusCode,
  5581. Header: res.Header,
  5582. }
  5583. }
  5584. if err != nil {
  5585. return nil, err
  5586. }
  5587. defer googleapi.CloseBody(res)
  5588. if err := googleapi.CheckResponse(res); err != nil {
  5589. return nil, err
  5590. }
  5591. ret := &Notification{
  5592. ServerResponse: googleapi.ServerResponse{
  5593. Header: res.Header,
  5594. HTTPStatusCode: res.StatusCode,
  5595. },
  5596. }
  5597. target := &ret
  5598. if err := gensupport.DecodeResponse(target, res); err != nil {
  5599. return nil, err
  5600. }
  5601. return ret, nil
  5602. // {
  5603. // "description": "Creates a notification subscription for a given bucket.",
  5604. // "httpMethod": "POST",
  5605. // "id": "storage.notifications.insert",
  5606. // "parameterOrder": [
  5607. // "bucket"
  5608. // ],
  5609. // "parameters": {
  5610. // "bucket": {
  5611. // "description": "The parent bucket of the notification.",
  5612. // "location": "path",
  5613. // "required": true,
  5614. // "type": "string"
  5615. // },
  5616. // "userProject": {
  5617. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  5618. // "location": "query",
  5619. // "type": "string"
  5620. // }
  5621. // },
  5622. // "path": "b/{bucket}/notificationConfigs",
  5623. // "request": {
  5624. // "$ref": "Notification"
  5625. // },
  5626. // "response": {
  5627. // "$ref": "Notification"
  5628. // },
  5629. // "scopes": [
  5630. // "https://www.googleapis.com/auth/cloud-platform",
  5631. // "https://www.googleapis.com/auth/devstorage.full_control",
  5632. // "https://www.googleapis.com/auth/devstorage.read_write"
  5633. // ]
  5634. // }
  5635. }
  5636. // method id "storage.notifications.list":
  5637. type NotificationsListCall struct {
  5638. s *Service
  5639. bucket string
  5640. urlParams_ gensupport.URLParams
  5641. ifNoneMatch_ string
  5642. ctx_ context.Context
  5643. header_ http.Header
  5644. }
  5645. // List: Retrieves a list of notification subscriptions for a given
  5646. // bucket.
  5647. func (r *NotificationsService) List(bucket string) *NotificationsListCall {
  5648. c := &NotificationsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5649. c.bucket = bucket
  5650. return c
  5651. }
  5652. // UserProject sets the optional parameter "userProject": The project to
  5653. // be billed for this request. Required for Requester Pays buckets.
  5654. func (c *NotificationsListCall) UserProject(userProject string) *NotificationsListCall {
  5655. c.urlParams_.Set("userProject", userProject)
  5656. return c
  5657. }
  5658. // Fields allows partial responses to be retrieved. See
  5659. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5660. // for more information.
  5661. func (c *NotificationsListCall) Fields(s ...googleapi.Field) *NotificationsListCall {
  5662. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5663. return c
  5664. }
  5665. // IfNoneMatch sets the optional parameter which makes the operation
  5666. // fail if the object's ETag matches the given value. This is useful for
  5667. // getting updates only after the object has changed since the last
  5668. // request. Use googleapi.IsNotModified to check whether the response
  5669. // error from Do is the result of In-None-Match.
  5670. func (c *NotificationsListCall) IfNoneMatch(entityTag string) *NotificationsListCall {
  5671. c.ifNoneMatch_ = entityTag
  5672. return c
  5673. }
  5674. // Context sets the context to be used in this call's Do method. Any
  5675. // pending HTTP request will be aborted if the provided context is
  5676. // canceled.
  5677. func (c *NotificationsListCall) Context(ctx context.Context) *NotificationsListCall {
  5678. c.ctx_ = ctx
  5679. return c
  5680. }
  5681. // Header returns an http.Header that can be modified by the caller to
  5682. // add HTTP headers to the request.
  5683. func (c *NotificationsListCall) Header() http.Header {
  5684. if c.header_ == nil {
  5685. c.header_ = make(http.Header)
  5686. }
  5687. return c.header_
  5688. }
  5689. func (c *NotificationsListCall) doRequest(alt string) (*http.Response, error) {
  5690. reqHeaders := make(http.Header)
  5691. for k, v := range c.header_ {
  5692. reqHeaders[k] = v
  5693. }
  5694. reqHeaders.Set("User-Agent", c.s.userAgent())
  5695. if c.ifNoneMatch_ != "" {
  5696. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  5697. }
  5698. var body io.Reader = nil
  5699. c.urlParams_.Set("alt", alt)
  5700. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/notificationConfigs")
  5701. urls += "?" + c.urlParams_.Encode()
  5702. req, _ := http.NewRequest("GET", urls, body)
  5703. req.Header = reqHeaders
  5704. googleapi.Expand(req.URL, map[string]string{
  5705. "bucket": c.bucket,
  5706. })
  5707. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5708. }
  5709. // Do executes the "storage.notifications.list" call.
  5710. // Exactly one of *Notifications or error will be non-nil. Any non-2xx
  5711. // status code is an error. Response headers are in either
  5712. // *Notifications.ServerResponse.Header or (if a response was returned
  5713. // at all) in error.(*googleapi.Error).Header. Use
  5714. // googleapi.IsNotModified to check whether the returned error was
  5715. // because http.StatusNotModified was returned.
  5716. func (c *NotificationsListCall) Do(opts ...googleapi.CallOption) (*Notifications, error) {
  5717. gensupport.SetOptions(c.urlParams_, opts...)
  5718. res, err := c.doRequest("json")
  5719. if res != nil && res.StatusCode == http.StatusNotModified {
  5720. if res.Body != nil {
  5721. res.Body.Close()
  5722. }
  5723. return nil, &googleapi.Error{
  5724. Code: res.StatusCode,
  5725. Header: res.Header,
  5726. }
  5727. }
  5728. if err != nil {
  5729. return nil, err
  5730. }
  5731. defer googleapi.CloseBody(res)
  5732. if err := googleapi.CheckResponse(res); err != nil {
  5733. return nil, err
  5734. }
  5735. ret := &Notifications{
  5736. ServerResponse: googleapi.ServerResponse{
  5737. Header: res.Header,
  5738. HTTPStatusCode: res.StatusCode,
  5739. },
  5740. }
  5741. target := &ret
  5742. if err := gensupport.DecodeResponse(target, res); err != nil {
  5743. return nil, err
  5744. }
  5745. return ret, nil
  5746. // {
  5747. // "description": "Retrieves a list of notification subscriptions for a given bucket.",
  5748. // "httpMethod": "GET",
  5749. // "id": "storage.notifications.list",
  5750. // "parameterOrder": [
  5751. // "bucket"
  5752. // ],
  5753. // "parameters": {
  5754. // "bucket": {
  5755. // "description": "Name of a Google Cloud Storage bucket.",
  5756. // "location": "path",
  5757. // "required": true,
  5758. // "type": "string"
  5759. // },
  5760. // "userProject": {
  5761. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  5762. // "location": "query",
  5763. // "type": "string"
  5764. // }
  5765. // },
  5766. // "path": "b/{bucket}/notificationConfigs",
  5767. // "response": {
  5768. // "$ref": "Notifications"
  5769. // },
  5770. // "scopes": [
  5771. // "https://www.googleapis.com/auth/cloud-platform",
  5772. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  5773. // "https://www.googleapis.com/auth/devstorage.full_control",
  5774. // "https://www.googleapis.com/auth/devstorage.read_only",
  5775. // "https://www.googleapis.com/auth/devstorage.read_write"
  5776. // ]
  5777. // }
  5778. }
  5779. // method id "storage.objectAccessControls.delete":
  5780. type ObjectAccessControlsDeleteCall struct {
  5781. s *Service
  5782. bucket string
  5783. object string
  5784. entity string
  5785. urlParams_ gensupport.URLParams
  5786. ctx_ context.Context
  5787. header_ http.Header
  5788. }
  5789. // Delete: Permanently deletes the ACL entry for the specified entity on
  5790. // the specified object.
  5791. func (r *ObjectAccessControlsService) Delete(bucket string, object string, entity string) *ObjectAccessControlsDeleteCall {
  5792. c := &ObjectAccessControlsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5793. c.bucket = bucket
  5794. c.object = object
  5795. c.entity = entity
  5796. return c
  5797. }
  5798. // Generation sets the optional parameter "generation": If present,
  5799. // selects a specific revision of this object (as opposed to the latest
  5800. // version, the default).
  5801. func (c *ObjectAccessControlsDeleteCall) Generation(generation int64) *ObjectAccessControlsDeleteCall {
  5802. c.urlParams_.Set("generation", fmt.Sprint(generation))
  5803. return c
  5804. }
  5805. // UserProject sets the optional parameter "userProject": The project to
  5806. // be billed for this request. Required for Requester Pays buckets.
  5807. func (c *ObjectAccessControlsDeleteCall) UserProject(userProject string) *ObjectAccessControlsDeleteCall {
  5808. c.urlParams_.Set("userProject", userProject)
  5809. return c
  5810. }
  5811. // Fields allows partial responses to be retrieved. See
  5812. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5813. // for more information.
  5814. func (c *ObjectAccessControlsDeleteCall) Fields(s ...googleapi.Field) *ObjectAccessControlsDeleteCall {
  5815. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5816. return c
  5817. }
  5818. // Context sets the context to be used in this call's Do method. Any
  5819. // pending HTTP request will be aborted if the provided context is
  5820. // canceled.
  5821. func (c *ObjectAccessControlsDeleteCall) Context(ctx context.Context) *ObjectAccessControlsDeleteCall {
  5822. c.ctx_ = ctx
  5823. return c
  5824. }
  5825. // Header returns an http.Header that can be modified by the caller to
  5826. // add HTTP headers to the request.
  5827. func (c *ObjectAccessControlsDeleteCall) Header() http.Header {
  5828. if c.header_ == nil {
  5829. c.header_ = make(http.Header)
  5830. }
  5831. return c.header_
  5832. }
  5833. func (c *ObjectAccessControlsDeleteCall) doRequest(alt string) (*http.Response, error) {
  5834. reqHeaders := make(http.Header)
  5835. for k, v := range c.header_ {
  5836. reqHeaders[k] = v
  5837. }
  5838. reqHeaders.Set("User-Agent", c.s.userAgent())
  5839. var body io.Reader = nil
  5840. c.urlParams_.Set("alt", alt)
  5841. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}/acl/{entity}")
  5842. urls += "?" + c.urlParams_.Encode()
  5843. req, _ := http.NewRequest("DELETE", urls, body)
  5844. req.Header = reqHeaders
  5845. googleapi.Expand(req.URL, map[string]string{
  5846. "bucket": c.bucket,
  5847. "object": c.object,
  5848. "entity": c.entity,
  5849. })
  5850. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5851. }
  5852. // Do executes the "storage.objectAccessControls.delete" call.
  5853. func (c *ObjectAccessControlsDeleteCall) Do(opts ...googleapi.CallOption) error {
  5854. gensupport.SetOptions(c.urlParams_, opts...)
  5855. res, err := c.doRequest("json")
  5856. if err != nil {
  5857. return err
  5858. }
  5859. defer googleapi.CloseBody(res)
  5860. if err := googleapi.CheckResponse(res); err != nil {
  5861. return err
  5862. }
  5863. return nil
  5864. // {
  5865. // "description": "Permanently deletes the ACL entry for the specified entity on the specified object.",
  5866. // "httpMethod": "DELETE",
  5867. // "id": "storage.objectAccessControls.delete",
  5868. // "parameterOrder": [
  5869. // "bucket",
  5870. // "object",
  5871. // "entity"
  5872. // ],
  5873. // "parameters": {
  5874. // "bucket": {
  5875. // "description": "Name of a bucket.",
  5876. // "location": "path",
  5877. // "required": true,
  5878. // "type": "string"
  5879. // },
  5880. // "entity": {
  5881. // "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.",
  5882. // "location": "path",
  5883. // "required": true,
  5884. // "type": "string"
  5885. // },
  5886. // "generation": {
  5887. // "description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).",
  5888. // "format": "int64",
  5889. // "location": "query",
  5890. // "type": "string"
  5891. // },
  5892. // "object": {
  5893. // "description": "Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
  5894. // "location": "path",
  5895. // "required": true,
  5896. // "type": "string"
  5897. // },
  5898. // "userProject": {
  5899. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  5900. // "location": "query",
  5901. // "type": "string"
  5902. // }
  5903. // },
  5904. // "path": "b/{bucket}/o/{object}/acl/{entity}",
  5905. // "scopes": [
  5906. // "https://www.googleapis.com/auth/cloud-platform",
  5907. // "https://www.googleapis.com/auth/devstorage.full_control"
  5908. // ]
  5909. // }
  5910. }
  5911. // method id "storage.objectAccessControls.get":
  5912. type ObjectAccessControlsGetCall struct {
  5913. s *Service
  5914. bucket string
  5915. object string
  5916. entity string
  5917. urlParams_ gensupport.URLParams
  5918. ifNoneMatch_ string
  5919. ctx_ context.Context
  5920. header_ http.Header
  5921. }
  5922. // Get: Returns the ACL entry for the specified entity on the specified
  5923. // object.
  5924. func (r *ObjectAccessControlsService) Get(bucket string, object string, entity string) *ObjectAccessControlsGetCall {
  5925. c := &ObjectAccessControlsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5926. c.bucket = bucket
  5927. c.object = object
  5928. c.entity = entity
  5929. return c
  5930. }
  5931. // Generation sets the optional parameter "generation": If present,
  5932. // selects a specific revision of this object (as opposed to the latest
  5933. // version, the default).
  5934. func (c *ObjectAccessControlsGetCall) Generation(generation int64) *ObjectAccessControlsGetCall {
  5935. c.urlParams_.Set("generation", fmt.Sprint(generation))
  5936. return c
  5937. }
  5938. // UserProject sets the optional parameter "userProject": The project to
  5939. // be billed for this request. Required for Requester Pays buckets.
  5940. func (c *ObjectAccessControlsGetCall) UserProject(userProject string) *ObjectAccessControlsGetCall {
  5941. c.urlParams_.Set("userProject", userProject)
  5942. return c
  5943. }
  5944. // Fields allows partial responses to be retrieved. See
  5945. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5946. // for more information.
  5947. func (c *ObjectAccessControlsGetCall) Fields(s ...googleapi.Field) *ObjectAccessControlsGetCall {
  5948. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5949. return c
  5950. }
  5951. // IfNoneMatch sets the optional parameter which makes the operation
  5952. // fail if the object's ETag matches the given value. This is useful for
  5953. // getting updates only after the object has changed since the last
  5954. // request. Use googleapi.IsNotModified to check whether the response
  5955. // error from Do is the result of In-None-Match.
  5956. func (c *ObjectAccessControlsGetCall) IfNoneMatch(entityTag string) *ObjectAccessControlsGetCall {
  5957. c.ifNoneMatch_ = entityTag
  5958. return c
  5959. }
  5960. // Context sets the context to be used in this call's Do method. Any
  5961. // pending HTTP request will be aborted if the provided context is
  5962. // canceled.
  5963. func (c *ObjectAccessControlsGetCall) Context(ctx context.Context) *ObjectAccessControlsGetCall {
  5964. c.ctx_ = ctx
  5965. return c
  5966. }
  5967. // Header returns an http.Header that can be modified by the caller to
  5968. // add HTTP headers to the request.
  5969. func (c *ObjectAccessControlsGetCall) Header() http.Header {
  5970. if c.header_ == nil {
  5971. c.header_ = make(http.Header)
  5972. }
  5973. return c.header_
  5974. }
  5975. func (c *ObjectAccessControlsGetCall) doRequest(alt string) (*http.Response, error) {
  5976. reqHeaders := make(http.Header)
  5977. for k, v := range c.header_ {
  5978. reqHeaders[k] = v
  5979. }
  5980. reqHeaders.Set("User-Agent", c.s.userAgent())
  5981. if c.ifNoneMatch_ != "" {
  5982. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  5983. }
  5984. var body io.Reader = nil
  5985. c.urlParams_.Set("alt", alt)
  5986. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}/acl/{entity}")
  5987. urls += "?" + c.urlParams_.Encode()
  5988. req, _ := http.NewRequest("GET", urls, body)
  5989. req.Header = reqHeaders
  5990. googleapi.Expand(req.URL, map[string]string{
  5991. "bucket": c.bucket,
  5992. "object": c.object,
  5993. "entity": c.entity,
  5994. })
  5995. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5996. }
  5997. // Do executes the "storage.objectAccessControls.get" call.
  5998. // Exactly one of *ObjectAccessControl or error will be non-nil. Any
  5999. // non-2xx status code is an error. Response headers are in either
  6000. // *ObjectAccessControl.ServerResponse.Header or (if a response was
  6001. // returned at all) in error.(*googleapi.Error).Header. Use
  6002. // googleapi.IsNotModified to check whether the returned error was
  6003. // because http.StatusNotModified was returned.
  6004. func (c *ObjectAccessControlsGetCall) Do(opts ...googleapi.CallOption) (*ObjectAccessControl, error) {
  6005. gensupport.SetOptions(c.urlParams_, opts...)
  6006. res, err := c.doRequest("json")
  6007. if res != nil && res.StatusCode == http.StatusNotModified {
  6008. if res.Body != nil {
  6009. res.Body.Close()
  6010. }
  6011. return nil, &googleapi.Error{
  6012. Code: res.StatusCode,
  6013. Header: res.Header,
  6014. }
  6015. }
  6016. if err != nil {
  6017. return nil, err
  6018. }
  6019. defer googleapi.CloseBody(res)
  6020. if err := googleapi.CheckResponse(res); err != nil {
  6021. return nil, err
  6022. }
  6023. ret := &ObjectAccessControl{
  6024. ServerResponse: googleapi.ServerResponse{
  6025. Header: res.Header,
  6026. HTTPStatusCode: res.StatusCode,
  6027. },
  6028. }
  6029. target := &ret
  6030. if err := gensupport.DecodeResponse(target, res); err != nil {
  6031. return nil, err
  6032. }
  6033. return ret, nil
  6034. // {
  6035. // "description": "Returns the ACL entry for the specified entity on the specified object.",
  6036. // "httpMethod": "GET",
  6037. // "id": "storage.objectAccessControls.get",
  6038. // "parameterOrder": [
  6039. // "bucket",
  6040. // "object",
  6041. // "entity"
  6042. // ],
  6043. // "parameters": {
  6044. // "bucket": {
  6045. // "description": "Name of a bucket.",
  6046. // "location": "path",
  6047. // "required": true,
  6048. // "type": "string"
  6049. // },
  6050. // "entity": {
  6051. // "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.",
  6052. // "location": "path",
  6053. // "required": true,
  6054. // "type": "string"
  6055. // },
  6056. // "generation": {
  6057. // "description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).",
  6058. // "format": "int64",
  6059. // "location": "query",
  6060. // "type": "string"
  6061. // },
  6062. // "object": {
  6063. // "description": "Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
  6064. // "location": "path",
  6065. // "required": true,
  6066. // "type": "string"
  6067. // },
  6068. // "userProject": {
  6069. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  6070. // "location": "query",
  6071. // "type": "string"
  6072. // }
  6073. // },
  6074. // "path": "b/{bucket}/o/{object}/acl/{entity}",
  6075. // "response": {
  6076. // "$ref": "ObjectAccessControl"
  6077. // },
  6078. // "scopes": [
  6079. // "https://www.googleapis.com/auth/cloud-platform",
  6080. // "https://www.googleapis.com/auth/devstorage.full_control"
  6081. // ]
  6082. // }
  6083. }
  6084. // method id "storage.objectAccessControls.insert":
  6085. type ObjectAccessControlsInsertCall struct {
  6086. s *Service
  6087. bucket string
  6088. object string
  6089. objectaccesscontrol *ObjectAccessControl
  6090. urlParams_ gensupport.URLParams
  6091. ctx_ context.Context
  6092. header_ http.Header
  6093. }
  6094. // Insert: Creates a new ACL entry on the specified object.
  6095. func (r *ObjectAccessControlsService) Insert(bucket string, object string, objectaccesscontrol *ObjectAccessControl) *ObjectAccessControlsInsertCall {
  6096. c := &ObjectAccessControlsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6097. c.bucket = bucket
  6098. c.object = object
  6099. c.objectaccesscontrol = objectaccesscontrol
  6100. return c
  6101. }
  6102. // Generation sets the optional parameter "generation": If present,
  6103. // selects a specific revision of this object (as opposed to the latest
  6104. // version, the default).
  6105. func (c *ObjectAccessControlsInsertCall) Generation(generation int64) *ObjectAccessControlsInsertCall {
  6106. c.urlParams_.Set("generation", fmt.Sprint(generation))
  6107. return c
  6108. }
  6109. // UserProject sets the optional parameter "userProject": The project to
  6110. // be billed for this request. Required for Requester Pays buckets.
  6111. func (c *ObjectAccessControlsInsertCall) UserProject(userProject string) *ObjectAccessControlsInsertCall {
  6112. c.urlParams_.Set("userProject", userProject)
  6113. return c
  6114. }
  6115. // Fields allows partial responses to be retrieved. See
  6116. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6117. // for more information.
  6118. func (c *ObjectAccessControlsInsertCall) Fields(s ...googleapi.Field) *ObjectAccessControlsInsertCall {
  6119. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6120. return c
  6121. }
  6122. // Context sets the context to be used in this call's Do method. Any
  6123. // pending HTTP request will be aborted if the provided context is
  6124. // canceled.
  6125. func (c *ObjectAccessControlsInsertCall) Context(ctx context.Context) *ObjectAccessControlsInsertCall {
  6126. c.ctx_ = ctx
  6127. return c
  6128. }
  6129. // Header returns an http.Header that can be modified by the caller to
  6130. // add HTTP headers to the request.
  6131. func (c *ObjectAccessControlsInsertCall) Header() http.Header {
  6132. if c.header_ == nil {
  6133. c.header_ = make(http.Header)
  6134. }
  6135. return c.header_
  6136. }
  6137. func (c *ObjectAccessControlsInsertCall) doRequest(alt string) (*http.Response, error) {
  6138. reqHeaders := make(http.Header)
  6139. for k, v := range c.header_ {
  6140. reqHeaders[k] = v
  6141. }
  6142. reqHeaders.Set("User-Agent", c.s.userAgent())
  6143. var body io.Reader = nil
  6144. body, err := googleapi.WithoutDataWrapper.JSONReader(c.objectaccesscontrol)
  6145. if err != nil {
  6146. return nil, err
  6147. }
  6148. reqHeaders.Set("Content-Type", "application/json")
  6149. c.urlParams_.Set("alt", alt)
  6150. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}/acl")
  6151. urls += "?" + c.urlParams_.Encode()
  6152. req, _ := http.NewRequest("POST", urls, body)
  6153. req.Header = reqHeaders
  6154. googleapi.Expand(req.URL, map[string]string{
  6155. "bucket": c.bucket,
  6156. "object": c.object,
  6157. })
  6158. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6159. }
  6160. // Do executes the "storage.objectAccessControls.insert" call.
  6161. // Exactly one of *ObjectAccessControl or error will be non-nil. Any
  6162. // non-2xx status code is an error. Response headers are in either
  6163. // *ObjectAccessControl.ServerResponse.Header or (if a response was
  6164. // returned at all) in error.(*googleapi.Error).Header. Use
  6165. // googleapi.IsNotModified to check whether the returned error was
  6166. // because http.StatusNotModified was returned.
  6167. func (c *ObjectAccessControlsInsertCall) Do(opts ...googleapi.CallOption) (*ObjectAccessControl, error) {
  6168. gensupport.SetOptions(c.urlParams_, opts...)
  6169. res, err := c.doRequest("json")
  6170. if res != nil && res.StatusCode == http.StatusNotModified {
  6171. if res.Body != nil {
  6172. res.Body.Close()
  6173. }
  6174. return nil, &googleapi.Error{
  6175. Code: res.StatusCode,
  6176. Header: res.Header,
  6177. }
  6178. }
  6179. if err != nil {
  6180. return nil, err
  6181. }
  6182. defer googleapi.CloseBody(res)
  6183. if err := googleapi.CheckResponse(res); err != nil {
  6184. return nil, err
  6185. }
  6186. ret := &ObjectAccessControl{
  6187. ServerResponse: googleapi.ServerResponse{
  6188. Header: res.Header,
  6189. HTTPStatusCode: res.StatusCode,
  6190. },
  6191. }
  6192. target := &ret
  6193. if err := gensupport.DecodeResponse(target, res); err != nil {
  6194. return nil, err
  6195. }
  6196. return ret, nil
  6197. // {
  6198. // "description": "Creates a new ACL entry on the specified object.",
  6199. // "httpMethod": "POST",
  6200. // "id": "storage.objectAccessControls.insert",
  6201. // "parameterOrder": [
  6202. // "bucket",
  6203. // "object"
  6204. // ],
  6205. // "parameters": {
  6206. // "bucket": {
  6207. // "description": "Name of a bucket.",
  6208. // "location": "path",
  6209. // "required": true,
  6210. // "type": "string"
  6211. // },
  6212. // "generation": {
  6213. // "description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).",
  6214. // "format": "int64",
  6215. // "location": "query",
  6216. // "type": "string"
  6217. // },
  6218. // "object": {
  6219. // "description": "Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
  6220. // "location": "path",
  6221. // "required": true,
  6222. // "type": "string"
  6223. // },
  6224. // "userProject": {
  6225. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  6226. // "location": "query",
  6227. // "type": "string"
  6228. // }
  6229. // },
  6230. // "path": "b/{bucket}/o/{object}/acl",
  6231. // "request": {
  6232. // "$ref": "ObjectAccessControl"
  6233. // },
  6234. // "response": {
  6235. // "$ref": "ObjectAccessControl"
  6236. // },
  6237. // "scopes": [
  6238. // "https://www.googleapis.com/auth/cloud-platform",
  6239. // "https://www.googleapis.com/auth/devstorage.full_control"
  6240. // ]
  6241. // }
  6242. }
  6243. // method id "storage.objectAccessControls.list":
  6244. type ObjectAccessControlsListCall struct {
  6245. s *Service
  6246. bucket string
  6247. object string
  6248. urlParams_ gensupport.URLParams
  6249. ifNoneMatch_ string
  6250. ctx_ context.Context
  6251. header_ http.Header
  6252. }
  6253. // List: Retrieves ACL entries on the specified object.
  6254. func (r *ObjectAccessControlsService) List(bucket string, object string) *ObjectAccessControlsListCall {
  6255. c := &ObjectAccessControlsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6256. c.bucket = bucket
  6257. c.object = object
  6258. return c
  6259. }
  6260. // Generation sets the optional parameter "generation": If present,
  6261. // selects a specific revision of this object (as opposed to the latest
  6262. // version, the default).
  6263. func (c *ObjectAccessControlsListCall) Generation(generation int64) *ObjectAccessControlsListCall {
  6264. c.urlParams_.Set("generation", fmt.Sprint(generation))
  6265. return c
  6266. }
  6267. // UserProject sets the optional parameter "userProject": The project to
  6268. // be billed for this request. Required for Requester Pays buckets.
  6269. func (c *ObjectAccessControlsListCall) UserProject(userProject string) *ObjectAccessControlsListCall {
  6270. c.urlParams_.Set("userProject", userProject)
  6271. return c
  6272. }
  6273. // Fields allows partial responses to be retrieved. See
  6274. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6275. // for more information.
  6276. func (c *ObjectAccessControlsListCall) Fields(s ...googleapi.Field) *ObjectAccessControlsListCall {
  6277. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6278. return c
  6279. }
  6280. // IfNoneMatch sets the optional parameter which makes the operation
  6281. // fail if the object's ETag matches the given value. This is useful for
  6282. // getting updates only after the object has changed since the last
  6283. // request. Use googleapi.IsNotModified to check whether the response
  6284. // error from Do is the result of In-None-Match.
  6285. func (c *ObjectAccessControlsListCall) IfNoneMatch(entityTag string) *ObjectAccessControlsListCall {
  6286. c.ifNoneMatch_ = entityTag
  6287. return c
  6288. }
  6289. // Context sets the context to be used in this call's Do method. Any
  6290. // pending HTTP request will be aborted if the provided context is
  6291. // canceled.
  6292. func (c *ObjectAccessControlsListCall) Context(ctx context.Context) *ObjectAccessControlsListCall {
  6293. c.ctx_ = ctx
  6294. return c
  6295. }
  6296. // Header returns an http.Header that can be modified by the caller to
  6297. // add HTTP headers to the request.
  6298. func (c *ObjectAccessControlsListCall) Header() http.Header {
  6299. if c.header_ == nil {
  6300. c.header_ = make(http.Header)
  6301. }
  6302. return c.header_
  6303. }
  6304. func (c *ObjectAccessControlsListCall) doRequest(alt string) (*http.Response, error) {
  6305. reqHeaders := make(http.Header)
  6306. for k, v := range c.header_ {
  6307. reqHeaders[k] = v
  6308. }
  6309. reqHeaders.Set("User-Agent", c.s.userAgent())
  6310. if c.ifNoneMatch_ != "" {
  6311. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  6312. }
  6313. var body io.Reader = nil
  6314. c.urlParams_.Set("alt", alt)
  6315. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}/acl")
  6316. urls += "?" + c.urlParams_.Encode()
  6317. req, _ := http.NewRequest("GET", urls, body)
  6318. req.Header = reqHeaders
  6319. googleapi.Expand(req.URL, map[string]string{
  6320. "bucket": c.bucket,
  6321. "object": c.object,
  6322. })
  6323. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6324. }
  6325. // Do executes the "storage.objectAccessControls.list" call.
  6326. // Exactly one of *ObjectAccessControls or error will be non-nil. Any
  6327. // non-2xx status code is an error. Response headers are in either
  6328. // *ObjectAccessControls.ServerResponse.Header or (if a response was
  6329. // returned at all) in error.(*googleapi.Error).Header. Use
  6330. // googleapi.IsNotModified to check whether the returned error was
  6331. // because http.StatusNotModified was returned.
  6332. func (c *ObjectAccessControlsListCall) Do(opts ...googleapi.CallOption) (*ObjectAccessControls, error) {
  6333. gensupport.SetOptions(c.urlParams_, opts...)
  6334. res, err := c.doRequest("json")
  6335. if res != nil && res.StatusCode == http.StatusNotModified {
  6336. if res.Body != nil {
  6337. res.Body.Close()
  6338. }
  6339. return nil, &googleapi.Error{
  6340. Code: res.StatusCode,
  6341. Header: res.Header,
  6342. }
  6343. }
  6344. if err != nil {
  6345. return nil, err
  6346. }
  6347. defer googleapi.CloseBody(res)
  6348. if err := googleapi.CheckResponse(res); err != nil {
  6349. return nil, err
  6350. }
  6351. ret := &ObjectAccessControls{
  6352. ServerResponse: googleapi.ServerResponse{
  6353. Header: res.Header,
  6354. HTTPStatusCode: res.StatusCode,
  6355. },
  6356. }
  6357. target := &ret
  6358. if err := gensupport.DecodeResponse(target, res); err != nil {
  6359. return nil, err
  6360. }
  6361. return ret, nil
  6362. // {
  6363. // "description": "Retrieves ACL entries on the specified object.",
  6364. // "httpMethod": "GET",
  6365. // "id": "storage.objectAccessControls.list",
  6366. // "parameterOrder": [
  6367. // "bucket",
  6368. // "object"
  6369. // ],
  6370. // "parameters": {
  6371. // "bucket": {
  6372. // "description": "Name of a bucket.",
  6373. // "location": "path",
  6374. // "required": true,
  6375. // "type": "string"
  6376. // },
  6377. // "generation": {
  6378. // "description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).",
  6379. // "format": "int64",
  6380. // "location": "query",
  6381. // "type": "string"
  6382. // },
  6383. // "object": {
  6384. // "description": "Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
  6385. // "location": "path",
  6386. // "required": true,
  6387. // "type": "string"
  6388. // },
  6389. // "userProject": {
  6390. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  6391. // "location": "query",
  6392. // "type": "string"
  6393. // }
  6394. // },
  6395. // "path": "b/{bucket}/o/{object}/acl",
  6396. // "response": {
  6397. // "$ref": "ObjectAccessControls"
  6398. // },
  6399. // "scopes": [
  6400. // "https://www.googleapis.com/auth/cloud-platform",
  6401. // "https://www.googleapis.com/auth/devstorage.full_control"
  6402. // ]
  6403. // }
  6404. }
  6405. // method id "storage.objectAccessControls.patch":
  6406. type ObjectAccessControlsPatchCall struct {
  6407. s *Service
  6408. bucket string
  6409. object string
  6410. entity string
  6411. objectaccesscontrol *ObjectAccessControl
  6412. urlParams_ gensupport.URLParams
  6413. ctx_ context.Context
  6414. header_ http.Header
  6415. }
  6416. // Patch: Updates an ACL entry on the specified object. This method
  6417. // supports patch semantics.
  6418. func (r *ObjectAccessControlsService) Patch(bucket string, object string, entity string, objectaccesscontrol *ObjectAccessControl) *ObjectAccessControlsPatchCall {
  6419. c := &ObjectAccessControlsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6420. c.bucket = bucket
  6421. c.object = object
  6422. c.entity = entity
  6423. c.objectaccesscontrol = objectaccesscontrol
  6424. return c
  6425. }
  6426. // Generation sets the optional parameter "generation": If present,
  6427. // selects a specific revision of this object (as opposed to the latest
  6428. // version, the default).
  6429. func (c *ObjectAccessControlsPatchCall) Generation(generation int64) *ObjectAccessControlsPatchCall {
  6430. c.urlParams_.Set("generation", fmt.Sprint(generation))
  6431. return c
  6432. }
  6433. // UserProject sets the optional parameter "userProject": The project to
  6434. // be billed for this request. Required for Requester Pays buckets.
  6435. func (c *ObjectAccessControlsPatchCall) UserProject(userProject string) *ObjectAccessControlsPatchCall {
  6436. c.urlParams_.Set("userProject", userProject)
  6437. return c
  6438. }
  6439. // Fields allows partial responses to be retrieved. See
  6440. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6441. // for more information.
  6442. func (c *ObjectAccessControlsPatchCall) Fields(s ...googleapi.Field) *ObjectAccessControlsPatchCall {
  6443. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6444. return c
  6445. }
  6446. // Context sets the context to be used in this call's Do method. Any
  6447. // pending HTTP request will be aborted if the provided context is
  6448. // canceled.
  6449. func (c *ObjectAccessControlsPatchCall) Context(ctx context.Context) *ObjectAccessControlsPatchCall {
  6450. c.ctx_ = ctx
  6451. return c
  6452. }
  6453. // Header returns an http.Header that can be modified by the caller to
  6454. // add HTTP headers to the request.
  6455. func (c *ObjectAccessControlsPatchCall) Header() http.Header {
  6456. if c.header_ == nil {
  6457. c.header_ = make(http.Header)
  6458. }
  6459. return c.header_
  6460. }
  6461. func (c *ObjectAccessControlsPatchCall) doRequest(alt string) (*http.Response, error) {
  6462. reqHeaders := make(http.Header)
  6463. for k, v := range c.header_ {
  6464. reqHeaders[k] = v
  6465. }
  6466. reqHeaders.Set("User-Agent", c.s.userAgent())
  6467. var body io.Reader = nil
  6468. body, err := googleapi.WithoutDataWrapper.JSONReader(c.objectaccesscontrol)
  6469. if err != nil {
  6470. return nil, err
  6471. }
  6472. reqHeaders.Set("Content-Type", "application/json")
  6473. c.urlParams_.Set("alt", alt)
  6474. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}/acl/{entity}")
  6475. urls += "?" + c.urlParams_.Encode()
  6476. req, _ := http.NewRequest("PATCH", urls, body)
  6477. req.Header = reqHeaders
  6478. googleapi.Expand(req.URL, map[string]string{
  6479. "bucket": c.bucket,
  6480. "object": c.object,
  6481. "entity": c.entity,
  6482. })
  6483. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6484. }
  6485. // Do executes the "storage.objectAccessControls.patch" call.
  6486. // Exactly one of *ObjectAccessControl or error will be non-nil. Any
  6487. // non-2xx status code is an error. Response headers are in either
  6488. // *ObjectAccessControl.ServerResponse.Header or (if a response was
  6489. // returned at all) in error.(*googleapi.Error).Header. Use
  6490. // googleapi.IsNotModified to check whether the returned error was
  6491. // because http.StatusNotModified was returned.
  6492. func (c *ObjectAccessControlsPatchCall) Do(opts ...googleapi.CallOption) (*ObjectAccessControl, error) {
  6493. gensupport.SetOptions(c.urlParams_, opts...)
  6494. res, err := c.doRequest("json")
  6495. if res != nil && res.StatusCode == http.StatusNotModified {
  6496. if res.Body != nil {
  6497. res.Body.Close()
  6498. }
  6499. return nil, &googleapi.Error{
  6500. Code: res.StatusCode,
  6501. Header: res.Header,
  6502. }
  6503. }
  6504. if err != nil {
  6505. return nil, err
  6506. }
  6507. defer googleapi.CloseBody(res)
  6508. if err := googleapi.CheckResponse(res); err != nil {
  6509. return nil, err
  6510. }
  6511. ret := &ObjectAccessControl{
  6512. ServerResponse: googleapi.ServerResponse{
  6513. Header: res.Header,
  6514. HTTPStatusCode: res.StatusCode,
  6515. },
  6516. }
  6517. target := &ret
  6518. if err := gensupport.DecodeResponse(target, res); err != nil {
  6519. return nil, err
  6520. }
  6521. return ret, nil
  6522. // {
  6523. // "description": "Updates an ACL entry on the specified object. This method supports patch semantics.",
  6524. // "httpMethod": "PATCH",
  6525. // "id": "storage.objectAccessControls.patch",
  6526. // "parameterOrder": [
  6527. // "bucket",
  6528. // "object",
  6529. // "entity"
  6530. // ],
  6531. // "parameters": {
  6532. // "bucket": {
  6533. // "description": "Name of a bucket.",
  6534. // "location": "path",
  6535. // "required": true,
  6536. // "type": "string"
  6537. // },
  6538. // "entity": {
  6539. // "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.",
  6540. // "location": "path",
  6541. // "required": true,
  6542. // "type": "string"
  6543. // },
  6544. // "generation": {
  6545. // "description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).",
  6546. // "format": "int64",
  6547. // "location": "query",
  6548. // "type": "string"
  6549. // },
  6550. // "object": {
  6551. // "description": "Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
  6552. // "location": "path",
  6553. // "required": true,
  6554. // "type": "string"
  6555. // },
  6556. // "userProject": {
  6557. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  6558. // "location": "query",
  6559. // "type": "string"
  6560. // }
  6561. // },
  6562. // "path": "b/{bucket}/o/{object}/acl/{entity}",
  6563. // "request": {
  6564. // "$ref": "ObjectAccessControl"
  6565. // },
  6566. // "response": {
  6567. // "$ref": "ObjectAccessControl"
  6568. // },
  6569. // "scopes": [
  6570. // "https://www.googleapis.com/auth/cloud-platform",
  6571. // "https://www.googleapis.com/auth/devstorage.full_control"
  6572. // ]
  6573. // }
  6574. }
  6575. // method id "storage.objectAccessControls.update":
  6576. type ObjectAccessControlsUpdateCall struct {
  6577. s *Service
  6578. bucket string
  6579. object string
  6580. entity string
  6581. objectaccesscontrol *ObjectAccessControl
  6582. urlParams_ gensupport.URLParams
  6583. ctx_ context.Context
  6584. header_ http.Header
  6585. }
  6586. // Update: Updates an ACL entry on the specified object.
  6587. func (r *ObjectAccessControlsService) Update(bucket string, object string, entity string, objectaccesscontrol *ObjectAccessControl) *ObjectAccessControlsUpdateCall {
  6588. c := &ObjectAccessControlsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6589. c.bucket = bucket
  6590. c.object = object
  6591. c.entity = entity
  6592. c.objectaccesscontrol = objectaccesscontrol
  6593. return c
  6594. }
  6595. // Generation sets the optional parameter "generation": If present,
  6596. // selects a specific revision of this object (as opposed to the latest
  6597. // version, the default).
  6598. func (c *ObjectAccessControlsUpdateCall) Generation(generation int64) *ObjectAccessControlsUpdateCall {
  6599. c.urlParams_.Set("generation", fmt.Sprint(generation))
  6600. return c
  6601. }
  6602. // UserProject sets the optional parameter "userProject": The project to
  6603. // be billed for this request. Required for Requester Pays buckets.
  6604. func (c *ObjectAccessControlsUpdateCall) UserProject(userProject string) *ObjectAccessControlsUpdateCall {
  6605. c.urlParams_.Set("userProject", userProject)
  6606. return c
  6607. }
  6608. // Fields allows partial responses to be retrieved. See
  6609. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6610. // for more information.
  6611. func (c *ObjectAccessControlsUpdateCall) Fields(s ...googleapi.Field) *ObjectAccessControlsUpdateCall {
  6612. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6613. return c
  6614. }
  6615. // Context sets the context to be used in this call's Do method. Any
  6616. // pending HTTP request will be aborted if the provided context is
  6617. // canceled.
  6618. func (c *ObjectAccessControlsUpdateCall) Context(ctx context.Context) *ObjectAccessControlsUpdateCall {
  6619. c.ctx_ = ctx
  6620. return c
  6621. }
  6622. // Header returns an http.Header that can be modified by the caller to
  6623. // add HTTP headers to the request.
  6624. func (c *ObjectAccessControlsUpdateCall) Header() http.Header {
  6625. if c.header_ == nil {
  6626. c.header_ = make(http.Header)
  6627. }
  6628. return c.header_
  6629. }
  6630. func (c *ObjectAccessControlsUpdateCall) doRequest(alt string) (*http.Response, error) {
  6631. reqHeaders := make(http.Header)
  6632. for k, v := range c.header_ {
  6633. reqHeaders[k] = v
  6634. }
  6635. reqHeaders.Set("User-Agent", c.s.userAgent())
  6636. var body io.Reader = nil
  6637. body, err := googleapi.WithoutDataWrapper.JSONReader(c.objectaccesscontrol)
  6638. if err != nil {
  6639. return nil, err
  6640. }
  6641. reqHeaders.Set("Content-Type", "application/json")
  6642. c.urlParams_.Set("alt", alt)
  6643. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}/acl/{entity}")
  6644. urls += "?" + c.urlParams_.Encode()
  6645. req, _ := http.NewRequest("PUT", urls, body)
  6646. req.Header = reqHeaders
  6647. googleapi.Expand(req.URL, map[string]string{
  6648. "bucket": c.bucket,
  6649. "object": c.object,
  6650. "entity": c.entity,
  6651. })
  6652. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6653. }
  6654. // Do executes the "storage.objectAccessControls.update" call.
  6655. // Exactly one of *ObjectAccessControl or error will be non-nil. Any
  6656. // non-2xx status code is an error. Response headers are in either
  6657. // *ObjectAccessControl.ServerResponse.Header or (if a response was
  6658. // returned at all) in error.(*googleapi.Error).Header. Use
  6659. // googleapi.IsNotModified to check whether the returned error was
  6660. // because http.StatusNotModified was returned.
  6661. func (c *ObjectAccessControlsUpdateCall) Do(opts ...googleapi.CallOption) (*ObjectAccessControl, error) {
  6662. gensupport.SetOptions(c.urlParams_, opts...)
  6663. res, err := c.doRequest("json")
  6664. if res != nil && res.StatusCode == http.StatusNotModified {
  6665. if res.Body != nil {
  6666. res.Body.Close()
  6667. }
  6668. return nil, &googleapi.Error{
  6669. Code: res.StatusCode,
  6670. Header: res.Header,
  6671. }
  6672. }
  6673. if err != nil {
  6674. return nil, err
  6675. }
  6676. defer googleapi.CloseBody(res)
  6677. if err := googleapi.CheckResponse(res); err != nil {
  6678. return nil, err
  6679. }
  6680. ret := &ObjectAccessControl{
  6681. ServerResponse: googleapi.ServerResponse{
  6682. Header: res.Header,
  6683. HTTPStatusCode: res.StatusCode,
  6684. },
  6685. }
  6686. target := &ret
  6687. if err := gensupport.DecodeResponse(target, res); err != nil {
  6688. return nil, err
  6689. }
  6690. return ret, nil
  6691. // {
  6692. // "description": "Updates an ACL entry on the specified object.",
  6693. // "httpMethod": "PUT",
  6694. // "id": "storage.objectAccessControls.update",
  6695. // "parameterOrder": [
  6696. // "bucket",
  6697. // "object",
  6698. // "entity"
  6699. // ],
  6700. // "parameters": {
  6701. // "bucket": {
  6702. // "description": "Name of a bucket.",
  6703. // "location": "path",
  6704. // "required": true,
  6705. // "type": "string"
  6706. // },
  6707. // "entity": {
  6708. // "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.",
  6709. // "location": "path",
  6710. // "required": true,
  6711. // "type": "string"
  6712. // },
  6713. // "generation": {
  6714. // "description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).",
  6715. // "format": "int64",
  6716. // "location": "query",
  6717. // "type": "string"
  6718. // },
  6719. // "object": {
  6720. // "description": "Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
  6721. // "location": "path",
  6722. // "required": true,
  6723. // "type": "string"
  6724. // },
  6725. // "userProject": {
  6726. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  6727. // "location": "query",
  6728. // "type": "string"
  6729. // }
  6730. // },
  6731. // "path": "b/{bucket}/o/{object}/acl/{entity}",
  6732. // "request": {
  6733. // "$ref": "ObjectAccessControl"
  6734. // },
  6735. // "response": {
  6736. // "$ref": "ObjectAccessControl"
  6737. // },
  6738. // "scopes": [
  6739. // "https://www.googleapis.com/auth/cloud-platform",
  6740. // "https://www.googleapis.com/auth/devstorage.full_control"
  6741. // ]
  6742. // }
  6743. }
  6744. // method id "storage.objects.compose":
  6745. type ObjectsComposeCall struct {
  6746. s *Service
  6747. destinationBucket string
  6748. destinationObject string
  6749. composerequest *ComposeRequest
  6750. urlParams_ gensupport.URLParams
  6751. ctx_ context.Context
  6752. header_ http.Header
  6753. }
  6754. // Compose: Concatenates a list of existing objects into a new object in
  6755. // the same bucket.
  6756. func (r *ObjectsService) Compose(destinationBucket string, destinationObject string, composerequest *ComposeRequest) *ObjectsComposeCall {
  6757. c := &ObjectsComposeCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6758. c.destinationBucket = destinationBucket
  6759. c.destinationObject = destinationObject
  6760. c.composerequest = composerequest
  6761. return c
  6762. }
  6763. // DestinationPredefinedAcl sets the optional parameter
  6764. // "destinationPredefinedAcl": Apply a predefined set of access controls
  6765. // to the destination object.
  6766. //
  6767. // Possible values:
  6768. // "authenticatedRead" - Object owner gets OWNER access, and
  6769. // allAuthenticatedUsers get READER access.
  6770. // "bucketOwnerFullControl" - Object owner gets OWNER access, and
  6771. // project team owners get OWNER access.
  6772. // "bucketOwnerRead" - Object owner gets OWNER access, and project
  6773. // team owners get READER access.
  6774. // "private" - Object owner gets OWNER access.
  6775. // "projectPrivate" - Object owner gets OWNER access, and project team
  6776. // members get access according to their roles.
  6777. // "publicRead" - Object owner gets OWNER access, and allUsers get
  6778. // READER access.
  6779. func (c *ObjectsComposeCall) DestinationPredefinedAcl(destinationPredefinedAcl string) *ObjectsComposeCall {
  6780. c.urlParams_.Set("destinationPredefinedAcl", destinationPredefinedAcl)
  6781. return c
  6782. }
  6783. // IfGenerationMatch sets the optional parameter "ifGenerationMatch":
  6784. // Makes the operation conditional on whether the object's current
  6785. // generation matches the given value. Setting to 0 makes the operation
  6786. // succeed only if there are no live versions of the object.
  6787. func (c *ObjectsComposeCall) IfGenerationMatch(ifGenerationMatch int64) *ObjectsComposeCall {
  6788. c.urlParams_.Set("ifGenerationMatch", fmt.Sprint(ifGenerationMatch))
  6789. return c
  6790. }
  6791. // IfMetagenerationMatch sets the optional parameter
  6792. // "ifMetagenerationMatch": Makes the operation conditional on whether
  6793. // the object's current metageneration matches the given value.
  6794. func (c *ObjectsComposeCall) IfMetagenerationMatch(ifMetagenerationMatch int64) *ObjectsComposeCall {
  6795. c.urlParams_.Set("ifMetagenerationMatch", fmt.Sprint(ifMetagenerationMatch))
  6796. return c
  6797. }
  6798. // KmsKeyName sets the optional parameter "kmsKeyName": Resource name of
  6799. // the Cloud KMS key, of the form
  6800. // projects/my-project/locations/global/keyRings/my-kr/cryptoKeys/my-key,
  6801. // that will be used to encrypt the object. Overrides the object
  6802. // metadata's kms_key_name value, if any.
  6803. func (c *ObjectsComposeCall) KmsKeyName(kmsKeyName string) *ObjectsComposeCall {
  6804. c.urlParams_.Set("kmsKeyName", kmsKeyName)
  6805. return c
  6806. }
  6807. // UserProject sets the optional parameter "userProject": The project to
  6808. // be billed for this request. Required for Requester Pays buckets.
  6809. func (c *ObjectsComposeCall) UserProject(userProject string) *ObjectsComposeCall {
  6810. c.urlParams_.Set("userProject", userProject)
  6811. return c
  6812. }
  6813. // Fields allows partial responses to be retrieved. See
  6814. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6815. // for more information.
  6816. func (c *ObjectsComposeCall) Fields(s ...googleapi.Field) *ObjectsComposeCall {
  6817. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6818. return c
  6819. }
  6820. // Context sets the context to be used in this call's Do method. Any
  6821. // pending HTTP request will be aborted if the provided context is
  6822. // canceled.
  6823. func (c *ObjectsComposeCall) Context(ctx context.Context) *ObjectsComposeCall {
  6824. c.ctx_ = ctx
  6825. return c
  6826. }
  6827. // Header returns an http.Header that can be modified by the caller to
  6828. // add HTTP headers to the request.
  6829. func (c *ObjectsComposeCall) Header() http.Header {
  6830. if c.header_ == nil {
  6831. c.header_ = make(http.Header)
  6832. }
  6833. return c.header_
  6834. }
  6835. func (c *ObjectsComposeCall) doRequest(alt string) (*http.Response, error) {
  6836. reqHeaders := make(http.Header)
  6837. for k, v := range c.header_ {
  6838. reqHeaders[k] = v
  6839. }
  6840. reqHeaders.Set("User-Agent", c.s.userAgent())
  6841. var body io.Reader = nil
  6842. body, err := googleapi.WithoutDataWrapper.JSONReader(c.composerequest)
  6843. if err != nil {
  6844. return nil, err
  6845. }
  6846. reqHeaders.Set("Content-Type", "application/json")
  6847. c.urlParams_.Set("alt", alt)
  6848. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{destinationBucket}/o/{destinationObject}/compose")
  6849. urls += "?" + c.urlParams_.Encode()
  6850. req, _ := http.NewRequest("POST", urls, body)
  6851. req.Header = reqHeaders
  6852. googleapi.Expand(req.URL, map[string]string{
  6853. "destinationBucket": c.destinationBucket,
  6854. "destinationObject": c.destinationObject,
  6855. })
  6856. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6857. }
  6858. // Do executes the "storage.objects.compose" call.
  6859. // Exactly one of *Object or error will be non-nil. Any non-2xx status
  6860. // code is an error. Response headers are in either
  6861. // *Object.ServerResponse.Header or (if a response was returned at all)
  6862. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  6863. // check whether the returned error was because http.StatusNotModified
  6864. // was returned.
  6865. func (c *ObjectsComposeCall) Do(opts ...googleapi.CallOption) (*Object, error) {
  6866. gensupport.SetOptions(c.urlParams_, opts...)
  6867. res, err := c.doRequest("json")
  6868. if res != nil && res.StatusCode == http.StatusNotModified {
  6869. if res.Body != nil {
  6870. res.Body.Close()
  6871. }
  6872. return nil, &googleapi.Error{
  6873. Code: res.StatusCode,
  6874. Header: res.Header,
  6875. }
  6876. }
  6877. if err != nil {
  6878. return nil, err
  6879. }
  6880. defer googleapi.CloseBody(res)
  6881. if err := googleapi.CheckResponse(res); err != nil {
  6882. return nil, err
  6883. }
  6884. ret := &Object{
  6885. ServerResponse: googleapi.ServerResponse{
  6886. Header: res.Header,
  6887. HTTPStatusCode: res.StatusCode,
  6888. },
  6889. }
  6890. target := &ret
  6891. if err := gensupport.DecodeResponse(target, res); err != nil {
  6892. return nil, err
  6893. }
  6894. return ret, nil
  6895. // {
  6896. // "description": "Concatenates a list of existing objects into a new object in the same bucket.",
  6897. // "httpMethod": "POST",
  6898. // "id": "storage.objects.compose",
  6899. // "parameterOrder": [
  6900. // "destinationBucket",
  6901. // "destinationObject"
  6902. // ],
  6903. // "parameters": {
  6904. // "destinationBucket": {
  6905. // "description": "Name of the bucket in which to store the new object.",
  6906. // "location": "path",
  6907. // "required": true,
  6908. // "type": "string"
  6909. // },
  6910. // "destinationObject": {
  6911. // "description": "Name of the new object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
  6912. // "location": "path",
  6913. // "required": true,
  6914. // "type": "string"
  6915. // },
  6916. // "destinationPredefinedAcl": {
  6917. // "description": "Apply a predefined set of access controls to the destination object.",
  6918. // "enum": [
  6919. // "authenticatedRead",
  6920. // "bucketOwnerFullControl",
  6921. // "bucketOwnerRead",
  6922. // "private",
  6923. // "projectPrivate",
  6924. // "publicRead"
  6925. // ],
  6926. // "enumDescriptions": [
  6927. // "Object owner gets OWNER access, and allAuthenticatedUsers get READER access.",
  6928. // "Object owner gets OWNER access, and project team owners get OWNER access.",
  6929. // "Object owner gets OWNER access, and project team owners get READER access.",
  6930. // "Object owner gets OWNER access.",
  6931. // "Object owner gets OWNER access, and project team members get access according to their roles.",
  6932. // "Object owner gets OWNER access, and allUsers get READER access."
  6933. // ],
  6934. // "location": "query",
  6935. // "type": "string"
  6936. // },
  6937. // "ifGenerationMatch": {
  6938. // "description": "Makes the operation conditional on whether the object's current generation matches the given value. Setting to 0 makes the operation succeed only if there are no live versions of the object.",
  6939. // "format": "int64",
  6940. // "location": "query",
  6941. // "type": "string"
  6942. // },
  6943. // "ifMetagenerationMatch": {
  6944. // "description": "Makes the operation conditional on whether the object's current metageneration matches the given value.",
  6945. // "format": "int64",
  6946. // "location": "query",
  6947. // "type": "string"
  6948. // },
  6949. // "kmsKeyName": {
  6950. // "description": "Resource name of the Cloud KMS key, of the form projects/my-project/locations/global/keyRings/my-kr/cryptoKeys/my-key, that will be used to encrypt the object. Overrides the object metadata's kms_key_name value, if any.",
  6951. // "location": "query",
  6952. // "type": "string"
  6953. // },
  6954. // "userProject": {
  6955. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  6956. // "location": "query",
  6957. // "type": "string"
  6958. // }
  6959. // },
  6960. // "path": "b/{destinationBucket}/o/{destinationObject}/compose",
  6961. // "request": {
  6962. // "$ref": "ComposeRequest"
  6963. // },
  6964. // "response": {
  6965. // "$ref": "Object"
  6966. // },
  6967. // "scopes": [
  6968. // "https://www.googleapis.com/auth/cloud-platform",
  6969. // "https://www.googleapis.com/auth/devstorage.full_control",
  6970. // "https://www.googleapis.com/auth/devstorage.read_write"
  6971. // ]
  6972. // }
  6973. }
  6974. // method id "storage.objects.copy":
  6975. type ObjectsCopyCall struct {
  6976. s *Service
  6977. sourceBucket string
  6978. sourceObject string
  6979. destinationBucket string
  6980. destinationObject string
  6981. object *Object
  6982. urlParams_ gensupport.URLParams
  6983. ctx_ context.Context
  6984. header_ http.Header
  6985. }
  6986. // Copy: Copies a source object to a destination object. Optionally
  6987. // overrides metadata.
  6988. func (r *ObjectsService) Copy(sourceBucket string, sourceObject string, destinationBucket string, destinationObject string, object *Object) *ObjectsCopyCall {
  6989. c := &ObjectsCopyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6990. c.sourceBucket = sourceBucket
  6991. c.sourceObject = sourceObject
  6992. c.destinationBucket = destinationBucket
  6993. c.destinationObject = destinationObject
  6994. c.object = object
  6995. return c
  6996. }
  6997. // DestinationPredefinedAcl sets the optional parameter
  6998. // "destinationPredefinedAcl": Apply a predefined set of access controls
  6999. // to the destination object.
  7000. //
  7001. // Possible values:
  7002. // "authenticatedRead" - Object owner gets OWNER access, and
  7003. // allAuthenticatedUsers get READER access.
  7004. // "bucketOwnerFullControl" - Object owner gets OWNER access, and
  7005. // project team owners get OWNER access.
  7006. // "bucketOwnerRead" - Object owner gets OWNER access, and project
  7007. // team owners get READER access.
  7008. // "private" - Object owner gets OWNER access.
  7009. // "projectPrivate" - Object owner gets OWNER access, and project team
  7010. // members get access according to their roles.
  7011. // "publicRead" - Object owner gets OWNER access, and allUsers get
  7012. // READER access.
  7013. func (c *ObjectsCopyCall) DestinationPredefinedAcl(destinationPredefinedAcl string) *ObjectsCopyCall {
  7014. c.urlParams_.Set("destinationPredefinedAcl", destinationPredefinedAcl)
  7015. return c
  7016. }
  7017. // IfGenerationMatch sets the optional parameter "ifGenerationMatch":
  7018. // Makes the operation conditional on whether the destination object's
  7019. // current generation matches the given value. Setting to 0 makes the
  7020. // operation succeed only if there are no live versions of the object.
  7021. func (c *ObjectsCopyCall) IfGenerationMatch(ifGenerationMatch int64) *ObjectsCopyCall {
  7022. c.urlParams_.Set("ifGenerationMatch", fmt.Sprint(ifGenerationMatch))
  7023. return c
  7024. }
  7025. // IfGenerationNotMatch sets the optional parameter
  7026. // "ifGenerationNotMatch": Makes the operation conditional on whether
  7027. // the destination object's current generation does not match the given
  7028. // value. If no live object exists, the precondition fails. Setting to 0
  7029. // makes the operation succeed only if there is a live version of the
  7030. // object.
  7031. func (c *ObjectsCopyCall) IfGenerationNotMatch(ifGenerationNotMatch int64) *ObjectsCopyCall {
  7032. c.urlParams_.Set("ifGenerationNotMatch", fmt.Sprint(ifGenerationNotMatch))
  7033. return c
  7034. }
  7035. // IfMetagenerationMatch sets the optional parameter
  7036. // "ifMetagenerationMatch": Makes the operation conditional on whether
  7037. // the destination object's current metageneration matches the given
  7038. // value.
  7039. func (c *ObjectsCopyCall) IfMetagenerationMatch(ifMetagenerationMatch int64) *ObjectsCopyCall {
  7040. c.urlParams_.Set("ifMetagenerationMatch", fmt.Sprint(ifMetagenerationMatch))
  7041. return c
  7042. }
  7043. // IfMetagenerationNotMatch sets the optional parameter
  7044. // "ifMetagenerationNotMatch": Makes the operation conditional on
  7045. // whether the destination object's current metageneration does not
  7046. // match the given value.
  7047. func (c *ObjectsCopyCall) IfMetagenerationNotMatch(ifMetagenerationNotMatch int64) *ObjectsCopyCall {
  7048. c.urlParams_.Set("ifMetagenerationNotMatch", fmt.Sprint(ifMetagenerationNotMatch))
  7049. return c
  7050. }
  7051. // IfSourceGenerationMatch sets the optional parameter
  7052. // "ifSourceGenerationMatch": Makes the operation conditional on whether
  7053. // the source object's current generation matches the given value.
  7054. func (c *ObjectsCopyCall) IfSourceGenerationMatch(ifSourceGenerationMatch int64) *ObjectsCopyCall {
  7055. c.urlParams_.Set("ifSourceGenerationMatch", fmt.Sprint(ifSourceGenerationMatch))
  7056. return c
  7057. }
  7058. // IfSourceGenerationNotMatch sets the optional parameter
  7059. // "ifSourceGenerationNotMatch": Makes the operation conditional on
  7060. // whether the source object's current generation does not match the
  7061. // given value.
  7062. func (c *ObjectsCopyCall) IfSourceGenerationNotMatch(ifSourceGenerationNotMatch int64) *ObjectsCopyCall {
  7063. c.urlParams_.Set("ifSourceGenerationNotMatch", fmt.Sprint(ifSourceGenerationNotMatch))
  7064. return c
  7065. }
  7066. // IfSourceMetagenerationMatch sets the optional parameter
  7067. // "ifSourceMetagenerationMatch": Makes the operation conditional on
  7068. // whether the source object's current metageneration matches the given
  7069. // value.
  7070. func (c *ObjectsCopyCall) IfSourceMetagenerationMatch(ifSourceMetagenerationMatch int64) *ObjectsCopyCall {
  7071. c.urlParams_.Set("ifSourceMetagenerationMatch", fmt.Sprint(ifSourceMetagenerationMatch))
  7072. return c
  7073. }
  7074. // IfSourceMetagenerationNotMatch sets the optional parameter
  7075. // "ifSourceMetagenerationNotMatch": Makes the operation conditional on
  7076. // whether the source object's current metageneration does not match the
  7077. // given value.
  7078. func (c *ObjectsCopyCall) IfSourceMetagenerationNotMatch(ifSourceMetagenerationNotMatch int64) *ObjectsCopyCall {
  7079. c.urlParams_.Set("ifSourceMetagenerationNotMatch", fmt.Sprint(ifSourceMetagenerationNotMatch))
  7080. return c
  7081. }
  7082. // Projection sets the optional parameter "projection": Set of
  7083. // properties to return. Defaults to noAcl, unless the object resource
  7084. // specifies the acl property, when it defaults to full.
  7085. //
  7086. // Possible values:
  7087. // "full" - Include all properties.
  7088. // "noAcl" - Omit the owner, acl property.
  7089. func (c *ObjectsCopyCall) Projection(projection string) *ObjectsCopyCall {
  7090. c.urlParams_.Set("projection", projection)
  7091. return c
  7092. }
  7093. // SourceGeneration sets the optional parameter "sourceGeneration": If
  7094. // present, selects a specific revision of the source object (as opposed
  7095. // to the latest version, the default).
  7096. func (c *ObjectsCopyCall) SourceGeneration(sourceGeneration int64) *ObjectsCopyCall {
  7097. c.urlParams_.Set("sourceGeneration", fmt.Sprint(sourceGeneration))
  7098. return c
  7099. }
  7100. // UserProject sets the optional parameter "userProject": The project to
  7101. // be billed for this request. Required for Requester Pays buckets.
  7102. func (c *ObjectsCopyCall) UserProject(userProject string) *ObjectsCopyCall {
  7103. c.urlParams_.Set("userProject", userProject)
  7104. return c
  7105. }
  7106. // Fields allows partial responses to be retrieved. See
  7107. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7108. // for more information.
  7109. func (c *ObjectsCopyCall) Fields(s ...googleapi.Field) *ObjectsCopyCall {
  7110. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7111. return c
  7112. }
  7113. // Context sets the context to be used in this call's Do method. Any
  7114. // pending HTTP request will be aborted if the provided context is
  7115. // canceled.
  7116. func (c *ObjectsCopyCall) Context(ctx context.Context) *ObjectsCopyCall {
  7117. c.ctx_ = ctx
  7118. return c
  7119. }
  7120. // Header returns an http.Header that can be modified by the caller to
  7121. // add HTTP headers to the request.
  7122. func (c *ObjectsCopyCall) Header() http.Header {
  7123. if c.header_ == nil {
  7124. c.header_ = make(http.Header)
  7125. }
  7126. return c.header_
  7127. }
  7128. func (c *ObjectsCopyCall) doRequest(alt string) (*http.Response, error) {
  7129. reqHeaders := make(http.Header)
  7130. for k, v := range c.header_ {
  7131. reqHeaders[k] = v
  7132. }
  7133. reqHeaders.Set("User-Agent", c.s.userAgent())
  7134. var body io.Reader = nil
  7135. body, err := googleapi.WithoutDataWrapper.JSONReader(c.object)
  7136. if err != nil {
  7137. return nil, err
  7138. }
  7139. reqHeaders.Set("Content-Type", "application/json")
  7140. c.urlParams_.Set("alt", alt)
  7141. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{sourceBucket}/o/{sourceObject}/copyTo/b/{destinationBucket}/o/{destinationObject}")
  7142. urls += "?" + c.urlParams_.Encode()
  7143. req, _ := http.NewRequest("POST", urls, body)
  7144. req.Header = reqHeaders
  7145. googleapi.Expand(req.URL, map[string]string{
  7146. "sourceBucket": c.sourceBucket,
  7147. "sourceObject": c.sourceObject,
  7148. "destinationBucket": c.destinationBucket,
  7149. "destinationObject": c.destinationObject,
  7150. })
  7151. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7152. }
  7153. // Do executes the "storage.objects.copy" call.
  7154. // Exactly one of *Object or error will be non-nil. Any non-2xx status
  7155. // code is an error. Response headers are in either
  7156. // *Object.ServerResponse.Header or (if a response was returned at all)
  7157. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  7158. // check whether the returned error was because http.StatusNotModified
  7159. // was returned.
  7160. func (c *ObjectsCopyCall) Do(opts ...googleapi.CallOption) (*Object, error) {
  7161. gensupport.SetOptions(c.urlParams_, opts...)
  7162. res, err := c.doRequest("json")
  7163. if res != nil && res.StatusCode == http.StatusNotModified {
  7164. if res.Body != nil {
  7165. res.Body.Close()
  7166. }
  7167. return nil, &googleapi.Error{
  7168. Code: res.StatusCode,
  7169. Header: res.Header,
  7170. }
  7171. }
  7172. if err != nil {
  7173. return nil, err
  7174. }
  7175. defer googleapi.CloseBody(res)
  7176. if err := googleapi.CheckResponse(res); err != nil {
  7177. return nil, err
  7178. }
  7179. ret := &Object{
  7180. ServerResponse: googleapi.ServerResponse{
  7181. Header: res.Header,
  7182. HTTPStatusCode: res.StatusCode,
  7183. },
  7184. }
  7185. target := &ret
  7186. if err := gensupport.DecodeResponse(target, res); err != nil {
  7187. return nil, err
  7188. }
  7189. return ret, nil
  7190. // {
  7191. // "description": "Copies a source object to a destination object. Optionally overrides metadata.",
  7192. // "httpMethod": "POST",
  7193. // "id": "storage.objects.copy",
  7194. // "parameterOrder": [
  7195. // "sourceBucket",
  7196. // "sourceObject",
  7197. // "destinationBucket",
  7198. // "destinationObject"
  7199. // ],
  7200. // "parameters": {
  7201. // "destinationBucket": {
  7202. // "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.",
  7203. // "location": "path",
  7204. // "required": true,
  7205. // "type": "string"
  7206. // },
  7207. // "destinationObject": {
  7208. // "description": "Name of the new object. Required when the object metadata is not otherwise provided. Overrides the object metadata's name value, if any.",
  7209. // "location": "path",
  7210. // "required": true,
  7211. // "type": "string"
  7212. // },
  7213. // "destinationPredefinedAcl": {
  7214. // "description": "Apply a predefined set of access controls to the destination object.",
  7215. // "enum": [
  7216. // "authenticatedRead",
  7217. // "bucketOwnerFullControl",
  7218. // "bucketOwnerRead",
  7219. // "private",
  7220. // "projectPrivate",
  7221. // "publicRead"
  7222. // ],
  7223. // "enumDescriptions": [
  7224. // "Object owner gets OWNER access, and allAuthenticatedUsers get READER access.",
  7225. // "Object owner gets OWNER access, and project team owners get OWNER access.",
  7226. // "Object owner gets OWNER access, and project team owners get READER access.",
  7227. // "Object owner gets OWNER access.",
  7228. // "Object owner gets OWNER access, and project team members get access according to their roles.",
  7229. // "Object owner gets OWNER access, and allUsers get READER access."
  7230. // ],
  7231. // "location": "query",
  7232. // "type": "string"
  7233. // },
  7234. // "ifGenerationMatch": {
  7235. // "description": "Makes the operation conditional on whether the destination object's current generation matches the given value. Setting to 0 makes the operation succeed only if there are no live versions of the object.",
  7236. // "format": "int64",
  7237. // "location": "query",
  7238. // "type": "string"
  7239. // },
  7240. // "ifGenerationNotMatch": {
  7241. // "description": "Makes the operation conditional on whether the destination object's current generation does not match the given value. If no live object exists, the precondition fails. Setting to 0 makes the operation succeed only if there is a live version of the object.",
  7242. // "format": "int64",
  7243. // "location": "query",
  7244. // "type": "string"
  7245. // },
  7246. // "ifMetagenerationMatch": {
  7247. // "description": "Makes the operation conditional on whether the destination object's current metageneration matches the given value.",
  7248. // "format": "int64",
  7249. // "location": "query",
  7250. // "type": "string"
  7251. // },
  7252. // "ifMetagenerationNotMatch": {
  7253. // "description": "Makes the operation conditional on whether the destination object's current metageneration does not match the given value.",
  7254. // "format": "int64",
  7255. // "location": "query",
  7256. // "type": "string"
  7257. // },
  7258. // "ifSourceGenerationMatch": {
  7259. // "description": "Makes the operation conditional on whether the source object's current generation matches the given value.",
  7260. // "format": "int64",
  7261. // "location": "query",
  7262. // "type": "string"
  7263. // },
  7264. // "ifSourceGenerationNotMatch": {
  7265. // "description": "Makes the operation conditional on whether the source object's current generation does not match the given value.",
  7266. // "format": "int64",
  7267. // "location": "query",
  7268. // "type": "string"
  7269. // },
  7270. // "ifSourceMetagenerationMatch": {
  7271. // "description": "Makes the operation conditional on whether the source object's current metageneration matches the given value.",
  7272. // "format": "int64",
  7273. // "location": "query",
  7274. // "type": "string"
  7275. // },
  7276. // "ifSourceMetagenerationNotMatch": {
  7277. // "description": "Makes the operation conditional on whether the source object's current metageneration does not match the given value.",
  7278. // "format": "int64",
  7279. // "location": "query",
  7280. // "type": "string"
  7281. // },
  7282. // "projection": {
  7283. // "description": "Set of properties to return. Defaults to noAcl, unless the object resource specifies the acl property, when it defaults to full.",
  7284. // "enum": [
  7285. // "full",
  7286. // "noAcl"
  7287. // ],
  7288. // "enumDescriptions": [
  7289. // "Include all properties.",
  7290. // "Omit the owner, acl property."
  7291. // ],
  7292. // "location": "query",
  7293. // "type": "string"
  7294. // },
  7295. // "sourceBucket": {
  7296. // "description": "Name of the bucket in which to find the source object.",
  7297. // "location": "path",
  7298. // "required": true,
  7299. // "type": "string"
  7300. // },
  7301. // "sourceGeneration": {
  7302. // "description": "If present, selects a specific revision of the source object (as opposed to the latest version, the default).",
  7303. // "format": "int64",
  7304. // "location": "query",
  7305. // "type": "string"
  7306. // },
  7307. // "sourceObject": {
  7308. // "description": "Name of the source object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
  7309. // "location": "path",
  7310. // "required": true,
  7311. // "type": "string"
  7312. // },
  7313. // "userProject": {
  7314. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  7315. // "location": "query",
  7316. // "type": "string"
  7317. // }
  7318. // },
  7319. // "path": "b/{sourceBucket}/o/{sourceObject}/copyTo/b/{destinationBucket}/o/{destinationObject}",
  7320. // "request": {
  7321. // "$ref": "Object"
  7322. // },
  7323. // "response": {
  7324. // "$ref": "Object"
  7325. // },
  7326. // "scopes": [
  7327. // "https://www.googleapis.com/auth/cloud-platform",
  7328. // "https://www.googleapis.com/auth/devstorage.full_control",
  7329. // "https://www.googleapis.com/auth/devstorage.read_write"
  7330. // ]
  7331. // }
  7332. }
  7333. // method id "storage.objects.delete":
  7334. type ObjectsDeleteCall struct {
  7335. s *Service
  7336. bucket string
  7337. object string
  7338. urlParams_ gensupport.URLParams
  7339. ctx_ context.Context
  7340. header_ http.Header
  7341. }
  7342. // Delete: Deletes an object and its metadata. Deletions are permanent
  7343. // if versioning is not enabled for the bucket, or if the generation
  7344. // parameter is used.
  7345. func (r *ObjectsService) Delete(bucket string, object string) *ObjectsDeleteCall {
  7346. c := &ObjectsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7347. c.bucket = bucket
  7348. c.object = object
  7349. return c
  7350. }
  7351. // Generation sets the optional parameter "generation": If present,
  7352. // permanently deletes a specific revision of this object (as opposed to
  7353. // the latest version, the default).
  7354. func (c *ObjectsDeleteCall) Generation(generation int64) *ObjectsDeleteCall {
  7355. c.urlParams_.Set("generation", fmt.Sprint(generation))
  7356. return c
  7357. }
  7358. // IfGenerationMatch sets the optional parameter "ifGenerationMatch":
  7359. // Makes the operation conditional on whether the object's current
  7360. // generation matches the given value. Setting to 0 makes the operation
  7361. // succeed only if there are no live versions of the object.
  7362. func (c *ObjectsDeleteCall) IfGenerationMatch(ifGenerationMatch int64) *ObjectsDeleteCall {
  7363. c.urlParams_.Set("ifGenerationMatch", fmt.Sprint(ifGenerationMatch))
  7364. return c
  7365. }
  7366. // IfGenerationNotMatch sets the optional parameter
  7367. // "ifGenerationNotMatch": Makes the operation conditional on whether
  7368. // the object's current generation does not match the given value. If no
  7369. // live object exists, the precondition fails. Setting to 0 makes the
  7370. // operation succeed only if there is a live version of the object.
  7371. func (c *ObjectsDeleteCall) IfGenerationNotMatch(ifGenerationNotMatch int64) *ObjectsDeleteCall {
  7372. c.urlParams_.Set("ifGenerationNotMatch", fmt.Sprint(ifGenerationNotMatch))
  7373. return c
  7374. }
  7375. // IfMetagenerationMatch sets the optional parameter
  7376. // "ifMetagenerationMatch": Makes the operation conditional on whether
  7377. // the object's current metageneration matches the given value.
  7378. func (c *ObjectsDeleteCall) IfMetagenerationMatch(ifMetagenerationMatch int64) *ObjectsDeleteCall {
  7379. c.urlParams_.Set("ifMetagenerationMatch", fmt.Sprint(ifMetagenerationMatch))
  7380. return c
  7381. }
  7382. // IfMetagenerationNotMatch sets the optional parameter
  7383. // "ifMetagenerationNotMatch": Makes the operation conditional on
  7384. // whether the object's current metageneration does not match the given
  7385. // value.
  7386. func (c *ObjectsDeleteCall) IfMetagenerationNotMatch(ifMetagenerationNotMatch int64) *ObjectsDeleteCall {
  7387. c.urlParams_.Set("ifMetagenerationNotMatch", fmt.Sprint(ifMetagenerationNotMatch))
  7388. return c
  7389. }
  7390. // UserProject sets the optional parameter "userProject": The project to
  7391. // be billed for this request. Required for Requester Pays buckets.
  7392. func (c *ObjectsDeleteCall) UserProject(userProject string) *ObjectsDeleteCall {
  7393. c.urlParams_.Set("userProject", userProject)
  7394. return c
  7395. }
  7396. // Fields allows partial responses to be retrieved. See
  7397. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7398. // for more information.
  7399. func (c *ObjectsDeleteCall) Fields(s ...googleapi.Field) *ObjectsDeleteCall {
  7400. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7401. return c
  7402. }
  7403. // Context sets the context to be used in this call's Do method. Any
  7404. // pending HTTP request will be aborted if the provided context is
  7405. // canceled.
  7406. func (c *ObjectsDeleteCall) Context(ctx context.Context) *ObjectsDeleteCall {
  7407. c.ctx_ = ctx
  7408. return c
  7409. }
  7410. // Header returns an http.Header that can be modified by the caller to
  7411. // add HTTP headers to the request.
  7412. func (c *ObjectsDeleteCall) Header() http.Header {
  7413. if c.header_ == nil {
  7414. c.header_ = make(http.Header)
  7415. }
  7416. return c.header_
  7417. }
  7418. func (c *ObjectsDeleteCall) doRequest(alt string) (*http.Response, error) {
  7419. reqHeaders := make(http.Header)
  7420. for k, v := range c.header_ {
  7421. reqHeaders[k] = v
  7422. }
  7423. reqHeaders.Set("User-Agent", c.s.userAgent())
  7424. var body io.Reader = nil
  7425. c.urlParams_.Set("alt", alt)
  7426. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}")
  7427. urls += "?" + c.urlParams_.Encode()
  7428. req, _ := http.NewRequest("DELETE", urls, body)
  7429. req.Header = reqHeaders
  7430. googleapi.Expand(req.URL, map[string]string{
  7431. "bucket": c.bucket,
  7432. "object": c.object,
  7433. })
  7434. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7435. }
  7436. // Do executes the "storage.objects.delete" call.
  7437. func (c *ObjectsDeleteCall) Do(opts ...googleapi.CallOption) error {
  7438. gensupport.SetOptions(c.urlParams_, opts...)
  7439. res, err := c.doRequest("json")
  7440. if err != nil {
  7441. return err
  7442. }
  7443. defer googleapi.CloseBody(res)
  7444. if err := googleapi.CheckResponse(res); err != nil {
  7445. return err
  7446. }
  7447. return nil
  7448. // {
  7449. // "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.",
  7450. // "httpMethod": "DELETE",
  7451. // "id": "storage.objects.delete",
  7452. // "parameterOrder": [
  7453. // "bucket",
  7454. // "object"
  7455. // ],
  7456. // "parameters": {
  7457. // "bucket": {
  7458. // "description": "Name of the bucket in which the object resides.",
  7459. // "location": "path",
  7460. // "required": true,
  7461. // "type": "string"
  7462. // },
  7463. // "generation": {
  7464. // "description": "If present, permanently deletes a specific revision of this object (as opposed to the latest version, the default).",
  7465. // "format": "int64",
  7466. // "location": "query",
  7467. // "type": "string"
  7468. // },
  7469. // "ifGenerationMatch": {
  7470. // "description": "Makes the operation conditional on whether the object's current generation matches the given value. Setting to 0 makes the operation succeed only if there are no live versions of the object.",
  7471. // "format": "int64",
  7472. // "location": "query",
  7473. // "type": "string"
  7474. // },
  7475. // "ifGenerationNotMatch": {
  7476. // "description": "Makes the operation conditional on whether the object's current generation does not match the given value. If no live object exists, the precondition fails. Setting to 0 makes the operation succeed only if there is a live version of the object.",
  7477. // "format": "int64",
  7478. // "location": "query",
  7479. // "type": "string"
  7480. // },
  7481. // "ifMetagenerationMatch": {
  7482. // "description": "Makes the operation conditional on whether the object's current metageneration matches the given value.",
  7483. // "format": "int64",
  7484. // "location": "query",
  7485. // "type": "string"
  7486. // },
  7487. // "ifMetagenerationNotMatch": {
  7488. // "description": "Makes the operation conditional on whether the object's current metageneration does not match the given value.",
  7489. // "format": "int64",
  7490. // "location": "query",
  7491. // "type": "string"
  7492. // },
  7493. // "object": {
  7494. // "description": "Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
  7495. // "location": "path",
  7496. // "required": true,
  7497. // "type": "string"
  7498. // },
  7499. // "userProject": {
  7500. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  7501. // "location": "query",
  7502. // "type": "string"
  7503. // }
  7504. // },
  7505. // "path": "b/{bucket}/o/{object}",
  7506. // "scopes": [
  7507. // "https://www.googleapis.com/auth/cloud-platform",
  7508. // "https://www.googleapis.com/auth/devstorage.full_control",
  7509. // "https://www.googleapis.com/auth/devstorage.read_write"
  7510. // ]
  7511. // }
  7512. }
  7513. // method id "storage.objects.get":
  7514. type ObjectsGetCall struct {
  7515. s *Service
  7516. bucket string
  7517. object string
  7518. urlParams_ gensupport.URLParams
  7519. ifNoneMatch_ string
  7520. ctx_ context.Context
  7521. header_ http.Header
  7522. }
  7523. // Get: Retrieves an object or its metadata.
  7524. func (r *ObjectsService) Get(bucket string, object string) *ObjectsGetCall {
  7525. c := &ObjectsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7526. c.bucket = bucket
  7527. c.object = object
  7528. return c
  7529. }
  7530. // Generation sets the optional parameter "generation": If present,
  7531. // selects a specific revision of this object (as opposed to the latest
  7532. // version, the default).
  7533. func (c *ObjectsGetCall) Generation(generation int64) *ObjectsGetCall {
  7534. c.urlParams_.Set("generation", fmt.Sprint(generation))
  7535. return c
  7536. }
  7537. // IfGenerationMatch sets the optional parameter "ifGenerationMatch":
  7538. // Makes the operation conditional on whether the object's current
  7539. // generation matches the given value. Setting to 0 makes the operation
  7540. // succeed only if there are no live versions of the object.
  7541. func (c *ObjectsGetCall) IfGenerationMatch(ifGenerationMatch int64) *ObjectsGetCall {
  7542. c.urlParams_.Set("ifGenerationMatch", fmt.Sprint(ifGenerationMatch))
  7543. return c
  7544. }
  7545. // IfGenerationNotMatch sets the optional parameter
  7546. // "ifGenerationNotMatch": Makes the operation conditional on whether
  7547. // the object's current generation does not match the given value. If no
  7548. // live object exists, the precondition fails. Setting to 0 makes the
  7549. // operation succeed only if there is a live version of the object.
  7550. func (c *ObjectsGetCall) IfGenerationNotMatch(ifGenerationNotMatch int64) *ObjectsGetCall {
  7551. c.urlParams_.Set("ifGenerationNotMatch", fmt.Sprint(ifGenerationNotMatch))
  7552. return c
  7553. }
  7554. // IfMetagenerationMatch sets the optional parameter
  7555. // "ifMetagenerationMatch": Makes the operation conditional on whether
  7556. // the object's current metageneration matches the given value.
  7557. func (c *ObjectsGetCall) IfMetagenerationMatch(ifMetagenerationMatch int64) *ObjectsGetCall {
  7558. c.urlParams_.Set("ifMetagenerationMatch", fmt.Sprint(ifMetagenerationMatch))
  7559. return c
  7560. }
  7561. // IfMetagenerationNotMatch sets the optional parameter
  7562. // "ifMetagenerationNotMatch": Makes the operation conditional on
  7563. // whether the object's current metageneration does not match the given
  7564. // value.
  7565. func (c *ObjectsGetCall) IfMetagenerationNotMatch(ifMetagenerationNotMatch int64) *ObjectsGetCall {
  7566. c.urlParams_.Set("ifMetagenerationNotMatch", fmt.Sprint(ifMetagenerationNotMatch))
  7567. return c
  7568. }
  7569. // Projection sets the optional parameter "projection": Set of
  7570. // properties to return. Defaults to noAcl.
  7571. //
  7572. // Possible values:
  7573. // "full" - Include all properties.
  7574. // "noAcl" - Omit the owner, acl property.
  7575. func (c *ObjectsGetCall) Projection(projection string) *ObjectsGetCall {
  7576. c.urlParams_.Set("projection", projection)
  7577. return c
  7578. }
  7579. // UserProject sets the optional parameter "userProject": The project to
  7580. // be billed for this request. Required for Requester Pays buckets.
  7581. func (c *ObjectsGetCall) UserProject(userProject string) *ObjectsGetCall {
  7582. c.urlParams_.Set("userProject", userProject)
  7583. return c
  7584. }
  7585. // Fields allows partial responses to be retrieved. See
  7586. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7587. // for more information.
  7588. func (c *ObjectsGetCall) Fields(s ...googleapi.Field) *ObjectsGetCall {
  7589. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7590. return c
  7591. }
  7592. // IfNoneMatch sets the optional parameter which makes the operation
  7593. // fail if the object's ETag matches the given value. This is useful for
  7594. // getting updates only after the object has changed since the last
  7595. // request. Use googleapi.IsNotModified to check whether the response
  7596. // error from Do is the result of In-None-Match.
  7597. func (c *ObjectsGetCall) IfNoneMatch(entityTag string) *ObjectsGetCall {
  7598. c.ifNoneMatch_ = entityTag
  7599. return c
  7600. }
  7601. // Context sets the context to be used in this call's Do and Download
  7602. // methods. Any pending HTTP request will be aborted if the provided
  7603. // context is canceled.
  7604. func (c *ObjectsGetCall) Context(ctx context.Context) *ObjectsGetCall {
  7605. c.ctx_ = ctx
  7606. return c
  7607. }
  7608. // Header returns an http.Header that can be modified by the caller to
  7609. // add HTTP headers to the request.
  7610. func (c *ObjectsGetCall) Header() http.Header {
  7611. if c.header_ == nil {
  7612. c.header_ = make(http.Header)
  7613. }
  7614. return c.header_
  7615. }
  7616. func (c *ObjectsGetCall) doRequest(alt string) (*http.Response, error) {
  7617. reqHeaders := make(http.Header)
  7618. for k, v := range c.header_ {
  7619. reqHeaders[k] = v
  7620. }
  7621. reqHeaders.Set("User-Agent", c.s.userAgent())
  7622. if c.ifNoneMatch_ != "" {
  7623. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  7624. }
  7625. var body io.Reader = nil
  7626. c.urlParams_.Set("alt", alt)
  7627. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}")
  7628. urls += "?" + c.urlParams_.Encode()
  7629. req, _ := http.NewRequest("GET", urls, body)
  7630. req.Header = reqHeaders
  7631. googleapi.Expand(req.URL, map[string]string{
  7632. "bucket": c.bucket,
  7633. "object": c.object,
  7634. })
  7635. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7636. }
  7637. // Download fetches the API endpoint's "media" value, instead of the normal
  7638. // API response value. If the returned error is nil, the Response is guaranteed to
  7639. // have a 2xx status code. Callers must close the Response.Body as usual.
  7640. func (c *ObjectsGetCall) Download(opts ...googleapi.CallOption) (*http.Response, error) {
  7641. gensupport.SetOptions(c.urlParams_, opts...)
  7642. res, err := c.doRequest("media")
  7643. if err != nil {
  7644. return nil, err
  7645. }
  7646. if err := googleapi.CheckMediaResponse(res); err != nil {
  7647. res.Body.Close()
  7648. return nil, err
  7649. }
  7650. return res, nil
  7651. }
  7652. // Do executes the "storage.objects.get" call.
  7653. // Exactly one of *Object or error will be non-nil. Any non-2xx status
  7654. // code is an error. Response headers are in either
  7655. // *Object.ServerResponse.Header or (if a response was returned at all)
  7656. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  7657. // check whether the returned error was because http.StatusNotModified
  7658. // was returned.
  7659. func (c *ObjectsGetCall) Do(opts ...googleapi.CallOption) (*Object, error) {
  7660. gensupport.SetOptions(c.urlParams_, opts...)
  7661. res, err := c.doRequest("json")
  7662. if res != nil && res.StatusCode == http.StatusNotModified {
  7663. if res.Body != nil {
  7664. res.Body.Close()
  7665. }
  7666. return nil, &googleapi.Error{
  7667. Code: res.StatusCode,
  7668. Header: res.Header,
  7669. }
  7670. }
  7671. if err != nil {
  7672. return nil, err
  7673. }
  7674. defer googleapi.CloseBody(res)
  7675. if err := googleapi.CheckResponse(res); err != nil {
  7676. return nil, err
  7677. }
  7678. ret := &Object{
  7679. ServerResponse: googleapi.ServerResponse{
  7680. Header: res.Header,
  7681. HTTPStatusCode: res.StatusCode,
  7682. },
  7683. }
  7684. target := &ret
  7685. if err := gensupport.DecodeResponse(target, res); err != nil {
  7686. return nil, err
  7687. }
  7688. return ret, nil
  7689. // {
  7690. // "description": "Retrieves an object or its metadata.",
  7691. // "httpMethod": "GET",
  7692. // "id": "storage.objects.get",
  7693. // "parameterOrder": [
  7694. // "bucket",
  7695. // "object"
  7696. // ],
  7697. // "parameters": {
  7698. // "bucket": {
  7699. // "description": "Name of the bucket in which the object resides.",
  7700. // "location": "path",
  7701. // "required": true,
  7702. // "type": "string"
  7703. // },
  7704. // "generation": {
  7705. // "description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).",
  7706. // "format": "int64",
  7707. // "location": "query",
  7708. // "type": "string"
  7709. // },
  7710. // "ifGenerationMatch": {
  7711. // "description": "Makes the operation conditional on whether the object's current generation matches the given value. Setting to 0 makes the operation succeed only if there are no live versions of the object.",
  7712. // "format": "int64",
  7713. // "location": "query",
  7714. // "type": "string"
  7715. // },
  7716. // "ifGenerationNotMatch": {
  7717. // "description": "Makes the operation conditional on whether the object's current generation does not match the given value. If no live object exists, the precondition fails. Setting to 0 makes the operation succeed only if there is a live version of the object.",
  7718. // "format": "int64",
  7719. // "location": "query",
  7720. // "type": "string"
  7721. // },
  7722. // "ifMetagenerationMatch": {
  7723. // "description": "Makes the operation conditional on whether the object's current metageneration matches the given value.",
  7724. // "format": "int64",
  7725. // "location": "query",
  7726. // "type": "string"
  7727. // },
  7728. // "ifMetagenerationNotMatch": {
  7729. // "description": "Makes the operation conditional on whether the object's current metageneration does not match the given value.",
  7730. // "format": "int64",
  7731. // "location": "query",
  7732. // "type": "string"
  7733. // },
  7734. // "object": {
  7735. // "description": "Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
  7736. // "location": "path",
  7737. // "required": true,
  7738. // "type": "string"
  7739. // },
  7740. // "projection": {
  7741. // "description": "Set of properties to return. Defaults to noAcl.",
  7742. // "enum": [
  7743. // "full",
  7744. // "noAcl"
  7745. // ],
  7746. // "enumDescriptions": [
  7747. // "Include all properties.",
  7748. // "Omit the owner, acl property."
  7749. // ],
  7750. // "location": "query",
  7751. // "type": "string"
  7752. // },
  7753. // "userProject": {
  7754. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  7755. // "location": "query",
  7756. // "type": "string"
  7757. // }
  7758. // },
  7759. // "path": "b/{bucket}/o/{object}",
  7760. // "response": {
  7761. // "$ref": "Object"
  7762. // },
  7763. // "scopes": [
  7764. // "https://www.googleapis.com/auth/cloud-platform",
  7765. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  7766. // "https://www.googleapis.com/auth/devstorage.full_control",
  7767. // "https://www.googleapis.com/auth/devstorage.read_only",
  7768. // "https://www.googleapis.com/auth/devstorage.read_write"
  7769. // ],
  7770. // "supportsMediaDownload": true,
  7771. // "useMediaDownloadService": true
  7772. // }
  7773. }
  7774. // method id "storage.objects.getIamPolicy":
  7775. type ObjectsGetIamPolicyCall struct {
  7776. s *Service
  7777. bucket string
  7778. object string
  7779. urlParams_ gensupport.URLParams
  7780. ifNoneMatch_ string
  7781. ctx_ context.Context
  7782. header_ http.Header
  7783. }
  7784. // GetIamPolicy: Returns an IAM policy for the specified object.
  7785. func (r *ObjectsService) GetIamPolicy(bucket string, object string) *ObjectsGetIamPolicyCall {
  7786. c := &ObjectsGetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7787. c.bucket = bucket
  7788. c.object = object
  7789. return c
  7790. }
  7791. // Generation sets the optional parameter "generation": If present,
  7792. // selects a specific revision of this object (as opposed to the latest
  7793. // version, the default).
  7794. func (c *ObjectsGetIamPolicyCall) Generation(generation int64) *ObjectsGetIamPolicyCall {
  7795. c.urlParams_.Set("generation", fmt.Sprint(generation))
  7796. return c
  7797. }
  7798. // UserProject sets the optional parameter "userProject": The project to
  7799. // be billed for this request. Required for Requester Pays buckets.
  7800. func (c *ObjectsGetIamPolicyCall) UserProject(userProject string) *ObjectsGetIamPolicyCall {
  7801. c.urlParams_.Set("userProject", userProject)
  7802. return c
  7803. }
  7804. // Fields allows partial responses to be retrieved. See
  7805. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7806. // for more information.
  7807. func (c *ObjectsGetIamPolicyCall) Fields(s ...googleapi.Field) *ObjectsGetIamPolicyCall {
  7808. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7809. return c
  7810. }
  7811. // IfNoneMatch sets the optional parameter which makes the operation
  7812. // fail if the object's ETag matches the given value. This is useful for
  7813. // getting updates only after the object has changed since the last
  7814. // request. Use googleapi.IsNotModified to check whether the response
  7815. // error from Do is the result of In-None-Match.
  7816. func (c *ObjectsGetIamPolicyCall) IfNoneMatch(entityTag string) *ObjectsGetIamPolicyCall {
  7817. c.ifNoneMatch_ = entityTag
  7818. return c
  7819. }
  7820. // Context sets the context to be used in this call's Do method. Any
  7821. // pending HTTP request will be aborted if the provided context is
  7822. // canceled.
  7823. func (c *ObjectsGetIamPolicyCall) Context(ctx context.Context) *ObjectsGetIamPolicyCall {
  7824. c.ctx_ = ctx
  7825. return c
  7826. }
  7827. // Header returns an http.Header that can be modified by the caller to
  7828. // add HTTP headers to the request.
  7829. func (c *ObjectsGetIamPolicyCall) Header() http.Header {
  7830. if c.header_ == nil {
  7831. c.header_ = make(http.Header)
  7832. }
  7833. return c.header_
  7834. }
  7835. func (c *ObjectsGetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
  7836. reqHeaders := make(http.Header)
  7837. for k, v := range c.header_ {
  7838. reqHeaders[k] = v
  7839. }
  7840. reqHeaders.Set("User-Agent", c.s.userAgent())
  7841. if c.ifNoneMatch_ != "" {
  7842. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  7843. }
  7844. var body io.Reader = nil
  7845. c.urlParams_.Set("alt", alt)
  7846. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}/iam")
  7847. urls += "?" + c.urlParams_.Encode()
  7848. req, _ := http.NewRequest("GET", urls, body)
  7849. req.Header = reqHeaders
  7850. googleapi.Expand(req.URL, map[string]string{
  7851. "bucket": c.bucket,
  7852. "object": c.object,
  7853. })
  7854. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7855. }
  7856. // Do executes the "storage.objects.getIamPolicy" call.
  7857. // Exactly one of *Policy or error will be non-nil. Any non-2xx status
  7858. // code is an error. Response headers are in either
  7859. // *Policy.ServerResponse.Header or (if a response was returned at all)
  7860. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  7861. // check whether the returned error was because http.StatusNotModified
  7862. // was returned.
  7863. func (c *ObjectsGetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) {
  7864. gensupport.SetOptions(c.urlParams_, opts...)
  7865. res, err := c.doRequest("json")
  7866. if res != nil && res.StatusCode == http.StatusNotModified {
  7867. if res.Body != nil {
  7868. res.Body.Close()
  7869. }
  7870. return nil, &googleapi.Error{
  7871. Code: res.StatusCode,
  7872. Header: res.Header,
  7873. }
  7874. }
  7875. if err != nil {
  7876. return nil, err
  7877. }
  7878. defer googleapi.CloseBody(res)
  7879. if err := googleapi.CheckResponse(res); err != nil {
  7880. return nil, err
  7881. }
  7882. ret := &Policy{
  7883. ServerResponse: googleapi.ServerResponse{
  7884. Header: res.Header,
  7885. HTTPStatusCode: res.StatusCode,
  7886. },
  7887. }
  7888. target := &ret
  7889. if err := gensupport.DecodeResponse(target, res); err != nil {
  7890. return nil, err
  7891. }
  7892. return ret, nil
  7893. // {
  7894. // "description": "Returns an IAM policy for the specified object.",
  7895. // "httpMethod": "GET",
  7896. // "id": "storage.objects.getIamPolicy",
  7897. // "parameterOrder": [
  7898. // "bucket",
  7899. // "object"
  7900. // ],
  7901. // "parameters": {
  7902. // "bucket": {
  7903. // "description": "Name of the bucket in which the object resides.",
  7904. // "location": "path",
  7905. // "required": true,
  7906. // "type": "string"
  7907. // },
  7908. // "generation": {
  7909. // "description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).",
  7910. // "format": "int64",
  7911. // "location": "query",
  7912. // "type": "string"
  7913. // },
  7914. // "object": {
  7915. // "description": "Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
  7916. // "location": "path",
  7917. // "required": true,
  7918. // "type": "string"
  7919. // },
  7920. // "userProject": {
  7921. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  7922. // "location": "query",
  7923. // "type": "string"
  7924. // }
  7925. // },
  7926. // "path": "b/{bucket}/o/{object}/iam",
  7927. // "response": {
  7928. // "$ref": "Policy"
  7929. // },
  7930. // "scopes": [
  7931. // "https://www.googleapis.com/auth/cloud-platform",
  7932. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  7933. // "https://www.googleapis.com/auth/devstorage.full_control",
  7934. // "https://www.googleapis.com/auth/devstorage.read_only",
  7935. // "https://www.googleapis.com/auth/devstorage.read_write"
  7936. // ]
  7937. // }
  7938. }
  7939. // method id "storage.objects.insert":
  7940. type ObjectsInsertCall struct {
  7941. s *Service
  7942. bucket string
  7943. object *Object
  7944. urlParams_ gensupport.URLParams
  7945. mediaInfo_ *gensupport.MediaInfo
  7946. ctx_ context.Context
  7947. header_ http.Header
  7948. }
  7949. // Insert: Stores a new object and metadata.
  7950. func (r *ObjectsService) Insert(bucket string, object *Object) *ObjectsInsertCall {
  7951. c := &ObjectsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7952. c.bucket = bucket
  7953. c.object = object
  7954. return c
  7955. }
  7956. // ContentEncoding sets the optional parameter "contentEncoding": If
  7957. // set, sets the contentEncoding property of the final object to this
  7958. // value. Setting this parameter is equivalent to setting the
  7959. // contentEncoding metadata property. This can be useful when uploading
  7960. // an object with uploadType=media to indicate the encoding of the
  7961. // content being uploaded.
  7962. func (c *ObjectsInsertCall) ContentEncoding(contentEncoding string) *ObjectsInsertCall {
  7963. c.urlParams_.Set("contentEncoding", contentEncoding)
  7964. return c
  7965. }
  7966. // IfGenerationMatch sets the optional parameter "ifGenerationMatch":
  7967. // Makes the operation conditional on whether the object's current
  7968. // generation matches the given value. Setting to 0 makes the operation
  7969. // succeed only if there are no live versions of the object.
  7970. func (c *ObjectsInsertCall) IfGenerationMatch(ifGenerationMatch int64) *ObjectsInsertCall {
  7971. c.urlParams_.Set("ifGenerationMatch", fmt.Sprint(ifGenerationMatch))
  7972. return c
  7973. }
  7974. // IfGenerationNotMatch sets the optional parameter
  7975. // "ifGenerationNotMatch": Makes the operation conditional on whether
  7976. // the object's current generation does not match the given value. If no
  7977. // live object exists, the precondition fails. Setting to 0 makes the
  7978. // operation succeed only if there is a live version of the object.
  7979. func (c *ObjectsInsertCall) IfGenerationNotMatch(ifGenerationNotMatch int64) *ObjectsInsertCall {
  7980. c.urlParams_.Set("ifGenerationNotMatch", fmt.Sprint(ifGenerationNotMatch))
  7981. return c
  7982. }
  7983. // IfMetagenerationMatch sets the optional parameter
  7984. // "ifMetagenerationMatch": Makes the operation conditional on whether
  7985. // the object's current metageneration matches the given value.
  7986. func (c *ObjectsInsertCall) IfMetagenerationMatch(ifMetagenerationMatch int64) *ObjectsInsertCall {
  7987. c.urlParams_.Set("ifMetagenerationMatch", fmt.Sprint(ifMetagenerationMatch))
  7988. return c
  7989. }
  7990. // IfMetagenerationNotMatch sets the optional parameter
  7991. // "ifMetagenerationNotMatch": Makes the operation conditional on
  7992. // whether the object's current metageneration does not match the given
  7993. // value.
  7994. func (c *ObjectsInsertCall) IfMetagenerationNotMatch(ifMetagenerationNotMatch int64) *ObjectsInsertCall {
  7995. c.urlParams_.Set("ifMetagenerationNotMatch", fmt.Sprint(ifMetagenerationNotMatch))
  7996. return c
  7997. }
  7998. // KmsKeyName sets the optional parameter "kmsKeyName": Resource name of
  7999. // the Cloud KMS key, of the form
  8000. // projects/my-project/locations/global/keyRings/my-kr/cryptoKeys/my-key,
  8001. // that will be used to encrypt the object. Overrides the object
  8002. // metadata's kms_key_name value, if any. Limited availability; usable
  8003. // only by enabled projects.
  8004. func (c *ObjectsInsertCall) KmsKeyName(kmsKeyName string) *ObjectsInsertCall {
  8005. c.urlParams_.Set("kmsKeyName", kmsKeyName)
  8006. return c
  8007. }
  8008. // Name sets the optional parameter "name": Name of the object. Required
  8009. // when the object metadata is not otherwise provided. Overrides the
  8010. // object metadata's name value, if any. For information about how to
  8011. // URL encode object names to be path safe, see Encoding URI Path Parts.
  8012. func (c *ObjectsInsertCall) Name(name string) *ObjectsInsertCall {
  8013. c.urlParams_.Set("name", name)
  8014. return c
  8015. }
  8016. // PredefinedAcl sets the optional parameter "predefinedAcl": Apply a
  8017. // predefined set of access controls to this object.
  8018. //
  8019. // Possible values:
  8020. // "authenticatedRead" - Object owner gets OWNER access, and
  8021. // allAuthenticatedUsers get READER access.
  8022. // "bucketOwnerFullControl" - Object owner gets OWNER access, and
  8023. // project team owners get OWNER access.
  8024. // "bucketOwnerRead" - Object owner gets OWNER access, and project
  8025. // team owners get READER access.
  8026. // "private" - Object owner gets OWNER access.
  8027. // "projectPrivate" - Object owner gets OWNER access, and project team
  8028. // members get access according to their roles.
  8029. // "publicRead" - Object owner gets OWNER access, and allUsers get
  8030. // READER access.
  8031. func (c *ObjectsInsertCall) PredefinedAcl(predefinedAcl string) *ObjectsInsertCall {
  8032. c.urlParams_.Set("predefinedAcl", predefinedAcl)
  8033. return c
  8034. }
  8035. // Projection sets the optional parameter "projection": Set of
  8036. // properties to return. Defaults to noAcl, unless the object resource
  8037. // specifies the acl property, when it defaults to full.
  8038. //
  8039. // Possible values:
  8040. // "full" - Include all properties.
  8041. // "noAcl" - Omit the owner, acl property.
  8042. func (c *ObjectsInsertCall) Projection(projection string) *ObjectsInsertCall {
  8043. c.urlParams_.Set("projection", projection)
  8044. return c
  8045. }
  8046. // UserProject sets the optional parameter "userProject": The project to
  8047. // be billed for this request. Required for Requester Pays buckets.
  8048. func (c *ObjectsInsertCall) UserProject(userProject string) *ObjectsInsertCall {
  8049. c.urlParams_.Set("userProject", userProject)
  8050. return c
  8051. }
  8052. // Media specifies the media to upload in one or more chunks. The chunk
  8053. // size may be controlled by supplying a MediaOption generated by
  8054. // googleapi.ChunkSize. The chunk size defaults to
  8055. // googleapi.DefaultUploadChunkSize.The Content-Type header used in the
  8056. // upload request will be determined by sniffing the contents of r,
  8057. // unless a MediaOption generated by googleapi.ContentType is
  8058. // supplied.
  8059. // At most one of Media and ResumableMedia may be set.
  8060. func (c *ObjectsInsertCall) Media(r io.Reader, options ...googleapi.MediaOption) *ObjectsInsertCall {
  8061. if ct := c.object.ContentType; ct != "" {
  8062. options = append([]googleapi.MediaOption{googleapi.ContentType(ct)}, options...)
  8063. }
  8064. c.mediaInfo_ = gensupport.NewInfoFromMedia(r, options)
  8065. return c
  8066. }
  8067. // ResumableMedia specifies the media to upload in chunks and can be
  8068. // canceled with ctx.
  8069. //
  8070. // Deprecated: use Media instead.
  8071. //
  8072. // At most one of Media and ResumableMedia may be set. mediaType
  8073. // identifies the MIME media type of the upload, such as "image/png". If
  8074. // mediaType is "", it will be auto-detected. The provided ctx will
  8075. // supersede any context previously provided to the Context method.
  8076. func (c *ObjectsInsertCall) ResumableMedia(ctx context.Context, r io.ReaderAt, size int64, mediaType string) *ObjectsInsertCall {
  8077. c.ctx_ = ctx
  8078. c.mediaInfo_ = gensupport.NewInfoFromResumableMedia(r, size, mediaType)
  8079. return c
  8080. }
  8081. // ProgressUpdater provides a callback function that will be called
  8082. // after every chunk. It should be a low-latency function in order to
  8083. // not slow down the upload operation. This should only be called when
  8084. // using ResumableMedia (as opposed to Media).
  8085. func (c *ObjectsInsertCall) ProgressUpdater(pu googleapi.ProgressUpdater) *ObjectsInsertCall {
  8086. c.mediaInfo_.SetProgressUpdater(pu)
  8087. return c
  8088. }
  8089. // Fields allows partial responses to be retrieved. See
  8090. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  8091. // for more information.
  8092. func (c *ObjectsInsertCall) Fields(s ...googleapi.Field) *ObjectsInsertCall {
  8093. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8094. return c
  8095. }
  8096. // Context sets the context to be used in this call's Do method. Any
  8097. // pending HTTP request will be aborted if the provided context is
  8098. // canceled.
  8099. // This context will supersede any context previously provided to the
  8100. // ResumableMedia method.
  8101. func (c *ObjectsInsertCall) Context(ctx context.Context) *ObjectsInsertCall {
  8102. c.ctx_ = ctx
  8103. return c
  8104. }
  8105. // Header returns an http.Header that can be modified by the caller to
  8106. // add HTTP headers to the request.
  8107. func (c *ObjectsInsertCall) Header() http.Header {
  8108. if c.header_ == nil {
  8109. c.header_ = make(http.Header)
  8110. }
  8111. return c.header_
  8112. }
  8113. func (c *ObjectsInsertCall) doRequest(alt string) (*http.Response, error) {
  8114. reqHeaders := make(http.Header)
  8115. for k, v := range c.header_ {
  8116. reqHeaders[k] = v
  8117. }
  8118. reqHeaders.Set("User-Agent", c.s.userAgent())
  8119. var body io.Reader = nil
  8120. body, err := googleapi.WithoutDataWrapper.JSONReader(c.object)
  8121. if err != nil {
  8122. return nil, err
  8123. }
  8124. reqHeaders.Set("Content-Type", "application/json")
  8125. c.urlParams_.Set("alt", alt)
  8126. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o")
  8127. if c.mediaInfo_ != nil {
  8128. urls = strings.Replace(urls, "https://www.googleapis.com/", "https://www.googleapis.com/upload/", 1)
  8129. c.urlParams_.Set("uploadType", c.mediaInfo_.UploadType())
  8130. }
  8131. if body == nil {
  8132. body = new(bytes.Buffer)
  8133. reqHeaders.Set("Content-Type", "application/json")
  8134. }
  8135. body, cleanup := c.mediaInfo_.UploadRequest(reqHeaders, body)
  8136. defer cleanup()
  8137. urls += "?" + c.urlParams_.Encode()
  8138. req, _ := http.NewRequest("POST", urls, body)
  8139. req.Header = reqHeaders
  8140. googleapi.Expand(req.URL, map[string]string{
  8141. "bucket": c.bucket,
  8142. })
  8143. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  8144. }
  8145. // Do executes the "storage.objects.insert" call.
  8146. // Exactly one of *Object or error will be non-nil. Any non-2xx status
  8147. // code is an error. Response headers are in either
  8148. // *Object.ServerResponse.Header or (if a response was returned at all)
  8149. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  8150. // check whether the returned error was because http.StatusNotModified
  8151. // was returned.
  8152. func (c *ObjectsInsertCall) Do(opts ...googleapi.CallOption) (*Object, error) {
  8153. gensupport.SetOptions(c.urlParams_, opts...)
  8154. res, err := c.doRequest("json")
  8155. if res != nil && res.StatusCode == http.StatusNotModified {
  8156. if res.Body != nil {
  8157. res.Body.Close()
  8158. }
  8159. return nil, &googleapi.Error{
  8160. Code: res.StatusCode,
  8161. Header: res.Header,
  8162. }
  8163. }
  8164. if err != nil {
  8165. return nil, err
  8166. }
  8167. defer googleapi.CloseBody(res)
  8168. if err := googleapi.CheckResponse(res); err != nil {
  8169. return nil, err
  8170. }
  8171. rx := c.mediaInfo_.ResumableUpload(res.Header.Get("Location"))
  8172. if rx != nil {
  8173. rx.Client = c.s.client
  8174. rx.UserAgent = c.s.userAgent()
  8175. ctx := c.ctx_
  8176. if ctx == nil {
  8177. ctx = context.TODO()
  8178. }
  8179. res, err = rx.Upload(ctx)
  8180. if err != nil {
  8181. return nil, err
  8182. }
  8183. defer res.Body.Close()
  8184. if err := googleapi.CheckResponse(res); err != nil {
  8185. return nil, err
  8186. }
  8187. }
  8188. ret := &Object{
  8189. ServerResponse: googleapi.ServerResponse{
  8190. Header: res.Header,
  8191. HTTPStatusCode: res.StatusCode,
  8192. },
  8193. }
  8194. target := &ret
  8195. if err := gensupport.DecodeResponse(target, res); err != nil {
  8196. return nil, err
  8197. }
  8198. return ret, nil
  8199. // {
  8200. // "description": "Stores a new object and metadata.",
  8201. // "httpMethod": "POST",
  8202. // "id": "storage.objects.insert",
  8203. // "mediaUpload": {
  8204. // "accept": [
  8205. // "*/*"
  8206. // ],
  8207. // "protocols": {
  8208. // "resumable": {
  8209. // "multipart": true,
  8210. // "path": "/resumable/upload/storage/v1/b/{bucket}/o"
  8211. // },
  8212. // "simple": {
  8213. // "multipart": true,
  8214. // "path": "/upload/storage/v1/b/{bucket}/o"
  8215. // }
  8216. // }
  8217. // },
  8218. // "parameterOrder": [
  8219. // "bucket"
  8220. // ],
  8221. // "parameters": {
  8222. // "bucket": {
  8223. // "description": "Name of the bucket in which to store the new object. Overrides the provided object metadata's bucket value, if any.",
  8224. // "location": "path",
  8225. // "required": true,
  8226. // "type": "string"
  8227. // },
  8228. // "contentEncoding": {
  8229. // "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.",
  8230. // "location": "query",
  8231. // "type": "string"
  8232. // },
  8233. // "ifGenerationMatch": {
  8234. // "description": "Makes the operation conditional on whether the object's current generation matches the given value. Setting to 0 makes the operation succeed only if there are no live versions of the object.",
  8235. // "format": "int64",
  8236. // "location": "query",
  8237. // "type": "string"
  8238. // },
  8239. // "ifGenerationNotMatch": {
  8240. // "description": "Makes the operation conditional on whether the object's current generation does not match the given value. If no live object exists, the precondition fails. Setting to 0 makes the operation succeed only if there is a live version of the object.",
  8241. // "format": "int64",
  8242. // "location": "query",
  8243. // "type": "string"
  8244. // },
  8245. // "ifMetagenerationMatch": {
  8246. // "description": "Makes the operation conditional on whether the object's current metageneration matches the given value.",
  8247. // "format": "int64",
  8248. // "location": "query",
  8249. // "type": "string"
  8250. // },
  8251. // "ifMetagenerationNotMatch": {
  8252. // "description": "Makes the operation conditional on whether the object's current metageneration does not match the given value.",
  8253. // "format": "int64",
  8254. // "location": "query",
  8255. // "type": "string"
  8256. // },
  8257. // "kmsKeyName": {
  8258. // "description": "Resource name of the Cloud KMS key, of the form projects/my-project/locations/global/keyRings/my-kr/cryptoKeys/my-key, that will be used to encrypt the object. Overrides the object metadata's kms_key_name value, if any. Limited availability; usable only by enabled projects.",
  8259. // "location": "query",
  8260. // "type": "string"
  8261. // },
  8262. // "name": {
  8263. // "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.",
  8264. // "location": "query",
  8265. // "type": "string"
  8266. // },
  8267. // "predefinedAcl": {
  8268. // "description": "Apply a predefined set of access controls to this object.",
  8269. // "enum": [
  8270. // "authenticatedRead",
  8271. // "bucketOwnerFullControl",
  8272. // "bucketOwnerRead",
  8273. // "private",
  8274. // "projectPrivate",
  8275. // "publicRead"
  8276. // ],
  8277. // "enumDescriptions": [
  8278. // "Object owner gets OWNER access, and allAuthenticatedUsers get READER access.",
  8279. // "Object owner gets OWNER access, and project team owners get OWNER access.",
  8280. // "Object owner gets OWNER access, and project team owners get READER access.",
  8281. // "Object owner gets OWNER access.",
  8282. // "Object owner gets OWNER access, and project team members get access according to their roles.",
  8283. // "Object owner gets OWNER access, and allUsers get READER access."
  8284. // ],
  8285. // "location": "query",
  8286. // "type": "string"
  8287. // },
  8288. // "projection": {
  8289. // "description": "Set of properties to return. Defaults to noAcl, unless the object resource specifies the acl property, when it defaults to full.",
  8290. // "enum": [
  8291. // "full",
  8292. // "noAcl"
  8293. // ],
  8294. // "enumDescriptions": [
  8295. // "Include all properties.",
  8296. // "Omit the owner, acl property."
  8297. // ],
  8298. // "location": "query",
  8299. // "type": "string"
  8300. // },
  8301. // "userProject": {
  8302. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  8303. // "location": "query",
  8304. // "type": "string"
  8305. // }
  8306. // },
  8307. // "path": "b/{bucket}/o",
  8308. // "request": {
  8309. // "$ref": "Object"
  8310. // },
  8311. // "response": {
  8312. // "$ref": "Object"
  8313. // },
  8314. // "scopes": [
  8315. // "https://www.googleapis.com/auth/cloud-platform",
  8316. // "https://www.googleapis.com/auth/devstorage.full_control",
  8317. // "https://www.googleapis.com/auth/devstorage.read_write"
  8318. // ],
  8319. // "supportsMediaUpload": true
  8320. // }
  8321. }
  8322. // method id "storage.objects.list":
  8323. type ObjectsListCall struct {
  8324. s *Service
  8325. bucket string
  8326. urlParams_ gensupport.URLParams
  8327. ifNoneMatch_ string
  8328. ctx_ context.Context
  8329. header_ http.Header
  8330. }
  8331. // List: Retrieves a list of objects matching the criteria.
  8332. func (r *ObjectsService) List(bucket string) *ObjectsListCall {
  8333. c := &ObjectsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8334. c.bucket = bucket
  8335. return c
  8336. }
  8337. // Delimiter sets the optional parameter "delimiter": Returns results in
  8338. // a directory-like mode. items will contain only objects whose names,
  8339. // aside from the prefix, do not contain delimiter. Objects whose names,
  8340. // aside from the prefix, contain delimiter will have their name,
  8341. // truncated after the delimiter, returned in prefixes. Duplicate
  8342. // prefixes are omitted.
  8343. func (c *ObjectsListCall) Delimiter(delimiter string) *ObjectsListCall {
  8344. c.urlParams_.Set("delimiter", delimiter)
  8345. return c
  8346. }
  8347. // MaxResults sets the optional parameter "maxResults": Maximum number
  8348. // of items plus prefixes to return in a single page of responses. As
  8349. // duplicate prefixes are omitted, fewer total results may be returned
  8350. // than requested. The service will use this parameter or 1,000 items,
  8351. // whichever is smaller.
  8352. func (c *ObjectsListCall) MaxResults(maxResults int64) *ObjectsListCall {
  8353. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  8354. return c
  8355. }
  8356. // PageToken sets the optional parameter "pageToken": A
  8357. // previously-returned page token representing part of the larger set of
  8358. // results to view.
  8359. func (c *ObjectsListCall) PageToken(pageToken string) *ObjectsListCall {
  8360. c.urlParams_.Set("pageToken", pageToken)
  8361. return c
  8362. }
  8363. // Prefix sets the optional parameter "prefix": Filter results to
  8364. // objects whose names begin with this prefix.
  8365. func (c *ObjectsListCall) Prefix(prefix string) *ObjectsListCall {
  8366. c.urlParams_.Set("prefix", prefix)
  8367. return c
  8368. }
  8369. // Projection sets the optional parameter "projection": Set of
  8370. // properties to return. Defaults to noAcl.
  8371. //
  8372. // Possible values:
  8373. // "full" - Include all properties.
  8374. // "noAcl" - Omit the owner, acl property.
  8375. func (c *ObjectsListCall) Projection(projection string) *ObjectsListCall {
  8376. c.urlParams_.Set("projection", projection)
  8377. return c
  8378. }
  8379. // UserProject sets the optional parameter "userProject": The project to
  8380. // be billed for this request. Required for Requester Pays buckets.
  8381. func (c *ObjectsListCall) UserProject(userProject string) *ObjectsListCall {
  8382. c.urlParams_.Set("userProject", userProject)
  8383. return c
  8384. }
  8385. // Versions sets the optional parameter "versions": If true, lists all
  8386. // versions of an object as distinct results. The default is false. For
  8387. // more information, see Object Versioning.
  8388. func (c *ObjectsListCall) Versions(versions bool) *ObjectsListCall {
  8389. c.urlParams_.Set("versions", fmt.Sprint(versions))
  8390. return c
  8391. }
  8392. // Fields allows partial responses to be retrieved. See
  8393. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  8394. // for more information.
  8395. func (c *ObjectsListCall) Fields(s ...googleapi.Field) *ObjectsListCall {
  8396. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8397. return c
  8398. }
  8399. // IfNoneMatch sets the optional parameter which makes the operation
  8400. // fail if the object's ETag matches the given value. This is useful for
  8401. // getting updates only after the object has changed since the last
  8402. // request. Use googleapi.IsNotModified to check whether the response
  8403. // error from Do is the result of In-None-Match.
  8404. func (c *ObjectsListCall) IfNoneMatch(entityTag string) *ObjectsListCall {
  8405. c.ifNoneMatch_ = entityTag
  8406. return c
  8407. }
  8408. // Context sets the context to be used in this call's Do method. Any
  8409. // pending HTTP request will be aborted if the provided context is
  8410. // canceled.
  8411. func (c *ObjectsListCall) Context(ctx context.Context) *ObjectsListCall {
  8412. c.ctx_ = ctx
  8413. return c
  8414. }
  8415. // Header returns an http.Header that can be modified by the caller to
  8416. // add HTTP headers to the request.
  8417. func (c *ObjectsListCall) Header() http.Header {
  8418. if c.header_ == nil {
  8419. c.header_ = make(http.Header)
  8420. }
  8421. return c.header_
  8422. }
  8423. func (c *ObjectsListCall) doRequest(alt string) (*http.Response, error) {
  8424. reqHeaders := make(http.Header)
  8425. for k, v := range c.header_ {
  8426. reqHeaders[k] = v
  8427. }
  8428. reqHeaders.Set("User-Agent", c.s.userAgent())
  8429. if c.ifNoneMatch_ != "" {
  8430. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  8431. }
  8432. var body io.Reader = nil
  8433. c.urlParams_.Set("alt", alt)
  8434. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o")
  8435. urls += "?" + c.urlParams_.Encode()
  8436. req, _ := http.NewRequest("GET", urls, body)
  8437. req.Header = reqHeaders
  8438. googleapi.Expand(req.URL, map[string]string{
  8439. "bucket": c.bucket,
  8440. })
  8441. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  8442. }
  8443. // Do executes the "storage.objects.list" call.
  8444. // Exactly one of *Objects or error will be non-nil. Any non-2xx status
  8445. // code is an error. Response headers are in either
  8446. // *Objects.ServerResponse.Header or (if a response was returned at all)
  8447. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  8448. // check whether the returned error was because http.StatusNotModified
  8449. // was returned.
  8450. func (c *ObjectsListCall) Do(opts ...googleapi.CallOption) (*Objects, error) {
  8451. gensupport.SetOptions(c.urlParams_, opts...)
  8452. res, err := c.doRequest("json")
  8453. if res != nil && res.StatusCode == http.StatusNotModified {
  8454. if res.Body != nil {
  8455. res.Body.Close()
  8456. }
  8457. return nil, &googleapi.Error{
  8458. Code: res.StatusCode,
  8459. Header: res.Header,
  8460. }
  8461. }
  8462. if err != nil {
  8463. return nil, err
  8464. }
  8465. defer googleapi.CloseBody(res)
  8466. if err := googleapi.CheckResponse(res); err != nil {
  8467. return nil, err
  8468. }
  8469. ret := &Objects{
  8470. ServerResponse: googleapi.ServerResponse{
  8471. Header: res.Header,
  8472. HTTPStatusCode: res.StatusCode,
  8473. },
  8474. }
  8475. target := &ret
  8476. if err := gensupport.DecodeResponse(target, res); err != nil {
  8477. return nil, err
  8478. }
  8479. return ret, nil
  8480. // {
  8481. // "description": "Retrieves a list of objects matching the criteria.",
  8482. // "httpMethod": "GET",
  8483. // "id": "storage.objects.list",
  8484. // "parameterOrder": [
  8485. // "bucket"
  8486. // ],
  8487. // "parameters": {
  8488. // "bucket": {
  8489. // "description": "Name of the bucket in which to look for objects.",
  8490. // "location": "path",
  8491. // "required": true,
  8492. // "type": "string"
  8493. // },
  8494. // "delimiter": {
  8495. // "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.",
  8496. // "location": "query",
  8497. // "type": "string"
  8498. // },
  8499. // "maxResults": {
  8500. // "default": "1000",
  8501. // "description": "Maximum number of items plus prefixes to return in a single page of responses. As duplicate prefixes are omitted, fewer total results may be returned than requested. The service will use this parameter or 1,000 items, whichever is smaller.",
  8502. // "format": "uint32",
  8503. // "location": "query",
  8504. // "minimum": "0",
  8505. // "type": "integer"
  8506. // },
  8507. // "pageToken": {
  8508. // "description": "A previously-returned page token representing part of the larger set of results to view.",
  8509. // "location": "query",
  8510. // "type": "string"
  8511. // },
  8512. // "prefix": {
  8513. // "description": "Filter results to objects whose names begin with this prefix.",
  8514. // "location": "query",
  8515. // "type": "string"
  8516. // },
  8517. // "projection": {
  8518. // "description": "Set of properties to return. Defaults to noAcl.",
  8519. // "enum": [
  8520. // "full",
  8521. // "noAcl"
  8522. // ],
  8523. // "enumDescriptions": [
  8524. // "Include all properties.",
  8525. // "Omit the owner, acl property."
  8526. // ],
  8527. // "location": "query",
  8528. // "type": "string"
  8529. // },
  8530. // "userProject": {
  8531. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  8532. // "location": "query",
  8533. // "type": "string"
  8534. // },
  8535. // "versions": {
  8536. // "description": "If true, lists all versions of an object as distinct results. The default is false. For more information, see Object Versioning.",
  8537. // "location": "query",
  8538. // "type": "boolean"
  8539. // }
  8540. // },
  8541. // "path": "b/{bucket}/o",
  8542. // "response": {
  8543. // "$ref": "Objects"
  8544. // },
  8545. // "scopes": [
  8546. // "https://www.googleapis.com/auth/cloud-platform",
  8547. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  8548. // "https://www.googleapis.com/auth/devstorage.full_control",
  8549. // "https://www.googleapis.com/auth/devstorage.read_only",
  8550. // "https://www.googleapis.com/auth/devstorage.read_write"
  8551. // ],
  8552. // "supportsSubscription": true
  8553. // }
  8554. }
  8555. // Pages invokes f for each page of results.
  8556. // A non-nil error returned from f will halt the iteration.
  8557. // The provided context supersedes any context provided to the Context method.
  8558. func (c *ObjectsListCall) Pages(ctx context.Context, f func(*Objects) error) error {
  8559. c.ctx_ = ctx
  8560. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  8561. for {
  8562. x, err := c.Do()
  8563. if err != nil {
  8564. return err
  8565. }
  8566. if err := f(x); err != nil {
  8567. return err
  8568. }
  8569. if x.NextPageToken == "" {
  8570. return nil
  8571. }
  8572. c.PageToken(x.NextPageToken)
  8573. }
  8574. }
  8575. // method id "storage.objects.patch":
  8576. type ObjectsPatchCall struct {
  8577. s *Service
  8578. bucket string
  8579. object string
  8580. object2 *Object
  8581. urlParams_ gensupport.URLParams
  8582. ctx_ context.Context
  8583. header_ http.Header
  8584. }
  8585. // Patch: Patches an object's metadata.
  8586. func (r *ObjectsService) Patch(bucket string, object string, object2 *Object) *ObjectsPatchCall {
  8587. c := &ObjectsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8588. c.bucket = bucket
  8589. c.object = object
  8590. c.object2 = object2
  8591. return c
  8592. }
  8593. // Generation sets the optional parameter "generation": If present,
  8594. // selects a specific revision of this object (as opposed to the latest
  8595. // version, the default).
  8596. func (c *ObjectsPatchCall) Generation(generation int64) *ObjectsPatchCall {
  8597. c.urlParams_.Set("generation", fmt.Sprint(generation))
  8598. return c
  8599. }
  8600. // IfGenerationMatch sets the optional parameter "ifGenerationMatch":
  8601. // Makes the operation conditional on whether the object's current
  8602. // generation matches the given value. Setting to 0 makes the operation
  8603. // succeed only if there are no live versions of the object.
  8604. func (c *ObjectsPatchCall) IfGenerationMatch(ifGenerationMatch int64) *ObjectsPatchCall {
  8605. c.urlParams_.Set("ifGenerationMatch", fmt.Sprint(ifGenerationMatch))
  8606. return c
  8607. }
  8608. // IfGenerationNotMatch sets the optional parameter
  8609. // "ifGenerationNotMatch": Makes the operation conditional on whether
  8610. // the object's current generation does not match the given value. If no
  8611. // live object exists, the precondition fails. Setting to 0 makes the
  8612. // operation succeed only if there is a live version of the object.
  8613. func (c *ObjectsPatchCall) IfGenerationNotMatch(ifGenerationNotMatch int64) *ObjectsPatchCall {
  8614. c.urlParams_.Set("ifGenerationNotMatch", fmt.Sprint(ifGenerationNotMatch))
  8615. return c
  8616. }
  8617. // IfMetagenerationMatch sets the optional parameter
  8618. // "ifMetagenerationMatch": Makes the operation conditional on whether
  8619. // the object's current metageneration matches the given value.
  8620. func (c *ObjectsPatchCall) IfMetagenerationMatch(ifMetagenerationMatch int64) *ObjectsPatchCall {
  8621. c.urlParams_.Set("ifMetagenerationMatch", fmt.Sprint(ifMetagenerationMatch))
  8622. return c
  8623. }
  8624. // IfMetagenerationNotMatch sets the optional parameter
  8625. // "ifMetagenerationNotMatch": Makes the operation conditional on
  8626. // whether the object's current metageneration does not match the given
  8627. // value.
  8628. func (c *ObjectsPatchCall) IfMetagenerationNotMatch(ifMetagenerationNotMatch int64) *ObjectsPatchCall {
  8629. c.urlParams_.Set("ifMetagenerationNotMatch", fmt.Sprint(ifMetagenerationNotMatch))
  8630. return c
  8631. }
  8632. // PredefinedAcl sets the optional parameter "predefinedAcl": Apply a
  8633. // predefined set of access controls to this object.
  8634. //
  8635. // Possible values:
  8636. // "authenticatedRead" - Object owner gets OWNER access, and
  8637. // allAuthenticatedUsers get READER access.
  8638. // "bucketOwnerFullControl" - Object owner gets OWNER access, and
  8639. // project team owners get OWNER access.
  8640. // "bucketOwnerRead" - Object owner gets OWNER access, and project
  8641. // team owners get READER access.
  8642. // "private" - Object owner gets OWNER access.
  8643. // "projectPrivate" - Object owner gets OWNER access, and project team
  8644. // members get access according to their roles.
  8645. // "publicRead" - Object owner gets OWNER access, and allUsers get
  8646. // READER access.
  8647. func (c *ObjectsPatchCall) PredefinedAcl(predefinedAcl string) *ObjectsPatchCall {
  8648. c.urlParams_.Set("predefinedAcl", predefinedAcl)
  8649. return c
  8650. }
  8651. // Projection sets the optional parameter "projection": Set of
  8652. // properties to return. Defaults to full.
  8653. //
  8654. // Possible values:
  8655. // "full" - Include all properties.
  8656. // "noAcl" - Omit the owner, acl property.
  8657. func (c *ObjectsPatchCall) Projection(projection string) *ObjectsPatchCall {
  8658. c.urlParams_.Set("projection", projection)
  8659. return c
  8660. }
  8661. // UserProject sets the optional parameter "userProject": The project to
  8662. // be billed for this request, for Requester Pays buckets.
  8663. func (c *ObjectsPatchCall) UserProject(userProject string) *ObjectsPatchCall {
  8664. c.urlParams_.Set("userProject", userProject)
  8665. return c
  8666. }
  8667. // Fields allows partial responses to be retrieved. See
  8668. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  8669. // for more information.
  8670. func (c *ObjectsPatchCall) Fields(s ...googleapi.Field) *ObjectsPatchCall {
  8671. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8672. return c
  8673. }
  8674. // Context sets the context to be used in this call's Do method. Any
  8675. // pending HTTP request will be aborted if the provided context is
  8676. // canceled.
  8677. func (c *ObjectsPatchCall) Context(ctx context.Context) *ObjectsPatchCall {
  8678. c.ctx_ = ctx
  8679. return c
  8680. }
  8681. // Header returns an http.Header that can be modified by the caller to
  8682. // add HTTP headers to the request.
  8683. func (c *ObjectsPatchCall) Header() http.Header {
  8684. if c.header_ == nil {
  8685. c.header_ = make(http.Header)
  8686. }
  8687. return c.header_
  8688. }
  8689. func (c *ObjectsPatchCall) doRequest(alt string) (*http.Response, error) {
  8690. reqHeaders := make(http.Header)
  8691. for k, v := range c.header_ {
  8692. reqHeaders[k] = v
  8693. }
  8694. reqHeaders.Set("User-Agent", c.s.userAgent())
  8695. var body io.Reader = nil
  8696. body, err := googleapi.WithoutDataWrapper.JSONReader(c.object2)
  8697. if err != nil {
  8698. return nil, err
  8699. }
  8700. reqHeaders.Set("Content-Type", "application/json")
  8701. c.urlParams_.Set("alt", alt)
  8702. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}")
  8703. urls += "?" + c.urlParams_.Encode()
  8704. req, _ := http.NewRequest("PATCH", urls, body)
  8705. req.Header = reqHeaders
  8706. googleapi.Expand(req.URL, map[string]string{
  8707. "bucket": c.bucket,
  8708. "object": c.object,
  8709. })
  8710. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  8711. }
  8712. // Do executes the "storage.objects.patch" call.
  8713. // Exactly one of *Object or error will be non-nil. Any non-2xx status
  8714. // code is an error. Response headers are in either
  8715. // *Object.ServerResponse.Header or (if a response was returned at all)
  8716. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  8717. // check whether the returned error was because http.StatusNotModified
  8718. // was returned.
  8719. func (c *ObjectsPatchCall) Do(opts ...googleapi.CallOption) (*Object, error) {
  8720. gensupport.SetOptions(c.urlParams_, opts...)
  8721. res, err := c.doRequest("json")
  8722. if res != nil && res.StatusCode == http.StatusNotModified {
  8723. if res.Body != nil {
  8724. res.Body.Close()
  8725. }
  8726. return nil, &googleapi.Error{
  8727. Code: res.StatusCode,
  8728. Header: res.Header,
  8729. }
  8730. }
  8731. if err != nil {
  8732. return nil, err
  8733. }
  8734. defer googleapi.CloseBody(res)
  8735. if err := googleapi.CheckResponse(res); err != nil {
  8736. return nil, err
  8737. }
  8738. ret := &Object{
  8739. ServerResponse: googleapi.ServerResponse{
  8740. Header: res.Header,
  8741. HTTPStatusCode: res.StatusCode,
  8742. },
  8743. }
  8744. target := &ret
  8745. if err := gensupport.DecodeResponse(target, res); err != nil {
  8746. return nil, err
  8747. }
  8748. return ret, nil
  8749. // {
  8750. // "description": "Patches an object's metadata.",
  8751. // "httpMethod": "PATCH",
  8752. // "id": "storage.objects.patch",
  8753. // "parameterOrder": [
  8754. // "bucket",
  8755. // "object"
  8756. // ],
  8757. // "parameters": {
  8758. // "bucket": {
  8759. // "description": "Name of the bucket in which the object resides.",
  8760. // "location": "path",
  8761. // "required": true,
  8762. // "type": "string"
  8763. // },
  8764. // "generation": {
  8765. // "description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).",
  8766. // "format": "int64",
  8767. // "location": "query",
  8768. // "type": "string"
  8769. // },
  8770. // "ifGenerationMatch": {
  8771. // "description": "Makes the operation conditional on whether the object's current generation matches the given value. Setting to 0 makes the operation succeed only if there are no live versions of the object.",
  8772. // "format": "int64",
  8773. // "location": "query",
  8774. // "type": "string"
  8775. // },
  8776. // "ifGenerationNotMatch": {
  8777. // "description": "Makes the operation conditional on whether the object's current generation does not match the given value. If no live object exists, the precondition fails. Setting to 0 makes the operation succeed only if there is a live version of the object.",
  8778. // "format": "int64",
  8779. // "location": "query",
  8780. // "type": "string"
  8781. // },
  8782. // "ifMetagenerationMatch": {
  8783. // "description": "Makes the operation conditional on whether the object's current metageneration matches the given value.",
  8784. // "format": "int64",
  8785. // "location": "query",
  8786. // "type": "string"
  8787. // },
  8788. // "ifMetagenerationNotMatch": {
  8789. // "description": "Makes the operation conditional on whether the object's current metageneration does not match the given value.",
  8790. // "format": "int64",
  8791. // "location": "query",
  8792. // "type": "string"
  8793. // },
  8794. // "object": {
  8795. // "description": "Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
  8796. // "location": "path",
  8797. // "required": true,
  8798. // "type": "string"
  8799. // },
  8800. // "predefinedAcl": {
  8801. // "description": "Apply a predefined set of access controls to this object.",
  8802. // "enum": [
  8803. // "authenticatedRead",
  8804. // "bucketOwnerFullControl",
  8805. // "bucketOwnerRead",
  8806. // "private",
  8807. // "projectPrivate",
  8808. // "publicRead"
  8809. // ],
  8810. // "enumDescriptions": [
  8811. // "Object owner gets OWNER access, and allAuthenticatedUsers get READER access.",
  8812. // "Object owner gets OWNER access, and project team owners get OWNER access.",
  8813. // "Object owner gets OWNER access, and project team owners get READER access.",
  8814. // "Object owner gets OWNER access.",
  8815. // "Object owner gets OWNER access, and project team members get access according to their roles.",
  8816. // "Object owner gets OWNER access, and allUsers get READER access."
  8817. // ],
  8818. // "location": "query",
  8819. // "type": "string"
  8820. // },
  8821. // "projection": {
  8822. // "description": "Set of properties to return. Defaults to full.",
  8823. // "enum": [
  8824. // "full",
  8825. // "noAcl"
  8826. // ],
  8827. // "enumDescriptions": [
  8828. // "Include all properties.",
  8829. // "Omit the owner, acl property."
  8830. // ],
  8831. // "location": "query",
  8832. // "type": "string"
  8833. // },
  8834. // "userProject": {
  8835. // "description": "The project to be billed for this request, for Requester Pays buckets.",
  8836. // "location": "query",
  8837. // "type": "string"
  8838. // }
  8839. // },
  8840. // "path": "b/{bucket}/o/{object}",
  8841. // "request": {
  8842. // "$ref": "Object"
  8843. // },
  8844. // "response": {
  8845. // "$ref": "Object"
  8846. // },
  8847. // "scopes": [
  8848. // "https://www.googleapis.com/auth/cloud-platform",
  8849. // "https://www.googleapis.com/auth/devstorage.full_control"
  8850. // ]
  8851. // }
  8852. }
  8853. // method id "storage.objects.rewrite":
  8854. type ObjectsRewriteCall struct {
  8855. s *Service
  8856. sourceBucket string
  8857. sourceObject string
  8858. destinationBucket string
  8859. destinationObject string
  8860. object *Object
  8861. urlParams_ gensupport.URLParams
  8862. ctx_ context.Context
  8863. header_ http.Header
  8864. }
  8865. // Rewrite: Rewrites a source object to a destination object. Optionally
  8866. // overrides metadata.
  8867. func (r *ObjectsService) Rewrite(sourceBucket string, sourceObject string, destinationBucket string, destinationObject string, object *Object) *ObjectsRewriteCall {
  8868. c := &ObjectsRewriteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8869. c.sourceBucket = sourceBucket
  8870. c.sourceObject = sourceObject
  8871. c.destinationBucket = destinationBucket
  8872. c.destinationObject = destinationObject
  8873. c.object = object
  8874. return c
  8875. }
  8876. // DestinationKmsKeyName sets the optional parameter
  8877. // "destinationKmsKeyName": Resource name of the Cloud KMS key, of the
  8878. // form
  8879. // projects/my-project/locations/global/keyRings/my-kr/cryptoKeys/my-key,
  8880. // that will be used to encrypt the object. Overrides the object
  8881. // metadata's kms_key_name value, if any.
  8882. func (c *ObjectsRewriteCall) DestinationKmsKeyName(destinationKmsKeyName string) *ObjectsRewriteCall {
  8883. c.urlParams_.Set("destinationKmsKeyName", destinationKmsKeyName)
  8884. return c
  8885. }
  8886. // DestinationPredefinedAcl sets the optional parameter
  8887. // "destinationPredefinedAcl": Apply a predefined set of access controls
  8888. // to the destination object.
  8889. //
  8890. // Possible values:
  8891. // "authenticatedRead" - Object owner gets OWNER access, and
  8892. // allAuthenticatedUsers get READER access.
  8893. // "bucketOwnerFullControl" - Object owner gets OWNER access, and
  8894. // project team owners get OWNER access.
  8895. // "bucketOwnerRead" - Object owner gets OWNER access, and project
  8896. // team owners get READER access.
  8897. // "private" - Object owner gets OWNER access.
  8898. // "projectPrivate" - Object owner gets OWNER access, and project team
  8899. // members get access according to their roles.
  8900. // "publicRead" - Object owner gets OWNER access, and allUsers get
  8901. // READER access.
  8902. func (c *ObjectsRewriteCall) DestinationPredefinedAcl(destinationPredefinedAcl string) *ObjectsRewriteCall {
  8903. c.urlParams_.Set("destinationPredefinedAcl", destinationPredefinedAcl)
  8904. return c
  8905. }
  8906. // IfGenerationMatch sets the optional parameter "ifGenerationMatch":
  8907. // Makes the operation conditional on whether the object's current
  8908. // generation matches the given value. Setting to 0 makes the operation
  8909. // succeed only if there are no live versions of the object.
  8910. func (c *ObjectsRewriteCall) IfGenerationMatch(ifGenerationMatch int64) *ObjectsRewriteCall {
  8911. c.urlParams_.Set("ifGenerationMatch", fmt.Sprint(ifGenerationMatch))
  8912. return c
  8913. }
  8914. // IfGenerationNotMatch sets the optional parameter
  8915. // "ifGenerationNotMatch": Makes the operation conditional on whether
  8916. // the object's current generation does not match the given value. If no
  8917. // live object exists, the precondition fails. Setting to 0 makes the
  8918. // operation succeed only if there is a live version of the object.
  8919. func (c *ObjectsRewriteCall) IfGenerationNotMatch(ifGenerationNotMatch int64) *ObjectsRewriteCall {
  8920. c.urlParams_.Set("ifGenerationNotMatch", fmt.Sprint(ifGenerationNotMatch))
  8921. return c
  8922. }
  8923. // IfMetagenerationMatch sets the optional parameter
  8924. // "ifMetagenerationMatch": Makes the operation conditional on whether
  8925. // the destination object's current metageneration matches the given
  8926. // value.
  8927. func (c *ObjectsRewriteCall) IfMetagenerationMatch(ifMetagenerationMatch int64) *ObjectsRewriteCall {
  8928. c.urlParams_.Set("ifMetagenerationMatch", fmt.Sprint(ifMetagenerationMatch))
  8929. return c
  8930. }
  8931. // IfMetagenerationNotMatch sets the optional parameter
  8932. // "ifMetagenerationNotMatch": Makes the operation conditional on
  8933. // whether the destination object's current metageneration does not
  8934. // match the given value.
  8935. func (c *ObjectsRewriteCall) IfMetagenerationNotMatch(ifMetagenerationNotMatch int64) *ObjectsRewriteCall {
  8936. c.urlParams_.Set("ifMetagenerationNotMatch", fmt.Sprint(ifMetagenerationNotMatch))
  8937. return c
  8938. }
  8939. // IfSourceGenerationMatch sets the optional parameter
  8940. // "ifSourceGenerationMatch": Makes the operation conditional on whether
  8941. // the source object's current generation matches the given value.
  8942. func (c *ObjectsRewriteCall) IfSourceGenerationMatch(ifSourceGenerationMatch int64) *ObjectsRewriteCall {
  8943. c.urlParams_.Set("ifSourceGenerationMatch", fmt.Sprint(ifSourceGenerationMatch))
  8944. return c
  8945. }
  8946. // IfSourceGenerationNotMatch sets the optional parameter
  8947. // "ifSourceGenerationNotMatch": Makes the operation conditional on
  8948. // whether the source object's current generation does not match the
  8949. // given value.
  8950. func (c *ObjectsRewriteCall) IfSourceGenerationNotMatch(ifSourceGenerationNotMatch int64) *ObjectsRewriteCall {
  8951. c.urlParams_.Set("ifSourceGenerationNotMatch", fmt.Sprint(ifSourceGenerationNotMatch))
  8952. return c
  8953. }
  8954. // IfSourceMetagenerationMatch sets the optional parameter
  8955. // "ifSourceMetagenerationMatch": Makes the operation conditional on
  8956. // whether the source object's current metageneration matches the given
  8957. // value.
  8958. func (c *ObjectsRewriteCall) IfSourceMetagenerationMatch(ifSourceMetagenerationMatch int64) *ObjectsRewriteCall {
  8959. c.urlParams_.Set("ifSourceMetagenerationMatch", fmt.Sprint(ifSourceMetagenerationMatch))
  8960. return c
  8961. }
  8962. // IfSourceMetagenerationNotMatch sets the optional parameter
  8963. // "ifSourceMetagenerationNotMatch": Makes the operation conditional on
  8964. // whether the source object's current metageneration does not match the
  8965. // given value.
  8966. func (c *ObjectsRewriteCall) IfSourceMetagenerationNotMatch(ifSourceMetagenerationNotMatch int64) *ObjectsRewriteCall {
  8967. c.urlParams_.Set("ifSourceMetagenerationNotMatch", fmt.Sprint(ifSourceMetagenerationNotMatch))
  8968. return c
  8969. }
  8970. // MaxBytesRewrittenPerCall sets the optional parameter
  8971. // "maxBytesRewrittenPerCall": The maximum number of bytes that will be
  8972. // rewritten per rewrite request. Most callers shouldn't need to specify
  8973. // this parameter - it is primarily in place to support testing. If
  8974. // specified the value must be an integral multiple of 1 MiB (1048576).
  8975. // Also, this only applies to requests where the source and destination
  8976. // span locations and/or storage classes. Finally, this value must not
  8977. // change across rewrite calls else you'll get an error that the
  8978. // rewriteToken is invalid.
  8979. func (c *ObjectsRewriteCall) MaxBytesRewrittenPerCall(maxBytesRewrittenPerCall int64) *ObjectsRewriteCall {
  8980. c.urlParams_.Set("maxBytesRewrittenPerCall", fmt.Sprint(maxBytesRewrittenPerCall))
  8981. return c
  8982. }
  8983. // Projection sets the optional parameter "projection": Set of
  8984. // properties to return. Defaults to noAcl, unless the object resource
  8985. // specifies the acl property, when it defaults to full.
  8986. //
  8987. // Possible values:
  8988. // "full" - Include all properties.
  8989. // "noAcl" - Omit the owner, acl property.
  8990. func (c *ObjectsRewriteCall) Projection(projection string) *ObjectsRewriteCall {
  8991. c.urlParams_.Set("projection", projection)
  8992. return c
  8993. }
  8994. // RewriteToken sets the optional parameter "rewriteToken": Include this
  8995. // field (from the previous rewrite response) on each rewrite request
  8996. // after the first one, until the rewrite response 'done' flag is true.
  8997. // Calls that provide a rewriteToken can omit all other request fields,
  8998. // but if included those fields must match the values provided in the
  8999. // first rewrite request.
  9000. func (c *ObjectsRewriteCall) RewriteToken(rewriteToken string) *ObjectsRewriteCall {
  9001. c.urlParams_.Set("rewriteToken", rewriteToken)
  9002. return c
  9003. }
  9004. // SourceGeneration sets the optional parameter "sourceGeneration": If
  9005. // present, selects a specific revision of the source object (as opposed
  9006. // to the latest version, the default).
  9007. func (c *ObjectsRewriteCall) SourceGeneration(sourceGeneration int64) *ObjectsRewriteCall {
  9008. c.urlParams_.Set("sourceGeneration", fmt.Sprint(sourceGeneration))
  9009. return c
  9010. }
  9011. // UserProject sets the optional parameter "userProject": The project to
  9012. // be billed for this request. Required for Requester Pays buckets.
  9013. func (c *ObjectsRewriteCall) UserProject(userProject string) *ObjectsRewriteCall {
  9014. c.urlParams_.Set("userProject", userProject)
  9015. return c
  9016. }
  9017. // Fields allows partial responses to be retrieved. See
  9018. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  9019. // for more information.
  9020. func (c *ObjectsRewriteCall) Fields(s ...googleapi.Field) *ObjectsRewriteCall {
  9021. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  9022. return c
  9023. }
  9024. // Context sets the context to be used in this call's Do method. Any
  9025. // pending HTTP request will be aborted if the provided context is
  9026. // canceled.
  9027. func (c *ObjectsRewriteCall) Context(ctx context.Context) *ObjectsRewriteCall {
  9028. c.ctx_ = ctx
  9029. return c
  9030. }
  9031. // Header returns an http.Header that can be modified by the caller to
  9032. // add HTTP headers to the request.
  9033. func (c *ObjectsRewriteCall) Header() http.Header {
  9034. if c.header_ == nil {
  9035. c.header_ = make(http.Header)
  9036. }
  9037. return c.header_
  9038. }
  9039. func (c *ObjectsRewriteCall) doRequest(alt string) (*http.Response, error) {
  9040. reqHeaders := make(http.Header)
  9041. for k, v := range c.header_ {
  9042. reqHeaders[k] = v
  9043. }
  9044. reqHeaders.Set("User-Agent", c.s.userAgent())
  9045. var body io.Reader = nil
  9046. body, err := googleapi.WithoutDataWrapper.JSONReader(c.object)
  9047. if err != nil {
  9048. return nil, err
  9049. }
  9050. reqHeaders.Set("Content-Type", "application/json")
  9051. c.urlParams_.Set("alt", alt)
  9052. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{sourceBucket}/o/{sourceObject}/rewriteTo/b/{destinationBucket}/o/{destinationObject}")
  9053. urls += "?" + c.urlParams_.Encode()
  9054. req, _ := http.NewRequest("POST", urls, body)
  9055. req.Header = reqHeaders
  9056. googleapi.Expand(req.URL, map[string]string{
  9057. "sourceBucket": c.sourceBucket,
  9058. "sourceObject": c.sourceObject,
  9059. "destinationBucket": c.destinationBucket,
  9060. "destinationObject": c.destinationObject,
  9061. })
  9062. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  9063. }
  9064. // Do executes the "storage.objects.rewrite" call.
  9065. // Exactly one of *RewriteResponse or error will be non-nil. Any non-2xx
  9066. // status code is an error. Response headers are in either
  9067. // *RewriteResponse.ServerResponse.Header or (if a response was returned
  9068. // at all) in error.(*googleapi.Error).Header. Use
  9069. // googleapi.IsNotModified to check whether the returned error was
  9070. // because http.StatusNotModified was returned.
  9071. func (c *ObjectsRewriteCall) Do(opts ...googleapi.CallOption) (*RewriteResponse, error) {
  9072. gensupport.SetOptions(c.urlParams_, opts...)
  9073. res, err := c.doRequest("json")
  9074. if res != nil && res.StatusCode == http.StatusNotModified {
  9075. if res.Body != nil {
  9076. res.Body.Close()
  9077. }
  9078. return nil, &googleapi.Error{
  9079. Code: res.StatusCode,
  9080. Header: res.Header,
  9081. }
  9082. }
  9083. if err != nil {
  9084. return nil, err
  9085. }
  9086. defer googleapi.CloseBody(res)
  9087. if err := googleapi.CheckResponse(res); err != nil {
  9088. return nil, err
  9089. }
  9090. ret := &RewriteResponse{
  9091. ServerResponse: googleapi.ServerResponse{
  9092. Header: res.Header,
  9093. HTTPStatusCode: res.StatusCode,
  9094. },
  9095. }
  9096. target := &ret
  9097. if err := gensupport.DecodeResponse(target, res); err != nil {
  9098. return nil, err
  9099. }
  9100. return ret, nil
  9101. // {
  9102. // "description": "Rewrites a source object to a destination object. Optionally overrides metadata.",
  9103. // "httpMethod": "POST",
  9104. // "id": "storage.objects.rewrite",
  9105. // "parameterOrder": [
  9106. // "sourceBucket",
  9107. // "sourceObject",
  9108. // "destinationBucket",
  9109. // "destinationObject"
  9110. // ],
  9111. // "parameters": {
  9112. // "destinationBucket": {
  9113. // "description": "Name of the bucket in which to store the new object. Overrides the provided object metadata's bucket value, if any.",
  9114. // "location": "path",
  9115. // "required": true,
  9116. // "type": "string"
  9117. // },
  9118. // "destinationKmsKeyName": {
  9119. // "description": "Resource name of the Cloud KMS key, of the form projects/my-project/locations/global/keyRings/my-kr/cryptoKeys/my-key, that will be used to encrypt the object. Overrides the object metadata's kms_key_name value, if any.",
  9120. // "location": "query",
  9121. // "type": "string"
  9122. // },
  9123. // "destinationObject": {
  9124. // "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.",
  9125. // "location": "path",
  9126. // "required": true,
  9127. // "type": "string"
  9128. // },
  9129. // "destinationPredefinedAcl": {
  9130. // "description": "Apply a predefined set of access controls to the destination object.",
  9131. // "enum": [
  9132. // "authenticatedRead",
  9133. // "bucketOwnerFullControl",
  9134. // "bucketOwnerRead",
  9135. // "private",
  9136. // "projectPrivate",
  9137. // "publicRead"
  9138. // ],
  9139. // "enumDescriptions": [
  9140. // "Object owner gets OWNER access, and allAuthenticatedUsers get READER access.",
  9141. // "Object owner gets OWNER access, and project team owners get OWNER access.",
  9142. // "Object owner gets OWNER access, and project team owners get READER access.",
  9143. // "Object owner gets OWNER access.",
  9144. // "Object owner gets OWNER access, and project team members get access according to their roles.",
  9145. // "Object owner gets OWNER access, and allUsers get READER access."
  9146. // ],
  9147. // "location": "query",
  9148. // "type": "string"
  9149. // },
  9150. // "ifGenerationMatch": {
  9151. // "description": "Makes the operation conditional on whether the object's current generation matches the given value. Setting to 0 makes the operation succeed only if there are no live versions of the object.",
  9152. // "format": "int64",
  9153. // "location": "query",
  9154. // "type": "string"
  9155. // },
  9156. // "ifGenerationNotMatch": {
  9157. // "description": "Makes the operation conditional on whether the object's current generation does not match the given value. If no live object exists, the precondition fails. Setting to 0 makes the operation succeed only if there is a live version of the object.",
  9158. // "format": "int64",
  9159. // "location": "query",
  9160. // "type": "string"
  9161. // },
  9162. // "ifMetagenerationMatch": {
  9163. // "description": "Makes the operation conditional on whether the destination object's current metageneration matches the given value.",
  9164. // "format": "int64",
  9165. // "location": "query",
  9166. // "type": "string"
  9167. // },
  9168. // "ifMetagenerationNotMatch": {
  9169. // "description": "Makes the operation conditional on whether the destination object's current metageneration does not match the given value.",
  9170. // "format": "int64",
  9171. // "location": "query",
  9172. // "type": "string"
  9173. // },
  9174. // "ifSourceGenerationMatch": {
  9175. // "description": "Makes the operation conditional on whether the source object's current generation matches the given value.",
  9176. // "format": "int64",
  9177. // "location": "query",
  9178. // "type": "string"
  9179. // },
  9180. // "ifSourceGenerationNotMatch": {
  9181. // "description": "Makes the operation conditional on whether the source object's current generation does not match the given value.",
  9182. // "format": "int64",
  9183. // "location": "query",
  9184. // "type": "string"
  9185. // },
  9186. // "ifSourceMetagenerationMatch": {
  9187. // "description": "Makes the operation conditional on whether the source object's current metageneration matches the given value.",
  9188. // "format": "int64",
  9189. // "location": "query",
  9190. // "type": "string"
  9191. // },
  9192. // "ifSourceMetagenerationNotMatch": {
  9193. // "description": "Makes the operation conditional on whether the source object's current metageneration does not match the given value.",
  9194. // "format": "int64",
  9195. // "location": "query",
  9196. // "type": "string"
  9197. // },
  9198. // "maxBytesRewrittenPerCall": {
  9199. // "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.",
  9200. // "format": "int64",
  9201. // "location": "query",
  9202. // "type": "string"
  9203. // },
  9204. // "projection": {
  9205. // "description": "Set of properties to return. Defaults to noAcl, unless the object resource specifies the acl property, when it defaults to full.",
  9206. // "enum": [
  9207. // "full",
  9208. // "noAcl"
  9209. // ],
  9210. // "enumDescriptions": [
  9211. // "Include all properties.",
  9212. // "Omit the owner, acl property."
  9213. // ],
  9214. // "location": "query",
  9215. // "type": "string"
  9216. // },
  9217. // "rewriteToken": {
  9218. // "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.",
  9219. // "location": "query",
  9220. // "type": "string"
  9221. // },
  9222. // "sourceBucket": {
  9223. // "description": "Name of the bucket in which to find the source object.",
  9224. // "location": "path",
  9225. // "required": true,
  9226. // "type": "string"
  9227. // },
  9228. // "sourceGeneration": {
  9229. // "description": "If present, selects a specific revision of the source object (as opposed to the latest version, the default).",
  9230. // "format": "int64",
  9231. // "location": "query",
  9232. // "type": "string"
  9233. // },
  9234. // "sourceObject": {
  9235. // "description": "Name of the source object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
  9236. // "location": "path",
  9237. // "required": true,
  9238. // "type": "string"
  9239. // },
  9240. // "userProject": {
  9241. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  9242. // "location": "query",
  9243. // "type": "string"
  9244. // }
  9245. // },
  9246. // "path": "b/{sourceBucket}/o/{sourceObject}/rewriteTo/b/{destinationBucket}/o/{destinationObject}",
  9247. // "request": {
  9248. // "$ref": "Object"
  9249. // },
  9250. // "response": {
  9251. // "$ref": "RewriteResponse"
  9252. // },
  9253. // "scopes": [
  9254. // "https://www.googleapis.com/auth/cloud-platform",
  9255. // "https://www.googleapis.com/auth/devstorage.full_control",
  9256. // "https://www.googleapis.com/auth/devstorage.read_write"
  9257. // ]
  9258. // }
  9259. }
  9260. // method id "storage.objects.setIamPolicy":
  9261. type ObjectsSetIamPolicyCall struct {
  9262. s *Service
  9263. bucket string
  9264. object string
  9265. policy *Policy
  9266. urlParams_ gensupport.URLParams
  9267. ctx_ context.Context
  9268. header_ http.Header
  9269. }
  9270. // SetIamPolicy: Updates an IAM policy for the specified object.
  9271. func (r *ObjectsService) SetIamPolicy(bucket string, object string, policy *Policy) *ObjectsSetIamPolicyCall {
  9272. c := &ObjectsSetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  9273. c.bucket = bucket
  9274. c.object = object
  9275. c.policy = policy
  9276. return c
  9277. }
  9278. // Generation sets the optional parameter "generation": If present,
  9279. // selects a specific revision of this object (as opposed to the latest
  9280. // version, the default).
  9281. func (c *ObjectsSetIamPolicyCall) Generation(generation int64) *ObjectsSetIamPolicyCall {
  9282. c.urlParams_.Set("generation", fmt.Sprint(generation))
  9283. return c
  9284. }
  9285. // UserProject sets the optional parameter "userProject": The project to
  9286. // be billed for this request. Required for Requester Pays buckets.
  9287. func (c *ObjectsSetIamPolicyCall) UserProject(userProject string) *ObjectsSetIamPolicyCall {
  9288. c.urlParams_.Set("userProject", userProject)
  9289. return c
  9290. }
  9291. // Fields allows partial responses to be retrieved. See
  9292. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  9293. // for more information.
  9294. func (c *ObjectsSetIamPolicyCall) Fields(s ...googleapi.Field) *ObjectsSetIamPolicyCall {
  9295. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  9296. return c
  9297. }
  9298. // Context sets the context to be used in this call's Do method. Any
  9299. // pending HTTP request will be aborted if the provided context is
  9300. // canceled.
  9301. func (c *ObjectsSetIamPolicyCall) Context(ctx context.Context) *ObjectsSetIamPolicyCall {
  9302. c.ctx_ = ctx
  9303. return c
  9304. }
  9305. // Header returns an http.Header that can be modified by the caller to
  9306. // add HTTP headers to the request.
  9307. func (c *ObjectsSetIamPolicyCall) Header() http.Header {
  9308. if c.header_ == nil {
  9309. c.header_ = make(http.Header)
  9310. }
  9311. return c.header_
  9312. }
  9313. func (c *ObjectsSetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
  9314. reqHeaders := make(http.Header)
  9315. for k, v := range c.header_ {
  9316. reqHeaders[k] = v
  9317. }
  9318. reqHeaders.Set("User-Agent", c.s.userAgent())
  9319. var body io.Reader = nil
  9320. body, err := googleapi.WithoutDataWrapper.JSONReader(c.policy)
  9321. if err != nil {
  9322. return nil, err
  9323. }
  9324. reqHeaders.Set("Content-Type", "application/json")
  9325. c.urlParams_.Set("alt", alt)
  9326. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}/iam")
  9327. urls += "?" + c.urlParams_.Encode()
  9328. req, _ := http.NewRequest("PUT", urls, body)
  9329. req.Header = reqHeaders
  9330. googleapi.Expand(req.URL, map[string]string{
  9331. "bucket": c.bucket,
  9332. "object": c.object,
  9333. })
  9334. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  9335. }
  9336. // Do executes the "storage.objects.setIamPolicy" call.
  9337. // Exactly one of *Policy or error will be non-nil. Any non-2xx status
  9338. // code is an error. Response headers are in either
  9339. // *Policy.ServerResponse.Header or (if a response was returned at all)
  9340. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  9341. // check whether the returned error was because http.StatusNotModified
  9342. // was returned.
  9343. func (c *ObjectsSetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) {
  9344. gensupport.SetOptions(c.urlParams_, opts...)
  9345. res, err := c.doRequest("json")
  9346. if res != nil && res.StatusCode == http.StatusNotModified {
  9347. if res.Body != nil {
  9348. res.Body.Close()
  9349. }
  9350. return nil, &googleapi.Error{
  9351. Code: res.StatusCode,
  9352. Header: res.Header,
  9353. }
  9354. }
  9355. if err != nil {
  9356. return nil, err
  9357. }
  9358. defer googleapi.CloseBody(res)
  9359. if err := googleapi.CheckResponse(res); err != nil {
  9360. return nil, err
  9361. }
  9362. ret := &Policy{
  9363. ServerResponse: googleapi.ServerResponse{
  9364. Header: res.Header,
  9365. HTTPStatusCode: res.StatusCode,
  9366. },
  9367. }
  9368. target := &ret
  9369. if err := gensupport.DecodeResponse(target, res); err != nil {
  9370. return nil, err
  9371. }
  9372. return ret, nil
  9373. // {
  9374. // "description": "Updates an IAM policy for the specified object.",
  9375. // "httpMethod": "PUT",
  9376. // "id": "storage.objects.setIamPolicy",
  9377. // "parameterOrder": [
  9378. // "bucket",
  9379. // "object"
  9380. // ],
  9381. // "parameters": {
  9382. // "bucket": {
  9383. // "description": "Name of the bucket in which the object resides.",
  9384. // "location": "path",
  9385. // "required": true,
  9386. // "type": "string"
  9387. // },
  9388. // "generation": {
  9389. // "description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).",
  9390. // "format": "int64",
  9391. // "location": "query",
  9392. // "type": "string"
  9393. // },
  9394. // "object": {
  9395. // "description": "Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
  9396. // "location": "path",
  9397. // "required": true,
  9398. // "type": "string"
  9399. // },
  9400. // "userProject": {
  9401. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  9402. // "location": "query",
  9403. // "type": "string"
  9404. // }
  9405. // },
  9406. // "path": "b/{bucket}/o/{object}/iam",
  9407. // "request": {
  9408. // "$ref": "Policy"
  9409. // },
  9410. // "response": {
  9411. // "$ref": "Policy"
  9412. // },
  9413. // "scopes": [
  9414. // "https://www.googleapis.com/auth/cloud-platform",
  9415. // "https://www.googleapis.com/auth/devstorage.full_control",
  9416. // "https://www.googleapis.com/auth/devstorage.read_write"
  9417. // ]
  9418. // }
  9419. }
  9420. // method id "storage.objects.testIamPermissions":
  9421. type ObjectsTestIamPermissionsCall struct {
  9422. s *Service
  9423. bucket string
  9424. object string
  9425. urlParams_ gensupport.URLParams
  9426. ifNoneMatch_ string
  9427. ctx_ context.Context
  9428. header_ http.Header
  9429. }
  9430. // TestIamPermissions: Tests a set of permissions on the given object to
  9431. // see which, if any, are held by the caller.
  9432. func (r *ObjectsService) TestIamPermissions(bucket string, object string, permissions []string) *ObjectsTestIamPermissionsCall {
  9433. c := &ObjectsTestIamPermissionsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  9434. c.bucket = bucket
  9435. c.object = object
  9436. c.urlParams_.SetMulti("permissions", append([]string{}, permissions...))
  9437. return c
  9438. }
  9439. // Generation sets the optional parameter "generation": If present,
  9440. // selects a specific revision of this object (as opposed to the latest
  9441. // version, the default).
  9442. func (c *ObjectsTestIamPermissionsCall) Generation(generation int64) *ObjectsTestIamPermissionsCall {
  9443. c.urlParams_.Set("generation", fmt.Sprint(generation))
  9444. return c
  9445. }
  9446. // UserProject sets the optional parameter "userProject": The project to
  9447. // be billed for this request. Required for Requester Pays buckets.
  9448. func (c *ObjectsTestIamPermissionsCall) UserProject(userProject string) *ObjectsTestIamPermissionsCall {
  9449. c.urlParams_.Set("userProject", userProject)
  9450. return c
  9451. }
  9452. // Fields allows partial responses to be retrieved. See
  9453. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  9454. // for more information.
  9455. func (c *ObjectsTestIamPermissionsCall) Fields(s ...googleapi.Field) *ObjectsTestIamPermissionsCall {
  9456. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  9457. return c
  9458. }
  9459. // IfNoneMatch sets the optional parameter which makes the operation
  9460. // fail if the object's ETag matches the given value. This is useful for
  9461. // getting updates only after the object has changed since the last
  9462. // request. Use googleapi.IsNotModified to check whether the response
  9463. // error from Do is the result of In-None-Match.
  9464. func (c *ObjectsTestIamPermissionsCall) IfNoneMatch(entityTag string) *ObjectsTestIamPermissionsCall {
  9465. c.ifNoneMatch_ = entityTag
  9466. return c
  9467. }
  9468. // Context sets the context to be used in this call's Do method. Any
  9469. // pending HTTP request will be aborted if the provided context is
  9470. // canceled.
  9471. func (c *ObjectsTestIamPermissionsCall) Context(ctx context.Context) *ObjectsTestIamPermissionsCall {
  9472. c.ctx_ = ctx
  9473. return c
  9474. }
  9475. // Header returns an http.Header that can be modified by the caller to
  9476. // add HTTP headers to the request.
  9477. func (c *ObjectsTestIamPermissionsCall) Header() http.Header {
  9478. if c.header_ == nil {
  9479. c.header_ = make(http.Header)
  9480. }
  9481. return c.header_
  9482. }
  9483. func (c *ObjectsTestIamPermissionsCall) doRequest(alt string) (*http.Response, error) {
  9484. reqHeaders := make(http.Header)
  9485. for k, v := range c.header_ {
  9486. reqHeaders[k] = v
  9487. }
  9488. reqHeaders.Set("User-Agent", c.s.userAgent())
  9489. if c.ifNoneMatch_ != "" {
  9490. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  9491. }
  9492. var body io.Reader = nil
  9493. c.urlParams_.Set("alt", alt)
  9494. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}/iam/testPermissions")
  9495. urls += "?" + c.urlParams_.Encode()
  9496. req, _ := http.NewRequest("GET", urls, body)
  9497. req.Header = reqHeaders
  9498. googleapi.Expand(req.URL, map[string]string{
  9499. "bucket": c.bucket,
  9500. "object": c.object,
  9501. })
  9502. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  9503. }
  9504. // Do executes the "storage.objects.testIamPermissions" call.
  9505. // Exactly one of *TestIamPermissionsResponse or error will be non-nil.
  9506. // Any non-2xx status code is an error. Response headers are in either
  9507. // *TestIamPermissionsResponse.ServerResponse.Header or (if a response
  9508. // was returned at all) in error.(*googleapi.Error).Header. Use
  9509. // googleapi.IsNotModified to check whether the returned error was
  9510. // because http.StatusNotModified was returned.
  9511. func (c *ObjectsTestIamPermissionsCall) Do(opts ...googleapi.CallOption) (*TestIamPermissionsResponse, error) {
  9512. gensupport.SetOptions(c.urlParams_, opts...)
  9513. res, err := c.doRequest("json")
  9514. if res != nil && res.StatusCode == http.StatusNotModified {
  9515. if res.Body != nil {
  9516. res.Body.Close()
  9517. }
  9518. return nil, &googleapi.Error{
  9519. Code: res.StatusCode,
  9520. Header: res.Header,
  9521. }
  9522. }
  9523. if err != nil {
  9524. return nil, err
  9525. }
  9526. defer googleapi.CloseBody(res)
  9527. if err := googleapi.CheckResponse(res); err != nil {
  9528. return nil, err
  9529. }
  9530. ret := &TestIamPermissionsResponse{
  9531. ServerResponse: googleapi.ServerResponse{
  9532. Header: res.Header,
  9533. HTTPStatusCode: res.StatusCode,
  9534. },
  9535. }
  9536. target := &ret
  9537. if err := gensupport.DecodeResponse(target, res); err != nil {
  9538. return nil, err
  9539. }
  9540. return ret, nil
  9541. // {
  9542. // "description": "Tests a set of permissions on the given object to see which, if any, are held by the caller.",
  9543. // "httpMethod": "GET",
  9544. // "id": "storage.objects.testIamPermissions",
  9545. // "parameterOrder": [
  9546. // "bucket",
  9547. // "object",
  9548. // "permissions"
  9549. // ],
  9550. // "parameters": {
  9551. // "bucket": {
  9552. // "description": "Name of the bucket in which the object resides.",
  9553. // "location": "path",
  9554. // "required": true,
  9555. // "type": "string"
  9556. // },
  9557. // "generation": {
  9558. // "description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).",
  9559. // "format": "int64",
  9560. // "location": "query",
  9561. // "type": "string"
  9562. // },
  9563. // "object": {
  9564. // "description": "Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
  9565. // "location": "path",
  9566. // "required": true,
  9567. // "type": "string"
  9568. // },
  9569. // "permissions": {
  9570. // "description": "Permissions to test.",
  9571. // "location": "query",
  9572. // "repeated": true,
  9573. // "required": true,
  9574. // "type": "string"
  9575. // },
  9576. // "userProject": {
  9577. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  9578. // "location": "query",
  9579. // "type": "string"
  9580. // }
  9581. // },
  9582. // "path": "b/{bucket}/o/{object}/iam/testPermissions",
  9583. // "response": {
  9584. // "$ref": "TestIamPermissionsResponse"
  9585. // },
  9586. // "scopes": [
  9587. // "https://www.googleapis.com/auth/cloud-platform",
  9588. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  9589. // "https://www.googleapis.com/auth/devstorage.full_control",
  9590. // "https://www.googleapis.com/auth/devstorage.read_only",
  9591. // "https://www.googleapis.com/auth/devstorage.read_write"
  9592. // ]
  9593. // }
  9594. }
  9595. // method id "storage.objects.update":
  9596. type ObjectsUpdateCall struct {
  9597. s *Service
  9598. bucket string
  9599. object string
  9600. object2 *Object
  9601. urlParams_ gensupport.URLParams
  9602. ctx_ context.Context
  9603. header_ http.Header
  9604. }
  9605. // Update: Updates an object's metadata.
  9606. func (r *ObjectsService) Update(bucket string, object string, object2 *Object) *ObjectsUpdateCall {
  9607. c := &ObjectsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  9608. c.bucket = bucket
  9609. c.object = object
  9610. c.object2 = object2
  9611. return c
  9612. }
  9613. // Generation sets the optional parameter "generation": If present,
  9614. // selects a specific revision of this object (as opposed to the latest
  9615. // version, the default).
  9616. func (c *ObjectsUpdateCall) Generation(generation int64) *ObjectsUpdateCall {
  9617. c.urlParams_.Set("generation", fmt.Sprint(generation))
  9618. return c
  9619. }
  9620. // IfGenerationMatch sets the optional parameter "ifGenerationMatch":
  9621. // Makes the operation conditional on whether the object's current
  9622. // generation matches the given value. Setting to 0 makes the operation
  9623. // succeed only if there are no live versions of the object.
  9624. func (c *ObjectsUpdateCall) IfGenerationMatch(ifGenerationMatch int64) *ObjectsUpdateCall {
  9625. c.urlParams_.Set("ifGenerationMatch", fmt.Sprint(ifGenerationMatch))
  9626. return c
  9627. }
  9628. // IfGenerationNotMatch sets the optional parameter
  9629. // "ifGenerationNotMatch": Makes the operation conditional on whether
  9630. // the object's current generation does not match the given value. If no
  9631. // live object exists, the precondition fails. Setting to 0 makes the
  9632. // operation succeed only if there is a live version of the object.
  9633. func (c *ObjectsUpdateCall) IfGenerationNotMatch(ifGenerationNotMatch int64) *ObjectsUpdateCall {
  9634. c.urlParams_.Set("ifGenerationNotMatch", fmt.Sprint(ifGenerationNotMatch))
  9635. return c
  9636. }
  9637. // IfMetagenerationMatch sets the optional parameter
  9638. // "ifMetagenerationMatch": Makes the operation conditional on whether
  9639. // the object's current metageneration matches the given value.
  9640. func (c *ObjectsUpdateCall) IfMetagenerationMatch(ifMetagenerationMatch int64) *ObjectsUpdateCall {
  9641. c.urlParams_.Set("ifMetagenerationMatch", fmt.Sprint(ifMetagenerationMatch))
  9642. return c
  9643. }
  9644. // IfMetagenerationNotMatch sets the optional parameter
  9645. // "ifMetagenerationNotMatch": Makes the operation conditional on
  9646. // whether the object's current metageneration does not match the given
  9647. // value.
  9648. func (c *ObjectsUpdateCall) IfMetagenerationNotMatch(ifMetagenerationNotMatch int64) *ObjectsUpdateCall {
  9649. c.urlParams_.Set("ifMetagenerationNotMatch", fmt.Sprint(ifMetagenerationNotMatch))
  9650. return c
  9651. }
  9652. // PredefinedAcl sets the optional parameter "predefinedAcl": Apply a
  9653. // predefined set of access controls to this object.
  9654. //
  9655. // Possible values:
  9656. // "authenticatedRead" - Object owner gets OWNER access, and
  9657. // allAuthenticatedUsers get READER access.
  9658. // "bucketOwnerFullControl" - Object owner gets OWNER access, and
  9659. // project team owners get OWNER access.
  9660. // "bucketOwnerRead" - Object owner gets OWNER access, and project
  9661. // team owners get READER access.
  9662. // "private" - Object owner gets OWNER access.
  9663. // "projectPrivate" - Object owner gets OWNER access, and project team
  9664. // members get access according to their roles.
  9665. // "publicRead" - Object owner gets OWNER access, and allUsers get
  9666. // READER access.
  9667. func (c *ObjectsUpdateCall) PredefinedAcl(predefinedAcl string) *ObjectsUpdateCall {
  9668. c.urlParams_.Set("predefinedAcl", predefinedAcl)
  9669. return c
  9670. }
  9671. // Projection sets the optional parameter "projection": Set of
  9672. // properties to return. Defaults to full.
  9673. //
  9674. // Possible values:
  9675. // "full" - Include all properties.
  9676. // "noAcl" - Omit the owner, acl property.
  9677. func (c *ObjectsUpdateCall) Projection(projection string) *ObjectsUpdateCall {
  9678. c.urlParams_.Set("projection", projection)
  9679. return c
  9680. }
  9681. // UserProject sets the optional parameter "userProject": The project to
  9682. // be billed for this request. Required for Requester Pays buckets.
  9683. func (c *ObjectsUpdateCall) UserProject(userProject string) *ObjectsUpdateCall {
  9684. c.urlParams_.Set("userProject", userProject)
  9685. return c
  9686. }
  9687. // Fields allows partial responses to be retrieved. See
  9688. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  9689. // for more information.
  9690. func (c *ObjectsUpdateCall) Fields(s ...googleapi.Field) *ObjectsUpdateCall {
  9691. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  9692. return c
  9693. }
  9694. // Context sets the context to be used in this call's Do method. Any
  9695. // pending HTTP request will be aborted if the provided context is
  9696. // canceled.
  9697. func (c *ObjectsUpdateCall) Context(ctx context.Context) *ObjectsUpdateCall {
  9698. c.ctx_ = ctx
  9699. return c
  9700. }
  9701. // Header returns an http.Header that can be modified by the caller to
  9702. // add HTTP headers to the request.
  9703. func (c *ObjectsUpdateCall) Header() http.Header {
  9704. if c.header_ == nil {
  9705. c.header_ = make(http.Header)
  9706. }
  9707. return c.header_
  9708. }
  9709. func (c *ObjectsUpdateCall) doRequest(alt string) (*http.Response, error) {
  9710. reqHeaders := make(http.Header)
  9711. for k, v := range c.header_ {
  9712. reqHeaders[k] = v
  9713. }
  9714. reqHeaders.Set("User-Agent", c.s.userAgent())
  9715. var body io.Reader = nil
  9716. body, err := googleapi.WithoutDataWrapper.JSONReader(c.object2)
  9717. if err != nil {
  9718. return nil, err
  9719. }
  9720. reqHeaders.Set("Content-Type", "application/json")
  9721. c.urlParams_.Set("alt", alt)
  9722. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}")
  9723. urls += "?" + c.urlParams_.Encode()
  9724. req, _ := http.NewRequest("PUT", urls, body)
  9725. req.Header = reqHeaders
  9726. googleapi.Expand(req.URL, map[string]string{
  9727. "bucket": c.bucket,
  9728. "object": c.object,
  9729. })
  9730. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  9731. }
  9732. // Do executes the "storage.objects.update" call.
  9733. // Exactly one of *Object or error will be non-nil. Any non-2xx status
  9734. // code is an error. Response headers are in either
  9735. // *Object.ServerResponse.Header or (if a response was returned at all)
  9736. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  9737. // check whether the returned error was because http.StatusNotModified
  9738. // was returned.
  9739. func (c *ObjectsUpdateCall) Do(opts ...googleapi.CallOption) (*Object, error) {
  9740. gensupport.SetOptions(c.urlParams_, opts...)
  9741. res, err := c.doRequest("json")
  9742. if res != nil && res.StatusCode == http.StatusNotModified {
  9743. if res.Body != nil {
  9744. res.Body.Close()
  9745. }
  9746. return nil, &googleapi.Error{
  9747. Code: res.StatusCode,
  9748. Header: res.Header,
  9749. }
  9750. }
  9751. if err != nil {
  9752. return nil, err
  9753. }
  9754. defer googleapi.CloseBody(res)
  9755. if err := googleapi.CheckResponse(res); err != nil {
  9756. return nil, err
  9757. }
  9758. ret := &Object{
  9759. ServerResponse: googleapi.ServerResponse{
  9760. Header: res.Header,
  9761. HTTPStatusCode: res.StatusCode,
  9762. },
  9763. }
  9764. target := &ret
  9765. if err := gensupport.DecodeResponse(target, res); err != nil {
  9766. return nil, err
  9767. }
  9768. return ret, nil
  9769. // {
  9770. // "description": "Updates an object's metadata.",
  9771. // "httpMethod": "PUT",
  9772. // "id": "storage.objects.update",
  9773. // "parameterOrder": [
  9774. // "bucket",
  9775. // "object"
  9776. // ],
  9777. // "parameters": {
  9778. // "bucket": {
  9779. // "description": "Name of the bucket in which the object resides.",
  9780. // "location": "path",
  9781. // "required": true,
  9782. // "type": "string"
  9783. // },
  9784. // "generation": {
  9785. // "description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).",
  9786. // "format": "int64",
  9787. // "location": "query",
  9788. // "type": "string"
  9789. // },
  9790. // "ifGenerationMatch": {
  9791. // "description": "Makes the operation conditional on whether the object's current generation matches the given value. Setting to 0 makes the operation succeed only if there are no live versions of the object.",
  9792. // "format": "int64",
  9793. // "location": "query",
  9794. // "type": "string"
  9795. // },
  9796. // "ifGenerationNotMatch": {
  9797. // "description": "Makes the operation conditional on whether the object's current generation does not match the given value. If no live object exists, the precondition fails. Setting to 0 makes the operation succeed only if there is a live version of the object.",
  9798. // "format": "int64",
  9799. // "location": "query",
  9800. // "type": "string"
  9801. // },
  9802. // "ifMetagenerationMatch": {
  9803. // "description": "Makes the operation conditional on whether the object's current metageneration matches the given value.",
  9804. // "format": "int64",
  9805. // "location": "query",
  9806. // "type": "string"
  9807. // },
  9808. // "ifMetagenerationNotMatch": {
  9809. // "description": "Makes the operation conditional on whether the object's current metageneration does not match the given value.",
  9810. // "format": "int64",
  9811. // "location": "query",
  9812. // "type": "string"
  9813. // },
  9814. // "object": {
  9815. // "description": "Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
  9816. // "location": "path",
  9817. // "required": true,
  9818. // "type": "string"
  9819. // },
  9820. // "predefinedAcl": {
  9821. // "description": "Apply a predefined set of access controls to this object.",
  9822. // "enum": [
  9823. // "authenticatedRead",
  9824. // "bucketOwnerFullControl",
  9825. // "bucketOwnerRead",
  9826. // "private",
  9827. // "projectPrivate",
  9828. // "publicRead"
  9829. // ],
  9830. // "enumDescriptions": [
  9831. // "Object owner gets OWNER access, and allAuthenticatedUsers get READER access.",
  9832. // "Object owner gets OWNER access, and project team owners get OWNER access.",
  9833. // "Object owner gets OWNER access, and project team owners get READER access.",
  9834. // "Object owner gets OWNER access.",
  9835. // "Object owner gets OWNER access, and project team members get access according to their roles.",
  9836. // "Object owner gets OWNER access, and allUsers get READER access."
  9837. // ],
  9838. // "location": "query",
  9839. // "type": "string"
  9840. // },
  9841. // "projection": {
  9842. // "description": "Set of properties to return. Defaults to full.",
  9843. // "enum": [
  9844. // "full",
  9845. // "noAcl"
  9846. // ],
  9847. // "enumDescriptions": [
  9848. // "Include all properties.",
  9849. // "Omit the owner, acl property."
  9850. // ],
  9851. // "location": "query",
  9852. // "type": "string"
  9853. // },
  9854. // "userProject": {
  9855. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  9856. // "location": "query",
  9857. // "type": "string"
  9858. // }
  9859. // },
  9860. // "path": "b/{bucket}/o/{object}",
  9861. // "request": {
  9862. // "$ref": "Object"
  9863. // },
  9864. // "response": {
  9865. // "$ref": "Object"
  9866. // },
  9867. // "scopes": [
  9868. // "https://www.googleapis.com/auth/cloud-platform",
  9869. // "https://www.googleapis.com/auth/devstorage.full_control"
  9870. // ]
  9871. // }
  9872. }
  9873. // method id "storage.objects.watchAll":
  9874. type ObjectsWatchAllCall struct {
  9875. s *Service
  9876. bucket string
  9877. channel *Channel
  9878. urlParams_ gensupport.URLParams
  9879. ctx_ context.Context
  9880. header_ http.Header
  9881. }
  9882. // WatchAll: Watch for changes on all objects in a bucket.
  9883. func (r *ObjectsService) WatchAll(bucket string, channel *Channel) *ObjectsWatchAllCall {
  9884. c := &ObjectsWatchAllCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  9885. c.bucket = bucket
  9886. c.channel = channel
  9887. return c
  9888. }
  9889. // Delimiter sets the optional parameter "delimiter": Returns results in
  9890. // a directory-like mode. items will contain only objects whose names,
  9891. // aside from the prefix, do not contain delimiter. Objects whose names,
  9892. // aside from the prefix, contain delimiter will have their name,
  9893. // truncated after the delimiter, returned in prefixes. Duplicate
  9894. // prefixes are omitted.
  9895. func (c *ObjectsWatchAllCall) Delimiter(delimiter string) *ObjectsWatchAllCall {
  9896. c.urlParams_.Set("delimiter", delimiter)
  9897. return c
  9898. }
  9899. // MaxResults sets the optional parameter "maxResults": Maximum number
  9900. // of items plus prefixes to return in a single page of responses. As
  9901. // duplicate prefixes are omitted, fewer total results may be returned
  9902. // than requested. The service will use this parameter or 1,000 items,
  9903. // whichever is smaller.
  9904. func (c *ObjectsWatchAllCall) MaxResults(maxResults int64) *ObjectsWatchAllCall {
  9905. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  9906. return c
  9907. }
  9908. // PageToken sets the optional parameter "pageToken": A
  9909. // previously-returned page token representing part of the larger set of
  9910. // results to view.
  9911. func (c *ObjectsWatchAllCall) PageToken(pageToken string) *ObjectsWatchAllCall {
  9912. c.urlParams_.Set("pageToken", pageToken)
  9913. return c
  9914. }
  9915. // Prefix sets the optional parameter "prefix": Filter results to
  9916. // objects whose names begin with this prefix.
  9917. func (c *ObjectsWatchAllCall) Prefix(prefix string) *ObjectsWatchAllCall {
  9918. c.urlParams_.Set("prefix", prefix)
  9919. return c
  9920. }
  9921. // Projection sets the optional parameter "projection": Set of
  9922. // properties to return. Defaults to noAcl.
  9923. //
  9924. // Possible values:
  9925. // "full" - Include all properties.
  9926. // "noAcl" - Omit the owner, acl property.
  9927. func (c *ObjectsWatchAllCall) Projection(projection string) *ObjectsWatchAllCall {
  9928. c.urlParams_.Set("projection", projection)
  9929. return c
  9930. }
  9931. // UserProject sets the optional parameter "userProject": The project to
  9932. // be billed for this request. Required for Requester Pays buckets.
  9933. func (c *ObjectsWatchAllCall) UserProject(userProject string) *ObjectsWatchAllCall {
  9934. c.urlParams_.Set("userProject", userProject)
  9935. return c
  9936. }
  9937. // Versions sets the optional parameter "versions": If true, lists all
  9938. // versions of an object as distinct results. The default is false. For
  9939. // more information, see Object Versioning.
  9940. func (c *ObjectsWatchAllCall) Versions(versions bool) *ObjectsWatchAllCall {
  9941. c.urlParams_.Set("versions", fmt.Sprint(versions))
  9942. return c
  9943. }
  9944. // Fields allows partial responses to be retrieved. See
  9945. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  9946. // for more information.
  9947. func (c *ObjectsWatchAllCall) Fields(s ...googleapi.Field) *ObjectsWatchAllCall {
  9948. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  9949. return c
  9950. }
  9951. // Context sets the context to be used in this call's Do method. Any
  9952. // pending HTTP request will be aborted if the provided context is
  9953. // canceled.
  9954. func (c *ObjectsWatchAllCall) Context(ctx context.Context) *ObjectsWatchAllCall {
  9955. c.ctx_ = ctx
  9956. return c
  9957. }
  9958. // Header returns an http.Header that can be modified by the caller to
  9959. // add HTTP headers to the request.
  9960. func (c *ObjectsWatchAllCall) Header() http.Header {
  9961. if c.header_ == nil {
  9962. c.header_ = make(http.Header)
  9963. }
  9964. return c.header_
  9965. }
  9966. func (c *ObjectsWatchAllCall) doRequest(alt string) (*http.Response, error) {
  9967. reqHeaders := make(http.Header)
  9968. for k, v := range c.header_ {
  9969. reqHeaders[k] = v
  9970. }
  9971. reqHeaders.Set("User-Agent", c.s.userAgent())
  9972. var body io.Reader = nil
  9973. body, err := googleapi.WithoutDataWrapper.JSONReader(c.channel)
  9974. if err != nil {
  9975. return nil, err
  9976. }
  9977. reqHeaders.Set("Content-Type", "application/json")
  9978. c.urlParams_.Set("alt", alt)
  9979. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/watch")
  9980. urls += "?" + c.urlParams_.Encode()
  9981. req, _ := http.NewRequest("POST", urls, body)
  9982. req.Header = reqHeaders
  9983. googleapi.Expand(req.URL, map[string]string{
  9984. "bucket": c.bucket,
  9985. })
  9986. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  9987. }
  9988. // Do executes the "storage.objects.watchAll" call.
  9989. // Exactly one of *Channel or error will be non-nil. Any non-2xx status
  9990. // code is an error. Response headers are in either
  9991. // *Channel.ServerResponse.Header or (if a response was returned at all)
  9992. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  9993. // check whether the returned error was because http.StatusNotModified
  9994. // was returned.
  9995. func (c *ObjectsWatchAllCall) Do(opts ...googleapi.CallOption) (*Channel, error) {
  9996. gensupport.SetOptions(c.urlParams_, opts...)
  9997. res, err := c.doRequest("json")
  9998. if res != nil && res.StatusCode == http.StatusNotModified {
  9999. if res.Body != nil {
  10000. res.Body.Close()
  10001. }
  10002. return nil, &googleapi.Error{
  10003. Code: res.StatusCode,
  10004. Header: res.Header,
  10005. }
  10006. }
  10007. if err != nil {
  10008. return nil, err
  10009. }
  10010. defer googleapi.CloseBody(res)
  10011. if err := googleapi.CheckResponse(res); err != nil {
  10012. return nil, err
  10013. }
  10014. ret := &Channel{
  10015. ServerResponse: googleapi.ServerResponse{
  10016. Header: res.Header,
  10017. HTTPStatusCode: res.StatusCode,
  10018. },
  10019. }
  10020. target := &ret
  10021. if err := gensupport.DecodeResponse(target, res); err != nil {
  10022. return nil, err
  10023. }
  10024. return ret, nil
  10025. // {
  10026. // "description": "Watch for changes on all objects in a bucket.",
  10027. // "httpMethod": "POST",
  10028. // "id": "storage.objects.watchAll",
  10029. // "parameterOrder": [
  10030. // "bucket"
  10031. // ],
  10032. // "parameters": {
  10033. // "bucket": {
  10034. // "description": "Name of the bucket in which to look for objects.",
  10035. // "location": "path",
  10036. // "required": true,
  10037. // "type": "string"
  10038. // },
  10039. // "delimiter": {
  10040. // "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.",
  10041. // "location": "query",
  10042. // "type": "string"
  10043. // },
  10044. // "maxResults": {
  10045. // "default": "1000",
  10046. // "description": "Maximum number of items plus prefixes to return in a single page of responses. As duplicate prefixes are omitted, fewer total results may be returned than requested. The service will use this parameter or 1,000 items, whichever is smaller.",
  10047. // "format": "uint32",
  10048. // "location": "query",
  10049. // "minimum": "0",
  10050. // "type": "integer"
  10051. // },
  10052. // "pageToken": {
  10053. // "description": "A previously-returned page token representing part of the larger set of results to view.",
  10054. // "location": "query",
  10055. // "type": "string"
  10056. // },
  10057. // "prefix": {
  10058. // "description": "Filter results to objects whose names begin with this prefix.",
  10059. // "location": "query",
  10060. // "type": "string"
  10061. // },
  10062. // "projection": {
  10063. // "description": "Set of properties to return. Defaults to noAcl.",
  10064. // "enum": [
  10065. // "full",
  10066. // "noAcl"
  10067. // ],
  10068. // "enumDescriptions": [
  10069. // "Include all properties.",
  10070. // "Omit the owner, acl property."
  10071. // ],
  10072. // "location": "query",
  10073. // "type": "string"
  10074. // },
  10075. // "userProject": {
  10076. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  10077. // "location": "query",
  10078. // "type": "string"
  10079. // },
  10080. // "versions": {
  10081. // "description": "If true, lists all versions of an object as distinct results. The default is false. For more information, see Object Versioning.",
  10082. // "location": "query",
  10083. // "type": "boolean"
  10084. // }
  10085. // },
  10086. // "path": "b/{bucket}/o/watch",
  10087. // "request": {
  10088. // "$ref": "Channel",
  10089. // "parameterName": "resource"
  10090. // },
  10091. // "response": {
  10092. // "$ref": "Channel"
  10093. // },
  10094. // "scopes": [
  10095. // "https://www.googleapis.com/auth/cloud-platform",
  10096. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  10097. // "https://www.googleapis.com/auth/devstorage.full_control",
  10098. // "https://www.googleapis.com/auth/devstorage.read_only",
  10099. // "https://www.googleapis.com/auth/devstorage.read_write"
  10100. // ],
  10101. // "supportsSubscription": true
  10102. // }
  10103. }
  10104. // method id "storage.projects.serviceAccount.get":
  10105. type ProjectsServiceAccountGetCall struct {
  10106. s *Service
  10107. projectId string
  10108. urlParams_ gensupport.URLParams
  10109. ifNoneMatch_ string
  10110. ctx_ context.Context
  10111. header_ http.Header
  10112. }
  10113. // Get: Get the email address of this project's Google Cloud Storage
  10114. // service account.
  10115. func (r *ProjectsServiceAccountService) Get(projectId string) *ProjectsServiceAccountGetCall {
  10116. c := &ProjectsServiceAccountGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  10117. c.projectId = projectId
  10118. return c
  10119. }
  10120. // UserProject sets the optional parameter "userProject": The project to
  10121. // be billed for this request.
  10122. func (c *ProjectsServiceAccountGetCall) UserProject(userProject string) *ProjectsServiceAccountGetCall {
  10123. c.urlParams_.Set("userProject", userProject)
  10124. return c
  10125. }
  10126. // Fields allows partial responses to be retrieved. See
  10127. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  10128. // for more information.
  10129. func (c *ProjectsServiceAccountGetCall) Fields(s ...googleapi.Field) *ProjectsServiceAccountGetCall {
  10130. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  10131. return c
  10132. }
  10133. // IfNoneMatch sets the optional parameter which makes the operation
  10134. // fail if the object's ETag matches the given value. This is useful for
  10135. // getting updates only after the object has changed since the last
  10136. // request. Use googleapi.IsNotModified to check whether the response
  10137. // error from Do is the result of In-None-Match.
  10138. func (c *ProjectsServiceAccountGetCall) IfNoneMatch(entityTag string) *ProjectsServiceAccountGetCall {
  10139. c.ifNoneMatch_ = entityTag
  10140. return c
  10141. }
  10142. // Context sets the context to be used in this call's Do method. Any
  10143. // pending HTTP request will be aborted if the provided context is
  10144. // canceled.
  10145. func (c *ProjectsServiceAccountGetCall) Context(ctx context.Context) *ProjectsServiceAccountGetCall {
  10146. c.ctx_ = ctx
  10147. return c
  10148. }
  10149. // Header returns an http.Header that can be modified by the caller to
  10150. // add HTTP headers to the request.
  10151. func (c *ProjectsServiceAccountGetCall) Header() http.Header {
  10152. if c.header_ == nil {
  10153. c.header_ = make(http.Header)
  10154. }
  10155. return c.header_
  10156. }
  10157. func (c *ProjectsServiceAccountGetCall) doRequest(alt string) (*http.Response, error) {
  10158. reqHeaders := make(http.Header)
  10159. for k, v := range c.header_ {
  10160. reqHeaders[k] = v
  10161. }
  10162. reqHeaders.Set("User-Agent", c.s.userAgent())
  10163. if c.ifNoneMatch_ != "" {
  10164. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  10165. }
  10166. var body io.Reader = nil
  10167. c.urlParams_.Set("alt", alt)
  10168. urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{projectId}/serviceAccount")
  10169. urls += "?" + c.urlParams_.Encode()
  10170. req, _ := http.NewRequest("GET", urls, body)
  10171. req.Header = reqHeaders
  10172. googleapi.Expand(req.URL, map[string]string{
  10173. "projectId": c.projectId,
  10174. })
  10175. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  10176. }
  10177. // Do executes the "storage.projects.serviceAccount.get" call.
  10178. // Exactly one of *ServiceAccount or error will be non-nil. Any non-2xx
  10179. // status code is an error. Response headers are in either
  10180. // *ServiceAccount.ServerResponse.Header or (if a response was returned
  10181. // at all) in error.(*googleapi.Error).Header. Use
  10182. // googleapi.IsNotModified to check whether the returned error was
  10183. // because http.StatusNotModified was returned.
  10184. func (c *ProjectsServiceAccountGetCall) Do(opts ...googleapi.CallOption) (*ServiceAccount, error) {
  10185. gensupport.SetOptions(c.urlParams_, opts...)
  10186. res, err := c.doRequest("json")
  10187. if res != nil && res.StatusCode == http.StatusNotModified {
  10188. if res.Body != nil {
  10189. res.Body.Close()
  10190. }
  10191. return nil, &googleapi.Error{
  10192. Code: res.StatusCode,
  10193. Header: res.Header,
  10194. }
  10195. }
  10196. if err != nil {
  10197. return nil, err
  10198. }
  10199. defer googleapi.CloseBody(res)
  10200. if err := googleapi.CheckResponse(res); err != nil {
  10201. return nil, err
  10202. }
  10203. ret := &ServiceAccount{
  10204. ServerResponse: googleapi.ServerResponse{
  10205. Header: res.Header,
  10206. HTTPStatusCode: res.StatusCode,
  10207. },
  10208. }
  10209. target := &ret
  10210. if err := gensupport.DecodeResponse(target, res); err != nil {
  10211. return nil, err
  10212. }
  10213. return ret, nil
  10214. // {
  10215. // "description": "Get the email address of this project's Google Cloud Storage service account.",
  10216. // "httpMethod": "GET",
  10217. // "id": "storage.projects.serviceAccount.get",
  10218. // "parameterOrder": [
  10219. // "projectId"
  10220. // ],
  10221. // "parameters": {
  10222. // "projectId": {
  10223. // "description": "Project ID",
  10224. // "location": "path",
  10225. // "required": true,
  10226. // "type": "string"
  10227. // },
  10228. // "userProject": {
  10229. // "description": "The project to be billed for this request.",
  10230. // "location": "query",
  10231. // "type": "string"
  10232. // }
  10233. // },
  10234. // "path": "projects/{projectId}/serviceAccount",
  10235. // "response": {
  10236. // "$ref": "ServiceAccount"
  10237. // },
  10238. // "scopes": [
  10239. // "https://www.googleapis.com/auth/cloud-platform",
  10240. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  10241. // "https://www.googleapis.com/auth/devstorage.full_control",
  10242. // "https://www.googleapis.com/auth/devstorage.read_only",
  10243. // "https://www.googleapis.com/auth/devstorage.read_write"
  10244. // ]
  10245. // }
  10246. }