storage-gen.go 402 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401
  1. // Package storage provides access to the Cloud Storage JSON API.
  2. //
  3. // This package is DEPRECATED. Use package cloud.google.com/go/storage instead.
  4. //
  5. // See https://developers.google.com/storage/docs/json_api/
  6. //
  7. // Usage example:
  8. //
  9. // import "google.golang.org/api/storage/v1"
  10. // ...
  11. // storageService, err := storage.New(oauthHttpClient)
  12. package storage // import "google.golang.org/api/storage/v1"
  13. import (
  14. "bytes"
  15. "encoding/json"
  16. "errors"
  17. "fmt"
  18. context "golang.org/x/net/context"
  19. ctxhttp "golang.org/x/net/context/ctxhttp"
  20. gensupport "google.golang.org/api/gensupport"
  21. googleapi "google.golang.org/api/googleapi"
  22. "io"
  23. "net/http"
  24. "net/url"
  25. "strconv"
  26. "strings"
  27. )
  28. // Always reference these packages, just in case the auto-generated code
  29. // below doesn't.
  30. var _ = bytes.NewBuffer
  31. var _ = strconv.Itoa
  32. var _ = fmt.Sprintf
  33. var _ = json.NewDecoder
  34. var _ = io.Copy
  35. var _ = url.Parse
  36. var _ = gensupport.MarshalJSON
  37. var _ = googleapi.Version
  38. var _ = errors.New
  39. var _ = strings.Replace
  40. var _ = context.Canceled
  41. var _ = ctxhttp.Do
  42. const apiId = "storage:v1"
  43. const apiName = "storage"
  44. const apiVersion = "v1"
  45. const basePath = "https://www.googleapis.com/storage/v1/"
  46. // OAuth2 scopes used by this API.
  47. const (
  48. // View and manage your data across Google Cloud Platform services
  49. CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform"
  50. // View your data across Google Cloud Platform services
  51. CloudPlatformReadOnlyScope = "https://www.googleapis.com/auth/cloud-platform.read-only"
  52. // Manage your data and permissions in Google Cloud Storage
  53. DevstorageFullControlScope = "https://www.googleapis.com/auth/devstorage.full_control"
  54. // View your data in Google Cloud Storage
  55. DevstorageReadOnlyScope = "https://www.googleapis.com/auth/devstorage.read_only"
  56. // Manage your data in Google Cloud Storage
  57. DevstorageReadWriteScope = "https://www.googleapis.com/auth/devstorage.read_write"
  58. )
  59. func New(client *http.Client) (*Service, error) {
  60. if client == nil {
  61. return nil, errors.New("client is nil")
  62. }
  63. s := &Service{client: client, BasePath: basePath}
  64. s.BucketAccessControls = NewBucketAccessControlsService(s)
  65. s.Buckets = NewBucketsService(s)
  66. s.Channels = NewChannelsService(s)
  67. s.DefaultObjectAccessControls = NewDefaultObjectAccessControlsService(s)
  68. s.Notifications = NewNotificationsService(s)
  69. s.ObjectAccessControls = NewObjectAccessControlsService(s)
  70. s.Objects = NewObjectsService(s)
  71. s.Projects = NewProjectsService(s)
  72. return s, nil
  73. }
  74. type Service struct {
  75. client *http.Client
  76. BasePath string // API endpoint base URL
  77. UserAgent string // optional additional User-Agent fragment
  78. BucketAccessControls *BucketAccessControlsService
  79. Buckets *BucketsService
  80. Channels *ChannelsService
  81. DefaultObjectAccessControls *DefaultObjectAccessControlsService
  82. Notifications *NotificationsService
  83. ObjectAccessControls *ObjectAccessControlsService
  84. Objects *ObjectsService
  85. Projects *ProjectsService
  86. }
  87. func (s *Service) userAgent() string {
  88. if s.UserAgent == "" {
  89. return googleapi.UserAgent
  90. }
  91. return googleapi.UserAgent + " " + s.UserAgent
  92. }
  93. func NewBucketAccessControlsService(s *Service) *BucketAccessControlsService {
  94. rs := &BucketAccessControlsService{s: s}
  95. return rs
  96. }
  97. type BucketAccessControlsService struct {
  98. s *Service
  99. }
  100. func NewBucketsService(s *Service) *BucketsService {
  101. rs := &BucketsService{s: s}
  102. return rs
  103. }
  104. type BucketsService struct {
  105. s *Service
  106. }
  107. func NewChannelsService(s *Service) *ChannelsService {
  108. rs := &ChannelsService{s: s}
  109. return rs
  110. }
  111. type ChannelsService struct {
  112. s *Service
  113. }
  114. func NewDefaultObjectAccessControlsService(s *Service) *DefaultObjectAccessControlsService {
  115. rs := &DefaultObjectAccessControlsService{s: s}
  116. return rs
  117. }
  118. type DefaultObjectAccessControlsService struct {
  119. s *Service
  120. }
  121. func NewNotificationsService(s *Service) *NotificationsService {
  122. rs := &NotificationsService{s: s}
  123. return rs
  124. }
  125. type NotificationsService struct {
  126. s *Service
  127. }
  128. func NewObjectAccessControlsService(s *Service) *ObjectAccessControlsService {
  129. rs := &ObjectAccessControlsService{s: s}
  130. return rs
  131. }
  132. type ObjectAccessControlsService struct {
  133. s *Service
  134. }
  135. func NewObjectsService(s *Service) *ObjectsService {
  136. rs := &ObjectsService{s: s}
  137. return rs
  138. }
  139. type ObjectsService struct {
  140. s *Service
  141. }
  142. func NewProjectsService(s *Service) *ProjectsService {
  143. rs := &ProjectsService{s: s}
  144. rs.ServiceAccount = NewProjectsServiceAccountService(s)
  145. return rs
  146. }
  147. type ProjectsService struct {
  148. s *Service
  149. ServiceAccount *ProjectsServiceAccountService
  150. }
  151. func NewProjectsServiceAccountService(s *Service) *ProjectsServiceAccountService {
  152. rs := &ProjectsServiceAccountService{s: s}
  153. return rs
  154. }
  155. type ProjectsServiceAccountService struct {
  156. s *Service
  157. }
  158. // Bucket: A bucket.
  159. type Bucket struct {
  160. // Acl: Access controls on the bucket.
  161. Acl []*BucketAccessControl `json:"acl,omitempty"`
  162. // Billing: The bucket's billing configuration.
  163. Billing *BucketBilling `json:"billing,omitempty"`
  164. // Cors: The bucket's Cross-Origin Resource Sharing (CORS)
  165. // configuration.
  166. Cors []*BucketCors `json:"cors,omitempty"`
  167. // DefaultEventBasedHold: The default value for event-based hold on
  168. // newly created objects in this bucket. Event-based hold is a way to
  169. // retain objects indefinitely until an event occurs, signified by the
  170. // hold's release. After being released, such objects will be subject to
  171. // bucket-level retention (if any). One sample use case of this flag is
  172. // for banks to hold loan documents for at least 3 years after loan is
  173. // paid in full. Here, bucket-level retention is 3 years and the event
  174. // is loan being paid in full. In this example, these objects will be
  175. // held intact for any number of years until the event has occurred
  176. // (event-based hold on the object is released) and then 3 more years
  177. // after that. That means retention duration of the objects begins from
  178. // the moment event-based hold transitioned from true to false. Objects
  179. // under event-based hold cannot be deleted, overwritten or archived
  180. // until the hold is removed.
  181. DefaultEventBasedHold bool `json:"defaultEventBasedHold,omitempty"`
  182. // DefaultObjectAcl: Default access controls to apply to new objects
  183. // when no ACL is provided.
  184. DefaultObjectAcl []*ObjectAccessControl `json:"defaultObjectAcl,omitempty"`
  185. // Encryption: Encryption configuration for a bucket.
  186. Encryption *BucketEncryption `json:"encryption,omitempty"`
  187. // Etag: HTTP 1.1 Entity tag for the bucket.
  188. Etag string `json:"etag,omitempty"`
  189. // Id: The ID of the bucket. For buckets, the id and name properties are
  190. // the same.
  191. Id string `json:"id,omitempty"`
  192. // Kind: The kind of item this is. For buckets, this is always
  193. // storage#bucket.
  194. Kind string `json:"kind,omitempty"`
  195. // Labels: User-provided labels, in key/value pairs.
  196. Labels map[string]string `json:"labels,omitempty"`
  197. // Lifecycle: The bucket's lifecycle configuration. See lifecycle
  198. // management for more information.
  199. Lifecycle *BucketLifecycle `json:"lifecycle,omitempty"`
  200. // Location: The location of the bucket. Object data for objects in the
  201. // bucket resides in physical storage within this region. Defaults to
  202. // US. See the developer's guide for the authoritative list.
  203. Location string `json:"location,omitempty"`
  204. // Logging: The bucket's logging configuration, which defines the
  205. // destination bucket and optional name prefix for the current bucket's
  206. // logs.
  207. Logging *BucketLogging `json:"logging,omitempty"`
  208. // Metageneration: The metadata generation of this bucket.
  209. Metageneration int64 `json:"metageneration,omitempty,string"`
  210. // Name: The name of the bucket.
  211. Name string `json:"name,omitempty"`
  212. // Owner: The owner of the bucket. This is always the project team's
  213. // owner group.
  214. Owner *BucketOwner `json:"owner,omitempty"`
  215. // ProjectNumber: The project number of the project the bucket belongs
  216. // to.
  217. ProjectNumber uint64 `json:"projectNumber,omitempty,string"`
  218. // RetentionPolicy: The bucket's retention policy. The retention policy
  219. // enforces a minimum retention time for all objects contained in the
  220. // bucket, based on their creation time. Any attempt to overwrite or
  221. // delete objects younger than the retention period will result in a
  222. // PERMISSION_DENIED error. An unlocked retention policy can be modified
  223. // or removed from the bucket via a storage.buckets.update operation. A
  224. // locked retention policy cannot be removed or shortened in duration
  225. // for the lifetime of the bucket. Attempting to remove or decrease
  226. // period of a locked retention policy will result in a
  227. // PERMISSION_DENIED error.
  228. RetentionPolicy *BucketRetentionPolicy `json:"retentionPolicy,omitempty"`
  229. // SelfLink: The URI of this bucket.
  230. SelfLink string `json:"selfLink,omitempty"`
  231. // StorageClass: The bucket's default storage class, used whenever no
  232. // storageClass is specified for a newly-created object. This defines
  233. // how objects in the bucket are stored and determines the SLA and the
  234. // cost of storage. Values include MULTI_REGIONAL, REGIONAL, STANDARD,
  235. // NEARLINE, COLDLINE, and DURABLE_REDUCED_AVAILABILITY. If this value
  236. // is not specified when the bucket is created, it will default to
  237. // STANDARD. For more information, see storage classes.
  238. StorageClass string `json:"storageClass,omitempty"`
  239. // TimeCreated: The creation time of the bucket in RFC 3339 format.
  240. TimeCreated string `json:"timeCreated,omitempty"`
  241. // Updated: The modification time of the bucket in RFC 3339 format.
  242. Updated string `json:"updated,omitempty"`
  243. // Versioning: The bucket's versioning configuration.
  244. Versioning *BucketVersioning `json:"versioning,omitempty"`
  245. // Website: The bucket's website configuration, controlling how the
  246. // service behaves when accessing bucket contents as a web site. See the
  247. // Static Website Examples for more information.
  248. Website *BucketWebsite `json:"website,omitempty"`
  249. // ServerResponse contains the HTTP response code and headers from the
  250. // server.
  251. googleapi.ServerResponse `json:"-"`
  252. // ForceSendFields is a list of field names (e.g. "Acl") to
  253. // unconditionally include in API requests. By default, fields with
  254. // empty values are omitted from API requests. However, any non-pointer,
  255. // non-interface field appearing in ForceSendFields will be sent to the
  256. // server regardless of whether the field is empty or not. This may be
  257. // used to include empty fields in Patch requests.
  258. ForceSendFields []string `json:"-"`
  259. // NullFields is a list of field names (e.g. "Acl") to include in API
  260. // requests with the JSON null value. By default, fields with empty
  261. // values are omitted from API requests. However, any field with an
  262. // empty value appearing in NullFields will be sent to the server as
  263. // null. It is an error if a field in this list has a non-empty value.
  264. // This may be used to include null fields in Patch requests.
  265. NullFields []string `json:"-"`
  266. }
  267. func (s *Bucket) MarshalJSON() ([]byte, error) {
  268. type NoMethod Bucket
  269. raw := NoMethod(*s)
  270. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  271. }
  272. // BucketBilling: The bucket's billing configuration.
  273. type BucketBilling struct {
  274. // RequesterPays: When set to true, Requester Pays is enabled for this
  275. // bucket.
  276. RequesterPays bool `json:"requesterPays,omitempty"`
  277. // ForceSendFields is a list of field names (e.g. "RequesterPays") to
  278. // unconditionally include in API requests. By default, fields with
  279. // empty values are omitted from API requests. However, any non-pointer,
  280. // non-interface field appearing in ForceSendFields will be sent to the
  281. // server regardless of whether the field is empty or not. This may be
  282. // used to include empty fields in Patch requests.
  283. ForceSendFields []string `json:"-"`
  284. // NullFields is a list of field names (e.g. "RequesterPays") to include
  285. // in API requests with the JSON null value. By default, fields with
  286. // empty values are omitted from API requests. However, any field with
  287. // an empty value appearing in NullFields will be sent to the server as
  288. // null. It is an error if a field in this list has a non-empty value.
  289. // This may be used to include null fields in Patch requests.
  290. NullFields []string `json:"-"`
  291. }
  292. func (s *BucketBilling) MarshalJSON() ([]byte, error) {
  293. type NoMethod BucketBilling
  294. raw := NoMethod(*s)
  295. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  296. }
  297. type BucketCors struct {
  298. // MaxAgeSeconds: The value, in seconds, to return in the
  299. // Access-Control-Max-Age header used in preflight responses.
  300. MaxAgeSeconds int64 `json:"maxAgeSeconds,omitempty"`
  301. // Method: The list of HTTP methods on which to include CORS response
  302. // headers, (GET, OPTIONS, POST, etc) Note: "*" is permitted in the list
  303. // of methods, and means "any method".
  304. Method []string `json:"method,omitempty"`
  305. // Origin: The list of Origins eligible to receive CORS response
  306. // headers. Note: "*" is permitted in the list of origins, and means
  307. // "any Origin".
  308. Origin []string `json:"origin,omitempty"`
  309. // ResponseHeader: The list of HTTP headers other than the simple
  310. // response headers to give permission for the user-agent to share
  311. // across domains.
  312. ResponseHeader []string `json:"responseHeader,omitempty"`
  313. // ForceSendFields is a list of field names (e.g. "MaxAgeSeconds") to
  314. // unconditionally include in API requests. By default, fields with
  315. // empty values are omitted from API requests. However, any non-pointer,
  316. // non-interface field appearing in ForceSendFields will be sent to the
  317. // server regardless of whether the field is empty or not. This may be
  318. // used to include empty fields in Patch requests.
  319. ForceSendFields []string `json:"-"`
  320. // NullFields is a list of field names (e.g. "MaxAgeSeconds") to include
  321. // in API requests with the JSON null value. By default, fields with
  322. // empty values are omitted from API requests. However, any field with
  323. // an empty value appearing in NullFields will be sent to the server as
  324. // null. It is an error if a field in this list has a non-empty value.
  325. // This may be used to include null fields in Patch requests.
  326. NullFields []string `json:"-"`
  327. }
  328. func (s *BucketCors) MarshalJSON() ([]byte, error) {
  329. type NoMethod BucketCors
  330. raw := NoMethod(*s)
  331. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  332. }
  333. // BucketEncryption: Encryption configuration for a bucket.
  334. type BucketEncryption struct {
  335. // DefaultKmsKeyName: A Cloud KMS key that will be used to encrypt
  336. // objects inserted into this bucket, if no encryption method is
  337. // specified.
  338. DefaultKmsKeyName string `json:"defaultKmsKeyName,omitempty"`
  339. // ForceSendFields is a list of field names (e.g. "DefaultKmsKeyName")
  340. // to unconditionally include in API requests. By default, fields with
  341. // empty values are omitted from API requests. However, any non-pointer,
  342. // non-interface field appearing in ForceSendFields will be sent to the
  343. // server regardless of whether the field is empty or not. This may be
  344. // used to include empty fields in Patch requests.
  345. ForceSendFields []string `json:"-"`
  346. // NullFields is a list of field names (e.g. "DefaultKmsKeyName") to
  347. // include in API requests with the JSON null value. By default, fields
  348. // with empty values are omitted from API requests. However, any field
  349. // with an empty value appearing in NullFields will be sent to the
  350. // server as null. It is an error if a field in this list has a
  351. // non-empty value. This may be used to include null fields in Patch
  352. // requests.
  353. NullFields []string `json:"-"`
  354. }
  355. func (s *BucketEncryption) MarshalJSON() ([]byte, error) {
  356. type NoMethod BucketEncryption
  357. raw := NoMethod(*s)
  358. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  359. }
  360. // BucketLifecycle: The bucket's lifecycle configuration. See lifecycle
  361. // management for more information.
  362. type BucketLifecycle struct {
  363. // Rule: A lifecycle management rule, which is made of an action to take
  364. // and the condition(s) under which the action will be taken.
  365. Rule []*BucketLifecycleRule `json:"rule,omitempty"`
  366. // ForceSendFields is a list of field names (e.g. "Rule") to
  367. // unconditionally include in API requests. By default, fields with
  368. // empty values are omitted from API requests. However, any non-pointer,
  369. // non-interface field appearing in ForceSendFields will be sent to the
  370. // server regardless of whether the field is empty or not. This may be
  371. // used to include empty fields in Patch requests.
  372. ForceSendFields []string `json:"-"`
  373. // NullFields is a list of field names (e.g. "Rule") to include in API
  374. // requests with the JSON null value. By default, fields with empty
  375. // values are omitted from API requests. However, any field with an
  376. // empty value appearing in NullFields will be sent to the server as
  377. // null. It is an error if a field in this list has a non-empty value.
  378. // This may be used to include null fields in Patch requests.
  379. NullFields []string `json:"-"`
  380. }
  381. func (s *BucketLifecycle) MarshalJSON() ([]byte, error) {
  382. type NoMethod BucketLifecycle
  383. raw := NoMethod(*s)
  384. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  385. }
  386. type BucketLifecycleRule struct {
  387. // Action: The action to take.
  388. Action *BucketLifecycleRuleAction `json:"action,omitempty"`
  389. // Condition: The condition(s) under which the action will be taken.
  390. Condition *BucketLifecycleRuleCondition `json:"condition,omitempty"`
  391. // ForceSendFields is a list of field names (e.g. "Action") to
  392. // unconditionally include in API requests. By default, fields with
  393. // empty values are omitted from API requests. However, any non-pointer,
  394. // non-interface field appearing in ForceSendFields will be sent to the
  395. // server regardless of whether the field is empty or not. This may be
  396. // used to include empty fields in Patch requests.
  397. ForceSendFields []string `json:"-"`
  398. // NullFields is a list of field names (e.g. "Action") to include in API
  399. // requests with the JSON null value. By default, fields with empty
  400. // values are omitted from API requests. However, any field with an
  401. // empty value appearing in NullFields will be sent to the server as
  402. // null. It is an error if a field in this list has a non-empty value.
  403. // This may be used to include null fields in Patch requests.
  404. NullFields []string `json:"-"`
  405. }
  406. func (s *BucketLifecycleRule) MarshalJSON() ([]byte, error) {
  407. type NoMethod BucketLifecycleRule
  408. raw := NoMethod(*s)
  409. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  410. }
  411. // BucketLifecycleRuleAction: The action to take.
  412. type BucketLifecycleRuleAction struct {
  413. // StorageClass: Target storage class. Required iff the type of the
  414. // action is SetStorageClass.
  415. StorageClass string `json:"storageClass,omitempty"`
  416. // Type: Type of the action. Currently, only Delete and SetStorageClass
  417. // are supported.
  418. Type string `json:"type,omitempty"`
  419. // ForceSendFields is a list of field names (e.g. "StorageClass") to
  420. // unconditionally include in API requests. By default, fields with
  421. // empty values are omitted from API requests. However, any non-pointer,
  422. // non-interface field appearing in ForceSendFields will be sent to the
  423. // server regardless of whether the field is empty or not. This may be
  424. // used to include empty fields in Patch requests.
  425. ForceSendFields []string `json:"-"`
  426. // NullFields is a list of field names (e.g. "StorageClass") to include
  427. // in API requests with the JSON null value. By default, fields with
  428. // empty values are omitted from API requests. However, any field with
  429. // an empty value appearing in NullFields will be sent to the server as
  430. // null. It is an error if a field in this list has a non-empty value.
  431. // This may be used to include null fields in Patch requests.
  432. NullFields []string `json:"-"`
  433. }
  434. func (s *BucketLifecycleRuleAction) MarshalJSON() ([]byte, error) {
  435. type NoMethod BucketLifecycleRuleAction
  436. raw := NoMethod(*s)
  437. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  438. }
  439. // BucketLifecycleRuleCondition: The condition(s) under which the action
  440. // will be taken.
  441. type BucketLifecycleRuleCondition struct {
  442. // Age: Age of an object (in days). This condition is satisfied when an
  443. // object reaches the specified age.
  444. Age int64 `json:"age,omitempty"`
  445. // CreatedBefore: A date in RFC 3339 format with only the date part (for
  446. // instance, "2013-01-15"). This condition is satisfied when an object
  447. // is created before midnight of the specified date in UTC.
  448. CreatedBefore string `json:"createdBefore,omitempty"`
  449. // IsLive: Relevant only for versioned objects. If the value is true,
  450. // this condition matches live objects; if the value is false, it
  451. // matches archived objects.
  452. IsLive *bool `json:"isLive,omitempty"`
  453. // MatchesPattern: A regular expression that satisfies the RE2 syntax.
  454. // This condition is satisfied when the name of the object matches the
  455. // RE2 pattern. Note: This feature is currently in the "Early Access"
  456. // launch stage and is only available to a whitelisted set of users;
  457. // that means that this feature may be changed in backward-incompatible
  458. // ways and that it is not guaranteed to be released.
  459. MatchesPattern string `json:"matchesPattern,omitempty"`
  460. // MatchesStorageClass: Objects having any of the storage classes
  461. // specified by this condition will be matched. Values include
  462. // MULTI_REGIONAL, REGIONAL, NEARLINE, COLDLINE, STANDARD, and
  463. // DURABLE_REDUCED_AVAILABILITY.
  464. MatchesStorageClass []string `json:"matchesStorageClass,omitempty"`
  465. // NumNewerVersions: Relevant only for versioned objects. If the value
  466. // is N, this condition is satisfied when there are at least N versions
  467. // (including the live version) newer than this version of the object.
  468. NumNewerVersions int64 `json:"numNewerVersions,omitempty"`
  469. // ForceSendFields is a list of field names (e.g. "Age") to
  470. // unconditionally include in API requests. By default, fields with
  471. // empty values are omitted from API requests. However, any non-pointer,
  472. // non-interface field appearing in ForceSendFields will be sent to the
  473. // server regardless of whether the field is empty or not. This may be
  474. // used to include empty fields in Patch requests.
  475. ForceSendFields []string `json:"-"`
  476. // NullFields is a list of field names (e.g. "Age") to include in API
  477. // requests with the JSON null value. By default, fields with empty
  478. // values are omitted from API requests. However, any field with an
  479. // empty value appearing in NullFields will be sent to the server as
  480. // null. It is an error if a field in this list has a non-empty value.
  481. // This may be used to include null fields in Patch requests.
  482. NullFields []string `json:"-"`
  483. }
  484. func (s *BucketLifecycleRuleCondition) MarshalJSON() ([]byte, error) {
  485. type NoMethod BucketLifecycleRuleCondition
  486. raw := NoMethod(*s)
  487. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  488. }
  489. // BucketLogging: The bucket's logging configuration, which defines the
  490. // destination bucket and optional name prefix for the current bucket's
  491. // logs.
  492. type BucketLogging struct {
  493. // LogBucket: The destination bucket where the current bucket's logs
  494. // should be placed.
  495. LogBucket string `json:"logBucket,omitempty"`
  496. // LogObjectPrefix: A prefix for log object names.
  497. LogObjectPrefix string `json:"logObjectPrefix,omitempty"`
  498. // ForceSendFields is a list of field names (e.g. "LogBucket") to
  499. // unconditionally include in API requests. By default, fields with
  500. // empty values are omitted from API requests. However, any non-pointer,
  501. // non-interface field appearing in ForceSendFields will be sent to the
  502. // server regardless of whether the field is empty or not. This may be
  503. // used to include empty fields in Patch requests.
  504. ForceSendFields []string `json:"-"`
  505. // NullFields is a list of field names (e.g. "LogBucket") to include in
  506. // API requests with the JSON null value. By default, fields with empty
  507. // values are omitted from API requests. However, any field with an
  508. // empty value appearing in NullFields will be sent to the server as
  509. // null. It is an error if a field in this list has a non-empty value.
  510. // This may be used to include null fields in Patch requests.
  511. NullFields []string `json:"-"`
  512. }
  513. func (s *BucketLogging) MarshalJSON() ([]byte, error) {
  514. type NoMethod BucketLogging
  515. raw := NoMethod(*s)
  516. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  517. }
  518. // BucketOwner: The owner of the bucket. This is always the project
  519. // team's owner group.
  520. type BucketOwner struct {
  521. // Entity: The entity, in the form project-owner-projectId.
  522. Entity string `json:"entity,omitempty"`
  523. // EntityId: The ID for the entity.
  524. EntityId string `json:"entityId,omitempty"`
  525. // ForceSendFields is a list of field names (e.g. "Entity") to
  526. // unconditionally include in API requests. By default, fields with
  527. // empty values are omitted from API requests. However, any non-pointer,
  528. // non-interface field appearing in ForceSendFields will be sent to the
  529. // server regardless of whether the field is empty or not. This may be
  530. // used to include empty fields in Patch requests.
  531. ForceSendFields []string `json:"-"`
  532. // NullFields is a list of field names (e.g. "Entity") to include in API
  533. // requests with the JSON null value. By default, fields with empty
  534. // values are omitted from API requests. However, any field with an
  535. // empty value appearing in NullFields will be sent to the server as
  536. // null. It is an error if a field in this list has a non-empty value.
  537. // This may be used to include null fields in Patch requests.
  538. NullFields []string `json:"-"`
  539. }
  540. func (s *BucketOwner) MarshalJSON() ([]byte, error) {
  541. type NoMethod BucketOwner
  542. raw := NoMethod(*s)
  543. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  544. }
  545. // BucketRetentionPolicy: The bucket's retention policy. The retention
  546. // policy enforces a minimum retention time for all objects contained in
  547. // the bucket, based on their creation time. Any attempt to overwrite or
  548. // delete objects younger than the retention period will result in a
  549. // PERMISSION_DENIED error. An unlocked retention policy can be modified
  550. // or removed from the bucket via a storage.buckets.update operation. A
  551. // locked retention policy cannot be removed or shortened in duration
  552. // for the lifetime of the bucket. Attempting to remove or decrease
  553. // period of a locked retention policy will result in a
  554. // PERMISSION_DENIED error.
  555. type BucketRetentionPolicy struct {
  556. // EffectiveTime: Server-determined value that indicates the time from
  557. // which policy was enforced and effective. This value is in RFC 3339
  558. // format.
  559. EffectiveTime string `json:"effectiveTime,omitempty"`
  560. // IsLocked: Once locked, an object retention policy cannot be modified.
  561. IsLocked bool `json:"isLocked,omitempty"`
  562. // RetentionPeriod: The duration in seconds that objects need to be
  563. // retained. Retention duration must be greater than zero and less than
  564. // 100 years. Note that enforcement of retention periods less than a day
  565. // is not guaranteed. Such periods should only be used for testing
  566. // purposes.
  567. RetentionPeriod int64 `json:"retentionPeriod,omitempty,string"`
  568. // ForceSendFields is a list of field names (e.g. "EffectiveTime") to
  569. // unconditionally include in API requests. By default, fields with
  570. // empty values are omitted from API requests. However, any non-pointer,
  571. // non-interface field appearing in ForceSendFields will be sent to the
  572. // server regardless of whether the field is empty or not. This may be
  573. // used to include empty fields in Patch requests.
  574. ForceSendFields []string `json:"-"`
  575. // NullFields is a list of field names (e.g. "EffectiveTime") to include
  576. // in API requests with the JSON null value. By default, fields with
  577. // empty values are omitted from API requests. However, any field with
  578. // an empty value appearing in NullFields will be sent to the server as
  579. // null. It is an error if a field in this list has a non-empty value.
  580. // This may be used to include null fields in Patch requests.
  581. NullFields []string `json:"-"`
  582. }
  583. func (s *BucketRetentionPolicy) MarshalJSON() ([]byte, error) {
  584. type NoMethod BucketRetentionPolicy
  585. raw := NoMethod(*s)
  586. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  587. }
  588. // BucketVersioning: The bucket's versioning configuration.
  589. type BucketVersioning struct {
  590. // Enabled: While set to true, versioning is fully enabled for this
  591. // bucket.
  592. Enabled bool `json:"enabled,omitempty"`
  593. // ForceSendFields is a list of field names (e.g. "Enabled") to
  594. // unconditionally include in API requests. By default, fields with
  595. // empty values are omitted from API requests. However, any non-pointer,
  596. // non-interface field appearing in ForceSendFields will be sent to the
  597. // server regardless of whether the field is empty or not. This may be
  598. // used to include empty fields in Patch requests.
  599. ForceSendFields []string `json:"-"`
  600. // NullFields is a list of field names (e.g. "Enabled") to include in
  601. // API requests with the JSON null value. By default, fields with empty
  602. // values are omitted from API requests. However, any field with an
  603. // empty value appearing in NullFields will be sent to the server as
  604. // null. It is an error if a field in this list has a non-empty value.
  605. // This may be used to include null fields in Patch requests.
  606. NullFields []string `json:"-"`
  607. }
  608. func (s *BucketVersioning) MarshalJSON() ([]byte, error) {
  609. type NoMethod BucketVersioning
  610. raw := NoMethod(*s)
  611. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  612. }
  613. // BucketWebsite: The bucket's website configuration, controlling how
  614. // the service behaves when accessing bucket contents as a web site. See
  615. // the Static Website Examples for more information.
  616. type BucketWebsite struct {
  617. // MainPageSuffix: If the requested object path is missing, the service
  618. // will ensure the path has a trailing '/', append this suffix, and
  619. // attempt to retrieve the resulting object. This allows the creation of
  620. // index.html objects to represent directory pages.
  621. MainPageSuffix string `json:"mainPageSuffix,omitempty"`
  622. // NotFoundPage: If the requested object path is missing, and any
  623. // mainPageSuffix object is missing, if applicable, the service will
  624. // return the named object from this bucket as the content for a 404 Not
  625. // Found result.
  626. NotFoundPage string `json:"notFoundPage,omitempty"`
  627. // ForceSendFields is a list of field names (e.g. "MainPageSuffix") to
  628. // unconditionally include in API requests. By default, fields with
  629. // empty values are omitted from API requests. However, any non-pointer,
  630. // non-interface field appearing in ForceSendFields will be sent to the
  631. // server regardless of whether the field is empty or not. This may be
  632. // used to include empty fields in Patch requests.
  633. ForceSendFields []string `json:"-"`
  634. // NullFields is a list of field names (e.g. "MainPageSuffix") to
  635. // include in API requests with the JSON null value. By default, fields
  636. // with empty values are omitted from API requests. However, any field
  637. // with an empty value appearing in NullFields will be sent to the
  638. // server as null. It is an error if a field in this list has a
  639. // non-empty value. This may be used to include null fields in Patch
  640. // requests.
  641. NullFields []string `json:"-"`
  642. }
  643. func (s *BucketWebsite) MarshalJSON() ([]byte, error) {
  644. type NoMethod BucketWebsite
  645. raw := NoMethod(*s)
  646. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  647. }
  648. // BucketAccessControl: An access-control entry.
  649. type BucketAccessControl struct {
  650. // Bucket: The name of the bucket.
  651. Bucket string `json:"bucket,omitempty"`
  652. // Domain: The domain associated with the entity, if any.
  653. Domain string `json:"domain,omitempty"`
  654. // Email: The email address associated with the entity, if any.
  655. Email string `json:"email,omitempty"`
  656. // Entity: The entity holding the permission, in one of the following
  657. // forms:
  658. // - user-userId
  659. // - user-email
  660. // - group-groupId
  661. // - group-email
  662. // - domain-domain
  663. // - project-team-projectId
  664. // - allUsers
  665. // - allAuthenticatedUsers Examples:
  666. // - The user liz@example.com would be user-liz@example.com.
  667. // - The group example@googlegroups.com would be
  668. // group-example@googlegroups.com.
  669. // - To refer to all members of the Google Apps for Business domain
  670. // example.com, the entity would be domain-example.com.
  671. Entity string `json:"entity,omitempty"`
  672. // EntityId: The ID for the entity, if any.
  673. EntityId string `json:"entityId,omitempty"`
  674. // Etag: HTTP 1.1 Entity tag for the access-control entry.
  675. Etag string `json:"etag,omitempty"`
  676. // Id: The ID of the access-control entry.
  677. Id string `json:"id,omitempty"`
  678. // Kind: The kind of item this is. For bucket access control entries,
  679. // this is always storage#bucketAccessControl.
  680. Kind string `json:"kind,omitempty"`
  681. // ProjectTeam: The project team associated with the entity, if any.
  682. ProjectTeam *BucketAccessControlProjectTeam `json:"projectTeam,omitempty"`
  683. // Role: The access permission for the entity.
  684. Role string `json:"role,omitempty"`
  685. // SelfLink: The link to this access-control entry.
  686. SelfLink string `json:"selfLink,omitempty"`
  687. // ServerResponse contains the HTTP response code and headers from the
  688. // server.
  689. googleapi.ServerResponse `json:"-"`
  690. // ForceSendFields is a list of field names (e.g. "Bucket") to
  691. // unconditionally include in API requests. By default, fields with
  692. // empty values are omitted from API requests. However, any non-pointer,
  693. // non-interface field appearing in ForceSendFields will be sent to the
  694. // server regardless of whether the field is empty or not. This may be
  695. // used to include empty fields in Patch requests.
  696. ForceSendFields []string `json:"-"`
  697. // NullFields is a list of field names (e.g. "Bucket") to include in API
  698. // requests with the JSON null value. By default, fields with empty
  699. // values are omitted from API requests. However, any field with an
  700. // empty value appearing in NullFields will be sent to the server as
  701. // null. It is an error if a field in this list has a non-empty value.
  702. // This may be used to include null fields in Patch requests.
  703. NullFields []string `json:"-"`
  704. }
  705. func (s *BucketAccessControl) MarshalJSON() ([]byte, error) {
  706. type NoMethod BucketAccessControl
  707. raw := NoMethod(*s)
  708. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  709. }
  710. // BucketAccessControlProjectTeam: The project team associated with the
  711. // entity, if any.
  712. type BucketAccessControlProjectTeam struct {
  713. // ProjectNumber: The project number.
  714. ProjectNumber string `json:"projectNumber,omitempty"`
  715. // Team: The team.
  716. Team string `json:"team,omitempty"`
  717. // ForceSendFields is a list of field names (e.g. "ProjectNumber") to
  718. // unconditionally include in API requests. By default, fields with
  719. // empty values are omitted from API requests. However, any non-pointer,
  720. // non-interface field appearing in ForceSendFields will be sent to the
  721. // server regardless of whether the field is empty or not. This may be
  722. // used to include empty fields in Patch requests.
  723. ForceSendFields []string `json:"-"`
  724. // NullFields is a list of field names (e.g. "ProjectNumber") to include
  725. // in API requests with the JSON null value. By default, fields with
  726. // empty values are omitted from API requests. However, any field with
  727. // an empty value appearing in NullFields will be sent to the server as
  728. // null. It is an error if a field in this list has a non-empty value.
  729. // This may be used to include null fields in Patch requests.
  730. NullFields []string `json:"-"`
  731. }
  732. func (s *BucketAccessControlProjectTeam) MarshalJSON() ([]byte, error) {
  733. type NoMethod BucketAccessControlProjectTeam
  734. raw := NoMethod(*s)
  735. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  736. }
  737. // BucketAccessControls: An access-control list.
  738. type BucketAccessControls struct {
  739. // Items: The list of items.
  740. Items []*BucketAccessControl `json:"items,omitempty"`
  741. // Kind: The kind of item this is. For lists of bucket access control
  742. // entries, this is always storage#bucketAccessControls.
  743. Kind string `json:"kind,omitempty"`
  744. // ServerResponse contains the HTTP response code and headers from the
  745. // server.
  746. googleapi.ServerResponse `json:"-"`
  747. // ForceSendFields is a list of field names (e.g. "Items") to
  748. // unconditionally include in API requests. By default, fields with
  749. // empty values are omitted from API requests. However, any non-pointer,
  750. // non-interface field appearing in ForceSendFields will be sent to the
  751. // server regardless of whether the field is empty or not. This may be
  752. // used to include empty fields in Patch requests.
  753. ForceSendFields []string `json:"-"`
  754. // NullFields is a list of field names (e.g. "Items") to include in API
  755. // requests with the JSON null value. By default, fields with empty
  756. // values are omitted from API requests. However, any field with an
  757. // empty value appearing in NullFields will be sent to the server as
  758. // null. It is an error if a field in this list has a non-empty value.
  759. // This may be used to include null fields in Patch requests.
  760. NullFields []string `json:"-"`
  761. }
  762. func (s *BucketAccessControls) MarshalJSON() ([]byte, error) {
  763. type NoMethod BucketAccessControls
  764. raw := NoMethod(*s)
  765. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  766. }
  767. // Buckets: A list of buckets.
  768. type Buckets struct {
  769. // Items: The list of items.
  770. Items []*Bucket `json:"items,omitempty"`
  771. // Kind: The kind of item this is. For lists of buckets, this is always
  772. // storage#buckets.
  773. Kind string `json:"kind,omitempty"`
  774. // NextPageToken: The continuation token, used to page through large
  775. // result sets. Provide this value in a subsequent request to return the
  776. // next page of results.
  777. NextPageToken string `json:"nextPageToken,omitempty"`
  778. // ServerResponse contains the HTTP response code and headers from the
  779. // server.
  780. googleapi.ServerResponse `json:"-"`
  781. // ForceSendFields is a list of field names (e.g. "Items") to
  782. // unconditionally include in API requests. By default, fields with
  783. // empty values are omitted from API requests. However, any non-pointer,
  784. // non-interface field appearing in ForceSendFields will be sent to the
  785. // server regardless of whether the field is empty or not. This may be
  786. // used to include empty fields in Patch requests.
  787. ForceSendFields []string `json:"-"`
  788. // NullFields is a list of field names (e.g. "Items") to include in API
  789. // requests with the JSON null value. By default, fields with empty
  790. // values are omitted from API requests. However, any field with an
  791. // empty value appearing in NullFields will be sent to the server as
  792. // null. It is an error if a field in this list has a non-empty value.
  793. // This may be used to include null fields in Patch requests.
  794. NullFields []string `json:"-"`
  795. }
  796. func (s *Buckets) MarshalJSON() ([]byte, error) {
  797. type NoMethod Buckets
  798. raw := NoMethod(*s)
  799. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  800. }
  801. // Channel: An notification channel used to watch for resource changes.
  802. type Channel struct {
  803. // Address: The address where notifications are delivered for this
  804. // channel.
  805. Address string `json:"address,omitempty"`
  806. // Expiration: Date and time of notification channel expiration,
  807. // expressed as a Unix timestamp, in milliseconds. Optional.
  808. Expiration int64 `json:"expiration,omitempty,string"`
  809. // Id: A UUID or similar unique string that identifies this channel.
  810. Id string `json:"id,omitempty"`
  811. // Kind: Identifies this as a notification channel used to watch for
  812. // changes to a resource. Value: the fixed string "api#channel".
  813. Kind string `json:"kind,omitempty"`
  814. // Params: Additional parameters controlling delivery channel behavior.
  815. // Optional.
  816. Params map[string]string `json:"params,omitempty"`
  817. // Payload: A Boolean value to indicate whether payload is wanted.
  818. // Optional.
  819. Payload bool `json:"payload,omitempty"`
  820. // ResourceId: An opaque ID that identifies the resource being watched
  821. // on this channel. Stable across different API versions.
  822. ResourceId string `json:"resourceId,omitempty"`
  823. // ResourceUri: A version-specific identifier for the watched resource.
  824. ResourceUri string `json:"resourceUri,omitempty"`
  825. // Token: An arbitrary string delivered to the target address with each
  826. // notification delivered over this channel. Optional.
  827. Token string `json:"token,omitempty"`
  828. // Type: The type of delivery mechanism used for this channel.
  829. Type string `json:"type,omitempty"`
  830. // ServerResponse contains the HTTP response code and headers from the
  831. // server.
  832. googleapi.ServerResponse `json:"-"`
  833. // ForceSendFields is a list of field names (e.g. "Address") to
  834. // unconditionally include in API requests. By default, fields with
  835. // empty values are omitted from API requests. However, any non-pointer,
  836. // non-interface field appearing in ForceSendFields will be sent to the
  837. // server regardless of whether the field is empty or not. This may be
  838. // used to include empty fields in Patch requests.
  839. ForceSendFields []string `json:"-"`
  840. // NullFields is a list of field names (e.g. "Address") to include in
  841. // API requests with the JSON null value. By default, fields with empty
  842. // values are omitted from API requests. However, any field with an
  843. // empty value appearing in NullFields will be sent to the server as
  844. // null. It is an error if a field in this list has a non-empty value.
  845. // This may be used to include null fields in Patch requests.
  846. NullFields []string `json:"-"`
  847. }
  848. func (s *Channel) MarshalJSON() ([]byte, error) {
  849. type NoMethod Channel
  850. raw := NoMethod(*s)
  851. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  852. }
  853. // ComposeRequest: A Compose request.
  854. type ComposeRequest struct {
  855. // Destination: Properties of the resulting object.
  856. Destination *Object `json:"destination,omitempty"`
  857. // Kind: The kind of item this is.
  858. Kind string `json:"kind,omitempty"`
  859. // SourceObjects: The list of source objects that will be concatenated
  860. // into a single object.
  861. SourceObjects []*ComposeRequestSourceObjects `json:"sourceObjects,omitempty"`
  862. // ForceSendFields is a list of field names (e.g. "Destination") to
  863. // unconditionally include in API requests. By default, fields with
  864. // empty values are omitted from API requests. However, any non-pointer,
  865. // non-interface field appearing in ForceSendFields will be sent to the
  866. // server regardless of whether the field is empty or not. This may be
  867. // used to include empty fields in Patch requests.
  868. ForceSendFields []string `json:"-"`
  869. // NullFields is a list of field names (e.g. "Destination") to include
  870. // in API requests with the JSON null value. By default, fields with
  871. // empty values are omitted from API requests. However, any field with
  872. // an empty value appearing in NullFields will be sent to the server as
  873. // null. It is an error if a field in this list has a non-empty value.
  874. // This may be used to include null fields in Patch requests.
  875. NullFields []string `json:"-"`
  876. }
  877. func (s *ComposeRequest) MarshalJSON() ([]byte, error) {
  878. type NoMethod ComposeRequest
  879. raw := NoMethod(*s)
  880. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  881. }
  882. type ComposeRequestSourceObjects struct {
  883. // Generation: The generation of this object to use as the source.
  884. Generation int64 `json:"generation,omitempty,string"`
  885. // Name: The source object's name. All source objects must reside in the
  886. // same bucket.
  887. Name string `json:"name,omitempty"`
  888. // ObjectPreconditions: Conditions that must be met for this operation
  889. // to execute.
  890. ObjectPreconditions *ComposeRequestSourceObjectsObjectPreconditions `json:"objectPreconditions,omitempty"`
  891. // ForceSendFields is a list of field names (e.g. "Generation") to
  892. // unconditionally include in API requests. By default, fields with
  893. // empty values are omitted from API requests. However, any non-pointer,
  894. // non-interface field appearing in ForceSendFields will be sent to the
  895. // server regardless of whether the field is empty or not. This may be
  896. // used to include empty fields in Patch requests.
  897. ForceSendFields []string `json:"-"`
  898. // NullFields is a list of field names (e.g. "Generation") to include in
  899. // API requests with the JSON null value. By default, fields with empty
  900. // values are omitted from API requests. However, any field with an
  901. // empty value appearing in NullFields will be sent to the server as
  902. // null. It is an error if a field in this list has a non-empty value.
  903. // This may be used to include null fields in Patch requests.
  904. NullFields []string `json:"-"`
  905. }
  906. func (s *ComposeRequestSourceObjects) MarshalJSON() ([]byte, error) {
  907. type NoMethod ComposeRequestSourceObjects
  908. raw := NoMethod(*s)
  909. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  910. }
  911. // ComposeRequestSourceObjectsObjectPreconditions: Conditions that must
  912. // be met for this operation to execute.
  913. type ComposeRequestSourceObjectsObjectPreconditions struct {
  914. // IfGenerationMatch: Only perform the composition if the generation of
  915. // the source object that would be used matches this value. If this
  916. // value and a generation are both specified, they must be the same
  917. // value or the call will fail.
  918. IfGenerationMatch int64 `json:"ifGenerationMatch,omitempty,string"`
  919. // ForceSendFields is a list of field names (e.g. "IfGenerationMatch")
  920. // to unconditionally include in API requests. By default, fields with
  921. // empty values are omitted from API requests. However, any non-pointer,
  922. // non-interface field appearing in ForceSendFields will be sent to the
  923. // server regardless of whether the field is empty or not. This may be
  924. // used to include empty fields in Patch requests.
  925. ForceSendFields []string `json:"-"`
  926. // NullFields is a list of field names (e.g. "IfGenerationMatch") to
  927. // include in API requests with the JSON null value. By default, fields
  928. // with empty values are omitted from API requests. However, any field
  929. // with an empty value appearing in NullFields will be sent to the
  930. // server as null. It is an error if a field in this list has a
  931. // non-empty value. This may be used to include null fields in Patch
  932. // requests.
  933. NullFields []string `json:"-"`
  934. }
  935. func (s *ComposeRequestSourceObjectsObjectPreconditions) MarshalJSON() ([]byte, error) {
  936. type NoMethod ComposeRequestSourceObjectsObjectPreconditions
  937. raw := NoMethod(*s)
  938. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  939. }
  940. // Notification: A subscription to receive Google PubSub notifications.
  941. type Notification struct {
  942. // CustomAttributes: An optional list of additional attributes to attach
  943. // to each Cloud PubSub message published for this notification
  944. // subscription.
  945. CustomAttributes map[string]string `json:"custom_attributes,omitempty"`
  946. // Etag: HTTP 1.1 Entity tag for this subscription notification.
  947. Etag string `json:"etag,omitempty"`
  948. // EventTypes: If present, only send notifications about listed event
  949. // types. If empty, sent notifications for all event types.
  950. EventTypes []string `json:"event_types,omitempty"`
  951. // Id: The ID of the notification.
  952. Id string `json:"id,omitempty"`
  953. // Kind: The kind of item this is. For notifications, this is always
  954. // storage#notification.
  955. Kind string `json:"kind,omitempty"`
  956. // ObjectNamePrefix: If present, only apply this notification
  957. // configuration to object names that begin with this prefix.
  958. ObjectNamePrefix string `json:"object_name_prefix,omitempty"`
  959. // PayloadFormat: The desired content of the Payload.
  960. PayloadFormat string `json:"payload_format,omitempty"`
  961. // SelfLink: The canonical URL of this notification.
  962. SelfLink string `json:"selfLink,omitempty"`
  963. // Topic: The Cloud PubSub topic to which this subscription publishes.
  964. // Formatted as:
  965. // '//pubsub.googleapis.com/projects/{project-identifier}/topics/{my-topi
  966. // c}'
  967. Topic string `json:"topic,omitempty"`
  968. // ServerResponse contains the HTTP response code and headers from the
  969. // server.
  970. googleapi.ServerResponse `json:"-"`
  971. // ForceSendFields is a list of field names (e.g. "CustomAttributes") to
  972. // unconditionally include in API requests. By default, fields with
  973. // empty values are omitted from API requests. However, any non-pointer,
  974. // non-interface field appearing in ForceSendFields will be sent to the
  975. // server regardless of whether the field is empty or not. This may be
  976. // used to include empty fields in Patch requests.
  977. ForceSendFields []string `json:"-"`
  978. // NullFields is a list of field names (e.g. "CustomAttributes") to
  979. // include in API requests with the JSON null value. By default, fields
  980. // with empty values are omitted from API requests. However, any field
  981. // with an empty value appearing in NullFields will be sent to the
  982. // server as null. It is an error if a field in this list has a
  983. // non-empty value. This may be used to include null fields in Patch
  984. // requests.
  985. NullFields []string `json:"-"`
  986. }
  987. func (s *Notification) MarshalJSON() ([]byte, error) {
  988. type NoMethod Notification
  989. raw := NoMethod(*s)
  990. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  991. }
  992. // Notifications: A list of notification subscriptions.
  993. type Notifications struct {
  994. // Items: The list of items.
  995. Items []*Notification `json:"items,omitempty"`
  996. // Kind: The kind of item this is. For lists of notifications, this is
  997. // always storage#notifications.
  998. Kind string `json:"kind,omitempty"`
  999. // ServerResponse contains the HTTP response code and headers from the
  1000. // server.
  1001. googleapi.ServerResponse `json:"-"`
  1002. // ForceSendFields is a list of field names (e.g. "Items") to
  1003. // unconditionally include in API requests. By default, fields with
  1004. // empty values are omitted from API requests. However, any non-pointer,
  1005. // non-interface field appearing in ForceSendFields will be sent to the
  1006. // server regardless of whether the field is empty or not. This may be
  1007. // used to include empty fields in Patch requests.
  1008. ForceSendFields []string `json:"-"`
  1009. // NullFields is a list of field names (e.g. "Items") to include in API
  1010. // requests with the JSON null value. By default, fields with empty
  1011. // values are omitted from API requests. However, any field with an
  1012. // empty value appearing in NullFields will be sent to the server as
  1013. // null. It is an error if a field in this list has a non-empty value.
  1014. // This may be used to include null fields in Patch requests.
  1015. NullFields []string `json:"-"`
  1016. }
  1017. func (s *Notifications) MarshalJSON() ([]byte, error) {
  1018. type NoMethod Notifications
  1019. raw := NoMethod(*s)
  1020. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1021. }
  1022. // Object: An object.
  1023. type Object struct {
  1024. // Acl: Access controls on the object.
  1025. Acl []*ObjectAccessControl `json:"acl,omitempty"`
  1026. // Bucket: The name of the bucket containing this object.
  1027. Bucket string `json:"bucket,omitempty"`
  1028. // CacheControl: Cache-Control directive for the object data. If
  1029. // omitted, and the object is accessible to all anonymous users, the
  1030. // default will be public, max-age=3600.
  1031. CacheControl string `json:"cacheControl,omitempty"`
  1032. // ComponentCount: Number of underlying components that make up this
  1033. // object. Components are accumulated by compose operations.
  1034. ComponentCount int64 `json:"componentCount,omitempty"`
  1035. // ContentDisposition: Content-Disposition of the object data.
  1036. ContentDisposition string `json:"contentDisposition,omitempty"`
  1037. // ContentEncoding: Content-Encoding of the object data.
  1038. ContentEncoding string `json:"contentEncoding,omitempty"`
  1039. // ContentLanguage: Content-Language of the object data.
  1040. ContentLanguage string `json:"contentLanguage,omitempty"`
  1041. // ContentType: Content-Type of the object data. If an object is stored
  1042. // without a Content-Type, it is served as application/octet-stream.
  1043. ContentType string `json:"contentType,omitempty"`
  1044. // Crc32c: CRC32c checksum, as described in RFC 4960, Appendix B;
  1045. // encoded using base64 in big-endian byte order. For more information
  1046. // about using the CRC32c checksum, see Hashes and ETags: Best
  1047. // Practices.
  1048. Crc32c string `json:"crc32c,omitempty"`
  1049. // CustomerEncryption: Metadata of customer-supplied encryption key, if
  1050. // the object is encrypted by such a key.
  1051. CustomerEncryption *ObjectCustomerEncryption `json:"customerEncryption,omitempty"`
  1052. // Etag: HTTP 1.1 Entity tag for the object.
  1053. Etag string `json:"etag,omitempty"`
  1054. // EventBasedHold: Whether an object is under event-based hold.
  1055. // Event-based hold is a way to retain objects until an event occurs,
  1056. // which is signified by the hold's release (i.e. this value is set to
  1057. // false). After being released (set to false), such objects will be
  1058. // subject to bucket-level retention (if any). One sample use case of
  1059. // this flag is for banks to hold loan documents for at least 3 years
  1060. // after loan is paid in full. Here, bucket-level retention is 3 years
  1061. // and the event is the loan being paid in full. In this example, these
  1062. // objects will be held intact for any number of years until the event
  1063. // has occurred (event-based hold on the object is released) and then 3
  1064. // more years after that. That means retention duration of the objects
  1065. // begins from the moment event-based hold transitioned from true to
  1066. // false.
  1067. EventBasedHold bool `json:"eventBasedHold,omitempty"`
  1068. // Generation: The content generation of this object. Used for object
  1069. // versioning.
  1070. Generation int64 `json:"generation,omitempty,string"`
  1071. // Id: The ID of the object, including the bucket name, object name, and
  1072. // generation number.
  1073. Id string `json:"id,omitempty"`
  1074. // Kind: The kind of item this is. For objects, this is always
  1075. // storage#object.
  1076. Kind string `json:"kind,omitempty"`
  1077. // KmsKeyName: Cloud KMS Key used to encrypt this object, if the object
  1078. // is encrypted by such a key.
  1079. KmsKeyName string `json:"kmsKeyName,omitempty"`
  1080. // Md5Hash: MD5 hash of the data; encoded using base64. For more
  1081. // information about using the MD5 hash, see Hashes and ETags: Best
  1082. // Practices.
  1083. Md5Hash string `json:"md5Hash,omitempty"`
  1084. // MediaLink: Media download link.
  1085. MediaLink string `json:"mediaLink,omitempty"`
  1086. // Metadata: User-provided metadata, in key/value pairs.
  1087. Metadata map[string]string `json:"metadata,omitempty"`
  1088. // Metageneration: The version of the metadata for this object at this
  1089. // generation. Used for preconditions and for detecting changes in
  1090. // metadata. A metageneration number is only meaningful in the context
  1091. // of a particular generation of a particular object.
  1092. Metageneration int64 `json:"metageneration,omitempty,string"`
  1093. // Name: The name of the object. Required if not specified by URL
  1094. // parameter.
  1095. Name string `json:"name,omitempty"`
  1096. // Owner: The owner of the object. This will always be the uploader of
  1097. // the object.
  1098. Owner *ObjectOwner `json:"owner,omitempty"`
  1099. // RetentionExpirationTime: A server-determined value that specifies the
  1100. // earliest time that the object's retention period expires. This value
  1101. // is in RFC 3339 format. Note 1: This field is not provided for objects
  1102. // with an active event-based hold, since retention expiration is
  1103. // unknown until the hold is removed. Note 2: This value can be provided
  1104. // even when temporary hold is set (so that the user can reason about
  1105. // policy without having to first unset the temporary hold).
  1106. RetentionExpirationTime string `json:"retentionExpirationTime,omitempty"`
  1107. // SelfLink: The link to this object.
  1108. SelfLink string `json:"selfLink,omitempty"`
  1109. // Size: Content-Length of the data in bytes.
  1110. Size uint64 `json:"size,omitempty,string"`
  1111. // StorageClass: Storage class of the object.
  1112. StorageClass string `json:"storageClass,omitempty"`
  1113. // TemporaryHold: Whether an object is under temporary hold. While this
  1114. // flag is set to true, the object is protected against deletion and
  1115. // overwrites. A common use case of this flag is regulatory
  1116. // investigations where objects need to be retained while the
  1117. // investigation is ongoing. Note that unlike event-based hold,
  1118. // temporary hold does not impact retention expiration time of an
  1119. // object.
  1120. TemporaryHold bool `json:"temporaryHold,omitempty"`
  1121. // TimeCreated: The creation time of the object in RFC 3339 format.
  1122. TimeCreated string `json:"timeCreated,omitempty"`
  1123. // TimeDeleted: The deletion time of the object in RFC 3339 format. Will
  1124. // be returned if and only if this version of the object has been
  1125. // deleted.
  1126. TimeDeleted string `json:"timeDeleted,omitempty"`
  1127. // TimeStorageClassUpdated: The time at which the object's storage class
  1128. // was last changed. When the object is initially created, it will be
  1129. // set to timeCreated.
  1130. TimeStorageClassUpdated string `json:"timeStorageClassUpdated,omitempty"`
  1131. // Updated: The modification time of the object metadata in RFC 3339
  1132. // format.
  1133. Updated string `json:"updated,omitempty"`
  1134. // ServerResponse contains the HTTP response code and headers from the
  1135. // server.
  1136. googleapi.ServerResponse `json:"-"`
  1137. // ForceSendFields is a list of field names (e.g. "Acl") to
  1138. // unconditionally include in API requests. By default, fields with
  1139. // empty values are omitted from API requests. However, any non-pointer,
  1140. // non-interface field appearing in ForceSendFields will be sent to the
  1141. // server regardless of whether the field is empty or not. This may be
  1142. // used to include empty fields in Patch requests.
  1143. ForceSendFields []string `json:"-"`
  1144. // NullFields is a list of field names (e.g. "Acl") to include in API
  1145. // requests with the JSON null value. By default, fields with empty
  1146. // values are omitted from API requests. However, any field with an
  1147. // empty value appearing in NullFields will be sent to the server as
  1148. // null. It is an error if a field in this list has a non-empty value.
  1149. // This may be used to include null fields in Patch requests.
  1150. NullFields []string `json:"-"`
  1151. }
  1152. func (s *Object) MarshalJSON() ([]byte, error) {
  1153. type NoMethod Object
  1154. raw := NoMethod(*s)
  1155. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1156. }
  1157. // ObjectCustomerEncryption: Metadata of customer-supplied encryption
  1158. // key, if the object is encrypted by such a key.
  1159. type ObjectCustomerEncryption struct {
  1160. // EncryptionAlgorithm: The encryption algorithm.
  1161. EncryptionAlgorithm string `json:"encryptionAlgorithm,omitempty"`
  1162. // KeySha256: SHA256 hash value of the encryption key.
  1163. KeySha256 string `json:"keySha256,omitempty"`
  1164. // ForceSendFields is a list of field names (e.g. "EncryptionAlgorithm")
  1165. // to unconditionally include in API requests. By default, fields with
  1166. // empty values are omitted from API requests. However, any non-pointer,
  1167. // non-interface field appearing in ForceSendFields will be sent to the
  1168. // server regardless of whether the field is empty or not. This may be
  1169. // used to include empty fields in Patch requests.
  1170. ForceSendFields []string `json:"-"`
  1171. // NullFields is a list of field names (e.g. "EncryptionAlgorithm") to
  1172. // include in API requests with the JSON null value. By default, fields
  1173. // with empty values are omitted from API requests. However, any field
  1174. // with an empty value appearing in NullFields will be sent to the
  1175. // server as null. It is an error if a field in this list has a
  1176. // non-empty value. This may be used to include null fields in Patch
  1177. // requests.
  1178. NullFields []string `json:"-"`
  1179. }
  1180. func (s *ObjectCustomerEncryption) MarshalJSON() ([]byte, error) {
  1181. type NoMethod ObjectCustomerEncryption
  1182. raw := NoMethod(*s)
  1183. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1184. }
  1185. // ObjectOwner: The owner of the object. This will always be the
  1186. // uploader of the object.
  1187. type ObjectOwner struct {
  1188. // Entity: The entity, in the form user-userId.
  1189. Entity string `json:"entity,omitempty"`
  1190. // EntityId: The ID for the entity.
  1191. EntityId string `json:"entityId,omitempty"`
  1192. // ForceSendFields is a list of field names (e.g. "Entity") to
  1193. // unconditionally include in API requests. By default, fields with
  1194. // empty values are omitted from API requests. However, any non-pointer,
  1195. // non-interface field appearing in ForceSendFields will be sent to the
  1196. // server regardless of whether the field is empty or not. This may be
  1197. // used to include empty fields in Patch requests.
  1198. ForceSendFields []string `json:"-"`
  1199. // NullFields is a list of field names (e.g. "Entity") to include in API
  1200. // requests with the JSON null value. By default, fields with empty
  1201. // values are omitted from API requests. However, any field with an
  1202. // empty value appearing in NullFields will be sent to the server as
  1203. // null. It is an error if a field in this list has a non-empty value.
  1204. // This may be used to include null fields in Patch requests.
  1205. NullFields []string `json:"-"`
  1206. }
  1207. func (s *ObjectOwner) MarshalJSON() ([]byte, error) {
  1208. type NoMethod ObjectOwner
  1209. raw := NoMethod(*s)
  1210. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1211. }
  1212. // ObjectAccessControl: An access-control entry.
  1213. type ObjectAccessControl struct {
  1214. // Bucket: The name of the bucket.
  1215. Bucket string `json:"bucket,omitempty"`
  1216. // Domain: The domain associated with the entity, if any.
  1217. Domain string `json:"domain,omitempty"`
  1218. // Email: The email address associated with the entity, if any.
  1219. Email string `json:"email,omitempty"`
  1220. // Entity: The entity holding the permission, in one of the following
  1221. // forms:
  1222. // - user-userId
  1223. // - user-email
  1224. // - group-groupId
  1225. // - group-email
  1226. // - domain-domain
  1227. // - project-team-projectId
  1228. // - allUsers
  1229. // - allAuthenticatedUsers Examples:
  1230. // - The user liz@example.com would be user-liz@example.com.
  1231. // - The group example@googlegroups.com would be
  1232. // group-example@googlegroups.com.
  1233. // - To refer to all members of the Google Apps for Business domain
  1234. // example.com, the entity would be domain-example.com.
  1235. Entity string `json:"entity,omitempty"`
  1236. // EntityId: The ID for the entity, if any.
  1237. EntityId string `json:"entityId,omitempty"`
  1238. // Etag: HTTP 1.1 Entity tag for the access-control entry.
  1239. Etag string `json:"etag,omitempty"`
  1240. // Generation: The content generation of the object, if applied to an
  1241. // object.
  1242. Generation int64 `json:"generation,omitempty,string"`
  1243. // Id: The ID of the access-control entry.
  1244. Id string `json:"id,omitempty"`
  1245. // Kind: The kind of item this is. For object access control entries,
  1246. // this is always storage#objectAccessControl.
  1247. Kind string `json:"kind,omitempty"`
  1248. // Object: The name of the object, if applied to an object.
  1249. Object string `json:"object,omitempty"`
  1250. // ProjectTeam: The project team associated with the entity, if any.
  1251. ProjectTeam *ObjectAccessControlProjectTeam `json:"projectTeam,omitempty"`
  1252. // Role: The access permission for the entity.
  1253. Role string `json:"role,omitempty"`
  1254. // SelfLink: The link to this access-control entry.
  1255. SelfLink string `json:"selfLink,omitempty"`
  1256. // ServerResponse contains the HTTP response code and headers from the
  1257. // server.
  1258. googleapi.ServerResponse `json:"-"`
  1259. // ForceSendFields is a list of field names (e.g. "Bucket") to
  1260. // unconditionally include in API requests. By default, fields with
  1261. // empty values are omitted from API requests. However, any non-pointer,
  1262. // non-interface field appearing in ForceSendFields will be sent to the
  1263. // server regardless of whether the field is empty or not. This may be
  1264. // used to include empty fields in Patch requests.
  1265. ForceSendFields []string `json:"-"`
  1266. // NullFields is a list of field names (e.g. "Bucket") to include in API
  1267. // requests with the JSON null value. By default, fields with empty
  1268. // values are omitted from API requests. However, any field with an
  1269. // empty value appearing in NullFields will be sent to the server as
  1270. // null. It is an error if a field in this list has a non-empty value.
  1271. // This may be used to include null fields in Patch requests.
  1272. NullFields []string `json:"-"`
  1273. }
  1274. func (s *ObjectAccessControl) MarshalJSON() ([]byte, error) {
  1275. type NoMethod ObjectAccessControl
  1276. raw := NoMethod(*s)
  1277. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1278. }
  1279. // ObjectAccessControlProjectTeam: The project team associated with the
  1280. // entity, if any.
  1281. type ObjectAccessControlProjectTeam struct {
  1282. // ProjectNumber: The project number.
  1283. ProjectNumber string `json:"projectNumber,omitempty"`
  1284. // Team: The team.
  1285. Team string `json:"team,omitempty"`
  1286. // ForceSendFields is a list of field names (e.g. "ProjectNumber") to
  1287. // unconditionally include in API requests. By default, fields with
  1288. // empty values are omitted from API requests. However, any non-pointer,
  1289. // non-interface field appearing in ForceSendFields will be sent to the
  1290. // server regardless of whether the field is empty or not. This may be
  1291. // used to include empty fields in Patch requests.
  1292. ForceSendFields []string `json:"-"`
  1293. // NullFields is a list of field names (e.g. "ProjectNumber") to include
  1294. // in API requests with the JSON null value. By default, fields with
  1295. // empty values are omitted from API requests. However, any field with
  1296. // an empty value appearing in NullFields will be sent to the server as
  1297. // null. It is an error if a field in this list has a non-empty value.
  1298. // This may be used to include null fields in Patch requests.
  1299. NullFields []string `json:"-"`
  1300. }
  1301. func (s *ObjectAccessControlProjectTeam) MarshalJSON() ([]byte, error) {
  1302. type NoMethod ObjectAccessControlProjectTeam
  1303. raw := NoMethod(*s)
  1304. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1305. }
  1306. // ObjectAccessControls: An access-control list.
  1307. type ObjectAccessControls struct {
  1308. // Items: The list of items.
  1309. Items []*ObjectAccessControl `json:"items,omitempty"`
  1310. // Kind: The kind of item this is. For lists of object access control
  1311. // entries, this is always storage#objectAccessControls.
  1312. Kind string `json:"kind,omitempty"`
  1313. // ServerResponse contains the HTTP response code and headers from the
  1314. // server.
  1315. googleapi.ServerResponse `json:"-"`
  1316. // ForceSendFields is a list of field names (e.g. "Items") to
  1317. // unconditionally include in API requests. By default, fields with
  1318. // empty values are omitted from API requests. However, any non-pointer,
  1319. // non-interface field appearing in ForceSendFields will be sent to the
  1320. // server regardless of whether the field is empty or not. This may be
  1321. // used to include empty fields in Patch requests.
  1322. ForceSendFields []string `json:"-"`
  1323. // NullFields is a list of field names (e.g. "Items") to include in API
  1324. // requests with the JSON null value. By default, fields with empty
  1325. // values are omitted from API requests. However, any field with an
  1326. // empty value appearing in NullFields will be sent to the server as
  1327. // null. It is an error if a field in this list has a non-empty value.
  1328. // This may be used to include null fields in Patch requests.
  1329. NullFields []string `json:"-"`
  1330. }
  1331. func (s *ObjectAccessControls) MarshalJSON() ([]byte, error) {
  1332. type NoMethod ObjectAccessControls
  1333. raw := NoMethod(*s)
  1334. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1335. }
  1336. // Objects: A list of objects.
  1337. type Objects struct {
  1338. // Items: The list of items.
  1339. Items []*Object `json:"items,omitempty"`
  1340. // Kind: The kind of item this is. For lists of objects, this is always
  1341. // storage#objects.
  1342. Kind string `json:"kind,omitempty"`
  1343. // NextPageToken: The continuation token, used to page through large
  1344. // result sets. Provide this value in a subsequent request to return the
  1345. // next page of results.
  1346. NextPageToken string `json:"nextPageToken,omitempty"`
  1347. // Prefixes: The list of prefixes of objects matching-but-not-listed up
  1348. // to and including the requested delimiter.
  1349. Prefixes []string `json:"prefixes,omitempty"`
  1350. // ServerResponse contains the HTTP response code and headers from the
  1351. // server.
  1352. googleapi.ServerResponse `json:"-"`
  1353. // ForceSendFields is a list of field names (e.g. "Items") to
  1354. // unconditionally include in API requests. By default, fields with
  1355. // empty values are omitted from API requests. However, any non-pointer,
  1356. // non-interface field appearing in ForceSendFields will be sent to the
  1357. // server regardless of whether the field is empty or not. This may be
  1358. // used to include empty fields in Patch requests.
  1359. ForceSendFields []string `json:"-"`
  1360. // NullFields is a list of field names (e.g. "Items") to include in API
  1361. // requests with the JSON null value. By default, fields with empty
  1362. // values are omitted from API requests. However, any field with an
  1363. // empty value appearing in NullFields will be sent to the server as
  1364. // null. It is an error if a field in this list has a non-empty value.
  1365. // This may be used to include null fields in Patch requests.
  1366. NullFields []string `json:"-"`
  1367. }
  1368. func (s *Objects) MarshalJSON() ([]byte, error) {
  1369. type NoMethod Objects
  1370. raw := NoMethod(*s)
  1371. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1372. }
  1373. // Policy: A bucket/object IAM policy.
  1374. type Policy struct {
  1375. // Bindings: An association between a role, which comes with a set of
  1376. // permissions, and members who may assume that role.
  1377. Bindings []*PolicyBindings `json:"bindings,omitempty"`
  1378. // Etag: HTTP 1.1 Entity tag for the policy.
  1379. Etag string `json:"etag,omitempty"`
  1380. // Kind: The kind of item this is. For policies, this is always
  1381. // storage#policy. This field is ignored on input.
  1382. Kind string `json:"kind,omitempty"`
  1383. // ResourceId: The ID of the resource to which this policy belongs. Will
  1384. // be of the form projects/_/buckets/bucket for buckets, and
  1385. // projects/_/buckets/bucket/objects/object for objects. A specific
  1386. // generation may be specified by appending #generationNumber to the end
  1387. // of the object name, e.g.
  1388. // projects/_/buckets/my-bucket/objects/data.txt#17. The current
  1389. // generation can be denoted with #0. This field is ignored on input.
  1390. ResourceId string `json:"resourceId,omitempty"`
  1391. // ServerResponse contains the HTTP response code and headers from the
  1392. // server.
  1393. googleapi.ServerResponse `json:"-"`
  1394. // ForceSendFields is a list of field names (e.g. "Bindings") to
  1395. // unconditionally include in API requests. By default, fields with
  1396. // empty values are omitted from API requests. However, any non-pointer,
  1397. // non-interface field appearing in ForceSendFields will be sent to the
  1398. // server regardless of whether the field is empty or not. This may be
  1399. // used to include empty fields in Patch requests.
  1400. ForceSendFields []string `json:"-"`
  1401. // NullFields is a list of field names (e.g. "Bindings") to include in
  1402. // API requests with the JSON null value. By default, fields with empty
  1403. // values are omitted from API requests. However, any field with an
  1404. // empty value appearing in NullFields will be sent to the server as
  1405. // null. It is an error if a field in this list has a non-empty value.
  1406. // This may be used to include null fields in Patch requests.
  1407. NullFields []string `json:"-"`
  1408. }
  1409. func (s *Policy) MarshalJSON() ([]byte, error) {
  1410. type NoMethod Policy
  1411. raw := NoMethod(*s)
  1412. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1413. }
  1414. type PolicyBindings struct {
  1415. Condition interface{} `json:"condition,omitempty"`
  1416. // Members: A collection of identifiers for members who may assume the
  1417. // provided role. Recognized identifiers are as follows:
  1418. // - allUsers — A special identifier that represents anyone on the
  1419. // internet; with or without a Google account.
  1420. // - allAuthenticatedUsers — A special identifier that represents
  1421. // anyone who is authenticated with a Google account or a service
  1422. // account.
  1423. // - user:emailid — An email address that represents a specific
  1424. // account. For example, user:alice@gmail.com or user:joe@example.com.
  1425. //
  1426. // - serviceAccount:emailid — An email address that represents a
  1427. // service account. For example,
  1428. // serviceAccount:my-other-app@appspot.gserviceaccount.com .
  1429. // - group:emailid — An email address that represents a Google group.
  1430. // For example, group:admins@example.com.
  1431. // - domain:domain — A Google Apps domain name that represents all the
  1432. // users of that domain. For example, domain:google.com or
  1433. // domain:example.com.
  1434. // - projectOwner:projectid — Owners of the given project. For
  1435. // example, projectOwner:my-example-project
  1436. // - projectEditor:projectid — Editors of the given project. For
  1437. // example, projectEditor:my-example-project
  1438. // - projectViewer:projectid — Viewers of the given project. For
  1439. // example, projectViewer:my-example-project
  1440. Members []string `json:"members,omitempty"`
  1441. // Role: The role to which members belong. Two types of roles are
  1442. // supported: new IAM roles, which grant permissions that do not map
  1443. // directly to those provided by ACLs, and legacy IAM roles, which do
  1444. // map directly to ACL permissions. All roles are of the format
  1445. // roles/storage.specificRole.
  1446. // The new IAM roles are:
  1447. // - roles/storage.admin — Full control of Google Cloud Storage
  1448. // resources.
  1449. // - roles/storage.objectViewer — Read-Only access to Google Cloud
  1450. // Storage objects.
  1451. // - roles/storage.objectCreator — Access to create objects in Google
  1452. // Cloud Storage.
  1453. // - roles/storage.objectAdmin — Full control of Google Cloud Storage
  1454. // objects. The legacy IAM roles are:
  1455. // - roles/storage.legacyObjectReader — Read-only access to objects
  1456. // without listing. Equivalent to an ACL entry on an object with the
  1457. // READER role.
  1458. // - roles/storage.legacyObjectOwner — Read/write access to existing
  1459. // objects without listing. Equivalent to an ACL entry on an object with
  1460. // the OWNER role.
  1461. // - roles/storage.legacyBucketReader — Read access to buckets with
  1462. // object listing. Equivalent to an ACL entry on a bucket with the
  1463. // READER role.
  1464. // - roles/storage.legacyBucketWriter — Read access to buckets with
  1465. // object listing/creation/deletion. Equivalent to an ACL entry on a
  1466. // bucket with the WRITER role.
  1467. // - roles/storage.legacyBucketOwner — Read and write access to
  1468. // existing buckets with object listing/creation/deletion. Equivalent to
  1469. // an ACL entry on a bucket with the OWNER role.
  1470. Role string `json:"role,omitempty"`
  1471. // ForceSendFields is a list of field names (e.g. "Condition") to
  1472. // unconditionally include in API requests. By default, fields with
  1473. // empty values are omitted from API requests. However, any non-pointer,
  1474. // non-interface field appearing in ForceSendFields will be sent to the
  1475. // server regardless of whether the field is empty or not. This may be
  1476. // used to include empty fields in Patch requests.
  1477. ForceSendFields []string `json:"-"`
  1478. // NullFields is a list of field names (e.g. "Condition") to include in
  1479. // API requests with the JSON null value. By default, fields with empty
  1480. // values are omitted from API requests. However, any field with an
  1481. // empty value appearing in NullFields will be sent to the server as
  1482. // null. It is an error if a field in this list has a non-empty value.
  1483. // This may be used to include null fields in Patch requests.
  1484. NullFields []string `json:"-"`
  1485. }
  1486. func (s *PolicyBindings) MarshalJSON() ([]byte, error) {
  1487. type NoMethod PolicyBindings
  1488. raw := NoMethod(*s)
  1489. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1490. }
  1491. // RewriteResponse: A rewrite response.
  1492. type RewriteResponse struct {
  1493. // Done: true if the copy is finished; otherwise, false if the copy is
  1494. // in progress. This property is always present in the response.
  1495. Done bool `json:"done,omitempty"`
  1496. // Kind: The kind of item this is.
  1497. Kind string `json:"kind,omitempty"`
  1498. // ObjectSize: The total size of the object being copied in bytes. This
  1499. // property is always present in the response.
  1500. ObjectSize int64 `json:"objectSize,omitempty,string"`
  1501. // Resource: A resource containing the metadata for the copied-to
  1502. // object. This property is present in the response only when copying
  1503. // completes.
  1504. Resource *Object `json:"resource,omitempty"`
  1505. // RewriteToken: A token to use in subsequent requests to continue
  1506. // copying data. This token is present in the response only when there
  1507. // is more data to copy.
  1508. RewriteToken string `json:"rewriteToken,omitempty"`
  1509. // TotalBytesRewritten: The total bytes written so far, which can be
  1510. // used to provide a waiting user with a progress indicator. This
  1511. // property is always present in the response.
  1512. TotalBytesRewritten int64 `json:"totalBytesRewritten,omitempty,string"`
  1513. // ServerResponse contains the HTTP response code and headers from the
  1514. // server.
  1515. googleapi.ServerResponse `json:"-"`
  1516. // ForceSendFields is a list of field names (e.g. "Done") to
  1517. // unconditionally include in API requests. By default, fields with
  1518. // empty values are omitted from API requests. However, any non-pointer,
  1519. // non-interface field appearing in ForceSendFields will be sent to the
  1520. // server regardless of whether the field is empty or not. This may be
  1521. // used to include empty fields in Patch requests.
  1522. ForceSendFields []string `json:"-"`
  1523. // NullFields is a list of field names (e.g. "Done") to include in API
  1524. // requests with the JSON null value. By default, fields with empty
  1525. // values are omitted from API requests. However, any field with an
  1526. // empty value appearing in NullFields will be sent to the server as
  1527. // null. It is an error if a field in this list has a non-empty value.
  1528. // This may be used to include null fields in Patch requests.
  1529. NullFields []string `json:"-"`
  1530. }
  1531. func (s *RewriteResponse) MarshalJSON() ([]byte, error) {
  1532. type NoMethod RewriteResponse
  1533. raw := NoMethod(*s)
  1534. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1535. }
  1536. // ServiceAccount: A subscription to receive Google PubSub
  1537. // notifications.
  1538. type ServiceAccount struct {
  1539. // EmailAddress: The ID of the notification.
  1540. EmailAddress string `json:"email_address,omitempty"`
  1541. // Kind: The kind of item this is. For notifications, this is always
  1542. // storage#notification.
  1543. Kind string `json:"kind,omitempty"`
  1544. // ServerResponse contains the HTTP response code and headers from the
  1545. // server.
  1546. googleapi.ServerResponse `json:"-"`
  1547. // ForceSendFields is a list of field names (e.g. "EmailAddress") to
  1548. // unconditionally include in API requests. By default, fields with
  1549. // empty values are omitted from API requests. However, any non-pointer,
  1550. // non-interface field appearing in ForceSendFields will be sent to the
  1551. // server regardless of whether the field is empty or not. This may be
  1552. // used to include empty fields in Patch requests.
  1553. ForceSendFields []string `json:"-"`
  1554. // NullFields is a list of field names (e.g. "EmailAddress") to include
  1555. // in API requests with the JSON null value. By default, fields with
  1556. // empty values are omitted from API requests. However, any field with
  1557. // an empty value appearing in NullFields will be sent to the server as
  1558. // null. It is an error if a field in this list has a non-empty value.
  1559. // This may be used to include null fields in Patch requests.
  1560. NullFields []string `json:"-"`
  1561. }
  1562. func (s *ServiceAccount) MarshalJSON() ([]byte, error) {
  1563. type NoMethod ServiceAccount
  1564. raw := NoMethod(*s)
  1565. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1566. }
  1567. // TestIamPermissionsResponse: A
  1568. // storage.(buckets|objects).testIamPermissions response.
  1569. type TestIamPermissionsResponse struct {
  1570. // Kind: The kind of item this is.
  1571. Kind string `json:"kind,omitempty"`
  1572. // Permissions: The permissions held by the caller. Permissions are
  1573. // always of the format storage.resource.capability, where resource is
  1574. // one of buckets or objects. The supported permissions are as follows:
  1575. //
  1576. // - storage.buckets.delete — Delete bucket.
  1577. // - storage.buckets.get — Read bucket metadata.
  1578. // - storage.buckets.getIamPolicy — Read bucket IAM policy.
  1579. // - storage.buckets.create — Create bucket.
  1580. // - storage.buckets.list — List buckets.
  1581. // - storage.buckets.setIamPolicy — Update bucket IAM policy.
  1582. // - storage.buckets.update — Update bucket metadata.
  1583. // - storage.objects.delete — Delete object.
  1584. // - storage.objects.get — Read object data and metadata.
  1585. // - storage.objects.getIamPolicy — Read object IAM policy.
  1586. // - storage.objects.create — Create object.
  1587. // - storage.objects.list — List objects.
  1588. // - storage.objects.setIamPolicy — Update object IAM policy.
  1589. // - storage.objects.update — Update object metadata.
  1590. Permissions []string `json:"permissions,omitempty"`
  1591. // ServerResponse contains the HTTP response code and headers from the
  1592. // server.
  1593. googleapi.ServerResponse `json:"-"`
  1594. // ForceSendFields is a list of field names (e.g. "Kind") to
  1595. // unconditionally include in API requests. By default, fields with
  1596. // empty values are omitted from API requests. However, any non-pointer,
  1597. // non-interface field appearing in ForceSendFields will be sent to the
  1598. // server regardless of whether the field is empty or not. This may be
  1599. // used to include empty fields in Patch requests.
  1600. ForceSendFields []string `json:"-"`
  1601. // NullFields is a list of field names (e.g. "Kind") to include in API
  1602. // requests with the JSON null value. By default, fields with empty
  1603. // values are omitted from API requests. However, any field with an
  1604. // empty value appearing in NullFields will be sent to the server as
  1605. // null. It is an error if a field in this list has a non-empty value.
  1606. // This may be used to include null fields in Patch requests.
  1607. NullFields []string `json:"-"`
  1608. }
  1609. func (s *TestIamPermissionsResponse) MarshalJSON() ([]byte, error) {
  1610. type NoMethod TestIamPermissionsResponse
  1611. raw := NoMethod(*s)
  1612. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1613. }
  1614. // method id "storage.bucketAccessControls.delete":
  1615. type BucketAccessControlsDeleteCall struct {
  1616. s *Service
  1617. bucket string
  1618. entity string
  1619. urlParams_ gensupport.URLParams
  1620. ctx_ context.Context
  1621. header_ http.Header
  1622. }
  1623. // Delete: Permanently deletes the ACL entry for the specified entity on
  1624. // the specified bucket.
  1625. func (r *BucketAccessControlsService) Delete(bucket string, entity string) *BucketAccessControlsDeleteCall {
  1626. c := &BucketAccessControlsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1627. c.bucket = bucket
  1628. c.entity = entity
  1629. return c
  1630. }
  1631. // UserProject sets the optional parameter "userProject": The project to
  1632. // be billed for this request. Required for Requester Pays buckets.
  1633. func (c *BucketAccessControlsDeleteCall) UserProject(userProject string) *BucketAccessControlsDeleteCall {
  1634. c.urlParams_.Set("userProject", userProject)
  1635. return c
  1636. }
  1637. // Fields allows partial responses to be retrieved. See
  1638. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1639. // for more information.
  1640. func (c *BucketAccessControlsDeleteCall) Fields(s ...googleapi.Field) *BucketAccessControlsDeleteCall {
  1641. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1642. return c
  1643. }
  1644. // Context sets the context to be used in this call's Do method. Any
  1645. // pending HTTP request will be aborted if the provided context is
  1646. // canceled.
  1647. func (c *BucketAccessControlsDeleteCall) Context(ctx context.Context) *BucketAccessControlsDeleteCall {
  1648. c.ctx_ = ctx
  1649. return c
  1650. }
  1651. // Header returns an http.Header that can be modified by the caller to
  1652. // add HTTP headers to the request.
  1653. func (c *BucketAccessControlsDeleteCall) Header() http.Header {
  1654. if c.header_ == nil {
  1655. c.header_ = make(http.Header)
  1656. }
  1657. return c.header_
  1658. }
  1659. func (c *BucketAccessControlsDeleteCall) doRequest(alt string) (*http.Response, error) {
  1660. reqHeaders := make(http.Header)
  1661. for k, v := range c.header_ {
  1662. reqHeaders[k] = v
  1663. }
  1664. reqHeaders.Set("User-Agent", c.s.userAgent())
  1665. var body io.Reader = nil
  1666. c.urlParams_.Set("alt", alt)
  1667. c.urlParams_.Set("prettyPrint", "false")
  1668. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/acl/{entity}")
  1669. urls += "?" + c.urlParams_.Encode()
  1670. req, err := http.NewRequest("DELETE", urls, body)
  1671. if err != nil {
  1672. return nil, err
  1673. }
  1674. req.Header = reqHeaders
  1675. googleapi.Expand(req.URL, map[string]string{
  1676. "bucket": c.bucket,
  1677. "entity": c.entity,
  1678. })
  1679. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1680. }
  1681. // Do executes the "storage.bucketAccessControls.delete" call.
  1682. func (c *BucketAccessControlsDeleteCall) Do(opts ...googleapi.CallOption) error {
  1683. gensupport.SetOptions(c.urlParams_, opts...)
  1684. res, err := c.doRequest("json")
  1685. if err != nil {
  1686. return err
  1687. }
  1688. defer googleapi.CloseBody(res)
  1689. if err := googleapi.CheckResponse(res); err != nil {
  1690. return err
  1691. }
  1692. return nil
  1693. // {
  1694. // "description": "Permanently deletes the ACL entry for the specified entity on the specified bucket.",
  1695. // "httpMethod": "DELETE",
  1696. // "id": "storage.bucketAccessControls.delete",
  1697. // "parameterOrder": [
  1698. // "bucket",
  1699. // "entity"
  1700. // ],
  1701. // "parameters": {
  1702. // "bucket": {
  1703. // "description": "Name of a bucket.",
  1704. // "location": "path",
  1705. // "required": true,
  1706. // "type": "string"
  1707. // },
  1708. // "entity": {
  1709. // "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.",
  1710. // "location": "path",
  1711. // "required": true,
  1712. // "type": "string"
  1713. // },
  1714. // "userProject": {
  1715. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  1716. // "location": "query",
  1717. // "type": "string"
  1718. // }
  1719. // },
  1720. // "path": "b/{bucket}/acl/{entity}",
  1721. // "scopes": [
  1722. // "https://www.googleapis.com/auth/cloud-platform",
  1723. // "https://www.googleapis.com/auth/devstorage.full_control"
  1724. // ]
  1725. // }
  1726. }
  1727. // method id "storage.bucketAccessControls.get":
  1728. type BucketAccessControlsGetCall struct {
  1729. s *Service
  1730. bucket string
  1731. entity string
  1732. urlParams_ gensupport.URLParams
  1733. ifNoneMatch_ string
  1734. ctx_ context.Context
  1735. header_ http.Header
  1736. }
  1737. // Get: Returns the ACL entry for the specified entity on the specified
  1738. // bucket.
  1739. func (r *BucketAccessControlsService) Get(bucket string, entity string) *BucketAccessControlsGetCall {
  1740. c := &BucketAccessControlsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1741. c.bucket = bucket
  1742. c.entity = entity
  1743. return c
  1744. }
  1745. // UserProject sets the optional parameter "userProject": The project to
  1746. // be billed for this request. Required for Requester Pays buckets.
  1747. func (c *BucketAccessControlsGetCall) UserProject(userProject string) *BucketAccessControlsGetCall {
  1748. c.urlParams_.Set("userProject", userProject)
  1749. return c
  1750. }
  1751. // Fields allows partial responses to be retrieved. See
  1752. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1753. // for more information.
  1754. func (c *BucketAccessControlsGetCall) Fields(s ...googleapi.Field) *BucketAccessControlsGetCall {
  1755. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1756. return c
  1757. }
  1758. // IfNoneMatch sets the optional parameter which makes the operation
  1759. // fail if the object's ETag matches the given value. This is useful for
  1760. // getting updates only after the object has changed since the last
  1761. // request. Use googleapi.IsNotModified to check whether the response
  1762. // error from Do is the result of In-None-Match.
  1763. func (c *BucketAccessControlsGetCall) IfNoneMatch(entityTag string) *BucketAccessControlsGetCall {
  1764. c.ifNoneMatch_ = entityTag
  1765. return c
  1766. }
  1767. // Context sets the context to be used in this call's Do method. Any
  1768. // pending HTTP request will be aborted if the provided context is
  1769. // canceled.
  1770. func (c *BucketAccessControlsGetCall) Context(ctx context.Context) *BucketAccessControlsGetCall {
  1771. c.ctx_ = ctx
  1772. return c
  1773. }
  1774. // Header returns an http.Header that can be modified by the caller to
  1775. // add HTTP headers to the request.
  1776. func (c *BucketAccessControlsGetCall) Header() http.Header {
  1777. if c.header_ == nil {
  1778. c.header_ = make(http.Header)
  1779. }
  1780. return c.header_
  1781. }
  1782. func (c *BucketAccessControlsGetCall) doRequest(alt string) (*http.Response, error) {
  1783. reqHeaders := make(http.Header)
  1784. for k, v := range c.header_ {
  1785. reqHeaders[k] = v
  1786. }
  1787. reqHeaders.Set("User-Agent", c.s.userAgent())
  1788. if c.ifNoneMatch_ != "" {
  1789. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1790. }
  1791. var body io.Reader = nil
  1792. c.urlParams_.Set("alt", alt)
  1793. c.urlParams_.Set("prettyPrint", "false")
  1794. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/acl/{entity}")
  1795. urls += "?" + c.urlParams_.Encode()
  1796. req, err := http.NewRequest("GET", urls, body)
  1797. if err != nil {
  1798. return nil, err
  1799. }
  1800. req.Header = reqHeaders
  1801. googleapi.Expand(req.URL, map[string]string{
  1802. "bucket": c.bucket,
  1803. "entity": c.entity,
  1804. })
  1805. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1806. }
  1807. // Do executes the "storage.bucketAccessControls.get" call.
  1808. // Exactly one of *BucketAccessControl or error will be non-nil. Any
  1809. // non-2xx status code is an error. Response headers are in either
  1810. // *BucketAccessControl.ServerResponse.Header or (if a response was
  1811. // returned at all) in error.(*googleapi.Error).Header. Use
  1812. // googleapi.IsNotModified to check whether the returned error was
  1813. // because http.StatusNotModified was returned.
  1814. func (c *BucketAccessControlsGetCall) Do(opts ...googleapi.CallOption) (*BucketAccessControl, error) {
  1815. gensupport.SetOptions(c.urlParams_, opts...)
  1816. res, err := c.doRequest("json")
  1817. if res != nil && res.StatusCode == http.StatusNotModified {
  1818. if res.Body != nil {
  1819. res.Body.Close()
  1820. }
  1821. return nil, &googleapi.Error{
  1822. Code: res.StatusCode,
  1823. Header: res.Header,
  1824. }
  1825. }
  1826. if err != nil {
  1827. return nil, err
  1828. }
  1829. defer googleapi.CloseBody(res)
  1830. if err := googleapi.CheckResponse(res); err != nil {
  1831. return nil, err
  1832. }
  1833. ret := &BucketAccessControl{
  1834. ServerResponse: googleapi.ServerResponse{
  1835. Header: res.Header,
  1836. HTTPStatusCode: res.StatusCode,
  1837. },
  1838. }
  1839. target := &ret
  1840. if err := gensupport.DecodeResponse(target, res); err != nil {
  1841. return nil, err
  1842. }
  1843. return ret, nil
  1844. // {
  1845. // "description": "Returns the ACL entry for the specified entity on the specified bucket.",
  1846. // "httpMethod": "GET",
  1847. // "id": "storage.bucketAccessControls.get",
  1848. // "parameterOrder": [
  1849. // "bucket",
  1850. // "entity"
  1851. // ],
  1852. // "parameters": {
  1853. // "bucket": {
  1854. // "description": "Name of a bucket.",
  1855. // "location": "path",
  1856. // "required": true,
  1857. // "type": "string"
  1858. // },
  1859. // "entity": {
  1860. // "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.",
  1861. // "location": "path",
  1862. // "required": true,
  1863. // "type": "string"
  1864. // },
  1865. // "userProject": {
  1866. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  1867. // "location": "query",
  1868. // "type": "string"
  1869. // }
  1870. // },
  1871. // "path": "b/{bucket}/acl/{entity}",
  1872. // "response": {
  1873. // "$ref": "BucketAccessControl"
  1874. // },
  1875. // "scopes": [
  1876. // "https://www.googleapis.com/auth/cloud-platform",
  1877. // "https://www.googleapis.com/auth/devstorage.full_control"
  1878. // ]
  1879. // }
  1880. }
  1881. // method id "storage.bucketAccessControls.insert":
  1882. type BucketAccessControlsInsertCall struct {
  1883. s *Service
  1884. bucket string
  1885. bucketaccesscontrol *BucketAccessControl
  1886. urlParams_ gensupport.URLParams
  1887. ctx_ context.Context
  1888. header_ http.Header
  1889. }
  1890. // Insert: Creates a new ACL entry on the specified bucket.
  1891. func (r *BucketAccessControlsService) Insert(bucket string, bucketaccesscontrol *BucketAccessControl) *BucketAccessControlsInsertCall {
  1892. c := &BucketAccessControlsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1893. c.bucket = bucket
  1894. c.bucketaccesscontrol = bucketaccesscontrol
  1895. return c
  1896. }
  1897. // UserProject sets the optional parameter "userProject": The project to
  1898. // be billed for this request. Required for Requester Pays buckets.
  1899. func (c *BucketAccessControlsInsertCall) UserProject(userProject string) *BucketAccessControlsInsertCall {
  1900. c.urlParams_.Set("userProject", userProject)
  1901. return c
  1902. }
  1903. // Fields allows partial responses to be retrieved. See
  1904. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1905. // for more information.
  1906. func (c *BucketAccessControlsInsertCall) Fields(s ...googleapi.Field) *BucketAccessControlsInsertCall {
  1907. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1908. return c
  1909. }
  1910. // Context sets the context to be used in this call's Do method. Any
  1911. // pending HTTP request will be aborted if the provided context is
  1912. // canceled.
  1913. func (c *BucketAccessControlsInsertCall) Context(ctx context.Context) *BucketAccessControlsInsertCall {
  1914. c.ctx_ = ctx
  1915. return c
  1916. }
  1917. // Header returns an http.Header that can be modified by the caller to
  1918. // add HTTP headers to the request.
  1919. func (c *BucketAccessControlsInsertCall) Header() http.Header {
  1920. if c.header_ == nil {
  1921. c.header_ = make(http.Header)
  1922. }
  1923. return c.header_
  1924. }
  1925. func (c *BucketAccessControlsInsertCall) doRequest(alt string) (*http.Response, error) {
  1926. reqHeaders := make(http.Header)
  1927. for k, v := range c.header_ {
  1928. reqHeaders[k] = v
  1929. }
  1930. reqHeaders.Set("User-Agent", c.s.userAgent())
  1931. var body io.Reader = nil
  1932. body, err := googleapi.WithoutDataWrapper.JSONReader(c.bucketaccesscontrol)
  1933. if err != nil {
  1934. return nil, err
  1935. }
  1936. reqHeaders.Set("Content-Type", "application/json")
  1937. c.urlParams_.Set("alt", alt)
  1938. c.urlParams_.Set("prettyPrint", "false")
  1939. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/acl")
  1940. urls += "?" + c.urlParams_.Encode()
  1941. req, err := http.NewRequest("POST", urls, body)
  1942. if err != nil {
  1943. return nil, err
  1944. }
  1945. req.Header = reqHeaders
  1946. googleapi.Expand(req.URL, map[string]string{
  1947. "bucket": c.bucket,
  1948. })
  1949. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1950. }
  1951. // Do executes the "storage.bucketAccessControls.insert" call.
  1952. // Exactly one of *BucketAccessControl or error will be non-nil. Any
  1953. // non-2xx status code is an error. Response headers are in either
  1954. // *BucketAccessControl.ServerResponse.Header or (if a response was
  1955. // returned at all) in error.(*googleapi.Error).Header. Use
  1956. // googleapi.IsNotModified to check whether the returned error was
  1957. // because http.StatusNotModified was returned.
  1958. func (c *BucketAccessControlsInsertCall) Do(opts ...googleapi.CallOption) (*BucketAccessControl, error) {
  1959. gensupport.SetOptions(c.urlParams_, opts...)
  1960. res, err := c.doRequest("json")
  1961. if res != nil && res.StatusCode == http.StatusNotModified {
  1962. if res.Body != nil {
  1963. res.Body.Close()
  1964. }
  1965. return nil, &googleapi.Error{
  1966. Code: res.StatusCode,
  1967. Header: res.Header,
  1968. }
  1969. }
  1970. if err != nil {
  1971. return nil, err
  1972. }
  1973. defer googleapi.CloseBody(res)
  1974. if err := googleapi.CheckResponse(res); err != nil {
  1975. return nil, err
  1976. }
  1977. ret := &BucketAccessControl{
  1978. ServerResponse: googleapi.ServerResponse{
  1979. Header: res.Header,
  1980. HTTPStatusCode: res.StatusCode,
  1981. },
  1982. }
  1983. target := &ret
  1984. if err := gensupport.DecodeResponse(target, res); err != nil {
  1985. return nil, err
  1986. }
  1987. return ret, nil
  1988. // {
  1989. // "description": "Creates a new ACL entry on the specified bucket.",
  1990. // "httpMethod": "POST",
  1991. // "id": "storage.bucketAccessControls.insert",
  1992. // "parameterOrder": [
  1993. // "bucket"
  1994. // ],
  1995. // "parameters": {
  1996. // "bucket": {
  1997. // "description": "Name of a bucket.",
  1998. // "location": "path",
  1999. // "required": true,
  2000. // "type": "string"
  2001. // },
  2002. // "userProject": {
  2003. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  2004. // "location": "query",
  2005. // "type": "string"
  2006. // }
  2007. // },
  2008. // "path": "b/{bucket}/acl",
  2009. // "request": {
  2010. // "$ref": "BucketAccessControl"
  2011. // },
  2012. // "response": {
  2013. // "$ref": "BucketAccessControl"
  2014. // },
  2015. // "scopes": [
  2016. // "https://www.googleapis.com/auth/cloud-platform",
  2017. // "https://www.googleapis.com/auth/devstorage.full_control"
  2018. // ]
  2019. // }
  2020. }
  2021. // method id "storage.bucketAccessControls.list":
  2022. type BucketAccessControlsListCall struct {
  2023. s *Service
  2024. bucket string
  2025. urlParams_ gensupport.URLParams
  2026. ifNoneMatch_ string
  2027. ctx_ context.Context
  2028. header_ http.Header
  2029. }
  2030. // List: Retrieves ACL entries on the specified bucket.
  2031. func (r *BucketAccessControlsService) List(bucket string) *BucketAccessControlsListCall {
  2032. c := &BucketAccessControlsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2033. c.bucket = bucket
  2034. return c
  2035. }
  2036. // UserProject sets the optional parameter "userProject": The project to
  2037. // be billed for this request. Required for Requester Pays buckets.
  2038. func (c *BucketAccessControlsListCall) UserProject(userProject string) *BucketAccessControlsListCall {
  2039. c.urlParams_.Set("userProject", userProject)
  2040. return c
  2041. }
  2042. // Fields allows partial responses to be retrieved. See
  2043. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2044. // for more information.
  2045. func (c *BucketAccessControlsListCall) Fields(s ...googleapi.Field) *BucketAccessControlsListCall {
  2046. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2047. return c
  2048. }
  2049. // IfNoneMatch sets the optional parameter which makes the operation
  2050. // fail if the object's ETag matches the given value. This is useful for
  2051. // getting updates only after the object has changed since the last
  2052. // request. Use googleapi.IsNotModified to check whether the response
  2053. // error from Do is the result of In-None-Match.
  2054. func (c *BucketAccessControlsListCall) IfNoneMatch(entityTag string) *BucketAccessControlsListCall {
  2055. c.ifNoneMatch_ = entityTag
  2056. return c
  2057. }
  2058. // Context sets the context to be used in this call's Do method. Any
  2059. // pending HTTP request will be aborted if the provided context is
  2060. // canceled.
  2061. func (c *BucketAccessControlsListCall) Context(ctx context.Context) *BucketAccessControlsListCall {
  2062. c.ctx_ = ctx
  2063. return c
  2064. }
  2065. // Header returns an http.Header that can be modified by the caller to
  2066. // add HTTP headers to the request.
  2067. func (c *BucketAccessControlsListCall) Header() http.Header {
  2068. if c.header_ == nil {
  2069. c.header_ = make(http.Header)
  2070. }
  2071. return c.header_
  2072. }
  2073. func (c *BucketAccessControlsListCall) doRequest(alt string) (*http.Response, error) {
  2074. reqHeaders := make(http.Header)
  2075. for k, v := range c.header_ {
  2076. reqHeaders[k] = v
  2077. }
  2078. reqHeaders.Set("User-Agent", c.s.userAgent())
  2079. if c.ifNoneMatch_ != "" {
  2080. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2081. }
  2082. var body io.Reader = nil
  2083. c.urlParams_.Set("alt", alt)
  2084. c.urlParams_.Set("prettyPrint", "false")
  2085. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/acl")
  2086. urls += "?" + c.urlParams_.Encode()
  2087. req, err := http.NewRequest("GET", urls, body)
  2088. if err != nil {
  2089. return nil, err
  2090. }
  2091. req.Header = reqHeaders
  2092. googleapi.Expand(req.URL, map[string]string{
  2093. "bucket": c.bucket,
  2094. })
  2095. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2096. }
  2097. // Do executes the "storage.bucketAccessControls.list" call.
  2098. // Exactly one of *BucketAccessControls or error will be non-nil. Any
  2099. // non-2xx status code is an error. Response headers are in either
  2100. // *BucketAccessControls.ServerResponse.Header or (if a response was
  2101. // returned at all) in error.(*googleapi.Error).Header. Use
  2102. // googleapi.IsNotModified to check whether the returned error was
  2103. // because http.StatusNotModified was returned.
  2104. func (c *BucketAccessControlsListCall) Do(opts ...googleapi.CallOption) (*BucketAccessControls, error) {
  2105. gensupport.SetOptions(c.urlParams_, opts...)
  2106. res, err := c.doRequest("json")
  2107. if res != nil && res.StatusCode == http.StatusNotModified {
  2108. if res.Body != nil {
  2109. res.Body.Close()
  2110. }
  2111. return nil, &googleapi.Error{
  2112. Code: res.StatusCode,
  2113. Header: res.Header,
  2114. }
  2115. }
  2116. if err != nil {
  2117. return nil, err
  2118. }
  2119. defer googleapi.CloseBody(res)
  2120. if err := googleapi.CheckResponse(res); err != nil {
  2121. return nil, err
  2122. }
  2123. ret := &BucketAccessControls{
  2124. ServerResponse: googleapi.ServerResponse{
  2125. Header: res.Header,
  2126. HTTPStatusCode: res.StatusCode,
  2127. },
  2128. }
  2129. target := &ret
  2130. if err := gensupport.DecodeResponse(target, res); err != nil {
  2131. return nil, err
  2132. }
  2133. return ret, nil
  2134. // {
  2135. // "description": "Retrieves ACL entries on the specified bucket.",
  2136. // "httpMethod": "GET",
  2137. // "id": "storage.bucketAccessControls.list",
  2138. // "parameterOrder": [
  2139. // "bucket"
  2140. // ],
  2141. // "parameters": {
  2142. // "bucket": {
  2143. // "description": "Name of a bucket.",
  2144. // "location": "path",
  2145. // "required": true,
  2146. // "type": "string"
  2147. // },
  2148. // "userProject": {
  2149. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  2150. // "location": "query",
  2151. // "type": "string"
  2152. // }
  2153. // },
  2154. // "path": "b/{bucket}/acl",
  2155. // "response": {
  2156. // "$ref": "BucketAccessControls"
  2157. // },
  2158. // "scopes": [
  2159. // "https://www.googleapis.com/auth/cloud-platform",
  2160. // "https://www.googleapis.com/auth/devstorage.full_control"
  2161. // ]
  2162. // }
  2163. }
  2164. // method id "storage.bucketAccessControls.patch":
  2165. type BucketAccessControlsPatchCall struct {
  2166. s *Service
  2167. bucket string
  2168. entity string
  2169. bucketaccesscontrol *BucketAccessControl
  2170. urlParams_ gensupport.URLParams
  2171. ctx_ context.Context
  2172. header_ http.Header
  2173. }
  2174. // Patch: Patches an ACL entry on the specified bucket.
  2175. func (r *BucketAccessControlsService) Patch(bucket string, entity string, bucketaccesscontrol *BucketAccessControl) *BucketAccessControlsPatchCall {
  2176. c := &BucketAccessControlsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2177. c.bucket = bucket
  2178. c.entity = entity
  2179. c.bucketaccesscontrol = bucketaccesscontrol
  2180. return c
  2181. }
  2182. // UserProject sets the optional parameter "userProject": The project to
  2183. // be billed for this request. Required for Requester Pays buckets.
  2184. func (c *BucketAccessControlsPatchCall) UserProject(userProject string) *BucketAccessControlsPatchCall {
  2185. c.urlParams_.Set("userProject", userProject)
  2186. return c
  2187. }
  2188. // Fields allows partial responses to be retrieved. See
  2189. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2190. // for more information.
  2191. func (c *BucketAccessControlsPatchCall) Fields(s ...googleapi.Field) *BucketAccessControlsPatchCall {
  2192. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2193. return c
  2194. }
  2195. // Context sets the context to be used in this call's Do method. Any
  2196. // pending HTTP request will be aborted if the provided context is
  2197. // canceled.
  2198. func (c *BucketAccessControlsPatchCall) Context(ctx context.Context) *BucketAccessControlsPatchCall {
  2199. c.ctx_ = ctx
  2200. return c
  2201. }
  2202. // Header returns an http.Header that can be modified by the caller to
  2203. // add HTTP headers to the request.
  2204. func (c *BucketAccessControlsPatchCall) Header() http.Header {
  2205. if c.header_ == nil {
  2206. c.header_ = make(http.Header)
  2207. }
  2208. return c.header_
  2209. }
  2210. func (c *BucketAccessControlsPatchCall) doRequest(alt string) (*http.Response, error) {
  2211. reqHeaders := make(http.Header)
  2212. for k, v := range c.header_ {
  2213. reqHeaders[k] = v
  2214. }
  2215. reqHeaders.Set("User-Agent", c.s.userAgent())
  2216. var body io.Reader = nil
  2217. body, err := googleapi.WithoutDataWrapper.JSONReader(c.bucketaccesscontrol)
  2218. if err != nil {
  2219. return nil, err
  2220. }
  2221. reqHeaders.Set("Content-Type", "application/json")
  2222. c.urlParams_.Set("alt", alt)
  2223. c.urlParams_.Set("prettyPrint", "false")
  2224. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/acl/{entity}")
  2225. urls += "?" + c.urlParams_.Encode()
  2226. req, err := http.NewRequest("PATCH", urls, body)
  2227. if err != nil {
  2228. return nil, err
  2229. }
  2230. req.Header = reqHeaders
  2231. googleapi.Expand(req.URL, map[string]string{
  2232. "bucket": c.bucket,
  2233. "entity": c.entity,
  2234. })
  2235. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2236. }
  2237. // Do executes the "storage.bucketAccessControls.patch" call.
  2238. // Exactly one of *BucketAccessControl or error will be non-nil. Any
  2239. // non-2xx status code is an error. Response headers are in either
  2240. // *BucketAccessControl.ServerResponse.Header or (if a response was
  2241. // returned at all) in error.(*googleapi.Error).Header. Use
  2242. // googleapi.IsNotModified to check whether the returned error was
  2243. // because http.StatusNotModified was returned.
  2244. func (c *BucketAccessControlsPatchCall) Do(opts ...googleapi.CallOption) (*BucketAccessControl, error) {
  2245. gensupport.SetOptions(c.urlParams_, opts...)
  2246. res, err := c.doRequest("json")
  2247. if res != nil && res.StatusCode == http.StatusNotModified {
  2248. if res.Body != nil {
  2249. res.Body.Close()
  2250. }
  2251. return nil, &googleapi.Error{
  2252. Code: res.StatusCode,
  2253. Header: res.Header,
  2254. }
  2255. }
  2256. if err != nil {
  2257. return nil, err
  2258. }
  2259. defer googleapi.CloseBody(res)
  2260. if err := googleapi.CheckResponse(res); err != nil {
  2261. return nil, err
  2262. }
  2263. ret := &BucketAccessControl{
  2264. ServerResponse: googleapi.ServerResponse{
  2265. Header: res.Header,
  2266. HTTPStatusCode: res.StatusCode,
  2267. },
  2268. }
  2269. target := &ret
  2270. if err := gensupport.DecodeResponse(target, res); err != nil {
  2271. return nil, err
  2272. }
  2273. return ret, nil
  2274. // {
  2275. // "description": "Patches an ACL entry on the specified bucket.",
  2276. // "httpMethod": "PATCH",
  2277. // "id": "storage.bucketAccessControls.patch",
  2278. // "parameterOrder": [
  2279. // "bucket",
  2280. // "entity"
  2281. // ],
  2282. // "parameters": {
  2283. // "bucket": {
  2284. // "description": "Name of a bucket.",
  2285. // "location": "path",
  2286. // "required": true,
  2287. // "type": "string"
  2288. // },
  2289. // "entity": {
  2290. // "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.",
  2291. // "location": "path",
  2292. // "required": true,
  2293. // "type": "string"
  2294. // },
  2295. // "userProject": {
  2296. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  2297. // "location": "query",
  2298. // "type": "string"
  2299. // }
  2300. // },
  2301. // "path": "b/{bucket}/acl/{entity}",
  2302. // "request": {
  2303. // "$ref": "BucketAccessControl"
  2304. // },
  2305. // "response": {
  2306. // "$ref": "BucketAccessControl"
  2307. // },
  2308. // "scopes": [
  2309. // "https://www.googleapis.com/auth/cloud-platform",
  2310. // "https://www.googleapis.com/auth/devstorage.full_control"
  2311. // ]
  2312. // }
  2313. }
  2314. // method id "storage.bucketAccessControls.update":
  2315. type BucketAccessControlsUpdateCall struct {
  2316. s *Service
  2317. bucket string
  2318. entity string
  2319. bucketaccesscontrol *BucketAccessControl
  2320. urlParams_ gensupport.URLParams
  2321. ctx_ context.Context
  2322. header_ http.Header
  2323. }
  2324. // Update: Updates an ACL entry on the specified bucket.
  2325. func (r *BucketAccessControlsService) Update(bucket string, entity string, bucketaccesscontrol *BucketAccessControl) *BucketAccessControlsUpdateCall {
  2326. c := &BucketAccessControlsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2327. c.bucket = bucket
  2328. c.entity = entity
  2329. c.bucketaccesscontrol = bucketaccesscontrol
  2330. return c
  2331. }
  2332. // UserProject sets the optional parameter "userProject": The project to
  2333. // be billed for this request. Required for Requester Pays buckets.
  2334. func (c *BucketAccessControlsUpdateCall) UserProject(userProject string) *BucketAccessControlsUpdateCall {
  2335. c.urlParams_.Set("userProject", userProject)
  2336. return c
  2337. }
  2338. // Fields allows partial responses to be retrieved. See
  2339. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2340. // for more information.
  2341. func (c *BucketAccessControlsUpdateCall) Fields(s ...googleapi.Field) *BucketAccessControlsUpdateCall {
  2342. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2343. return c
  2344. }
  2345. // Context sets the context to be used in this call's Do method. Any
  2346. // pending HTTP request will be aborted if the provided context is
  2347. // canceled.
  2348. func (c *BucketAccessControlsUpdateCall) Context(ctx context.Context) *BucketAccessControlsUpdateCall {
  2349. c.ctx_ = ctx
  2350. return c
  2351. }
  2352. // Header returns an http.Header that can be modified by the caller to
  2353. // add HTTP headers to the request.
  2354. func (c *BucketAccessControlsUpdateCall) Header() http.Header {
  2355. if c.header_ == nil {
  2356. c.header_ = make(http.Header)
  2357. }
  2358. return c.header_
  2359. }
  2360. func (c *BucketAccessControlsUpdateCall) doRequest(alt string) (*http.Response, error) {
  2361. reqHeaders := make(http.Header)
  2362. for k, v := range c.header_ {
  2363. reqHeaders[k] = v
  2364. }
  2365. reqHeaders.Set("User-Agent", c.s.userAgent())
  2366. var body io.Reader = nil
  2367. body, err := googleapi.WithoutDataWrapper.JSONReader(c.bucketaccesscontrol)
  2368. if err != nil {
  2369. return nil, err
  2370. }
  2371. reqHeaders.Set("Content-Type", "application/json")
  2372. c.urlParams_.Set("alt", alt)
  2373. c.urlParams_.Set("prettyPrint", "false")
  2374. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/acl/{entity}")
  2375. urls += "?" + c.urlParams_.Encode()
  2376. req, err := http.NewRequest("PUT", urls, body)
  2377. if err != nil {
  2378. return nil, err
  2379. }
  2380. req.Header = reqHeaders
  2381. googleapi.Expand(req.URL, map[string]string{
  2382. "bucket": c.bucket,
  2383. "entity": c.entity,
  2384. })
  2385. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2386. }
  2387. // Do executes the "storage.bucketAccessControls.update" call.
  2388. // Exactly one of *BucketAccessControl or error will be non-nil. Any
  2389. // non-2xx status code is an error. Response headers are in either
  2390. // *BucketAccessControl.ServerResponse.Header or (if a response was
  2391. // returned at all) in error.(*googleapi.Error).Header. Use
  2392. // googleapi.IsNotModified to check whether the returned error was
  2393. // because http.StatusNotModified was returned.
  2394. func (c *BucketAccessControlsUpdateCall) Do(opts ...googleapi.CallOption) (*BucketAccessControl, error) {
  2395. gensupport.SetOptions(c.urlParams_, opts...)
  2396. res, err := c.doRequest("json")
  2397. if res != nil && res.StatusCode == http.StatusNotModified {
  2398. if res.Body != nil {
  2399. res.Body.Close()
  2400. }
  2401. return nil, &googleapi.Error{
  2402. Code: res.StatusCode,
  2403. Header: res.Header,
  2404. }
  2405. }
  2406. if err != nil {
  2407. return nil, err
  2408. }
  2409. defer googleapi.CloseBody(res)
  2410. if err := googleapi.CheckResponse(res); err != nil {
  2411. return nil, err
  2412. }
  2413. ret := &BucketAccessControl{
  2414. ServerResponse: googleapi.ServerResponse{
  2415. Header: res.Header,
  2416. HTTPStatusCode: res.StatusCode,
  2417. },
  2418. }
  2419. target := &ret
  2420. if err := gensupport.DecodeResponse(target, res); err != nil {
  2421. return nil, err
  2422. }
  2423. return ret, nil
  2424. // {
  2425. // "description": "Updates an ACL entry on the specified bucket.",
  2426. // "httpMethod": "PUT",
  2427. // "id": "storage.bucketAccessControls.update",
  2428. // "parameterOrder": [
  2429. // "bucket",
  2430. // "entity"
  2431. // ],
  2432. // "parameters": {
  2433. // "bucket": {
  2434. // "description": "Name of a bucket.",
  2435. // "location": "path",
  2436. // "required": true,
  2437. // "type": "string"
  2438. // },
  2439. // "entity": {
  2440. // "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.",
  2441. // "location": "path",
  2442. // "required": true,
  2443. // "type": "string"
  2444. // },
  2445. // "userProject": {
  2446. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  2447. // "location": "query",
  2448. // "type": "string"
  2449. // }
  2450. // },
  2451. // "path": "b/{bucket}/acl/{entity}",
  2452. // "request": {
  2453. // "$ref": "BucketAccessControl"
  2454. // },
  2455. // "response": {
  2456. // "$ref": "BucketAccessControl"
  2457. // },
  2458. // "scopes": [
  2459. // "https://www.googleapis.com/auth/cloud-platform",
  2460. // "https://www.googleapis.com/auth/devstorage.full_control"
  2461. // ]
  2462. // }
  2463. }
  2464. // method id "storage.buckets.delete":
  2465. type BucketsDeleteCall struct {
  2466. s *Service
  2467. bucket string
  2468. urlParams_ gensupport.URLParams
  2469. ctx_ context.Context
  2470. header_ http.Header
  2471. }
  2472. // Delete: Permanently deletes an empty bucket.
  2473. func (r *BucketsService) Delete(bucket string) *BucketsDeleteCall {
  2474. c := &BucketsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2475. c.bucket = bucket
  2476. return c
  2477. }
  2478. // IfMetagenerationMatch sets the optional parameter
  2479. // "ifMetagenerationMatch": If set, only deletes the bucket if its
  2480. // metageneration matches this value.
  2481. func (c *BucketsDeleteCall) IfMetagenerationMatch(ifMetagenerationMatch int64) *BucketsDeleteCall {
  2482. c.urlParams_.Set("ifMetagenerationMatch", fmt.Sprint(ifMetagenerationMatch))
  2483. return c
  2484. }
  2485. // IfMetagenerationNotMatch sets the optional parameter
  2486. // "ifMetagenerationNotMatch": If set, only deletes the bucket if its
  2487. // metageneration does not match this value.
  2488. func (c *BucketsDeleteCall) IfMetagenerationNotMatch(ifMetagenerationNotMatch int64) *BucketsDeleteCall {
  2489. c.urlParams_.Set("ifMetagenerationNotMatch", fmt.Sprint(ifMetagenerationNotMatch))
  2490. return c
  2491. }
  2492. // UserProject sets the optional parameter "userProject": The project to
  2493. // be billed for this request. Required for Requester Pays buckets.
  2494. func (c *BucketsDeleteCall) UserProject(userProject string) *BucketsDeleteCall {
  2495. c.urlParams_.Set("userProject", userProject)
  2496. return c
  2497. }
  2498. // Fields allows partial responses to be retrieved. See
  2499. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2500. // for more information.
  2501. func (c *BucketsDeleteCall) Fields(s ...googleapi.Field) *BucketsDeleteCall {
  2502. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2503. return c
  2504. }
  2505. // Context sets the context to be used in this call's Do method. Any
  2506. // pending HTTP request will be aborted if the provided context is
  2507. // canceled.
  2508. func (c *BucketsDeleteCall) Context(ctx context.Context) *BucketsDeleteCall {
  2509. c.ctx_ = ctx
  2510. return c
  2511. }
  2512. // Header returns an http.Header that can be modified by the caller to
  2513. // add HTTP headers to the request.
  2514. func (c *BucketsDeleteCall) Header() http.Header {
  2515. if c.header_ == nil {
  2516. c.header_ = make(http.Header)
  2517. }
  2518. return c.header_
  2519. }
  2520. func (c *BucketsDeleteCall) doRequest(alt string) (*http.Response, error) {
  2521. reqHeaders := make(http.Header)
  2522. for k, v := range c.header_ {
  2523. reqHeaders[k] = v
  2524. }
  2525. reqHeaders.Set("User-Agent", c.s.userAgent())
  2526. var body io.Reader = nil
  2527. c.urlParams_.Set("alt", alt)
  2528. c.urlParams_.Set("prettyPrint", "false")
  2529. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}")
  2530. urls += "?" + c.urlParams_.Encode()
  2531. req, err := http.NewRequest("DELETE", urls, body)
  2532. if err != nil {
  2533. return nil, err
  2534. }
  2535. req.Header = reqHeaders
  2536. googleapi.Expand(req.URL, map[string]string{
  2537. "bucket": c.bucket,
  2538. })
  2539. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2540. }
  2541. // Do executes the "storage.buckets.delete" call.
  2542. func (c *BucketsDeleteCall) Do(opts ...googleapi.CallOption) error {
  2543. gensupport.SetOptions(c.urlParams_, opts...)
  2544. res, err := c.doRequest("json")
  2545. if err != nil {
  2546. return err
  2547. }
  2548. defer googleapi.CloseBody(res)
  2549. if err := googleapi.CheckResponse(res); err != nil {
  2550. return err
  2551. }
  2552. return nil
  2553. // {
  2554. // "description": "Permanently deletes an empty bucket.",
  2555. // "httpMethod": "DELETE",
  2556. // "id": "storage.buckets.delete",
  2557. // "parameterOrder": [
  2558. // "bucket"
  2559. // ],
  2560. // "parameters": {
  2561. // "bucket": {
  2562. // "description": "Name of a bucket.",
  2563. // "location": "path",
  2564. // "required": true,
  2565. // "type": "string"
  2566. // },
  2567. // "ifMetagenerationMatch": {
  2568. // "description": "If set, only deletes the bucket if its metageneration matches this value.",
  2569. // "format": "int64",
  2570. // "location": "query",
  2571. // "type": "string"
  2572. // },
  2573. // "ifMetagenerationNotMatch": {
  2574. // "description": "If set, only deletes the bucket if its metageneration does not match this value.",
  2575. // "format": "int64",
  2576. // "location": "query",
  2577. // "type": "string"
  2578. // },
  2579. // "userProject": {
  2580. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  2581. // "location": "query",
  2582. // "type": "string"
  2583. // }
  2584. // },
  2585. // "path": "b/{bucket}",
  2586. // "scopes": [
  2587. // "https://www.googleapis.com/auth/cloud-platform",
  2588. // "https://www.googleapis.com/auth/devstorage.full_control",
  2589. // "https://www.googleapis.com/auth/devstorage.read_write"
  2590. // ]
  2591. // }
  2592. }
  2593. // method id "storage.buckets.get":
  2594. type BucketsGetCall struct {
  2595. s *Service
  2596. bucket string
  2597. urlParams_ gensupport.URLParams
  2598. ifNoneMatch_ string
  2599. ctx_ context.Context
  2600. header_ http.Header
  2601. }
  2602. // Get: Returns metadata for the specified bucket.
  2603. func (r *BucketsService) Get(bucket string) *BucketsGetCall {
  2604. c := &BucketsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2605. c.bucket = bucket
  2606. return c
  2607. }
  2608. // IfMetagenerationMatch sets the optional parameter
  2609. // "ifMetagenerationMatch": Makes the return of the bucket metadata
  2610. // conditional on whether the bucket's current metageneration matches
  2611. // the given value.
  2612. func (c *BucketsGetCall) IfMetagenerationMatch(ifMetagenerationMatch int64) *BucketsGetCall {
  2613. c.urlParams_.Set("ifMetagenerationMatch", fmt.Sprint(ifMetagenerationMatch))
  2614. return c
  2615. }
  2616. // IfMetagenerationNotMatch sets the optional parameter
  2617. // "ifMetagenerationNotMatch": Makes the return of the bucket metadata
  2618. // conditional on whether the bucket's current metageneration does not
  2619. // match the given value.
  2620. func (c *BucketsGetCall) IfMetagenerationNotMatch(ifMetagenerationNotMatch int64) *BucketsGetCall {
  2621. c.urlParams_.Set("ifMetagenerationNotMatch", fmt.Sprint(ifMetagenerationNotMatch))
  2622. return c
  2623. }
  2624. // Projection sets the optional parameter "projection": Set of
  2625. // properties to return. Defaults to noAcl.
  2626. //
  2627. // Possible values:
  2628. // "full" - Include all properties.
  2629. // "noAcl" - Omit owner, acl and defaultObjectAcl properties.
  2630. func (c *BucketsGetCall) Projection(projection string) *BucketsGetCall {
  2631. c.urlParams_.Set("projection", projection)
  2632. return c
  2633. }
  2634. // UserProject sets the optional parameter "userProject": The project to
  2635. // be billed for this request. Required for Requester Pays buckets.
  2636. func (c *BucketsGetCall) UserProject(userProject string) *BucketsGetCall {
  2637. c.urlParams_.Set("userProject", userProject)
  2638. return c
  2639. }
  2640. // Fields allows partial responses to be retrieved. See
  2641. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2642. // for more information.
  2643. func (c *BucketsGetCall) Fields(s ...googleapi.Field) *BucketsGetCall {
  2644. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2645. return c
  2646. }
  2647. // IfNoneMatch sets the optional parameter which makes the operation
  2648. // fail if the object's ETag matches the given value. This is useful for
  2649. // getting updates only after the object has changed since the last
  2650. // request. Use googleapi.IsNotModified to check whether the response
  2651. // error from Do is the result of In-None-Match.
  2652. func (c *BucketsGetCall) IfNoneMatch(entityTag string) *BucketsGetCall {
  2653. c.ifNoneMatch_ = entityTag
  2654. return c
  2655. }
  2656. // Context sets the context to be used in this call's Do method. Any
  2657. // pending HTTP request will be aborted if the provided context is
  2658. // canceled.
  2659. func (c *BucketsGetCall) Context(ctx context.Context) *BucketsGetCall {
  2660. c.ctx_ = ctx
  2661. return c
  2662. }
  2663. // Header returns an http.Header that can be modified by the caller to
  2664. // add HTTP headers to the request.
  2665. func (c *BucketsGetCall) Header() http.Header {
  2666. if c.header_ == nil {
  2667. c.header_ = make(http.Header)
  2668. }
  2669. return c.header_
  2670. }
  2671. func (c *BucketsGetCall) doRequest(alt string) (*http.Response, error) {
  2672. reqHeaders := make(http.Header)
  2673. for k, v := range c.header_ {
  2674. reqHeaders[k] = v
  2675. }
  2676. reqHeaders.Set("User-Agent", c.s.userAgent())
  2677. if c.ifNoneMatch_ != "" {
  2678. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2679. }
  2680. var body io.Reader = nil
  2681. c.urlParams_.Set("alt", alt)
  2682. c.urlParams_.Set("prettyPrint", "false")
  2683. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}")
  2684. urls += "?" + c.urlParams_.Encode()
  2685. req, err := http.NewRequest("GET", urls, body)
  2686. if err != nil {
  2687. return nil, err
  2688. }
  2689. req.Header = reqHeaders
  2690. googleapi.Expand(req.URL, map[string]string{
  2691. "bucket": c.bucket,
  2692. })
  2693. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2694. }
  2695. // Do executes the "storage.buckets.get" call.
  2696. // Exactly one of *Bucket or error will be non-nil. Any non-2xx status
  2697. // code is an error. Response headers are in either
  2698. // *Bucket.ServerResponse.Header or (if a response was returned at all)
  2699. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2700. // check whether the returned error was because http.StatusNotModified
  2701. // was returned.
  2702. func (c *BucketsGetCall) Do(opts ...googleapi.CallOption) (*Bucket, error) {
  2703. gensupport.SetOptions(c.urlParams_, opts...)
  2704. res, err := c.doRequest("json")
  2705. if res != nil && res.StatusCode == http.StatusNotModified {
  2706. if res.Body != nil {
  2707. res.Body.Close()
  2708. }
  2709. return nil, &googleapi.Error{
  2710. Code: res.StatusCode,
  2711. Header: res.Header,
  2712. }
  2713. }
  2714. if err != nil {
  2715. return nil, err
  2716. }
  2717. defer googleapi.CloseBody(res)
  2718. if err := googleapi.CheckResponse(res); err != nil {
  2719. return nil, err
  2720. }
  2721. ret := &Bucket{
  2722. ServerResponse: googleapi.ServerResponse{
  2723. Header: res.Header,
  2724. HTTPStatusCode: res.StatusCode,
  2725. },
  2726. }
  2727. target := &ret
  2728. if err := gensupport.DecodeResponse(target, res); err != nil {
  2729. return nil, err
  2730. }
  2731. return ret, nil
  2732. // {
  2733. // "description": "Returns metadata for the specified bucket.",
  2734. // "httpMethod": "GET",
  2735. // "id": "storage.buckets.get",
  2736. // "parameterOrder": [
  2737. // "bucket"
  2738. // ],
  2739. // "parameters": {
  2740. // "bucket": {
  2741. // "description": "Name of a bucket.",
  2742. // "location": "path",
  2743. // "required": true,
  2744. // "type": "string"
  2745. // },
  2746. // "ifMetagenerationMatch": {
  2747. // "description": "Makes the return of the bucket metadata conditional on whether the bucket's current metageneration matches the given value.",
  2748. // "format": "int64",
  2749. // "location": "query",
  2750. // "type": "string"
  2751. // },
  2752. // "ifMetagenerationNotMatch": {
  2753. // "description": "Makes the return of the bucket metadata conditional on whether the bucket's current metageneration does not match the given value.",
  2754. // "format": "int64",
  2755. // "location": "query",
  2756. // "type": "string"
  2757. // },
  2758. // "projection": {
  2759. // "description": "Set of properties to return. Defaults to noAcl.",
  2760. // "enum": [
  2761. // "full",
  2762. // "noAcl"
  2763. // ],
  2764. // "enumDescriptions": [
  2765. // "Include all properties.",
  2766. // "Omit owner, acl and defaultObjectAcl properties."
  2767. // ],
  2768. // "location": "query",
  2769. // "type": "string"
  2770. // },
  2771. // "userProject": {
  2772. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  2773. // "location": "query",
  2774. // "type": "string"
  2775. // }
  2776. // },
  2777. // "path": "b/{bucket}",
  2778. // "response": {
  2779. // "$ref": "Bucket"
  2780. // },
  2781. // "scopes": [
  2782. // "https://www.googleapis.com/auth/cloud-platform",
  2783. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  2784. // "https://www.googleapis.com/auth/devstorage.full_control",
  2785. // "https://www.googleapis.com/auth/devstorage.read_only",
  2786. // "https://www.googleapis.com/auth/devstorage.read_write"
  2787. // ]
  2788. // }
  2789. }
  2790. // method id "storage.buckets.getIamPolicy":
  2791. type BucketsGetIamPolicyCall struct {
  2792. s *Service
  2793. bucket string
  2794. urlParams_ gensupport.URLParams
  2795. ifNoneMatch_ string
  2796. ctx_ context.Context
  2797. header_ http.Header
  2798. }
  2799. // GetIamPolicy: Returns an IAM policy for the specified bucket.
  2800. func (r *BucketsService) GetIamPolicy(bucket string) *BucketsGetIamPolicyCall {
  2801. c := &BucketsGetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2802. c.bucket = bucket
  2803. return c
  2804. }
  2805. // UserProject sets the optional parameter "userProject": The project to
  2806. // be billed for this request. Required for Requester Pays buckets.
  2807. func (c *BucketsGetIamPolicyCall) UserProject(userProject string) *BucketsGetIamPolicyCall {
  2808. c.urlParams_.Set("userProject", userProject)
  2809. return c
  2810. }
  2811. // Fields allows partial responses to be retrieved. See
  2812. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2813. // for more information.
  2814. func (c *BucketsGetIamPolicyCall) Fields(s ...googleapi.Field) *BucketsGetIamPolicyCall {
  2815. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2816. return c
  2817. }
  2818. // IfNoneMatch sets the optional parameter which makes the operation
  2819. // fail if the object's ETag matches the given value. This is useful for
  2820. // getting updates only after the object has changed since the last
  2821. // request. Use googleapi.IsNotModified to check whether the response
  2822. // error from Do is the result of In-None-Match.
  2823. func (c *BucketsGetIamPolicyCall) IfNoneMatch(entityTag string) *BucketsGetIamPolicyCall {
  2824. c.ifNoneMatch_ = entityTag
  2825. return c
  2826. }
  2827. // Context sets the context to be used in this call's Do method. Any
  2828. // pending HTTP request will be aborted if the provided context is
  2829. // canceled.
  2830. func (c *BucketsGetIamPolicyCall) Context(ctx context.Context) *BucketsGetIamPolicyCall {
  2831. c.ctx_ = ctx
  2832. return c
  2833. }
  2834. // Header returns an http.Header that can be modified by the caller to
  2835. // add HTTP headers to the request.
  2836. func (c *BucketsGetIamPolicyCall) Header() http.Header {
  2837. if c.header_ == nil {
  2838. c.header_ = make(http.Header)
  2839. }
  2840. return c.header_
  2841. }
  2842. func (c *BucketsGetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
  2843. reqHeaders := make(http.Header)
  2844. for k, v := range c.header_ {
  2845. reqHeaders[k] = v
  2846. }
  2847. reqHeaders.Set("User-Agent", c.s.userAgent())
  2848. if c.ifNoneMatch_ != "" {
  2849. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2850. }
  2851. var body io.Reader = nil
  2852. c.urlParams_.Set("alt", alt)
  2853. c.urlParams_.Set("prettyPrint", "false")
  2854. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/iam")
  2855. urls += "?" + c.urlParams_.Encode()
  2856. req, err := http.NewRequest("GET", urls, body)
  2857. if err != nil {
  2858. return nil, err
  2859. }
  2860. req.Header = reqHeaders
  2861. googleapi.Expand(req.URL, map[string]string{
  2862. "bucket": c.bucket,
  2863. })
  2864. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2865. }
  2866. // Do executes the "storage.buckets.getIamPolicy" call.
  2867. // Exactly one of *Policy or error will be non-nil. Any non-2xx status
  2868. // code is an error. Response headers are in either
  2869. // *Policy.ServerResponse.Header or (if a response was returned at all)
  2870. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2871. // check whether the returned error was because http.StatusNotModified
  2872. // was returned.
  2873. func (c *BucketsGetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) {
  2874. gensupport.SetOptions(c.urlParams_, opts...)
  2875. res, err := c.doRequest("json")
  2876. if res != nil && res.StatusCode == http.StatusNotModified {
  2877. if res.Body != nil {
  2878. res.Body.Close()
  2879. }
  2880. return nil, &googleapi.Error{
  2881. Code: res.StatusCode,
  2882. Header: res.Header,
  2883. }
  2884. }
  2885. if err != nil {
  2886. return nil, err
  2887. }
  2888. defer googleapi.CloseBody(res)
  2889. if err := googleapi.CheckResponse(res); err != nil {
  2890. return nil, err
  2891. }
  2892. ret := &Policy{
  2893. ServerResponse: googleapi.ServerResponse{
  2894. Header: res.Header,
  2895. HTTPStatusCode: res.StatusCode,
  2896. },
  2897. }
  2898. target := &ret
  2899. if err := gensupport.DecodeResponse(target, res); err != nil {
  2900. return nil, err
  2901. }
  2902. return ret, nil
  2903. // {
  2904. // "description": "Returns an IAM policy for the specified bucket.",
  2905. // "httpMethod": "GET",
  2906. // "id": "storage.buckets.getIamPolicy",
  2907. // "parameterOrder": [
  2908. // "bucket"
  2909. // ],
  2910. // "parameters": {
  2911. // "bucket": {
  2912. // "description": "Name of a bucket.",
  2913. // "location": "path",
  2914. // "required": true,
  2915. // "type": "string"
  2916. // },
  2917. // "userProject": {
  2918. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  2919. // "location": "query",
  2920. // "type": "string"
  2921. // }
  2922. // },
  2923. // "path": "b/{bucket}/iam",
  2924. // "response": {
  2925. // "$ref": "Policy"
  2926. // },
  2927. // "scopes": [
  2928. // "https://www.googleapis.com/auth/cloud-platform",
  2929. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  2930. // "https://www.googleapis.com/auth/devstorage.full_control",
  2931. // "https://www.googleapis.com/auth/devstorage.read_only",
  2932. // "https://www.googleapis.com/auth/devstorage.read_write"
  2933. // ]
  2934. // }
  2935. }
  2936. // method id "storage.buckets.insert":
  2937. type BucketsInsertCall struct {
  2938. s *Service
  2939. bucket *Bucket
  2940. urlParams_ gensupport.URLParams
  2941. ctx_ context.Context
  2942. header_ http.Header
  2943. }
  2944. // Insert: Creates a new bucket.
  2945. func (r *BucketsService) Insert(projectid string, bucket *Bucket) *BucketsInsertCall {
  2946. c := &BucketsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2947. c.urlParams_.Set("project", projectid)
  2948. c.bucket = bucket
  2949. return c
  2950. }
  2951. // PredefinedAcl sets the optional parameter "predefinedAcl": Apply a
  2952. // predefined set of access controls to this bucket.
  2953. //
  2954. // Possible values:
  2955. // "authenticatedRead" - Project team owners get OWNER access, and
  2956. // allAuthenticatedUsers get READER access.
  2957. // "private" - Project team owners get OWNER access.
  2958. // "projectPrivate" - Project team members get access according to
  2959. // their roles.
  2960. // "publicRead" - Project team owners get OWNER access, and allUsers
  2961. // get READER access.
  2962. // "publicReadWrite" - Project team owners get OWNER access, and
  2963. // allUsers get WRITER access.
  2964. func (c *BucketsInsertCall) PredefinedAcl(predefinedAcl string) *BucketsInsertCall {
  2965. c.urlParams_.Set("predefinedAcl", predefinedAcl)
  2966. return c
  2967. }
  2968. // PredefinedDefaultObjectAcl sets the optional parameter
  2969. // "predefinedDefaultObjectAcl": Apply a predefined set of default
  2970. // object access controls to this bucket.
  2971. //
  2972. // Possible values:
  2973. // "authenticatedRead" - Object owner gets OWNER access, and
  2974. // allAuthenticatedUsers get READER access.
  2975. // "bucketOwnerFullControl" - Object owner gets OWNER access, and
  2976. // project team owners get OWNER access.
  2977. // "bucketOwnerRead" - Object owner gets OWNER access, and project
  2978. // team owners get READER access.
  2979. // "private" - Object owner gets OWNER access.
  2980. // "projectPrivate" - Object owner gets OWNER access, and project team
  2981. // members get access according to their roles.
  2982. // "publicRead" - Object owner gets OWNER access, and allUsers get
  2983. // READER access.
  2984. func (c *BucketsInsertCall) PredefinedDefaultObjectAcl(predefinedDefaultObjectAcl string) *BucketsInsertCall {
  2985. c.urlParams_.Set("predefinedDefaultObjectAcl", predefinedDefaultObjectAcl)
  2986. return c
  2987. }
  2988. // Projection sets the optional parameter "projection": Set of
  2989. // properties to return. Defaults to noAcl, unless the bucket resource
  2990. // specifies acl or defaultObjectAcl properties, when it defaults to
  2991. // full.
  2992. //
  2993. // Possible values:
  2994. // "full" - Include all properties.
  2995. // "noAcl" - Omit owner, acl and defaultObjectAcl properties.
  2996. func (c *BucketsInsertCall) Projection(projection string) *BucketsInsertCall {
  2997. c.urlParams_.Set("projection", projection)
  2998. return c
  2999. }
  3000. // UserProject sets the optional parameter "userProject": The project to
  3001. // be billed for this request.
  3002. func (c *BucketsInsertCall) UserProject(userProject string) *BucketsInsertCall {
  3003. c.urlParams_.Set("userProject", userProject)
  3004. return c
  3005. }
  3006. // Fields allows partial responses to be retrieved. See
  3007. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3008. // for more information.
  3009. func (c *BucketsInsertCall) Fields(s ...googleapi.Field) *BucketsInsertCall {
  3010. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3011. return c
  3012. }
  3013. // Context sets the context to be used in this call's Do method. Any
  3014. // pending HTTP request will be aborted if the provided context is
  3015. // canceled.
  3016. func (c *BucketsInsertCall) Context(ctx context.Context) *BucketsInsertCall {
  3017. c.ctx_ = ctx
  3018. return c
  3019. }
  3020. // Header returns an http.Header that can be modified by the caller to
  3021. // add HTTP headers to the request.
  3022. func (c *BucketsInsertCall) Header() http.Header {
  3023. if c.header_ == nil {
  3024. c.header_ = make(http.Header)
  3025. }
  3026. return c.header_
  3027. }
  3028. func (c *BucketsInsertCall) doRequest(alt string) (*http.Response, error) {
  3029. reqHeaders := make(http.Header)
  3030. for k, v := range c.header_ {
  3031. reqHeaders[k] = v
  3032. }
  3033. reqHeaders.Set("User-Agent", c.s.userAgent())
  3034. var body io.Reader = nil
  3035. body, err := googleapi.WithoutDataWrapper.JSONReader(c.bucket)
  3036. if err != nil {
  3037. return nil, err
  3038. }
  3039. reqHeaders.Set("Content-Type", "application/json")
  3040. c.urlParams_.Set("alt", alt)
  3041. c.urlParams_.Set("prettyPrint", "false")
  3042. urls := googleapi.ResolveRelative(c.s.BasePath, "b")
  3043. urls += "?" + c.urlParams_.Encode()
  3044. req, err := http.NewRequest("POST", urls, body)
  3045. if err != nil {
  3046. return nil, err
  3047. }
  3048. req.Header = reqHeaders
  3049. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3050. }
  3051. // Do executes the "storage.buckets.insert" call.
  3052. // Exactly one of *Bucket or error will be non-nil. Any non-2xx status
  3053. // code is an error. Response headers are in either
  3054. // *Bucket.ServerResponse.Header or (if a response was returned at all)
  3055. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3056. // check whether the returned error was because http.StatusNotModified
  3057. // was returned.
  3058. func (c *BucketsInsertCall) Do(opts ...googleapi.CallOption) (*Bucket, error) {
  3059. gensupport.SetOptions(c.urlParams_, opts...)
  3060. res, err := c.doRequest("json")
  3061. if res != nil && res.StatusCode == http.StatusNotModified {
  3062. if res.Body != nil {
  3063. res.Body.Close()
  3064. }
  3065. return nil, &googleapi.Error{
  3066. Code: res.StatusCode,
  3067. Header: res.Header,
  3068. }
  3069. }
  3070. if err != nil {
  3071. return nil, err
  3072. }
  3073. defer googleapi.CloseBody(res)
  3074. if err := googleapi.CheckResponse(res); err != nil {
  3075. return nil, err
  3076. }
  3077. ret := &Bucket{
  3078. ServerResponse: googleapi.ServerResponse{
  3079. Header: res.Header,
  3080. HTTPStatusCode: res.StatusCode,
  3081. },
  3082. }
  3083. target := &ret
  3084. if err := gensupport.DecodeResponse(target, res); err != nil {
  3085. return nil, err
  3086. }
  3087. return ret, nil
  3088. // {
  3089. // "description": "Creates a new bucket.",
  3090. // "httpMethod": "POST",
  3091. // "id": "storage.buckets.insert",
  3092. // "parameterOrder": [
  3093. // "project"
  3094. // ],
  3095. // "parameters": {
  3096. // "predefinedAcl": {
  3097. // "description": "Apply a predefined set of access controls to this bucket.",
  3098. // "enum": [
  3099. // "authenticatedRead",
  3100. // "private",
  3101. // "projectPrivate",
  3102. // "publicRead",
  3103. // "publicReadWrite"
  3104. // ],
  3105. // "enumDescriptions": [
  3106. // "Project team owners get OWNER access, and allAuthenticatedUsers get READER access.",
  3107. // "Project team owners get OWNER access.",
  3108. // "Project team members get access according to their roles.",
  3109. // "Project team owners get OWNER access, and allUsers get READER access.",
  3110. // "Project team owners get OWNER access, and allUsers get WRITER access."
  3111. // ],
  3112. // "location": "query",
  3113. // "type": "string"
  3114. // },
  3115. // "predefinedDefaultObjectAcl": {
  3116. // "description": "Apply a predefined set of default object access controls to this bucket.",
  3117. // "enum": [
  3118. // "authenticatedRead",
  3119. // "bucketOwnerFullControl",
  3120. // "bucketOwnerRead",
  3121. // "private",
  3122. // "projectPrivate",
  3123. // "publicRead"
  3124. // ],
  3125. // "enumDescriptions": [
  3126. // "Object owner gets OWNER access, and allAuthenticatedUsers get READER access.",
  3127. // "Object owner gets OWNER access, and project team owners get OWNER access.",
  3128. // "Object owner gets OWNER access, and project team owners get READER access.",
  3129. // "Object owner gets OWNER access.",
  3130. // "Object owner gets OWNER access, and project team members get access according to their roles.",
  3131. // "Object owner gets OWNER access, and allUsers get READER access."
  3132. // ],
  3133. // "location": "query",
  3134. // "type": "string"
  3135. // },
  3136. // "project": {
  3137. // "description": "A valid API project identifier.",
  3138. // "location": "query",
  3139. // "required": true,
  3140. // "type": "string"
  3141. // },
  3142. // "projection": {
  3143. // "description": "Set of properties to return. Defaults to noAcl, unless the bucket resource specifies acl or defaultObjectAcl properties, when it defaults to full.",
  3144. // "enum": [
  3145. // "full",
  3146. // "noAcl"
  3147. // ],
  3148. // "enumDescriptions": [
  3149. // "Include all properties.",
  3150. // "Omit owner, acl and defaultObjectAcl properties."
  3151. // ],
  3152. // "location": "query",
  3153. // "type": "string"
  3154. // },
  3155. // "userProject": {
  3156. // "description": "The project to be billed for this request.",
  3157. // "location": "query",
  3158. // "type": "string"
  3159. // }
  3160. // },
  3161. // "path": "b",
  3162. // "request": {
  3163. // "$ref": "Bucket"
  3164. // },
  3165. // "response": {
  3166. // "$ref": "Bucket"
  3167. // },
  3168. // "scopes": [
  3169. // "https://www.googleapis.com/auth/cloud-platform",
  3170. // "https://www.googleapis.com/auth/devstorage.full_control",
  3171. // "https://www.googleapis.com/auth/devstorage.read_write"
  3172. // ]
  3173. // }
  3174. }
  3175. // method id "storage.buckets.list":
  3176. type BucketsListCall struct {
  3177. s *Service
  3178. urlParams_ gensupport.URLParams
  3179. ifNoneMatch_ string
  3180. ctx_ context.Context
  3181. header_ http.Header
  3182. }
  3183. // List: Retrieves a list of buckets for a given project.
  3184. func (r *BucketsService) List(projectid string) *BucketsListCall {
  3185. c := &BucketsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3186. c.urlParams_.Set("project", projectid)
  3187. return c
  3188. }
  3189. // MaxResults sets the optional parameter "maxResults": Maximum number
  3190. // of buckets to return in a single response. The service will use this
  3191. // parameter or 1,000 items, whichever is smaller.
  3192. func (c *BucketsListCall) MaxResults(maxResults int64) *BucketsListCall {
  3193. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  3194. return c
  3195. }
  3196. // PageToken sets the optional parameter "pageToken": A
  3197. // previously-returned page token representing part of the larger set of
  3198. // results to view.
  3199. func (c *BucketsListCall) PageToken(pageToken string) *BucketsListCall {
  3200. c.urlParams_.Set("pageToken", pageToken)
  3201. return c
  3202. }
  3203. // Prefix sets the optional parameter "prefix": Filter results to
  3204. // buckets whose names begin with this prefix.
  3205. func (c *BucketsListCall) Prefix(prefix string) *BucketsListCall {
  3206. c.urlParams_.Set("prefix", prefix)
  3207. return c
  3208. }
  3209. // Projection sets the optional parameter "projection": Set of
  3210. // properties to return. Defaults to noAcl.
  3211. //
  3212. // Possible values:
  3213. // "full" - Include all properties.
  3214. // "noAcl" - Omit owner, acl and defaultObjectAcl properties.
  3215. func (c *BucketsListCall) Projection(projection string) *BucketsListCall {
  3216. c.urlParams_.Set("projection", projection)
  3217. return c
  3218. }
  3219. // UserProject sets the optional parameter "userProject": The project to
  3220. // be billed for this request.
  3221. func (c *BucketsListCall) UserProject(userProject string) *BucketsListCall {
  3222. c.urlParams_.Set("userProject", userProject)
  3223. return c
  3224. }
  3225. // Fields allows partial responses to be retrieved. See
  3226. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3227. // for more information.
  3228. func (c *BucketsListCall) Fields(s ...googleapi.Field) *BucketsListCall {
  3229. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3230. return c
  3231. }
  3232. // IfNoneMatch sets the optional parameter which makes the operation
  3233. // fail if the object's ETag matches the given value. This is useful for
  3234. // getting updates only after the object has changed since the last
  3235. // request. Use googleapi.IsNotModified to check whether the response
  3236. // error from Do is the result of In-None-Match.
  3237. func (c *BucketsListCall) IfNoneMatch(entityTag string) *BucketsListCall {
  3238. c.ifNoneMatch_ = entityTag
  3239. return c
  3240. }
  3241. // Context sets the context to be used in this call's Do method. Any
  3242. // pending HTTP request will be aborted if the provided context is
  3243. // canceled.
  3244. func (c *BucketsListCall) Context(ctx context.Context) *BucketsListCall {
  3245. c.ctx_ = ctx
  3246. return c
  3247. }
  3248. // Header returns an http.Header that can be modified by the caller to
  3249. // add HTTP headers to the request.
  3250. func (c *BucketsListCall) Header() http.Header {
  3251. if c.header_ == nil {
  3252. c.header_ = make(http.Header)
  3253. }
  3254. return c.header_
  3255. }
  3256. func (c *BucketsListCall) doRequest(alt string) (*http.Response, error) {
  3257. reqHeaders := make(http.Header)
  3258. for k, v := range c.header_ {
  3259. reqHeaders[k] = v
  3260. }
  3261. reqHeaders.Set("User-Agent", c.s.userAgent())
  3262. if c.ifNoneMatch_ != "" {
  3263. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3264. }
  3265. var body io.Reader = nil
  3266. c.urlParams_.Set("alt", alt)
  3267. c.urlParams_.Set("prettyPrint", "false")
  3268. urls := googleapi.ResolveRelative(c.s.BasePath, "b")
  3269. urls += "?" + c.urlParams_.Encode()
  3270. req, err := http.NewRequest("GET", urls, body)
  3271. if err != nil {
  3272. return nil, err
  3273. }
  3274. req.Header = reqHeaders
  3275. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3276. }
  3277. // Do executes the "storage.buckets.list" call.
  3278. // Exactly one of *Buckets or error will be non-nil. Any non-2xx status
  3279. // code is an error. Response headers are in either
  3280. // *Buckets.ServerResponse.Header or (if a response was returned at all)
  3281. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3282. // check whether the returned error was because http.StatusNotModified
  3283. // was returned.
  3284. func (c *BucketsListCall) Do(opts ...googleapi.CallOption) (*Buckets, error) {
  3285. gensupport.SetOptions(c.urlParams_, opts...)
  3286. res, err := c.doRequest("json")
  3287. if res != nil && res.StatusCode == http.StatusNotModified {
  3288. if res.Body != nil {
  3289. res.Body.Close()
  3290. }
  3291. return nil, &googleapi.Error{
  3292. Code: res.StatusCode,
  3293. Header: res.Header,
  3294. }
  3295. }
  3296. if err != nil {
  3297. return nil, err
  3298. }
  3299. defer googleapi.CloseBody(res)
  3300. if err := googleapi.CheckResponse(res); err != nil {
  3301. return nil, err
  3302. }
  3303. ret := &Buckets{
  3304. ServerResponse: googleapi.ServerResponse{
  3305. Header: res.Header,
  3306. HTTPStatusCode: res.StatusCode,
  3307. },
  3308. }
  3309. target := &ret
  3310. if err := gensupport.DecodeResponse(target, res); err != nil {
  3311. return nil, err
  3312. }
  3313. return ret, nil
  3314. // {
  3315. // "description": "Retrieves a list of buckets for a given project.",
  3316. // "httpMethod": "GET",
  3317. // "id": "storage.buckets.list",
  3318. // "parameterOrder": [
  3319. // "project"
  3320. // ],
  3321. // "parameters": {
  3322. // "maxResults": {
  3323. // "default": "1000",
  3324. // "description": "Maximum number of buckets to return in a single response. The service will use this parameter or 1,000 items, whichever is smaller.",
  3325. // "format": "uint32",
  3326. // "location": "query",
  3327. // "minimum": "0",
  3328. // "type": "integer"
  3329. // },
  3330. // "pageToken": {
  3331. // "description": "A previously-returned page token representing part of the larger set of results to view.",
  3332. // "location": "query",
  3333. // "type": "string"
  3334. // },
  3335. // "prefix": {
  3336. // "description": "Filter results to buckets whose names begin with this prefix.",
  3337. // "location": "query",
  3338. // "type": "string"
  3339. // },
  3340. // "project": {
  3341. // "description": "A valid API project identifier.",
  3342. // "location": "query",
  3343. // "required": true,
  3344. // "type": "string"
  3345. // },
  3346. // "projection": {
  3347. // "description": "Set of properties to return. Defaults to noAcl.",
  3348. // "enum": [
  3349. // "full",
  3350. // "noAcl"
  3351. // ],
  3352. // "enumDescriptions": [
  3353. // "Include all properties.",
  3354. // "Omit owner, acl and defaultObjectAcl properties."
  3355. // ],
  3356. // "location": "query",
  3357. // "type": "string"
  3358. // },
  3359. // "userProject": {
  3360. // "description": "The project to be billed for this request.",
  3361. // "location": "query",
  3362. // "type": "string"
  3363. // }
  3364. // },
  3365. // "path": "b",
  3366. // "response": {
  3367. // "$ref": "Buckets"
  3368. // },
  3369. // "scopes": [
  3370. // "https://www.googleapis.com/auth/cloud-platform",
  3371. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  3372. // "https://www.googleapis.com/auth/devstorage.full_control",
  3373. // "https://www.googleapis.com/auth/devstorage.read_only",
  3374. // "https://www.googleapis.com/auth/devstorage.read_write"
  3375. // ]
  3376. // }
  3377. }
  3378. // Pages invokes f for each page of results.
  3379. // A non-nil error returned from f will halt the iteration.
  3380. // The provided context supersedes any context provided to the Context method.
  3381. func (c *BucketsListCall) Pages(ctx context.Context, f func(*Buckets) error) error {
  3382. c.ctx_ = ctx
  3383. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  3384. for {
  3385. x, err := c.Do()
  3386. if err != nil {
  3387. return err
  3388. }
  3389. if err := f(x); err != nil {
  3390. return err
  3391. }
  3392. if x.NextPageToken == "" {
  3393. return nil
  3394. }
  3395. c.PageToken(x.NextPageToken)
  3396. }
  3397. }
  3398. // method id "storage.buckets.lockRetentionPolicy":
  3399. type BucketsLockRetentionPolicyCall struct {
  3400. s *Service
  3401. bucket string
  3402. urlParams_ gensupport.URLParams
  3403. ctx_ context.Context
  3404. header_ http.Header
  3405. }
  3406. // LockRetentionPolicy: Locks retention policy on a bucket.
  3407. func (r *BucketsService) LockRetentionPolicy(bucket string, ifMetagenerationMatch int64) *BucketsLockRetentionPolicyCall {
  3408. c := &BucketsLockRetentionPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3409. c.bucket = bucket
  3410. c.urlParams_.Set("ifMetagenerationMatch", fmt.Sprint(ifMetagenerationMatch))
  3411. return c
  3412. }
  3413. // UserProject sets the optional parameter "userProject": The project to
  3414. // be billed for this request. Required for Requester Pays buckets.
  3415. func (c *BucketsLockRetentionPolicyCall) UserProject(userProject string) *BucketsLockRetentionPolicyCall {
  3416. c.urlParams_.Set("userProject", userProject)
  3417. return c
  3418. }
  3419. // Fields allows partial responses to be retrieved. See
  3420. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3421. // for more information.
  3422. func (c *BucketsLockRetentionPolicyCall) Fields(s ...googleapi.Field) *BucketsLockRetentionPolicyCall {
  3423. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3424. return c
  3425. }
  3426. // Context sets the context to be used in this call's Do method. Any
  3427. // pending HTTP request will be aborted if the provided context is
  3428. // canceled.
  3429. func (c *BucketsLockRetentionPolicyCall) Context(ctx context.Context) *BucketsLockRetentionPolicyCall {
  3430. c.ctx_ = ctx
  3431. return c
  3432. }
  3433. // Header returns an http.Header that can be modified by the caller to
  3434. // add HTTP headers to the request.
  3435. func (c *BucketsLockRetentionPolicyCall) Header() http.Header {
  3436. if c.header_ == nil {
  3437. c.header_ = make(http.Header)
  3438. }
  3439. return c.header_
  3440. }
  3441. func (c *BucketsLockRetentionPolicyCall) doRequest(alt string) (*http.Response, error) {
  3442. reqHeaders := make(http.Header)
  3443. for k, v := range c.header_ {
  3444. reqHeaders[k] = v
  3445. }
  3446. reqHeaders.Set("User-Agent", c.s.userAgent())
  3447. var body io.Reader = nil
  3448. c.urlParams_.Set("alt", alt)
  3449. c.urlParams_.Set("prettyPrint", "false")
  3450. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/lockRetentionPolicy")
  3451. urls += "?" + c.urlParams_.Encode()
  3452. req, err := http.NewRequest("POST", urls, body)
  3453. if err != nil {
  3454. return nil, err
  3455. }
  3456. req.Header = reqHeaders
  3457. googleapi.Expand(req.URL, map[string]string{
  3458. "bucket": c.bucket,
  3459. })
  3460. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3461. }
  3462. // Do executes the "storage.buckets.lockRetentionPolicy" call.
  3463. // Exactly one of *Bucket or error will be non-nil. Any non-2xx status
  3464. // code is an error. Response headers are in either
  3465. // *Bucket.ServerResponse.Header or (if a response was returned at all)
  3466. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3467. // check whether the returned error was because http.StatusNotModified
  3468. // was returned.
  3469. func (c *BucketsLockRetentionPolicyCall) Do(opts ...googleapi.CallOption) (*Bucket, error) {
  3470. gensupport.SetOptions(c.urlParams_, opts...)
  3471. res, err := c.doRequest("json")
  3472. if res != nil && res.StatusCode == http.StatusNotModified {
  3473. if res.Body != nil {
  3474. res.Body.Close()
  3475. }
  3476. return nil, &googleapi.Error{
  3477. Code: res.StatusCode,
  3478. Header: res.Header,
  3479. }
  3480. }
  3481. if err != nil {
  3482. return nil, err
  3483. }
  3484. defer googleapi.CloseBody(res)
  3485. if err := googleapi.CheckResponse(res); err != nil {
  3486. return nil, err
  3487. }
  3488. ret := &Bucket{
  3489. ServerResponse: googleapi.ServerResponse{
  3490. Header: res.Header,
  3491. HTTPStatusCode: res.StatusCode,
  3492. },
  3493. }
  3494. target := &ret
  3495. if err := gensupport.DecodeResponse(target, res); err != nil {
  3496. return nil, err
  3497. }
  3498. return ret, nil
  3499. // {
  3500. // "description": "Locks retention policy on a bucket.",
  3501. // "httpMethod": "POST",
  3502. // "id": "storage.buckets.lockRetentionPolicy",
  3503. // "parameterOrder": [
  3504. // "bucket",
  3505. // "ifMetagenerationMatch"
  3506. // ],
  3507. // "parameters": {
  3508. // "bucket": {
  3509. // "description": "Name of a bucket.",
  3510. // "location": "path",
  3511. // "required": true,
  3512. // "type": "string"
  3513. // },
  3514. // "ifMetagenerationMatch": {
  3515. // "description": "Makes the operation conditional on whether bucket's current metageneration matches the given value.",
  3516. // "format": "int64",
  3517. // "location": "query",
  3518. // "required": true,
  3519. // "type": "string"
  3520. // },
  3521. // "userProject": {
  3522. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  3523. // "location": "query",
  3524. // "type": "string"
  3525. // }
  3526. // },
  3527. // "path": "b/{bucket}/lockRetentionPolicy",
  3528. // "response": {
  3529. // "$ref": "Bucket"
  3530. // },
  3531. // "scopes": [
  3532. // "https://www.googleapis.com/auth/cloud-platform",
  3533. // "https://www.googleapis.com/auth/devstorage.full_control",
  3534. // "https://www.googleapis.com/auth/devstorage.read_write"
  3535. // ]
  3536. // }
  3537. }
  3538. // method id "storage.buckets.patch":
  3539. type BucketsPatchCall struct {
  3540. s *Service
  3541. bucket string
  3542. bucket2 *Bucket
  3543. urlParams_ gensupport.URLParams
  3544. ctx_ context.Context
  3545. header_ http.Header
  3546. }
  3547. // Patch: Patches a bucket. Changes to the bucket will be readable
  3548. // immediately after writing, but configuration changes may take time to
  3549. // propagate.
  3550. func (r *BucketsService) Patch(bucket string, bucket2 *Bucket) *BucketsPatchCall {
  3551. c := &BucketsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3552. c.bucket = bucket
  3553. c.bucket2 = bucket2
  3554. return c
  3555. }
  3556. // IfMetagenerationMatch sets the optional parameter
  3557. // "ifMetagenerationMatch": Makes the return of the bucket metadata
  3558. // conditional on whether the bucket's current metageneration matches
  3559. // the given value.
  3560. func (c *BucketsPatchCall) IfMetagenerationMatch(ifMetagenerationMatch int64) *BucketsPatchCall {
  3561. c.urlParams_.Set("ifMetagenerationMatch", fmt.Sprint(ifMetagenerationMatch))
  3562. return c
  3563. }
  3564. // IfMetagenerationNotMatch sets the optional parameter
  3565. // "ifMetagenerationNotMatch": Makes the return of the bucket metadata
  3566. // conditional on whether the bucket's current metageneration does not
  3567. // match the given value.
  3568. func (c *BucketsPatchCall) IfMetagenerationNotMatch(ifMetagenerationNotMatch int64) *BucketsPatchCall {
  3569. c.urlParams_.Set("ifMetagenerationNotMatch", fmt.Sprint(ifMetagenerationNotMatch))
  3570. return c
  3571. }
  3572. // PredefinedAcl sets the optional parameter "predefinedAcl": Apply a
  3573. // predefined set of access controls to this bucket.
  3574. //
  3575. // Possible values:
  3576. // "authenticatedRead" - Project team owners get OWNER access, and
  3577. // allAuthenticatedUsers get READER access.
  3578. // "private" - Project team owners get OWNER access.
  3579. // "projectPrivate" - Project team members get access according to
  3580. // their roles.
  3581. // "publicRead" - Project team owners get OWNER access, and allUsers
  3582. // get READER access.
  3583. // "publicReadWrite" - Project team owners get OWNER access, and
  3584. // allUsers get WRITER access.
  3585. func (c *BucketsPatchCall) PredefinedAcl(predefinedAcl string) *BucketsPatchCall {
  3586. c.urlParams_.Set("predefinedAcl", predefinedAcl)
  3587. return c
  3588. }
  3589. // PredefinedDefaultObjectAcl sets the optional parameter
  3590. // "predefinedDefaultObjectAcl": Apply a predefined set of default
  3591. // object access controls to this bucket.
  3592. //
  3593. // Possible values:
  3594. // "authenticatedRead" - Object owner gets OWNER access, and
  3595. // allAuthenticatedUsers get READER access.
  3596. // "bucketOwnerFullControl" - Object owner gets OWNER access, and
  3597. // project team owners get OWNER access.
  3598. // "bucketOwnerRead" - Object owner gets OWNER access, and project
  3599. // team owners get READER access.
  3600. // "private" - Object owner gets OWNER access.
  3601. // "projectPrivate" - Object owner gets OWNER access, and project team
  3602. // members get access according to their roles.
  3603. // "publicRead" - Object owner gets OWNER access, and allUsers get
  3604. // READER access.
  3605. func (c *BucketsPatchCall) PredefinedDefaultObjectAcl(predefinedDefaultObjectAcl string) *BucketsPatchCall {
  3606. c.urlParams_.Set("predefinedDefaultObjectAcl", predefinedDefaultObjectAcl)
  3607. return c
  3608. }
  3609. // Projection sets the optional parameter "projection": Set of
  3610. // properties to return. Defaults to full.
  3611. //
  3612. // Possible values:
  3613. // "full" - Include all properties.
  3614. // "noAcl" - Omit owner, acl and defaultObjectAcl properties.
  3615. func (c *BucketsPatchCall) Projection(projection string) *BucketsPatchCall {
  3616. c.urlParams_.Set("projection", projection)
  3617. return c
  3618. }
  3619. // UserProject sets the optional parameter "userProject": The project to
  3620. // be billed for this request. Required for Requester Pays buckets.
  3621. func (c *BucketsPatchCall) UserProject(userProject string) *BucketsPatchCall {
  3622. c.urlParams_.Set("userProject", userProject)
  3623. return c
  3624. }
  3625. // Fields allows partial responses to be retrieved. See
  3626. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3627. // for more information.
  3628. func (c *BucketsPatchCall) Fields(s ...googleapi.Field) *BucketsPatchCall {
  3629. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3630. return c
  3631. }
  3632. // Context sets the context to be used in this call's Do method. Any
  3633. // pending HTTP request will be aborted if the provided context is
  3634. // canceled.
  3635. func (c *BucketsPatchCall) Context(ctx context.Context) *BucketsPatchCall {
  3636. c.ctx_ = ctx
  3637. return c
  3638. }
  3639. // Header returns an http.Header that can be modified by the caller to
  3640. // add HTTP headers to the request.
  3641. func (c *BucketsPatchCall) Header() http.Header {
  3642. if c.header_ == nil {
  3643. c.header_ = make(http.Header)
  3644. }
  3645. return c.header_
  3646. }
  3647. func (c *BucketsPatchCall) doRequest(alt string) (*http.Response, error) {
  3648. reqHeaders := make(http.Header)
  3649. for k, v := range c.header_ {
  3650. reqHeaders[k] = v
  3651. }
  3652. reqHeaders.Set("User-Agent", c.s.userAgent())
  3653. var body io.Reader = nil
  3654. body, err := googleapi.WithoutDataWrapper.JSONReader(c.bucket2)
  3655. if err != nil {
  3656. return nil, err
  3657. }
  3658. reqHeaders.Set("Content-Type", "application/json")
  3659. c.urlParams_.Set("alt", alt)
  3660. c.urlParams_.Set("prettyPrint", "false")
  3661. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}")
  3662. urls += "?" + c.urlParams_.Encode()
  3663. req, err := http.NewRequest("PATCH", urls, body)
  3664. if err != nil {
  3665. return nil, err
  3666. }
  3667. req.Header = reqHeaders
  3668. googleapi.Expand(req.URL, map[string]string{
  3669. "bucket": c.bucket,
  3670. })
  3671. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3672. }
  3673. // Do executes the "storage.buckets.patch" call.
  3674. // Exactly one of *Bucket or error will be non-nil. Any non-2xx status
  3675. // code is an error. Response headers are in either
  3676. // *Bucket.ServerResponse.Header or (if a response was returned at all)
  3677. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3678. // check whether the returned error was because http.StatusNotModified
  3679. // was returned.
  3680. func (c *BucketsPatchCall) Do(opts ...googleapi.CallOption) (*Bucket, error) {
  3681. gensupport.SetOptions(c.urlParams_, opts...)
  3682. res, err := c.doRequest("json")
  3683. if res != nil && res.StatusCode == http.StatusNotModified {
  3684. if res.Body != nil {
  3685. res.Body.Close()
  3686. }
  3687. return nil, &googleapi.Error{
  3688. Code: res.StatusCode,
  3689. Header: res.Header,
  3690. }
  3691. }
  3692. if err != nil {
  3693. return nil, err
  3694. }
  3695. defer googleapi.CloseBody(res)
  3696. if err := googleapi.CheckResponse(res); err != nil {
  3697. return nil, err
  3698. }
  3699. ret := &Bucket{
  3700. ServerResponse: googleapi.ServerResponse{
  3701. Header: res.Header,
  3702. HTTPStatusCode: res.StatusCode,
  3703. },
  3704. }
  3705. target := &ret
  3706. if err := gensupport.DecodeResponse(target, res); err != nil {
  3707. return nil, err
  3708. }
  3709. return ret, nil
  3710. // {
  3711. // "description": "Patches a bucket. Changes to the bucket will be readable immediately after writing, but configuration changes may take time to propagate.",
  3712. // "httpMethod": "PATCH",
  3713. // "id": "storage.buckets.patch",
  3714. // "parameterOrder": [
  3715. // "bucket"
  3716. // ],
  3717. // "parameters": {
  3718. // "bucket": {
  3719. // "description": "Name of a bucket.",
  3720. // "location": "path",
  3721. // "required": true,
  3722. // "type": "string"
  3723. // },
  3724. // "ifMetagenerationMatch": {
  3725. // "description": "Makes the return of the bucket metadata conditional on whether the bucket's current metageneration matches the given value.",
  3726. // "format": "int64",
  3727. // "location": "query",
  3728. // "type": "string"
  3729. // },
  3730. // "ifMetagenerationNotMatch": {
  3731. // "description": "Makes the return of the bucket metadata conditional on whether the bucket's current metageneration does not match the given value.",
  3732. // "format": "int64",
  3733. // "location": "query",
  3734. // "type": "string"
  3735. // },
  3736. // "predefinedAcl": {
  3737. // "description": "Apply a predefined set of access controls to this bucket.",
  3738. // "enum": [
  3739. // "authenticatedRead",
  3740. // "private",
  3741. // "projectPrivate",
  3742. // "publicRead",
  3743. // "publicReadWrite"
  3744. // ],
  3745. // "enumDescriptions": [
  3746. // "Project team owners get OWNER access, and allAuthenticatedUsers get READER access.",
  3747. // "Project team owners get OWNER access.",
  3748. // "Project team members get access according to their roles.",
  3749. // "Project team owners get OWNER access, and allUsers get READER access.",
  3750. // "Project team owners get OWNER access, and allUsers get WRITER access."
  3751. // ],
  3752. // "location": "query",
  3753. // "type": "string"
  3754. // },
  3755. // "predefinedDefaultObjectAcl": {
  3756. // "description": "Apply a predefined set of default object access controls to this bucket.",
  3757. // "enum": [
  3758. // "authenticatedRead",
  3759. // "bucketOwnerFullControl",
  3760. // "bucketOwnerRead",
  3761. // "private",
  3762. // "projectPrivate",
  3763. // "publicRead"
  3764. // ],
  3765. // "enumDescriptions": [
  3766. // "Object owner gets OWNER access, and allAuthenticatedUsers get READER access.",
  3767. // "Object owner gets OWNER access, and project team owners get OWNER access.",
  3768. // "Object owner gets OWNER access, and project team owners get READER access.",
  3769. // "Object owner gets OWNER access.",
  3770. // "Object owner gets OWNER access, and project team members get access according to their roles.",
  3771. // "Object owner gets OWNER access, and allUsers get READER access."
  3772. // ],
  3773. // "location": "query",
  3774. // "type": "string"
  3775. // },
  3776. // "projection": {
  3777. // "description": "Set of properties to return. Defaults to full.",
  3778. // "enum": [
  3779. // "full",
  3780. // "noAcl"
  3781. // ],
  3782. // "enumDescriptions": [
  3783. // "Include all properties.",
  3784. // "Omit owner, acl and defaultObjectAcl properties."
  3785. // ],
  3786. // "location": "query",
  3787. // "type": "string"
  3788. // },
  3789. // "userProject": {
  3790. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  3791. // "location": "query",
  3792. // "type": "string"
  3793. // }
  3794. // },
  3795. // "path": "b/{bucket}",
  3796. // "request": {
  3797. // "$ref": "Bucket"
  3798. // },
  3799. // "response": {
  3800. // "$ref": "Bucket"
  3801. // },
  3802. // "scopes": [
  3803. // "https://www.googleapis.com/auth/cloud-platform",
  3804. // "https://www.googleapis.com/auth/devstorage.full_control"
  3805. // ]
  3806. // }
  3807. }
  3808. // method id "storage.buckets.setIamPolicy":
  3809. type BucketsSetIamPolicyCall struct {
  3810. s *Service
  3811. bucket string
  3812. policy *Policy
  3813. urlParams_ gensupport.URLParams
  3814. ctx_ context.Context
  3815. header_ http.Header
  3816. }
  3817. // SetIamPolicy: Updates an IAM policy for the specified bucket.
  3818. func (r *BucketsService) SetIamPolicy(bucket string, policy *Policy) *BucketsSetIamPolicyCall {
  3819. c := &BucketsSetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3820. c.bucket = bucket
  3821. c.policy = policy
  3822. return c
  3823. }
  3824. // UserProject sets the optional parameter "userProject": The project to
  3825. // be billed for this request. Required for Requester Pays buckets.
  3826. func (c *BucketsSetIamPolicyCall) UserProject(userProject string) *BucketsSetIamPolicyCall {
  3827. c.urlParams_.Set("userProject", userProject)
  3828. return c
  3829. }
  3830. // Fields allows partial responses to be retrieved. See
  3831. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3832. // for more information.
  3833. func (c *BucketsSetIamPolicyCall) Fields(s ...googleapi.Field) *BucketsSetIamPolicyCall {
  3834. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3835. return c
  3836. }
  3837. // Context sets the context to be used in this call's Do method. Any
  3838. // pending HTTP request will be aborted if the provided context is
  3839. // canceled.
  3840. func (c *BucketsSetIamPolicyCall) Context(ctx context.Context) *BucketsSetIamPolicyCall {
  3841. c.ctx_ = ctx
  3842. return c
  3843. }
  3844. // Header returns an http.Header that can be modified by the caller to
  3845. // add HTTP headers to the request.
  3846. func (c *BucketsSetIamPolicyCall) Header() http.Header {
  3847. if c.header_ == nil {
  3848. c.header_ = make(http.Header)
  3849. }
  3850. return c.header_
  3851. }
  3852. func (c *BucketsSetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
  3853. reqHeaders := make(http.Header)
  3854. for k, v := range c.header_ {
  3855. reqHeaders[k] = v
  3856. }
  3857. reqHeaders.Set("User-Agent", c.s.userAgent())
  3858. var body io.Reader = nil
  3859. body, err := googleapi.WithoutDataWrapper.JSONReader(c.policy)
  3860. if err != nil {
  3861. return nil, err
  3862. }
  3863. reqHeaders.Set("Content-Type", "application/json")
  3864. c.urlParams_.Set("alt", alt)
  3865. c.urlParams_.Set("prettyPrint", "false")
  3866. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/iam")
  3867. urls += "?" + c.urlParams_.Encode()
  3868. req, err := http.NewRequest("PUT", urls, body)
  3869. if err != nil {
  3870. return nil, err
  3871. }
  3872. req.Header = reqHeaders
  3873. googleapi.Expand(req.URL, map[string]string{
  3874. "bucket": c.bucket,
  3875. })
  3876. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3877. }
  3878. // Do executes the "storage.buckets.setIamPolicy" call.
  3879. // Exactly one of *Policy or error will be non-nil. Any non-2xx status
  3880. // code is an error. Response headers are in either
  3881. // *Policy.ServerResponse.Header or (if a response was returned at all)
  3882. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3883. // check whether the returned error was because http.StatusNotModified
  3884. // was returned.
  3885. func (c *BucketsSetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) {
  3886. gensupport.SetOptions(c.urlParams_, opts...)
  3887. res, err := c.doRequest("json")
  3888. if res != nil && res.StatusCode == http.StatusNotModified {
  3889. if res.Body != nil {
  3890. res.Body.Close()
  3891. }
  3892. return nil, &googleapi.Error{
  3893. Code: res.StatusCode,
  3894. Header: res.Header,
  3895. }
  3896. }
  3897. if err != nil {
  3898. return nil, err
  3899. }
  3900. defer googleapi.CloseBody(res)
  3901. if err := googleapi.CheckResponse(res); err != nil {
  3902. return nil, err
  3903. }
  3904. ret := &Policy{
  3905. ServerResponse: googleapi.ServerResponse{
  3906. Header: res.Header,
  3907. HTTPStatusCode: res.StatusCode,
  3908. },
  3909. }
  3910. target := &ret
  3911. if err := gensupport.DecodeResponse(target, res); err != nil {
  3912. return nil, err
  3913. }
  3914. return ret, nil
  3915. // {
  3916. // "description": "Updates an IAM policy for the specified bucket.",
  3917. // "httpMethod": "PUT",
  3918. // "id": "storage.buckets.setIamPolicy",
  3919. // "parameterOrder": [
  3920. // "bucket"
  3921. // ],
  3922. // "parameters": {
  3923. // "bucket": {
  3924. // "description": "Name of a bucket.",
  3925. // "location": "path",
  3926. // "required": true,
  3927. // "type": "string"
  3928. // },
  3929. // "userProject": {
  3930. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  3931. // "location": "query",
  3932. // "type": "string"
  3933. // }
  3934. // },
  3935. // "path": "b/{bucket}/iam",
  3936. // "request": {
  3937. // "$ref": "Policy"
  3938. // },
  3939. // "response": {
  3940. // "$ref": "Policy"
  3941. // },
  3942. // "scopes": [
  3943. // "https://www.googleapis.com/auth/cloud-platform",
  3944. // "https://www.googleapis.com/auth/devstorage.full_control",
  3945. // "https://www.googleapis.com/auth/devstorage.read_write"
  3946. // ]
  3947. // }
  3948. }
  3949. // method id "storage.buckets.testIamPermissions":
  3950. type BucketsTestIamPermissionsCall struct {
  3951. s *Service
  3952. bucket string
  3953. urlParams_ gensupport.URLParams
  3954. ifNoneMatch_ string
  3955. ctx_ context.Context
  3956. header_ http.Header
  3957. }
  3958. // TestIamPermissions: Tests a set of permissions on the given bucket to
  3959. // see which, if any, are held by the caller.
  3960. func (r *BucketsService) TestIamPermissions(bucket string, permissions []string) *BucketsTestIamPermissionsCall {
  3961. c := &BucketsTestIamPermissionsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3962. c.bucket = bucket
  3963. c.urlParams_.SetMulti("permissions", append([]string{}, permissions...))
  3964. return c
  3965. }
  3966. // UserProject sets the optional parameter "userProject": The project to
  3967. // be billed for this request. Required for Requester Pays buckets.
  3968. func (c *BucketsTestIamPermissionsCall) UserProject(userProject string) *BucketsTestIamPermissionsCall {
  3969. c.urlParams_.Set("userProject", userProject)
  3970. return c
  3971. }
  3972. // Fields allows partial responses to be retrieved. See
  3973. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3974. // for more information.
  3975. func (c *BucketsTestIamPermissionsCall) Fields(s ...googleapi.Field) *BucketsTestIamPermissionsCall {
  3976. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3977. return c
  3978. }
  3979. // IfNoneMatch sets the optional parameter which makes the operation
  3980. // fail if the object's ETag matches the given value. This is useful for
  3981. // getting updates only after the object has changed since the last
  3982. // request. Use googleapi.IsNotModified to check whether the response
  3983. // error from Do is the result of In-None-Match.
  3984. func (c *BucketsTestIamPermissionsCall) IfNoneMatch(entityTag string) *BucketsTestIamPermissionsCall {
  3985. c.ifNoneMatch_ = entityTag
  3986. return c
  3987. }
  3988. // Context sets the context to be used in this call's Do method. Any
  3989. // pending HTTP request will be aborted if the provided context is
  3990. // canceled.
  3991. func (c *BucketsTestIamPermissionsCall) Context(ctx context.Context) *BucketsTestIamPermissionsCall {
  3992. c.ctx_ = ctx
  3993. return c
  3994. }
  3995. // Header returns an http.Header that can be modified by the caller to
  3996. // add HTTP headers to the request.
  3997. func (c *BucketsTestIamPermissionsCall) Header() http.Header {
  3998. if c.header_ == nil {
  3999. c.header_ = make(http.Header)
  4000. }
  4001. return c.header_
  4002. }
  4003. func (c *BucketsTestIamPermissionsCall) doRequest(alt string) (*http.Response, error) {
  4004. reqHeaders := make(http.Header)
  4005. for k, v := range c.header_ {
  4006. reqHeaders[k] = v
  4007. }
  4008. reqHeaders.Set("User-Agent", c.s.userAgent())
  4009. if c.ifNoneMatch_ != "" {
  4010. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  4011. }
  4012. var body io.Reader = nil
  4013. c.urlParams_.Set("alt", alt)
  4014. c.urlParams_.Set("prettyPrint", "false")
  4015. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/iam/testPermissions")
  4016. urls += "?" + c.urlParams_.Encode()
  4017. req, err := http.NewRequest("GET", urls, body)
  4018. if err != nil {
  4019. return nil, err
  4020. }
  4021. req.Header = reqHeaders
  4022. googleapi.Expand(req.URL, map[string]string{
  4023. "bucket": c.bucket,
  4024. })
  4025. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4026. }
  4027. // Do executes the "storage.buckets.testIamPermissions" call.
  4028. // Exactly one of *TestIamPermissionsResponse or error will be non-nil.
  4029. // Any non-2xx status code is an error. Response headers are in either
  4030. // *TestIamPermissionsResponse.ServerResponse.Header or (if a response
  4031. // was returned at all) in error.(*googleapi.Error).Header. Use
  4032. // googleapi.IsNotModified to check whether the returned error was
  4033. // because http.StatusNotModified was returned.
  4034. func (c *BucketsTestIamPermissionsCall) Do(opts ...googleapi.CallOption) (*TestIamPermissionsResponse, error) {
  4035. gensupport.SetOptions(c.urlParams_, opts...)
  4036. res, err := c.doRequest("json")
  4037. if res != nil && res.StatusCode == http.StatusNotModified {
  4038. if res.Body != nil {
  4039. res.Body.Close()
  4040. }
  4041. return nil, &googleapi.Error{
  4042. Code: res.StatusCode,
  4043. Header: res.Header,
  4044. }
  4045. }
  4046. if err != nil {
  4047. return nil, err
  4048. }
  4049. defer googleapi.CloseBody(res)
  4050. if err := googleapi.CheckResponse(res); err != nil {
  4051. return nil, err
  4052. }
  4053. ret := &TestIamPermissionsResponse{
  4054. ServerResponse: googleapi.ServerResponse{
  4055. Header: res.Header,
  4056. HTTPStatusCode: res.StatusCode,
  4057. },
  4058. }
  4059. target := &ret
  4060. if err := gensupport.DecodeResponse(target, res); err != nil {
  4061. return nil, err
  4062. }
  4063. return ret, nil
  4064. // {
  4065. // "description": "Tests a set of permissions on the given bucket to see which, if any, are held by the caller.",
  4066. // "httpMethod": "GET",
  4067. // "id": "storage.buckets.testIamPermissions",
  4068. // "parameterOrder": [
  4069. // "bucket",
  4070. // "permissions"
  4071. // ],
  4072. // "parameters": {
  4073. // "bucket": {
  4074. // "description": "Name of a bucket.",
  4075. // "location": "path",
  4076. // "required": true,
  4077. // "type": "string"
  4078. // },
  4079. // "permissions": {
  4080. // "description": "Permissions to test.",
  4081. // "location": "query",
  4082. // "repeated": true,
  4083. // "required": true,
  4084. // "type": "string"
  4085. // },
  4086. // "userProject": {
  4087. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  4088. // "location": "query",
  4089. // "type": "string"
  4090. // }
  4091. // },
  4092. // "path": "b/{bucket}/iam/testPermissions",
  4093. // "response": {
  4094. // "$ref": "TestIamPermissionsResponse"
  4095. // },
  4096. // "scopes": [
  4097. // "https://www.googleapis.com/auth/cloud-platform",
  4098. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  4099. // "https://www.googleapis.com/auth/devstorage.full_control",
  4100. // "https://www.googleapis.com/auth/devstorage.read_only",
  4101. // "https://www.googleapis.com/auth/devstorage.read_write"
  4102. // ]
  4103. // }
  4104. }
  4105. // method id "storage.buckets.update":
  4106. type BucketsUpdateCall struct {
  4107. s *Service
  4108. bucket string
  4109. bucket2 *Bucket
  4110. urlParams_ gensupport.URLParams
  4111. ctx_ context.Context
  4112. header_ http.Header
  4113. }
  4114. // Update: Updates a bucket. Changes to the bucket will be readable
  4115. // immediately after writing, but configuration changes may take time to
  4116. // propagate.
  4117. func (r *BucketsService) Update(bucket string, bucket2 *Bucket) *BucketsUpdateCall {
  4118. c := &BucketsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4119. c.bucket = bucket
  4120. c.bucket2 = bucket2
  4121. return c
  4122. }
  4123. // IfMetagenerationMatch sets the optional parameter
  4124. // "ifMetagenerationMatch": Makes the return of the bucket metadata
  4125. // conditional on whether the bucket's current metageneration matches
  4126. // the given value.
  4127. func (c *BucketsUpdateCall) IfMetagenerationMatch(ifMetagenerationMatch int64) *BucketsUpdateCall {
  4128. c.urlParams_.Set("ifMetagenerationMatch", fmt.Sprint(ifMetagenerationMatch))
  4129. return c
  4130. }
  4131. // IfMetagenerationNotMatch sets the optional parameter
  4132. // "ifMetagenerationNotMatch": Makes the return of the bucket metadata
  4133. // conditional on whether the bucket's current metageneration does not
  4134. // match the given value.
  4135. func (c *BucketsUpdateCall) IfMetagenerationNotMatch(ifMetagenerationNotMatch int64) *BucketsUpdateCall {
  4136. c.urlParams_.Set("ifMetagenerationNotMatch", fmt.Sprint(ifMetagenerationNotMatch))
  4137. return c
  4138. }
  4139. // PredefinedAcl sets the optional parameter "predefinedAcl": Apply a
  4140. // predefined set of access controls to this bucket.
  4141. //
  4142. // Possible values:
  4143. // "authenticatedRead" - Project team owners get OWNER access, and
  4144. // allAuthenticatedUsers get READER access.
  4145. // "private" - Project team owners get OWNER access.
  4146. // "projectPrivate" - Project team members get access according to
  4147. // their roles.
  4148. // "publicRead" - Project team owners get OWNER access, and allUsers
  4149. // get READER access.
  4150. // "publicReadWrite" - Project team owners get OWNER access, and
  4151. // allUsers get WRITER access.
  4152. func (c *BucketsUpdateCall) PredefinedAcl(predefinedAcl string) *BucketsUpdateCall {
  4153. c.urlParams_.Set("predefinedAcl", predefinedAcl)
  4154. return c
  4155. }
  4156. // PredefinedDefaultObjectAcl sets the optional parameter
  4157. // "predefinedDefaultObjectAcl": Apply a predefined set of default
  4158. // object access controls to this bucket.
  4159. //
  4160. // Possible values:
  4161. // "authenticatedRead" - Object owner gets OWNER access, and
  4162. // allAuthenticatedUsers get READER access.
  4163. // "bucketOwnerFullControl" - Object owner gets OWNER access, and
  4164. // project team owners get OWNER access.
  4165. // "bucketOwnerRead" - Object owner gets OWNER access, and project
  4166. // team owners get READER access.
  4167. // "private" - Object owner gets OWNER access.
  4168. // "projectPrivate" - Object owner gets OWNER access, and project team
  4169. // members get access according to their roles.
  4170. // "publicRead" - Object owner gets OWNER access, and allUsers get
  4171. // READER access.
  4172. func (c *BucketsUpdateCall) PredefinedDefaultObjectAcl(predefinedDefaultObjectAcl string) *BucketsUpdateCall {
  4173. c.urlParams_.Set("predefinedDefaultObjectAcl", predefinedDefaultObjectAcl)
  4174. return c
  4175. }
  4176. // Projection sets the optional parameter "projection": Set of
  4177. // properties to return. Defaults to full.
  4178. //
  4179. // Possible values:
  4180. // "full" - Include all properties.
  4181. // "noAcl" - Omit owner, acl and defaultObjectAcl properties.
  4182. func (c *BucketsUpdateCall) Projection(projection string) *BucketsUpdateCall {
  4183. c.urlParams_.Set("projection", projection)
  4184. return c
  4185. }
  4186. // UserProject sets the optional parameter "userProject": The project to
  4187. // be billed for this request. Required for Requester Pays buckets.
  4188. func (c *BucketsUpdateCall) UserProject(userProject string) *BucketsUpdateCall {
  4189. c.urlParams_.Set("userProject", userProject)
  4190. return c
  4191. }
  4192. // Fields allows partial responses to be retrieved. See
  4193. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4194. // for more information.
  4195. func (c *BucketsUpdateCall) Fields(s ...googleapi.Field) *BucketsUpdateCall {
  4196. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4197. return c
  4198. }
  4199. // Context sets the context to be used in this call's Do method. Any
  4200. // pending HTTP request will be aborted if the provided context is
  4201. // canceled.
  4202. func (c *BucketsUpdateCall) Context(ctx context.Context) *BucketsUpdateCall {
  4203. c.ctx_ = ctx
  4204. return c
  4205. }
  4206. // Header returns an http.Header that can be modified by the caller to
  4207. // add HTTP headers to the request.
  4208. func (c *BucketsUpdateCall) Header() http.Header {
  4209. if c.header_ == nil {
  4210. c.header_ = make(http.Header)
  4211. }
  4212. return c.header_
  4213. }
  4214. func (c *BucketsUpdateCall) doRequest(alt string) (*http.Response, error) {
  4215. reqHeaders := make(http.Header)
  4216. for k, v := range c.header_ {
  4217. reqHeaders[k] = v
  4218. }
  4219. reqHeaders.Set("User-Agent", c.s.userAgent())
  4220. var body io.Reader = nil
  4221. body, err := googleapi.WithoutDataWrapper.JSONReader(c.bucket2)
  4222. if err != nil {
  4223. return nil, err
  4224. }
  4225. reqHeaders.Set("Content-Type", "application/json")
  4226. c.urlParams_.Set("alt", alt)
  4227. c.urlParams_.Set("prettyPrint", "false")
  4228. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}")
  4229. urls += "?" + c.urlParams_.Encode()
  4230. req, err := http.NewRequest("PUT", urls, body)
  4231. if err != nil {
  4232. return nil, err
  4233. }
  4234. req.Header = reqHeaders
  4235. googleapi.Expand(req.URL, map[string]string{
  4236. "bucket": c.bucket,
  4237. })
  4238. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4239. }
  4240. // Do executes the "storage.buckets.update" call.
  4241. // Exactly one of *Bucket or error will be non-nil. Any non-2xx status
  4242. // code is an error. Response headers are in either
  4243. // *Bucket.ServerResponse.Header or (if a response was returned at all)
  4244. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  4245. // check whether the returned error was because http.StatusNotModified
  4246. // was returned.
  4247. func (c *BucketsUpdateCall) Do(opts ...googleapi.CallOption) (*Bucket, error) {
  4248. gensupport.SetOptions(c.urlParams_, opts...)
  4249. res, err := c.doRequest("json")
  4250. if res != nil && res.StatusCode == http.StatusNotModified {
  4251. if res.Body != nil {
  4252. res.Body.Close()
  4253. }
  4254. return nil, &googleapi.Error{
  4255. Code: res.StatusCode,
  4256. Header: res.Header,
  4257. }
  4258. }
  4259. if err != nil {
  4260. return nil, err
  4261. }
  4262. defer googleapi.CloseBody(res)
  4263. if err := googleapi.CheckResponse(res); err != nil {
  4264. return nil, err
  4265. }
  4266. ret := &Bucket{
  4267. ServerResponse: googleapi.ServerResponse{
  4268. Header: res.Header,
  4269. HTTPStatusCode: res.StatusCode,
  4270. },
  4271. }
  4272. target := &ret
  4273. if err := gensupport.DecodeResponse(target, res); err != nil {
  4274. return nil, err
  4275. }
  4276. return ret, nil
  4277. // {
  4278. // "description": "Updates a bucket. Changes to the bucket will be readable immediately after writing, but configuration changes may take time to propagate.",
  4279. // "httpMethod": "PUT",
  4280. // "id": "storage.buckets.update",
  4281. // "parameterOrder": [
  4282. // "bucket"
  4283. // ],
  4284. // "parameters": {
  4285. // "bucket": {
  4286. // "description": "Name of a bucket.",
  4287. // "location": "path",
  4288. // "required": true,
  4289. // "type": "string"
  4290. // },
  4291. // "ifMetagenerationMatch": {
  4292. // "description": "Makes the return of the bucket metadata conditional on whether the bucket's current metageneration matches the given value.",
  4293. // "format": "int64",
  4294. // "location": "query",
  4295. // "type": "string"
  4296. // },
  4297. // "ifMetagenerationNotMatch": {
  4298. // "description": "Makes the return of the bucket metadata conditional on whether the bucket's current metageneration does not match the given value.",
  4299. // "format": "int64",
  4300. // "location": "query",
  4301. // "type": "string"
  4302. // },
  4303. // "predefinedAcl": {
  4304. // "description": "Apply a predefined set of access controls to this bucket.",
  4305. // "enum": [
  4306. // "authenticatedRead",
  4307. // "private",
  4308. // "projectPrivate",
  4309. // "publicRead",
  4310. // "publicReadWrite"
  4311. // ],
  4312. // "enumDescriptions": [
  4313. // "Project team owners get OWNER access, and allAuthenticatedUsers get READER access.",
  4314. // "Project team owners get OWNER access.",
  4315. // "Project team members get access according to their roles.",
  4316. // "Project team owners get OWNER access, and allUsers get READER access.",
  4317. // "Project team owners get OWNER access, and allUsers get WRITER access."
  4318. // ],
  4319. // "location": "query",
  4320. // "type": "string"
  4321. // },
  4322. // "predefinedDefaultObjectAcl": {
  4323. // "description": "Apply a predefined set of default object access controls to this bucket.",
  4324. // "enum": [
  4325. // "authenticatedRead",
  4326. // "bucketOwnerFullControl",
  4327. // "bucketOwnerRead",
  4328. // "private",
  4329. // "projectPrivate",
  4330. // "publicRead"
  4331. // ],
  4332. // "enumDescriptions": [
  4333. // "Object owner gets OWNER access, and allAuthenticatedUsers get READER access.",
  4334. // "Object owner gets OWNER access, and project team owners get OWNER access.",
  4335. // "Object owner gets OWNER access, and project team owners get READER access.",
  4336. // "Object owner gets OWNER access.",
  4337. // "Object owner gets OWNER access, and project team members get access according to their roles.",
  4338. // "Object owner gets OWNER access, and allUsers get READER access."
  4339. // ],
  4340. // "location": "query",
  4341. // "type": "string"
  4342. // },
  4343. // "projection": {
  4344. // "description": "Set of properties to return. Defaults to full.",
  4345. // "enum": [
  4346. // "full",
  4347. // "noAcl"
  4348. // ],
  4349. // "enumDescriptions": [
  4350. // "Include all properties.",
  4351. // "Omit owner, acl and defaultObjectAcl properties."
  4352. // ],
  4353. // "location": "query",
  4354. // "type": "string"
  4355. // },
  4356. // "userProject": {
  4357. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  4358. // "location": "query",
  4359. // "type": "string"
  4360. // }
  4361. // },
  4362. // "path": "b/{bucket}",
  4363. // "request": {
  4364. // "$ref": "Bucket"
  4365. // },
  4366. // "response": {
  4367. // "$ref": "Bucket"
  4368. // },
  4369. // "scopes": [
  4370. // "https://www.googleapis.com/auth/cloud-platform",
  4371. // "https://www.googleapis.com/auth/devstorage.full_control"
  4372. // ]
  4373. // }
  4374. }
  4375. // method id "storage.channels.stop":
  4376. type ChannelsStopCall struct {
  4377. s *Service
  4378. channel *Channel
  4379. urlParams_ gensupport.URLParams
  4380. ctx_ context.Context
  4381. header_ http.Header
  4382. }
  4383. // Stop: Stop watching resources through this channel
  4384. func (r *ChannelsService) Stop(channel *Channel) *ChannelsStopCall {
  4385. c := &ChannelsStopCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4386. c.channel = channel
  4387. return c
  4388. }
  4389. // Fields allows partial responses to be retrieved. See
  4390. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4391. // for more information.
  4392. func (c *ChannelsStopCall) Fields(s ...googleapi.Field) *ChannelsStopCall {
  4393. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4394. return c
  4395. }
  4396. // Context sets the context to be used in this call's Do method. Any
  4397. // pending HTTP request will be aborted if the provided context is
  4398. // canceled.
  4399. func (c *ChannelsStopCall) Context(ctx context.Context) *ChannelsStopCall {
  4400. c.ctx_ = ctx
  4401. return c
  4402. }
  4403. // Header returns an http.Header that can be modified by the caller to
  4404. // add HTTP headers to the request.
  4405. func (c *ChannelsStopCall) Header() http.Header {
  4406. if c.header_ == nil {
  4407. c.header_ = make(http.Header)
  4408. }
  4409. return c.header_
  4410. }
  4411. func (c *ChannelsStopCall) doRequest(alt string) (*http.Response, error) {
  4412. reqHeaders := make(http.Header)
  4413. for k, v := range c.header_ {
  4414. reqHeaders[k] = v
  4415. }
  4416. reqHeaders.Set("User-Agent", c.s.userAgent())
  4417. var body io.Reader = nil
  4418. body, err := googleapi.WithoutDataWrapper.JSONReader(c.channel)
  4419. if err != nil {
  4420. return nil, err
  4421. }
  4422. reqHeaders.Set("Content-Type", "application/json")
  4423. c.urlParams_.Set("alt", alt)
  4424. c.urlParams_.Set("prettyPrint", "false")
  4425. urls := googleapi.ResolveRelative(c.s.BasePath, "channels/stop")
  4426. urls += "?" + c.urlParams_.Encode()
  4427. req, err := http.NewRequest("POST", urls, body)
  4428. if err != nil {
  4429. return nil, err
  4430. }
  4431. req.Header = reqHeaders
  4432. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4433. }
  4434. // Do executes the "storage.channels.stop" call.
  4435. func (c *ChannelsStopCall) Do(opts ...googleapi.CallOption) error {
  4436. gensupport.SetOptions(c.urlParams_, opts...)
  4437. res, err := c.doRequest("json")
  4438. if err != nil {
  4439. return err
  4440. }
  4441. defer googleapi.CloseBody(res)
  4442. if err := googleapi.CheckResponse(res); err != nil {
  4443. return err
  4444. }
  4445. return nil
  4446. // {
  4447. // "description": "Stop watching resources through this channel",
  4448. // "httpMethod": "POST",
  4449. // "id": "storage.channels.stop",
  4450. // "path": "channels/stop",
  4451. // "request": {
  4452. // "$ref": "Channel",
  4453. // "parameterName": "resource"
  4454. // },
  4455. // "scopes": [
  4456. // "https://www.googleapis.com/auth/cloud-platform",
  4457. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  4458. // "https://www.googleapis.com/auth/devstorage.full_control",
  4459. // "https://www.googleapis.com/auth/devstorage.read_only",
  4460. // "https://www.googleapis.com/auth/devstorage.read_write"
  4461. // ]
  4462. // }
  4463. }
  4464. // method id "storage.defaultObjectAccessControls.delete":
  4465. type DefaultObjectAccessControlsDeleteCall struct {
  4466. s *Service
  4467. bucket string
  4468. entity string
  4469. urlParams_ gensupport.URLParams
  4470. ctx_ context.Context
  4471. header_ http.Header
  4472. }
  4473. // Delete: Permanently deletes the default object ACL entry for the
  4474. // specified entity on the specified bucket.
  4475. func (r *DefaultObjectAccessControlsService) Delete(bucket string, entity string) *DefaultObjectAccessControlsDeleteCall {
  4476. c := &DefaultObjectAccessControlsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4477. c.bucket = bucket
  4478. c.entity = entity
  4479. return c
  4480. }
  4481. // UserProject sets the optional parameter "userProject": The project to
  4482. // be billed for this request. Required for Requester Pays buckets.
  4483. func (c *DefaultObjectAccessControlsDeleteCall) UserProject(userProject string) *DefaultObjectAccessControlsDeleteCall {
  4484. c.urlParams_.Set("userProject", userProject)
  4485. return c
  4486. }
  4487. // Fields allows partial responses to be retrieved. See
  4488. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4489. // for more information.
  4490. func (c *DefaultObjectAccessControlsDeleteCall) Fields(s ...googleapi.Field) *DefaultObjectAccessControlsDeleteCall {
  4491. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4492. return c
  4493. }
  4494. // Context sets the context to be used in this call's Do method. Any
  4495. // pending HTTP request will be aborted if the provided context is
  4496. // canceled.
  4497. func (c *DefaultObjectAccessControlsDeleteCall) Context(ctx context.Context) *DefaultObjectAccessControlsDeleteCall {
  4498. c.ctx_ = ctx
  4499. return c
  4500. }
  4501. // Header returns an http.Header that can be modified by the caller to
  4502. // add HTTP headers to the request.
  4503. func (c *DefaultObjectAccessControlsDeleteCall) Header() http.Header {
  4504. if c.header_ == nil {
  4505. c.header_ = make(http.Header)
  4506. }
  4507. return c.header_
  4508. }
  4509. func (c *DefaultObjectAccessControlsDeleteCall) doRequest(alt string) (*http.Response, error) {
  4510. reqHeaders := make(http.Header)
  4511. for k, v := range c.header_ {
  4512. reqHeaders[k] = v
  4513. }
  4514. reqHeaders.Set("User-Agent", c.s.userAgent())
  4515. var body io.Reader = nil
  4516. c.urlParams_.Set("alt", alt)
  4517. c.urlParams_.Set("prettyPrint", "false")
  4518. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/defaultObjectAcl/{entity}")
  4519. urls += "?" + c.urlParams_.Encode()
  4520. req, err := http.NewRequest("DELETE", urls, body)
  4521. if err != nil {
  4522. return nil, err
  4523. }
  4524. req.Header = reqHeaders
  4525. googleapi.Expand(req.URL, map[string]string{
  4526. "bucket": c.bucket,
  4527. "entity": c.entity,
  4528. })
  4529. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4530. }
  4531. // Do executes the "storage.defaultObjectAccessControls.delete" call.
  4532. func (c *DefaultObjectAccessControlsDeleteCall) Do(opts ...googleapi.CallOption) error {
  4533. gensupport.SetOptions(c.urlParams_, opts...)
  4534. res, err := c.doRequest("json")
  4535. if err != nil {
  4536. return err
  4537. }
  4538. defer googleapi.CloseBody(res)
  4539. if err := googleapi.CheckResponse(res); err != nil {
  4540. return err
  4541. }
  4542. return nil
  4543. // {
  4544. // "description": "Permanently deletes the default object ACL entry for the specified entity on the specified bucket.",
  4545. // "httpMethod": "DELETE",
  4546. // "id": "storage.defaultObjectAccessControls.delete",
  4547. // "parameterOrder": [
  4548. // "bucket",
  4549. // "entity"
  4550. // ],
  4551. // "parameters": {
  4552. // "bucket": {
  4553. // "description": "Name of a bucket.",
  4554. // "location": "path",
  4555. // "required": true,
  4556. // "type": "string"
  4557. // },
  4558. // "entity": {
  4559. // "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.",
  4560. // "location": "path",
  4561. // "required": true,
  4562. // "type": "string"
  4563. // },
  4564. // "userProject": {
  4565. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  4566. // "location": "query",
  4567. // "type": "string"
  4568. // }
  4569. // },
  4570. // "path": "b/{bucket}/defaultObjectAcl/{entity}",
  4571. // "scopes": [
  4572. // "https://www.googleapis.com/auth/cloud-platform",
  4573. // "https://www.googleapis.com/auth/devstorage.full_control"
  4574. // ]
  4575. // }
  4576. }
  4577. // method id "storage.defaultObjectAccessControls.get":
  4578. type DefaultObjectAccessControlsGetCall struct {
  4579. s *Service
  4580. bucket string
  4581. entity string
  4582. urlParams_ gensupport.URLParams
  4583. ifNoneMatch_ string
  4584. ctx_ context.Context
  4585. header_ http.Header
  4586. }
  4587. // Get: Returns the default object ACL entry for the specified entity on
  4588. // the specified bucket.
  4589. func (r *DefaultObjectAccessControlsService) Get(bucket string, entity string) *DefaultObjectAccessControlsGetCall {
  4590. c := &DefaultObjectAccessControlsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4591. c.bucket = bucket
  4592. c.entity = entity
  4593. return c
  4594. }
  4595. // UserProject sets the optional parameter "userProject": The project to
  4596. // be billed for this request. Required for Requester Pays buckets.
  4597. func (c *DefaultObjectAccessControlsGetCall) UserProject(userProject string) *DefaultObjectAccessControlsGetCall {
  4598. c.urlParams_.Set("userProject", userProject)
  4599. return c
  4600. }
  4601. // Fields allows partial responses to be retrieved. See
  4602. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4603. // for more information.
  4604. func (c *DefaultObjectAccessControlsGetCall) Fields(s ...googleapi.Field) *DefaultObjectAccessControlsGetCall {
  4605. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4606. return c
  4607. }
  4608. // IfNoneMatch sets the optional parameter which makes the operation
  4609. // fail if the object's ETag matches the given value. This is useful for
  4610. // getting updates only after the object has changed since the last
  4611. // request. Use googleapi.IsNotModified to check whether the response
  4612. // error from Do is the result of In-None-Match.
  4613. func (c *DefaultObjectAccessControlsGetCall) IfNoneMatch(entityTag string) *DefaultObjectAccessControlsGetCall {
  4614. c.ifNoneMatch_ = entityTag
  4615. return c
  4616. }
  4617. // Context sets the context to be used in this call's Do method. Any
  4618. // pending HTTP request will be aborted if the provided context is
  4619. // canceled.
  4620. func (c *DefaultObjectAccessControlsGetCall) Context(ctx context.Context) *DefaultObjectAccessControlsGetCall {
  4621. c.ctx_ = ctx
  4622. return c
  4623. }
  4624. // Header returns an http.Header that can be modified by the caller to
  4625. // add HTTP headers to the request.
  4626. func (c *DefaultObjectAccessControlsGetCall) Header() http.Header {
  4627. if c.header_ == nil {
  4628. c.header_ = make(http.Header)
  4629. }
  4630. return c.header_
  4631. }
  4632. func (c *DefaultObjectAccessControlsGetCall) doRequest(alt string) (*http.Response, error) {
  4633. reqHeaders := make(http.Header)
  4634. for k, v := range c.header_ {
  4635. reqHeaders[k] = v
  4636. }
  4637. reqHeaders.Set("User-Agent", c.s.userAgent())
  4638. if c.ifNoneMatch_ != "" {
  4639. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  4640. }
  4641. var body io.Reader = nil
  4642. c.urlParams_.Set("alt", alt)
  4643. c.urlParams_.Set("prettyPrint", "false")
  4644. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/defaultObjectAcl/{entity}")
  4645. urls += "?" + c.urlParams_.Encode()
  4646. req, err := http.NewRequest("GET", urls, body)
  4647. if err != nil {
  4648. return nil, err
  4649. }
  4650. req.Header = reqHeaders
  4651. googleapi.Expand(req.URL, map[string]string{
  4652. "bucket": c.bucket,
  4653. "entity": c.entity,
  4654. })
  4655. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4656. }
  4657. // Do executes the "storage.defaultObjectAccessControls.get" call.
  4658. // Exactly one of *ObjectAccessControl or error will be non-nil. Any
  4659. // non-2xx status code is an error. Response headers are in either
  4660. // *ObjectAccessControl.ServerResponse.Header or (if a response was
  4661. // returned at all) in error.(*googleapi.Error).Header. Use
  4662. // googleapi.IsNotModified to check whether the returned error was
  4663. // because http.StatusNotModified was returned.
  4664. func (c *DefaultObjectAccessControlsGetCall) Do(opts ...googleapi.CallOption) (*ObjectAccessControl, error) {
  4665. gensupport.SetOptions(c.urlParams_, opts...)
  4666. res, err := c.doRequest("json")
  4667. if res != nil && res.StatusCode == http.StatusNotModified {
  4668. if res.Body != nil {
  4669. res.Body.Close()
  4670. }
  4671. return nil, &googleapi.Error{
  4672. Code: res.StatusCode,
  4673. Header: res.Header,
  4674. }
  4675. }
  4676. if err != nil {
  4677. return nil, err
  4678. }
  4679. defer googleapi.CloseBody(res)
  4680. if err := googleapi.CheckResponse(res); err != nil {
  4681. return nil, err
  4682. }
  4683. ret := &ObjectAccessControl{
  4684. ServerResponse: googleapi.ServerResponse{
  4685. Header: res.Header,
  4686. HTTPStatusCode: res.StatusCode,
  4687. },
  4688. }
  4689. target := &ret
  4690. if err := gensupport.DecodeResponse(target, res); err != nil {
  4691. return nil, err
  4692. }
  4693. return ret, nil
  4694. // {
  4695. // "description": "Returns the default object ACL entry for the specified entity on the specified bucket.",
  4696. // "httpMethod": "GET",
  4697. // "id": "storage.defaultObjectAccessControls.get",
  4698. // "parameterOrder": [
  4699. // "bucket",
  4700. // "entity"
  4701. // ],
  4702. // "parameters": {
  4703. // "bucket": {
  4704. // "description": "Name of a bucket.",
  4705. // "location": "path",
  4706. // "required": true,
  4707. // "type": "string"
  4708. // },
  4709. // "entity": {
  4710. // "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.",
  4711. // "location": "path",
  4712. // "required": true,
  4713. // "type": "string"
  4714. // },
  4715. // "userProject": {
  4716. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  4717. // "location": "query",
  4718. // "type": "string"
  4719. // }
  4720. // },
  4721. // "path": "b/{bucket}/defaultObjectAcl/{entity}",
  4722. // "response": {
  4723. // "$ref": "ObjectAccessControl"
  4724. // },
  4725. // "scopes": [
  4726. // "https://www.googleapis.com/auth/cloud-platform",
  4727. // "https://www.googleapis.com/auth/devstorage.full_control"
  4728. // ]
  4729. // }
  4730. }
  4731. // method id "storage.defaultObjectAccessControls.insert":
  4732. type DefaultObjectAccessControlsInsertCall struct {
  4733. s *Service
  4734. bucket string
  4735. objectaccesscontrol *ObjectAccessControl
  4736. urlParams_ gensupport.URLParams
  4737. ctx_ context.Context
  4738. header_ http.Header
  4739. }
  4740. // Insert: Creates a new default object ACL entry on the specified
  4741. // bucket.
  4742. func (r *DefaultObjectAccessControlsService) Insert(bucket string, objectaccesscontrol *ObjectAccessControl) *DefaultObjectAccessControlsInsertCall {
  4743. c := &DefaultObjectAccessControlsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4744. c.bucket = bucket
  4745. c.objectaccesscontrol = objectaccesscontrol
  4746. return c
  4747. }
  4748. // UserProject sets the optional parameter "userProject": The project to
  4749. // be billed for this request. Required for Requester Pays buckets.
  4750. func (c *DefaultObjectAccessControlsInsertCall) UserProject(userProject string) *DefaultObjectAccessControlsInsertCall {
  4751. c.urlParams_.Set("userProject", userProject)
  4752. return c
  4753. }
  4754. // Fields allows partial responses to be retrieved. See
  4755. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4756. // for more information.
  4757. func (c *DefaultObjectAccessControlsInsertCall) Fields(s ...googleapi.Field) *DefaultObjectAccessControlsInsertCall {
  4758. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4759. return c
  4760. }
  4761. // Context sets the context to be used in this call's Do method. Any
  4762. // pending HTTP request will be aborted if the provided context is
  4763. // canceled.
  4764. func (c *DefaultObjectAccessControlsInsertCall) Context(ctx context.Context) *DefaultObjectAccessControlsInsertCall {
  4765. c.ctx_ = ctx
  4766. return c
  4767. }
  4768. // Header returns an http.Header that can be modified by the caller to
  4769. // add HTTP headers to the request.
  4770. func (c *DefaultObjectAccessControlsInsertCall) Header() http.Header {
  4771. if c.header_ == nil {
  4772. c.header_ = make(http.Header)
  4773. }
  4774. return c.header_
  4775. }
  4776. func (c *DefaultObjectAccessControlsInsertCall) doRequest(alt string) (*http.Response, error) {
  4777. reqHeaders := make(http.Header)
  4778. for k, v := range c.header_ {
  4779. reqHeaders[k] = v
  4780. }
  4781. reqHeaders.Set("User-Agent", c.s.userAgent())
  4782. var body io.Reader = nil
  4783. body, err := googleapi.WithoutDataWrapper.JSONReader(c.objectaccesscontrol)
  4784. if err != nil {
  4785. return nil, err
  4786. }
  4787. reqHeaders.Set("Content-Type", "application/json")
  4788. c.urlParams_.Set("alt", alt)
  4789. c.urlParams_.Set("prettyPrint", "false")
  4790. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/defaultObjectAcl")
  4791. urls += "?" + c.urlParams_.Encode()
  4792. req, err := http.NewRequest("POST", urls, body)
  4793. if err != nil {
  4794. return nil, err
  4795. }
  4796. req.Header = reqHeaders
  4797. googleapi.Expand(req.URL, map[string]string{
  4798. "bucket": c.bucket,
  4799. })
  4800. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4801. }
  4802. // Do executes the "storage.defaultObjectAccessControls.insert" call.
  4803. // Exactly one of *ObjectAccessControl or error will be non-nil. Any
  4804. // non-2xx status code is an error. Response headers are in either
  4805. // *ObjectAccessControl.ServerResponse.Header or (if a response was
  4806. // returned at all) in error.(*googleapi.Error).Header. Use
  4807. // googleapi.IsNotModified to check whether the returned error was
  4808. // because http.StatusNotModified was returned.
  4809. func (c *DefaultObjectAccessControlsInsertCall) Do(opts ...googleapi.CallOption) (*ObjectAccessControl, error) {
  4810. gensupport.SetOptions(c.urlParams_, opts...)
  4811. res, err := c.doRequest("json")
  4812. if res != nil && res.StatusCode == http.StatusNotModified {
  4813. if res.Body != nil {
  4814. res.Body.Close()
  4815. }
  4816. return nil, &googleapi.Error{
  4817. Code: res.StatusCode,
  4818. Header: res.Header,
  4819. }
  4820. }
  4821. if err != nil {
  4822. return nil, err
  4823. }
  4824. defer googleapi.CloseBody(res)
  4825. if err := googleapi.CheckResponse(res); err != nil {
  4826. return nil, err
  4827. }
  4828. ret := &ObjectAccessControl{
  4829. ServerResponse: googleapi.ServerResponse{
  4830. Header: res.Header,
  4831. HTTPStatusCode: res.StatusCode,
  4832. },
  4833. }
  4834. target := &ret
  4835. if err := gensupport.DecodeResponse(target, res); err != nil {
  4836. return nil, err
  4837. }
  4838. return ret, nil
  4839. // {
  4840. // "description": "Creates a new default object ACL entry on the specified bucket.",
  4841. // "httpMethod": "POST",
  4842. // "id": "storage.defaultObjectAccessControls.insert",
  4843. // "parameterOrder": [
  4844. // "bucket"
  4845. // ],
  4846. // "parameters": {
  4847. // "bucket": {
  4848. // "description": "Name of a bucket.",
  4849. // "location": "path",
  4850. // "required": true,
  4851. // "type": "string"
  4852. // },
  4853. // "userProject": {
  4854. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  4855. // "location": "query",
  4856. // "type": "string"
  4857. // }
  4858. // },
  4859. // "path": "b/{bucket}/defaultObjectAcl",
  4860. // "request": {
  4861. // "$ref": "ObjectAccessControl"
  4862. // },
  4863. // "response": {
  4864. // "$ref": "ObjectAccessControl"
  4865. // },
  4866. // "scopes": [
  4867. // "https://www.googleapis.com/auth/cloud-platform",
  4868. // "https://www.googleapis.com/auth/devstorage.full_control"
  4869. // ]
  4870. // }
  4871. }
  4872. // method id "storage.defaultObjectAccessControls.list":
  4873. type DefaultObjectAccessControlsListCall struct {
  4874. s *Service
  4875. bucket string
  4876. urlParams_ gensupport.URLParams
  4877. ifNoneMatch_ string
  4878. ctx_ context.Context
  4879. header_ http.Header
  4880. }
  4881. // List: Retrieves default object ACL entries on the specified bucket.
  4882. func (r *DefaultObjectAccessControlsService) List(bucket string) *DefaultObjectAccessControlsListCall {
  4883. c := &DefaultObjectAccessControlsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4884. c.bucket = bucket
  4885. return c
  4886. }
  4887. // IfMetagenerationMatch sets the optional parameter
  4888. // "ifMetagenerationMatch": If present, only return default ACL listing
  4889. // if the bucket's current metageneration matches this value.
  4890. func (c *DefaultObjectAccessControlsListCall) IfMetagenerationMatch(ifMetagenerationMatch int64) *DefaultObjectAccessControlsListCall {
  4891. c.urlParams_.Set("ifMetagenerationMatch", fmt.Sprint(ifMetagenerationMatch))
  4892. return c
  4893. }
  4894. // IfMetagenerationNotMatch sets the optional parameter
  4895. // "ifMetagenerationNotMatch": If present, only return default ACL
  4896. // listing if the bucket's current metageneration does not match the
  4897. // given value.
  4898. func (c *DefaultObjectAccessControlsListCall) IfMetagenerationNotMatch(ifMetagenerationNotMatch int64) *DefaultObjectAccessControlsListCall {
  4899. c.urlParams_.Set("ifMetagenerationNotMatch", fmt.Sprint(ifMetagenerationNotMatch))
  4900. return c
  4901. }
  4902. // UserProject sets the optional parameter "userProject": The project to
  4903. // be billed for this request. Required for Requester Pays buckets.
  4904. func (c *DefaultObjectAccessControlsListCall) UserProject(userProject string) *DefaultObjectAccessControlsListCall {
  4905. c.urlParams_.Set("userProject", userProject)
  4906. return c
  4907. }
  4908. // Fields allows partial responses to be retrieved. See
  4909. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4910. // for more information.
  4911. func (c *DefaultObjectAccessControlsListCall) Fields(s ...googleapi.Field) *DefaultObjectAccessControlsListCall {
  4912. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4913. return c
  4914. }
  4915. // IfNoneMatch sets the optional parameter which makes the operation
  4916. // fail if the object's ETag matches the given value. This is useful for
  4917. // getting updates only after the object has changed since the last
  4918. // request. Use googleapi.IsNotModified to check whether the response
  4919. // error from Do is the result of In-None-Match.
  4920. func (c *DefaultObjectAccessControlsListCall) IfNoneMatch(entityTag string) *DefaultObjectAccessControlsListCall {
  4921. c.ifNoneMatch_ = entityTag
  4922. return c
  4923. }
  4924. // Context sets the context to be used in this call's Do method. Any
  4925. // pending HTTP request will be aborted if the provided context is
  4926. // canceled.
  4927. func (c *DefaultObjectAccessControlsListCall) Context(ctx context.Context) *DefaultObjectAccessControlsListCall {
  4928. c.ctx_ = ctx
  4929. return c
  4930. }
  4931. // Header returns an http.Header that can be modified by the caller to
  4932. // add HTTP headers to the request.
  4933. func (c *DefaultObjectAccessControlsListCall) Header() http.Header {
  4934. if c.header_ == nil {
  4935. c.header_ = make(http.Header)
  4936. }
  4937. return c.header_
  4938. }
  4939. func (c *DefaultObjectAccessControlsListCall) doRequest(alt string) (*http.Response, error) {
  4940. reqHeaders := make(http.Header)
  4941. for k, v := range c.header_ {
  4942. reqHeaders[k] = v
  4943. }
  4944. reqHeaders.Set("User-Agent", c.s.userAgent())
  4945. if c.ifNoneMatch_ != "" {
  4946. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  4947. }
  4948. var body io.Reader = nil
  4949. c.urlParams_.Set("alt", alt)
  4950. c.urlParams_.Set("prettyPrint", "false")
  4951. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/defaultObjectAcl")
  4952. urls += "?" + c.urlParams_.Encode()
  4953. req, err := http.NewRequest("GET", urls, body)
  4954. if err != nil {
  4955. return nil, err
  4956. }
  4957. req.Header = reqHeaders
  4958. googleapi.Expand(req.URL, map[string]string{
  4959. "bucket": c.bucket,
  4960. })
  4961. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4962. }
  4963. // Do executes the "storage.defaultObjectAccessControls.list" call.
  4964. // Exactly one of *ObjectAccessControls or error will be non-nil. Any
  4965. // non-2xx status code is an error. Response headers are in either
  4966. // *ObjectAccessControls.ServerResponse.Header or (if a response was
  4967. // returned at all) in error.(*googleapi.Error).Header. Use
  4968. // googleapi.IsNotModified to check whether the returned error was
  4969. // because http.StatusNotModified was returned.
  4970. func (c *DefaultObjectAccessControlsListCall) Do(opts ...googleapi.CallOption) (*ObjectAccessControls, error) {
  4971. gensupport.SetOptions(c.urlParams_, opts...)
  4972. res, err := c.doRequest("json")
  4973. if res != nil && res.StatusCode == http.StatusNotModified {
  4974. if res.Body != nil {
  4975. res.Body.Close()
  4976. }
  4977. return nil, &googleapi.Error{
  4978. Code: res.StatusCode,
  4979. Header: res.Header,
  4980. }
  4981. }
  4982. if err != nil {
  4983. return nil, err
  4984. }
  4985. defer googleapi.CloseBody(res)
  4986. if err := googleapi.CheckResponse(res); err != nil {
  4987. return nil, err
  4988. }
  4989. ret := &ObjectAccessControls{
  4990. ServerResponse: googleapi.ServerResponse{
  4991. Header: res.Header,
  4992. HTTPStatusCode: res.StatusCode,
  4993. },
  4994. }
  4995. target := &ret
  4996. if err := gensupport.DecodeResponse(target, res); err != nil {
  4997. return nil, err
  4998. }
  4999. return ret, nil
  5000. // {
  5001. // "description": "Retrieves default object ACL entries on the specified bucket.",
  5002. // "httpMethod": "GET",
  5003. // "id": "storage.defaultObjectAccessControls.list",
  5004. // "parameterOrder": [
  5005. // "bucket"
  5006. // ],
  5007. // "parameters": {
  5008. // "bucket": {
  5009. // "description": "Name of a bucket.",
  5010. // "location": "path",
  5011. // "required": true,
  5012. // "type": "string"
  5013. // },
  5014. // "ifMetagenerationMatch": {
  5015. // "description": "If present, only return default ACL listing if the bucket's current metageneration matches this value.",
  5016. // "format": "int64",
  5017. // "location": "query",
  5018. // "type": "string"
  5019. // },
  5020. // "ifMetagenerationNotMatch": {
  5021. // "description": "If present, only return default ACL listing if the bucket's current metageneration does not match the given value.",
  5022. // "format": "int64",
  5023. // "location": "query",
  5024. // "type": "string"
  5025. // },
  5026. // "userProject": {
  5027. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  5028. // "location": "query",
  5029. // "type": "string"
  5030. // }
  5031. // },
  5032. // "path": "b/{bucket}/defaultObjectAcl",
  5033. // "response": {
  5034. // "$ref": "ObjectAccessControls"
  5035. // },
  5036. // "scopes": [
  5037. // "https://www.googleapis.com/auth/cloud-platform",
  5038. // "https://www.googleapis.com/auth/devstorage.full_control"
  5039. // ]
  5040. // }
  5041. }
  5042. // method id "storage.defaultObjectAccessControls.patch":
  5043. type DefaultObjectAccessControlsPatchCall struct {
  5044. s *Service
  5045. bucket string
  5046. entity string
  5047. objectaccesscontrol *ObjectAccessControl
  5048. urlParams_ gensupport.URLParams
  5049. ctx_ context.Context
  5050. header_ http.Header
  5051. }
  5052. // Patch: Patches a default object ACL entry on the specified bucket.
  5053. func (r *DefaultObjectAccessControlsService) Patch(bucket string, entity string, objectaccesscontrol *ObjectAccessControl) *DefaultObjectAccessControlsPatchCall {
  5054. c := &DefaultObjectAccessControlsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5055. c.bucket = bucket
  5056. c.entity = entity
  5057. c.objectaccesscontrol = objectaccesscontrol
  5058. return c
  5059. }
  5060. // UserProject sets the optional parameter "userProject": The project to
  5061. // be billed for this request. Required for Requester Pays buckets.
  5062. func (c *DefaultObjectAccessControlsPatchCall) UserProject(userProject string) *DefaultObjectAccessControlsPatchCall {
  5063. c.urlParams_.Set("userProject", userProject)
  5064. return c
  5065. }
  5066. // Fields allows partial responses to be retrieved. See
  5067. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5068. // for more information.
  5069. func (c *DefaultObjectAccessControlsPatchCall) Fields(s ...googleapi.Field) *DefaultObjectAccessControlsPatchCall {
  5070. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5071. return c
  5072. }
  5073. // Context sets the context to be used in this call's Do method. Any
  5074. // pending HTTP request will be aborted if the provided context is
  5075. // canceled.
  5076. func (c *DefaultObjectAccessControlsPatchCall) Context(ctx context.Context) *DefaultObjectAccessControlsPatchCall {
  5077. c.ctx_ = ctx
  5078. return c
  5079. }
  5080. // Header returns an http.Header that can be modified by the caller to
  5081. // add HTTP headers to the request.
  5082. func (c *DefaultObjectAccessControlsPatchCall) Header() http.Header {
  5083. if c.header_ == nil {
  5084. c.header_ = make(http.Header)
  5085. }
  5086. return c.header_
  5087. }
  5088. func (c *DefaultObjectAccessControlsPatchCall) doRequest(alt string) (*http.Response, error) {
  5089. reqHeaders := make(http.Header)
  5090. for k, v := range c.header_ {
  5091. reqHeaders[k] = v
  5092. }
  5093. reqHeaders.Set("User-Agent", c.s.userAgent())
  5094. var body io.Reader = nil
  5095. body, err := googleapi.WithoutDataWrapper.JSONReader(c.objectaccesscontrol)
  5096. if err != nil {
  5097. return nil, err
  5098. }
  5099. reqHeaders.Set("Content-Type", "application/json")
  5100. c.urlParams_.Set("alt", alt)
  5101. c.urlParams_.Set("prettyPrint", "false")
  5102. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/defaultObjectAcl/{entity}")
  5103. urls += "?" + c.urlParams_.Encode()
  5104. req, err := http.NewRequest("PATCH", urls, body)
  5105. if err != nil {
  5106. return nil, err
  5107. }
  5108. req.Header = reqHeaders
  5109. googleapi.Expand(req.URL, map[string]string{
  5110. "bucket": c.bucket,
  5111. "entity": c.entity,
  5112. })
  5113. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5114. }
  5115. // Do executes the "storage.defaultObjectAccessControls.patch" call.
  5116. // Exactly one of *ObjectAccessControl or error will be non-nil. Any
  5117. // non-2xx status code is an error. Response headers are in either
  5118. // *ObjectAccessControl.ServerResponse.Header or (if a response was
  5119. // returned at all) in error.(*googleapi.Error).Header. Use
  5120. // googleapi.IsNotModified to check whether the returned error was
  5121. // because http.StatusNotModified was returned.
  5122. func (c *DefaultObjectAccessControlsPatchCall) Do(opts ...googleapi.CallOption) (*ObjectAccessControl, error) {
  5123. gensupport.SetOptions(c.urlParams_, opts...)
  5124. res, err := c.doRequest("json")
  5125. if res != nil && res.StatusCode == http.StatusNotModified {
  5126. if res.Body != nil {
  5127. res.Body.Close()
  5128. }
  5129. return nil, &googleapi.Error{
  5130. Code: res.StatusCode,
  5131. Header: res.Header,
  5132. }
  5133. }
  5134. if err != nil {
  5135. return nil, err
  5136. }
  5137. defer googleapi.CloseBody(res)
  5138. if err := googleapi.CheckResponse(res); err != nil {
  5139. return nil, err
  5140. }
  5141. ret := &ObjectAccessControl{
  5142. ServerResponse: googleapi.ServerResponse{
  5143. Header: res.Header,
  5144. HTTPStatusCode: res.StatusCode,
  5145. },
  5146. }
  5147. target := &ret
  5148. if err := gensupport.DecodeResponse(target, res); err != nil {
  5149. return nil, err
  5150. }
  5151. return ret, nil
  5152. // {
  5153. // "description": "Patches a default object ACL entry on the specified bucket.",
  5154. // "httpMethod": "PATCH",
  5155. // "id": "storage.defaultObjectAccessControls.patch",
  5156. // "parameterOrder": [
  5157. // "bucket",
  5158. // "entity"
  5159. // ],
  5160. // "parameters": {
  5161. // "bucket": {
  5162. // "description": "Name of a bucket.",
  5163. // "location": "path",
  5164. // "required": true,
  5165. // "type": "string"
  5166. // },
  5167. // "entity": {
  5168. // "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.",
  5169. // "location": "path",
  5170. // "required": true,
  5171. // "type": "string"
  5172. // },
  5173. // "userProject": {
  5174. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  5175. // "location": "query",
  5176. // "type": "string"
  5177. // }
  5178. // },
  5179. // "path": "b/{bucket}/defaultObjectAcl/{entity}",
  5180. // "request": {
  5181. // "$ref": "ObjectAccessControl"
  5182. // },
  5183. // "response": {
  5184. // "$ref": "ObjectAccessControl"
  5185. // },
  5186. // "scopes": [
  5187. // "https://www.googleapis.com/auth/cloud-platform",
  5188. // "https://www.googleapis.com/auth/devstorage.full_control"
  5189. // ]
  5190. // }
  5191. }
  5192. // method id "storage.defaultObjectAccessControls.update":
  5193. type DefaultObjectAccessControlsUpdateCall struct {
  5194. s *Service
  5195. bucket string
  5196. entity string
  5197. objectaccesscontrol *ObjectAccessControl
  5198. urlParams_ gensupport.URLParams
  5199. ctx_ context.Context
  5200. header_ http.Header
  5201. }
  5202. // Update: Updates a default object ACL entry on the specified bucket.
  5203. func (r *DefaultObjectAccessControlsService) Update(bucket string, entity string, objectaccesscontrol *ObjectAccessControl) *DefaultObjectAccessControlsUpdateCall {
  5204. c := &DefaultObjectAccessControlsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5205. c.bucket = bucket
  5206. c.entity = entity
  5207. c.objectaccesscontrol = objectaccesscontrol
  5208. return c
  5209. }
  5210. // UserProject sets the optional parameter "userProject": The project to
  5211. // be billed for this request. Required for Requester Pays buckets.
  5212. func (c *DefaultObjectAccessControlsUpdateCall) UserProject(userProject string) *DefaultObjectAccessControlsUpdateCall {
  5213. c.urlParams_.Set("userProject", userProject)
  5214. return c
  5215. }
  5216. // Fields allows partial responses to be retrieved. See
  5217. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5218. // for more information.
  5219. func (c *DefaultObjectAccessControlsUpdateCall) Fields(s ...googleapi.Field) *DefaultObjectAccessControlsUpdateCall {
  5220. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5221. return c
  5222. }
  5223. // Context sets the context to be used in this call's Do method. Any
  5224. // pending HTTP request will be aborted if the provided context is
  5225. // canceled.
  5226. func (c *DefaultObjectAccessControlsUpdateCall) Context(ctx context.Context) *DefaultObjectAccessControlsUpdateCall {
  5227. c.ctx_ = ctx
  5228. return c
  5229. }
  5230. // Header returns an http.Header that can be modified by the caller to
  5231. // add HTTP headers to the request.
  5232. func (c *DefaultObjectAccessControlsUpdateCall) Header() http.Header {
  5233. if c.header_ == nil {
  5234. c.header_ = make(http.Header)
  5235. }
  5236. return c.header_
  5237. }
  5238. func (c *DefaultObjectAccessControlsUpdateCall) doRequest(alt string) (*http.Response, error) {
  5239. reqHeaders := make(http.Header)
  5240. for k, v := range c.header_ {
  5241. reqHeaders[k] = v
  5242. }
  5243. reqHeaders.Set("User-Agent", c.s.userAgent())
  5244. var body io.Reader = nil
  5245. body, err := googleapi.WithoutDataWrapper.JSONReader(c.objectaccesscontrol)
  5246. if err != nil {
  5247. return nil, err
  5248. }
  5249. reqHeaders.Set("Content-Type", "application/json")
  5250. c.urlParams_.Set("alt", alt)
  5251. c.urlParams_.Set("prettyPrint", "false")
  5252. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/defaultObjectAcl/{entity}")
  5253. urls += "?" + c.urlParams_.Encode()
  5254. req, err := http.NewRequest("PUT", urls, body)
  5255. if err != nil {
  5256. return nil, err
  5257. }
  5258. req.Header = reqHeaders
  5259. googleapi.Expand(req.URL, map[string]string{
  5260. "bucket": c.bucket,
  5261. "entity": c.entity,
  5262. })
  5263. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5264. }
  5265. // Do executes the "storage.defaultObjectAccessControls.update" call.
  5266. // Exactly one of *ObjectAccessControl or error will be non-nil. Any
  5267. // non-2xx status code is an error. Response headers are in either
  5268. // *ObjectAccessControl.ServerResponse.Header or (if a response was
  5269. // returned at all) in error.(*googleapi.Error).Header. Use
  5270. // googleapi.IsNotModified to check whether the returned error was
  5271. // because http.StatusNotModified was returned.
  5272. func (c *DefaultObjectAccessControlsUpdateCall) Do(opts ...googleapi.CallOption) (*ObjectAccessControl, error) {
  5273. gensupport.SetOptions(c.urlParams_, opts...)
  5274. res, err := c.doRequest("json")
  5275. if res != nil && res.StatusCode == http.StatusNotModified {
  5276. if res.Body != nil {
  5277. res.Body.Close()
  5278. }
  5279. return nil, &googleapi.Error{
  5280. Code: res.StatusCode,
  5281. Header: res.Header,
  5282. }
  5283. }
  5284. if err != nil {
  5285. return nil, err
  5286. }
  5287. defer googleapi.CloseBody(res)
  5288. if err := googleapi.CheckResponse(res); err != nil {
  5289. return nil, err
  5290. }
  5291. ret := &ObjectAccessControl{
  5292. ServerResponse: googleapi.ServerResponse{
  5293. Header: res.Header,
  5294. HTTPStatusCode: res.StatusCode,
  5295. },
  5296. }
  5297. target := &ret
  5298. if err := gensupport.DecodeResponse(target, res); err != nil {
  5299. return nil, err
  5300. }
  5301. return ret, nil
  5302. // {
  5303. // "description": "Updates a default object ACL entry on the specified bucket.",
  5304. // "httpMethod": "PUT",
  5305. // "id": "storage.defaultObjectAccessControls.update",
  5306. // "parameterOrder": [
  5307. // "bucket",
  5308. // "entity"
  5309. // ],
  5310. // "parameters": {
  5311. // "bucket": {
  5312. // "description": "Name of a bucket.",
  5313. // "location": "path",
  5314. // "required": true,
  5315. // "type": "string"
  5316. // },
  5317. // "entity": {
  5318. // "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.",
  5319. // "location": "path",
  5320. // "required": true,
  5321. // "type": "string"
  5322. // },
  5323. // "userProject": {
  5324. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  5325. // "location": "query",
  5326. // "type": "string"
  5327. // }
  5328. // },
  5329. // "path": "b/{bucket}/defaultObjectAcl/{entity}",
  5330. // "request": {
  5331. // "$ref": "ObjectAccessControl"
  5332. // },
  5333. // "response": {
  5334. // "$ref": "ObjectAccessControl"
  5335. // },
  5336. // "scopes": [
  5337. // "https://www.googleapis.com/auth/cloud-platform",
  5338. // "https://www.googleapis.com/auth/devstorage.full_control"
  5339. // ]
  5340. // }
  5341. }
  5342. // method id "storage.notifications.delete":
  5343. type NotificationsDeleteCall struct {
  5344. s *Service
  5345. bucket string
  5346. notification string
  5347. urlParams_ gensupport.URLParams
  5348. ctx_ context.Context
  5349. header_ http.Header
  5350. }
  5351. // Delete: Permanently deletes a notification subscription.
  5352. func (r *NotificationsService) Delete(bucket string, notification string) *NotificationsDeleteCall {
  5353. c := &NotificationsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5354. c.bucket = bucket
  5355. c.notification = notification
  5356. return c
  5357. }
  5358. // UserProject sets the optional parameter "userProject": The project to
  5359. // be billed for this request. Required for Requester Pays buckets.
  5360. func (c *NotificationsDeleteCall) UserProject(userProject string) *NotificationsDeleteCall {
  5361. c.urlParams_.Set("userProject", userProject)
  5362. return c
  5363. }
  5364. // Fields allows partial responses to be retrieved. See
  5365. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5366. // for more information.
  5367. func (c *NotificationsDeleteCall) Fields(s ...googleapi.Field) *NotificationsDeleteCall {
  5368. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5369. return c
  5370. }
  5371. // Context sets the context to be used in this call's Do method. Any
  5372. // pending HTTP request will be aborted if the provided context is
  5373. // canceled.
  5374. func (c *NotificationsDeleteCall) Context(ctx context.Context) *NotificationsDeleteCall {
  5375. c.ctx_ = ctx
  5376. return c
  5377. }
  5378. // Header returns an http.Header that can be modified by the caller to
  5379. // add HTTP headers to the request.
  5380. func (c *NotificationsDeleteCall) Header() http.Header {
  5381. if c.header_ == nil {
  5382. c.header_ = make(http.Header)
  5383. }
  5384. return c.header_
  5385. }
  5386. func (c *NotificationsDeleteCall) doRequest(alt string) (*http.Response, error) {
  5387. reqHeaders := make(http.Header)
  5388. for k, v := range c.header_ {
  5389. reqHeaders[k] = v
  5390. }
  5391. reqHeaders.Set("User-Agent", c.s.userAgent())
  5392. var body io.Reader = nil
  5393. c.urlParams_.Set("alt", alt)
  5394. c.urlParams_.Set("prettyPrint", "false")
  5395. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/notificationConfigs/{notification}")
  5396. urls += "?" + c.urlParams_.Encode()
  5397. req, err := http.NewRequest("DELETE", urls, body)
  5398. if err != nil {
  5399. return nil, err
  5400. }
  5401. req.Header = reqHeaders
  5402. googleapi.Expand(req.URL, map[string]string{
  5403. "bucket": c.bucket,
  5404. "notification": c.notification,
  5405. })
  5406. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5407. }
  5408. // Do executes the "storage.notifications.delete" call.
  5409. func (c *NotificationsDeleteCall) Do(opts ...googleapi.CallOption) error {
  5410. gensupport.SetOptions(c.urlParams_, opts...)
  5411. res, err := c.doRequest("json")
  5412. if err != nil {
  5413. return err
  5414. }
  5415. defer googleapi.CloseBody(res)
  5416. if err := googleapi.CheckResponse(res); err != nil {
  5417. return err
  5418. }
  5419. return nil
  5420. // {
  5421. // "description": "Permanently deletes a notification subscription.",
  5422. // "httpMethod": "DELETE",
  5423. // "id": "storage.notifications.delete",
  5424. // "parameterOrder": [
  5425. // "bucket",
  5426. // "notification"
  5427. // ],
  5428. // "parameters": {
  5429. // "bucket": {
  5430. // "description": "The parent bucket of the notification.",
  5431. // "location": "path",
  5432. // "required": true,
  5433. // "type": "string"
  5434. // },
  5435. // "notification": {
  5436. // "description": "ID of the notification to delete.",
  5437. // "location": "path",
  5438. // "required": true,
  5439. // "type": "string"
  5440. // },
  5441. // "userProject": {
  5442. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  5443. // "location": "query",
  5444. // "type": "string"
  5445. // }
  5446. // },
  5447. // "path": "b/{bucket}/notificationConfigs/{notification}",
  5448. // "scopes": [
  5449. // "https://www.googleapis.com/auth/cloud-platform",
  5450. // "https://www.googleapis.com/auth/devstorage.full_control",
  5451. // "https://www.googleapis.com/auth/devstorage.read_write"
  5452. // ]
  5453. // }
  5454. }
  5455. // method id "storage.notifications.get":
  5456. type NotificationsGetCall struct {
  5457. s *Service
  5458. bucket string
  5459. notification string
  5460. urlParams_ gensupport.URLParams
  5461. ifNoneMatch_ string
  5462. ctx_ context.Context
  5463. header_ http.Header
  5464. }
  5465. // Get: View a notification configuration.
  5466. func (r *NotificationsService) Get(bucket string, notification string) *NotificationsGetCall {
  5467. c := &NotificationsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5468. c.bucket = bucket
  5469. c.notification = notification
  5470. return c
  5471. }
  5472. // UserProject sets the optional parameter "userProject": The project to
  5473. // be billed for this request. Required for Requester Pays buckets.
  5474. func (c *NotificationsGetCall) UserProject(userProject string) *NotificationsGetCall {
  5475. c.urlParams_.Set("userProject", userProject)
  5476. return c
  5477. }
  5478. // Fields allows partial responses to be retrieved. See
  5479. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5480. // for more information.
  5481. func (c *NotificationsGetCall) Fields(s ...googleapi.Field) *NotificationsGetCall {
  5482. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5483. return c
  5484. }
  5485. // IfNoneMatch sets the optional parameter which makes the operation
  5486. // fail if the object's ETag matches the given value. This is useful for
  5487. // getting updates only after the object has changed since the last
  5488. // request. Use googleapi.IsNotModified to check whether the response
  5489. // error from Do is the result of In-None-Match.
  5490. func (c *NotificationsGetCall) IfNoneMatch(entityTag string) *NotificationsGetCall {
  5491. c.ifNoneMatch_ = entityTag
  5492. return c
  5493. }
  5494. // Context sets the context to be used in this call's Do method. Any
  5495. // pending HTTP request will be aborted if the provided context is
  5496. // canceled.
  5497. func (c *NotificationsGetCall) Context(ctx context.Context) *NotificationsGetCall {
  5498. c.ctx_ = ctx
  5499. return c
  5500. }
  5501. // Header returns an http.Header that can be modified by the caller to
  5502. // add HTTP headers to the request.
  5503. func (c *NotificationsGetCall) Header() http.Header {
  5504. if c.header_ == nil {
  5505. c.header_ = make(http.Header)
  5506. }
  5507. return c.header_
  5508. }
  5509. func (c *NotificationsGetCall) doRequest(alt string) (*http.Response, error) {
  5510. reqHeaders := make(http.Header)
  5511. for k, v := range c.header_ {
  5512. reqHeaders[k] = v
  5513. }
  5514. reqHeaders.Set("User-Agent", c.s.userAgent())
  5515. if c.ifNoneMatch_ != "" {
  5516. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  5517. }
  5518. var body io.Reader = nil
  5519. c.urlParams_.Set("alt", alt)
  5520. c.urlParams_.Set("prettyPrint", "false")
  5521. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/notificationConfigs/{notification}")
  5522. urls += "?" + c.urlParams_.Encode()
  5523. req, err := http.NewRequest("GET", urls, body)
  5524. if err != nil {
  5525. return nil, err
  5526. }
  5527. req.Header = reqHeaders
  5528. googleapi.Expand(req.URL, map[string]string{
  5529. "bucket": c.bucket,
  5530. "notification": c.notification,
  5531. })
  5532. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5533. }
  5534. // Do executes the "storage.notifications.get" call.
  5535. // Exactly one of *Notification or error will be non-nil. Any non-2xx
  5536. // status code is an error. Response headers are in either
  5537. // *Notification.ServerResponse.Header or (if a response was returned at
  5538. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  5539. // to check whether the returned error was because
  5540. // http.StatusNotModified was returned.
  5541. func (c *NotificationsGetCall) Do(opts ...googleapi.CallOption) (*Notification, error) {
  5542. gensupport.SetOptions(c.urlParams_, opts...)
  5543. res, err := c.doRequest("json")
  5544. if res != nil && res.StatusCode == http.StatusNotModified {
  5545. if res.Body != nil {
  5546. res.Body.Close()
  5547. }
  5548. return nil, &googleapi.Error{
  5549. Code: res.StatusCode,
  5550. Header: res.Header,
  5551. }
  5552. }
  5553. if err != nil {
  5554. return nil, err
  5555. }
  5556. defer googleapi.CloseBody(res)
  5557. if err := googleapi.CheckResponse(res); err != nil {
  5558. return nil, err
  5559. }
  5560. ret := &Notification{
  5561. ServerResponse: googleapi.ServerResponse{
  5562. Header: res.Header,
  5563. HTTPStatusCode: res.StatusCode,
  5564. },
  5565. }
  5566. target := &ret
  5567. if err := gensupport.DecodeResponse(target, res); err != nil {
  5568. return nil, err
  5569. }
  5570. return ret, nil
  5571. // {
  5572. // "description": "View a notification configuration.",
  5573. // "httpMethod": "GET",
  5574. // "id": "storage.notifications.get",
  5575. // "parameterOrder": [
  5576. // "bucket",
  5577. // "notification"
  5578. // ],
  5579. // "parameters": {
  5580. // "bucket": {
  5581. // "description": "The parent bucket of the notification.",
  5582. // "location": "path",
  5583. // "required": true,
  5584. // "type": "string"
  5585. // },
  5586. // "notification": {
  5587. // "description": "Notification ID",
  5588. // "location": "path",
  5589. // "required": true,
  5590. // "type": "string"
  5591. // },
  5592. // "userProject": {
  5593. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  5594. // "location": "query",
  5595. // "type": "string"
  5596. // }
  5597. // },
  5598. // "path": "b/{bucket}/notificationConfigs/{notification}",
  5599. // "response": {
  5600. // "$ref": "Notification"
  5601. // },
  5602. // "scopes": [
  5603. // "https://www.googleapis.com/auth/cloud-platform",
  5604. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  5605. // "https://www.googleapis.com/auth/devstorage.full_control",
  5606. // "https://www.googleapis.com/auth/devstorage.read_only",
  5607. // "https://www.googleapis.com/auth/devstorage.read_write"
  5608. // ]
  5609. // }
  5610. }
  5611. // method id "storage.notifications.insert":
  5612. type NotificationsInsertCall struct {
  5613. s *Service
  5614. bucket string
  5615. notification *Notification
  5616. urlParams_ gensupport.URLParams
  5617. ctx_ context.Context
  5618. header_ http.Header
  5619. }
  5620. // Insert: Creates a notification subscription for a given bucket.
  5621. func (r *NotificationsService) Insert(bucket string, notification *Notification) *NotificationsInsertCall {
  5622. c := &NotificationsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5623. c.bucket = bucket
  5624. c.notification = notification
  5625. return c
  5626. }
  5627. // UserProject sets the optional parameter "userProject": The project to
  5628. // be billed for this request. Required for Requester Pays buckets.
  5629. func (c *NotificationsInsertCall) UserProject(userProject string) *NotificationsInsertCall {
  5630. c.urlParams_.Set("userProject", userProject)
  5631. return c
  5632. }
  5633. // Fields allows partial responses to be retrieved. See
  5634. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5635. // for more information.
  5636. func (c *NotificationsInsertCall) Fields(s ...googleapi.Field) *NotificationsInsertCall {
  5637. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5638. return c
  5639. }
  5640. // Context sets the context to be used in this call's Do method. Any
  5641. // pending HTTP request will be aborted if the provided context is
  5642. // canceled.
  5643. func (c *NotificationsInsertCall) Context(ctx context.Context) *NotificationsInsertCall {
  5644. c.ctx_ = ctx
  5645. return c
  5646. }
  5647. // Header returns an http.Header that can be modified by the caller to
  5648. // add HTTP headers to the request.
  5649. func (c *NotificationsInsertCall) Header() http.Header {
  5650. if c.header_ == nil {
  5651. c.header_ = make(http.Header)
  5652. }
  5653. return c.header_
  5654. }
  5655. func (c *NotificationsInsertCall) doRequest(alt string) (*http.Response, error) {
  5656. reqHeaders := make(http.Header)
  5657. for k, v := range c.header_ {
  5658. reqHeaders[k] = v
  5659. }
  5660. reqHeaders.Set("User-Agent", c.s.userAgent())
  5661. var body io.Reader = nil
  5662. body, err := googleapi.WithoutDataWrapper.JSONReader(c.notification)
  5663. if err != nil {
  5664. return nil, err
  5665. }
  5666. reqHeaders.Set("Content-Type", "application/json")
  5667. c.urlParams_.Set("alt", alt)
  5668. c.urlParams_.Set("prettyPrint", "false")
  5669. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/notificationConfigs")
  5670. urls += "?" + c.urlParams_.Encode()
  5671. req, err := http.NewRequest("POST", urls, body)
  5672. if err != nil {
  5673. return nil, err
  5674. }
  5675. req.Header = reqHeaders
  5676. googleapi.Expand(req.URL, map[string]string{
  5677. "bucket": c.bucket,
  5678. })
  5679. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5680. }
  5681. // Do executes the "storage.notifications.insert" call.
  5682. // Exactly one of *Notification or error will be non-nil. Any non-2xx
  5683. // status code is an error. Response headers are in either
  5684. // *Notification.ServerResponse.Header or (if a response was returned at
  5685. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  5686. // to check whether the returned error was because
  5687. // http.StatusNotModified was returned.
  5688. func (c *NotificationsInsertCall) Do(opts ...googleapi.CallOption) (*Notification, error) {
  5689. gensupport.SetOptions(c.urlParams_, opts...)
  5690. res, err := c.doRequest("json")
  5691. if res != nil && res.StatusCode == http.StatusNotModified {
  5692. if res.Body != nil {
  5693. res.Body.Close()
  5694. }
  5695. return nil, &googleapi.Error{
  5696. Code: res.StatusCode,
  5697. Header: res.Header,
  5698. }
  5699. }
  5700. if err != nil {
  5701. return nil, err
  5702. }
  5703. defer googleapi.CloseBody(res)
  5704. if err := googleapi.CheckResponse(res); err != nil {
  5705. return nil, err
  5706. }
  5707. ret := &Notification{
  5708. ServerResponse: googleapi.ServerResponse{
  5709. Header: res.Header,
  5710. HTTPStatusCode: res.StatusCode,
  5711. },
  5712. }
  5713. target := &ret
  5714. if err := gensupport.DecodeResponse(target, res); err != nil {
  5715. return nil, err
  5716. }
  5717. return ret, nil
  5718. // {
  5719. // "description": "Creates a notification subscription for a given bucket.",
  5720. // "httpMethod": "POST",
  5721. // "id": "storage.notifications.insert",
  5722. // "parameterOrder": [
  5723. // "bucket"
  5724. // ],
  5725. // "parameters": {
  5726. // "bucket": {
  5727. // "description": "The parent bucket of the notification.",
  5728. // "location": "path",
  5729. // "required": true,
  5730. // "type": "string"
  5731. // },
  5732. // "userProject": {
  5733. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  5734. // "location": "query",
  5735. // "type": "string"
  5736. // }
  5737. // },
  5738. // "path": "b/{bucket}/notificationConfigs",
  5739. // "request": {
  5740. // "$ref": "Notification"
  5741. // },
  5742. // "response": {
  5743. // "$ref": "Notification"
  5744. // },
  5745. // "scopes": [
  5746. // "https://www.googleapis.com/auth/cloud-platform",
  5747. // "https://www.googleapis.com/auth/devstorage.full_control",
  5748. // "https://www.googleapis.com/auth/devstorage.read_write"
  5749. // ]
  5750. // }
  5751. }
  5752. // method id "storage.notifications.list":
  5753. type NotificationsListCall struct {
  5754. s *Service
  5755. bucket string
  5756. urlParams_ gensupport.URLParams
  5757. ifNoneMatch_ string
  5758. ctx_ context.Context
  5759. header_ http.Header
  5760. }
  5761. // List: Retrieves a list of notification subscriptions for a given
  5762. // bucket.
  5763. func (r *NotificationsService) List(bucket string) *NotificationsListCall {
  5764. c := &NotificationsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5765. c.bucket = bucket
  5766. return c
  5767. }
  5768. // UserProject sets the optional parameter "userProject": The project to
  5769. // be billed for this request. Required for Requester Pays buckets.
  5770. func (c *NotificationsListCall) UserProject(userProject string) *NotificationsListCall {
  5771. c.urlParams_.Set("userProject", userProject)
  5772. return c
  5773. }
  5774. // Fields allows partial responses to be retrieved. See
  5775. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5776. // for more information.
  5777. func (c *NotificationsListCall) Fields(s ...googleapi.Field) *NotificationsListCall {
  5778. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5779. return c
  5780. }
  5781. // IfNoneMatch sets the optional parameter which makes the operation
  5782. // fail if the object's ETag matches the given value. This is useful for
  5783. // getting updates only after the object has changed since the last
  5784. // request. Use googleapi.IsNotModified to check whether the response
  5785. // error from Do is the result of In-None-Match.
  5786. func (c *NotificationsListCall) IfNoneMatch(entityTag string) *NotificationsListCall {
  5787. c.ifNoneMatch_ = entityTag
  5788. return c
  5789. }
  5790. // Context sets the context to be used in this call's Do method. Any
  5791. // pending HTTP request will be aborted if the provided context is
  5792. // canceled.
  5793. func (c *NotificationsListCall) Context(ctx context.Context) *NotificationsListCall {
  5794. c.ctx_ = ctx
  5795. return c
  5796. }
  5797. // Header returns an http.Header that can be modified by the caller to
  5798. // add HTTP headers to the request.
  5799. func (c *NotificationsListCall) Header() http.Header {
  5800. if c.header_ == nil {
  5801. c.header_ = make(http.Header)
  5802. }
  5803. return c.header_
  5804. }
  5805. func (c *NotificationsListCall) doRequest(alt string) (*http.Response, error) {
  5806. reqHeaders := make(http.Header)
  5807. for k, v := range c.header_ {
  5808. reqHeaders[k] = v
  5809. }
  5810. reqHeaders.Set("User-Agent", c.s.userAgent())
  5811. if c.ifNoneMatch_ != "" {
  5812. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  5813. }
  5814. var body io.Reader = nil
  5815. c.urlParams_.Set("alt", alt)
  5816. c.urlParams_.Set("prettyPrint", "false")
  5817. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/notificationConfigs")
  5818. urls += "?" + c.urlParams_.Encode()
  5819. req, err := http.NewRequest("GET", urls, body)
  5820. if err != nil {
  5821. return nil, err
  5822. }
  5823. req.Header = reqHeaders
  5824. googleapi.Expand(req.URL, map[string]string{
  5825. "bucket": c.bucket,
  5826. })
  5827. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5828. }
  5829. // Do executes the "storage.notifications.list" call.
  5830. // Exactly one of *Notifications or error will be non-nil. Any non-2xx
  5831. // status code is an error. Response headers are in either
  5832. // *Notifications.ServerResponse.Header or (if a response was returned
  5833. // at all) in error.(*googleapi.Error).Header. Use
  5834. // googleapi.IsNotModified to check whether the returned error was
  5835. // because http.StatusNotModified was returned.
  5836. func (c *NotificationsListCall) Do(opts ...googleapi.CallOption) (*Notifications, error) {
  5837. gensupport.SetOptions(c.urlParams_, opts...)
  5838. res, err := c.doRequest("json")
  5839. if res != nil && res.StatusCode == http.StatusNotModified {
  5840. if res.Body != nil {
  5841. res.Body.Close()
  5842. }
  5843. return nil, &googleapi.Error{
  5844. Code: res.StatusCode,
  5845. Header: res.Header,
  5846. }
  5847. }
  5848. if err != nil {
  5849. return nil, err
  5850. }
  5851. defer googleapi.CloseBody(res)
  5852. if err := googleapi.CheckResponse(res); err != nil {
  5853. return nil, err
  5854. }
  5855. ret := &Notifications{
  5856. ServerResponse: googleapi.ServerResponse{
  5857. Header: res.Header,
  5858. HTTPStatusCode: res.StatusCode,
  5859. },
  5860. }
  5861. target := &ret
  5862. if err := gensupport.DecodeResponse(target, res); err != nil {
  5863. return nil, err
  5864. }
  5865. return ret, nil
  5866. // {
  5867. // "description": "Retrieves a list of notification subscriptions for a given bucket.",
  5868. // "httpMethod": "GET",
  5869. // "id": "storage.notifications.list",
  5870. // "parameterOrder": [
  5871. // "bucket"
  5872. // ],
  5873. // "parameters": {
  5874. // "bucket": {
  5875. // "description": "Name of a Google Cloud Storage bucket.",
  5876. // "location": "path",
  5877. // "required": true,
  5878. // "type": "string"
  5879. // },
  5880. // "userProject": {
  5881. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  5882. // "location": "query",
  5883. // "type": "string"
  5884. // }
  5885. // },
  5886. // "path": "b/{bucket}/notificationConfigs",
  5887. // "response": {
  5888. // "$ref": "Notifications"
  5889. // },
  5890. // "scopes": [
  5891. // "https://www.googleapis.com/auth/cloud-platform",
  5892. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  5893. // "https://www.googleapis.com/auth/devstorage.full_control",
  5894. // "https://www.googleapis.com/auth/devstorage.read_only",
  5895. // "https://www.googleapis.com/auth/devstorage.read_write"
  5896. // ]
  5897. // }
  5898. }
  5899. // method id "storage.objectAccessControls.delete":
  5900. type ObjectAccessControlsDeleteCall struct {
  5901. s *Service
  5902. bucket string
  5903. object string
  5904. entity string
  5905. urlParams_ gensupport.URLParams
  5906. ctx_ context.Context
  5907. header_ http.Header
  5908. }
  5909. // Delete: Permanently deletes the ACL entry for the specified entity on
  5910. // the specified object.
  5911. func (r *ObjectAccessControlsService) Delete(bucket string, object string, entity string) *ObjectAccessControlsDeleteCall {
  5912. c := &ObjectAccessControlsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5913. c.bucket = bucket
  5914. c.object = object
  5915. c.entity = entity
  5916. return c
  5917. }
  5918. // Generation sets the optional parameter "generation": If present,
  5919. // selects a specific revision of this object (as opposed to the latest
  5920. // version, the default).
  5921. func (c *ObjectAccessControlsDeleteCall) Generation(generation int64) *ObjectAccessControlsDeleteCall {
  5922. c.urlParams_.Set("generation", fmt.Sprint(generation))
  5923. return c
  5924. }
  5925. // UserProject sets the optional parameter "userProject": The project to
  5926. // be billed for this request. Required for Requester Pays buckets.
  5927. func (c *ObjectAccessControlsDeleteCall) UserProject(userProject string) *ObjectAccessControlsDeleteCall {
  5928. c.urlParams_.Set("userProject", userProject)
  5929. return c
  5930. }
  5931. // Fields allows partial responses to be retrieved. See
  5932. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5933. // for more information.
  5934. func (c *ObjectAccessControlsDeleteCall) Fields(s ...googleapi.Field) *ObjectAccessControlsDeleteCall {
  5935. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5936. return c
  5937. }
  5938. // Context sets the context to be used in this call's Do method. Any
  5939. // pending HTTP request will be aborted if the provided context is
  5940. // canceled.
  5941. func (c *ObjectAccessControlsDeleteCall) Context(ctx context.Context) *ObjectAccessControlsDeleteCall {
  5942. c.ctx_ = ctx
  5943. return c
  5944. }
  5945. // Header returns an http.Header that can be modified by the caller to
  5946. // add HTTP headers to the request.
  5947. func (c *ObjectAccessControlsDeleteCall) Header() http.Header {
  5948. if c.header_ == nil {
  5949. c.header_ = make(http.Header)
  5950. }
  5951. return c.header_
  5952. }
  5953. func (c *ObjectAccessControlsDeleteCall) doRequest(alt string) (*http.Response, error) {
  5954. reqHeaders := make(http.Header)
  5955. for k, v := range c.header_ {
  5956. reqHeaders[k] = v
  5957. }
  5958. reqHeaders.Set("User-Agent", c.s.userAgent())
  5959. var body io.Reader = nil
  5960. c.urlParams_.Set("alt", alt)
  5961. c.urlParams_.Set("prettyPrint", "false")
  5962. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}/acl/{entity}")
  5963. urls += "?" + c.urlParams_.Encode()
  5964. req, err := http.NewRequest("DELETE", urls, body)
  5965. if err != nil {
  5966. return nil, err
  5967. }
  5968. req.Header = reqHeaders
  5969. googleapi.Expand(req.URL, map[string]string{
  5970. "bucket": c.bucket,
  5971. "object": c.object,
  5972. "entity": c.entity,
  5973. })
  5974. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5975. }
  5976. // Do executes the "storage.objectAccessControls.delete" call.
  5977. func (c *ObjectAccessControlsDeleteCall) Do(opts ...googleapi.CallOption) error {
  5978. gensupport.SetOptions(c.urlParams_, opts...)
  5979. res, err := c.doRequest("json")
  5980. if err != nil {
  5981. return err
  5982. }
  5983. defer googleapi.CloseBody(res)
  5984. if err := googleapi.CheckResponse(res); err != nil {
  5985. return err
  5986. }
  5987. return nil
  5988. // {
  5989. // "description": "Permanently deletes the ACL entry for the specified entity on the specified object.",
  5990. // "httpMethod": "DELETE",
  5991. // "id": "storage.objectAccessControls.delete",
  5992. // "parameterOrder": [
  5993. // "bucket",
  5994. // "object",
  5995. // "entity"
  5996. // ],
  5997. // "parameters": {
  5998. // "bucket": {
  5999. // "description": "Name of a bucket.",
  6000. // "location": "path",
  6001. // "required": true,
  6002. // "type": "string"
  6003. // },
  6004. // "entity": {
  6005. // "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.",
  6006. // "location": "path",
  6007. // "required": true,
  6008. // "type": "string"
  6009. // },
  6010. // "generation": {
  6011. // "description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).",
  6012. // "format": "int64",
  6013. // "location": "query",
  6014. // "type": "string"
  6015. // },
  6016. // "object": {
  6017. // "description": "Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
  6018. // "location": "path",
  6019. // "required": true,
  6020. // "type": "string"
  6021. // },
  6022. // "userProject": {
  6023. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  6024. // "location": "query",
  6025. // "type": "string"
  6026. // }
  6027. // },
  6028. // "path": "b/{bucket}/o/{object}/acl/{entity}",
  6029. // "scopes": [
  6030. // "https://www.googleapis.com/auth/cloud-platform",
  6031. // "https://www.googleapis.com/auth/devstorage.full_control"
  6032. // ]
  6033. // }
  6034. }
  6035. // method id "storage.objectAccessControls.get":
  6036. type ObjectAccessControlsGetCall struct {
  6037. s *Service
  6038. bucket string
  6039. object string
  6040. entity string
  6041. urlParams_ gensupport.URLParams
  6042. ifNoneMatch_ string
  6043. ctx_ context.Context
  6044. header_ http.Header
  6045. }
  6046. // Get: Returns the ACL entry for the specified entity on the specified
  6047. // object.
  6048. func (r *ObjectAccessControlsService) Get(bucket string, object string, entity string) *ObjectAccessControlsGetCall {
  6049. c := &ObjectAccessControlsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6050. c.bucket = bucket
  6051. c.object = object
  6052. c.entity = entity
  6053. return c
  6054. }
  6055. // Generation sets the optional parameter "generation": If present,
  6056. // selects a specific revision of this object (as opposed to the latest
  6057. // version, the default).
  6058. func (c *ObjectAccessControlsGetCall) Generation(generation int64) *ObjectAccessControlsGetCall {
  6059. c.urlParams_.Set("generation", fmt.Sprint(generation))
  6060. return c
  6061. }
  6062. // UserProject sets the optional parameter "userProject": The project to
  6063. // be billed for this request. Required for Requester Pays buckets.
  6064. func (c *ObjectAccessControlsGetCall) UserProject(userProject string) *ObjectAccessControlsGetCall {
  6065. c.urlParams_.Set("userProject", userProject)
  6066. return c
  6067. }
  6068. // Fields allows partial responses to be retrieved. See
  6069. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6070. // for more information.
  6071. func (c *ObjectAccessControlsGetCall) Fields(s ...googleapi.Field) *ObjectAccessControlsGetCall {
  6072. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6073. return c
  6074. }
  6075. // IfNoneMatch sets the optional parameter which makes the operation
  6076. // fail if the object's ETag matches the given value. This is useful for
  6077. // getting updates only after the object has changed since the last
  6078. // request. Use googleapi.IsNotModified to check whether the response
  6079. // error from Do is the result of In-None-Match.
  6080. func (c *ObjectAccessControlsGetCall) IfNoneMatch(entityTag string) *ObjectAccessControlsGetCall {
  6081. c.ifNoneMatch_ = entityTag
  6082. return c
  6083. }
  6084. // Context sets the context to be used in this call's Do method. Any
  6085. // pending HTTP request will be aborted if the provided context is
  6086. // canceled.
  6087. func (c *ObjectAccessControlsGetCall) Context(ctx context.Context) *ObjectAccessControlsGetCall {
  6088. c.ctx_ = ctx
  6089. return c
  6090. }
  6091. // Header returns an http.Header that can be modified by the caller to
  6092. // add HTTP headers to the request.
  6093. func (c *ObjectAccessControlsGetCall) Header() http.Header {
  6094. if c.header_ == nil {
  6095. c.header_ = make(http.Header)
  6096. }
  6097. return c.header_
  6098. }
  6099. func (c *ObjectAccessControlsGetCall) doRequest(alt string) (*http.Response, error) {
  6100. reqHeaders := make(http.Header)
  6101. for k, v := range c.header_ {
  6102. reqHeaders[k] = v
  6103. }
  6104. reqHeaders.Set("User-Agent", c.s.userAgent())
  6105. if c.ifNoneMatch_ != "" {
  6106. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  6107. }
  6108. var body io.Reader = nil
  6109. c.urlParams_.Set("alt", alt)
  6110. c.urlParams_.Set("prettyPrint", "false")
  6111. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}/acl/{entity}")
  6112. urls += "?" + c.urlParams_.Encode()
  6113. req, err := http.NewRequest("GET", urls, body)
  6114. if err != nil {
  6115. return nil, err
  6116. }
  6117. req.Header = reqHeaders
  6118. googleapi.Expand(req.URL, map[string]string{
  6119. "bucket": c.bucket,
  6120. "object": c.object,
  6121. "entity": c.entity,
  6122. })
  6123. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6124. }
  6125. // Do executes the "storage.objectAccessControls.get" call.
  6126. // Exactly one of *ObjectAccessControl or error will be non-nil. Any
  6127. // non-2xx status code is an error. Response headers are in either
  6128. // *ObjectAccessControl.ServerResponse.Header or (if a response was
  6129. // returned at all) in error.(*googleapi.Error).Header. Use
  6130. // googleapi.IsNotModified to check whether the returned error was
  6131. // because http.StatusNotModified was returned.
  6132. func (c *ObjectAccessControlsGetCall) Do(opts ...googleapi.CallOption) (*ObjectAccessControl, error) {
  6133. gensupport.SetOptions(c.urlParams_, opts...)
  6134. res, err := c.doRequest("json")
  6135. if res != nil && res.StatusCode == http.StatusNotModified {
  6136. if res.Body != nil {
  6137. res.Body.Close()
  6138. }
  6139. return nil, &googleapi.Error{
  6140. Code: res.StatusCode,
  6141. Header: res.Header,
  6142. }
  6143. }
  6144. if err != nil {
  6145. return nil, err
  6146. }
  6147. defer googleapi.CloseBody(res)
  6148. if err := googleapi.CheckResponse(res); err != nil {
  6149. return nil, err
  6150. }
  6151. ret := &ObjectAccessControl{
  6152. ServerResponse: googleapi.ServerResponse{
  6153. Header: res.Header,
  6154. HTTPStatusCode: res.StatusCode,
  6155. },
  6156. }
  6157. target := &ret
  6158. if err := gensupport.DecodeResponse(target, res); err != nil {
  6159. return nil, err
  6160. }
  6161. return ret, nil
  6162. // {
  6163. // "description": "Returns the ACL entry for the specified entity on the specified object.",
  6164. // "httpMethod": "GET",
  6165. // "id": "storage.objectAccessControls.get",
  6166. // "parameterOrder": [
  6167. // "bucket",
  6168. // "object",
  6169. // "entity"
  6170. // ],
  6171. // "parameters": {
  6172. // "bucket": {
  6173. // "description": "Name of a bucket.",
  6174. // "location": "path",
  6175. // "required": true,
  6176. // "type": "string"
  6177. // },
  6178. // "entity": {
  6179. // "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.",
  6180. // "location": "path",
  6181. // "required": true,
  6182. // "type": "string"
  6183. // },
  6184. // "generation": {
  6185. // "description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).",
  6186. // "format": "int64",
  6187. // "location": "query",
  6188. // "type": "string"
  6189. // },
  6190. // "object": {
  6191. // "description": "Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
  6192. // "location": "path",
  6193. // "required": true,
  6194. // "type": "string"
  6195. // },
  6196. // "userProject": {
  6197. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  6198. // "location": "query",
  6199. // "type": "string"
  6200. // }
  6201. // },
  6202. // "path": "b/{bucket}/o/{object}/acl/{entity}",
  6203. // "response": {
  6204. // "$ref": "ObjectAccessControl"
  6205. // },
  6206. // "scopes": [
  6207. // "https://www.googleapis.com/auth/cloud-platform",
  6208. // "https://www.googleapis.com/auth/devstorage.full_control"
  6209. // ]
  6210. // }
  6211. }
  6212. // method id "storage.objectAccessControls.insert":
  6213. type ObjectAccessControlsInsertCall struct {
  6214. s *Service
  6215. bucket string
  6216. object string
  6217. objectaccesscontrol *ObjectAccessControl
  6218. urlParams_ gensupport.URLParams
  6219. ctx_ context.Context
  6220. header_ http.Header
  6221. }
  6222. // Insert: Creates a new ACL entry on the specified object.
  6223. func (r *ObjectAccessControlsService) Insert(bucket string, object string, objectaccesscontrol *ObjectAccessControl) *ObjectAccessControlsInsertCall {
  6224. c := &ObjectAccessControlsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6225. c.bucket = bucket
  6226. c.object = object
  6227. c.objectaccesscontrol = objectaccesscontrol
  6228. return c
  6229. }
  6230. // Generation sets the optional parameter "generation": If present,
  6231. // selects a specific revision of this object (as opposed to the latest
  6232. // version, the default).
  6233. func (c *ObjectAccessControlsInsertCall) Generation(generation int64) *ObjectAccessControlsInsertCall {
  6234. c.urlParams_.Set("generation", fmt.Sprint(generation))
  6235. return c
  6236. }
  6237. // UserProject sets the optional parameter "userProject": The project to
  6238. // be billed for this request. Required for Requester Pays buckets.
  6239. func (c *ObjectAccessControlsInsertCall) UserProject(userProject string) *ObjectAccessControlsInsertCall {
  6240. c.urlParams_.Set("userProject", userProject)
  6241. return c
  6242. }
  6243. // Fields allows partial responses to be retrieved. See
  6244. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6245. // for more information.
  6246. func (c *ObjectAccessControlsInsertCall) Fields(s ...googleapi.Field) *ObjectAccessControlsInsertCall {
  6247. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6248. return c
  6249. }
  6250. // Context sets the context to be used in this call's Do method. Any
  6251. // pending HTTP request will be aborted if the provided context is
  6252. // canceled.
  6253. func (c *ObjectAccessControlsInsertCall) Context(ctx context.Context) *ObjectAccessControlsInsertCall {
  6254. c.ctx_ = ctx
  6255. return c
  6256. }
  6257. // Header returns an http.Header that can be modified by the caller to
  6258. // add HTTP headers to the request.
  6259. func (c *ObjectAccessControlsInsertCall) Header() http.Header {
  6260. if c.header_ == nil {
  6261. c.header_ = make(http.Header)
  6262. }
  6263. return c.header_
  6264. }
  6265. func (c *ObjectAccessControlsInsertCall) doRequest(alt string) (*http.Response, error) {
  6266. reqHeaders := make(http.Header)
  6267. for k, v := range c.header_ {
  6268. reqHeaders[k] = v
  6269. }
  6270. reqHeaders.Set("User-Agent", c.s.userAgent())
  6271. var body io.Reader = nil
  6272. body, err := googleapi.WithoutDataWrapper.JSONReader(c.objectaccesscontrol)
  6273. if err != nil {
  6274. return nil, err
  6275. }
  6276. reqHeaders.Set("Content-Type", "application/json")
  6277. c.urlParams_.Set("alt", alt)
  6278. c.urlParams_.Set("prettyPrint", "false")
  6279. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}/acl")
  6280. urls += "?" + c.urlParams_.Encode()
  6281. req, err := http.NewRequest("POST", urls, body)
  6282. if err != nil {
  6283. return nil, err
  6284. }
  6285. req.Header = reqHeaders
  6286. googleapi.Expand(req.URL, map[string]string{
  6287. "bucket": c.bucket,
  6288. "object": c.object,
  6289. })
  6290. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6291. }
  6292. // Do executes the "storage.objectAccessControls.insert" call.
  6293. // Exactly one of *ObjectAccessControl or error will be non-nil. Any
  6294. // non-2xx status code is an error. Response headers are in either
  6295. // *ObjectAccessControl.ServerResponse.Header or (if a response was
  6296. // returned at all) in error.(*googleapi.Error).Header. Use
  6297. // googleapi.IsNotModified to check whether the returned error was
  6298. // because http.StatusNotModified was returned.
  6299. func (c *ObjectAccessControlsInsertCall) Do(opts ...googleapi.CallOption) (*ObjectAccessControl, error) {
  6300. gensupport.SetOptions(c.urlParams_, opts...)
  6301. res, err := c.doRequest("json")
  6302. if res != nil && res.StatusCode == http.StatusNotModified {
  6303. if res.Body != nil {
  6304. res.Body.Close()
  6305. }
  6306. return nil, &googleapi.Error{
  6307. Code: res.StatusCode,
  6308. Header: res.Header,
  6309. }
  6310. }
  6311. if err != nil {
  6312. return nil, err
  6313. }
  6314. defer googleapi.CloseBody(res)
  6315. if err := googleapi.CheckResponse(res); err != nil {
  6316. return nil, err
  6317. }
  6318. ret := &ObjectAccessControl{
  6319. ServerResponse: googleapi.ServerResponse{
  6320. Header: res.Header,
  6321. HTTPStatusCode: res.StatusCode,
  6322. },
  6323. }
  6324. target := &ret
  6325. if err := gensupport.DecodeResponse(target, res); err != nil {
  6326. return nil, err
  6327. }
  6328. return ret, nil
  6329. // {
  6330. // "description": "Creates a new ACL entry on the specified object.",
  6331. // "httpMethod": "POST",
  6332. // "id": "storage.objectAccessControls.insert",
  6333. // "parameterOrder": [
  6334. // "bucket",
  6335. // "object"
  6336. // ],
  6337. // "parameters": {
  6338. // "bucket": {
  6339. // "description": "Name of a bucket.",
  6340. // "location": "path",
  6341. // "required": true,
  6342. // "type": "string"
  6343. // },
  6344. // "generation": {
  6345. // "description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).",
  6346. // "format": "int64",
  6347. // "location": "query",
  6348. // "type": "string"
  6349. // },
  6350. // "object": {
  6351. // "description": "Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
  6352. // "location": "path",
  6353. // "required": true,
  6354. // "type": "string"
  6355. // },
  6356. // "userProject": {
  6357. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  6358. // "location": "query",
  6359. // "type": "string"
  6360. // }
  6361. // },
  6362. // "path": "b/{bucket}/o/{object}/acl",
  6363. // "request": {
  6364. // "$ref": "ObjectAccessControl"
  6365. // },
  6366. // "response": {
  6367. // "$ref": "ObjectAccessControl"
  6368. // },
  6369. // "scopes": [
  6370. // "https://www.googleapis.com/auth/cloud-platform",
  6371. // "https://www.googleapis.com/auth/devstorage.full_control"
  6372. // ]
  6373. // }
  6374. }
  6375. // method id "storage.objectAccessControls.list":
  6376. type ObjectAccessControlsListCall struct {
  6377. s *Service
  6378. bucket string
  6379. object string
  6380. urlParams_ gensupport.URLParams
  6381. ifNoneMatch_ string
  6382. ctx_ context.Context
  6383. header_ http.Header
  6384. }
  6385. // List: Retrieves ACL entries on the specified object.
  6386. func (r *ObjectAccessControlsService) List(bucket string, object string) *ObjectAccessControlsListCall {
  6387. c := &ObjectAccessControlsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6388. c.bucket = bucket
  6389. c.object = object
  6390. return c
  6391. }
  6392. // Generation sets the optional parameter "generation": If present,
  6393. // selects a specific revision of this object (as opposed to the latest
  6394. // version, the default).
  6395. func (c *ObjectAccessControlsListCall) Generation(generation int64) *ObjectAccessControlsListCall {
  6396. c.urlParams_.Set("generation", fmt.Sprint(generation))
  6397. return c
  6398. }
  6399. // UserProject sets the optional parameter "userProject": The project to
  6400. // be billed for this request. Required for Requester Pays buckets.
  6401. func (c *ObjectAccessControlsListCall) UserProject(userProject string) *ObjectAccessControlsListCall {
  6402. c.urlParams_.Set("userProject", userProject)
  6403. return c
  6404. }
  6405. // Fields allows partial responses to be retrieved. See
  6406. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6407. // for more information.
  6408. func (c *ObjectAccessControlsListCall) Fields(s ...googleapi.Field) *ObjectAccessControlsListCall {
  6409. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6410. return c
  6411. }
  6412. // IfNoneMatch sets the optional parameter which makes the operation
  6413. // fail if the object's ETag matches the given value. This is useful for
  6414. // getting updates only after the object has changed since the last
  6415. // request. Use googleapi.IsNotModified to check whether the response
  6416. // error from Do is the result of In-None-Match.
  6417. func (c *ObjectAccessControlsListCall) IfNoneMatch(entityTag string) *ObjectAccessControlsListCall {
  6418. c.ifNoneMatch_ = entityTag
  6419. return c
  6420. }
  6421. // Context sets the context to be used in this call's Do method. Any
  6422. // pending HTTP request will be aborted if the provided context is
  6423. // canceled.
  6424. func (c *ObjectAccessControlsListCall) Context(ctx context.Context) *ObjectAccessControlsListCall {
  6425. c.ctx_ = ctx
  6426. return c
  6427. }
  6428. // Header returns an http.Header that can be modified by the caller to
  6429. // add HTTP headers to the request.
  6430. func (c *ObjectAccessControlsListCall) Header() http.Header {
  6431. if c.header_ == nil {
  6432. c.header_ = make(http.Header)
  6433. }
  6434. return c.header_
  6435. }
  6436. func (c *ObjectAccessControlsListCall) doRequest(alt string) (*http.Response, error) {
  6437. reqHeaders := make(http.Header)
  6438. for k, v := range c.header_ {
  6439. reqHeaders[k] = v
  6440. }
  6441. reqHeaders.Set("User-Agent", c.s.userAgent())
  6442. if c.ifNoneMatch_ != "" {
  6443. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  6444. }
  6445. var body io.Reader = nil
  6446. c.urlParams_.Set("alt", alt)
  6447. c.urlParams_.Set("prettyPrint", "false")
  6448. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}/acl")
  6449. urls += "?" + c.urlParams_.Encode()
  6450. req, err := http.NewRequest("GET", urls, body)
  6451. if err != nil {
  6452. return nil, err
  6453. }
  6454. req.Header = reqHeaders
  6455. googleapi.Expand(req.URL, map[string]string{
  6456. "bucket": c.bucket,
  6457. "object": c.object,
  6458. })
  6459. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6460. }
  6461. // Do executes the "storage.objectAccessControls.list" call.
  6462. // Exactly one of *ObjectAccessControls or error will be non-nil. Any
  6463. // non-2xx status code is an error. Response headers are in either
  6464. // *ObjectAccessControls.ServerResponse.Header or (if a response was
  6465. // returned at all) in error.(*googleapi.Error).Header. Use
  6466. // googleapi.IsNotModified to check whether the returned error was
  6467. // because http.StatusNotModified was returned.
  6468. func (c *ObjectAccessControlsListCall) Do(opts ...googleapi.CallOption) (*ObjectAccessControls, error) {
  6469. gensupport.SetOptions(c.urlParams_, opts...)
  6470. res, err := c.doRequest("json")
  6471. if res != nil && res.StatusCode == http.StatusNotModified {
  6472. if res.Body != nil {
  6473. res.Body.Close()
  6474. }
  6475. return nil, &googleapi.Error{
  6476. Code: res.StatusCode,
  6477. Header: res.Header,
  6478. }
  6479. }
  6480. if err != nil {
  6481. return nil, err
  6482. }
  6483. defer googleapi.CloseBody(res)
  6484. if err := googleapi.CheckResponse(res); err != nil {
  6485. return nil, err
  6486. }
  6487. ret := &ObjectAccessControls{
  6488. ServerResponse: googleapi.ServerResponse{
  6489. Header: res.Header,
  6490. HTTPStatusCode: res.StatusCode,
  6491. },
  6492. }
  6493. target := &ret
  6494. if err := gensupport.DecodeResponse(target, res); err != nil {
  6495. return nil, err
  6496. }
  6497. return ret, nil
  6498. // {
  6499. // "description": "Retrieves ACL entries on the specified object.",
  6500. // "httpMethod": "GET",
  6501. // "id": "storage.objectAccessControls.list",
  6502. // "parameterOrder": [
  6503. // "bucket",
  6504. // "object"
  6505. // ],
  6506. // "parameters": {
  6507. // "bucket": {
  6508. // "description": "Name of a bucket.",
  6509. // "location": "path",
  6510. // "required": true,
  6511. // "type": "string"
  6512. // },
  6513. // "generation": {
  6514. // "description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).",
  6515. // "format": "int64",
  6516. // "location": "query",
  6517. // "type": "string"
  6518. // },
  6519. // "object": {
  6520. // "description": "Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
  6521. // "location": "path",
  6522. // "required": true,
  6523. // "type": "string"
  6524. // },
  6525. // "userProject": {
  6526. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  6527. // "location": "query",
  6528. // "type": "string"
  6529. // }
  6530. // },
  6531. // "path": "b/{bucket}/o/{object}/acl",
  6532. // "response": {
  6533. // "$ref": "ObjectAccessControls"
  6534. // },
  6535. // "scopes": [
  6536. // "https://www.googleapis.com/auth/cloud-platform",
  6537. // "https://www.googleapis.com/auth/devstorage.full_control"
  6538. // ]
  6539. // }
  6540. }
  6541. // method id "storage.objectAccessControls.patch":
  6542. type ObjectAccessControlsPatchCall struct {
  6543. s *Service
  6544. bucket string
  6545. object string
  6546. entity string
  6547. objectaccesscontrol *ObjectAccessControl
  6548. urlParams_ gensupport.URLParams
  6549. ctx_ context.Context
  6550. header_ http.Header
  6551. }
  6552. // Patch: Patches an ACL entry on the specified object.
  6553. func (r *ObjectAccessControlsService) Patch(bucket string, object string, entity string, objectaccesscontrol *ObjectAccessControl) *ObjectAccessControlsPatchCall {
  6554. c := &ObjectAccessControlsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6555. c.bucket = bucket
  6556. c.object = object
  6557. c.entity = entity
  6558. c.objectaccesscontrol = objectaccesscontrol
  6559. return c
  6560. }
  6561. // Generation sets the optional parameter "generation": If present,
  6562. // selects a specific revision of this object (as opposed to the latest
  6563. // version, the default).
  6564. func (c *ObjectAccessControlsPatchCall) Generation(generation int64) *ObjectAccessControlsPatchCall {
  6565. c.urlParams_.Set("generation", fmt.Sprint(generation))
  6566. return c
  6567. }
  6568. // UserProject sets the optional parameter "userProject": The project to
  6569. // be billed for this request. Required for Requester Pays buckets.
  6570. func (c *ObjectAccessControlsPatchCall) UserProject(userProject string) *ObjectAccessControlsPatchCall {
  6571. c.urlParams_.Set("userProject", userProject)
  6572. return c
  6573. }
  6574. // Fields allows partial responses to be retrieved. See
  6575. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6576. // for more information.
  6577. func (c *ObjectAccessControlsPatchCall) Fields(s ...googleapi.Field) *ObjectAccessControlsPatchCall {
  6578. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6579. return c
  6580. }
  6581. // Context sets the context to be used in this call's Do method. Any
  6582. // pending HTTP request will be aborted if the provided context is
  6583. // canceled.
  6584. func (c *ObjectAccessControlsPatchCall) Context(ctx context.Context) *ObjectAccessControlsPatchCall {
  6585. c.ctx_ = ctx
  6586. return c
  6587. }
  6588. // Header returns an http.Header that can be modified by the caller to
  6589. // add HTTP headers to the request.
  6590. func (c *ObjectAccessControlsPatchCall) Header() http.Header {
  6591. if c.header_ == nil {
  6592. c.header_ = make(http.Header)
  6593. }
  6594. return c.header_
  6595. }
  6596. func (c *ObjectAccessControlsPatchCall) doRequest(alt string) (*http.Response, error) {
  6597. reqHeaders := make(http.Header)
  6598. for k, v := range c.header_ {
  6599. reqHeaders[k] = v
  6600. }
  6601. reqHeaders.Set("User-Agent", c.s.userAgent())
  6602. var body io.Reader = nil
  6603. body, err := googleapi.WithoutDataWrapper.JSONReader(c.objectaccesscontrol)
  6604. if err != nil {
  6605. return nil, err
  6606. }
  6607. reqHeaders.Set("Content-Type", "application/json")
  6608. c.urlParams_.Set("alt", alt)
  6609. c.urlParams_.Set("prettyPrint", "false")
  6610. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}/acl/{entity}")
  6611. urls += "?" + c.urlParams_.Encode()
  6612. req, err := http.NewRequest("PATCH", urls, body)
  6613. if err != nil {
  6614. return nil, err
  6615. }
  6616. req.Header = reqHeaders
  6617. googleapi.Expand(req.URL, map[string]string{
  6618. "bucket": c.bucket,
  6619. "object": c.object,
  6620. "entity": c.entity,
  6621. })
  6622. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6623. }
  6624. // Do executes the "storage.objectAccessControls.patch" call.
  6625. // Exactly one of *ObjectAccessControl or error will be non-nil. Any
  6626. // non-2xx status code is an error. Response headers are in either
  6627. // *ObjectAccessControl.ServerResponse.Header or (if a response was
  6628. // returned at all) in error.(*googleapi.Error).Header. Use
  6629. // googleapi.IsNotModified to check whether the returned error was
  6630. // because http.StatusNotModified was returned.
  6631. func (c *ObjectAccessControlsPatchCall) Do(opts ...googleapi.CallOption) (*ObjectAccessControl, error) {
  6632. gensupport.SetOptions(c.urlParams_, opts...)
  6633. res, err := c.doRequest("json")
  6634. if res != nil && res.StatusCode == http.StatusNotModified {
  6635. if res.Body != nil {
  6636. res.Body.Close()
  6637. }
  6638. return nil, &googleapi.Error{
  6639. Code: res.StatusCode,
  6640. Header: res.Header,
  6641. }
  6642. }
  6643. if err != nil {
  6644. return nil, err
  6645. }
  6646. defer googleapi.CloseBody(res)
  6647. if err := googleapi.CheckResponse(res); err != nil {
  6648. return nil, err
  6649. }
  6650. ret := &ObjectAccessControl{
  6651. ServerResponse: googleapi.ServerResponse{
  6652. Header: res.Header,
  6653. HTTPStatusCode: res.StatusCode,
  6654. },
  6655. }
  6656. target := &ret
  6657. if err := gensupport.DecodeResponse(target, res); err != nil {
  6658. return nil, err
  6659. }
  6660. return ret, nil
  6661. // {
  6662. // "description": "Patches an ACL entry on the specified object.",
  6663. // "httpMethod": "PATCH",
  6664. // "id": "storage.objectAccessControls.patch",
  6665. // "parameterOrder": [
  6666. // "bucket",
  6667. // "object",
  6668. // "entity"
  6669. // ],
  6670. // "parameters": {
  6671. // "bucket": {
  6672. // "description": "Name of a bucket.",
  6673. // "location": "path",
  6674. // "required": true,
  6675. // "type": "string"
  6676. // },
  6677. // "entity": {
  6678. // "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.",
  6679. // "location": "path",
  6680. // "required": true,
  6681. // "type": "string"
  6682. // },
  6683. // "generation": {
  6684. // "description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).",
  6685. // "format": "int64",
  6686. // "location": "query",
  6687. // "type": "string"
  6688. // },
  6689. // "object": {
  6690. // "description": "Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
  6691. // "location": "path",
  6692. // "required": true,
  6693. // "type": "string"
  6694. // },
  6695. // "userProject": {
  6696. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  6697. // "location": "query",
  6698. // "type": "string"
  6699. // }
  6700. // },
  6701. // "path": "b/{bucket}/o/{object}/acl/{entity}",
  6702. // "request": {
  6703. // "$ref": "ObjectAccessControl"
  6704. // },
  6705. // "response": {
  6706. // "$ref": "ObjectAccessControl"
  6707. // },
  6708. // "scopes": [
  6709. // "https://www.googleapis.com/auth/cloud-platform",
  6710. // "https://www.googleapis.com/auth/devstorage.full_control"
  6711. // ]
  6712. // }
  6713. }
  6714. // method id "storage.objectAccessControls.update":
  6715. type ObjectAccessControlsUpdateCall struct {
  6716. s *Service
  6717. bucket string
  6718. object string
  6719. entity string
  6720. objectaccesscontrol *ObjectAccessControl
  6721. urlParams_ gensupport.URLParams
  6722. ctx_ context.Context
  6723. header_ http.Header
  6724. }
  6725. // Update: Updates an ACL entry on the specified object.
  6726. func (r *ObjectAccessControlsService) Update(bucket string, object string, entity string, objectaccesscontrol *ObjectAccessControl) *ObjectAccessControlsUpdateCall {
  6727. c := &ObjectAccessControlsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6728. c.bucket = bucket
  6729. c.object = object
  6730. c.entity = entity
  6731. c.objectaccesscontrol = objectaccesscontrol
  6732. return c
  6733. }
  6734. // Generation sets the optional parameter "generation": If present,
  6735. // selects a specific revision of this object (as opposed to the latest
  6736. // version, the default).
  6737. func (c *ObjectAccessControlsUpdateCall) Generation(generation int64) *ObjectAccessControlsUpdateCall {
  6738. c.urlParams_.Set("generation", fmt.Sprint(generation))
  6739. return c
  6740. }
  6741. // UserProject sets the optional parameter "userProject": The project to
  6742. // be billed for this request. Required for Requester Pays buckets.
  6743. func (c *ObjectAccessControlsUpdateCall) UserProject(userProject string) *ObjectAccessControlsUpdateCall {
  6744. c.urlParams_.Set("userProject", userProject)
  6745. return c
  6746. }
  6747. // Fields allows partial responses to be retrieved. See
  6748. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6749. // for more information.
  6750. func (c *ObjectAccessControlsUpdateCall) Fields(s ...googleapi.Field) *ObjectAccessControlsUpdateCall {
  6751. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6752. return c
  6753. }
  6754. // Context sets the context to be used in this call's Do method. Any
  6755. // pending HTTP request will be aborted if the provided context is
  6756. // canceled.
  6757. func (c *ObjectAccessControlsUpdateCall) Context(ctx context.Context) *ObjectAccessControlsUpdateCall {
  6758. c.ctx_ = ctx
  6759. return c
  6760. }
  6761. // Header returns an http.Header that can be modified by the caller to
  6762. // add HTTP headers to the request.
  6763. func (c *ObjectAccessControlsUpdateCall) Header() http.Header {
  6764. if c.header_ == nil {
  6765. c.header_ = make(http.Header)
  6766. }
  6767. return c.header_
  6768. }
  6769. func (c *ObjectAccessControlsUpdateCall) doRequest(alt string) (*http.Response, error) {
  6770. reqHeaders := make(http.Header)
  6771. for k, v := range c.header_ {
  6772. reqHeaders[k] = v
  6773. }
  6774. reqHeaders.Set("User-Agent", c.s.userAgent())
  6775. var body io.Reader = nil
  6776. body, err := googleapi.WithoutDataWrapper.JSONReader(c.objectaccesscontrol)
  6777. if err != nil {
  6778. return nil, err
  6779. }
  6780. reqHeaders.Set("Content-Type", "application/json")
  6781. c.urlParams_.Set("alt", alt)
  6782. c.urlParams_.Set("prettyPrint", "false")
  6783. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}/acl/{entity}")
  6784. urls += "?" + c.urlParams_.Encode()
  6785. req, err := http.NewRequest("PUT", urls, body)
  6786. if err != nil {
  6787. return nil, err
  6788. }
  6789. req.Header = reqHeaders
  6790. googleapi.Expand(req.URL, map[string]string{
  6791. "bucket": c.bucket,
  6792. "object": c.object,
  6793. "entity": c.entity,
  6794. })
  6795. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6796. }
  6797. // Do executes the "storage.objectAccessControls.update" call.
  6798. // Exactly one of *ObjectAccessControl or error will be non-nil. Any
  6799. // non-2xx status code is an error. Response headers are in either
  6800. // *ObjectAccessControl.ServerResponse.Header or (if a response was
  6801. // returned at all) in error.(*googleapi.Error).Header. Use
  6802. // googleapi.IsNotModified to check whether the returned error was
  6803. // because http.StatusNotModified was returned.
  6804. func (c *ObjectAccessControlsUpdateCall) Do(opts ...googleapi.CallOption) (*ObjectAccessControl, error) {
  6805. gensupport.SetOptions(c.urlParams_, opts...)
  6806. res, err := c.doRequest("json")
  6807. if res != nil && res.StatusCode == http.StatusNotModified {
  6808. if res.Body != nil {
  6809. res.Body.Close()
  6810. }
  6811. return nil, &googleapi.Error{
  6812. Code: res.StatusCode,
  6813. Header: res.Header,
  6814. }
  6815. }
  6816. if err != nil {
  6817. return nil, err
  6818. }
  6819. defer googleapi.CloseBody(res)
  6820. if err := googleapi.CheckResponse(res); err != nil {
  6821. return nil, err
  6822. }
  6823. ret := &ObjectAccessControl{
  6824. ServerResponse: googleapi.ServerResponse{
  6825. Header: res.Header,
  6826. HTTPStatusCode: res.StatusCode,
  6827. },
  6828. }
  6829. target := &ret
  6830. if err := gensupport.DecodeResponse(target, res); err != nil {
  6831. return nil, err
  6832. }
  6833. return ret, nil
  6834. // {
  6835. // "description": "Updates an ACL entry on the specified object.",
  6836. // "httpMethod": "PUT",
  6837. // "id": "storage.objectAccessControls.update",
  6838. // "parameterOrder": [
  6839. // "bucket",
  6840. // "object",
  6841. // "entity"
  6842. // ],
  6843. // "parameters": {
  6844. // "bucket": {
  6845. // "description": "Name of a bucket.",
  6846. // "location": "path",
  6847. // "required": true,
  6848. // "type": "string"
  6849. // },
  6850. // "entity": {
  6851. // "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.",
  6852. // "location": "path",
  6853. // "required": true,
  6854. // "type": "string"
  6855. // },
  6856. // "generation": {
  6857. // "description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).",
  6858. // "format": "int64",
  6859. // "location": "query",
  6860. // "type": "string"
  6861. // },
  6862. // "object": {
  6863. // "description": "Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
  6864. // "location": "path",
  6865. // "required": true,
  6866. // "type": "string"
  6867. // },
  6868. // "userProject": {
  6869. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  6870. // "location": "query",
  6871. // "type": "string"
  6872. // }
  6873. // },
  6874. // "path": "b/{bucket}/o/{object}/acl/{entity}",
  6875. // "request": {
  6876. // "$ref": "ObjectAccessControl"
  6877. // },
  6878. // "response": {
  6879. // "$ref": "ObjectAccessControl"
  6880. // },
  6881. // "scopes": [
  6882. // "https://www.googleapis.com/auth/cloud-platform",
  6883. // "https://www.googleapis.com/auth/devstorage.full_control"
  6884. // ]
  6885. // }
  6886. }
  6887. // method id "storage.objects.compose":
  6888. type ObjectsComposeCall struct {
  6889. s *Service
  6890. destinationBucket string
  6891. destinationObject string
  6892. composerequest *ComposeRequest
  6893. urlParams_ gensupport.URLParams
  6894. ctx_ context.Context
  6895. header_ http.Header
  6896. }
  6897. // Compose: Concatenates a list of existing objects into a new object in
  6898. // the same bucket.
  6899. func (r *ObjectsService) Compose(destinationBucket string, destinationObject string, composerequest *ComposeRequest) *ObjectsComposeCall {
  6900. c := &ObjectsComposeCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6901. c.destinationBucket = destinationBucket
  6902. c.destinationObject = destinationObject
  6903. c.composerequest = composerequest
  6904. return c
  6905. }
  6906. // DestinationPredefinedAcl sets the optional parameter
  6907. // "destinationPredefinedAcl": Apply a predefined set of access controls
  6908. // to the destination object.
  6909. //
  6910. // Possible values:
  6911. // "authenticatedRead" - Object owner gets OWNER access, and
  6912. // allAuthenticatedUsers get READER access.
  6913. // "bucketOwnerFullControl" - Object owner gets OWNER access, and
  6914. // project team owners get OWNER access.
  6915. // "bucketOwnerRead" - Object owner gets OWNER access, and project
  6916. // team owners get READER access.
  6917. // "private" - Object owner gets OWNER access.
  6918. // "projectPrivate" - Object owner gets OWNER access, and project team
  6919. // members get access according to their roles.
  6920. // "publicRead" - Object owner gets OWNER access, and allUsers get
  6921. // READER access.
  6922. func (c *ObjectsComposeCall) DestinationPredefinedAcl(destinationPredefinedAcl string) *ObjectsComposeCall {
  6923. c.urlParams_.Set("destinationPredefinedAcl", destinationPredefinedAcl)
  6924. return c
  6925. }
  6926. // IfGenerationMatch sets the optional parameter "ifGenerationMatch":
  6927. // Makes the operation conditional on whether the object's current
  6928. // generation matches the given value. Setting to 0 makes the operation
  6929. // succeed only if there are no live versions of the object.
  6930. func (c *ObjectsComposeCall) IfGenerationMatch(ifGenerationMatch int64) *ObjectsComposeCall {
  6931. c.urlParams_.Set("ifGenerationMatch", fmt.Sprint(ifGenerationMatch))
  6932. return c
  6933. }
  6934. // IfMetagenerationMatch sets the optional parameter
  6935. // "ifMetagenerationMatch": Makes the operation conditional on whether
  6936. // the object's current metageneration matches the given value.
  6937. func (c *ObjectsComposeCall) IfMetagenerationMatch(ifMetagenerationMatch int64) *ObjectsComposeCall {
  6938. c.urlParams_.Set("ifMetagenerationMatch", fmt.Sprint(ifMetagenerationMatch))
  6939. return c
  6940. }
  6941. // KmsKeyName sets the optional parameter "kmsKeyName": Resource name of
  6942. // the Cloud KMS key, of the form
  6943. // projects/my-project/locations/global/keyRings/my-kr/cryptoKeys/my-key,
  6944. // that will be used to encrypt the object. Overrides the object
  6945. // metadata's kms_key_name value, if any.
  6946. func (c *ObjectsComposeCall) KmsKeyName(kmsKeyName string) *ObjectsComposeCall {
  6947. c.urlParams_.Set("kmsKeyName", kmsKeyName)
  6948. return c
  6949. }
  6950. // UserProject sets the optional parameter "userProject": The project to
  6951. // be billed for this request. Required for Requester Pays buckets.
  6952. func (c *ObjectsComposeCall) UserProject(userProject string) *ObjectsComposeCall {
  6953. c.urlParams_.Set("userProject", userProject)
  6954. return c
  6955. }
  6956. // Fields allows partial responses to be retrieved. See
  6957. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6958. // for more information.
  6959. func (c *ObjectsComposeCall) Fields(s ...googleapi.Field) *ObjectsComposeCall {
  6960. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6961. return c
  6962. }
  6963. // Context sets the context to be used in this call's Do method. Any
  6964. // pending HTTP request will be aborted if the provided context is
  6965. // canceled.
  6966. func (c *ObjectsComposeCall) Context(ctx context.Context) *ObjectsComposeCall {
  6967. c.ctx_ = ctx
  6968. return c
  6969. }
  6970. // Header returns an http.Header that can be modified by the caller to
  6971. // add HTTP headers to the request.
  6972. func (c *ObjectsComposeCall) Header() http.Header {
  6973. if c.header_ == nil {
  6974. c.header_ = make(http.Header)
  6975. }
  6976. return c.header_
  6977. }
  6978. func (c *ObjectsComposeCall) doRequest(alt string) (*http.Response, error) {
  6979. reqHeaders := make(http.Header)
  6980. for k, v := range c.header_ {
  6981. reqHeaders[k] = v
  6982. }
  6983. reqHeaders.Set("User-Agent", c.s.userAgent())
  6984. var body io.Reader = nil
  6985. body, err := googleapi.WithoutDataWrapper.JSONReader(c.composerequest)
  6986. if err != nil {
  6987. return nil, err
  6988. }
  6989. reqHeaders.Set("Content-Type", "application/json")
  6990. c.urlParams_.Set("alt", alt)
  6991. c.urlParams_.Set("prettyPrint", "false")
  6992. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{destinationBucket}/o/{destinationObject}/compose")
  6993. urls += "?" + c.urlParams_.Encode()
  6994. req, err := http.NewRequest("POST", urls, body)
  6995. if err != nil {
  6996. return nil, err
  6997. }
  6998. req.Header = reqHeaders
  6999. googleapi.Expand(req.URL, map[string]string{
  7000. "destinationBucket": c.destinationBucket,
  7001. "destinationObject": c.destinationObject,
  7002. })
  7003. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7004. }
  7005. // Do executes the "storage.objects.compose" call.
  7006. // Exactly one of *Object or error will be non-nil. Any non-2xx status
  7007. // code is an error. Response headers are in either
  7008. // *Object.ServerResponse.Header or (if a response was returned at all)
  7009. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  7010. // check whether the returned error was because http.StatusNotModified
  7011. // was returned.
  7012. func (c *ObjectsComposeCall) Do(opts ...googleapi.CallOption) (*Object, error) {
  7013. gensupport.SetOptions(c.urlParams_, opts...)
  7014. res, err := c.doRequest("json")
  7015. if res != nil && res.StatusCode == http.StatusNotModified {
  7016. if res.Body != nil {
  7017. res.Body.Close()
  7018. }
  7019. return nil, &googleapi.Error{
  7020. Code: res.StatusCode,
  7021. Header: res.Header,
  7022. }
  7023. }
  7024. if err != nil {
  7025. return nil, err
  7026. }
  7027. defer googleapi.CloseBody(res)
  7028. if err := googleapi.CheckResponse(res); err != nil {
  7029. return nil, err
  7030. }
  7031. ret := &Object{
  7032. ServerResponse: googleapi.ServerResponse{
  7033. Header: res.Header,
  7034. HTTPStatusCode: res.StatusCode,
  7035. },
  7036. }
  7037. target := &ret
  7038. if err := gensupport.DecodeResponse(target, res); err != nil {
  7039. return nil, err
  7040. }
  7041. return ret, nil
  7042. // {
  7043. // "description": "Concatenates a list of existing objects into a new object in the same bucket.",
  7044. // "httpMethod": "POST",
  7045. // "id": "storage.objects.compose",
  7046. // "parameterOrder": [
  7047. // "destinationBucket",
  7048. // "destinationObject"
  7049. // ],
  7050. // "parameters": {
  7051. // "destinationBucket": {
  7052. // "description": "Name of the bucket containing the source objects. The destination object is stored in this bucket.",
  7053. // "location": "path",
  7054. // "required": true,
  7055. // "type": "string"
  7056. // },
  7057. // "destinationObject": {
  7058. // "description": "Name of the new object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
  7059. // "location": "path",
  7060. // "required": true,
  7061. // "type": "string"
  7062. // },
  7063. // "destinationPredefinedAcl": {
  7064. // "description": "Apply a predefined set of access controls to the destination object.",
  7065. // "enum": [
  7066. // "authenticatedRead",
  7067. // "bucketOwnerFullControl",
  7068. // "bucketOwnerRead",
  7069. // "private",
  7070. // "projectPrivate",
  7071. // "publicRead"
  7072. // ],
  7073. // "enumDescriptions": [
  7074. // "Object owner gets OWNER access, and allAuthenticatedUsers get READER access.",
  7075. // "Object owner gets OWNER access, and project team owners get OWNER access.",
  7076. // "Object owner gets OWNER access, and project team owners get READER access.",
  7077. // "Object owner gets OWNER access.",
  7078. // "Object owner gets OWNER access, and project team members get access according to their roles.",
  7079. // "Object owner gets OWNER access, and allUsers get READER access."
  7080. // ],
  7081. // "location": "query",
  7082. // "type": "string"
  7083. // },
  7084. // "ifGenerationMatch": {
  7085. // "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.",
  7086. // "format": "int64",
  7087. // "location": "query",
  7088. // "type": "string"
  7089. // },
  7090. // "ifMetagenerationMatch": {
  7091. // "description": "Makes the operation conditional on whether the object's current metageneration matches the given value.",
  7092. // "format": "int64",
  7093. // "location": "query",
  7094. // "type": "string"
  7095. // },
  7096. // "kmsKeyName": {
  7097. // "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.",
  7098. // "location": "query",
  7099. // "type": "string"
  7100. // },
  7101. // "userProject": {
  7102. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  7103. // "location": "query",
  7104. // "type": "string"
  7105. // }
  7106. // },
  7107. // "path": "b/{destinationBucket}/o/{destinationObject}/compose",
  7108. // "request": {
  7109. // "$ref": "ComposeRequest"
  7110. // },
  7111. // "response": {
  7112. // "$ref": "Object"
  7113. // },
  7114. // "scopes": [
  7115. // "https://www.googleapis.com/auth/cloud-platform",
  7116. // "https://www.googleapis.com/auth/devstorage.full_control",
  7117. // "https://www.googleapis.com/auth/devstorage.read_write"
  7118. // ]
  7119. // }
  7120. }
  7121. // method id "storage.objects.copy":
  7122. type ObjectsCopyCall struct {
  7123. s *Service
  7124. sourceBucket string
  7125. sourceObject string
  7126. destinationBucket string
  7127. destinationObject string
  7128. object *Object
  7129. urlParams_ gensupport.URLParams
  7130. ctx_ context.Context
  7131. header_ http.Header
  7132. }
  7133. // Copy: Copies a source object to a destination object. Optionally
  7134. // overrides metadata.
  7135. func (r *ObjectsService) Copy(sourceBucket string, sourceObject string, destinationBucket string, destinationObject string, object *Object) *ObjectsCopyCall {
  7136. c := &ObjectsCopyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7137. c.sourceBucket = sourceBucket
  7138. c.sourceObject = sourceObject
  7139. c.destinationBucket = destinationBucket
  7140. c.destinationObject = destinationObject
  7141. c.object = object
  7142. return c
  7143. }
  7144. // DestinationPredefinedAcl sets the optional parameter
  7145. // "destinationPredefinedAcl": Apply a predefined set of access controls
  7146. // to the destination object.
  7147. //
  7148. // Possible values:
  7149. // "authenticatedRead" - Object owner gets OWNER access, and
  7150. // allAuthenticatedUsers get READER access.
  7151. // "bucketOwnerFullControl" - Object owner gets OWNER access, and
  7152. // project team owners get OWNER access.
  7153. // "bucketOwnerRead" - Object owner gets OWNER access, and project
  7154. // team owners get READER access.
  7155. // "private" - Object owner gets OWNER access.
  7156. // "projectPrivate" - Object owner gets OWNER access, and project team
  7157. // members get access according to their roles.
  7158. // "publicRead" - Object owner gets OWNER access, and allUsers get
  7159. // READER access.
  7160. func (c *ObjectsCopyCall) DestinationPredefinedAcl(destinationPredefinedAcl string) *ObjectsCopyCall {
  7161. c.urlParams_.Set("destinationPredefinedAcl", destinationPredefinedAcl)
  7162. return c
  7163. }
  7164. // IfGenerationMatch sets the optional parameter "ifGenerationMatch":
  7165. // Makes the operation conditional on whether the destination object's
  7166. // current generation matches the given value. Setting to 0 makes the
  7167. // operation succeed only if there are no live versions of the object.
  7168. func (c *ObjectsCopyCall) IfGenerationMatch(ifGenerationMatch int64) *ObjectsCopyCall {
  7169. c.urlParams_.Set("ifGenerationMatch", fmt.Sprint(ifGenerationMatch))
  7170. return c
  7171. }
  7172. // IfGenerationNotMatch sets the optional parameter
  7173. // "ifGenerationNotMatch": Makes the operation conditional on whether
  7174. // the destination object's current generation does not match the given
  7175. // value. If no live object exists, the precondition fails. Setting to 0
  7176. // makes the operation succeed only if there is a live version of the
  7177. // object.
  7178. func (c *ObjectsCopyCall) IfGenerationNotMatch(ifGenerationNotMatch int64) *ObjectsCopyCall {
  7179. c.urlParams_.Set("ifGenerationNotMatch", fmt.Sprint(ifGenerationNotMatch))
  7180. return c
  7181. }
  7182. // IfMetagenerationMatch sets the optional parameter
  7183. // "ifMetagenerationMatch": Makes the operation conditional on whether
  7184. // the destination object's current metageneration matches the given
  7185. // value.
  7186. func (c *ObjectsCopyCall) IfMetagenerationMatch(ifMetagenerationMatch int64) *ObjectsCopyCall {
  7187. c.urlParams_.Set("ifMetagenerationMatch", fmt.Sprint(ifMetagenerationMatch))
  7188. return c
  7189. }
  7190. // IfMetagenerationNotMatch sets the optional parameter
  7191. // "ifMetagenerationNotMatch": Makes the operation conditional on
  7192. // whether the destination object's current metageneration does not
  7193. // match the given value.
  7194. func (c *ObjectsCopyCall) IfMetagenerationNotMatch(ifMetagenerationNotMatch int64) *ObjectsCopyCall {
  7195. c.urlParams_.Set("ifMetagenerationNotMatch", fmt.Sprint(ifMetagenerationNotMatch))
  7196. return c
  7197. }
  7198. // IfSourceGenerationMatch sets the optional parameter
  7199. // "ifSourceGenerationMatch": Makes the operation conditional on whether
  7200. // the source object's current generation matches the given value.
  7201. func (c *ObjectsCopyCall) IfSourceGenerationMatch(ifSourceGenerationMatch int64) *ObjectsCopyCall {
  7202. c.urlParams_.Set("ifSourceGenerationMatch", fmt.Sprint(ifSourceGenerationMatch))
  7203. return c
  7204. }
  7205. // IfSourceGenerationNotMatch sets the optional parameter
  7206. // "ifSourceGenerationNotMatch": Makes the operation conditional on
  7207. // whether the source object's current generation does not match the
  7208. // given value.
  7209. func (c *ObjectsCopyCall) IfSourceGenerationNotMatch(ifSourceGenerationNotMatch int64) *ObjectsCopyCall {
  7210. c.urlParams_.Set("ifSourceGenerationNotMatch", fmt.Sprint(ifSourceGenerationNotMatch))
  7211. return c
  7212. }
  7213. // IfSourceMetagenerationMatch sets the optional parameter
  7214. // "ifSourceMetagenerationMatch": Makes the operation conditional on
  7215. // whether the source object's current metageneration matches the given
  7216. // value.
  7217. func (c *ObjectsCopyCall) IfSourceMetagenerationMatch(ifSourceMetagenerationMatch int64) *ObjectsCopyCall {
  7218. c.urlParams_.Set("ifSourceMetagenerationMatch", fmt.Sprint(ifSourceMetagenerationMatch))
  7219. return c
  7220. }
  7221. // IfSourceMetagenerationNotMatch sets the optional parameter
  7222. // "ifSourceMetagenerationNotMatch": Makes the operation conditional on
  7223. // whether the source object's current metageneration does not match the
  7224. // given value.
  7225. func (c *ObjectsCopyCall) IfSourceMetagenerationNotMatch(ifSourceMetagenerationNotMatch int64) *ObjectsCopyCall {
  7226. c.urlParams_.Set("ifSourceMetagenerationNotMatch", fmt.Sprint(ifSourceMetagenerationNotMatch))
  7227. return c
  7228. }
  7229. // Projection sets the optional parameter "projection": Set of
  7230. // properties to return. Defaults to noAcl, unless the object resource
  7231. // specifies the acl property, when it defaults to full.
  7232. //
  7233. // Possible values:
  7234. // "full" - Include all properties.
  7235. // "noAcl" - Omit the owner, acl property.
  7236. func (c *ObjectsCopyCall) Projection(projection string) *ObjectsCopyCall {
  7237. c.urlParams_.Set("projection", projection)
  7238. return c
  7239. }
  7240. // SourceGeneration sets the optional parameter "sourceGeneration": If
  7241. // present, selects a specific revision of the source object (as opposed
  7242. // to the latest version, the default).
  7243. func (c *ObjectsCopyCall) SourceGeneration(sourceGeneration int64) *ObjectsCopyCall {
  7244. c.urlParams_.Set("sourceGeneration", fmt.Sprint(sourceGeneration))
  7245. return c
  7246. }
  7247. // UserProject sets the optional parameter "userProject": The project to
  7248. // be billed for this request. Required for Requester Pays buckets.
  7249. func (c *ObjectsCopyCall) UserProject(userProject string) *ObjectsCopyCall {
  7250. c.urlParams_.Set("userProject", userProject)
  7251. return c
  7252. }
  7253. // Fields allows partial responses to be retrieved. See
  7254. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7255. // for more information.
  7256. func (c *ObjectsCopyCall) Fields(s ...googleapi.Field) *ObjectsCopyCall {
  7257. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7258. return c
  7259. }
  7260. // Context sets the context to be used in this call's Do method. Any
  7261. // pending HTTP request will be aborted if the provided context is
  7262. // canceled.
  7263. func (c *ObjectsCopyCall) Context(ctx context.Context) *ObjectsCopyCall {
  7264. c.ctx_ = ctx
  7265. return c
  7266. }
  7267. // Header returns an http.Header that can be modified by the caller to
  7268. // add HTTP headers to the request.
  7269. func (c *ObjectsCopyCall) Header() http.Header {
  7270. if c.header_ == nil {
  7271. c.header_ = make(http.Header)
  7272. }
  7273. return c.header_
  7274. }
  7275. func (c *ObjectsCopyCall) doRequest(alt string) (*http.Response, error) {
  7276. reqHeaders := make(http.Header)
  7277. for k, v := range c.header_ {
  7278. reqHeaders[k] = v
  7279. }
  7280. reqHeaders.Set("User-Agent", c.s.userAgent())
  7281. var body io.Reader = nil
  7282. body, err := googleapi.WithoutDataWrapper.JSONReader(c.object)
  7283. if err != nil {
  7284. return nil, err
  7285. }
  7286. reqHeaders.Set("Content-Type", "application/json")
  7287. c.urlParams_.Set("alt", alt)
  7288. c.urlParams_.Set("prettyPrint", "false")
  7289. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{sourceBucket}/o/{sourceObject}/copyTo/b/{destinationBucket}/o/{destinationObject}")
  7290. urls += "?" + c.urlParams_.Encode()
  7291. req, err := http.NewRequest("POST", urls, body)
  7292. if err != nil {
  7293. return nil, err
  7294. }
  7295. req.Header = reqHeaders
  7296. googleapi.Expand(req.URL, map[string]string{
  7297. "sourceBucket": c.sourceBucket,
  7298. "sourceObject": c.sourceObject,
  7299. "destinationBucket": c.destinationBucket,
  7300. "destinationObject": c.destinationObject,
  7301. })
  7302. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7303. }
  7304. // Do executes the "storage.objects.copy" call.
  7305. // Exactly one of *Object or error will be non-nil. Any non-2xx status
  7306. // code is an error. Response headers are in either
  7307. // *Object.ServerResponse.Header or (if a response was returned at all)
  7308. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  7309. // check whether the returned error was because http.StatusNotModified
  7310. // was returned.
  7311. func (c *ObjectsCopyCall) Do(opts ...googleapi.CallOption) (*Object, error) {
  7312. gensupport.SetOptions(c.urlParams_, opts...)
  7313. res, err := c.doRequest("json")
  7314. if res != nil && res.StatusCode == http.StatusNotModified {
  7315. if res.Body != nil {
  7316. res.Body.Close()
  7317. }
  7318. return nil, &googleapi.Error{
  7319. Code: res.StatusCode,
  7320. Header: res.Header,
  7321. }
  7322. }
  7323. if err != nil {
  7324. return nil, err
  7325. }
  7326. defer googleapi.CloseBody(res)
  7327. if err := googleapi.CheckResponse(res); err != nil {
  7328. return nil, err
  7329. }
  7330. ret := &Object{
  7331. ServerResponse: googleapi.ServerResponse{
  7332. Header: res.Header,
  7333. HTTPStatusCode: res.StatusCode,
  7334. },
  7335. }
  7336. target := &ret
  7337. if err := gensupport.DecodeResponse(target, res); err != nil {
  7338. return nil, err
  7339. }
  7340. return ret, nil
  7341. // {
  7342. // "description": "Copies a source object to a destination object. Optionally overrides metadata.",
  7343. // "httpMethod": "POST",
  7344. // "id": "storage.objects.copy",
  7345. // "parameterOrder": [
  7346. // "sourceBucket",
  7347. // "sourceObject",
  7348. // "destinationBucket",
  7349. // "destinationObject"
  7350. // ],
  7351. // "parameters": {
  7352. // "destinationBucket": {
  7353. // "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.",
  7354. // "location": "path",
  7355. // "required": true,
  7356. // "type": "string"
  7357. // },
  7358. // "destinationObject": {
  7359. // "description": "Name of the new object. Required when the object metadata is not otherwise provided. Overrides the object metadata's name value, if any.",
  7360. // "location": "path",
  7361. // "required": true,
  7362. // "type": "string"
  7363. // },
  7364. // "destinationPredefinedAcl": {
  7365. // "description": "Apply a predefined set of access controls to the destination object.",
  7366. // "enum": [
  7367. // "authenticatedRead",
  7368. // "bucketOwnerFullControl",
  7369. // "bucketOwnerRead",
  7370. // "private",
  7371. // "projectPrivate",
  7372. // "publicRead"
  7373. // ],
  7374. // "enumDescriptions": [
  7375. // "Object owner gets OWNER access, and allAuthenticatedUsers get READER access.",
  7376. // "Object owner gets OWNER access, and project team owners get OWNER access.",
  7377. // "Object owner gets OWNER access, and project team owners get READER access.",
  7378. // "Object owner gets OWNER access.",
  7379. // "Object owner gets OWNER access, and project team members get access according to their roles.",
  7380. // "Object owner gets OWNER access, and allUsers get READER access."
  7381. // ],
  7382. // "location": "query",
  7383. // "type": "string"
  7384. // },
  7385. // "ifGenerationMatch": {
  7386. // "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.",
  7387. // "format": "int64",
  7388. // "location": "query",
  7389. // "type": "string"
  7390. // },
  7391. // "ifGenerationNotMatch": {
  7392. // "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.",
  7393. // "format": "int64",
  7394. // "location": "query",
  7395. // "type": "string"
  7396. // },
  7397. // "ifMetagenerationMatch": {
  7398. // "description": "Makes the operation conditional on whether the destination object's current metageneration matches the given value.",
  7399. // "format": "int64",
  7400. // "location": "query",
  7401. // "type": "string"
  7402. // },
  7403. // "ifMetagenerationNotMatch": {
  7404. // "description": "Makes the operation conditional on whether the destination object's current metageneration does not match the given value.",
  7405. // "format": "int64",
  7406. // "location": "query",
  7407. // "type": "string"
  7408. // },
  7409. // "ifSourceGenerationMatch": {
  7410. // "description": "Makes the operation conditional on whether the source object's current generation matches the given value.",
  7411. // "format": "int64",
  7412. // "location": "query",
  7413. // "type": "string"
  7414. // },
  7415. // "ifSourceGenerationNotMatch": {
  7416. // "description": "Makes the operation conditional on whether the source object's current generation does not match the given value.",
  7417. // "format": "int64",
  7418. // "location": "query",
  7419. // "type": "string"
  7420. // },
  7421. // "ifSourceMetagenerationMatch": {
  7422. // "description": "Makes the operation conditional on whether the source object's current metageneration matches the given value.",
  7423. // "format": "int64",
  7424. // "location": "query",
  7425. // "type": "string"
  7426. // },
  7427. // "ifSourceMetagenerationNotMatch": {
  7428. // "description": "Makes the operation conditional on whether the source object's current metageneration does not match the given value.",
  7429. // "format": "int64",
  7430. // "location": "query",
  7431. // "type": "string"
  7432. // },
  7433. // "projection": {
  7434. // "description": "Set of properties to return. Defaults to noAcl, unless the object resource specifies the acl property, when it defaults to full.",
  7435. // "enum": [
  7436. // "full",
  7437. // "noAcl"
  7438. // ],
  7439. // "enumDescriptions": [
  7440. // "Include all properties.",
  7441. // "Omit the owner, acl property."
  7442. // ],
  7443. // "location": "query",
  7444. // "type": "string"
  7445. // },
  7446. // "sourceBucket": {
  7447. // "description": "Name of the bucket in which to find the source object.",
  7448. // "location": "path",
  7449. // "required": true,
  7450. // "type": "string"
  7451. // },
  7452. // "sourceGeneration": {
  7453. // "description": "If present, selects a specific revision of the source object (as opposed to the latest version, the default).",
  7454. // "format": "int64",
  7455. // "location": "query",
  7456. // "type": "string"
  7457. // },
  7458. // "sourceObject": {
  7459. // "description": "Name of the source object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
  7460. // "location": "path",
  7461. // "required": true,
  7462. // "type": "string"
  7463. // },
  7464. // "userProject": {
  7465. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  7466. // "location": "query",
  7467. // "type": "string"
  7468. // }
  7469. // },
  7470. // "path": "b/{sourceBucket}/o/{sourceObject}/copyTo/b/{destinationBucket}/o/{destinationObject}",
  7471. // "request": {
  7472. // "$ref": "Object"
  7473. // },
  7474. // "response": {
  7475. // "$ref": "Object"
  7476. // },
  7477. // "scopes": [
  7478. // "https://www.googleapis.com/auth/cloud-platform",
  7479. // "https://www.googleapis.com/auth/devstorage.full_control",
  7480. // "https://www.googleapis.com/auth/devstorage.read_write"
  7481. // ]
  7482. // }
  7483. }
  7484. // method id "storage.objects.delete":
  7485. type ObjectsDeleteCall struct {
  7486. s *Service
  7487. bucket string
  7488. object string
  7489. urlParams_ gensupport.URLParams
  7490. ctx_ context.Context
  7491. header_ http.Header
  7492. }
  7493. // Delete: Deletes an object and its metadata. Deletions are permanent
  7494. // if versioning is not enabled for the bucket, or if the generation
  7495. // parameter is used.
  7496. func (r *ObjectsService) Delete(bucket string, object string) *ObjectsDeleteCall {
  7497. c := &ObjectsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7498. c.bucket = bucket
  7499. c.object = object
  7500. return c
  7501. }
  7502. // Generation sets the optional parameter "generation": If present,
  7503. // permanently deletes a specific revision of this object (as opposed to
  7504. // the latest version, the default).
  7505. func (c *ObjectsDeleteCall) Generation(generation int64) *ObjectsDeleteCall {
  7506. c.urlParams_.Set("generation", fmt.Sprint(generation))
  7507. return c
  7508. }
  7509. // IfGenerationMatch sets the optional parameter "ifGenerationMatch":
  7510. // Makes the operation conditional on whether the object's current
  7511. // generation matches the given value. Setting to 0 makes the operation
  7512. // succeed only if there are no live versions of the object.
  7513. func (c *ObjectsDeleteCall) IfGenerationMatch(ifGenerationMatch int64) *ObjectsDeleteCall {
  7514. c.urlParams_.Set("ifGenerationMatch", fmt.Sprint(ifGenerationMatch))
  7515. return c
  7516. }
  7517. // IfGenerationNotMatch sets the optional parameter
  7518. // "ifGenerationNotMatch": Makes the operation conditional on whether
  7519. // the object's current generation does not match the given value. If no
  7520. // live object exists, the precondition fails. Setting to 0 makes the
  7521. // operation succeed only if there is a live version of the object.
  7522. func (c *ObjectsDeleteCall) IfGenerationNotMatch(ifGenerationNotMatch int64) *ObjectsDeleteCall {
  7523. c.urlParams_.Set("ifGenerationNotMatch", fmt.Sprint(ifGenerationNotMatch))
  7524. return c
  7525. }
  7526. // IfMetagenerationMatch sets the optional parameter
  7527. // "ifMetagenerationMatch": Makes the operation conditional on whether
  7528. // the object's current metageneration matches the given value.
  7529. func (c *ObjectsDeleteCall) IfMetagenerationMatch(ifMetagenerationMatch int64) *ObjectsDeleteCall {
  7530. c.urlParams_.Set("ifMetagenerationMatch", fmt.Sprint(ifMetagenerationMatch))
  7531. return c
  7532. }
  7533. // IfMetagenerationNotMatch sets the optional parameter
  7534. // "ifMetagenerationNotMatch": Makes the operation conditional on
  7535. // whether the object's current metageneration does not match the given
  7536. // value.
  7537. func (c *ObjectsDeleteCall) IfMetagenerationNotMatch(ifMetagenerationNotMatch int64) *ObjectsDeleteCall {
  7538. c.urlParams_.Set("ifMetagenerationNotMatch", fmt.Sprint(ifMetagenerationNotMatch))
  7539. return c
  7540. }
  7541. // UserProject sets the optional parameter "userProject": The project to
  7542. // be billed for this request. Required for Requester Pays buckets.
  7543. func (c *ObjectsDeleteCall) UserProject(userProject string) *ObjectsDeleteCall {
  7544. c.urlParams_.Set("userProject", userProject)
  7545. return c
  7546. }
  7547. // Fields allows partial responses to be retrieved. See
  7548. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7549. // for more information.
  7550. func (c *ObjectsDeleteCall) Fields(s ...googleapi.Field) *ObjectsDeleteCall {
  7551. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7552. return c
  7553. }
  7554. // Context sets the context to be used in this call's Do method. Any
  7555. // pending HTTP request will be aborted if the provided context is
  7556. // canceled.
  7557. func (c *ObjectsDeleteCall) Context(ctx context.Context) *ObjectsDeleteCall {
  7558. c.ctx_ = ctx
  7559. return c
  7560. }
  7561. // Header returns an http.Header that can be modified by the caller to
  7562. // add HTTP headers to the request.
  7563. func (c *ObjectsDeleteCall) Header() http.Header {
  7564. if c.header_ == nil {
  7565. c.header_ = make(http.Header)
  7566. }
  7567. return c.header_
  7568. }
  7569. func (c *ObjectsDeleteCall) doRequest(alt string) (*http.Response, error) {
  7570. reqHeaders := make(http.Header)
  7571. for k, v := range c.header_ {
  7572. reqHeaders[k] = v
  7573. }
  7574. reqHeaders.Set("User-Agent", c.s.userAgent())
  7575. var body io.Reader = nil
  7576. c.urlParams_.Set("alt", alt)
  7577. c.urlParams_.Set("prettyPrint", "false")
  7578. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}")
  7579. urls += "?" + c.urlParams_.Encode()
  7580. req, err := http.NewRequest("DELETE", urls, body)
  7581. if err != nil {
  7582. return nil, err
  7583. }
  7584. req.Header = reqHeaders
  7585. googleapi.Expand(req.URL, map[string]string{
  7586. "bucket": c.bucket,
  7587. "object": c.object,
  7588. })
  7589. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7590. }
  7591. // Do executes the "storage.objects.delete" call.
  7592. func (c *ObjectsDeleteCall) Do(opts ...googleapi.CallOption) error {
  7593. gensupport.SetOptions(c.urlParams_, opts...)
  7594. res, err := c.doRequest("json")
  7595. if err != nil {
  7596. return err
  7597. }
  7598. defer googleapi.CloseBody(res)
  7599. if err := googleapi.CheckResponse(res); err != nil {
  7600. return err
  7601. }
  7602. return nil
  7603. // {
  7604. // "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.",
  7605. // "httpMethod": "DELETE",
  7606. // "id": "storage.objects.delete",
  7607. // "parameterOrder": [
  7608. // "bucket",
  7609. // "object"
  7610. // ],
  7611. // "parameters": {
  7612. // "bucket": {
  7613. // "description": "Name of the bucket in which the object resides.",
  7614. // "location": "path",
  7615. // "required": true,
  7616. // "type": "string"
  7617. // },
  7618. // "generation": {
  7619. // "description": "If present, permanently deletes a specific revision of this object (as opposed to the latest version, the default).",
  7620. // "format": "int64",
  7621. // "location": "query",
  7622. // "type": "string"
  7623. // },
  7624. // "ifGenerationMatch": {
  7625. // "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.",
  7626. // "format": "int64",
  7627. // "location": "query",
  7628. // "type": "string"
  7629. // },
  7630. // "ifGenerationNotMatch": {
  7631. // "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.",
  7632. // "format": "int64",
  7633. // "location": "query",
  7634. // "type": "string"
  7635. // },
  7636. // "ifMetagenerationMatch": {
  7637. // "description": "Makes the operation conditional on whether the object's current metageneration matches the given value.",
  7638. // "format": "int64",
  7639. // "location": "query",
  7640. // "type": "string"
  7641. // },
  7642. // "ifMetagenerationNotMatch": {
  7643. // "description": "Makes the operation conditional on whether the object's current metageneration does not match the given value.",
  7644. // "format": "int64",
  7645. // "location": "query",
  7646. // "type": "string"
  7647. // },
  7648. // "object": {
  7649. // "description": "Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
  7650. // "location": "path",
  7651. // "required": true,
  7652. // "type": "string"
  7653. // },
  7654. // "userProject": {
  7655. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  7656. // "location": "query",
  7657. // "type": "string"
  7658. // }
  7659. // },
  7660. // "path": "b/{bucket}/o/{object}",
  7661. // "scopes": [
  7662. // "https://www.googleapis.com/auth/cloud-platform",
  7663. // "https://www.googleapis.com/auth/devstorage.full_control",
  7664. // "https://www.googleapis.com/auth/devstorage.read_write"
  7665. // ]
  7666. // }
  7667. }
  7668. // method id "storage.objects.get":
  7669. type ObjectsGetCall struct {
  7670. s *Service
  7671. bucket string
  7672. object string
  7673. urlParams_ gensupport.URLParams
  7674. ifNoneMatch_ string
  7675. ctx_ context.Context
  7676. header_ http.Header
  7677. }
  7678. // Get: Retrieves an object or its metadata.
  7679. func (r *ObjectsService) Get(bucket string, object string) *ObjectsGetCall {
  7680. c := &ObjectsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7681. c.bucket = bucket
  7682. c.object = object
  7683. return c
  7684. }
  7685. // Generation sets the optional parameter "generation": If present,
  7686. // selects a specific revision of this object (as opposed to the latest
  7687. // version, the default).
  7688. func (c *ObjectsGetCall) Generation(generation int64) *ObjectsGetCall {
  7689. c.urlParams_.Set("generation", fmt.Sprint(generation))
  7690. return c
  7691. }
  7692. // IfGenerationMatch sets the optional parameter "ifGenerationMatch":
  7693. // Makes the operation conditional on whether the object's current
  7694. // generation matches the given value. Setting to 0 makes the operation
  7695. // succeed only if there are no live versions of the object.
  7696. func (c *ObjectsGetCall) IfGenerationMatch(ifGenerationMatch int64) *ObjectsGetCall {
  7697. c.urlParams_.Set("ifGenerationMatch", fmt.Sprint(ifGenerationMatch))
  7698. return c
  7699. }
  7700. // IfGenerationNotMatch sets the optional parameter
  7701. // "ifGenerationNotMatch": Makes the operation conditional on whether
  7702. // the object's current generation does not match the given value. If no
  7703. // live object exists, the precondition fails. Setting to 0 makes the
  7704. // operation succeed only if there is a live version of the object.
  7705. func (c *ObjectsGetCall) IfGenerationNotMatch(ifGenerationNotMatch int64) *ObjectsGetCall {
  7706. c.urlParams_.Set("ifGenerationNotMatch", fmt.Sprint(ifGenerationNotMatch))
  7707. return c
  7708. }
  7709. // IfMetagenerationMatch sets the optional parameter
  7710. // "ifMetagenerationMatch": Makes the operation conditional on whether
  7711. // the object's current metageneration matches the given value.
  7712. func (c *ObjectsGetCall) IfMetagenerationMatch(ifMetagenerationMatch int64) *ObjectsGetCall {
  7713. c.urlParams_.Set("ifMetagenerationMatch", fmt.Sprint(ifMetagenerationMatch))
  7714. return c
  7715. }
  7716. // IfMetagenerationNotMatch sets the optional parameter
  7717. // "ifMetagenerationNotMatch": Makes the operation conditional on
  7718. // whether the object's current metageneration does not match the given
  7719. // value.
  7720. func (c *ObjectsGetCall) IfMetagenerationNotMatch(ifMetagenerationNotMatch int64) *ObjectsGetCall {
  7721. c.urlParams_.Set("ifMetagenerationNotMatch", fmt.Sprint(ifMetagenerationNotMatch))
  7722. return c
  7723. }
  7724. // Projection sets the optional parameter "projection": Set of
  7725. // properties to return. Defaults to noAcl.
  7726. //
  7727. // Possible values:
  7728. // "full" - Include all properties.
  7729. // "noAcl" - Omit the owner, acl property.
  7730. func (c *ObjectsGetCall) Projection(projection string) *ObjectsGetCall {
  7731. c.urlParams_.Set("projection", projection)
  7732. return c
  7733. }
  7734. // UserProject sets the optional parameter "userProject": The project to
  7735. // be billed for this request. Required for Requester Pays buckets.
  7736. func (c *ObjectsGetCall) UserProject(userProject string) *ObjectsGetCall {
  7737. c.urlParams_.Set("userProject", userProject)
  7738. return c
  7739. }
  7740. // Fields allows partial responses to be retrieved. See
  7741. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7742. // for more information.
  7743. func (c *ObjectsGetCall) Fields(s ...googleapi.Field) *ObjectsGetCall {
  7744. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7745. return c
  7746. }
  7747. // IfNoneMatch sets the optional parameter which makes the operation
  7748. // fail if the object's ETag matches the given value. This is useful for
  7749. // getting updates only after the object has changed since the last
  7750. // request. Use googleapi.IsNotModified to check whether the response
  7751. // error from Do is the result of In-None-Match.
  7752. func (c *ObjectsGetCall) IfNoneMatch(entityTag string) *ObjectsGetCall {
  7753. c.ifNoneMatch_ = entityTag
  7754. return c
  7755. }
  7756. // Context sets the context to be used in this call's Do and Download
  7757. // methods. Any pending HTTP request will be aborted if the provided
  7758. // context is canceled.
  7759. func (c *ObjectsGetCall) Context(ctx context.Context) *ObjectsGetCall {
  7760. c.ctx_ = ctx
  7761. return c
  7762. }
  7763. // Header returns an http.Header that can be modified by the caller to
  7764. // add HTTP headers to the request.
  7765. func (c *ObjectsGetCall) Header() http.Header {
  7766. if c.header_ == nil {
  7767. c.header_ = make(http.Header)
  7768. }
  7769. return c.header_
  7770. }
  7771. func (c *ObjectsGetCall) doRequest(alt string) (*http.Response, error) {
  7772. reqHeaders := make(http.Header)
  7773. for k, v := range c.header_ {
  7774. reqHeaders[k] = v
  7775. }
  7776. reqHeaders.Set("User-Agent", c.s.userAgent())
  7777. if c.ifNoneMatch_ != "" {
  7778. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  7779. }
  7780. var body io.Reader = nil
  7781. c.urlParams_.Set("alt", alt)
  7782. c.urlParams_.Set("prettyPrint", "false")
  7783. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}")
  7784. urls += "?" + c.urlParams_.Encode()
  7785. req, err := http.NewRequest("GET", urls, body)
  7786. if err != nil {
  7787. return nil, err
  7788. }
  7789. req.Header = reqHeaders
  7790. googleapi.Expand(req.URL, map[string]string{
  7791. "bucket": c.bucket,
  7792. "object": c.object,
  7793. })
  7794. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7795. }
  7796. // Download fetches the API endpoint's "media" value, instead of the normal
  7797. // API response value. If the returned error is nil, the Response is guaranteed to
  7798. // have a 2xx status code. Callers must close the Response.Body as usual.
  7799. func (c *ObjectsGetCall) Download(opts ...googleapi.CallOption) (*http.Response, error) {
  7800. gensupport.SetOptions(c.urlParams_, opts...)
  7801. res, err := c.doRequest("media")
  7802. if err != nil {
  7803. return nil, err
  7804. }
  7805. if err := googleapi.CheckMediaResponse(res); err != nil {
  7806. res.Body.Close()
  7807. return nil, err
  7808. }
  7809. return res, nil
  7810. }
  7811. // Do executes the "storage.objects.get" call.
  7812. // Exactly one of *Object or error will be non-nil. Any non-2xx status
  7813. // code is an error. Response headers are in either
  7814. // *Object.ServerResponse.Header or (if a response was returned at all)
  7815. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  7816. // check whether the returned error was because http.StatusNotModified
  7817. // was returned.
  7818. func (c *ObjectsGetCall) Do(opts ...googleapi.CallOption) (*Object, error) {
  7819. gensupport.SetOptions(c.urlParams_, opts...)
  7820. res, err := c.doRequest("json")
  7821. if res != nil && res.StatusCode == http.StatusNotModified {
  7822. if res.Body != nil {
  7823. res.Body.Close()
  7824. }
  7825. return nil, &googleapi.Error{
  7826. Code: res.StatusCode,
  7827. Header: res.Header,
  7828. }
  7829. }
  7830. if err != nil {
  7831. return nil, err
  7832. }
  7833. defer googleapi.CloseBody(res)
  7834. if err := googleapi.CheckResponse(res); err != nil {
  7835. return nil, err
  7836. }
  7837. ret := &Object{
  7838. ServerResponse: googleapi.ServerResponse{
  7839. Header: res.Header,
  7840. HTTPStatusCode: res.StatusCode,
  7841. },
  7842. }
  7843. target := &ret
  7844. if err := gensupport.DecodeResponse(target, res); err != nil {
  7845. return nil, err
  7846. }
  7847. return ret, nil
  7848. // {
  7849. // "description": "Retrieves an object or its metadata.",
  7850. // "httpMethod": "GET",
  7851. // "id": "storage.objects.get",
  7852. // "parameterOrder": [
  7853. // "bucket",
  7854. // "object"
  7855. // ],
  7856. // "parameters": {
  7857. // "bucket": {
  7858. // "description": "Name of the bucket in which the object resides.",
  7859. // "location": "path",
  7860. // "required": true,
  7861. // "type": "string"
  7862. // },
  7863. // "generation": {
  7864. // "description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).",
  7865. // "format": "int64",
  7866. // "location": "query",
  7867. // "type": "string"
  7868. // },
  7869. // "ifGenerationMatch": {
  7870. // "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.",
  7871. // "format": "int64",
  7872. // "location": "query",
  7873. // "type": "string"
  7874. // },
  7875. // "ifGenerationNotMatch": {
  7876. // "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.",
  7877. // "format": "int64",
  7878. // "location": "query",
  7879. // "type": "string"
  7880. // },
  7881. // "ifMetagenerationMatch": {
  7882. // "description": "Makes the operation conditional on whether the object's current metageneration matches the given value.",
  7883. // "format": "int64",
  7884. // "location": "query",
  7885. // "type": "string"
  7886. // },
  7887. // "ifMetagenerationNotMatch": {
  7888. // "description": "Makes the operation conditional on whether the object's current metageneration does not match the given value.",
  7889. // "format": "int64",
  7890. // "location": "query",
  7891. // "type": "string"
  7892. // },
  7893. // "object": {
  7894. // "description": "Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
  7895. // "location": "path",
  7896. // "required": true,
  7897. // "type": "string"
  7898. // },
  7899. // "projection": {
  7900. // "description": "Set of properties to return. Defaults to noAcl.",
  7901. // "enum": [
  7902. // "full",
  7903. // "noAcl"
  7904. // ],
  7905. // "enumDescriptions": [
  7906. // "Include all properties.",
  7907. // "Omit the owner, acl property."
  7908. // ],
  7909. // "location": "query",
  7910. // "type": "string"
  7911. // },
  7912. // "userProject": {
  7913. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  7914. // "location": "query",
  7915. // "type": "string"
  7916. // }
  7917. // },
  7918. // "path": "b/{bucket}/o/{object}",
  7919. // "response": {
  7920. // "$ref": "Object"
  7921. // },
  7922. // "scopes": [
  7923. // "https://www.googleapis.com/auth/cloud-platform",
  7924. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  7925. // "https://www.googleapis.com/auth/devstorage.full_control",
  7926. // "https://www.googleapis.com/auth/devstorage.read_only",
  7927. // "https://www.googleapis.com/auth/devstorage.read_write"
  7928. // ],
  7929. // "supportsMediaDownload": true,
  7930. // "useMediaDownloadService": true
  7931. // }
  7932. }
  7933. // method id "storage.objects.getIamPolicy":
  7934. type ObjectsGetIamPolicyCall struct {
  7935. s *Service
  7936. bucket string
  7937. object string
  7938. urlParams_ gensupport.URLParams
  7939. ifNoneMatch_ string
  7940. ctx_ context.Context
  7941. header_ http.Header
  7942. }
  7943. // GetIamPolicy: Returns an IAM policy for the specified object.
  7944. func (r *ObjectsService) GetIamPolicy(bucket string, object string) *ObjectsGetIamPolicyCall {
  7945. c := &ObjectsGetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7946. c.bucket = bucket
  7947. c.object = object
  7948. return c
  7949. }
  7950. // Generation sets the optional parameter "generation": If present,
  7951. // selects a specific revision of this object (as opposed to the latest
  7952. // version, the default).
  7953. func (c *ObjectsGetIamPolicyCall) Generation(generation int64) *ObjectsGetIamPolicyCall {
  7954. c.urlParams_.Set("generation", fmt.Sprint(generation))
  7955. return c
  7956. }
  7957. // UserProject sets the optional parameter "userProject": The project to
  7958. // be billed for this request. Required for Requester Pays buckets.
  7959. func (c *ObjectsGetIamPolicyCall) UserProject(userProject string) *ObjectsGetIamPolicyCall {
  7960. c.urlParams_.Set("userProject", userProject)
  7961. return c
  7962. }
  7963. // Fields allows partial responses to be retrieved. See
  7964. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7965. // for more information.
  7966. func (c *ObjectsGetIamPolicyCall) Fields(s ...googleapi.Field) *ObjectsGetIamPolicyCall {
  7967. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7968. return c
  7969. }
  7970. // IfNoneMatch sets the optional parameter which makes the operation
  7971. // fail if the object's ETag matches the given value. This is useful for
  7972. // getting updates only after the object has changed since the last
  7973. // request. Use googleapi.IsNotModified to check whether the response
  7974. // error from Do is the result of In-None-Match.
  7975. func (c *ObjectsGetIamPolicyCall) IfNoneMatch(entityTag string) *ObjectsGetIamPolicyCall {
  7976. c.ifNoneMatch_ = entityTag
  7977. return c
  7978. }
  7979. // Context sets the context to be used in this call's Do method. Any
  7980. // pending HTTP request will be aborted if the provided context is
  7981. // canceled.
  7982. func (c *ObjectsGetIamPolicyCall) Context(ctx context.Context) *ObjectsGetIamPolicyCall {
  7983. c.ctx_ = ctx
  7984. return c
  7985. }
  7986. // Header returns an http.Header that can be modified by the caller to
  7987. // add HTTP headers to the request.
  7988. func (c *ObjectsGetIamPolicyCall) Header() http.Header {
  7989. if c.header_ == nil {
  7990. c.header_ = make(http.Header)
  7991. }
  7992. return c.header_
  7993. }
  7994. func (c *ObjectsGetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
  7995. reqHeaders := make(http.Header)
  7996. for k, v := range c.header_ {
  7997. reqHeaders[k] = v
  7998. }
  7999. reqHeaders.Set("User-Agent", c.s.userAgent())
  8000. if c.ifNoneMatch_ != "" {
  8001. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  8002. }
  8003. var body io.Reader = nil
  8004. c.urlParams_.Set("alt", alt)
  8005. c.urlParams_.Set("prettyPrint", "false")
  8006. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}/iam")
  8007. urls += "?" + c.urlParams_.Encode()
  8008. req, err := http.NewRequest("GET", urls, body)
  8009. if err != nil {
  8010. return nil, err
  8011. }
  8012. req.Header = reqHeaders
  8013. googleapi.Expand(req.URL, map[string]string{
  8014. "bucket": c.bucket,
  8015. "object": c.object,
  8016. })
  8017. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  8018. }
  8019. // Do executes the "storage.objects.getIamPolicy" call.
  8020. // Exactly one of *Policy or error will be non-nil. Any non-2xx status
  8021. // code is an error. Response headers are in either
  8022. // *Policy.ServerResponse.Header or (if a response was returned at all)
  8023. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  8024. // check whether the returned error was because http.StatusNotModified
  8025. // was returned.
  8026. func (c *ObjectsGetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) {
  8027. gensupport.SetOptions(c.urlParams_, opts...)
  8028. res, err := c.doRequest("json")
  8029. if res != nil && res.StatusCode == http.StatusNotModified {
  8030. if res.Body != nil {
  8031. res.Body.Close()
  8032. }
  8033. return nil, &googleapi.Error{
  8034. Code: res.StatusCode,
  8035. Header: res.Header,
  8036. }
  8037. }
  8038. if err != nil {
  8039. return nil, err
  8040. }
  8041. defer googleapi.CloseBody(res)
  8042. if err := googleapi.CheckResponse(res); err != nil {
  8043. return nil, err
  8044. }
  8045. ret := &Policy{
  8046. ServerResponse: googleapi.ServerResponse{
  8047. Header: res.Header,
  8048. HTTPStatusCode: res.StatusCode,
  8049. },
  8050. }
  8051. target := &ret
  8052. if err := gensupport.DecodeResponse(target, res); err != nil {
  8053. return nil, err
  8054. }
  8055. return ret, nil
  8056. // {
  8057. // "description": "Returns an IAM policy for the specified object.",
  8058. // "httpMethod": "GET",
  8059. // "id": "storage.objects.getIamPolicy",
  8060. // "parameterOrder": [
  8061. // "bucket",
  8062. // "object"
  8063. // ],
  8064. // "parameters": {
  8065. // "bucket": {
  8066. // "description": "Name of the bucket in which the object resides.",
  8067. // "location": "path",
  8068. // "required": true,
  8069. // "type": "string"
  8070. // },
  8071. // "generation": {
  8072. // "description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).",
  8073. // "format": "int64",
  8074. // "location": "query",
  8075. // "type": "string"
  8076. // },
  8077. // "object": {
  8078. // "description": "Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
  8079. // "location": "path",
  8080. // "required": true,
  8081. // "type": "string"
  8082. // },
  8083. // "userProject": {
  8084. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  8085. // "location": "query",
  8086. // "type": "string"
  8087. // }
  8088. // },
  8089. // "path": "b/{bucket}/o/{object}/iam",
  8090. // "response": {
  8091. // "$ref": "Policy"
  8092. // },
  8093. // "scopes": [
  8094. // "https://www.googleapis.com/auth/cloud-platform",
  8095. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  8096. // "https://www.googleapis.com/auth/devstorage.full_control",
  8097. // "https://www.googleapis.com/auth/devstorage.read_only",
  8098. // "https://www.googleapis.com/auth/devstorage.read_write"
  8099. // ]
  8100. // }
  8101. }
  8102. // method id "storage.objects.insert":
  8103. type ObjectsInsertCall struct {
  8104. s *Service
  8105. bucket string
  8106. object *Object
  8107. urlParams_ gensupport.URLParams
  8108. mediaInfo_ *gensupport.MediaInfo
  8109. ctx_ context.Context
  8110. header_ http.Header
  8111. }
  8112. // Insert: Stores a new object and metadata.
  8113. func (r *ObjectsService) Insert(bucket string, object *Object) *ObjectsInsertCall {
  8114. c := &ObjectsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8115. c.bucket = bucket
  8116. c.object = object
  8117. return c
  8118. }
  8119. // ContentEncoding sets the optional parameter "contentEncoding": If
  8120. // set, sets the contentEncoding property of the final object to this
  8121. // value. Setting this parameter is equivalent to setting the
  8122. // contentEncoding metadata property. This can be useful when uploading
  8123. // an object with uploadType=media to indicate the encoding of the
  8124. // content being uploaded.
  8125. func (c *ObjectsInsertCall) ContentEncoding(contentEncoding string) *ObjectsInsertCall {
  8126. c.urlParams_.Set("contentEncoding", contentEncoding)
  8127. return c
  8128. }
  8129. // IfGenerationMatch sets the optional parameter "ifGenerationMatch":
  8130. // Makes the operation conditional on whether the object's current
  8131. // generation matches the given value. Setting to 0 makes the operation
  8132. // succeed only if there are no live versions of the object.
  8133. func (c *ObjectsInsertCall) IfGenerationMatch(ifGenerationMatch int64) *ObjectsInsertCall {
  8134. c.urlParams_.Set("ifGenerationMatch", fmt.Sprint(ifGenerationMatch))
  8135. return c
  8136. }
  8137. // IfGenerationNotMatch sets the optional parameter
  8138. // "ifGenerationNotMatch": Makes the operation conditional on whether
  8139. // the object's current generation does not match the given value. If no
  8140. // live object exists, the precondition fails. Setting to 0 makes the
  8141. // operation succeed only if there is a live version of the object.
  8142. func (c *ObjectsInsertCall) IfGenerationNotMatch(ifGenerationNotMatch int64) *ObjectsInsertCall {
  8143. c.urlParams_.Set("ifGenerationNotMatch", fmt.Sprint(ifGenerationNotMatch))
  8144. return c
  8145. }
  8146. // IfMetagenerationMatch sets the optional parameter
  8147. // "ifMetagenerationMatch": Makes the operation conditional on whether
  8148. // the object's current metageneration matches the given value.
  8149. func (c *ObjectsInsertCall) IfMetagenerationMatch(ifMetagenerationMatch int64) *ObjectsInsertCall {
  8150. c.urlParams_.Set("ifMetagenerationMatch", fmt.Sprint(ifMetagenerationMatch))
  8151. return c
  8152. }
  8153. // IfMetagenerationNotMatch sets the optional parameter
  8154. // "ifMetagenerationNotMatch": Makes the operation conditional on
  8155. // whether the object's current metageneration does not match the given
  8156. // value.
  8157. func (c *ObjectsInsertCall) IfMetagenerationNotMatch(ifMetagenerationNotMatch int64) *ObjectsInsertCall {
  8158. c.urlParams_.Set("ifMetagenerationNotMatch", fmt.Sprint(ifMetagenerationNotMatch))
  8159. return c
  8160. }
  8161. // KmsKeyName sets the optional parameter "kmsKeyName": Resource name of
  8162. // the Cloud KMS key, of the form
  8163. // projects/my-project/locations/global/keyRings/my-kr/cryptoKeys/my-key,
  8164. // that will be used to encrypt the object. Overrides the object
  8165. // metadata's kms_key_name value, if any.
  8166. func (c *ObjectsInsertCall) KmsKeyName(kmsKeyName string) *ObjectsInsertCall {
  8167. c.urlParams_.Set("kmsKeyName", kmsKeyName)
  8168. return c
  8169. }
  8170. // Name sets the optional parameter "name": Name of the object. Required
  8171. // when the object metadata is not otherwise provided. Overrides the
  8172. // object metadata's name value, if any. For information about how to
  8173. // URL encode object names to be path safe, see Encoding URI Path Parts.
  8174. func (c *ObjectsInsertCall) Name(name string) *ObjectsInsertCall {
  8175. c.urlParams_.Set("name", name)
  8176. return c
  8177. }
  8178. // PredefinedAcl sets the optional parameter "predefinedAcl": Apply a
  8179. // predefined set of access controls to this object.
  8180. //
  8181. // Possible values:
  8182. // "authenticatedRead" - Object owner gets OWNER access, and
  8183. // allAuthenticatedUsers get READER access.
  8184. // "bucketOwnerFullControl" - Object owner gets OWNER access, and
  8185. // project team owners get OWNER access.
  8186. // "bucketOwnerRead" - Object owner gets OWNER access, and project
  8187. // team owners get READER access.
  8188. // "private" - Object owner gets OWNER access.
  8189. // "projectPrivate" - Object owner gets OWNER access, and project team
  8190. // members get access according to their roles.
  8191. // "publicRead" - Object owner gets OWNER access, and allUsers get
  8192. // READER access.
  8193. func (c *ObjectsInsertCall) PredefinedAcl(predefinedAcl string) *ObjectsInsertCall {
  8194. c.urlParams_.Set("predefinedAcl", predefinedAcl)
  8195. return c
  8196. }
  8197. // Projection sets the optional parameter "projection": Set of
  8198. // properties to return. Defaults to noAcl, unless the object resource
  8199. // specifies the acl property, when it defaults to full.
  8200. //
  8201. // Possible values:
  8202. // "full" - Include all properties.
  8203. // "noAcl" - Omit the owner, acl property.
  8204. func (c *ObjectsInsertCall) Projection(projection string) *ObjectsInsertCall {
  8205. c.urlParams_.Set("projection", projection)
  8206. return c
  8207. }
  8208. // UserProject sets the optional parameter "userProject": The project to
  8209. // be billed for this request. Required for Requester Pays buckets.
  8210. func (c *ObjectsInsertCall) UserProject(userProject string) *ObjectsInsertCall {
  8211. c.urlParams_.Set("userProject", userProject)
  8212. return c
  8213. }
  8214. // Media specifies the media to upload in one or more chunks. The chunk
  8215. // size may be controlled by supplying a MediaOption generated by
  8216. // googleapi.ChunkSize. The chunk size defaults to
  8217. // googleapi.DefaultUploadChunkSize.The Content-Type header used in the
  8218. // upload request will be determined by sniffing the contents of r,
  8219. // unless a MediaOption generated by googleapi.ContentType is
  8220. // supplied.
  8221. // At most one of Media and ResumableMedia may be set.
  8222. func (c *ObjectsInsertCall) Media(r io.Reader, options ...googleapi.MediaOption) *ObjectsInsertCall {
  8223. if ct := c.object.ContentType; ct != "" {
  8224. options = append([]googleapi.MediaOption{googleapi.ContentType(ct)}, options...)
  8225. }
  8226. c.mediaInfo_ = gensupport.NewInfoFromMedia(r, options)
  8227. return c
  8228. }
  8229. // ResumableMedia specifies the media to upload in chunks and can be
  8230. // canceled with ctx.
  8231. //
  8232. // Deprecated: use Media instead.
  8233. //
  8234. // At most one of Media and ResumableMedia may be set. mediaType
  8235. // identifies the MIME media type of the upload, such as "image/png". If
  8236. // mediaType is "", it will be auto-detected. The provided ctx will
  8237. // supersede any context previously provided to the Context method.
  8238. func (c *ObjectsInsertCall) ResumableMedia(ctx context.Context, r io.ReaderAt, size int64, mediaType string) *ObjectsInsertCall {
  8239. c.ctx_ = ctx
  8240. c.mediaInfo_ = gensupport.NewInfoFromResumableMedia(r, size, mediaType)
  8241. return c
  8242. }
  8243. // ProgressUpdater provides a callback function that will be called
  8244. // after every chunk. It should be a low-latency function in order to
  8245. // not slow down the upload operation. This should only be called when
  8246. // using ResumableMedia (as opposed to Media).
  8247. func (c *ObjectsInsertCall) ProgressUpdater(pu googleapi.ProgressUpdater) *ObjectsInsertCall {
  8248. c.mediaInfo_.SetProgressUpdater(pu)
  8249. return c
  8250. }
  8251. // Fields allows partial responses to be retrieved. See
  8252. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  8253. // for more information.
  8254. func (c *ObjectsInsertCall) Fields(s ...googleapi.Field) *ObjectsInsertCall {
  8255. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8256. return c
  8257. }
  8258. // Context sets the context to be used in this call's Do method. Any
  8259. // pending HTTP request will be aborted if the provided context is
  8260. // canceled.
  8261. // This context will supersede any context previously provided to the
  8262. // ResumableMedia method.
  8263. func (c *ObjectsInsertCall) Context(ctx context.Context) *ObjectsInsertCall {
  8264. c.ctx_ = ctx
  8265. return c
  8266. }
  8267. // Header returns an http.Header that can be modified by the caller to
  8268. // add HTTP headers to the request.
  8269. func (c *ObjectsInsertCall) Header() http.Header {
  8270. if c.header_ == nil {
  8271. c.header_ = make(http.Header)
  8272. }
  8273. return c.header_
  8274. }
  8275. func (c *ObjectsInsertCall) doRequest(alt string) (*http.Response, error) {
  8276. reqHeaders := make(http.Header)
  8277. for k, v := range c.header_ {
  8278. reqHeaders[k] = v
  8279. }
  8280. reqHeaders.Set("User-Agent", c.s.userAgent())
  8281. var body io.Reader = nil
  8282. body, err := googleapi.WithoutDataWrapper.JSONReader(c.object)
  8283. if err != nil {
  8284. return nil, err
  8285. }
  8286. reqHeaders.Set("Content-Type", "application/json")
  8287. c.urlParams_.Set("alt", alt)
  8288. c.urlParams_.Set("prettyPrint", "false")
  8289. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o")
  8290. if c.mediaInfo_ != nil {
  8291. urls = strings.Replace(urls, "https://www.googleapis.com/", "https://www.googleapis.com/upload/", 1)
  8292. c.urlParams_.Set("uploadType", c.mediaInfo_.UploadType())
  8293. }
  8294. if body == nil {
  8295. body = new(bytes.Buffer)
  8296. reqHeaders.Set("Content-Type", "application/json")
  8297. }
  8298. body, getBody, cleanup := c.mediaInfo_.UploadRequest(reqHeaders, body)
  8299. defer cleanup()
  8300. urls += "?" + c.urlParams_.Encode()
  8301. req, err := http.NewRequest("POST", urls, body)
  8302. if err != nil {
  8303. return nil, err
  8304. }
  8305. req.Header = reqHeaders
  8306. gensupport.SetGetBody(req, getBody)
  8307. googleapi.Expand(req.URL, map[string]string{
  8308. "bucket": c.bucket,
  8309. })
  8310. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  8311. }
  8312. // Do executes the "storage.objects.insert" call.
  8313. // Exactly one of *Object or error will be non-nil. Any non-2xx status
  8314. // code is an error. Response headers are in either
  8315. // *Object.ServerResponse.Header or (if a response was returned at all)
  8316. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  8317. // check whether the returned error was because http.StatusNotModified
  8318. // was returned.
  8319. func (c *ObjectsInsertCall) Do(opts ...googleapi.CallOption) (*Object, error) {
  8320. gensupport.SetOptions(c.urlParams_, opts...)
  8321. res, err := c.doRequest("json")
  8322. if res != nil && res.StatusCode == http.StatusNotModified {
  8323. if res.Body != nil {
  8324. res.Body.Close()
  8325. }
  8326. return nil, &googleapi.Error{
  8327. Code: res.StatusCode,
  8328. Header: res.Header,
  8329. }
  8330. }
  8331. if err != nil {
  8332. return nil, err
  8333. }
  8334. defer googleapi.CloseBody(res)
  8335. if err := googleapi.CheckResponse(res); err != nil {
  8336. return nil, err
  8337. }
  8338. rx := c.mediaInfo_.ResumableUpload(res.Header.Get("Location"))
  8339. if rx != nil {
  8340. rx.Client = c.s.client
  8341. rx.UserAgent = c.s.userAgent()
  8342. ctx := c.ctx_
  8343. if ctx == nil {
  8344. ctx = context.TODO()
  8345. }
  8346. res, err = rx.Upload(ctx)
  8347. if err != nil {
  8348. return nil, err
  8349. }
  8350. defer res.Body.Close()
  8351. if err := googleapi.CheckResponse(res); err != nil {
  8352. return nil, err
  8353. }
  8354. }
  8355. ret := &Object{
  8356. ServerResponse: googleapi.ServerResponse{
  8357. Header: res.Header,
  8358. HTTPStatusCode: res.StatusCode,
  8359. },
  8360. }
  8361. target := &ret
  8362. if err := gensupport.DecodeResponse(target, res); err != nil {
  8363. return nil, err
  8364. }
  8365. return ret, nil
  8366. // {
  8367. // "description": "Stores a new object and metadata.",
  8368. // "httpMethod": "POST",
  8369. // "id": "storage.objects.insert",
  8370. // "mediaUpload": {
  8371. // "accept": [
  8372. // "*/*"
  8373. // ],
  8374. // "protocols": {
  8375. // "resumable": {
  8376. // "multipart": true,
  8377. // "path": "/resumable/upload/storage/v1/b/{bucket}/o"
  8378. // },
  8379. // "simple": {
  8380. // "multipart": true,
  8381. // "path": "/upload/storage/v1/b/{bucket}/o"
  8382. // }
  8383. // }
  8384. // },
  8385. // "parameterOrder": [
  8386. // "bucket"
  8387. // ],
  8388. // "parameters": {
  8389. // "bucket": {
  8390. // "description": "Name of the bucket in which to store the new object. Overrides the provided object metadata's bucket value, if any.",
  8391. // "location": "path",
  8392. // "required": true,
  8393. // "type": "string"
  8394. // },
  8395. // "contentEncoding": {
  8396. // "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.",
  8397. // "location": "query",
  8398. // "type": "string"
  8399. // },
  8400. // "ifGenerationMatch": {
  8401. // "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.",
  8402. // "format": "int64",
  8403. // "location": "query",
  8404. // "type": "string"
  8405. // },
  8406. // "ifGenerationNotMatch": {
  8407. // "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.",
  8408. // "format": "int64",
  8409. // "location": "query",
  8410. // "type": "string"
  8411. // },
  8412. // "ifMetagenerationMatch": {
  8413. // "description": "Makes the operation conditional on whether the object's current metageneration matches the given value.",
  8414. // "format": "int64",
  8415. // "location": "query",
  8416. // "type": "string"
  8417. // },
  8418. // "ifMetagenerationNotMatch": {
  8419. // "description": "Makes the operation conditional on whether the object's current metageneration does not match the given value.",
  8420. // "format": "int64",
  8421. // "location": "query",
  8422. // "type": "string"
  8423. // },
  8424. // "kmsKeyName": {
  8425. // "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.",
  8426. // "location": "query",
  8427. // "type": "string"
  8428. // },
  8429. // "name": {
  8430. // "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.",
  8431. // "location": "query",
  8432. // "type": "string"
  8433. // },
  8434. // "predefinedAcl": {
  8435. // "description": "Apply a predefined set of access controls to this object.",
  8436. // "enum": [
  8437. // "authenticatedRead",
  8438. // "bucketOwnerFullControl",
  8439. // "bucketOwnerRead",
  8440. // "private",
  8441. // "projectPrivate",
  8442. // "publicRead"
  8443. // ],
  8444. // "enumDescriptions": [
  8445. // "Object owner gets OWNER access, and allAuthenticatedUsers get READER access.",
  8446. // "Object owner gets OWNER access, and project team owners get OWNER access.",
  8447. // "Object owner gets OWNER access, and project team owners get READER access.",
  8448. // "Object owner gets OWNER access.",
  8449. // "Object owner gets OWNER access, and project team members get access according to their roles.",
  8450. // "Object owner gets OWNER access, and allUsers get READER access."
  8451. // ],
  8452. // "location": "query",
  8453. // "type": "string"
  8454. // },
  8455. // "projection": {
  8456. // "description": "Set of properties to return. Defaults to noAcl, unless the object resource specifies the acl property, when it defaults to full.",
  8457. // "enum": [
  8458. // "full",
  8459. // "noAcl"
  8460. // ],
  8461. // "enumDescriptions": [
  8462. // "Include all properties.",
  8463. // "Omit the owner, acl property."
  8464. // ],
  8465. // "location": "query",
  8466. // "type": "string"
  8467. // },
  8468. // "userProject": {
  8469. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  8470. // "location": "query",
  8471. // "type": "string"
  8472. // }
  8473. // },
  8474. // "path": "b/{bucket}/o",
  8475. // "request": {
  8476. // "$ref": "Object"
  8477. // },
  8478. // "response": {
  8479. // "$ref": "Object"
  8480. // },
  8481. // "scopes": [
  8482. // "https://www.googleapis.com/auth/cloud-platform",
  8483. // "https://www.googleapis.com/auth/devstorage.full_control",
  8484. // "https://www.googleapis.com/auth/devstorage.read_write"
  8485. // ],
  8486. // "supportsMediaUpload": true
  8487. // }
  8488. }
  8489. // method id "storage.objects.list":
  8490. type ObjectsListCall struct {
  8491. s *Service
  8492. bucket string
  8493. urlParams_ gensupport.URLParams
  8494. ifNoneMatch_ string
  8495. ctx_ context.Context
  8496. header_ http.Header
  8497. }
  8498. // List: Retrieves a list of objects matching the criteria.
  8499. func (r *ObjectsService) List(bucket string) *ObjectsListCall {
  8500. c := &ObjectsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8501. c.bucket = bucket
  8502. return c
  8503. }
  8504. // Delimiter sets the optional parameter "delimiter": Returns results in
  8505. // a directory-like mode. items will contain only objects whose names,
  8506. // aside from the prefix, do not contain delimiter. Objects whose names,
  8507. // aside from the prefix, contain delimiter will have their name,
  8508. // truncated after the delimiter, returned in prefixes. Duplicate
  8509. // prefixes are omitted.
  8510. func (c *ObjectsListCall) Delimiter(delimiter string) *ObjectsListCall {
  8511. c.urlParams_.Set("delimiter", delimiter)
  8512. return c
  8513. }
  8514. // IncludeTrailingDelimiter sets the optional parameter
  8515. // "includeTrailingDelimiter": If true, objects that end in exactly one
  8516. // instance of delimiter will have their metadata included in items in
  8517. // addition to prefixes.
  8518. func (c *ObjectsListCall) IncludeTrailingDelimiter(includeTrailingDelimiter bool) *ObjectsListCall {
  8519. c.urlParams_.Set("includeTrailingDelimiter", fmt.Sprint(includeTrailingDelimiter))
  8520. return c
  8521. }
  8522. // MaxResults sets the optional parameter "maxResults": Maximum number
  8523. // of items plus prefixes to return in a single page of responses. As
  8524. // duplicate prefixes are omitted, fewer total results may be returned
  8525. // than requested. The service will use this parameter or 1,000 items,
  8526. // whichever is smaller.
  8527. func (c *ObjectsListCall) MaxResults(maxResults int64) *ObjectsListCall {
  8528. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  8529. return c
  8530. }
  8531. // PageToken sets the optional parameter "pageToken": A
  8532. // previously-returned page token representing part of the larger set of
  8533. // results to view.
  8534. func (c *ObjectsListCall) PageToken(pageToken string) *ObjectsListCall {
  8535. c.urlParams_.Set("pageToken", pageToken)
  8536. return c
  8537. }
  8538. // Prefix sets the optional parameter "prefix": Filter results to
  8539. // objects whose names begin with this prefix.
  8540. func (c *ObjectsListCall) Prefix(prefix string) *ObjectsListCall {
  8541. c.urlParams_.Set("prefix", prefix)
  8542. return c
  8543. }
  8544. // Projection sets the optional parameter "projection": Set of
  8545. // properties to return. Defaults to noAcl.
  8546. //
  8547. // Possible values:
  8548. // "full" - Include all properties.
  8549. // "noAcl" - Omit the owner, acl property.
  8550. func (c *ObjectsListCall) Projection(projection string) *ObjectsListCall {
  8551. c.urlParams_.Set("projection", projection)
  8552. return c
  8553. }
  8554. // UserProject sets the optional parameter "userProject": The project to
  8555. // be billed for this request. Required for Requester Pays buckets.
  8556. func (c *ObjectsListCall) UserProject(userProject string) *ObjectsListCall {
  8557. c.urlParams_.Set("userProject", userProject)
  8558. return c
  8559. }
  8560. // Versions sets the optional parameter "versions": If true, lists all
  8561. // versions of an object as distinct results. The default is false. For
  8562. // more information, see Object Versioning.
  8563. func (c *ObjectsListCall) Versions(versions bool) *ObjectsListCall {
  8564. c.urlParams_.Set("versions", fmt.Sprint(versions))
  8565. return c
  8566. }
  8567. // Fields allows partial responses to be retrieved. See
  8568. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  8569. // for more information.
  8570. func (c *ObjectsListCall) Fields(s ...googleapi.Field) *ObjectsListCall {
  8571. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8572. return c
  8573. }
  8574. // IfNoneMatch sets the optional parameter which makes the operation
  8575. // fail if the object's ETag matches the given value. This is useful for
  8576. // getting updates only after the object has changed since the last
  8577. // request. Use googleapi.IsNotModified to check whether the response
  8578. // error from Do is the result of In-None-Match.
  8579. func (c *ObjectsListCall) IfNoneMatch(entityTag string) *ObjectsListCall {
  8580. c.ifNoneMatch_ = entityTag
  8581. return c
  8582. }
  8583. // Context sets the context to be used in this call's Do method. Any
  8584. // pending HTTP request will be aborted if the provided context is
  8585. // canceled.
  8586. func (c *ObjectsListCall) Context(ctx context.Context) *ObjectsListCall {
  8587. c.ctx_ = ctx
  8588. return c
  8589. }
  8590. // Header returns an http.Header that can be modified by the caller to
  8591. // add HTTP headers to the request.
  8592. func (c *ObjectsListCall) Header() http.Header {
  8593. if c.header_ == nil {
  8594. c.header_ = make(http.Header)
  8595. }
  8596. return c.header_
  8597. }
  8598. func (c *ObjectsListCall) doRequest(alt string) (*http.Response, error) {
  8599. reqHeaders := make(http.Header)
  8600. for k, v := range c.header_ {
  8601. reqHeaders[k] = v
  8602. }
  8603. reqHeaders.Set("User-Agent", c.s.userAgent())
  8604. if c.ifNoneMatch_ != "" {
  8605. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  8606. }
  8607. var body io.Reader = nil
  8608. c.urlParams_.Set("alt", alt)
  8609. c.urlParams_.Set("prettyPrint", "false")
  8610. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o")
  8611. urls += "?" + c.urlParams_.Encode()
  8612. req, err := http.NewRequest("GET", urls, body)
  8613. if err != nil {
  8614. return nil, err
  8615. }
  8616. req.Header = reqHeaders
  8617. googleapi.Expand(req.URL, map[string]string{
  8618. "bucket": c.bucket,
  8619. })
  8620. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  8621. }
  8622. // Do executes the "storage.objects.list" call.
  8623. // Exactly one of *Objects or error will be non-nil. Any non-2xx status
  8624. // code is an error. Response headers are in either
  8625. // *Objects.ServerResponse.Header or (if a response was returned at all)
  8626. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  8627. // check whether the returned error was because http.StatusNotModified
  8628. // was returned.
  8629. func (c *ObjectsListCall) Do(opts ...googleapi.CallOption) (*Objects, error) {
  8630. gensupport.SetOptions(c.urlParams_, opts...)
  8631. res, err := c.doRequest("json")
  8632. if res != nil && res.StatusCode == http.StatusNotModified {
  8633. if res.Body != nil {
  8634. res.Body.Close()
  8635. }
  8636. return nil, &googleapi.Error{
  8637. Code: res.StatusCode,
  8638. Header: res.Header,
  8639. }
  8640. }
  8641. if err != nil {
  8642. return nil, err
  8643. }
  8644. defer googleapi.CloseBody(res)
  8645. if err := googleapi.CheckResponse(res); err != nil {
  8646. return nil, err
  8647. }
  8648. ret := &Objects{
  8649. ServerResponse: googleapi.ServerResponse{
  8650. Header: res.Header,
  8651. HTTPStatusCode: res.StatusCode,
  8652. },
  8653. }
  8654. target := &ret
  8655. if err := gensupport.DecodeResponse(target, res); err != nil {
  8656. return nil, err
  8657. }
  8658. return ret, nil
  8659. // {
  8660. // "description": "Retrieves a list of objects matching the criteria.",
  8661. // "httpMethod": "GET",
  8662. // "id": "storage.objects.list",
  8663. // "parameterOrder": [
  8664. // "bucket"
  8665. // ],
  8666. // "parameters": {
  8667. // "bucket": {
  8668. // "description": "Name of the bucket in which to look for objects.",
  8669. // "location": "path",
  8670. // "required": true,
  8671. // "type": "string"
  8672. // },
  8673. // "delimiter": {
  8674. // "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.",
  8675. // "location": "query",
  8676. // "type": "string"
  8677. // },
  8678. // "includeTrailingDelimiter": {
  8679. // "description": "If true, objects that end in exactly one instance of delimiter will have their metadata included in items in addition to prefixes.",
  8680. // "location": "query",
  8681. // "type": "boolean"
  8682. // },
  8683. // "maxResults": {
  8684. // "default": "1000",
  8685. // "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.",
  8686. // "format": "uint32",
  8687. // "location": "query",
  8688. // "minimum": "0",
  8689. // "type": "integer"
  8690. // },
  8691. // "pageToken": {
  8692. // "description": "A previously-returned page token representing part of the larger set of results to view.",
  8693. // "location": "query",
  8694. // "type": "string"
  8695. // },
  8696. // "prefix": {
  8697. // "description": "Filter results to objects whose names begin with this prefix.",
  8698. // "location": "query",
  8699. // "type": "string"
  8700. // },
  8701. // "projection": {
  8702. // "description": "Set of properties to return. Defaults to noAcl.",
  8703. // "enum": [
  8704. // "full",
  8705. // "noAcl"
  8706. // ],
  8707. // "enumDescriptions": [
  8708. // "Include all properties.",
  8709. // "Omit the owner, acl property."
  8710. // ],
  8711. // "location": "query",
  8712. // "type": "string"
  8713. // },
  8714. // "userProject": {
  8715. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  8716. // "location": "query",
  8717. // "type": "string"
  8718. // },
  8719. // "versions": {
  8720. // "description": "If true, lists all versions of an object as distinct results. The default is false. For more information, see Object Versioning.",
  8721. // "location": "query",
  8722. // "type": "boolean"
  8723. // }
  8724. // },
  8725. // "path": "b/{bucket}/o",
  8726. // "response": {
  8727. // "$ref": "Objects"
  8728. // },
  8729. // "scopes": [
  8730. // "https://www.googleapis.com/auth/cloud-platform",
  8731. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  8732. // "https://www.googleapis.com/auth/devstorage.full_control",
  8733. // "https://www.googleapis.com/auth/devstorage.read_only",
  8734. // "https://www.googleapis.com/auth/devstorage.read_write"
  8735. // ],
  8736. // "supportsSubscription": true
  8737. // }
  8738. }
  8739. // Pages invokes f for each page of results.
  8740. // A non-nil error returned from f will halt the iteration.
  8741. // The provided context supersedes any context provided to the Context method.
  8742. func (c *ObjectsListCall) Pages(ctx context.Context, f func(*Objects) error) error {
  8743. c.ctx_ = ctx
  8744. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  8745. for {
  8746. x, err := c.Do()
  8747. if err != nil {
  8748. return err
  8749. }
  8750. if err := f(x); err != nil {
  8751. return err
  8752. }
  8753. if x.NextPageToken == "" {
  8754. return nil
  8755. }
  8756. c.PageToken(x.NextPageToken)
  8757. }
  8758. }
  8759. // method id "storage.objects.patch":
  8760. type ObjectsPatchCall struct {
  8761. s *Service
  8762. bucket string
  8763. object string
  8764. object2 *Object
  8765. urlParams_ gensupport.URLParams
  8766. ctx_ context.Context
  8767. header_ http.Header
  8768. }
  8769. // Patch: Patches an object's metadata.
  8770. func (r *ObjectsService) Patch(bucket string, object string, object2 *Object) *ObjectsPatchCall {
  8771. c := &ObjectsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8772. c.bucket = bucket
  8773. c.object = object
  8774. c.object2 = object2
  8775. return c
  8776. }
  8777. // Generation sets the optional parameter "generation": If present,
  8778. // selects a specific revision of this object (as opposed to the latest
  8779. // version, the default).
  8780. func (c *ObjectsPatchCall) Generation(generation int64) *ObjectsPatchCall {
  8781. c.urlParams_.Set("generation", fmt.Sprint(generation))
  8782. return c
  8783. }
  8784. // IfGenerationMatch sets the optional parameter "ifGenerationMatch":
  8785. // Makes the operation conditional on whether the object's current
  8786. // generation matches the given value. Setting to 0 makes the operation
  8787. // succeed only if there are no live versions of the object.
  8788. func (c *ObjectsPatchCall) IfGenerationMatch(ifGenerationMatch int64) *ObjectsPatchCall {
  8789. c.urlParams_.Set("ifGenerationMatch", fmt.Sprint(ifGenerationMatch))
  8790. return c
  8791. }
  8792. // IfGenerationNotMatch sets the optional parameter
  8793. // "ifGenerationNotMatch": Makes the operation conditional on whether
  8794. // the object's current generation does not match the given value. If no
  8795. // live object exists, the precondition fails. Setting to 0 makes the
  8796. // operation succeed only if there is a live version of the object.
  8797. func (c *ObjectsPatchCall) IfGenerationNotMatch(ifGenerationNotMatch int64) *ObjectsPatchCall {
  8798. c.urlParams_.Set("ifGenerationNotMatch", fmt.Sprint(ifGenerationNotMatch))
  8799. return c
  8800. }
  8801. // IfMetagenerationMatch sets the optional parameter
  8802. // "ifMetagenerationMatch": Makes the operation conditional on whether
  8803. // the object's current metageneration matches the given value.
  8804. func (c *ObjectsPatchCall) IfMetagenerationMatch(ifMetagenerationMatch int64) *ObjectsPatchCall {
  8805. c.urlParams_.Set("ifMetagenerationMatch", fmt.Sprint(ifMetagenerationMatch))
  8806. return c
  8807. }
  8808. // IfMetagenerationNotMatch sets the optional parameter
  8809. // "ifMetagenerationNotMatch": Makes the operation conditional on
  8810. // whether the object's current metageneration does not match the given
  8811. // value.
  8812. func (c *ObjectsPatchCall) IfMetagenerationNotMatch(ifMetagenerationNotMatch int64) *ObjectsPatchCall {
  8813. c.urlParams_.Set("ifMetagenerationNotMatch", fmt.Sprint(ifMetagenerationNotMatch))
  8814. return c
  8815. }
  8816. // PredefinedAcl sets the optional parameter "predefinedAcl": Apply a
  8817. // predefined set of access controls to this object.
  8818. //
  8819. // Possible values:
  8820. // "authenticatedRead" - Object owner gets OWNER access, and
  8821. // allAuthenticatedUsers get READER access.
  8822. // "bucketOwnerFullControl" - Object owner gets OWNER access, and
  8823. // project team owners get OWNER access.
  8824. // "bucketOwnerRead" - Object owner gets OWNER access, and project
  8825. // team owners get READER access.
  8826. // "private" - Object owner gets OWNER access.
  8827. // "projectPrivate" - Object owner gets OWNER access, and project team
  8828. // members get access according to their roles.
  8829. // "publicRead" - Object owner gets OWNER access, and allUsers get
  8830. // READER access.
  8831. func (c *ObjectsPatchCall) PredefinedAcl(predefinedAcl string) *ObjectsPatchCall {
  8832. c.urlParams_.Set("predefinedAcl", predefinedAcl)
  8833. return c
  8834. }
  8835. // Projection sets the optional parameter "projection": Set of
  8836. // properties to return. Defaults to full.
  8837. //
  8838. // Possible values:
  8839. // "full" - Include all properties.
  8840. // "noAcl" - Omit the owner, acl property.
  8841. func (c *ObjectsPatchCall) Projection(projection string) *ObjectsPatchCall {
  8842. c.urlParams_.Set("projection", projection)
  8843. return c
  8844. }
  8845. // UserProject sets the optional parameter "userProject": The project to
  8846. // be billed for this request, for Requester Pays buckets.
  8847. func (c *ObjectsPatchCall) UserProject(userProject string) *ObjectsPatchCall {
  8848. c.urlParams_.Set("userProject", userProject)
  8849. return c
  8850. }
  8851. // Fields allows partial responses to be retrieved. See
  8852. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  8853. // for more information.
  8854. func (c *ObjectsPatchCall) Fields(s ...googleapi.Field) *ObjectsPatchCall {
  8855. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8856. return c
  8857. }
  8858. // Context sets the context to be used in this call's Do method. Any
  8859. // pending HTTP request will be aborted if the provided context is
  8860. // canceled.
  8861. func (c *ObjectsPatchCall) Context(ctx context.Context) *ObjectsPatchCall {
  8862. c.ctx_ = ctx
  8863. return c
  8864. }
  8865. // Header returns an http.Header that can be modified by the caller to
  8866. // add HTTP headers to the request.
  8867. func (c *ObjectsPatchCall) Header() http.Header {
  8868. if c.header_ == nil {
  8869. c.header_ = make(http.Header)
  8870. }
  8871. return c.header_
  8872. }
  8873. func (c *ObjectsPatchCall) doRequest(alt string) (*http.Response, error) {
  8874. reqHeaders := make(http.Header)
  8875. for k, v := range c.header_ {
  8876. reqHeaders[k] = v
  8877. }
  8878. reqHeaders.Set("User-Agent", c.s.userAgent())
  8879. var body io.Reader = nil
  8880. body, err := googleapi.WithoutDataWrapper.JSONReader(c.object2)
  8881. if err != nil {
  8882. return nil, err
  8883. }
  8884. reqHeaders.Set("Content-Type", "application/json")
  8885. c.urlParams_.Set("alt", alt)
  8886. c.urlParams_.Set("prettyPrint", "false")
  8887. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}")
  8888. urls += "?" + c.urlParams_.Encode()
  8889. req, err := http.NewRequest("PATCH", urls, body)
  8890. if err != nil {
  8891. return nil, err
  8892. }
  8893. req.Header = reqHeaders
  8894. googleapi.Expand(req.URL, map[string]string{
  8895. "bucket": c.bucket,
  8896. "object": c.object,
  8897. })
  8898. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  8899. }
  8900. // Do executes the "storage.objects.patch" call.
  8901. // Exactly one of *Object or error will be non-nil. Any non-2xx status
  8902. // code is an error. Response headers are in either
  8903. // *Object.ServerResponse.Header or (if a response was returned at all)
  8904. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  8905. // check whether the returned error was because http.StatusNotModified
  8906. // was returned.
  8907. func (c *ObjectsPatchCall) Do(opts ...googleapi.CallOption) (*Object, error) {
  8908. gensupport.SetOptions(c.urlParams_, opts...)
  8909. res, err := c.doRequest("json")
  8910. if res != nil && res.StatusCode == http.StatusNotModified {
  8911. if res.Body != nil {
  8912. res.Body.Close()
  8913. }
  8914. return nil, &googleapi.Error{
  8915. Code: res.StatusCode,
  8916. Header: res.Header,
  8917. }
  8918. }
  8919. if err != nil {
  8920. return nil, err
  8921. }
  8922. defer googleapi.CloseBody(res)
  8923. if err := googleapi.CheckResponse(res); err != nil {
  8924. return nil, err
  8925. }
  8926. ret := &Object{
  8927. ServerResponse: googleapi.ServerResponse{
  8928. Header: res.Header,
  8929. HTTPStatusCode: res.StatusCode,
  8930. },
  8931. }
  8932. target := &ret
  8933. if err := gensupport.DecodeResponse(target, res); err != nil {
  8934. return nil, err
  8935. }
  8936. return ret, nil
  8937. // {
  8938. // "description": "Patches an object's metadata.",
  8939. // "httpMethod": "PATCH",
  8940. // "id": "storage.objects.patch",
  8941. // "parameterOrder": [
  8942. // "bucket",
  8943. // "object"
  8944. // ],
  8945. // "parameters": {
  8946. // "bucket": {
  8947. // "description": "Name of the bucket in which the object resides.",
  8948. // "location": "path",
  8949. // "required": true,
  8950. // "type": "string"
  8951. // },
  8952. // "generation": {
  8953. // "description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).",
  8954. // "format": "int64",
  8955. // "location": "query",
  8956. // "type": "string"
  8957. // },
  8958. // "ifGenerationMatch": {
  8959. // "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.",
  8960. // "format": "int64",
  8961. // "location": "query",
  8962. // "type": "string"
  8963. // },
  8964. // "ifGenerationNotMatch": {
  8965. // "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.",
  8966. // "format": "int64",
  8967. // "location": "query",
  8968. // "type": "string"
  8969. // },
  8970. // "ifMetagenerationMatch": {
  8971. // "description": "Makes the operation conditional on whether the object's current metageneration matches the given value.",
  8972. // "format": "int64",
  8973. // "location": "query",
  8974. // "type": "string"
  8975. // },
  8976. // "ifMetagenerationNotMatch": {
  8977. // "description": "Makes the operation conditional on whether the object's current metageneration does not match the given value.",
  8978. // "format": "int64",
  8979. // "location": "query",
  8980. // "type": "string"
  8981. // },
  8982. // "object": {
  8983. // "description": "Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
  8984. // "location": "path",
  8985. // "required": true,
  8986. // "type": "string"
  8987. // },
  8988. // "predefinedAcl": {
  8989. // "description": "Apply a predefined set of access controls to this object.",
  8990. // "enum": [
  8991. // "authenticatedRead",
  8992. // "bucketOwnerFullControl",
  8993. // "bucketOwnerRead",
  8994. // "private",
  8995. // "projectPrivate",
  8996. // "publicRead"
  8997. // ],
  8998. // "enumDescriptions": [
  8999. // "Object owner gets OWNER access, and allAuthenticatedUsers get READER access.",
  9000. // "Object owner gets OWNER access, and project team owners get OWNER access.",
  9001. // "Object owner gets OWNER access, and project team owners get READER access.",
  9002. // "Object owner gets OWNER access.",
  9003. // "Object owner gets OWNER access, and project team members get access according to their roles.",
  9004. // "Object owner gets OWNER access, and allUsers get READER access."
  9005. // ],
  9006. // "location": "query",
  9007. // "type": "string"
  9008. // },
  9009. // "projection": {
  9010. // "description": "Set of properties to return. Defaults to full.",
  9011. // "enum": [
  9012. // "full",
  9013. // "noAcl"
  9014. // ],
  9015. // "enumDescriptions": [
  9016. // "Include all properties.",
  9017. // "Omit the owner, acl property."
  9018. // ],
  9019. // "location": "query",
  9020. // "type": "string"
  9021. // },
  9022. // "userProject": {
  9023. // "description": "The project to be billed for this request, for Requester Pays buckets.",
  9024. // "location": "query",
  9025. // "type": "string"
  9026. // }
  9027. // },
  9028. // "path": "b/{bucket}/o/{object}",
  9029. // "request": {
  9030. // "$ref": "Object"
  9031. // },
  9032. // "response": {
  9033. // "$ref": "Object"
  9034. // },
  9035. // "scopes": [
  9036. // "https://www.googleapis.com/auth/cloud-platform",
  9037. // "https://www.googleapis.com/auth/devstorage.full_control"
  9038. // ]
  9039. // }
  9040. }
  9041. // method id "storage.objects.rewrite":
  9042. type ObjectsRewriteCall struct {
  9043. s *Service
  9044. sourceBucket string
  9045. sourceObject string
  9046. destinationBucket string
  9047. destinationObject string
  9048. object *Object
  9049. urlParams_ gensupport.URLParams
  9050. ctx_ context.Context
  9051. header_ http.Header
  9052. }
  9053. // Rewrite: Rewrites a source object to a destination object. Optionally
  9054. // overrides metadata.
  9055. func (r *ObjectsService) Rewrite(sourceBucket string, sourceObject string, destinationBucket string, destinationObject string, object *Object) *ObjectsRewriteCall {
  9056. c := &ObjectsRewriteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  9057. c.sourceBucket = sourceBucket
  9058. c.sourceObject = sourceObject
  9059. c.destinationBucket = destinationBucket
  9060. c.destinationObject = destinationObject
  9061. c.object = object
  9062. return c
  9063. }
  9064. // DestinationKmsKeyName sets the optional parameter
  9065. // "destinationKmsKeyName": Resource name of the Cloud KMS key, of the
  9066. // form
  9067. // projects/my-project/locations/global/keyRings/my-kr/cryptoKeys/my-key,
  9068. // that will be used to encrypt the object. Overrides the object
  9069. // metadata's kms_key_name value, if any.
  9070. func (c *ObjectsRewriteCall) DestinationKmsKeyName(destinationKmsKeyName string) *ObjectsRewriteCall {
  9071. c.urlParams_.Set("destinationKmsKeyName", destinationKmsKeyName)
  9072. return c
  9073. }
  9074. // DestinationPredefinedAcl sets the optional parameter
  9075. // "destinationPredefinedAcl": Apply a predefined set of access controls
  9076. // to the destination object.
  9077. //
  9078. // Possible values:
  9079. // "authenticatedRead" - Object owner gets OWNER access, and
  9080. // allAuthenticatedUsers get READER access.
  9081. // "bucketOwnerFullControl" - Object owner gets OWNER access, and
  9082. // project team owners get OWNER access.
  9083. // "bucketOwnerRead" - Object owner gets OWNER access, and project
  9084. // team owners get READER access.
  9085. // "private" - Object owner gets OWNER access.
  9086. // "projectPrivate" - Object owner gets OWNER access, and project team
  9087. // members get access according to their roles.
  9088. // "publicRead" - Object owner gets OWNER access, and allUsers get
  9089. // READER access.
  9090. func (c *ObjectsRewriteCall) DestinationPredefinedAcl(destinationPredefinedAcl string) *ObjectsRewriteCall {
  9091. c.urlParams_.Set("destinationPredefinedAcl", destinationPredefinedAcl)
  9092. return c
  9093. }
  9094. // IfGenerationMatch sets the optional parameter "ifGenerationMatch":
  9095. // Makes the operation conditional on whether the object's current
  9096. // generation matches the given value. Setting to 0 makes the operation
  9097. // succeed only if there are no live versions of the object.
  9098. func (c *ObjectsRewriteCall) IfGenerationMatch(ifGenerationMatch int64) *ObjectsRewriteCall {
  9099. c.urlParams_.Set("ifGenerationMatch", fmt.Sprint(ifGenerationMatch))
  9100. return c
  9101. }
  9102. // IfGenerationNotMatch sets the optional parameter
  9103. // "ifGenerationNotMatch": Makes the operation conditional on whether
  9104. // the object's current generation does not match the given value. If no
  9105. // live object exists, the precondition fails. Setting to 0 makes the
  9106. // operation succeed only if there is a live version of the object.
  9107. func (c *ObjectsRewriteCall) IfGenerationNotMatch(ifGenerationNotMatch int64) *ObjectsRewriteCall {
  9108. c.urlParams_.Set("ifGenerationNotMatch", fmt.Sprint(ifGenerationNotMatch))
  9109. return c
  9110. }
  9111. // IfMetagenerationMatch sets the optional parameter
  9112. // "ifMetagenerationMatch": Makes the operation conditional on whether
  9113. // the destination object's current metageneration matches the given
  9114. // value.
  9115. func (c *ObjectsRewriteCall) IfMetagenerationMatch(ifMetagenerationMatch int64) *ObjectsRewriteCall {
  9116. c.urlParams_.Set("ifMetagenerationMatch", fmt.Sprint(ifMetagenerationMatch))
  9117. return c
  9118. }
  9119. // IfMetagenerationNotMatch sets the optional parameter
  9120. // "ifMetagenerationNotMatch": Makes the operation conditional on
  9121. // whether the destination object's current metageneration does not
  9122. // match the given value.
  9123. func (c *ObjectsRewriteCall) IfMetagenerationNotMatch(ifMetagenerationNotMatch int64) *ObjectsRewriteCall {
  9124. c.urlParams_.Set("ifMetagenerationNotMatch", fmt.Sprint(ifMetagenerationNotMatch))
  9125. return c
  9126. }
  9127. // IfSourceGenerationMatch sets the optional parameter
  9128. // "ifSourceGenerationMatch": Makes the operation conditional on whether
  9129. // the source object's current generation matches the given value.
  9130. func (c *ObjectsRewriteCall) IfSourceGenerationMatch(ifSourceGenerationMatch int64) *ObjectsRewriteCall {
  9131. c.urlParams_.Set("ifSourceGenerationMatch", fmt.Sprint(ifSourceGenerationMatch))
  9132. return c
  9133. }
  9134. // IfSourceGenerationNotMatch sets the optional parameter
  9135. // "ifSourceGenerationNotMatch": Makes the operation conditional on
  9136. // whether the source object's current generation does not match the
  9137. // given value.
  9138. func (c *ObjectsRewriteCall) IfSourceGenerationNotMatch(ifSourceGenerationNotMatch int64) *ObjectsRewriteCall {
  9139. c.urlParams_.Set("ifSourceGenerationNotMatch", fmt.Sprint(ifSourceGenerationNotMatch))
  9140. return c
  9141. }
  9142. // IfSourceMetagenerationMatch sets the optional parameter
  9143. // "ifSourceMetagenerationMatch": Makes the operation conditional on
  9144. // whether the source object's current metageneration matches the given
  9145. // value.
  9146. func (c *ObjectsRewriteCall) IfSourceMetagenerationMatch(ifSourceMetagenerationMatch int64) *ObjectsRewriteCall {
  9147. c.urlParams_.Set("ifSourceMetagenerationMatch", fmt.Sprint(ifSourceMetagenerationMatch))
  9148. return c
  9149. }
  9150. // IfSourceMetagenerationNotMatch sets the optional parameter
  9151. // "ifSourceMetagenerationNotMatch": Makes the operation conditional on
  9152. // whether the source object's current metageneration does not match the
  9153. // given value.
  9154. func (c *ObjectsRewriteCall) IfSourceMetagenerationNotMatch(ifSourceMetagenerationNotMatch int64) *ObjectsRewriteCall {
  9155. c.urlParams_.Set("ifSourceMetagenerationNotMatch", fmt.Sprint(ifSourceMetagenerationNotMatch))
  9156. return c
  9157. }
  9158. // MaxBytesRewrittenPerCall sets the optional parameter
  9159. // "maxBytesRewrittenPerCall": The maximum number of bytes that will be
  9160. // rewritten per rewrite request. Most callers shouldn't need to specify
  9161. // this parameter - it is primarily in place to support testing. If
  9162. // specified the value must be an integral multiple of 1 MiB (1048576).
  9163. // Also, this only applies to requests where the source and destination
  9164. // span locations and/or storage classes. Finally, this value must not
  9165. // change across rewrite calls else you'll get an error that the
  9166. // rewriteToken is invalid.
  9167. func (c *ObjectsRewriteCall) MaxBytesRewrittenPerCall(maxBytesRewrittenPerCall int64) *ObjectsRewriteCall {
  9168. c.urlParams_.Set("maxBytesRewrittenPerCall", fmt.Sprint(maxBytesRewrittenPerCall))
  9169. return c
  9170. }
  9171. // Projection sets the optional parameter "projection": Set of
  9172. // properties to return. Defaults to noAcl, unless the object resource
  9173. // specifies the acl property, when it defaults to full.
  9174. //
  9175. // Possible values:
  9176. // "full" - Include all properties.
  9177. // "noAcl" - Omit the owner, acl property.
  9178. func (c *ObjectsRewriteCall) Projection(projection string) *ObjectsRewriteCall {
  9179. c.urlParams_.Set("projection", projection)
  9180. return c
  9181. }
  9182. // RewriteToken sets the optional parameter "rewriteToken": Include this
  9183. // field (from the previous rewrite response) on each rewrite request
  9184. // after the first one, until the rewrite response 'done' flag is true.
  9185. // Calls that provide a rewriteToken can omit all other request fields,
  9186. // but if included those fields must match the values provided in the
  9187. // first rewrite request.
  9188. func (c *ObjectsRewriteCall) RewriteToken(rewriteToken string) *ObjectsRewriteCall {
  9189. c.urlParams_.Set("rewriteToken", rewriteToken)
  9190. return c
  9191. }
  9192. // SourceGeneration sets the optional parameter "sourceGeneration": If
  9193. // present, selects a specific revision of the source object (as opposed
  9194. // to the latest version, the default).
  9195. func (c *ObjectsRewriteCall) SourceGeneration(sourceGeneration int64) *ObjectsRewriteCall {
  9196. c.urlParams_.Set("sourceGeneration", fmt.Sprint(sourceGeneration))
  9197. return c
  9198. }
  9199. // UserProject sets the optional parameter "userProject": The project to
  9200. // be billed for this request. Required for Requester Pays buckets.
  9201. func (c *ObjectsRewriteCall) UserProject(userProject string) *ObjectsRewriteCall {
  9202. c.urlParams_.Set("userProject", userProject)
  9203. return c
  9204. }
  9205. // Fields allows partial responses to be retrieved. See
  9206. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  9207. // for more information.
  9208. func (c *ObjectsRewriteCall) Fields(s ...googleapi.Field) *ObjectsRewriteCall {
  9209. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  9210. return c
  9211. }
  9212. // Context sets the context to be used in this call's Do method. Any
  9213. // pending HTTP request will be aborted if the provided context is
  9214. // canceled.
  9215. func (c *ObjectsRewriteCall) Context(ctx context.Context) *ObjectsRewriteCall {
  9216. c.ctx_ = ctx
  9217. return c
  9218. }
  9219. // Header returns an http.Header that can be modified by the caller to
  9220. // add HTTP headers to the request.
  9221. func (c *ObjectsRewriteCall) Header() http.Header {
  9222. if c.header_ == nil {
  9223. c.header_ = make(http.Header)
  9224. }
  9225. return c.header_
  9226. }
  9227. func (c *ObjectsRewriteCall) doRequest(alt string) (*http.Response, error) {
  9228. reqHeaders := make(http.Header)
  9229. for k, v := range c.header_ {
  9230. reqHeaders[k] = v
  9231. }
  9232. reqHeaders.Set("User-Agent", c.s.userAgent())
  9233. var body io.Reader = nil
  9234. body, err := googleapi.WithoutDataWrapper.JSONReader(c.object)
  9235. if err != nil {
  9236. return nil, err
  9237. }
  9238. reqHeaders.Set("Content-Type", "application/json")
  9239. c.urlParams_.Set("alt", alt)
  9240. c.urlParams_.Set("prettyPrint", "false")
  9241. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{sourceBucket}/o/{sourceObject}/rewriteTo/b/{destinationBucket}/o/{destinationObject}")
  9242. urls += "?" + c.urlParams_.Encode()
  9243. req, err := http.NewRequest("POST", urls, body)
  9244. if err != nil {
  9245. return nil, err
  9246. }
  9247. req.Header = reqHeaders
  9248. googleapi.Expand(req.URL, map[string]string{
  9249. "sourceBucket": c.sourceBucket,
  9250. "sourceObject": c.sourceObject,
  9251. "destinationBucket": c.destinationBucket,
  9252. "destinationObject": c.destinationObject,
  9253. })
  9254. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  9255. }
  9256. // Do executes the "storage.objects.rewrite" call.
  9257. // Exactly one of *RewriteResponse or error will be non-nil. Any non-2xx
  9258. // status code is an error. Response headers are in either
  9259. // *RewriteResponse.ServerResponse.Header or (if a response was returned
  9260. // at all) in error.(*googleapi.Error).Header. Use
  9261. // googleapi.IsNotModified to check whether the returned error was
  9262. // because http.StatusNotModified was returned.
  9263. func (c *ObjectsRewriteCall) Do(opts ...googleapi.CallOption) (*RewriteResponse, error) {
  9264. gensupport.SetOptions(c.urlParams_, opts...)
  9265. res, err := c.doRequest("json")
  9266. if res != nil && res.StatusCode == http.StatusNotModified {
  9267. if res.Body != nil {
  9268. res.Body.Close()
  9269. }
  9270. return nil, &googleapi.Error{
  9271. Code: res.StatusCode,
  9272. Header: res.Header,
  9273. }
  9274. }
  9275. if err != nil {
  9276. return nil, err
  9277. }
  9278. defer googleapi.CloseBody(res)
  9279. if err := googleapi.CheckResponse(res); err != nil {
  9280. return nil, err
  9281. }
  9282. ret := &RewriteResponse{
  9283. ServerResponse: googleapi.ServerResponse{
  9284. Header: res.Header,
  9285. HTTPStatusCode: res.StatusCode,
  9286. },
  9287. }
  9288. target := &ret
  9289. if err := gensupport.DecodeResponse(target, res); err != nil {
  9290. return nil, err
  9291. }
  9292. return ret, nil
  9293. // {
  9294. // "description": "Rewrites a source object to a destination object. Optionally overrides metadata.",
  9295. // "httpMethod": "POST",
  9296. // "id": "storage.objects.rewrite",
  9297. // "parameterOrder": [
  9298. // "sourceBucket",
  9299. // "sourceObject",
  9300. // "destinationBucket",
  9301. // "destinationObject"
  9302. // ],
  9303. // "parameters": {
  9304. // "destinationBucket": {
  9305. // "description": "Name of the bucket in which to store the new object. Overrides the provided object metadata's bucket value, if any.",
  9306. // "location": "path",
  9307. // "required": true,
  9308. // "type": "string"
  9309. // },
  9310. // "destinationKmsKeyName": {
  9311. // "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.",
  9312. // "location": "query",
  9313. // "type": "string"
  9314. // },
  9315. // "destinationObject": {
  9316. // "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.",
  9317. // "location": "path",
  9318. // "required": true,
  9319. // "type": "string"
  9320. // },
  9321. // "destinationPredefinedAcl": {
  9322. // "description": "Apply a predefined set of access controls to the destination object.",
  9323. // "enum": [
  9324. // "authenticatedRead",
  9325. // "bucketOwnerFullControl",
  9326. // "bucketOwnerRead",
  9327. // "private",
  9328. // "projectPrivate",
  9329. // "publicRead"
  9330. // ],
  9331. // "enumDescriptions": [
  9332. // "Object owner gets OWNER access, and allAuthenticatedUsers get READER access.",
  9333. // "Object owner gets OWNER access, and project team owners get OWNER access.",
  9334. // "Object owner gets OWNER access, and project team owners get READER access.",
  9335. // "Object owner gets OWNER access.",
  9336. // "Object owner gets OWNER access, and project team members get access according to their roles.",
  9337. // "Object owner gets OWNER access, and allUsers get READER access."
  9338. // ],
  9339. // "location": "query",
  9340. // "type": "string"
  9341. // },
  9342. // "ifGenerationMatch": {
  9343. // "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.",
  9344. // "format": "int64",
  9345. // "location": "query",
  9346. // "type": "string"
  9347. // },
  9348. // "ifGenerationNotMatch": {
  9349. // "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.",
  9350. // "format": "int64",
  9351. // "location": "query",
  9352. // "type": "string"
  9353. // },
  9354. // "ifMetagenerationMatch": {
  9355. // "description": "Makes the operation conditional on whether the destination object's current metageneration matches the given value.",
  9356. // "format": "int64",
  9357. // "location": "query",
  9358. // "type": "string"
  9359. // },
  9360. // "ifMetagenerationNotMatch": {
  9361. // "description": "Makes the operation conditional on whether the destination object's current metageneration does not match the given value.",
  9362. // "format": "int64",
  9363. // "location": "query",
  9364. // "type": "string"
  9365. // },
  9366. // "ifSourceGenerationMatch": {
  9367. // "description": "Makes the operation conditional on whether the source object's current generation matches the given value.",
  9368. // "format": "int64",
  9369. // "location": "query",
  9370. // "type": "string"
  9371. // },
  9372. // "ifSourceGenerationNotMatch": {
  9373. // "description": "Makes the operation conditional on whether the source object's current generation does not match the given value.",
  9374. // "format": "int64",
  9375. // "location": "query",
  9376. // "type": "string"
  9377. // },
  9378. // "ifSourceMetagenerationMatch": {
  9379. // "description": "Makes the operation conditional on whether the source object's current metageneration matches the given value.",
  9380. // "format": "int64",
  9381. // "location": "query",
  9382. // "type": "string"
  9383. // },
  9384. // "ifSourceMetagenerationNotMatch": {
  9385. // "description": "Makes the operation conditional on whether the source object's current metageneration does not match the given value.",
  9386. // "format": "int64",
  9387. // "location": "query",
  9388. // "type": "string"
  9389. // },
  9390. // "maxBytesRewrittenPerCall": {
  9391. // "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.",
  9392. // "format": "int64",
  9393. // "location": "query",
  9394. // "type": "string"
  9395. // },
  9396. // "projection": {
  9397. // "description": "Set of properties to return. Defaults to noAcl, unless the object resource specifies the acl property, when it defaults to full.",
  9398. // "enum": [
  9399. // "full",
  9400. // "noAcl"
  9401. // ],
  9402. // "enumDescriptions": [
  9403. // "Include all properties.",
  9404. // "Omit the owner, acl property."
  9405. // ],
  9406. // "location": "query",
  9407. // "type": "string"
  9408. // },
  9409. // "rewriteToken": {
  9410. // "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.",
  9411. // "location": "query",
  9412. // "type": "string"
  9413. // },
  9414. // "sourceBucket": {
  9415. // "description": "Name of the bucket in which to find the source object.",
  9416. // "location": "path",
  9417. // "required": true,
  9418. // "type": "string"
  9419. // },
  9420. // "sourceGeneration": {
  9421. // "description": "If present, selects a specific revision of the source object (as opposed to the latest version, the default).",
  9422. // "format": "int64",
  9423. // "location": "query",
  9424. // "type": "string"
  9425. // },
  9426. // "sourceObject": {
  9427. // "description": "Name of the source object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
  9428. // "location": "path",
  9429. // "required": true,
  9430. // "type": "string"
  9431. // },
  9432. // "userProject": {
  9433. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  9434. // "location": "query",
  9435. // "type": "string"
  9436. // }
  9437. // },
  9438. // "path": "b/{sourceBucket}/o/{sourceObject}/rewriteTo/b/{destinationBucket}/o/{destinationObject}",
  9439. // "request": {
  9440. // "$ref": "Object"
  9441. // },
  9442. // "response": {
  9443. // "$ref": "RewriteResponse"
  9444. // },
  9445. // "scopes": [
  9446. // "https://www.googleapis.com/auth/cloud-platform",
  9447. // "https://www.googleapis.com/auth/devstorage.full_control",
  9448. // "https://www.googleapis.com/auth/devstorage.read_write"
  9449. // ]
  9450. // }
  9451. }
  9452. // method id "storage.objects.setIamPolicy":
  9453. type ObjectsSetIamPolicyCall struct {
  9454. s *Service
  9455. bucket string
  9456. object string
  9457. policy *Policy
  9458. urlParams_ gensupport.URLParams
  9459. ctx_ context.Context
  9460. header_ http.Header
  9461. }
  9462. // SetIamPolicy: Updates an IAM policy for the specified object.
  9463. func (r *ObjectsService) SetIamPolicy(bucket string, object string, policy *Policy) *ObjectsSetIamPolicyCall {
  9464. c := &ObjectsSetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  9465. c.bucket = bucket
  9466. c.object = object
  9467. c.policy = policy
  9468. return c
  9469. }
  9470. // Generation sets the optional parameter "generation": If present,
  9471. // selects a specific revision of this object (as opposed to the latest
  9472. // version, the default).
  9473. func (c *ObjectsSetIamPolicyCall) Generation(generation int64) *ObjectsSetIamPolicyCall {
  9474. c.urlParams_.Set("generation", fmt.Sprint(generation))
  9475. return c
  9476. }
  9477. // UserProject sets the optional parameter "userProject": The project to
  9478. // be billed for this request. Required for Requester Pays buckets.
  9479. func (c *ObjectsSetIamPolicyCall) UserProject(userProject string) *ObjectsSetIamPolicyCall {
  9480. c.urlParams_.Set("userProject", userProject)
  9481. return c
  9482. }
  9483. // Fields allows partial responses to be retrieved. See
  9484. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  9485. // for more information.
  9486. func (c *ObjectsSetIamPolicyCall) Fields(s ...googleapi.Field) *ObjectsSetIamPolicyCall {
  9487. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  9488. return c
  9489. }
  9490. // Context sets the context to be used in this call's Do method. Any
  9491. // pending HTTP request will be aborted if the provided context is
  9492. // canceled.
  9493. func (c *ObjectsSetIamPolicyCall) Context(ctx context.Context) *ObjectsSetIamPolicyCall {
  9494. c.ctx_ = ctx
  9495. return c
  9496. }
  9497. // Header returns an http.Header that can be modified by the caller to
  9498. // add HTTP headers to the request.
  9499. func (c *ObjectsSetIamPolicyCall) Header() http.Header {
  9500. if c.header_ == nil {
  9501. c.header_ = make(http.Header)
  9502. }
  9503. return c.header_
  9504. }
  9505. func (c *ObjectsSetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
  9506. reqHeaders := make(http.Header)
  9507. for k, v := range c.header_ {
  9508. reqHeaders[k] = v
  9509. }
  9510. reqHeaders.Set("User-Agent", c.s.userAgent())
  9511. var body io.Reader = nil
  9512. body, err := googleapi.WithoutDataWrapper.JSONReader(c.policy)
  9513. if err != nil {
  9514. return nil, err
  9515. }
  9516. reqHeaders.Set("Content-Type", "application/json")
  9517. c.urlParams_.Set("alt", alt)
  9518. c.urlParams_.Set("prettyPrint", "false")
  9519. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}/iam")
  9520. urls += "?" + c.urlParams_.Encode()
  9521. req, err := http.NewRequest("PUT", urls, body)
  9522. if err != nil {
  9523. return nil, err
  9524. }
  9525. req.Header = reqHeaders
  9526. googleapi.Expand(req.URL, map[string]string{
  9527. "bucket": c.bucket,
  9528. "object": c.object,
  9529. })
  9530. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  9531. }
  9532. // Do executes the "storage.objects.setIamPolicy" call.
  9533. // Exactly one of *Policy or error will be non-nil. Any non-2xx status
  9534. // code is an error. Response headers are in either
  9535. // *Policy.ServerResponse.Header or (if a response was returned at all)
  9536. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  9537. // check whether the returned error was because http.StatusNotModified
  9538. // was returned.
  9539. func (c *ObjectsSetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) {
  9540. gensupport.SetOptions(c.urlParams_, opts...)
  9541. res, err := c.doRequest("json")
  9542. if res != nil && res.StatusCode == http.StatusNotModified {
  9543. if res.Body != nil {
  9544. res.Body.Close()
  9545. }
  9546. return nil, &googleapi.Error{
  9547. Code: res.StatusCode,
  9548. Header: res.Header,
  9549. }
  9550. }
  9551. if err != nil {
  9552. return nil, err
  9553. }
  9554. defer googleapi.CloseBody(res)
  9555. if err := googleapi.CheckResponse(res); err != nil {
  9556. return nil, err
  9557. }
  9558. ret := &Policy{
  9559. ServerResponse: googleapi.ServerResponse{
  9560. Header: res.Header,
  9561. HTTPStatusCode: res.StatusCode,
  9562. },
  9563. }
  9564. target := &ret
  9565. if err := gensupport.DecodeResponse(target, res); err != nil {
  9566. return nil, err
  9567. }
  9568. return ret, nil
  9569. // {
  9570. // "description": "Updates an IAM policy for the specified object.",
  9571. // "httpMethod": "PUT",
  9572. // "id": "storage.objects.setIamPolicy",
  9573. // "parameterOrder": [
  9574. // "bucket",
  9575. // "object"
  9576. // ],
  9577. // "parameters": {
  9578. // "bucket": {
  9579. // "description": "Name of the bucket in which the object resides.",
  9580. // "location": "path",
  9581. // "required": true,
  9582. // "type": "string"
  9583. // },
  9584. // "generation": {
  9585. // "description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).",
  9586. // "format": "int64",
  9587. // "location": "query",
  9588. // "type": "string"
  9589. // },
  9590. // "object": {
  9591. // "description": "Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
  9592. // "location": "path",
  9593. // "required": true,
  9594. // "type": "string"
  9595. // },
  9596. // "userProject": {
  9597. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  9598. // "location": "query",
  9599. // "type": "string"
  9600. // }
  9601. // },
  9602. // "path": "b/{bucket}/o/{object}/iam",
  9603. // "request": {
  9604. // "$ref": "Policy"
  9605. // },
  9606. // "response": {
  9607. // "$ref": "Policy"
  9608. // },
  9609. // "scopes": [
  9610. // "https://www.googleapis.com/auth/cloud-platform",
  9611. // "https://www.googleapis.com/auth/devstorage.full_control",
  9612. // "https://www.googleapis.com/auth/devstorage.read_write"
  9613. // ]
  9614. // }
  9615. }
  9616. // method id "storage.objects.testIamPermissions":
  9617. type ObjectsTestIamPermissionsCall struct {
  9618. s *Service
  9619. bucket string
  9620. object string
  9621. urlParams_ gensupport.URLParams
  9622. ifNoneMatch_ string
  9623. ctx_ context.Context
  9624. header_ http.Header
  9625. }
  9626. // TestIamPermissions: Tests a set of permissions on the given object to
  9627. // see which, if any, are held by the caller.
  9628. func (r *ObjectsService) TestIamPermissions(bucket string, object string, permissions []string) *ObjectsTestIamPermissionsCall {
  9629. c := &ObjectsTestIamPermissionsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  9630. c.bucket = bucket
  9631. c.object = object
  9632. c.urlParams_.SetMulti("permissions", append([]string{}, permissions...))
  9633. return c
  9634. }
  9635. // Generation sets the optional parameter "generation": If present,
  9636. // selects a specific revision of this object (as opposed to the latest
  9637. // version, the default).
  9638. func (c *ObjectsTestIamPermissionsCall) Generation(generation int64) *ObjectsTestIamPermissionsCall {
  9639. c.urlParams_.Set("generation", fmt.Sprint(generation))
  9640. return c
  9641. }
  9642. // UserProject sets the optional parameter "userProject": The project to
  9643. // be billed for this request. Required for Requester Pays buckets.
  9644. func (c *ObjectsTestIamPermissionsCall) UserProject(userProject string) *ObjectsTestIamPermissionsCall {
  9645. c.urlParams_.Set("userProject", userProject)
  9646. return c
  9647. }
  9648. // Fields allows partial responses to be retrieved. See
  9649. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  9650. // for more information.
  9651. func (c *ObjectsTestIamPermissionsCall) Fields(s ...googleapi.Field) *ObjectsTestIamPermissionsCall {
  9652. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  9653. return c
  9654. }
  9655. // IfNoneMatch sets the optional parameter which makes the operation
  9656. // fail if the object's ETag matches the given value. This is useful for
  9657. // getting updates only after the object has changed since the last
  9658. // request. Use googleapi.IsNotModified to check whether the response
  9659. // error from Do is the result of In-None-Match.
  9660. func (c *ObjectsTestIamPermissionsCall) IfNoneMatch(entityTag string) *ObjectsTestIamPermissionsCall {
  9661. c.ifNoneMatch_ = entityTag
  9662. return c
  9663. }
  9664. // Context sets the context to be used in this call's Do method. Any
  9665. // pending HTTP request will be aborted if the provided context is
  9666. // canceled.
  9667. func (c *ObjectsTestIamPermissionsCall) Context(ctx context.Context) *ObjectsTestIamPermissionsCall {
  9668. c.ctx_ = ctx
  9669. return c
  9670. }
  9671. // Header returns an http.Header that can be modified by the caller to
  9672. // add HTTP headers to the request.
  9673. func (c *ObjectsTestIamPermissionsCall) Header() http.Header {
  9674. if c.header_ == nil {
  9675. c.header_ = make(http.Header)
  9676. }
  9677. return c.header_
  9678. }
  9679. func (c *ObjectsTestIamPermissionsCall) doRequest(alt string) (*http.Response, error) {
  9680. reqHeaders := make(http.Header)
  9681. for k, v := range c.header_ {
  9682. reqHeaders[k] = v
  9683. }
  9684. reqHeaders.Set("User-Agent", c.s.userAgent())
  9685. if c.ifNoneMatch_ != "" {
  9686. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  9687. }
  9688. var body io.Reader = nil
  9689. c.urlParams_.Set("alt", alt)
  9690. c.urlParams_.Set("prettyPrint", "false")
  9691. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}/iam/testPermissions")
  9692. urls += "?" + c.urlParams_.Encode()
  9693. req, err := http.NewRequest("GET", urls, body)
  9694. if err != nil {
  9695. return nil, err
  9696. }
  9697. req.Header = reqHeaders
  9698. googleapi.Expand(req.URL, map[string]string{
  9699. "bucket": c.bucket,
  9700. "object": c.object,
  9701. })
  9702. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  9703. }
  9704. // Do executes the "storage.objects.testIamPermissions" call.
  9705. // Exactly one of *TestIamPermissionsResponse or error will be non-nil.
  9706. // Any non-2xx status code is an error. Response headers are in either
  9707. // *TestIamPermissionsResponse.ServerResponse.Header or (if a response
  9708. // was returned at all) in error.(*googleapi.Error).Header. Use
  9709. // googleapi.IsNotModified to check whether the returned error was
  9710. // because http.StatusNotModified was returned.
  9711. func (c *ObjectsTestIamPermissionsCall) Do(opts ...googleapi.CallOption) (*TestIamPermissionsResponse, error) {
  9712. gensupport.SetOptions(c.urlParams_, opts...)
  9713. res, err := c.doRequest("json")
  9714. if res != nil && res.StatusCode == http.StatusNotModified {
  9715. if res.Body != nil {
  9716. res.Body.Close()
  9717. }
  9718. return nil, &googleapi.Error{
  9719. Code: res.StatusCode,
  9720. Header: res.Header,
  9721. }
  9722. }
  9723. if err != nil {
  9724. return nil, err
  9725. }
  9726. defer googleapi.CloseBody(res)
  9727. if err := googleapi.CheckResponse(res); err != nil {
  9728. return nil, err
  9729. }
  9730. ret := &TestIamPermissionsResponse{
  9731. ServerResponse: googleapi.ServerResponse{
  9732. Header: res.Header,
  9733. HTTPStatusCode: res.StatusCode,
  9734. },
  9735. }
  9736. target := &ret
  9737. if err := gensupport.DecodeResponse(target, res); err != nil {
  9738. return nil, err
  9739. }
  9740. return ret, nil
  9741. // {
  9742. // "description": "Tests a set of permissions on the given object to see which, if any, are held by the caller.",
  9743. // "httpMethod": "GET",
  9744. // "id": "storage.objects.testIamPermissions",
  9745. // "parameterOrder": [
  9746. // "bucket",
  9747. // "object",
  9748. // "permissions"
  9749. // ],
  9750. // "parameters": {
  9751. // "bucket": {
  9752. // "description": "Name of the bucket in which the object resides.",
  9753. // "location": "path",
  9754. // "required": true,
  9755. // "type": "string"
  9756. // },
  9757. // "generation": {
  9758. // "description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).",
  9759. // "format": "int64",
  9760. // "location": "query",
  9761. // "type": "string"
  9762. // },
  9763. // "object": {
  9764. // "description": "Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
  9765. // "location": "path",
  9766. // "required": true,
  9767. // "type": "string"
  9768. // },
  9769. // "permissions": {
  9770. // "description": "Permissions to test.",
  9771. // "location": "query",
  9772. // "repeated": true,
  9773. // "required": true,
  9774. // "type": "string"
  9775. // },
  9776. // "userProject": {
  9777. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  9778. // "location": "query",
  9779. // "type": "string"
  9780. // }
  9781. // },
  9782. // "path": "b/{bucket}/o/{object}/iam/testPermissions",
  9783. // "response": {
  9784. // "$ref": "TestIamPermissionsResponse"
  9785. // },
  9786. // "scopes": [
  9787. // "https://www.googleapis.com/auth/cloud-platform",
  9788. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  9789. // "https://www.googleapis.com/auth/devstorage.full_control",
  9790. // "https://www.googleapis.com/auth/devstorage.read_only",
  9791. // "https://www.googleapis.com/auth/devstorage.read_write"
  9792. // ]
  9793. // }
  9794. }
  9795. // method id "storage.objects.update":
  9796. type ObjectsUpdateCall struct {
  9797. s *Service
  9798. bucket string
  9799. object string
  9800. object2 *Object
  9801. urlParams_ gensupport.URLParams
  9802. ctx_ context.Context
  9803. header_ http.Header
  9804. }
  9805. // Update: Updates an object's metadata.
  9806. func (r *ObjectsService) Update(bucket string, object string, object2 *Object) *ObjectsUpdateCall {
  9807. c := &ObjectsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  9808. c.bucket = bucket
  9809. c.object = object
  9810. c.object2 = object2
  9811. return c
  9812. }
  9813. // Generation sets the optional parameter "generation": If present,
  9814. // selects a specific revision of this object (as opposed to the latest
  9815. // version, the default).
  9816. func (c *ObjectsUpdateCall) Generation(generation int64) *ObjectsUpdateCall {
  9817. c.urlParams_.Set("generation", fmt.Sprint(generation))
  9818. return c
  9819. }
  9820. // IfGenerationMatch sets the optional parameter "ifGenerationMatch":
  9821. // Makes the operation conditional on whether the object's current
  9822. // generation matches the given value. Setting to 0 makes the operation
  9823. // succeed only if there are no live versions of the object.
  9824. func (c *ObjectsUpdateCall) IfGenerationMatch(ifGenerationMatch int64) *ObjectsUpdateCall {
  9825. c.urlParams_.Set("ifGenerationMatch", fmt.Sprint(ifGenerationMatch))
  9826. return c
  9827. }
  9828. // IfGenerationNotMatch sets the optional parameter
  9829. // "ifGenerationNotMatch": Makes the operation conditional on whether
  9830. // the object's current generation does not match the given value. If no
  9831. // live object exists, the precondition fails. Setting to 0 makes the
  9832. // operation succeed only if there is a live version of the object.
  9833. func (c *ObjectsUpdateCall) IfGenerationNotMatch(ifGenerationNotMatch int64) *ObjectsUpdateCall {
  9834. c.urlParams_.Set("ifGenerationNotMatch", fmt.Sprint(ifGenerationNotMatch))
  9835. return c
  9836. }
  9837. // IfMetagenerationMatch sets the optional parameter
  9838. // "ifMetagenerationMatch": Makes the operation conditional on whether
  9839. // the object's current metageneration matches the given value.
  9840. func (c *ObjectsUpdateCall) IfMetagenerationMatch(ifMetagenerationMatch int64) *ObjectsUpdateCall {
  9841. c.urlParams_.Set("ifMetagenerationMatch", fmt.Sprint(ifMetagenerationMatch))
  9842. return c
  9843. }
  9844. // IfMetagenerationNotMatch sets the optional parameter
  9845. // "ifMetagenerationNotMatch": Makes the operation conditional on
  9846. // whether the object's current metageneration does not match the given
  9847. // value.
  9848. func (c *ObjectsUpdateCall) IfMetagenerationNotMatch(ifMetagenerationNotMatch int64) *ObjectsUpdateCall {
  9849. c.urlParams_.Set("ifMetagenerationNotMatch", fmt.Sprint(ifMetagenerationNotMatch))
  9850. return c
  9851. }
  9852. // PredefinedAcl sets the optional parameter "predefinedAcl": Apply a
  9853. // predefined set of access controls to this object.
  9854. //
  9855. // Possible values:
  9856. // "authenticatedRead" - Object owner gets OWNER access, and
  9857. // allAuthenticatedUsers get READER access.
  9858. // "bucketOwnerFullControl" - Object owner gets OWNER access, and
  9859. // project team owners get OWNER access.
  9860. // "bucketOwnerRead" - Object owner gets OWNER access, and project
  9861. // team owners get READER access.
  9862. // "private" - Object owner gets OWNER access.
  9863. // "projectPrivate" - Object owner gets OWNER access, and project team
  9864. // members get access according to their roles.
  9865. // "publicRead" - Object owner gets OWNER access, and allUsers get
  9866. // READER access.
  9867. func (c *ObjectsUpdateCall) PredefinedAcl(predefinedAcl string) *ObjectsUpdateCall {
  9868. c.urlParams_.Set("predefinedAcl", predefinedAcl)
  9869. return c
  9870. }
  9871. // Projection sets the optional parameter "projection": Set of
  9872. // properties to return. Defaults to full.
  9873. //
  9874. // Possible values:
  9875. // "full" - Include all properties.
  9876. // "noAcl" - Omit the owner, acl property.
  9877. func (c *ObjectsUpdateCall) Projection(projection string) *ObjectsUpdateCall {
  9878. c.urlParams_.Set("projection", projection)
  9879. return c
  9880. }
  9881. // UserProject sets the optional parameter "userProject": The project to
  9882. // be billed for this request. Required for Requester Pays buckets.
  9883. func (c *ObjectsUpdateCall) UserProject(userProject string) *ObjectsUpdateCall {
  9884. c.urlParams_.Set("userProject", userProject)
  9885. return c
  9886. }
  9887. // Fields allows partial responses to be retrieved. See
  9888. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  9889. // for more information.
  9890. func (c *ObjectsUpdateCall) Fields(s ...googleapi.Field) *ObjectsUpdateCall {
  9891. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  9892. return c
  9893. }
  9894. // Context sets the context to be used in this call's Do method. Any
  9895. // pending HTTP request will be aborted if the provided context is
  9896. // canceled.
  9897. func (c *ObjectsUpdateCall) Context(ctx context.Context) *ObjectsUpdateCall {
  9898. c.ctx_ = ctx
  9899. return c
  9900. }
  9901. // Header returns an http.Header that can be modified by the caller to
  9902. // add HTTP headers to the request.
  9903. func (c *ObjectsUpdateCall) Header() http.Header {
  9904. if c.header_ == nil {
  9905. c.header_ = make(http.Header)
  9906. }
  9907. return c.header_
  9908. }
  9909. func (c *ObjectsUpdateCall) doRequest(alt string) (*http.Response, error) {
  9910. reqHeaders := make(http.Header)
  9911. for k, v := range c.header_ {
  9912. reqHeaders[k] = v
  9913. }
  9914. reqHeaders.Set("User-Agent", c.s.userAgent())
  9915. var body io.Reader = nil
  9916. body, err := googleapi.WithoutDataWrapper.JSONReader(c.object2)
  9917. if err != nil {
  9918. return nil, err
  9919. }
  9920. reqHeaders.Set("Content-Type", "application/json")
  9921. c.urlParams_.Set("alt", alt)
  9922. c.urlParams_.Set("prettyPrint", "false")
  9923. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}")
  9924. urls += "?" + c.urlParams_.Encode()
  9925. req, err := http.NewRequest("PUT", urls, body)
  9926. if err != nil {
  9927. return nil, err
  9928. }
  9929. req.Header = reqHeaders
  9930. googleapi.Expand(req.URL, map[string]string{
  9931. "bucket": c.bucket,
  9932. "object": c.object,
  9933. })
  9934. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  9935. }
  9936. // Do executes the "storage.objects.update" call.
  9937. // Exactly one of *Object or error will be non-nil. Any non-2xx status
  9938. // code is an error. Response headers are in either
  9939. // *Object.ServerResponse.Header or (if a response was returned at all)
  9940. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  9941. // check whether the returned error was because http.StatusNotModified
  9942. // was returned.
  9943. func (c *ObjectsUpdateCall) Do(opts ...googleapi.CallOption) (*Object, error) {
  9944. gensupport.SetOptions(c.urlParams_, opts...)
  9945. res, err := c.doRequest("json")
  9946. if res != nil && res.StatusCode == http.StatusNotModified {
  9947. if res.Body != nil {
  9948. res.Body.Close()
  9949. }
  9950. return nil, &googleapi.Error{
  9951. Code: res.StatusCode,
  9952. Header: res.Header,
  9953. }
  9954. }
  9955. if err != nil {
  9956. return nil, err
  9957. }
  9958. defer googleapi.CloseBody(res)
  9959. if err := googleapi.CheckResponse(res); err != nil {
  9960. return nil, err
  9961. }
  9962. ret := &Object{
  9963. ServerResponse: googleapi.ServerResponse{
  9964. Header: res.Header,
  9965. HTTPStatusCode: res.StatusCode,
  9966. },
  9967. }
  9968. target := &ret
  9969. if err := gensupport.DecodeResponse(target, res); err != nil {
  9970. return nil, err
  9971. }
  9972. return ret, nil
  9973. // {
  9974. // "description": "Updates an object's metadata.",
  9975. // "httpMethod": "PUT",
  9976. // "id": "storage.objects.update",
  9977. // "parameterOrder": [
  9978. // "bucket",
  9979. // "object"
  9980. // ],
  9981. // "parameters": {
  9982. // "bucket": {
  9983. // "description": "Name of the bucket in which the object resides.",
  9984. // "location": "path",
  9985. // "required": true,
  9986. // "type": "string"
  9987. // },
  9988. // "generation": {
  9989. // "description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).",
  9990. // "format": "int64",
  9991. // "location": "query",
  9992. // "type": "string"
  9993. // },
  9994. // "ifGenerationMatch": {
  9995. // "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.",
  9996. // "format": "int64",
  9997. // "location": "query",
  9998. // "type": "string"
  9999. // },
  10000. // "ifGenerationNotMatch": {
  10001. // "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.",
  10002. // "format": "int64",
  10003. // "location": "query",
  10004. // "type": "string"
  10005. // },
  10006. // "ifMetagenerationMatch": {
  10007. // "description": "Makes the operation conditional on whether the object's current metageneration matches the given value.",
  10008. // "format": "int64",
  10009. // "location": "query",
  10010. // "type": "string"
  10011. // },
  10012. // "ifMetagenerationNotMatch": {
  10013. // "description": "Makes the operation conditional on whether the object's current metageneration does not match the given value.",
  10014. // "format": "int64",
  10015. // "location": "query",
  10016. // "type": "string"
  10017. // },
  10018. // "object": {
  10019. // "description": "Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
  10020. // "location": "path",
  10021. // "required": true,
  10022. // "type": "string"
  10023. // },
  10024. // "predefinedAcl": {
  10025. // "description": "Apply a predefined set of access controls to this object.",
  10026. // "enum": [
  10027. // "authenticatedRead",
  10028. // "bucketOwnerFullControl",
  10029. // "bucketOwnerRead",
  10030. // "private",
  10031. // "projectPrivate",
  10032. // "publicRead"
  10033. // ],
  10034. // "enumDescriptions": [
  10035. // "Object owner gets OWNER access, and allAuthenticatedUsers get READER access.",
  10036. // "Object owner gets OWNER access, and project team owners get OWNER access.",
  10037. // "Object owner gets OWNER access, and project team owners get READER access.",
  10038. // "Object owner gets OWNER access.",
  10039. // "Object owner gets OWNER access, and project team members get access according to their roles.",
  10040. // "Object owner gets OWNER access, and allUsers get READER access."
  10041. // ],
  10042. // "location": "query",
  10043. // "type": "string"
  10044. // },
  10045. // "projection": {
  10046. // "description": "Set of properties to return. Defaults to full.",
  10047. // "enum": [
  10048. // "full",
  10049. // "noAcl"
  10050. // ],
  10051. // "enumDescriptions": [
  10052. // "Include all properties.",
  10053. // "Omit the owner, acl property."
  10054. // ],
  10055. // "location": "query",
  10056. // "type": "string"
  10057. // },
  10058. // "userProject": {
  10059. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  10060. // "location": "query",
  10061. // "type": "string"
  10062. // }
  10063. // },
  10064. // "path": "b/{bucket}/o/{object}",
  10065. // "request": {
  10066. // "$ref": "Object"
  10067. // },
  10068. // "response": {
  10069. // "$ref": "Object"
  10070. // },
  10071. // "scopes": [
  10072. // "https://www.googleapis.com/auth/cloud-platform",
  10073. // "https://www.googleapis.com/auth/devstorage.full_control"
  10074. // ]
  10075. // }
  10076. }
  10077. // method id "storage.objects.watchAll":
  10078. type ObjectsWatchAllCall struct {
  10079. s *Service
  10080. bucket string
  10081. channel *Channel
  10082. urlParams_ gensupport.URLParams
  10083. ctx_ context.Context
  10084. header_ http.Header
  10085. }
  10086. // WatchAll: Watch for changes on all objects in a bucket.
  10087. func (r *ObjectsService) WatchAll(bucket string, channel *Channel) *ObjectsWatchAllCall {
  10088. c := &ObjectsWatchAllCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  10089. c.bucket = bucket
  10090. c.channel = channel
  10091. return c
  10092. }
  10093. // Delimiter sets the optional parameter "delimiter": Returns results in
  10094. // a directory-like mode. items will contain only objects whose names,
  10095. // aside from the prefix, do not contain delimiter. Objects whose names,
  10096. // aside from the prefix, contain delimiter will have their name,
  10097. // truncated after the delimiter, returned in prefixes. Duplicate
  10098. // prefixes are omitted.
  10099. func (c *ObjectsWatchAllCall) Delimiter(delimiter string) *ObjectsWatchAllCall {
  10100. c.urlParams_.Set("delimiter", delimiter)
  10101. return c
  10102. }
  10103. // IncludeTrailingDelimiter sets the optional parameter
  10104. // "includeTrailingDelimiter": If true, objects that end in exactly one
  10105. // instance of delimiter will have their metadata included in items in
  10106. // addition to prefixes.
  10107. func (c *ObjectsWatchAllCall) IncludeTrailingDelimiter(includeTrailingDelimiter bool) *ObjectsWatchAllCall {
  10108. c.urlParams_.Set("includeTrailingDelimiter", fmt.Sprint(includeTrailingDelimiter))
  10109. return c
  10110. }
  10111. // MaxResults sets the optional parameter "maxResults": Maximum number
  10112. // of items plus prefixes to return in a single page of responses. As
  10113. // duplicate prefixes are omitted, fewer total results may be returned
  10114. // than requested. The service will use this parameter or 1,000 items,
  10115. // whichever is smaller.
  10116. func (c *ObjectsWatchAllCall) MaxResults(maxResults int64) *ObjectsWatchAllCall {
  10117. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  10118. return c
  10119. }
  10120. // PageToken sets the optional parameter "pageToken": A
  10121. // previously-returned page token representing part of the larger set of
  10122. // results to view.
  10123. func (c *ObjectsWatchAllCall) PageToken(pageToken string) *ObjectsWatchAllCall {
  10124. c.urlParams_.Set("pageToken", pageToken)
  10125. return c
  10126. }
  10127. // Prefix sets the optional parameter "prefix": Filter results to
  10128. // objects whose names begin with this prefix.
  10129. func (c *ObjectsWatchAllCall) Prefix(prefix string) *ObjectsWatchAllCall {
  10130. c.urlParams_.Set("prefix", prefix)
  10131. return c
  10132. }
  10133. // Projection sets the optional parameter "projection": Set of
  10134. // properties to return. Defaults to noAcl.
  10135. //
  10136. // Possible values:
  10137. // "full" - Include all properties.
  10138. // "noAcl" - Omit the owner, acl property.
  10139. func (c *ObjectsWatchAllCall) Projection(projection string) *ObjectsWatchAllCall {
  10140. c.urlParams_.Set("projection", projection)
  10141. return c
  10142. }
  10143. // UserProject sets the optional parameter "userProject": The project to
  10144. // be billed for this request. Required for Requester Pays buckets.
  10145. func (c *ObjectsWatchAllCall) UserProject(userProject string) *ObjectsWatchAllCall {
  10146. c.urlParams_.Set("userProject", userProject)
  10147. return c
  10148. }
  10149. // Versions sets the optional parameter "versions": If true, lists all
  10150. // versions of an object as distinct results. The default is false. For
  10151. // more information, see Object Versioning.
  10152. func (c *ObjectsWatchAllCall) Versions(versions bool) *ObjectsWatchAllCall {
  10153. c.urlParams_.Set("versions", fmt.Sprint(versions))
  10154. return c
  10155. }
  10156. // Fields allows partial responses to be retrieved. See
  10157. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  10158. // for more information.
  10159. func (c *ObjectsWatchAllCall) Fields(s ...googleapi.Field) *ObjectsWatchAllCall {
  10160. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  10161. return c
  10162. }
  10163. // Context sets the context to be used in this call's Do method. Any
  10164. // pending HTTP request will be aborted if the provided context is
  10165. // canceled.
  10166. func (c *ObjectsWatchAllCall) Context(ctx context.Context) *ObjectsWatchAllCall {
  10167. c.ctx_ = ctx
  10168. return c
  10169. }
  10170. // Header returns an http.Header that can be modified by the caller to
  10171. // add HTTP headers to the request.
  10172. func (c *ObjectsWatchAllCall) Header() http.Header {
  10173. if c.header_ == nil {
  10174. c.header_ = make(http.Header)
  10175. }
  10176. return c.header_
  10177. }
  10178. func (c *ObjectsWatchAllCall) doRequest(alt string) (*http.Response, error) {
  10179. reqHeaders := make(http.Header)
  10180. for k, v := range c.header_ {
  10181. reqHeaders[k] = v
  10182. }
  10183. reqHeaders.Set("User-Agent", c.s.userAgent())
  10184. var body io.Reader = nil
  10185. body, err := googleapi.WithoutDataWrapper.JSONReader(c.channel)
  10186. if err != nil {
  10187. return nil, err
  10188. }
  10189. reqHeaders.Set("Content-Type", "application/json")
  10190. c.urlParams_.Set("alt", alt)
  10191. c.urlParams_.Set("prettyPrint", "false")
  10192. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/watch")
  10193. urls += "?" + c.urlParams_.Encode()
  10194. req, err := http.NewRequest("POST", urls, body)
  10195. if err != nil {
  10196. return nil, err
  10197. }
  10198. req.Header = reqHeaders
  10199. googleapi.Expand(req.URL, map[string]string{
  10200. "bucket": c.bucket,
  10201. })
  10202. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  10203. }
  10204. // Do executes the "storage.objects.watchAll" call.
  10205. // Exactly one of *Channel or error will be non-nil. Any non-2xx status
  10206. // code is an error. Response headers are in either
  10207. // *Channel.ServerResponse.Header or (if a response was returned at all)
  10208. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  10209. // check whether the returned error was because http.StatusNotModified
  10210. // was returned.
  10211. func (c *ObjectsWatchAllCall) Do(opts ...googleapi.CallOption) (*Channel, error) {
  10212. gensupport.SetOptions(c.urlParams_, opts...)
  10213. res, err := c.doRequest("json")
  10214. if res != nil && res.StatusCode == http.StatusNotModified {
  10215. if res.Body != nil {
  10216. res.Body.Close()
  10217. }
  10218. return nil, &googleapi.Error{
  10219. Code: res.StatusCode,
  10220. Header: res.Header,
  10221. }
  10222. }
  10223. if err != nil {
  10224. return nil, err
  10225. }
  10226. defer googleapi.CloseBody(res)
  10227. if err := googleapi.CheckResponse(res); err != nil {
  10228. return nil, err
  10229. }
  10230. ret := &Channel{
  10231. ServerResponse: googleapi.ServerResponse{
  10232. Header: res.Header,
  10233. HTTPStatusCode: res.StatusCode,
  10234. },
  10235. }
  10236. target := &ret
  10237. if err := gensupport.DecodeResponse(target, res); err != nil {
  10238. return nil, err
  10239. }
  10240. return ret, nil
  10241. // {
  10242. // "description": "Watch for changes on all objects in a bucket.",
  10243. // "httpMethod": "POST",
  10244. // "id": "storage.objects.watchAll",
  10245. // "parameterOrder": [
  10246. // "bucket"
  10247. // ],
  10248. // "parameters": {
  10249. // "bucket": {
  10250. // "description": "Name of the bucket in which to look for objects.",
  10251. // "location": "path",
  10252. // "required": true,
  10253. // "type": "string"
  10254. // },
  10255. // "delimiter": {
  10256. // "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.",
  10257. // "location": "query",
  10258. // "type": "string"
  10259. // },
  10260. // "includeTrailingDelimiter": {
  10261. // "description": "If true, objects that end in exactly one instance of delimiter will have their metadata included in items in addition to prefixes.",
  10262. // "location": "query",
  10263. // "type": "boolean"
  10264. // },
  10265. // "maxResults": {
  10266. // "default": "1000",
  10267. // "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.",
  10268. // "format": "uint32",
  10269. // "location": "query",
  10270. // "minimum": "0",
  10271. // "type": "integer"
  10272. // },
  10273. // "pageToken": {
  10274. // "description": "A previously-returned page token representing part of the larger set of results to view.",
  10275. // "location": "query",
  10276. // "type": "string"
  10277. // },
  10278. // "prefix": {
  10279. // "description": "Filter results to objects whose names begin with this prefix.",
  10280. // "location": "query",
  10281. // "type": "string"
  10282. // },
  10283. // "projection": {
  10284. // "description": "Set of properties to return. Defaults to noAcl.",
  10285. // "enum": [
  10286. // "full",
  10287. // "noAcl"
  10288. // ],
  10289. // "enumDescriptions": [
  10290. // "Include all properties.",
  10291. // "Omit the owner, acl property."
  10292. // ],
  10293. // "location": "query",
  10294. // "type": "string"
  10295. // },
  10296. // "userProject": {
  10297. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  10298. // "location": "query",
  10299. // "type": "string"
  10300. // },
  10301. // "versions": {
  10302. // "description": "If true, lists all versions of an object as distinct results. The default is false. For more information, see Object Versioning.",
  10303. // "location": "query",
  10304. // "type": "boolean"
  10305. // }
  10306. // },
  10307. // "path": "b/{bucket}/o/watch",
  10308. // "request": {
  10309. // "$ref": "Channel",
  10310. // "parameterName": "resource"
  10311. // },
  10312. // "response": {
  10313. // "$ref": "Channel"
  10314. // },
  10315. // "scopes": [
  10316. // "https://www.googleapis.com/auth/cloud-platform",
  10317. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  10318. // "https://www.googleapis.com/auth/devstorage.full_control",
  10319. // "https://www.googleapis.com/auth/devstorage.read_only",
  10320. // "https://www.googleapis.com/auth/devstorage.read_write"
  10321. // ],
  10322. // "supportsSubscription": true
  10323. // }
  10324. }
  10325. // method id "storage.projects.serviceAccount.get":
  10326. type ProjectsServiceAccountGetCall struct {
  10327. s *Service
  10328. projectId string
  10329. urlParams_ gensupport.URLParams
  10330. ifNoneMatch_ string
  10331. ctx_ context.Context
  10332. header_ http.Header
  10333. }
  10334. // Get: Get the email address of this project's Google Cloud Storage
  10335. // service account.
  10336. func (r *ProjectsServiceAccountService) Get(projectId string) *ProjectsServiceAccountGetCall {
  10337. c := &ProjectsServiceAccountGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  10338. c.projectId = projectId
  10339. return c
  10340. }
  10341. // UserProject sets the optional parameter "userProject": The project to
  10342. // be billed for this request.
  10343. func (c *ProjectsServiceAccountGetCall) UserProject(userProject string) *ProjectsServiceAccountGetCall {
  10344. c.urlParams_.Set("userProject", userProject)
  10345. return c
  10346. }
  10347. // Fields allows partial responses to be retrieved. See
  10348. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  10349. // for more information.
  10350. func (c *ProjectsServiceAccountGetCall) Fields(s ...googleapi.Field) *ProjectsServiceAccountGetCall {
  10351. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  10352. return c
  10353. }
  10354. // IfNoneMatch sets the optional parameter which makes the operation
  10355. // fail if the object's ETag matches the given value. This is useful for
  10356. // getting updates only after the object has changed since the last
  10357. // request. Use googleapi.IsNotModified to check whether the response
  10358. // error from Do is the result of In-None-Match.
  10359. func (c *ProjectsServiceAccountGetCall) IfNoneMatch(entityTag string) *ProjectsServiceAccountGetCall {
  10360. c.ifNoneMatch_ = entityTag
  10361. return c
  10362. }
  10363. // Context sets the context to be used in this call's Do method. Any
  10364. // pending HTTP request will be aborted if the provided context is
  10365. // canceled.
  10366. func (c *ProjectsServiceAccountGetCall) Context(ctx context.Context) *ProjectsServiceAccountGetCall {
  10367. c.ctx_ = ctx
  10368. return c
  10369. }
  10370. // Header returns an http.Header that can be modified by the caller to
  10371. // add HTTP headers to the request.
  10372. func (c *ProjectsServiceAccountGetCall) Header() http.Header {
  10373. if c.header_ == nil {
  10374. c.header_ = make(http.Header)
  10375. }
  10376. return c.header_
  10377. }
  10378. func (c *ProjectsServiceAccountGetCall) doRequest(alt string) (*http.Response, error) {
  10379. reqHeaders := make(http.Header)
  10380. for k, v := range c.header_ {
  10381. reqHeaders[k] = v
  10382. }
  10383. reqHeaders.Set("User-Agent", c.s.userAgent())
  10384. if c.ifNoneMatch_ != "" {
  10385. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  10386. }
  10387. var body io.Reader = nil
  10388. c.urlParams_.Set("alt", alt)
  10389. c.urlParams_.Set("prettyPrint", "false")
  10390. urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{projectId}/serviceAccount")
  10391. urls += "?" + c.urlParams_.Encode()
  10392. req, err := http.NewRequest("GET", urls, body)
  10393. if err != nil {
  10394. return nil, err
  10395. }
  10396. req.Header = reqHeaders
  10397. googleapi.Expand(req.URL, map[string]string{
  10398. "projectId": c.projectId,
  10399. })
  10400. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  10401. }
  10402. // Do executes the "storage.projects.serviceAccount.get" call.
  10403. // Exactly one of *ServiceAccount or error will be non-nil. Any non-2xx
  10404. // status code is an error. Response headers are in either
  10405. // *ServiceAccount.ServerResponse.Header or (if a response was returned
  10406. // at all) in error.(*googleapi.Error).Header. Use
  10407. // googleapi.IsNotModified to check whether the returned error was
  10408. // because http.StatusNotModified was returned.
  10409. func (c *ProjectsServiceAccountGetCall) Do(opts ...googleapi.CallOption) (*ServiceAccount, error) {
  10410. gensupport.SetOptions(c.urlParams_, opts...)
  10411. res, err := c.doRequest("json")
  10412. if res != nil && res.StatusCode == http.StatusNotModified {
  10413. if res.Body != nil {
  10414. res.Body.Close()
  10415. }
  10416. return nil, &googleapi.Error{
  10417. Code: res.StatusCode,
  10418. Header: res.Header,
  10419. }
  10420. }
  10421. if err != nil {
  10422. return nil, err
  10423. }
  10424. defer googleapi.CloseBody(res)
  10425. if err := googleapi.CheckResponse(res); err != nil {
  10426. return nil, err
  10427. }
  10428. ret := &ServiceAccount{
  10429. ServerResponse: googleapi.ServerResponse{
  10430. Header: res.Header,
  10431. HTTPStatusCode: res.StatusCode,
  10432. },
  10433. }
  10434. target := &ret
  10435. if err := gensupport.DecodeResponse(target, res); err != nil {
  10436. return nil, err
  10437. }
  10438. return ret, nil
  10439. // {
  10440. // "description": "Get the email address of this project's Google Cloud Storage service account.",
  10441. // "httpMethod": "GET",
  10442. // "id": "storage.projects.serviceAccount.get",
  10443. // "parameterOrder": [
  10444. // "projectId"
  10445. // ],
  10446. // "parameters": {
  10447. // "projectId": {
  10448. // "description": "Project ID",
  10449. // "location": "path",
  10450. // "required": true,
  10451. // "type": "string"
  10452. // },
  10453. // "userProject": {
  10454. // "description": "The project to be billed for this request.",
  10455. // "location": "query",
  10456. // "type": "string"
  10457. // }
  10458. // },
  10459. // "path": "projects/{projectId}/serviceAccount",
  10460. // "response": {
  10461. // "$ref": "ServiceAccount"
  10462. // },
  10463. // "scopes": [
  10464. // "https://www.googleapis.com/auth/cloud-platform",
  10465. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  10466. // "https://www.googleapis.com/auth/devstorage.full_control",
  10467. // "https://www.googleapis.com/auth/devstorage.read_only",
  10468. // "https://www.googleapis.com/auth/devstorage.read_write"
  10469. // ]
  10470. // }
  10471. }