storage-gen.go 405 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472
  1. // Copyright 2018 Google Inc. All rights reserved.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. // Code generated file. DO NOT EDIT.
  5. // Package storage provides access to the Cloud Storage JSON API.
  6. //
  7. // This package is DEPRECATED. Use package cloud.google.com/go/storage instead.
  8. //
  9. // See https://developers.google.com/storage/docs/json_api/
  10. //
  11. // Usage example:
  12. //
  13. // import "google.golang.org/api/storage/v1"
  14. // ...
  15. // storageService, err := storage.New(oauthHttpClient)
  16. package storage // import "google.golang.org/api/storage/v1"
  17. import (
  18. "bytes"
  19. "context"
  20. "encoding/json"
  21. "errors"
  22. "fmt"
  23. "io"
  24. "net/http"
  25. "net/url"
  26. "strconv"
  27. "strings"
  28. gensupport "google.golang.org/api/gensupport"
  29. googleapi "google.golang.org/api/googleapi"
  30. )
  31. // Always reference these packages, just in case the auto-generated code
  32. // below doesn't.
  33. var _ = bytes.NewBuffer
  34. var _ = strconv.Itoa
  35. var _ = fmt.Sprintf
  36. var _ = json.NewDecoder
  37. var _ = io.Copy
  38. var _ = url.Parse
  39. var _ = gensupport.MarshalJSON
  40. var _ = googleapi.Version
  41. var _ = errors.New
  42. var _ = strings.Replace
  43. var _ = context.Canceled
  44. const apiId = "storage:v1"
  45. const apiName = "storage"
  46. const apiVersion = "v1"
  47. const basePath = "https://www.googleapis.com/storage/v1/"
  48. // OAuth2 scopes used by this API.
  49. const (
  50. // View and manage your data across Google Cloud Platform services
  51. CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform"
  52. // View your data across Google Cloud Platform services
  53. CloudPlatformReadOnlyScope = "https://www.googleapis.com/auth/cloud-platform.read-only"
  54. // Manage your data and permissions in Google Cloud Storage
  55. DevstorageFullControlScope = "https://www.googleapis.com/auth/devstorage.full_control"
  56. // View your data in Google Cloud Storage
  57. DevstorageReadOnlyScope = "https://www.googleapis.com/auth/devstorage.read_only"
  58. // Manage your data in Google Cloud Storage
  59. DevstorageReadWriteScope = "https://www.googleapis.com/auth/devstorage.read_write"
  60. )
  61. func New(client *http.Client) (*Service, error) {
  62. if client == nil {
  63. return nil, errors.New("client is nil")
  64. }
  65. s := &Service{client: client, BasePath: basePath}
  66. s.BucketAccessControls = NewBucketAccessControlsService(s)
  67. s.Buckets = NewBucketsService(s)
  68. s.Channels = NewChannelsService(s)
  69. s.DefaultObjectAccessControls = NewDefaultObjectAccessControlsService(s)
  70. s.Notifications = NewNotificationsService(s)
  71. s.ObjectAccessControls = NewObjectAccessControlsService(s)
  72. s.Objects = NewObjectsService(s)
  73. s.Projects = NewProjectsService(s)
  74. return s, nil
  75. }
  76. type Service struct {
  77. client *http.Client
  78. BasePath string // API endpoint base URL
  79. UserAgent string // optional additional User-Agent fragment
  80. BucketAccessControls *BucketAccessControlsService
  81. Buckets *BucketsService
  82. Channels *ChannelsService
  83. DefaultObjectAccessControls *DefaultObjectAccessControlsService
  84. Notifications *NotificationsService
  85. ObjectAccessControls *ObjectAccessControlsService
  86. Objects *ObjectsService
  87. Projects *ProjectsService
  88. }
  89. func (s *Service) userAgent() string {
  90. if s.UserAgent == "" {
  91. return googleapi.UserAgent
  92. }
  93. return googleapi.UserAgent + " " + s.UserAgent
  94. }
  95. func NewBucketAccessControlsService(s *Service) *BucketAccessControlsService {
  96. rs := &BucketAccessControlsService{s: s}
  97. return rs
  98. }
  99. type BucketAccessControlsService struct {
  100. s *Service
  101. }
  102. func NewBucketsService(s *Service) *BucketsService {
  103. rs := &BucketsService{s: s}
  104. return rs
  105. }
  106. type BucketsService struct {
  107. s *Service
  108. }
  109. func NewChannelsService(s *Service) *ChannelsService {
  110. rs := &ChannelsService{s: s}
  111. return rs
  112. }
  113. type ChannelsService struct {
  114. s *Service
  115. }
  116. func NewDefaultObjectAccessControlsService(s *Service) *DefaultObjectAccessControlsService {
  117. rs := &DefaultObjectAccessControlsService{s: s}
  118. return rs
  119. }
  120. type DefaultObjectAccessControlsService struct {
  121. s *Service
  122. }
  123. func NewNotificationsService(s *Service) *NotificationsService {
  124. rs := &NotificationsService{s: s}
  125. return rs
  126. }
  127. type NotificationsService struct {
  128. s *Service
  129. }
  130. func NewObjectAccessControlsService(s *Service) *ObjectAccessControlsService {
  131. rs := &ObjectAccessControlsService{s: s}
  132. return rs
  133. }
  134. type ObjectAccessControlsService struct {
  135. s *Service
  136. }
  137. func NewObjectsService(s *Service) *ObjectsService {
  138. rs := &ObjectsService{s: s}
  139. return rs
  140. }
  141. type ObjectsService struct {
  142. s *Service
  143. }
  144. func NewProjectsService(s *Service) *ProjectsService {
  145. rs := &ProjectsService{s: s}
  146. rs.ServiceAccount = NewProjectsServiceAccountService(s)
  147. return rs
  148. }
  149. type ProjectsService struct {
  150. s *Service
  151. ServiceAccount *ProjectsServiceAccountService
  152. }
  153. func NewProjectsServiceAccountService(s *Service) *ProjectsServiceAccountService {
  154. rs := &ProjectsServiceAccountService{s: s}
  155. return rs
  156. }
  157. type ProjectsServiceAccountService struct {
  158. s *Service
  159. }
  160. // Bucket: A bucket.
  161. type Bucket struct {
  162. // Acl: Access controls on the bucket.
  163. Acl []*BucketAccessControl `json:"acl,omitempty"`
  164. // Billing: The bucket's billing configuration.
  165. Billing *BucketBilling `json:"billing,omitempty"`
  166. // Cors: The bucket's Cross-Origin Resource Sharing (CORS)
  167. // configuration.
  168. Cors []*BucketCors `json:"cors,omitempty"`
  169. // DefaultEventBasedHold: The default value for event-based hold on
  170. // newly created objects in this bucket. Event-based hold is a way to
  171. // retain objects indefinitely until an event occurs, signified by the
  172. // hold's release. After being released, such objects will be subject to
  173. // bucket-level retention (if any). One sample use case of this flag is
  174. // for banks to hold loan documents for at least 3 years after loan is
  175. // paid in full. Here, bucket-level retention is 3 years and the event
  176. // is loan being paid in full. In this example, these objects will be
  177. // held intact for any number of years until the event has occurred
  178. // (event-based hold on the object is released) and then 3 more years
  179. // after that. That means retention duration of the objects begins from
  180. // the moment event-based hold transitioned from true to false. Objects
  181. // under event-based hold cannot be deleted, overwritten or archived
  182. // until the hold is removed.
  183. DefaultEventBasedHold bool `json:"defaultEventBasedHold,omitempty"`
  184. // DefaultObjectAcl: Default access controls to apply to new objects
  185. // when no ACL is provided.
  186. DefaultObjectAcl []*ObjectAccessControl `json:"defaultObjectAcl,omitempty"`
  187. // Encryption: Encryption configuration for a bucket.
  188. Encryption *BucketEncryption `json:"encryption,omitempty"`
  189. // Etag: HTTP 1.1 Entity tag for the bucket.
  190. Etag string `json:"etag,omitempty"`
  191. // IamConfiguration: The bucket's IAM configuration.
  192. IamConfiguration *BucketIamConfiguration `json:"iamConfiguration,omitempty"`
  193. // Id: The ID of the bucket. For buckets, the id and name properties are
  194. // the same.
  195. Id string `json:"id,omitempty"`
  196. // Kind: The kind of item this is. For buckets, this is always
  197. // storage#bucket.
  198. Kind string `json:"kind,omitempty"`
  199. // Labels: User-provided labels, in key/value pairs.
  200. Labels map[string]string `json:"labels,omitempty"`
  201. // Lifecycle: The bucket's lifecycle configuration. See lifecycle
  202. // management for more information.
  203. Lifecycle *BucketLifecycle `json:"lifecycle,omitempty"`
  204. // Location: The location of the bucket. Object data for objects in the
  205. // bucket resides in physical storage within this region. Defaults to
  206. // US. See the developer's guide for the authoritative list.
  207. Location string `json:"location,omitempty"`
  208. // Logging: The bucket's logging configuration, which defines the
  209. // destination bucket and optional name prefix for the current bucket's
  210. // logs.
  211. Logging *BucketLogging `json:"logging,omitempty"`
  212. // Metageneration: The metadata generation of this bucket.
  213. Metageneration int64 `json:"metageneration,omitempty,string"`
  214. // Name: The name of the bucket.
  215. Name string `json:"name,omitempty"`
  216. // Owner: The owner of the bucket. This is always the project team's
  217. // owner group.
  218. Owner *BucketOwner `json:"owner,omitempty"`
  219. // ProjectNumber: The project number of the project the bucket belongs
  220. // to.
  221. ProjectNumber uint64 `json:"projectNumber,omitempty,string"`
  222. // RetentionPolicy: The bucket's retention policy. The retention policy
  223. // enforces a minimum retention time for all objects contained in the
  224. // bucket, based on their creation time. Any attempt to overwrite or
  225. // delete objects younger than the retention period will result in a
  226. // PERMISSION_DENIED error. An unlocked retention policy can be modified
  227. // or removed from the bucket via a storage.buckets.update operation. A
  228. // locked retention policy cannot be removed or shortened in duration
  229. // for the lifetime of the bucket. Attempting to remove or decrease
  230. // period of a locked retention policy will result in a
  231. // PERMISSION_DENIED error.
  232. RetentionPolicy *BucketRetentionPolicy `json:"retentionPolicy,omitempty"`
  233. // SelfLink: The URI of this bucket.
  234. SelfLink string `json:"selfLink,omitempty"`
  235. // StorageClass: The bucket's default storage class, used whenever no
  236. // storageClass is specified for a newly-created object. This defines
  237. // how objects in the bucket are stored and determines the SLA and the
  238. // cost of storage. Values include MULTI_REGIONAL, REGIONAL, STANDARD,
  239. // NEARLINE, COLDLINE, and DURABLE_REDUCED_AVAILABILITY. If this value
  240. // is not specified when the bucket is created, it will default to
  241. // STANDARD. For more information, see storage classes.
  242. StorageClass string `json:"storageClass,omitempty"`
  243. // TimeCreated: The creation time of the bucket in RFC 3339 format.
  244. TimeCreated string `json:"timeCreated,omitempty"`
  245. // Updated: The modification time of the bucket in RFC 3339 format.
  246. Updated string `json:"updated,omitempty"`
  247. // Versioning: The bucket's versioning configuration.
  248. Versioning *BucketVersioning `json:"versioning,omitempty"`
  249. // Website: The bucket's website configuration, controlling how the
  250. // service behaves when accessing bucket contents as a web site. See the
  251. // Static Website Examples for more information.
  252. Website *BucketWebsite `json:"website,omitempty"`
  253. // ServerResponse contains the HTTP response code and headers from the
  254. // server.
  255. googleapi.ServerResponse `json:"-"`
  256. // ForceSendFields is a list of field names (e.g. "Acl") to
  257. // unconditionally include in API requests. By default, fields with
  258. // empty values are omitted from API requests. However, any non-pointer,
  259. // non-interface field appearing in ForceSendFields will be sent to the
  260. // server regardless of whether the field is empty or not. This may be
  261. // used to include empty fields in Patch requests.
  262. ForceSendFields []string `json:"-"`
  263. // NullFields is a list of field names (e.g. "Acl") to include in API
  264. // requests with the JSON null value. By default, fields with empty
  265. // values are omitted from API requests. However, any field with an
  266. // empty value appearing in NullFields will be sent to the server as
  267. // null. It is an error if a field in this list has a non-empty value.
  268. // This may be used to include null fields in Patch requests.
  269. NullFields []string `json:"-"`
  270. }
  271. func (s *Bucket) MarshalJSON() ([]byte, error) {
  272. type NoMethod Bucket
  273. raw := NoMethod(*s)
  274. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  275. }
  276. // BucketBilling: The bucket's billing configuration.
  277. type BucketBilling struct {
  278. // RequesterPays: When set to true, Requester Pays is enabled for this
  279. // bucket.
  280. RequesterPays bool `json:"requesterPays,omitempty"`
  281. // ForceSendFields is a list of field names (e.g. "RequesterPays") to
  282. // unconditionally include in API requests. By default, fields with
  283. // empty values are omitted from API requests. However, any non-pointer,
  284. // non-interface field appearing in ForceSendFields will be sent to the
  285. // server regardless of whether the field is empty or not. This may be
  286. // used to include empty fields in Patch requests.
  287. ForceSendFields []string `json:"-"`
  288. // NullFields is a list of field names (e.g. "RequesterPays") to include
  289. // in API requests with the JSON null value. By default, fields with
  290. // empty values are omitted from API requests. However, any field with
  291. // an empty value appearing in NullFields will be sent to the server as
  292. // null. It is an error if a field in this list has a non-empty value.
  293. // This may be used to include null fields in Patch requests.
  294. NullFields []string `json:"-"`
  295. }
  296. func (s *BucketBilling) MarshalJSON() ([]byte, error) {
  297. type NoMethod BucketBilling
  298. raw := NoMethod(*s)
  299. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  300. }
  301. type BucketCors struct {
  302. // MaxAgeSeconds: The value, in seconds, to return in the
  303. // Access-Control-Max-Age header used in preflight responses.
  304. MaxAgeSeconds int64 `json:"maxAgeSeconds,omitempty"`
  305. // Method: The list of HTTP methods on which to include CORS response
  306. // headers, (GET, OPTIONS, POST, etc) Note: "*" is permitted in the list
  307. // of methods, and means "any method".
  308. Method []string `json:"method,omitempty"`
  309. // Origin: The list of Origins eligible to receive CORS response
  310. // headers. Note: "*" is permitted in the list of origins, and means
  311. // "any Origin".
  312. Origin []string `json:"origin,omitempty"`
  313. // ResponseHeader: The list of HTTP headers other than the simple
  314. // response headers to give permission for the user-agent to share
  315. // across domains.
  316. ResponseHeader []string `json:"responseHeader,omitempty"`
  317. // ForceSendFields is a list of field names (e.g. "MaxAgeSeconds") to
  318. // unconditionally include in API requests. By default, fields with
  319. // empty values are omitted from API requests. However, any non-pointer,
  320. // non-interface field appearing in ForceSendFields will be sent to the
  321. // server regardless of whether the field is empty or not. This may be
  322. // used to include empty fields in Patch requests.
  323. ForceSendFields []string `json:"-"`
  324. // NullFields is a list of field names (e.g. "MaxAgeSeconds") to include
  325. // in API requests with the JSON null value. By default, fields with
  326. // empty values are omitted from API requests. However, any field with
  327. // an empty value appearing in NullFields will be sent to the server as
  328. // null. It is an error if a field in this list has a non-empty value.
  329. // This may be used to include null fields in Patch requests.
  330. NullFields []string `json:"-"`
  331. }
  332. func (s *BucketCors) MarshalJSON() ([]byte, error) {
  333. type NoMethod BucketCors
  334. raw := NoMethod(*s)
  335. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  336. }
  337. // BucketEncryption: Encryption configuration for a bucket.
  338. type BucketEncryption struct {
  339. // DefaultKmsKeyName: A Cloud KMS key that will be used to encrypt
  340. // objects inserted into this bucket, if no encryption method is
  341. // specified.
  342. DefaultKmsKeyName string `json:"defaultKmsKeyName,omitempty"`
  343. // ForceSendFields is a list of field names (e.g. "DefaultKmsKeyName")
  344. // to unconditionally include in API requests. By default, fields with
  345. // empty values are omitted from API requests. However, any non-pointer,
  346. // non-interface field appearing in ForceSendFields will be sent to the
  347. // server regardless of whether the field is empty or not. This may be
  348. // used to include empty fields in Patch requests.
  349. ForceSendFields []string `json:"-"`
  350. // NullFields is a list of field names (e.g. "DefaultKmsKeyName") to
  351. // include in API requests with the JSON null value. By default, fields
  352. // with empty values are omitted from API requests. However, any field
  353. // with an empty value appearing in NullFields will be sent to the
  354. // server as null. It is an error if a field in this list has a
  355. // non-empty value. This may be used to include null fields in Patch
  356. // requests.
  357. NullFields []string `json:"-"`
  358. }
  359. func (s *BucketEncryption) MarshalJSON() ([]byte, error) {
  360. type NoMethod BucketEncryption
  361. raw := NoMethod(*s)
  362. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  363. }
  364. // BucketIamConfiguration: The bucket's IAM configuration.
  365. type BucketIamConfiguration struct {
  366. BucketPolicyOnly *BucketIamConfigurationBucketPolicyOnly `json:"bucketPolicyOnly,omitempty"`
  367. // ForceSendFields is a list of field names (e.g. "BucketPolicyOnly") to
  368. // unconditionally include in API requests. By default, fields with
  369. // empty values are omitted from API requests. However, any non-pointer,
  370. // non-interface field appearing in ForceSendFields will be sent to the
  371. // server regardless of whether the field is empty or not. This may be
  372. // used to include empty fields in Patch requests.
  373. ForceSendFields []string `json:"-"`
  374. // NullFields is a list of field names (e.g. "BucketPolicyOnly") to
  375. // include in API requests with the JSON null value. By default, fields
  376. // with empty values are omitted from API requests. However, any field
  377. // with an empty value appearing in NullFields will be sent to the
  378. // server as null. It is an error if a field in this list has a
  379. // non-empty value. This may be used to include null fields in Patch
  380. // requests.
  381. NullFields []string `json:"-"`
  382. }
  383. func (s *BucketIamConfiguration) MarshalJSON() ([]byte, error) {
  384. type NoMethod BucketIamConfiguration
  385. raw := NoMethod(*s)
  386. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  387. }
  388. type BucketIamConfigurationBucketPolicyOnly struct {
  389. // Enabled: If set, access checks only use bucket-level IAM policies or
  390. // above.
  391. Enabled bool `json:"enabled,omitempty"`
  392. // LockedTime: The deadline time for changing
  393. // iamConfiguration.bucketPolicyOnly.enabled from true to false in RFC
  394. // 3339 format. iamConfiguration.bucketPolicyOnly.enabled may be changed
  395. // from true to false until the locked time, after which the field is
  396. // immutable.
  397. LockedTime string `json:"lockedTime,omitempty"`
  398. // ForceSendFields is a list of field names (e.g. "Enabled") to
  399. // unconditionally include in API requests. By default, fields with
  400. // empty values are omitted from API requests. However, any non-pointer,
  401. // non-interface field appearing in ForceSendFields will be sent to the
  402. // server regardless of whether the field is empty or not. This may be
  403. // used to include empty fields in Patch requests.
  404. ForceSendFields []string `json:"-"`
  405. // NullFields is a list of field names (e.g. "Enabled") to include in
  406. // API requests with the JSON null value. By default, fields with empty
  407. // values are omitted from API requests. However, any field with an
  408. // empty value appearing in NullFields will be sent to the server as
  409. // null. It is an error if a field in this list has a non-empty value.
  410. // This may be used to include null fields in Patch requests.
  411. NullFields []string `json:"-"`
  412. }
  413. func (s *BucketIamConfigurationBucketPolicyOnly) MarshalJSON() ([]byte, error) {
  414. type NoMethod BucketIamConfigurationBucketPolicyOnly
  415. raw := NoMethod(*s)
  416. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  417. }
  418. // BucketLifecycle: The bucket's lifecycle configuration. See lifecycle
  419. // management for more information.
  420. type BucketLifecycle struct {
  421. // Rule: A lifecycle management rule, which is made of an action to take
  422. // and the condition(s) under which the action will be taken.
  423. Rule []*BucketLifecycleRule `json:"rule,omitempty"`
  424. // ForceSendFields is a list of field names (e.g. "Rule") to
  425. // unconditionally include in API requests. By default, fields with
  426. // empty values are omitted from API requests. However, any non-pointer,
  427. // non-interface field appearing in ForceSendFields will be sent to the
  428. // server regardless of whether the field is empty or not. This may be
  429. // used to include empty fields in Patch requests.
  430. ForceSendFields []string `json:"-"`
  431. // NullFields is a list of field names (e.g. "Rule") to include in API
  432. // requests with the JSON null value. By default, fields with empty
  433. // values are omitted from API requests. However, any field with an
  434. // empty value appearing in NullFields will be sent to the server as
  435. // null. It is an error if a field in this list has a non-empty value.
  436. // This may be used to include null fields in Patch requests.
  437. NullFields []string `json:"-"`
  438. }
  439. func (s *BucketLifecycle) MarshalJSON() ([]byte, error) {
  440. type NoMethod BucketLifecycle
  441. raw := NoMethod(*s)
  442. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  443. }
  444. type BucketLifecycleRule struct {
  445. // Action: The action to take.
  446. Action *BucketLifecycleRuleAction `json:"action,omitempty"`
  447. // Condition: The condition(s) under which the action will be taken.
  448. Condition *BucketLifecycleRuleCondition `json:"condition,omitempty"`
  449. // ForceSendFields is a list of field names (e.g. "Action") to
  450. // unconditionally include in API requests. By default, fields with
  451. // empty values are omitted from API requests. However, any non-pointer,
  452. // non-interface field appearing in ForceSendFields will be sent to the
  453. // server regardless of whether the field is empty or not. This may be
  454. // used to include empty fields in Patch requests.
  455. ForceSendFields []string `json:"-"`
  456. // NullFields is a list of field names (e.g. "Action") to include in API
  457. // requests with the JSON null value. By default, fields with empty
  458. // values are omitted from API requests. However, any field with an
  459. // empty value appearing in NullFields will be sent to the server as
  460. // null. It is an error if a field in this list has a non-empty value.
  461. // This may be used to include null fields in Patch requests.
  462. NullFields []string `json:"-"`
  463. }
  464. func (s *BucketLifecycleRule) MarshalJSON() ([]byte, error) {
  465. type NoMethod BucketLifecycleRule
  466. raw := NoMethod(*s)
  467. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  468. }
  469. // BucketLifecycleRuleAction: The action to take.
  470. type BucketLifecycleRuleAction struct {
  471. // StorageClass: Target storage class. Required iff the type of the
  472. // action is SetStorageClass.
  473. StorageClass string `json:"storageClass,omitempty"`
  474. // Type: Type of the action. Currently, only Delete and SetStorageClass
  475. // are supported.
  476. Type string `json:"type,omitempty"`
  477. // ForceSendFields is a list of field names (e.g. "StorageClass") to
  478. // unconditionally include in API requests. By default, fields with
  479. // empty values are omitted from API requests. However, any non-pointer,
  480. // non-interface field appearing in ForceSendFields will be sent to the
  481. // server regardless of whether the field is empty or not. This may be
  482. // used to include empty fields in Patch requests.
  483. ForceSendFields []string `json:"-"`
  484. // NullFields is a list of field names (e.g. "StorageClass") to include
  485. // in API requests with the JSON null value. By default, fields with
  486. // empty values are omitted from API requests. However, any field with
  487. // an empty value appearing in NullFields will be sent to the server as
  488. // null. It is an error if a field in this list has a non-empty value.
  489. // This may be used to include null fields in Patch requests.
  490. NullFields []string `json:"-"`
  491. }
  492. func (s *BucketLifecycleRuleAction) MarshalJSON() ([]byte, error) {
  493. type NoMethod BucketLifecycleRuleAction
  494. raw := NoMethod(*s)
  495. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  496. }
  497. // BucketLifecycleRuleCondition: The condition(s) under which the action
  498. // will be taken.
  499. type BucketLifecycleRuleCondition struct {
  500. // Age: Age of an object (in days). This condition is satisfied when an
  501. // object reaches the specified age.
  502. Age int64 `json:"age,omitempty"`
  503. // CreatedBefore: A date in RFC 3339 format with only the date part (for
  504. // instance, "2013-01-15"). This condition is satisfied when an object
  505. // is created before midnight of the specified date in UTC.
  506. CreatedBefore string `json:"createdBefore,omitempty"`
  507. // IsLive: Relevant only for versioned objects. If the value is true,
  508. // this condition matches live objects; if the value is false, it
  509. // matches archived objects.
  510. IsLive *bool `json:"isLive,omitempty"`
  511. // MatchesPattern: A regular expression that satisfies the RE2 syntax.
  512. // This condition is satisfied when the name of the object matches the
  513. // RE2 pattern. Note: This feature is currently in the "Early Access"
  514. // launch stage and is only available to a whitelisted set of users;
  515. // that means that this feature may be changed in backward-incompatible
  516. // ways and that it is not guaranteed to be released.
  517. MatchesPattern string `json:"matchesPattern,omitempty"`
  518. // MatchesStorageClass: Objects having any of the storage classes
  519. // specified by this condition will be matched. Values include
  520. // MULTI_REGIONAL, REGIONAL, NEARLINE, COLDLINE, STANDARD, and
  521. // DURABLE_REDUCED_AVAILABILITY.
  522. MatchesStorageClass []string `json:"matchesStorageClass,omitempty"`
  523. // NumNewerVersions: Relevant only for versioned objects. If the value
  524. // is N, this condition is satisfied when there are at least N versions
  525. // (including the live version) newer than this version of the object.
  526. NumNewerVersions int64 `json:"numNewerVersions,omitempty"`
  527. // ForceSendFields is a list of field names (e.g. "Age") to
  528. // unconditionally include in API requests. By default, fields with
  529. // empty values are omitted from API requests. However, any non-pointer,
  530. // non-interface field appearing in ForceSendFields will be sent to the
  531. // server regardless of whether the field is empty or not. This may be
  532. // used to include empty fields in Patch requests.
  533. ForceSendFields []string `json:"-"`
  534. // NullFields is a list of field names (e.g. "Age") to include in API
  535. // requests with the JSON null value. By default, fields with empty
  536. // values are omitted from API requests. However, any field with an
  537. // empty value appearing in NullFields will be sent to the server as
  538. // null. It is an error if a field in this list has a non-empty value.
  539. // This may be used to include null fields in Patch requests.
  540. NullFields []string `json:"-"`
  541. }
  542. func (s *BucketLifecycleRuleCondition) MarshalJSON() ([]byte, error) {
  543. type NoMethod BucketLifecycleRuleCondition
  544. raw := NoMethod(*s)
  545. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  546. }
  547. // BucketLogging: The bucket's logging configuration, which defines the
  548. // destination bucket and optional name prefix for the current bucket's
  549. // logs.
  550. type BucketLogging struct {
  551. // LogBucket: The destination bucket where the current bucket's logs
  552. // should be placed.
  553. LogBucket string `json:"logBucket,omitempty"`
  554. // LogObjectPrefix: A prefix for log object names.
  555. LogObjectPrefix string `json:"logObjectPrefix,omitempty"`
  556. // ForceSendFields is a list of field names (e.g. "LogBucket") to
  557. // unconditionally include in API requests. By default, fields with
  558. // empty values are omitted from API requests. However, any non-pointer,
  559. // non-interface field appearing in ForceSendFields will be sent to the
  560. // server regardless of whether the field is empty or not. This may be
  561. // used to include empty fields in Patch requests.
  562. ForceSendFields []string `json:"-"`
  563. // NullFields is a list of field names (e.g. "LogBucket") to include in
  564. // API requests with the JSON null value. By default, fields with empty
  565. // values are omitted from API requests. However, any field with an
  566. // empty value appearing in NullFields will be sent to the server as
  567. // null. It is an error if a field in this list has a non-empty value.
  568. // This may be used to include null fields in Patch requests.
  569. NullFields []string `json:"-"`
  570. }
  571. func (s *BucketLogging) MarshalJSON() ([]byte, error) {
  572. type NoMethod BucketLogging
  573. raw := NoMethod(*s)
  574. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  575. }
  576. // BucketOwner: The owner of the bucket. This is always the project
  577. // team's owner group.
  578. type BucketOwner struct {
  579. // Entity: The entity, in the form project-owner-projectId.
  580. Entity string `json:"entity,omitempty"`
  581. // EntityId: The ID for the entity.
  582. EntityId string `json:"entityId,omitempty"`
  583. // ForceSendFields is a list of field names (e.g. "Entity") to
  584. // unconditionally include in API requests. By default, fields with
  585. // empty values are omitted from API requests. However, any non-pointer,
  586. // non-interface field appearing in ForceSendFields will be sent to the
  587. // server regardless of whether the field is empty or not. This may be
  588. // used to include empty fields in Patch requests.
  589. ForceSendFields []string `json:"-"`
  590. // NullFields is a list of field names (e.g. "Entity") to include in API
  591. // requests with the JSON null value. By default, fields with empty
  592. // values are omitted from API requests. However, any field with an
  593. // empty value appearing in NullFields will be sent to the server as
  594. // null. It is an error if a field in this list has a non-empty value.
  595. // This may be used to include null fields in Patch requests.
  596. NullFields []string `json:"-"`
  597. }
  598. func (s *BucketOwner) MarshalJSON() ([]byte, error) {
  599. type NoMethod BucketOwner
  600. raw := NoMethod(*s)
  601. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  602. }
  603. // BucketRetentionPolicy: The bucket's retention policy. The retention
  604. // policy enforces a minimum retention time for all objects contained in
  605. // the bucket, based on their creation time. Any attempt to overwrite or
  606. // delete objects younger than the retention period will result in a
  607. // PERMISSION_DENIED error. An unlocked retention policy can be modified
  608. // or removed from the bucket via a storage.buckets.update operation. A
  609. // locked retention policy cannot be removed or shortened in duration
  610. // for the lifetime of the bucket. Attempting to remove or decrease
  611. // period of a locked retention policy will result in a
  612. // PERMISSION_DENIED error.
  613. type BucketRetentionPolicy struct {
  614. // EffectiveTime: Server-determined value that indicates the time from
  615. // which policy was enforced and effective. This value is in RFC 3339
  616. // format.
  617. EffectiveTime string `json:"effectiveTime,omitempty"`
  618. // IsLocked: Once locked, an object retention policy cannot be modified.
  619. IsLocked bool `json:"isLocked,omitempty"`
  620. // RetentionPeriod: The duration in seconds that objects need to be
  621. // retained. Retention duration must be greater than zero and less than
  622. // 100 years. Note that enforcement of retention periods less than a day
  623. // is not guaranteed. Such periods should only be used for testing
  624. // purposes.
  625. RetentionPeriod int64 `json:"retentionPeriod,omitempty,string"`
  626. // ForceSendFields is a list of field names (e.g. "EffectiveTime") to
  627. // unconditionally include in API requests. By default, fields with
  628. // empty values are omitted from API requests. However, any non-pointer,
  629. // non-interface field appearing in ForceSendFields will be sent to the
  630. // server regardless of whether the field is empty or not. This may be
  631. // used to include empty fields in Patch requests.
  632. ForceSendFields []string `json:"-"`
  633. // NullFields is a list of field names (e.g. "EffectiveTime") to include
  634. // in API requests with the JSON null value. By default, fields with
  635. // empty values are omitted from API requests. However, any field with
  636. // an empty value appearing in NullFields will be sent to the server as
  637. // null. It is an error if a field in this list has a non-empty value.
  638. // This may be used to include null fields in Patch requests.
  639. NullFields []string `json:"-"`
  640. }
  641. func (s *BucketRetentionPolicy) MarshalJSON() ([]byte, error) {
  642. type NoMethod BucketRetentionPolicy
  643. raw := NoMethod(*s)
  644. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  645. }
  646. // BucketVersioning: The bucket's versioning configuration.
  647. type BucketVersioning struct {
  648. // Enabled: While set to true, versioning is fully enabled for this
  649. // bucket.
  650. Enabled bool `json:"enabled,omitempty"`
  651. // ForceSendFields is a list of field names (e.g. "Enabled") to
  652. // unconditionally include in API requests. By default, fields with
  653. // empty values are omitted from API requests. However, any non-pointer,
  654. // non-interface field appearing in ForceSendFields will be sent to the
  655. // server regardless of whether the field is empty or not. This may be
  656. // used to include empty fields in Patch requests.
  657. ForceSendFields []string `json:"-"`
  658. // NullFields is a list of field names (e.g. "Enabled") to include in
  659. // API requests with the JSON null value. By default, fields with empty
  660. // values are omitted from API requests. However, any field with an
  661. // empty value appearing in NullFields will be sent to the server as
  662. // null. It is an error if a field in this list has a non-empty value.
  663. // This may be used to include null fields in Patch requests.
  664. NullFields []string `json:"-"`
  665. }
  666. func (s *BucketVersioning) MarshalJSON() ([]byte, error) {
  667. type NoMethod BucketVersioning
  668. raw := NoMethod(*s)
  669. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  670. }
  671. // BucketWebsite: The bucket's website configuration, controlling how
  672. // the service behaves when accessing bucket contents as a web site. See
  673. // the Static Website Examples for more information.
  674. type BucketWebsite struct {
  675. // MainPageSuffix: If the requested object path is missing, the service
  676. // will ensure the path has a trailing '/', append this suffix, and
  677. // attempt to retrieve the resulting object. This allows the creation of
  678. // index.html objects to represent directory pages.
  679. MainPageSuffix string `json:"mainPageSuffix,omitempty"`
  680. // NotFoundPage: If the requested object path is missing, and any
  681. // mainPageSuffix object is missing, if applicable, the service will
  682. // return the named object from this bucket as the content for a 404 Not
  683. // Found result.
  684. NotFoundPage string `json:"notFoundPage,omitempty"`
  685. // ForceSendFields is a list of field names (e.g. "MainPageSuffix") to
  686. // unconditionally include in API requests. By default, fields with
  687. // empty values are omitted from API requests. However, any non-pointer,
  688. // non-interface field appearing in ForceSendFields will be sent to the
  689. // server regardless of whether the field is empty or not. This may be
  690. // used to include empty fields in Patch requests.
  691. ForceSendFields []string `json:"-"`
  692. // NullFields is a list of field names (e.g. "MainPageSuffix") to
  693. // include in API requests with the JSON null value. By default, fields
  694. // with empty values are omitted from API requests. However, any field
  695. // with an empty value appearing in NullFields will be sent to the
  696. // server as null. It is an error if a field in this list has a
  697. // non-empty value. This may be used to include null fields in Patch
  698. // requests.
  699. NullFields []string `json:"-"`
  700. }
  701. func (s *BucketWebsite) MarshalJSON() ([]byte, error) {
  702. type NoMethod BucketWebsite
  703. raw := NoMethod(*s)
  704. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  705. }
  706. // BucketAccessControl: An access-control entry.
  707. type BucketAccessControl struct {
  708. // Bucket: The name of the bucket.
  709. Bucket string `json:"bucket,omitempty"`
  710. // Domain: The domain associated with the entity, if any.
  711. Domain string `json:"domain,omitempty"`
  712. // Email: The email address associated with the entity, if any.
  713. Email string `json:"email,omitempty"`
  714. // Entity: The entity holding the permission, in one of the following
  715. // forms:
  716. // - user-userId
  717. // - user-email
  718. // - group-groupId
  719. // - group-email
  720. // - domain-domain
  721. // - project-team-projectId
  722. // - allUsers
  723. // - allAuthenticatedUsers Examples:
  724. // - The user liz@example.com would be user-liz@example.com.
  725. // - The group example@googlegroups.com would be
  726. // group-example@googlegroups.com.
  727. // - To refer to all members of the Google Apps for Business domain
  728. // example.com, the entity would be domain-example.com.
  729. Entity string `json:"entity,omitempty"`
  730. // EntityId: The ID for the entity, if any.
  731. EntityId string `json:"entityId,omitempty"`
  732. // Etag: HTTP 1.1 Entity tag for the access-control entry.
  733. Etag string `json:"etag,omitempty"`
  734. // Id: The ID of the access-control entry.
  735. Id string `json:"id,omitempty"`
  736. // Kind: The kind of item this is. For bucket access control entries,
  737. // this is always storage#bucketAccessControl.
  738. Kind string `json:"kind,omitempty"`
  739. // ProjectTeam: The project team associated with the entity, if any.
  740. ProjectTeam *BucketAccessControlProjectTeam `json:"projectTeam,omitempty"`
  741. // Role: The access permission for the entity.
  742. Role string `json:"role,omitempty"`
  743. // SelfLink: The link to this access-control entry.
  744. SelfLink string `json:"selfLink,omitempty"`
  745. // ServerResponse contains the HTTP response code and headers from the
  746. // server.
  747. googleapi.ServerResponse `json:"-"`
  748. // ForceSendFields is a list of field names (e.g. "Bucket") to
  749. // unconditionally include in API requests. By default, fields with
  750. // empty values are omitted from API requests. However, any non-pointer,
  751. // non-interface field appearing in ForceSendFields will be sent to the
  752. // server regardless of whether the field is empty or not. This may be
  753. // used to include empty fields in Patch requests.
  754. ForceSendFields []string `json:"-"`
  755. // NullFields is a list of field names (e.g. "Bucket") to include in API
  756. // requests with the JSON null value. By default, fields with empty
  757. // values are omitted from API requests. However, any field with an
  758. // empty value appearing in NullFields will be sent to the server as
  759. // null. It is an error if a field in this list has a non-empty value.
  760. // This may be used to include null fields in Patch requests.
  761. NullFields []string `json:"-"`
  762. }
  763. func (s *BucketAccessControl) MarshalJSON() ([]byte, error) {
  764. type NoMethod BucketAccessControl
  765. raw := NoMethod(*s)
  766. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  767. }
  768. // BucketAccessControlProjectTeam: The project team associated with the
  769. // entity, if any.
  770. type BucketAccessControlProjectTeam struct {
  771. // ProjectNumber: The project number.
  772. ProjectNumber string `json:"projectNumber,omitempty"`
  773. // Team: The team.
  774. Team string `json:"team,omitempty"`
  775. // ForceSendFields is a list of field names (e.g. "ProjectNumber") to
  776. // unconditionally include in API requests. By default, fields with
  777. // empty values are omitted from API requests. However, any non-pointer,
  778. // non-interface field appearing in ForceSendFields will be sent to the
  779. // server regardless of whether the field is empty or not. This may be
  780. // used to include empty fields in Patch requests.
  781. ForceSendFields []string `json:"-"`
  782. // NullFields is a list of field names (e.g. "ProjectNumber") to include
  783. // in API requests with the JSON null value. By default, fields with
  784. // empty values are omitted from API requests. However, any field with
  785. // an empty value appearing in NullFields will be sent to the server as
  786. // null. It is an error if a field in this list has a non-empty value.
  787. // This may be used to include null fields in Patch requests.
  788. NullFields []string `json:"-"`
  789. }
  790. func (s *BucketAccessControlProjectTeam) MarshalJSON() ([]byte, error) {
  791. type NoMethod BucketAccessControlProjectTeam
  792. raw := NoMethod(*s)
  793. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  794. }
  795. // BucketAccessControls: An access-control list.
  796. type BucketAccessControls struct {
  797. // Items: The list of items.
  798. Items []*BucketAccessControl `json:"items,omitempty"`
  799. // Kind: The kind of item this is. For lists of bucket access control
  800. // entries, this is always storage#bucketAccessControls.
  801. Kind string `json:"kind,omitempty"`
  802. // ServerResponse contains the HTTP response code and headers from the
  803. // server.
  804. googleapi.ServerResponse `json:"-"`
  805. // ForceSendFields is a list of field names (e.g. "Items") to
  806. // unconditionally include in API requests. By default, fields with
  807. // empty values are omitted from API requests. However, any non-pointer,
  808. // non-interface field appearing in ForceSendFields will be sent to the
  809. // server regardless of whether the field is empty or not. This may be
  810. // used to include empty fields in Patch requests.
  811. ForceSendFields []string `json:"-"`
  812. // NullFields is a list of field names (e.g. "Items") to include in API
  813. // requests with the JSON null value. By default, fields with empty
  814. // values are omitted from API requests. However, any field with an
  815. // empty value appearing in NullFields will be sent to the server as
  816. // null. It is an error if a field in this list has a non-empty value.
  817. // This may be used to include null fields in Patch requests.
  818. NullFields []string `json:"-"`
  819. }
  820. func (s *BucketAccessControls) MarshalJSON() ([]byte, error) {
  821. type NoMethod BucketAccessControls
  822. raw := NoMethod(*s)
  823. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  824. }
  825. // Buckets: A list of buckets.
  826. type Buckets struct {
  827. // Items: The list of items.
  828. Items []*Bucket `json:"items,omitempty"`
  829. // Kind: The kind of item this is. For lists of buckets, this is always
  830. // storage#buckets.
  831. Kind string `json:"kind,omitempty"`
  832. // NextPageToken: The continuation token, used to page through large
  833. // result sets. Provide this value in a subsequent request to return the
  834. // next page of results.
  835. NextPageToken string `json:"nextPageToken,omitempty"`
  836. // ServerResponse contains the HTTP response code and headers from the
  837. // server.
  838. googleapi.ServerResponse `json:"-"`
  839. // ForceSendFields is a list of field names (e.g. "Items") to
  840. // unconditionally include in API requests. By default, fields with
  841. // empty values are omitted from API requests. However, any non-pointer,
  842. // non-interface field appearing in ForceSendFields will be sent to the
  843. // server regardless of whether the field is empty or not. This may be
  844. // used to include empty fields in Patch requests.
  845. ForceSendFields []string `json:"-"`
  846. // NullFields is a list of field names (e.g. "Items") to include in API
  847. // requests with the JSON null value. By default, fields with empty
  848. // values are omitted from API requests. However, any field with an
  849. // empty value appearing in NullFields will be sent to the server as
  850. // null. It is an error if a field in this list has a non-empty value.
  851. // This may be used to include null fields in Patch requests.
  852. NullFields []string `json:"-"`
  853. }
  854. func (s *Buckets) MarshalJSON() ([]byte, error) {
  855. type NoMethod Buckets
  856. raw := NoMethod(*s)
  857. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  858. }
  859. // Channel: An notification channel used to watch for resource changes.
  860. type Channel struct {
  861. // Address: The address where notifications are delivered for this
  862. // channel.
  863. Address string `json:"address,omitempty"`
  864. // Expiration: Date and time of notification channel expiration,
  865. // expressed as a Unix timestamp, in milliseconds. Optional.
  866. Expiration int64 `json:"expiration,omitempty,string"`
  867. // Id: A UUID or similar unique string that identifies this channel.
  868. Id string `json:"id,omitempty"`
  869. // Kind: Identifies this as a notification channel used to watch for
  870. // changes to a resource. Value: the fixed string "api#channel".
  871. Kind string `json:"kind,omitempty"`
  872. // Params: Additional parameters controlling delivery channel behavior.
  873. // Optional.
  874. Params map[string]string `json:"params,omitempty"`
  875. // Payload: A Boolean value to indicate whether payload is wanted.
  876. // Optional.
  877. Payload bool `json:"payload,omitempty"`
  878. // ResourceId: An opaque ID that identifies the resource being watched
  879. // on this channel. Stable across different API versions.
  880. ResourceId string `json:"resourceId,omitempty"`
  881. // ResourceUri: A version-specific identifier for the watched resource.
  882. ResourceUri string `json:"resourceUri,omitempty"`
  883. // Token: An arbitrary string delivered to the target address with each
  884. // notification delivered over this channel. Optional.
  885. Token string `json:"token,omitempty"`
  886. // Type: The type of delivery mechanism used for this channel.
  887. Type string `json:"type,omitempty"`
  888. // ServerResponse contains the HTTP response code and headers from the
  889. // server.
  890. googleapi.ServerResponse `json:"-"`
  891. // ForceSendFields is a list of field names (e.g. "Address") 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. "Address") 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 *Channel) MarshalJSON() ([]byte, error) {
  907. type NoMethod Channel
  908. raw := NoMethod(*s)
  909. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  910. }
  911. // ComposeRequest: A Compose request.
  912. type ComposeRequest struct {
  913. // Destination: Properties of the resulting object.
  914. Destination *Object `json:"destination,omitempty"`
  915. // Kind: The kind of item this is.
  916. Kind string `json:"kind,omitempty"`
  917. // SourceObjects: The list of source objects that will be concatenated
  918. // into a single object.
  919. SourceObjects []*ComposeRequestSourceObjects `json:"sourceObjects,omitempty"`
  920. // ForceSendFields is a list of field names (e.g. "Destination") to
  921. // unconditionally include in API requests. By default, fields with
  922. // empty values are omitted from API requests. However, any non-pointer,
  923. // non-interface field appearing in ForceSendFields will be sent to the
  924. // server regardless of whether the field is empty or not. This may be
  925. // used to include empty fields in Patch requests.
  926. ForceSendFields []string `json:"-"`
  927. // NullFields is a list of field names (e.g. "Destination") to include
  928. // in API requests with the JSON null value. By default, fields with
  929. // empty values are omitted from API requests. However, any field with
  930. // an empty value appearing in NullFields will be sent to the server as
  931. // null. It is an error if a field in this list has a non-empty value.
  932. // This may be used to include null fields in Patch requests.
  933. NullFields []string `json:"-"`
  934. }
  935. func (s *ComposeRequest) MarshalJSON() ([]byte, error) {
  936. type NoMethod ComposeRequest
  937. raw := NoMethod(*s)
  938. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  939. }
  940. type ComposeRequestSourceObjects struct {
  941. // Generation: The generation of this object to use as the source.
  942. Generation int64 `json:"generation,omitempty,string"`
  943. // Name: The source object's name. All source objects must reside in the
  944. // same bucket.
  945. Name string `json:"name,omitempty"`
  946. // ObjectPreconditions: Conditions that must be met for this operation
  947. // to execute.
  948. ObjectPreconditions *ComposeRequestSourceObjectsObjectPreconditions `json:"objectPreconditions,omitempty"`
  949. // ForceSendFields is a list of field names (e.g. "Generation") to
  950. // unconditionally include in API requests. By default, fields with
  951. // empty values are omitted from API requests. However, any non-pointer,
  952. // non-interface field appearing in ForceSendFields will be sent to the
  953. // server regardless of whether the field is empty or not. This may be
  954. // used to include empty fields in Patch requests.
  955. ForceSendFields []string `json:"-"`
  956. // NullFields is a list of field names (e.g. "Generation") to include in
  957. // API requests with the JSON null value. By default, fields with empty
  958. // values are omitted from API requests. However, any field with an
  959. // empty value appearing in NullFields will be sent to the server as
  960. // null. It is an error if a field in this list has a non-empty value.
  961. // This may be used to include null fields in Patch requests.
  962. NullFields []string `json:"-"`
  963. }
  964. func (s *ComposeRequestSourceObjects) MarshalJSON() ([]byte, error) {
  965. type NoMethod ComposeRequestSourceObjects
  966. raw := NoMethod(*s)
  967. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  968. }
  969. // ComposeRequestSourceObjectsObjectPreconditions: Conditions that must
  970. // be met for this operation to execute.
  971. type ComposeRequestSourceObjectsObjectPreconditions struct {
  972. // IfGenerationMatch: Only perform the composition if the generation of
  973. // the source object that would be used matches this value. If this
  974. // value and a generation are both specified, they must be the same
  975. // value or the call will fail.
  976. IfGenerationMatch int64 `json:"ifGenerationMatch,omitempty,string"`
  977. // ForceSendFields is a list of field names (e.g. "IfGenerationMatch")
  978. // to unconditionally include in API requests. By default, fields with
  979. // empty values are omitted from API requests. However, any non-pointer,
  980. // non-interface field appearing in ForceSendFields will be sent to the
  981. // server regardless of whether the field is empty or not. This may be
  982. // used to include empty fields in Patch requests.
  983. ForceSendFields []string `json:"-"`
  984. // NullFields is a list of field names (e.g. "IfGenerationMatch") to
  985. // include in API requests with the JSON null value. By default, fields
  986. // with empty values are omitted from API requests. However, any field
  987. // with an empty value appearing in NullFields will be sent to the
  988. // server as null. It is an error if a field in this list has a
  989. // non-empty value. This may be used to include null fields in Patch
  990. // requests.
  991. NullFields []string `json:"-"`
  992. }
  993. func (s *ComposeRequestSourceObjectsObjectPreconditions) MarshalJSON() ([]byte, error) {
  994. type NoMethod ComposeRequestSourceObjectsObjectPreconditions
  995. raw := NoMethod(*s)
  996. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  997. }
  998. // Notification: A subscription to receive Google PubSub notifications.
  999. type Notification struct {
  1000. // CustomAttributes: An optional list of additional attributes to attach
  1001. // to each Cloud PubSub message published for this notification
  1002. // subscription.
  1003. CustomAttributes map[string]string `json:"custom_attributes,omitempty"`
  1004. // Etag: HTTP 1.1 Entity tag for this subscription notification.
  1005. Etag string `json:"etag,omitempty"`
  1006. // EventTypes: If present, only send notifications about listed event
  1007. // types. If empty, sent notifications for all event types.
  1008. EventTypes []string `json:"event_types,omitempty"`
  1009. // Id: The ID of the notification.
  1010. Id string `json:"id,omitempty"`
  1011. // Kind: The kind of item this is. For notifications, this is always
  1012. // storage#notification.
  1013. Kind string `json:"kind,omitempty"`
  1014. // ObjectNamePrefix: If present, only apply this notification
  1015. // configuration to object names that begin with this prefix.
  1016. ObjectNamePrefix string `json:"object_name_prefix,omitempty"`
  1017. // PayloadFormat: The desired content of the Payload.
  1018. PayloadFormat string `json:"payload_format,omitempty"`
  1019. // SelfLink: The canonical URL of this notification.
  1020. SelfLink string `json:"selfLink,omitempty"`
  1021. // Topic: The Cloud PubSub topic to which this subscription publishes.
  1022. // Formatted as:
  1023. // '//pubsub.googleapis.com/projects/{project-identifier}/topics/{my-topi
  1024. // c}'
  1025. Topic string `json:"topic,omitempty"`
  1026. // ServerResponse contains the HTTP response code and headers from the
  1027. // server.
  1028. googleapi.ServerResponse `json:"-"`
  1029. // ForceSendFields is a list of field names (e.g. "CustomAttributes") to
  1030. // unconditionally include in API requests. By default, fields with
  1031. // empty values are omitted from API requests. However, any non-pointer,
  1032. // non-interface field appearing in ForceSendFields will be sent to the
  1033. // server regardless of whether the field is empty or not. This may be
  1034. // used to include empty fields in Patch requests.
  1035. ForceSendFields []string `json:"-"`
  1036. // NullFields is a list of field names (e.g. "CustomAttributes") to
  1037. // include in API requests with the JSON null value. By default, fields
  1038. // with empty values are omitted from API requests. However, any field
  1039. // with an empty value appearing in NullFields will be sent to the
  1040. // server as null. It is an error if a field in this list has a
  1041. // non-empty value. This may be used to include null fields in Patch
  1042. // requests.
  1043. NullFields []string `json:"-"`
  1044. }
  1045. func (s *Notification) MarshalJSON() ([]byte, error) {
  1046. type NoMethod Notification
  1047. raw := NoMethod(*s)
  1048. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1049. }
  1050. // Notifications: A list of notification subscriptions.
  1051. type Notifications struct {
  1052. // Items: The list of items.
  1053. Items []*Notification `json:"items,omitempty"`
  1054. // Kind: The kind of item this is. For lists of notifications, this is
  1055. // always storage#notifications.
  1056. Kind string `json:"kind,omitempty"`
  1057. // ServerResponse contains the HTTP response code and headers from the
  1058. // server.
  1059. googleapi.ServerResponse `json:"-"`
  1060. // ForceSendFields is a list of field names (e.g. "Items") to
  1061. // unconditionally include in API requests. By default, fields with
  1062. // empty values are omitted from API requests. However, any non-pointer,
  1063. // non-interface field appearing in ForceSendFields will be sent to the
  1064. // server regardless of whether the field is empty or not. This may be
  1065. // used to include empty fields in Patch requests.
  1066. ForceSendFields []string `json:"-"`
  1067. // NullFields is a list of field names (e.g. "Items") to include in API
  1068. // requests with the JSON null value. By default, fields with empty
  1069. // values are omitted from API requests. However, any field with an
  1070. // empty value appearing in NullFields will be sent to the server as
  1071. // null. It is an error if a field in this list has a non-empty value.
  1072. // This may be used to include null fields in Patch requests.
  1073. NullFields []string `json:"-"`
  1074. }
  1075. func (s *Notifications) MarshalJSON() ([]byte, error) {
  1076. type NoMethod Notifications
  1077. raw := NoMethod(*s)
  1078. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1079. }
  1080. // Object: An object.
  1081. type Object struct {
  1082. // Acl: Access controls on the object.
  1083. Acl []*ObjectAccessControl `json:"acl,omitempty"`
  1084. // Bucket: The name of the bucket containing this object.
  1085. Bucket string `json:"bucket,omitempty"`
  1086. // CacheControl: Cache-Control directive for the object data. If
  1087. // omitted, and the object is accessible to all anonymous users, the
  1088. // default will be public, max-age=3600.
  1089. CacheControl string `json:"cacheControl,omitempty"`
  1090. // ComponentCount: Number of underlying components that make up this
  1091. // object. Components are accumulated by compose operations.
  1092. ComponentCount int64 `json:"componentCount,omitempty"`
  1093. // ContentDisposition: Content-Disposition of the object data.
  1094. ContentDisposition string `json:"contentDisposition,omitempty"`
  1095. // ContentEncoding: Content-Encoding of the object data.
  1096. ContentEncoding string `json:"contentEncoding,omitempty"`
  1097. // ContentLanguage: Content-Language of the object data.
  1098. ContentLanguage string `json:"contentLanguage,omitempty"`
  1099. // ContentType: Content-Type of the object data. If an object is stored
  1100. // without a Content-Type, it is served as application/octet-stream.
  1101. ContentType string `json:"contentType,omitempty"`
  1102. // Crc32c: CRC32c checksum, as described in RFC 4960, Appendix B;
  1103. // encoded using base64 in big-endian byte order. For more information
  1104. // about using the CRC32c checksum, see Hashes and ETags: Best
  1105. // Practices.
  1106. Crc32c string `json:"crc32c,omitempty"`
  1107. // CustomerEncryption: Metadata of customer-supplied encryption key, if
  1108. // the object is encrypted by such a key.
  1109. CustomerEncryption *ObjectCustomerEncryption `json:"customerEncryption,omitempty"`
  1110. // Etag: HTTP 1.1 Entity tag for the object.
  1111. Etag string `json:"etag,omitempty"`
  1112. // EventBasedHold: Whether an object is under event-based hold.
  1113. // Event-based hold is a way to retain objects until an event occurs,
  1114. // which is signified by the hold's release (i.e. this value is set to
  1115. // false). After being released (set to false), such objects will be
  1116. // subject to bucket-level retention (if any). One sample use case of
  1117. // this flag is for banks to hold loan documents for at least 3 years
  1118. // after loan is paid in full. Here, bucket-level retention is 3 years
  1119. // and the event is the loan being paid in full. In this example, these
  1120. // objects will be held intact for any number of years until the event
  1121. // has occurred (event-based hold on the object is released) and then 3
  1122. // more years after that. That means retention duration of the objects
  1123. // begins from the moment event-based hold transitioned from true to
  1124. // false.
  1125. EventBasedHold bool `json:"eventBasedHold,omitempty"`
  1126. // Generation: The content generation of this object. Used for object
  1127. // versioning.
  1128. Generation int64 `json:"generation,omitempty,string"`
  1129. // Id: The ID of the object, including the bucket name, object name, and
  1130. // generation number.
  1131. Id string `json:"id,omitempty"`
  1132. // Kind: The kind of item this is. For objects, this is always
  1133. // storage#object.
  1134. Kind string `json:"kind,omitempty"`
  1135. // KmsKeyName: Cloud KMS Key used to encrypt this object, if the object
  1136. // is encrypted by such a key.
  1137. KmsKeyName string `json:"kmsKeyName,omitempty"`
  1138. // Md5Hash: MD5 hash of the data; encoded using base64. For more
  1139. // information about using the MD5 hash, see Hashes and ETags: Best
  1140. // Practices.
  1141. Md5Hash string `json:"md5Hash,omitempty"`
  1142. // MediaLink: Media download link.
  1143. MediaLink string `json:"mediaLink,omitempty"`
  1144. // Metadata: User-provided metadata, in key/value pairs.
  1145. Metadata map[string]string `json:"metadata,omitempty"`
  1146. // Metageneration: The version of the metadata for this object at this
  1147. // generation. Used for preconditions and for detecting changes in
  1148. // metadata. A metageneration number is only meaningful in the context
  1149. // of a particular generation of a particular object.
  1150. Metageneration int64 `json:"metageneration,omitempty,string"`
  1151. // Name: The name of the object. Required if not specified by URL
  1152. // parameter.
  1153. Name string `json:"name,omitempty"`
  1154. // Owner: The owner of the object. This will always be the uploader of
  1155. // the object.
  1156. Owner *ObjectOwner `json:"owner,omitempty"`
  1157. // RetentionExpirationTime: A server-determined value that specifies the
  1158. // earliest time that the object's retention period expires. This value
  1159. // is in RFC 3339 format. Note 1: This field is not provided for objects
  1160. // with an active event-based hold, since retention expiration is
  1161. // unknown until the hold is removed. Note 2: This value can be provided
  1162. // even when temporary hold is set (so that the user can reason about
  1163. // policy without having to first unset the temporary hold).
  1164. RetentionExpirationTime string `json:"retentionExpirationTime,omitempty"`
  1165. // SelfLink: The link to this object.
  1166. SelfLink string `json:"selfLink,omitempty"`
  1167. // Size: Content-Length of the data in bytes.
  1168. Size uint64 `json:"size,omitempty,string"`
  1169. // StorageClass: Storage class of the object.
  1170. StorageClass string `json:"storageClass,omitempty"`
  1171. // TemporaryHold: Whether an object is under temporary hold. While this
  1172. // flag is set to true, the object is protected against deletion and
  1173. // overwrites. A common use case of this flag is regulatory
  1174. // investigations where objects need to be retained while the
  1175. // investigation is ongoing. Note that unlike event-based hold,
  1176. // temporary hold does not impact retention expiration time of an
  1177. // object.
  1178. TemporaryHold bool `json:"temporaryHold,omitempty"`
  1179. // TimeCreated: The creation time of the object in RFC 3339 format.
  1180. TimeCreated string `json:"timeCreated,omitempty"`
  1181. // TimeDeleted: The deletion time of the object in RFC 3339 format. Will
  1182. // be returned if and only if this version of the object has been
  1183. // deleted.
  1184. TimeDeleted string `json:"timeDeleted,omitempty"`
  1185. // TimeStorageClassUpdated: The time at which the object's storage class
  1186. // was last changed. When the object is initially created, it will be
  1187. // set to timeCreated.
  1188. TimeStorageClassUpdated string `json:"timeStorageClassUpdated,omitempty"`
  1189. // Updated: The modification time of the object metadata in RFC 3339
  1190. // format.
  1191. Updated string `json:"updated,omitempty"`
  1192. // ServerResponse contains the HTTP response code and headers from the
  1193. // server.
  1194. googleapi.ServerResponse `json:"-"`
  1195. // ForceSendFields is a list of field names (e.g. "Acl") to
  1196. // unconditionally include in API requests. By default, fields with
  1197. // empty values are omitted from API requests. However, any non-pointer,
  1198. // non-interface field appearing in ForceSendFields will be sent to the
  1199. // server regardless of whether the field is empty or not. This may be
  1200. // used to include empty fields in Patch requests.
  1201. ForceSendFields []string `json:"-"`
  1202. // NullFields is a list of field names (e.g. "Acl") to include in API
  1203. // requests with the JSON null value. By default, fields with empty
  1204. // values are omitted from API requests. However, any field with an
  1205. // empty value appearing in NullFields will be sent to the server as
  1206. // null. It is an error if a field in this list has a non-empty value.
  1207. // This may be used to include null fields in Patch requests.
  1208. NullFields []string `json:"-"`
  1209. }
  1210. func (s *Object) MarshalJSON() ([]byte, error) {
  1211. type NoMethod Object
  1212. raw := NoMethod(*s)
  1213. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1214. }
  1215. // ObjectCustomerEncryption: Metadata of customer-supplied encryption
  1216. // key, if the object is encrypted by such a key.
  1217. type ObjectCustomerEncryption struct {
  1218. // EncryptionAlgorithm: The encryption algorithm.
  1219. EncryptionAlgorithm string `json:"encryptionAlgorithm,omitempty"`
  1220. // KeySha256: SHA256 hash value of the encryption key.
  1221. KeySha256 string `json:"keySha256,omitempty"`
  1222. // ForceSendFields is a list of field names (e.g. "EncryptionAlgorithm")
  1223. // to unconditionally include in API requests. By default, fields with
  1224. // empty values are omitted from API requests. However, any non-pointer,
  1225. // non-interface field appearing in ForceSendFields will be sent to the
  1226. // server regardless of whether the field is empty or not. This may be
  1227. // used to include empty fields in Patch requests.
  1228. ForceSendFields []string `json:"-"`
  1229. // NullFields is a list of field names (e.g. "EncryptionAlgorithm") to
  1230. // include in API requests with the JSON null value. By default, fields
  1231. // with empty values are omitted from API requests. However, any field
  1232. // with an empty value appearing in NullFields will be sent to the
  1233. // server as null. It is an error if a field in this list has a
  1234. // non-empty value. This may be used to include null fields in Patch
  1235. // requests.
  1236. NullFields []string `json:"-"`
  1237. }
  1238. func (s *ObjectCustomerEncryption) MarshalJSON() ([]byte, error) {
  1239. type NoMethod ObjectCustomerEncryption
  1240. raw := NoMethod(*s)
  1241. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1242. }
  1243. // ObjectOwner: The owner of the object. This will always be the
  1244. // uploader of the object.
  1245. type ObjectOwner struct {
  1246. // Entity: The entity, in the form user-userId.
  1247. Entity string `json:"entity,omitempty"`
  1248. // EntityId: The ID for the entity.
  1249. EntityId string `json:"entityId,omitempty"`
  1250. // ForceSendFields is a list of field names (e.g. "Entity") to
  1251. // unconditionally include in API requests. By default, fields with
  1252. // empty values are omitted from API requests. However, any non-pointer,
  1253. // non-interface field appearing in ForceSendFields will be sent to the
  1254. // server regardless of whether the field is empty or not. This may be
  1255. // used to include empty fields in Patch requests.
  1256. ForceSendFields []string `json:"-"`
  1257. // NullFields is a list of field names (e.g. "Entity") to include in API
  1258. // requests with the JSON null value. By default, fields with empty
  1259. // values are omitted from API requests. However, any field with an
  1260. // empty value appearing in NullFields will be sent to the server as
  1261. // null. It is an error if a field in this list has a non-empty value.
  1262. // This may be used to include null fields in Patch requests.
  1263. NullFields []string `json:"-"`
  1264. }
  1265. func (s *ObjectOwner) MarshalJSON() ([]byte, error) {
  1266. type NoMethod ObjectOwner
  1267. raw := NoMethod(*s)
  1268. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1269. }
  1270. // ObjectAccessControl: An access-control entry.
  1271. type ObjectAccessControl struct {
  1272. // Bucket: The name of the bucket.
  1273. Bucket string `json:"bucket,omitempty"`
  1274. // Domain: The domain associated with the entity, if any.
  1275. Domain string `json:"domain,omitempty"`
  1276. // Email: The email address associated with the entity, if any.
  1277. Email string `json:"email,omitempty"`
  1278. // Entity: The entity holding the permission, in one of the following
  1279. // forms:
  1280. // - user-userId
  1281. // - user-email
  1282. // - group-groupId
  1283. // - group-email
  1284. // - domain-domain
  1285. // - project-team-projectId
  1286. // - allUsers
  1287. // - allAuthenticatedUsers Examples:
  1288. // - The user liz@example.com would be user-liz@example.com.
  1289. // - The group example@googlegroups.com would be
  1290. // group-example@googlegroups.com.
  1291. // - To refer to all members of the Google Apps for Business domain
  1292. // example.com, the entity would be domain-example.com.
  1293. Entity string `json:"entity,omitempty"`
  1294. // EntityId: The ID for the entity, if any.
  1295. EntityId string `json:"entityId,omitempty"`
  1296. // Etag: HTTP 1.1 Entity tag for the access-control entry.
  1297. Etag string `json:"etag,omitempty"`
  1298. // Generation: The content generation of the object, if applied to an
  1299. // object.
  1300. Generation int64 `json:"generation,omitempty,string"`
  1301. // Id: The ID of the access-control entry.
  1302. Id string `json:"id,omitempty"`
  1303. // Kind: The kind of item this is. For object access control entries,
  1304. // this is always storage#objectAccessControl.
  1305. Kind string `json:"kind,omitempty"`
  1306. // Object: The name of the object, if applied to an object.
  1307. Object string `json:"object,omitempty"`
  1308. // ProjectTeam: The project team associated with the entity, if any.
  1309. ProjectTeam *ObjectAccessControlProjectTeam `json:"projectTeam,omitempty"`
  1310. // Role: The access permission for the entity.
  1311. Role string `json:"role,omitempty"`
  1312. // SelfLink: The link to this access-control entry.
  1313. SelfLink string `json:"selfLink,omitempty"`
  1314. // ServerResponse contains the HTTP response code and headers from the
  1315. // server.
  1316. googleapi.ServerResponse `json:"-"`
  1317. // ForceSendFields is a list of field names (e.g. "Bucket") to
  1318. // unconditionally include in API requests. By default, fields with
  1319. // empty values are omitted from API requests. However, any non-pointer,
  1320. // non-interface field appearing in ForceSendFields will be sent to the
  1321. // server regardless of whether the field is empty or not. This may be
  1322. // used to include empty fields in Patch requests.
  1323. ForceSendFields []string `json:"-"`
  1324. // NullFields is a list of field names (e.g. "Bucket") to include in API
  1325. // requests with the JSON null value. By default, fields with empty
  1326. // values are omitted from API requests. However, any field with an
  1327. // empty value appearing in NullFields will be sent to the server as
  1328. // null. It is an error if a field in this list has a non-empty value.
  1329. // This may be used to include null fields in Patch requests.
  1330. NullFields []string `json:"-"`
  1331. }
  1332. func (s *ObjectAccessControl) MarshalJSON() ([]byte, error) {
  1333. type NoMethod ObjectAccessControl
  1334. raw := NoMethod(*s)
  1335. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1336. }
  1337. // ObjectAccessControlProjectTeam: The project team associated with the
  1338. // entity, if any.
  1339. type ObjectAccessControlProjectTeam struct {
  1340. // ProjectNumber: The project number.
  1341. ProjectNumber string `json:"projectNumber,omitempty"`
  1342. // Team: The team.
  1343. Team string `json:"team,omitempty"`
  1344. // ForceSendFields is a list of field names (e.g. "ProjectNumber") to
  1345. // unconditionally include in API requests. By default, fields with
  1346. // empty values are omitted from API requests. However, any non-pointer,
  1347. // non-interface field appearing in ForceSendFields will be sent to the
  1348. // server regardless of whether the field is empty or not. This may be
  1349. // used to include empty fields in Patch requests.
  1350. ForceSendFields []string `json:"-"`
  1351. // NullFields is a list of field names (e.g. "ProjectNumber") to include
  1352. // in API requests with the JSON null value. By default, fields with
  1353. // empty values are omitted from API requests. However, any field with
  1354. // an empty value appearing in NullFields will be sent to the server as
  1355. // null. It is an error if a field in this list has a non-empty value.
  1356. // This may be used to include null fields in Patch requests.
  1357. NullFields []string `json:"-"`
  1358. }
  1359. func (s *ObjectAccessControlProjectTeam) MarshalJSON() ([]byte, error) {
  1360. type NoMethod ObjectAccessControlProjectTeam
  1361. raw := NoMethod(*s)
  1362. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1363. }
  1364. // ObjectAccessControls: An access-control list.
  1365. type ObjectAccessControls struct {
  1366. // Items: The list of items.
  1367. Items []*ObjectAccessControl `json:"items,omitempty"`
  1368. // Kind: The kind of item this is. For lists of object access control
  1369. // entries, this is always storage#objectAccessControls.
  1370. Kind string `json:"kind,omitempty"`
  1371. // ServerResponse contains the HTTP response code and headers from the
  1372. // server.
  1373. googleapi.ServerResponse `json:"-"`
  1374. // ForceSendFields is a list of field names (e.g. "Items") to
  1375. // unconditionally include in API requests. By default, fields with
  1376. // empty values are omitted from API requests. However, any non-pointer,
  1377. // non-interface field appearing in ForceSendFields will be sent to the
  1378. // server regardless of whether the field is empty or not. This may be
  1379. // used to include empty fields in Patch requests.
  1380. ForceSendFields []string `json:"-"`
  1381. // NullFields is a list of field names (e.g. "Items") to include in API
  1382. // requests with the JSON null value. By default, fields with empty
  1383. // values are omitted from API requests. However, any field with an
  1384. // empty value appearing in NullFields will be sent to the server as
  1385. // null. It is an error if a field in this list has a non-empty value.
  1386. // This may be used to include null fields in Patch requests.
  1387. NullFields []string `json:"-"`
  1388. }
  1389. func (s *ObjectAccessControls) MarshalJSON() ([]byte, error) {
  1390. type NoMethod ObjectAccessControls
  1391. raw := NoMethod(*s)
  1392. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1393. }
  1394. // Objects: A list of objects.
  1395. type Objects struct {
  1396. // Items: The list of items.
  1397. Items []*Object `json:"items,omitempty"`
  1398. // Kind: The kind of item this is. For lists of objects, this is always
  1399. // storage#objects.
  1400. Kind string `json:"kind,omitempty"`
  1401. // NextPageToken: The continuation token, used to page through large
  1402. // result sets. Provide this value in a subsequent request to return the
  1403. // next page of results.
  1404. NextPageToken string `json:"nextPageToken,omitempty"`
  1405. // Prefixes: The list of prefixes of objects matching-but-not-listed up
  1406. // to and including the requested delimiter.
  1407. Prefixes []string `json:"prefixes,omitempty"`
  1408. // ServerResponse contains the HTTP response code and headers from the
  1409. // server.
  1410. googleapi.ServerResponse `json:"-"`
  1411. // ForceSendFields is a list of field names (e.g. "Items") to
  1412. // unconditionally include in API requests. By default, fields with
  1413. // empty values are omitted from API requests. However, any non-pointer,
  1414. // non-interface field appearing in ForceSendFields will be sent to the
  1415. // server regardless of whether the field is empty or not. This may be
  1416. // used to include empty fields in Patch requests.
  1417. ForceSendFields []string `json:"-"`
  1418. // NullFields is a list of field names (e.g. "Items") to include in API
  1419. // requests with the JSON null value. By default, fields with empty
  1420. // values are omitted from API requests. However, any field with an
  1421. // empty value appearing in NullFields will be sent to the server as
  1422. // null. It is an error if a field in this list has a non-empty value.
  1423. // This may be used to include null fields in Patch requests.
  1424. NullFields []string `json:"-"`
  1425. }
  1426. func (s *Objects) MarshalJSON() ([]byte, error) {
  1427. type NoMethod Objects
  1428. raw := NoMethod(*s)
  1429. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1430. }
  1431. // Policy: A bucket/object IAM policy.
  1432. type Policy struct {
  1433. // Bindings: An association between a role, which comes with a set of
  1434. // permissions, and members who may assume that role.
  1435. Bindings []*PolicyBindings `json:"bindings,omitempty"`
  1436. // Etag: HTTP 1.1 Entity tag for the policy.
  1437. Etag string `json:"etag,omitempty"`
  1438. // Kind: The kind of item this is. For policies, this is always
  1439. // storage#policy. This field is ignored on input.
  1440. Kind string `json:"kind,omitempty"`
  1441. // ResourceId: The ID of the resource to which this policy belongs. Will
  1442. // be of the form projects/_/buckets/bucket for buckets, and
  1443. // projects/_/buckets/bucket/objects/object for objects. A specific
  1444. // generation may be specified by appending #generationNumber to the end
  1445. // of the object name, e.g.
  1446. // projects/_/buckets/my-bucket/objects/data.txt#17. The current
  1447. // generation can be denoted with #0. This field is ignored on input.
  1448. ResourceId string `json:"resourceId,omitempty"`
  1449. // ServerResponse contains the HTTP response code and headers from the
  1450. // server.
  1451. googleapi.ServerResponse `json:"-"`
  1452. // ForceSendFields is a list of field names (e.g. "Bindings") to
  1453. // unconditionally include in API requests. By default, fields with
  1454. // empty values are omitted from API requests. However, any non-pointer,
  1455. // non-interface field appearing in ForceSendFields will be sent to the
  1456. // server regardless of whether the field is empty or not. This may be
  1457. // used to include empty fields in Patch requests.
  1458. ForceSendFields []string `json:"-"`
  1459. // NullFields is a list of field names (e.g. "Bindings") to include in
  1460. // API requests with the JSON null value. By default, fields with empty
  1461. // values are omitted from API requests. However, any field with an
  1462. // empty value appearing in NullFields will be sent to the server as
  1463. // null. It is an error if a field in this list has a non-empty value.
  1464. // This may be used to include null fields in Patch requests.
  1465. NullFields []string `json:"-"`
  1466. }
  1467. func (s *Policy) MarshalJSON() ([]byte, error) {
  1468. type NoMethod Policy
  1469. raw := NoMethod(*s)
  1470. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1471. }
  1472. type PolicyBindings struct {
  1473. Condition interface{} `json:"condition,omitempty"`
  1474. // Members: A collection of identifiers for members who may assume the
  1475. // provided role. Recognized identifiers are as follows:
  1476. // - allUsers — A special identifier that represents anyone on the
  1477. // internet; with or without a Google account.
  1478. // - allAuthenticatedUsers — A special identifier that represents
  1479. // anyone who is authenticated with a Google account or a service
  1480. // account.
  1481. // - user:emailid — An email address that represents a specific
  1482. // account. For example, user:alice@gmail.com or user:joe@example.com.
  1483. //
  1484. // - serviceAccount:emailid — An email address that represents a
  1485. // service account. For example,
  1486. // serviceAccount:my-other-app@appspot.gserviceaccount.com .
  1487. // - group:emailid — An email address that represents a Google group.
  1488. // For example, group:admins@example.com.
  1489. // - domain:domain — A Google Apps domain name that represents all the
  1490. // users of that domain. For example, domain:google.com or
  1491. // domain:example.com.
  1492. // - projectOwner:projectid — Owners of the given project. For
  1493. // example, projectOwner:my-example-project
  1494. // - projectEditor:projectid — Editors of the given project. For
  1495. // example, projectEditor:my-example-project
  1496. // - projectViewer:projectid — Viewers of the given project. For
  1497. // example, projectViewer:my-example-project
  1498. Members []string `json:"members,omitempty"`
  1499. // Role: The role to which members belong. Two types of roles are
  1500. // supported: new IAM roles, which grant permissions that do not map
  1501. // directly to those provided by ACLs, and legacy IAM roles, which do
  1502. // map directly to ACL permissions. All roles are of the format
  1503. // roles/storage.specificRole.
  1504. // The new IAM roles are:
  1505. // - roles/storage.admin — Full control of Google Cloud Storage
  1506. // resources.
  1507. // - roles/storage.objectViewer — Read-Only access to Google Cloud
  1508. // Storage objects.
  1509. // - roles/storage.objectCreator — Access to create objects in Google
  1510. // Cloud Storage.
  1511. // - roles/storage.objectAdmin — Full control of Google Cloud Storage
  1512. // objects. The legacy IAM roles are:
  1513. // - roles/storage.legacyObjectReader — Read-only access to objects
  1514. // without listing. Equivalent to an ACL entry on an object with the
  1515. // READER role.
  1516. // - roles/storage.legacyObjectOwner — Read/write access to existing
  1517. // objects without listing. Equivalent to an ACL entry on an object with
  1518. // the OWNER role.
  1519. // - roles/storage.legacyBucketReader — Read access to buckets with
  1520. // object listing. Equivalent to an ACL entry on a bucket with the
  1521. // READER role.
  1522. // - roles/storage.legacyBucketWriter — Read access to buckets with
  1523. // object listing/creation/deletion. Equivalent to an ACL entry on a
  1524. // bucket with the WRITER role.
  1525. // - roles/storage.legacyBucketOwner — Read and write access to
  1526. // existing buckets with object listing/creation/deletion. Equivalent to
  1527. // an ACL entry on a bucket with the OWNER role.
  1528. Role string `json:"role,omitempty"`
  1529. // ForceSendFields is a list of field names (e.g. "Condition") to
  1530. // unconditionally include in API requests. By default, fields with
  1531. // empty values are omitted from API requests. However, any non-pointer,
  1532. // non-interface field appearing in ForceSendFields will be sent to the
  1533. // server regardless of whether the field is empty or not. This may be
  1534. // used to include empty fields in Patch requests.
  1535. ForceSendFields []string `json:"-"`
  1536. // NullFields is a list of field names (e.g. "Condition") to include in
  1537. // API requests with the JSON null value. By default, fields with empty
  1538. // values are omitted from API requests. However, any field with an
  1539. // empty value appearing in NullFields will be sent to the server as
  1540. // null. It is an error if a field in this list has a non-empty value.
  1541. // This may be used to include null fields in Patch requests.
  1542. NullFields []string `json:"-"`
  1543. }
  1544. func (s *PolicyBindings) MarshalJSON() ([]byte, error) {
  1545. type NoMethod PolicyBindings
  1546. raw := NoMethod(*s)
  1547. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1548. }
  1549. // RewriteResponse: A rewrite response.
  1550. type RewriteResponse struct {
  1551. // Done: true if the copy is finished; otherwise, false if the copy is
  1552. // in progress. This property is always present in the response.
  1553. Done bool `json:"done,omitempty"`
  1554. // Kind: The kind of item this is.
  1555. Kind string `json:"kind,omitempty"`
  1556. // ObjectSize: The total size of the object being copied in bytes. This
  1557. // property is always present in the response.
  1558. ObjectSize int64 `json:"objectSize,omitempty,string"`
  1559. // Resource: A resource containing the metadata for the copied-to
  1560. // object. This property is present in the response only when copying
  1561. // completes.
  1562. Resource *Object `json:"resource,omitempty"`
  1563. // RewriteToken: A token to use in subsequent requests to continue
  1564. // copying data. This token is present in the response only when there
  1565. // is more data to copy.
  1566. RewriteToken string `json:"rewriteToken,omitempty"`
  1567. // TotalBytesRewritten: The total bytes written so far, which can be
  1568. // used to provide a waiting user with a progress indicator. This
  1569. // property is always present in the response.
  1570. TotalBytesRewritten int64 `json:"totalBytesRewritten,omitempty,string"`
  1571. // ServerResponse contains the HTTP response code and headers from the
  1572. // server.
  1573. googleapi.ServerResponse `json:"-"`
  1574. // ForceSendFields is a list of field names (e.g. "Done") to
  1575. // unconditionally include in API requests. By default, fields with
  1576. // empty values are omitted from API requests. However, any non-pointer,
  1577. // non-interface field appearing in ForceSendFields will be sent to the
  1578. // server regardless of whether the field is empty or not. This may be
  1579. // used to include empty fields in Patch requests.
  1580. ForceSendFields []string `json:"-"`
  1581. // NullFields is a list of field names (e.g. "Done") to include in API
  1582. // requests with the JSON null value. By default, fields with empty
  1583. // values are omitted from API requests. However, any field with an
  1584. // empty value appearing in NullFields will be sent to the server as
  1585. // null. It is an error if a field in this list has a non-empty value.
  1586. // This may be used to include null fields in Patch requests.
  1587. NullFields []string `json:"-"`
  1588. }
  1589. func (s *RewriteResponse) MarshalJSON() ([]byte, error) {
  1590. type NoMethod RewriteResponse
  1591. raw := NoMethod(*s)
  1592. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1593. }
  1594. // ServiceAccount: A subscription to receive Google PubSub
  1595. // notifications.
  1596. type ServiceAccount struct {
  1597. // EmailAddress: The ID of the notification.
  1598. EmailAddress string `json:"email_address,omitempty"`
  1599. // Kind: The kind of item this is. For notifications, this is always
  1600. // storage#notification.
  1601. Kind string `json:"kind,omitempty"`
  1602. // ServerResponse contains the HTTP response code and headers from the
  1603. // server.
  1604. googleapi.ServerResponse `json:"-"`
  1605. // ForceSendFields is a list of field names (e.g. "EmailAddress") to
  1606. // unconditionally include in API requests. By default, fields with
  1607. // empty values are omitted from API requests. However, any non-pointer,
  1608. // non-interface field appearing in ForceSendFields will be sent to the
  1609. // server regardless of whether the field is empty or not. This may be
  1610. // used to include empty fields in Patch requests.
  1611. ForceSendFields []string `json:"-"`
  1612. // NullFields is a list of field names (e.g. "EmailAddress") to include
  1613. // in API requests with the JSON null value. By default, fields with
  1614. // empty values are omitted from API requests. However, any field with
  1615. // an empty value appearing in NullFields will be sent to the server as
  1616. // null. It is an error if a field in this list has a non-empty value.
  1617. // This may be used to include null fields in Patch requests.
  1618. NullFields []string `json:"-"`
  1619. }
  1620. func (s *ServiceAccount) MarshalJSON() ([]byte, error) {
  1621. type NoMethod ServiceAccount
  1622. raw := NoMethod(*s)
  1623. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1624. }
  1625. // TestIamPermissionsResponse: A
  1626. // storage.(buckets|objects).testIamPermissions response.
  1627. type TestIamPermissionsResponse struct {
  1628. // Kind: The kind of item this is.
  1629. Kind string `json:"kind,omitempty"`
  1630. // Permissions: The permissions held by the caller. Permissions are
  1631. // always of the format storage.resource.capability, where resource is
  1632. // one of buckets or objects. The supported permissions are as follows:
  1633. //
  1634. // - storage.buckets.delete — Delete bucket.
  1635. // - storage.buckets.get — Read bucket metadata.
  1636. // - storage.buckets.getIamPolicy — Read bucket IAM policy.
  1637. // - storage.buckets.create — Create bucket.
  1638. // - storage.buckets.list — List buckets.
  1639. // - storage.buckets.setIamPolicy — Update bucket IAM policy.
  1640. // - storage.buckets.update — Update bucket metadata.
  1641. // - storage.objects.delete — Delete object.
  1642. // - storage.objects.get — Read object data and metadata.
  1643. // - storage.objects.getIamPolicy — Read object IAM policy.
  1644. // - storage.objects.create — Create object.
  1645. // - storage.objects.list — List objects.
  1646. // - storage.objects.setIamPolicy — Update object IAM policy.
  1647. // - storage.objects.update — Update object metadata.
  1648. Permissions []string `json:"permissions,omitempty"`
  1649. // ServerResponse contains the HTTP response code and headers from the
  1650. // server.
  1651. googleapi.ServerResponse `json:"-"`
  1652. // ForceSendFields is a list of field names (e.g. "Kind") to
  1653. // unconditionally include in API requests. By default, fields with
  1654. // empty values are omitted from API requests. However, any non-pointer,
  1655. // non-interface field appearing in ForceSendFields will be sent to the
  1656. // server regardless of whether the field is empty or not. This may be
  1657. // used to include empty fields in Patch requests.
  1658. ForceSendFields []string `json:"-"`
  1659. // NullFields is a list of field names (e.g. "Kind") to include in API
  1660. // requests with the JSON null value. By default, fields with empty
  1661. // values are omitted from API requests. However, any field with an
  1662. // empty value appearing in NullFields will be sent to the server as
  1663. // null. It is an error if a field in this list has a non-empty value.
  1664. // This may be used to include null fields in Patch requests.
  1665. NullFields []string `json:"-"`
  1666. }
  1667. func (s *TestIamPermissionsResponse) MarshalJSON() ([]byte, error) {
  1668. type NoMethod TestIamPermissionsResponse
  1669. raw := NoMethod(*s)
  1670. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1671. }
  1672. // method id "storage.bucketAccessControls.delete":
  1673. type BucketAccessControlsDeleteCall struct {
  1674. s *Service
  1675. bucket string
  1676. entity string
  1677. urlParams_ gensupport.URLParams
  1678. ctx_ context.Context
  1679. header_ http.Header
  1680. }
  1681. // Delete: Permanently deletes the ACL entry for the specified entity on
  1682. // the specified bucket.
  1683. func (r *BucketAccessControlsService) Delete(bucket string, entity string) *BucketAccessControlsDeleteCall {
  1684. c := &BucketAccessControlsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1685. c.bucket = bucket
  1686. c.entity = entity
  1687. return c
  1688. }
  1689. // UserProject sets the optional parameter "userProject": The project to
  1690. // be billed for this request. Required for Requester Pays buckets.
  1691. func (c *BucketAccessControlsDeleteCall) UserProject(userProject string) *BucketAccessControlsDeleteCall {
  1692. c.urlParams_.Set("userProject", userProject)
  1693. return c
  1694. }
  1695. // Fields allows partial responses to be retrieved. See
  1696. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1697. // for more information.
  1698. func (c *BucketAccessControlsDeleteCall) Fields(s ...googleapi.Field) *BucketAccessControlsDeleteCall {
  1699. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1700. return c
  1701. }
  1702. // Context sets the context to be used in this call's Do method. Any
  1703. // pending HTTP request will be aborted if the provided context is
  1704. // canceled.
  1705. func (c *BucketAccessControlsDeleteCall) Context(ctx context.Context) *BucketAccessControlsDeleteCall {
  1706. c.ctx_ = ctx
  1707. return c
  1708. }
  1709. // Header returns an http.Header that can be modified by the caller to
  1710. // add HTTP headers to the request.
  1711. func (c *BucketAccessControlsDeleteCall) Header() http.Header {
  1712. if c.header_ == nil {
  1713. c.header_ = make(http.Header)
  1714. }
  1715. return c.header_
  1716. }
  1717. func (c *BucketAccessControlsDeleteCall) doRequest(alt string) (*http.Response, error) {
  1718. reqHeaders := make(http.Header)
  1719. for k, v := range c.header_ {
  1720. reqHeaders[k] = v
  1721. }
  1722. reqHeaders.Set("User-Agent", c.s.userAgent())
  1723. var body io.Reader = nil
  1724. c.urlParams_.Set("alt", alt)
  1725. c.urlParams_.Set("prettyPrint", "false")
  1726. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/acl/{entity}")
  1727. urls += "?" + c.urlParams_.Encode()
  1728. req, err := http.NewRequest("DELETE", urls, body)
  1729. if err != nil {
  1730. return nil, err
  1731. }
  1732. req.Header = reqHeaders
  1733. googleapi.Expand(req.URL, map[string]string{
  1734. "bucket": c.bucket,
  1735. "entity": c.entity,
  1736. })
  1737. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1738. }
  1739. // Do executes the "storage.bucketAccessControls.delete" call.
  1740. func (c *BucketAccessControlsDeleteCall) Do(opts ...googleapi.CallOption) error {
  1741. gensupport.SetOptions(c.urlParams_, opts...)
  1742. res, err := c.doRequest("json")
  1743. if err != nil {
  1744. return err
  1745. }
  1746. defer googleapi.CloseBody(res)
  1747. if err := googleapi.CheckResponse(res); err != nil {
  1748. return err
  1749. }
  1750. return nil
  1751. // {
  1752. // "description": "Permanently deletes the ACL entry for the specified entity on the specified bucket.",
  1753. // "httpMethod": "DELETE",
  1754. // "id": "storage.bucketAccessControls.delete",
  1755. // "parameterOrder": [
  1756. // "bucket",
  1757. // "entity"
  1758. // ],
  1759. // "parameters": {
  1760. // "bucket": {
  1761. // "description": "Name of a bucket.",
  1762. // "location": "path",
  1763. // "required": true,
  1764. // "type": "string"
  1765. // },
  1766. // "entity": {
  1767. // "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.",
  1768. // "location": "path",
  1769. // "required": true,
  1770. // "type": "string"
  1771. // },
  1772. // "userProject": {
  1773. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  1774. // "location": "query",
  1775. // "type": "string"
  1776. // }
  1777. // },
  1778. // "path": "b/{bucket}/acl/{entity}",
  1779. // "scopes": [
  1780. // "https://www.googleapis.com/auth/cloud-platform",
  1781. // "https://www.googleapis.com/auth/devstorage.full_control"
  1782. // ]
  1783. // }
  1784. }
  1785. // method id "storage.bucketAccessControls.get":
  1786. type BucketAccessControlsGetCall struct {
  1787. s *Service
  1788. bucket string
  1789. entity string
  1790. urlParams_ gensupport.URLParams
  1791. ifNoneMatch_ string
  1792. ctx_ context.Context
  1793. header_ http.Header
  1794. }
  1795. // Get: Returns the ACL entry for the specified entity on the specified
  1796. // bucket.
  1797. func (r *BucketAccessControlsService) Get(bucket string, entity string) *BucketAccessControlsGetCall {
  1798. c := &BucketAccessControlsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1799. c.bucket = bucket
  1800. c.entity = entity
  1801. return c
  1802. }
  1803. // UserProject sets the optional parameter "userProject": The project to
  1804. // be billed for this request. Required for Requester Pays buckets.
  1805. func (c *BucketAccessControlsGetCall) UserProject(userProject string) *BucketAccessControlsGetCall {
  1806. c.urlParams_.Set("userProject", userProject)
  1807. return c
  1808. }
  1809. // Fields allows partial responses to be retrieved. See
  1810. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1811. // for more information.
  1812. func (c *BucketAccessControlsGetCall) Fields(s ...googleapi.Field) *BucketAccessControlsGetCall {
  1813. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1814. return c
  1815. }
  1816. // IfNoneMatch sets the optional parameter which makes the operation
  1817. // fail if the object's ETag matches the given value. This is useful for
  1818. // getting updates only after the object has changed since the last
  1819. // request. Use googleapi.IsNotModified to check whether the response
  1820. // error from Do is the result of In-None-Match.
  1821. func (c *BucketAccessControlsGetCall) IfNoneMatch(entityTag string) *BucketAccessControlsGetCall {
  1822. c.ifNoneMatch_ = entityTag
  1823. return c
  1824. }
  1825. // Context sets the context to be used in this call's Do method. Any
  1826. // pending HTTP request will be aborted if the provided context is
  1827. // canceled.
  1828. func (c *BucketAccessControlsGetCall) Context(ctx context.Context) *BucketAccessControlsGetCall {
  1829. c.ctx_ = ctx
  1830. return c
  1831. }
  1832. // Header returns an http.Header that can be modified by the caller to
  1833. // add HTTP headers to the request.
  1834. func (c *BucketAccessControlsGetCall) Header() http.Header {
  1835. if c.header_ == nil {
  1836. c.header_ = make(http.Header)
  1837. }
  1838. return c.header_
  1839. }
  1840. func (c *BucketAccessControlsGetCall) doRequest(alt string) (*http.Response, error) {
  1841. reqHeaders := make(http.Header)
  1842. for k, v := range c.header_ {
  1843. reqHeaders[k] = v
  1844. }
  1845. reqHeaders.Set("User-Agent", c.s.userAgent())
  1846. if c.ifNoneMatch_ != "" {
  1847. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1848. }
  1849. var body io.Reader = nil
  1850. c.urlParams_.Set("alt", alt)
  1851. c.urlParams_.Set("prettyPrint", "false")
  1852. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/acl/{entity}")
  1853. urls += "?" + c.urlParams_.Encode()
  1854. req, err := http.NewRequest("GET", urls, body)
  1855. if err != nil {
  1856. return nil, err
  1857. }
  1858. req.Header = reqHeaders
  1859. googleapi.Expand(req.URL, map[string]string{
  1860. "bucket": c.bucket,
  1861. "entity": c.entity,
  1862. })
  1863. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1864. }
  1865. // Do executes the "storage.bucketAccessControls.get" call.
  1866. // Exactly one of *BucketAccessControl or error will be non-nil. Any
  1867. // non-2xx status code is an error. Response headers are in either
  1868. // *BucketAccessControl.ServerResponse.Header or (if a response was
  1869. // returned at all) in error.(*googleapi.Error).Header. Use
  1870. // googleapi.IsNotModified to check whether the returned error was
  1871. // because http.StatusNotModified was returned.
  1872. func (c *BucketAccessControlsGetCall) Do(opts ...googleapi.CallOption) (*BucketAccessControl, error) {
  1873. gensupport.SetOptions(c.urlParams_, opts...)
  1874. res, err := c.doRequest("json")
  1875. if res != nil && res.StatusCode == http.StatusNotModified {
  1876. if res.Body != nil {
  1877. res.Body.Close()
  1878. }
  1879. return nil, &googleapi.Error{
  1880. Code: res.StatusCode,
  1881. Header: res.Header,
  1882. }
  1883. }
  1884. if err != nil {
  1885. return nil, err
  1886. }
  1887. defer googleapi.CloseBody(res)
  1888. if err := googleapi.CheckResponse(res); err != nil {
  1889. return nil, err
  1890. }
  1891. ret := &BucketAccessControl{
  1892. ServerResponse: googleapi.ServerResponse{
  1893. Header: res.Header,
  1894. HTTPStatusCode: res.StatusCode,
  1895. },
  1896. }
  1897. target := &ret
  1898. if err := gensupport.DecodeResponse(target, res); err != nil {
  1899. return nil, err
  1900. }
  1901. return ret, nil
  1902. // {
  1903. // "description": "Returns the ACL entry for the specified entity on the specified bucket.",
  1904. // "httpMethod": "GET",
  1905. // "id": "storage.bucketAccessControls.get",
  1906. // "parameterOrder": [
  1907. // "bucket",
  1908. // "entity"
  1909. // ],
  1910. // "parameters": {
  1911. // "bucket": {
  1912. // "description": "Name of a bucket.",
  1913. // "location": "path",
  1914. // "required": true,
  1915. // "type": "string"
  1916. // },
  1917. // "entity": {
  1918. // "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.",
  1919. // "location": "path",
  1920. // "required": true,
  1921. // "type": "string"
  1922. // },
  1923. // "userProject": {
  1924. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  1925. // "location": "query",
  1926. // "type": "string"
  1927. // }
  1928. // },
  1929. // "path": "b/{bucket}/acl/{entity}",
  1930. // "response": {
  1931. // "$ref": "BucketAccessControl"
  1932. // },
  1933. // "scopes": [
  1934. // "https://www.googleapis.com/auth/cloud-platform",
  1935. // "https://www.googleapis.com/auth/devstorage.full_control"
  1936. // ]
  1937. // }
  1938. }
  1939. // method id "storage.bucketAccessControls.insert":
  1940. type BucketAccessControlsInsertCall struct {
  1941. s *Service
  1942. bucket string
  1943. bucketaccesscontrol *BucketAccessControl
  1944. urlParams_ gensupport.URLParams
  1945. ctx_ context.Context
  1946. header_ http.Header
  1947. }
  1948. // Insert: Creates a new ACL entry on the specified bucket.
  1949. func (r *BucketAccessControlsService) Insert(bucket string, bucketaccesscontrol *BucketAccessControl) *BucketAccessControlsInsertCall {
  1950. c := &BucketAccessControlsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1951. c.bucket = bucket
  1952. c.bucketaccesscontrol = bucketaccesscontrol
  1953. return c
  1954. }
  1955. // UserProject sets the optional parameter "userProject": The project to
  1956. // be billed for this request. Required for Requester Pays buckets.
  1957. func (c *BucketAccessControlsInsertCall) UserProject(userProject string) *BucketAccessControlsInsertCall {
  1958. c.urlParams_.Set("userProject", userProject)
  1959. return c
  1960. }
  1961. // Fields allows partial responses to be retrieved. See
  1962. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1963. // for more information.
  1964. func (c *BucketAccessControlsInsertCall) Fields(s ...googleapi.Field) *BucketAccessControlsInsertCall {
  1965. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1966. return c
  1967. }
  1968. // Context sets the context to be used in this call's Do method. Any
  1969. // pending HTTP request will be aborted if the provided context is
  1970. // canceled.
  1971. func (c *BucketAccessControlsInsertCall) Context(ctx context.Context) *BucketAccessControlsInsertCall {
  1972. c.ctx_ = ctx
  1973. return c
  1974. }
  1975. // Header returns an http.Header that can be modified by the caller to
  1976. // add HTTP headers to the request.
  1977. func (c *BucketAccessControlsInsertCall) Header() http.Header {
  1978. if c.header_ == nil {
  1979. c.header_ = make(http.Header)
  1980. }
  1981. return c.header_
  1982. }
  1983. func (c *BucketAccessControlsInsertCall) doRequest(alt string) (*http.Response, error) {
  1984. reqHeaders := make(http.Header)
  1985. for k, v := range c.header_ {
  1986. reqHeaders[k] = v
  1987. }
  1988. reqHeaders.Set("User-Agent", c.s.userAgent())
  1989. var body io.Reader = nil
  1990. body, err := googleapi.WithoutDataWrapper.JSONReader(c.bucketaccesscontrol)
  1991. if err != nil {
  1992. return nil, err
  1993. }
  1994. reqHeaders.Set("Content-Type", "application/json")
  1995. c.urlParams_.Set("alt", alt)
  1996. c.urlParams_.Set("prettyPrint", "false")
  1997. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/acl")
  1998. urls += "?" + c.urlParams_.Encode()
  1999. req, err := http.NewRequest("POST", urls, body)
  2000. if err != nil {
  2001. return nil, err
  2002. }
  2003. req.Header = reqHeaders
  2004. googleapi.Expand(req.URL, map[string]string{
  2005. "bucket": c.bucket,
  2006. })
  2007. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2008. }
  2009. // Do executes the "storage.bucketAccessControls.insert" call.
  2010. // Exactly one of *BucketAccessControl or error will be non-nil. Any
  2011. // non-2xx status code is an error. Response headers are in either
  2012. // *BucketAccessControl.ServerResponse.Header or (if a response was
  2013. // returned at all) in error.(*googleapi.Error).Header. Use
  2014. // googleapi.IsNotModified to check whether the returned error was
  2015. // because http.StatusNotModified was returned.
  2016. func (c *BucketAccessControlsInsertCall) Do(opts ...googleapi.CallOption) (*BucketAccessControl, error) {
  2017. gensupport.SetOptions(c.urlParams_, opts...)
  2018. res, err := c.doRequest("json")
  2019. if res != nil && res.StatusCode == http.StatusNotModified {
  2020. if res.Body != nil {
  2021. res.Body.Close()
  2022. }
  2023. return nil, &googleapi.Error{
  2024. Code: res.StatusCode,
  2025. Header: res.Header,
  2026. }
  2027. }
  2028. if err != nil {
  2029. return nil, err
  2030. }
  2031. defer googleapi.CloseBody(res)
  2032. if err := googleapi.CheckResponse(res); err != nil {
  2033. return nil, err
  2034. }
  2035. ret := &BucketAccessControl{
  2036. ServerResponse: googleapi.ServerResponse{
  2037. Header: res.Header,
  2038. HTTPStatusCode: res.StatusCode,
  2039. },
  2040. }
  2041. target := &ret
  2042. if err := gensupport.DecodeResponse(target, res); err != nil {
  2043. return nil, err
  2044. }
  2045. return ret, nil
  2046. // {
  2047. // "description": "Creates a new ACL entry on the specified bucket.",
  2048. // "httpMethod": "POST",
  2049. // "id": "storage.bucketAccessControls.insert",
  2050. // "parameterOrder": [
  2051. // "bucket"
  2052. // ],
  2053. // "parameters": {
  2054. // "bucket": {
  2055. // "description": "Name of a bucket.",
  2056. // "location": "path",
  2057. // "required": true,
  2058. // "type": "string"
  2059. // },
  2060. // "userProject": {
  2061. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  2062. // "location": "query",
  2063. // "type": "string"
  2064. // }
  2065. // },
  2066. // "path": "b/{bucket}/acl",
  2067. // "request": {
  2068. // "$ref": "BucketAccessControl"
  2069. // },
  2070. // "response": {
  2071. // "$ref": "BucketAccessControl"
  2072. // },
  2073. // "scopes": [
  2074. // "https://www.googleapis.com/auth/cloud-platform",
  2075. // "https://www.googleapis.com/auth/devstorage.full_control"
  2076. // ]
  2077. // }
  2078. }
  2079. // method id "storage.bucketAccessControls.list":
  2080. type BucketAccessControlsListCall struct {
  2081. s *Service
  2082. bucket string
  2083. urlParams_ gensupport.URLParams
  2084. ifNoneMatch_ string
  2085. ctx_ context.Context
  2086. header_ http.Header
  2087. }
  2088. // List: Retrieves ACL entries on the specified bucket.
  2089. func (r *BucketAccessControlsService) List(bucket string) *BucketAccessControlsListCall {
  2090. c := &BucketAccessControlsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2091. c.bucket = bucket
  2092. return c
  2093. }
  2094. // UserProject sets the optional parameter "userProject": The project to
  2095. // be billed for this request. Required for Requester Pays buckets.
  2096. func (c *BucketAccessControlsListCall) UserProject(userProject string) *BucketAccessControlsListCall {
  2097. c.urlParams_.Set("userProject", userProject)
  2098. return c
  2099. }
  2100. // Fields allows partial responses to be retrieved. See
  2101. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2102. // for more information.
  2103. func (c *BucketAccessControlsListCall) Fields(s ...googleapi.Field) *BucketAccessControlsListCall {
  2104. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2105. return c
  2106. }
  2107. // IfNoneMatch sets the optional parameter which makes the operation
  2108. // fail if the object's ETag matches the given value. This is useful for
  2109. // getting updates only after the object has changed since the last
  2110. // request. Use googleapi.IsNotModified to check whether the response
  2111. // error from Do is the result of In-None-Match.
  2112. func (c *BucketAccessControlsListCall) IfNoneMatch(entityTag string) *BucketAccessControlsListCall {
  2113. c.ifNoneMatch_ = entityTag
  2114. return c
  2115. }
  2116. // Context sets the context to be used in this call's Do method. Any
  2117. // pending HTTP request will be aborted if the provided context is
  2118. // canceled.
  2119. func (c *BucketAccessControlsListCall) Context(ctx context.Context) *BucketAccessControlsListCall {
  2120. c.ctx_ = ctx
  2121. return c
  2122. }
  2123. // Header returns an http.Header that can be modified by the caller to
  2124. // add HTTP headers to the request.
  2125. func (c *BucketAccessControlsListCall) Header() http.Header {
  2126. if c.header_ == nil {
  2127. c.header_ = make(http.Header)
  2128. }
  2129. return c.header_
  2130. }
  2131. func (c *BucketAccessControlsListCall) doRequest(alt string) (*http.Response, error) {
  2132. reqHeaders := make(http.Header)
  2133. for k, v := range c.header_ {
  2134. reqHeaders[k] = v
  2135. }
  2136. reqHeaders.Set("User-Agent", c.s.userAgent())
  2137. if c.ifNoneMatch_ != "" {
  2138. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2139. }
  2140. var body io.Reader = nil
  2141. c.urlParams_.Set("alt", alt)
  2142. c.urlParams_.Set("prettyPrint", "false")
  2143. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/acl")
  2144. urls += "?" + c.urlParams_.Encode()
  2145. req, err := http.NewRequest("GET", urls, body)
  2146. if err != nil {
  2147. return nil, err
  2148. }
  2149. req.Header = reqHeaders
  2150. googleapi.Expand(req.URL, map[string]string{
  2151. "bucket": c.bucket,
  2152. })
  2153. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2154. }
  2155. // Do executes the "storage.bucketAccessControls.list" call.
  2156. // Exactly one of *BucketAccessControls or error will be non-nil. Any
  2157. // non-2xx status code is an error. Response headers are in either
  2158. // *BucketAccessControls.ServerResponse.Header or (if a response was
  2159. // returned at all) in error.(*googleapi.Error).Header. Use
  2160. // googleapi.IsNotModified to check whether the returned error was
  2161. // because http.StatusNotModified was returned.
  2162. func (c *BucketAccessControlsListCall) Do(opts ...googleapi.CallOption) (*BucketAccessControls, error) {
  2163. gensupport.SetOptions(c.urlParams_, opts...)
  2164. res, err := c.doRequest("json")
  2165. if res != nil && res.StatusCode == http.StatusNotModified {
  2166. if res.Body != nil {
  2167. res.Body.Close()
  2168. }
  2169. return nil, &googleapi.Error{
  2170. Code: res.StatusCode,
  2171. Header: res.Header,
  2172. }
  2173. }
  2174. if err != nil {
  2175. return nil, err
  2176. }
  2177. defer googleapi.CloseBody(res)
  2178. if err := googleapi.CheckResponse(res); err != nil {
  2179. return nil, err
  2180. }
  2181. ret := &BucketAccessControls{
  2182. ServerResponse: googleapi.ServerResponse{
  2183. Header: res.Header,
  2184. HTTPStatusCode: res.StatusCode,
  2185. },
  2186. }
  2187. target := &ret
  2188. if err := gensupport.DecodeResponse(target, res); err != nil {
  2189. return nil, err
  2190. }
  2191. return ret, nil
  2192. // {
  2193. // "description": "Retrieves ACL entries on the specified bucket.",
  2194. // "httpMethod": "GET",
  2195. // "id": "storage.bucketAccessControls.list",
  2196. // "parameterOrder": [
  2197. // "bucket"
  2198. // ],
  2199. // "parameters": {
  2200. // "bucket": {
  2201. // "description": "Name of a bucket.",
  2202. // "location": "path",
  2203. // "required": true,
  2204. // "type": "string"
  2205. // },
  2206. // "userProject": {
  2207. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  2208. // "location": "query",
  2209. // "type": "string"
  2210. // }
  2211. // },
  2212. // "path": "b/{bucket}/acl",
  2213. // "response": {
  2214. // "$ref": "BucketAccessControls"
  2215. // },
  2216. // "scopes": [
  2217. // "https://www.googleapis.com/auth/cloud-platform",
  2218. // "https://www.googleapis.com/auth/devstorage.full_control"
  2219. // ]
  2220. // }
  2221. }
  2222. // method id "storage.bucketAccessControls.patch":
  2223. type BucketAccessControlsPatchCall struct {
  2224. s *Service
  2225. bucket string
  2226. entity string
  2227. bucketaccesscontrol *BucketAccessControl
  2228. urlParams_ gensupport.URLParams
  2229. ctx_ context.Context
  2230. header_ http.Header
  2231. }
  2232. // Patch: Patches an ACL entry on the specified bucket.
  2233. func (r *BucketAccessControlsService) Patch(bucket string, entity string, bucketaccesscontrol *BucketAccessControl) *BucketAccessControlsPatchCall {
  2234. c := &BucketAccessControlsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2235. c.bucket = bucket
  2236. c.entity = entity
  2237. c.bucketaccesscontrol = bucketaccesscontrol
  2238. return c
  2239. }
  2240. // UserProject sets the optional parameter "userProject": The project to
  2241. // be billed for this request. Required for Requester Pays buckets.
  2242. func (c *BucketAccessControlsPatchCall) UserProject(userProject string) *BucketAccessControlsPatchCall {
  2243. c.urlParams_.Set("userProject", userProject)
  2244. return c
  2245. }
  2246. // Fields allows partial responses to be retrieved. See
  2247. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2248. // for more information.
  2249. func (c *BucketAccessControlsPatchCall) Fields(s ...googleapi.Field) *BucketAccessControlsPatchCall {
  2250. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2251. return c
  2252. }
  2253. // Context sets the context to be used in this call's Do method. Any
  2254. // pending HTTP request will be aborted if the provided context is
  2255. // canceled.
  2256. func (c *BucketAccessControlsPatchCall) Context(ctx context.Context) *BucketAccessControlsPatchCall {
  2257. c.ctx_ = ctx
  2258. return c
  2259. }
  2260. // Header returns an http.Header that can be modified by the caller to
  2261. // add HTTP headers to the request.
  2262. func (c *BucketAccessControlsPatchCall) Header() http.Header {
  2263. if c.header_ == nil {
  2264. c.header_ = make(http.Header)
  2265. }
  2266. return c.header_
  2267. }
  2268. func (c *BucketAccessControlsPatchCall) doRequest(alt string) (*http.Response, error) {
  2269. reqHeaders := make(http.Header)
  2270. for k, v := range c.header_ {
  2271. reqHeaders[k] = v
  2272. }
  2273. reqHeaders.Set("User-Agent", c.s.userAgent())
  2274. var body io.Reader = nil
  2275. body, err := googleapi.WithoutDataWrapper.JSONReader(c.bucketaccesscontrol)
  2276. if err != nil {
  2277. return nil, err
  2278. }
  2279. reqHeaders.Set("Content-Type", "application/json")
  2280. c.urlParams_.Set("alt", alt)
  2281. c.urlParams_.Set("prettyPrint", "false")
  2282. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/acl/{entity}")
  2283. urls += "?" + c.urlParams_.Encode()
  2284. req, err := http.NewRequest("PATCH", urls, body)
  2285. if err != nil {
  2286. return nil, err
  2287. }
  2288. req.Header = reqHeaders
  2289. googleapi.Expand(req.URL, map[string]string{
  2290. "bucket": c.bucket,
  2291. "entity": c.entity,
  2292. })
  2293. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2294. }
  2295. // Do executes the "storage.bucketAccessControls.patch" call.
  2296. // Exactly one of *BucketAccessControl or error will be non-nil. Any
  2297. // non-2xx status code is an error. Response headers are in either
  2298. // *BucketAccessControl.ServerResponse.Header or (if a response was
  2299. // returned at all) in error.(*googleapi.Error).Header. Use
  2300. // googleapi.IsNotModified to check whether the returned error was
  2301. // because http.StatusNotModified was returned.
  2302. func (c *BucketAccessControlsPatchCall) Do(opts ...googleapi.CallOption) (*BucketAccessControl, error) {
  2303. gensupport.SetOptions(c.urlParams_, opts...)
  2304. res, err := c.doRequest("json")
  2305. if res != nil && res.StatusCode == http.StatusNotModified {
  2306. if res.Body != nil {
  2307. res.Body.Close()
  2308. }
  2309. return nil, &googleapi.Error{
  2310. Code: res.StatusCode,
  2311. Header: res.Header,
  2312. }
  2313. }
  2314. if err != nil {
  2315. return nil, err
  2316. }
  2317. defer googleapi.CloseBody(res)
  2318. if err := googleapi.CheckResponse(res); err != nil {
  2319. return nil, err
  2320. }
  2321. ret := &BucketAccessControl{
  2322. ServerResponse: googleapi.ServerResponse{
  2323. Header: res.Header,
  2324. HTTPStatusCode: res.StatusCode,
  2325. },
  2326. }
  2327. target := &ret
  2328. if err := gensupport.DecodeResponse(target, res); err != nil {
  2329. return nil, err
  2330. }
  2331. return ret, nil
  2332. // {
  2333. // "description": "Patches an ACL entry on the specified bucket.",
  2334. // "httpMethod": "PATCH",
  2335. // "id": "storage.bucketAccessControls.patch",
  2336. // "parameterOrder": [
  2337. // "bucket",
  2338. // "entity"
  2339. // ],
  2340. // "parameters": {
  2341. // "bucket": {
  2342. // "description": "Name of a bucket.",
  2343. // "location": "path",
  2344. // "required": true,
  2345. // "type": "string"
  2346. // },
  2347. // "entity": {
  2348. // "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.",
  2349. // "location": "path",
  2350. // "required": true,
  2351. // "type": "string"
  2352. // },
  2353. // "userProject": {
  2354. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  2355. // "location": "query",
  2356. // "type": "string"
  2357. // }
  2358. // },
  2359. // "path": "b/{bucket}/acl/{entity}",
  2360. // "request": {
  2361. // "$ref": "BucketAccessControl"
  2362. // },
  2363. // "response": {
  2364. // "$ref": "BucketAccessControl"
  2365. // },
  2366. // "scopes": [
  2367. // "https://www.googleapis.com/auth/cloud-platform",
  2368. // "https://www.googleapis.com/auth/devstorage.full_control"
  2369. // ]
  2370. // }
  2371. }
  2372. // method id "storage.bucketAccessControls.update":
  2373. type BucketAccessControlsUpdateCall struct {
  2374. s *Service
  2375. bucket string
  2376. entity string
  2377. bucketaccesscontrol *BucketAccessControl
  2378. urlParams_ gensupport.URLParams
  2379. ctx_ context.Context
  2380. header_ http.Header
  2381. }
  2382. // Update: Updates an ACL entry on the specified bucket.
  2383. func (r *BucketAccessControlsService) Update(bucket string, entity string, bucketaccesscontrol *BucketAccessControl) *BucketAccessControlsUpdateCall {
  2384. c := &BucketAccessControlsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2385. c.bucket = bucket
  2386. c.entity = entity
  2387. c.bucketaccesscontrol = bucketaccesscontrol
  2388. return c
  2389. }
  2390. // UserProject sets the optional parameter "userProject": The project to
  2391. // be billed for this request. Required for Requester Pays buckets.
  2392. func (c *BucketAccessControlsUpdateCall) UserProject(userProject string) *BucketAccessControlsUpdateCall {
  2393. c.urlParams_.Set("userProject", userProject)
  2394. return c
  2395. }
  2396. // Fields allows partial responses to be retrieved. See
  2397. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2398. // for more information.
  2399. func (c *BucketAccessControlsUpdateCall) Fields(s ...googleapi.Field) *BucketAccessControlsUpdateCall {
  2400. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2401. return c
  2402. }
  2403. // Context sets the context to be used in this call's Do method. Any
  2404. // pending HTTP request will be aborted if the provided context is
  2405. // canceled.
  2406. func (c *BucketAccessControlsUpdateCall) Context(ctx context.Context) *BucketAccessControlsUpdateCall {
  2407. c.ctx_ = ctx
  2408. return c
  2409. }
  2410. // Header returns an http.Header that can be modified by the caller to
  2411. // add HTTP headers to the request.
  2412. func (c *BucketAccessControlsUpdateCall) Header() http.Header {
  2413. if c.header_ == nil {
  2414. c.header_ = make(http.Header)
  2415. }
  2416. return c.header_
  2417. }
  2418. func (c *BucketAccessControlsUpdateCall) doRequest(alt string) (*http.Response, error) {
  2419. reqHeaders := make(http.Header)
  2420. for k, v := range c.header_ {
  2421. reqHeaders[k] = v
  2422. }
  2423. reqHeaders.Set("User-Agent", c.s.userAgent())
  2424. var body io.Reader = nil
  2425. body, err := googleapi.WithoutDataWrapper.JSONReader(c.bucketaccesscontrol)
  2426. if err != nil {
  2427. return nil, err
  2428. }
  2429. reqHeaders.Set("Content-Type", "application/json")
  2430. c.urlParams_.Set("alt", alt)
  2431. c.urlParams_.Set("prettyPrint", "false")
  2432. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/acl/{entity}")
  2433. urls += "?" + c.urlParams_.Encode()
  2434. req, err := http.NewRequest("PUT", urls, body)
  2435. if err != nil {
  2436. return nil, err
  2437. }
  2438. req.Header = reqHeaders
  2439. googleapi.Expand(req.URL, map[string]string{
  2440. "bucket": c.bucket,
  2441. "entity": c.entity,
  2442. })
  2443. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2444. }
  2445. // Do executes the "storage.bucketAccessControls.update" call.
  2446. // Exactly one of *BucketAccessControl or error will be non-nil. Any
  2447. // non-2xx status code is an error. Response headers are in either
  2448. // *BucketAccessControl.ServerResponse.Header or (if a response was
  2449. // returned at all) in error.(*googleapi.Error).Header. Use
  2450. // googleapi.IsNotModified to check whether the returned error was
  2451. // because http.StatusNotModified was returned.
  2452. func (c *BucketAccessControlsUpdateCall) Do(opts ...googleapi.CallOption) (*BucketAccessControl, error) {
  2453. gensupport.SetOptions(c.urlParams_, opts...)
  2454. res, err := c.doRequest("json")
  2455. if res != nil && res.StatusCode == http.StatusNotModified {
  2456. if res.Body != nil {
  2457. res.Body.Close()
  2458. }
  2459. return nil, &googleapi.Error{
  2460. Code: res.StatusCode,
  2461. Header: res.Header,
  2462. }
  2463. }
  2464. if err != nil {
  2465. return nil, err
  2466. }
  2467. defer googleapi.CloseBody(res)
  2468. if err := googleapi.CheckResponse(res); err != nil {
  2469. return nil, err
  2470. }
  2471. ret := &BucketAccessControl{
  2472. ServerResponse: googleapi.ServerResponse{
  2473. Header: res.Header,
  2474. HTTPStatusCode: res.StatusCode,
  2475. },
  2476. }
  2477. target := &ret
  2478. if err := gensupport.DecodeResponse(target, res); err != nil {
  2479. return nil, err
  2480. }
  2481. return ret, nil
  2482. // {
  2483. // "description": "Updates an ACL entry on the specified bucket.",
  2484. // "httpMethod": "PUT",
  2485. // "id": "storage.bucketAccessControls.update",
  2486. // "parameterOrder": [
  2487. // "bucket",
  2488. // "entity"
  2489. // ],
  2490. // "parameters": {
  2491. // "bucket": {
  2492. // "description": "Name of a bucket.",
  2493. // "location": "path",
  2494. // "required": true,
  2495. // "type": "string"
  2496. // },
  2497. // "entity": {
  2498. // "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.",
  2499. // "location": "path",
  2500. // "required": true,
  2501. // "type": "string"
  2502. // },
  2503. // "userProject": {
  2504. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  2505. // "location": "query",
  2506. // "type": "string"
  2507. // }
  2508. // },
  2509. // "path": "b/{bucket}/acl/{entity}",
  2510. // "request": {
  2511. // "$ref": "BucketAccessControl"
  2512. // },
  2513. // "response": {
  2514. // "$ref": "BucketAccessControl"
  2515. // },
  2516. // "scopes": [
  2517. // "https://www.googleapis.com/auth/cloud-platform",
  2518. // "https://www.googleapis.com/auth/devstorage.full_control"
  2519. // ]
  2520. // }
  2521. }
  2522. // method id "storage.buckets.delete":
  2523. type BucketsDeleteCall struct {
  2524. s *Service
  2525. bucket string
  2526. urlParams_ gensupport.URLParams
  2527. ctx_ context.Context
  2528. header_ http.Header
  2529. }
  2530. // Delete: Permanently deletes an empty bucket.
  2531. func (r *BucketsService) Delete(bucket string) *BucketsDeleteCall {
  2532. c := &BucketsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2533. c.bucket = bucket
  2534. return c
  2535. }
  2536. // IfMetagenerationMatch sets the optional parameter
  2537. // "ifMetagenerationMatch": If set, only deletes the bucket if its
  2538. // metageneration matches this value.
  2539. func (c *BucketsDeleteCall) IfMetagenerationMatch(ifMetagenerationMatch int64) *BucketsDeleteCall {
  2540. c.urlParams_.Set("ifMetagenerationMatch", fmt.Sprint(ifMetagenerationMatch))
  2541. return c
  2542. }
  2543. // IfMetagenerationNotMatch sets the optional parameter
  2544. // "ifMetagenerationNotMatch": If set, only deletes the bucket if its
  2545. // metageneration does not match this value.
  2546. func (c *BucketsDeleteCall) IfMetagenerationNotMatch(ifMetagenerationNotMatch int64) *BucketsDeleteCall {
  2547. c.urlParams_.Set("ifMetagenerationNotMatch", fmt.Sprint(ifMetagenerationNotMatch))
  2548. return c
  2549. }
  2550. // UserProject sets the optional parameter "userProject": The project to
  2551. // be billed for this request. Required for Requester Pays buckets.
  2552. func (c *BucketsDeleteCall) UserProject(userProject string) *BucketsDeleteCall {
  2553. c.urlParams_.Set("userProject", userProject)
  2554. return c
  2555. }
  2556. // Fields allows partial responses to be retrieved. See
  2557. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2558. // for more information.
  2559. func (c *BucketsDeleteCall) Fields(s ...googleapi.Field) *BucketsDeleteCall {
  2560. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2561. return c
  2562. }
  2563. // Context sets the context to be used in this call's Do method. Any
  2564. // pending HTTP request will be aborted if the provided context is
  2565. // canceled.
  2566. func (c *BucketsDeleteCall) Context(ctx context.Context) *BucketsDeleteCall {
  2567. c.ctx_ = ctx
  2568. return c
  2569. }
  2570. // Header returns an http.Header that can be modified by the caller to
  2571. // add HTTP headers to the request.
  2572. func (c *BucketsDeleteCall) Header() http.Header {
  2573. if c.header_ == nil {
  2574. c.header_ = make(http.Header)
  2575. }
  2576. return c.header_
  2577. }
  2578. func (c *BucketsDeleteCall) doRequest(alt string) (*http.Response, error) {
  2579. reqHeaders := make(http.Header)
  2580. for k, v := range c.header_ {
  2581. reqHeaders[k] = v
  2582. }
  2583. reqHeaders.Set("User-Agent", c.s.userAgent())
  2584. var body io.Reader = nil
  2585. c.urlParams_.Set("alt", alt)
  2586. c.urlParams_.Set("prettyPrint", "false")
  2587. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}")
  2588. urls += "?" + c.urlParams_.Encode()
  2589. req, err := http.NewRequest("DELETE", urls, body)
  2590. if err != nil {
  2591. return nil, err
  2592. }
  2593. req.Header = reqHeaders
  2594. googleapi.Expand(req.URL, map[string]string{
  2595. "bucket": c.bucket,
  2596. })
  2597. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2598. }
  2599. // Do executes the "storage.buckets.delete" call.
  2600. func (c *BucketsDeleteCall) Do(opts ...googleapi.CallOption) error {
  2601. gensupport.SetOptions(c.urlParams_, opts...)
  2602. res, err := c.doRequest("json")
  2603. if err != nil {
  2604. return err
  2605. }
  2606. defer googleapi.CloseBody(res)
  2607. if err := googleapi.CheckResponse(res); err != nil {
  2608. return err
  2609. }
  2610. return nil
  2611. // {
  2612. // "description": "Permanently deletes an empty bucket.",
  2613. // "httpMethod": "DELETE",
  2614. // "id": "storage.buckets.delete",
  2615. // "parameterOrder": [
  2616. // "bucket"
  2617. // ],
  2618. // "parameters": {
  2619. // "bucket": {
  2620. // "description": "Name of a bucket.",
  2621. // "location": "path",
  2622. // "required": true,
  2623. // "type": "string"
  2624. // },
  2625. // "ifMetagenerationMatch": {
  2626. // "description": "If set, only deletes the bucket if its metageneration matches this value.",
  2627. // "format": "int64",
  2628. // "location": "query",
  2629. // "type": "string"
  2630. // },
  2631. // "ifMetagenerationNotMatch": {
  2632. // "description": "If set, only deletes the bucket if its metageneration does not match this value.",
  2633. // "format": "int64",
  2634. // "location": "query",
  2635. // "type": "string"
  2636. // },
  2637. // "userProject": {
  2638. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  2639. // "location": "query",
  2640. // "type": "string"
  2641. // }
  2642. // },
  2643. // "path": "b/{bucket}",
  2644. // "scopes": [
  2645. // "https://www.googleapis.com/auth/cloud-platform",
  2646. // "https://www.googleapis.com/auth/devstorage.full_control",
  2647. // "https://www.googleapis.com/auth/devstorage.read_write"
  2648. // ]
  2649. // }
  2650. }
  2651. // method id "storage.buckets.get":
  2652. type BucketsGetCall struct {
  2653. s *Service
  2654. bucket string
  2655. urlParams_ gensupport.URLParams
  2656. ifNoneMatch_ string
  2657. ctx_ context.Context
  2658. header_ http.Header
  2659. }
  2660. // Get: Returns metadata for the specified bucket.
  2661. func (r *BucketsService) Get(bucket string) *BucketsGetCall {
  2662. c := &BucketsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2663. c.bucket = bucket
  2664. return c
  2665. }
  2666. // IfMetagenerationMatch sets the optional parameter
  2667. // "ifMetagenerationMatch": Makes the return of the bucket metadata
  2668. // conditional on whether the bucket's current metageneration matches
  2669. // the given value.
  2670. func (c *BucketsGetCall) IfMetagenerationMatch(ifMetagenerationMatch int64) *BucketsGetCall {
  2671. c.urlParams_.Set("ifMetagenerationMatch", fmt.Sprint(ifMetagenerationMatch))
  2672. return c
  2673. }
  2674. // IfMetagenerationNotMatch sets the optional parameter
  2675. // "ifMetagenerationNotMatch": Makes the return of the bucket metadata
  2676. // conditional on whether the bucket's current metageneration does not
  2677. // match the given value.
  2678. func (c *BucketsGetCall) IfMetagenerationNotMatch(ifMetagenerationNotMatch int64) *BucketsGetCall {
  2679. c.urlParams_.Set("ifMetagenerationNotMatch", fmt.Sprint(ifMetagenerationNotMatch))
  2680. return c
  2681. }
  2682. // Projection sets the optional parameter "projection": Set of
  2683. // properties to return. Defaults to noAcl.
  2684. //
  2685. // Possible values:
  2686. // "full" - Include all properties.
  2687. // "noAcl" - Omit owner, acl and defaultObjectAcl properties.
  2688. func (c *BucketsGetCall) Projection(projection string) *BucketsGetCall {
  2689. c.urlParams_.Set("projection", projection)
  2690. return c
  2691. }
  2692. // UserProject sets the optional parameter "userProject": The project to
  2693. // be billed for this request. Required for Requester Pays buckets.
  2694. func (c *BucketsGetCall) UserProject(userProject string) *BucketsGetCall {
  2695. c.urlParams_.Set("userProject", userProject)
  2696. return c
  2697. }
  2698. // Fields allows partial responses to be retrieved. See
  2699. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2700. // for more information.
  2701. func (c *BucketsGetCall) Fields(s ...googleapi.Field) *BucketsGetCall {
  2702. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2703. return c
  2704. }
  2705. // IfNoneMatch sets the optional parameter which makes the operation
  2706. // fail if the object's ETag matches the given value. This is useful for
  2707. // getting updates only after the object has changed since the last
  2708. // request. Use googleapi.IsNotModified to check whether the response
  2709. // error from Do is the result of In-None-Match.
  2710. func (c *BucketsGetCall) IfNoneMatch(entityTag string) *BucketsGetCall {
  2711. c.ifNoneMatch_ = entityTag
  2712. return c
  2713. }
  2714. // Context sets the context to be used in this call's Do method. Any
  2715. // pending HTTP request will be aborted if the provided context is
  2716. // canceled.
  2717. func (c *BucketsGetCall) Context(ctx context.Context) *BucketsGetCall {
  2718. c.ctx_ = ctx
  2719. return c
  2720. }
  2721. // Header returns an http.Header that can be modified by the caller to
  2722. // add HTTP headers to the request.
  2723. func (c *BucketsGetCall) Header() http.Header {
  2724. if c.header_ == nil {
  2725. c.header_ = make(http.Header)
  2726. }
  2727. return c.header_
  2728. }
  2729. func (c *BucketsGetCall) doRequest(alt string) (*http.Response, error) {
  2730. reqHeaders := make(http.Header)
  2731. for k, v := range c.header_ {
  2732. reqHeaders[k] = v
  2733. }
  2734. reqHeaders.Set("User-Agent", c.s.userAgent())
  2735. if c.ifNoneMatch_ != "" {
  2736. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2737. }
  2738. var body io.Reader = nil
  2739. c.urlParams_.Set("alt", alt)
  2740. c.urlParams_.Set("prettyPrint", "false")
  2741. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}")
  2742. urls += "?" + c.urlParams_.Encode()
  2743. req, err := http.NewRequest("GET", urls, body)
  2744. if err != nil {
  2745. return nil, err
  2746. }
  2747. req.Header = reqHeaders
  2748. googleapi.Expand(req.URL, map[string]string{
  2749. "bucket": c.bucket,
  2750. })
  2751. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2752. }
  2753. // Do executes the "storage.buckets.get" call.
  2754. // Exactly one of *Bucket or error will be non-nil. Any non-2xx status
  2755. // code is an error. Response headers are in either
  2756. // *Bucket.ServerResponse.Header or (if a response was returned at all)
  2757. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2758. // check whether the returned error was because http.StatusNotModified
  2759. // was returned.
  2760. func (c *BucketsGetCall) Do(opts ...googleapi.CallOption) (*Bucket, error) {
  2761. gensupport.SetOptions(c.urlParams_, opts...)
  2762. res, err := c.doRequest("json")
  2763. if res != nil && res.StatusCode == http.StatusNotModified {
  2764. if res.Body != nil {
  2765. res.Body.Close()
  2766. }
  2767. return nil, &googleapi.Error{
  2768. Code: res.StatusCode,
  2769. Header: res.Header,
  2770. }
  2771. }
  2772. if err != nil {
  2773. return nil, err
  2774. }
  2775. defer googleapi.CloseBody(res)
  2776. if err := googleapi.CheckResponse(res); err != nil {
  2777. return nil, err
  2778. }
  2779. ret := &Bucket{
  2780. ServerResponse: googleapi.ServerResponse{
  2781. Header: res.Header,
  2782. HTTPStatusCode: res.StatusCode,
  2783. },
  2784. }
  2785. target := &ret
  2786. if err := gensupport.DecodeResponse(target, res); err != nil {
  2787. return nil, err
  2788. }
  2789. return ret, nil
  2790. // {
  2791. // "description": "Returns metadata for the specified bucket.",
  2792. // "httpMethod": "GET",
  2793. // "id": "storage.buckets.get",
  2794. // "parameterOrder": [
  2795. // "bucket"
  2796. // ],
  2797. // "parameters": {
  2798. // "bucket": {
  2799. // "description": "Name of a bucket.",
  2800. // "location": "path",
  2801. // "required": true,
  2802. // "type": "string"
  2803. // },
  2804. // "ifMetagenerationMatch": {
  2805. // "description": "Makes the return of the bucket metadata conditional on whether the bucket's current metageneration matches the given value.",
  2806. // "format": "int64",
  2807. // "location": "query",
  2808. // "type": "string"
  2809. // },
  2810. // "ifMetagenerationNotMatch": {
  2811. // "description": "Makes the return of the bucket metadata conditional on whether the bucket's current metageneration does not match the given value.",
  2812. // "format": "int64",
  2813. // "location": "query",
  2814. // "type": "string"
  2815. // },
  2816. // "projection": {
  2817. // "description": "Set of properties to return. Defaults to noAcl.",
  2818. // "enum": [
  2819. // "full",
  2820. // "noAcl"
  2821. // ],
  2822. // "enumDescriptions": [
  2823. // "Include all properties.",
  2824. // "Omit owner, acl and defaultObjectAcl properties."
  2825. // ],
  2826. // "location": "query",
  2827. // "type": "string"
  2828. // },
  2829. // "userProject": {
  2830. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  2831. // "location": "query",
  2832. // "type": "string"
  2833. // }
  2834. // },
  2835. // "path": "b/{bucket}",
  2836. // "response": {
  2837. // "$ref": "Bucket"
  2838. // },
  2839. // "scopes": [
  2840. // "https://www.googleapis.com/auth/cloud-platform",
  2841. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  2842. // "https://www.googleapis.com/auth/devstorage.full_control",
  2843. // "https://www.googleapis.com/auth/devstorage.read_only",
  2844. // "https://www.googleapis.com/auth/devstorage.read_write"
  2845. // ]
  2846. // }
  2847. }
  2848. // method id "storage.buckets.getIamPolicy":
  2849. type BucketsGetIamPolicyCall struct {
  2850. s *Service
  2851. bucket string
  2852. urlParams_ gensupport.URLParams
  2853. ifNoneMatch_ string
  2854. ctx_ context.Context
  2855. header_ http.Header
  2856. }
  2857. // GetIamPolicy: Returns an IAM policy for the specified bucket.
  2858. func (r *BucketsService) GetIamPolicy(bucket string) *BucketsGetIamPolicyCall {
  2859. c := &BucketsGetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2860. c.bucket = bucket
  2861. return c
  2862. }
  2863. // UserProject sets the optional parameter "userProject": The project to
  2864. // be billed for this request. Required for Requester Pays buckets.
  2865. func (c *BucketsGetIamPolicyCall) UserProject(userProject string) *BucketsGetIamPolicyCall {
  2866. c.urlParams_.Set("userProject", userProject)
  2867. return c
  2868. }
  2869. // Fields allows partial responses to be retrieved. See
  2870. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2871. // for more information.
  2872. func (c *BucketsGetIamPolicyCall) Fields(s ...googleapi.Field) *BucketsGetIamPolicyCall {
  2873. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2874. return c
  2875. }
  2876. // IfNoneMatch sets the optional parameter which makes the operation
  2877. // fail if the object's ETag matches the given value. This is useful for
  2878. // getting updates only after the object has changed since the last
  2879. // request. Use googleapi.IsNotModified to check whether the response
  2880. // error from Do is the result of In-None-Match.
  2881. func (c *BucketsGetIamPolicyCall) IfNoneMatch(entityTag string) *BucketsGetIamPolicyCall {
  2882. c.ifNoneMatch_ = entityTag
  2883. return c
  2884. }
  2885. // Context sets the context to be used in this call's Do method. Any
  2886. // pending HTTP request will be aborted if the provided context is
  2887. // canceled.
  2888. func (c *BucketsGetIamPolicyCall) Context(ctx context.Context) *BucketsGetIamPolicyCall {
  2889. c.ctx_ = ctx
  2890. return c
  2891. }
  2892. // Header returns an http.Header that can be modified by the caller to
  2893. // add HTTP headers to the request.
  2894. func (c *BucketsGetIamPolicyCall) Header() http.Header {
  2895. if c.header_ == nil {
  2896. c.header_ = make(http.Header)
  2897. }
  2898. return c.header_
  2899. }
  2900. func (c *BucketsGetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
  2901. reqHeaders := make(http.Header)
  2902. for k, v := range c.header_ {
  2903. reqHeaders[k] = v
  2904. }
  2905. reqHeaders.Set("User-Agent", c.s.userAgent())
  2906. if c.ifNoneMatch_ != "" {
  2907. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2908. }
  2909. var body io.Reader = nil
  2910. c.urlParams_.Set("alt", alt)
  2911. c.urlParams_.Set("prettyPrint", "false")
  2912. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/iam")
  2913. urls += "?" + c.urlParams_.Encode()
  2914. req, err := http.NewRequest("GET", urls, body)
  2915. if err != nil {
  2916. return nil, err
  2917. }
  2918. req.Header = reqHeaders
  2919. googleapi.Expand(req.URL, map[string]string{
  2920. "bucket": c.bucket,
  2921. })
  2922. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2923. }
  2924. // Do executes the "storage.buckets.getIamPolicy" call.
  2925. // Exactly one of *Policy or error will be non-nil. Any non-2xx status
  2926. // code is an error. Response headers are in either
  2927. // *Policy.ServerResponse.Header or (if a response was returned at all)
  2928. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2929. // check whether the returned error was because http.StatusNotModified
  2930. // was returned.
  2931. func (c *BucketsGetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) {
  2932. gensupport.SetOptions(c.urlParams_, opts...)
  2933. res, err := c.doRequest("json")
  2934. if res != nil && res.StatusCode == http.StatusNotModified {
  2935. if res.Body != nil {
  2936. res.Body.Close()
  2937. }
  2938. return nil, &googleapi.Error{
  2939. Code: res.StatusCode,
  2940. Header: res.Header,
  2941. }
  2942. }
  2943. if err != nil {
  2944. return nil, err
  2945. }
  2946. defer googleapi.CloseBody(res)
  2947. if err := googleapi.CheckResponse(res); err != nil {
  2948. return nil, err
  2949. }
  2950. ret := &Policy{
  2951. ServerResponse: googleapi.ServerResponse{
  2952. Header: res.Header,
  2953. HTTPStatusCode: res.StatusCode,
  2954. },
  2955. }
  2956. target := &ret
  2957. if err := gensupport.DecodeResponse(target, res); err != nil {
  2958. return nil, err
  2959. }
  2960. return ret, nil
  2961. // {
  2962. // "description": "Returns an IAM policy for the specified bucket.",
  2963. // "httpMethod": "GET",
  2964. // "id": "storage.buckets.getIamPolicy",
  2965. // "parameterOrder": [
  2966. // "bucket"
  2967. // ],
  2968. // "parameters": {
  2969. // "bucket": {
  2970. // "description": "Name of a bucket.",
  2971. // "location": "path",
  2972. // "required": true,
  2973. // "type": "string"
  2974. // },
  2975. // "userProject": {
  2976. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  2977. // "location": "query",
  2978. // "type": "string"
  2979. // }
  2980. // },
  2981. // "path": "b/{bucket}/iam",
  2982. // "response": {
  2983. // "$ref": "Policy"
  2984. // },
  2985. // "scopes": [
  2986. // "https://www.googleapis.com/auth/cloud-platform",
  2987. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  2988. // "https://www.googleapis.com/auth/devstorage.full_control",
  2989. // "https://www.googleapis.com/auth/devstorage.read_only",
  2990. // "https://www.googleapis.com/auth/devstorage.read_write"
  2991. // ]
  2992. // }
  2993. }
  2994. // method id "storage.buckets.insert":
  2995. type BucketsInsertCall struct {
  2996. s *Service
  2997. bucket *Bucket
  2998. urlParams_ gensupport.URLParams
  2999. ctx_ context.Context
  3000. header_ http.Header
  3001. }
  3002. // Insert: Creates a new bucket.
  3003. func (r *BucketsService) Insert(projectid string, bucket *Bucket) *BucketsInsertCall {
  3004. c := &BucketsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3005. c.urlParams_.Set("project", projectid)
  3006. c.bucket = bucket
  3007. return c
  3008. }
  3009. // PredefinedAcl sets the optional parameter "predefinedAcl": Apply a
  3010. // predefined set of access controls to this bucket.
  3011. //
  3012. // Possible values:
  3013. // "authenticatedRead" - Project team owners get OWNER access, and
  3014. // allAuthenticatedUsers get READER access.
  3015. // "private" - Project team owners get OWNER access.
  3016. // "projectPrivate" - Project team members get access according to
  3017. // their roles.
  3018. // "publicRead" - Project team owners get OWNER access, and allUsers
  3019. // get READER access.
  3020. // "publicReadWrite" - Project team owners get OWNER access, and
  3021. // allUsers get WRITER access.
  3022. func (c *BucketsInsertCall) PredefinedAcl(predefinedAcl string) *BucketsInsertCall {
  3023. c.urlParams_.Set("predefinedAcl", predefinedAcl)
  3024. return c
  3025. }
  3026. // PredefinedDefaultObjectAcl sets the optional parameter
  3027. // "predefinedDefaultObjectAcl": Apply a predefined set of default
  3028. // object access controls to this bucket.
  3029. //
  3030. // Possible values:
  3031. // "authenticatedRead" - Object owner gets OWNER access, and
  3032. // allAuthenticatedUsers get READER access.
  3033. // "bucketOwnerFullControl" - Object owner gets OWNER access, and
  3034. // project team owners get OWNER access.
  3035. // "bucketOwnerRead" - Object owner gets OWNER access, and project
  3036. // team owners get READER access.
  3037. // "private" - Object owner gets OWNER access.
  3038. // "projectPrivate" - Object owner gets OWNER access, and project team
  3039. // members get access according to their roles.
  3040. // "publicRead" - Object owner gets OWNER access, and allUsers get
  3041. // READER access.
  3042. func (c *BucketsInsertCall) PredefinedDefaultObjectAcl(predefinedDefaultObjectAcl string) *BucketsInsertCall {
  3043. c.urlParams_.Set("predefinedDefaultObjectAcl", predefinedDefaultObjectAcl)
  3044. return c
  3045. }
  3046. // Projection sets the optional parameter "projection": Set of
  3047. // properties to return. Defaults to noAcl, unless the bucket resource
  3048. // specifies acl or defaultObjectAcl properties, when it defaults to
  3049. // full.
  3050. //
  3051. // Possible values:
  3052. // "full" - Include all properties.
  3053. // "noAcl" - Omit owner, acl and defaultObjectAcl properties.
  3054. func (c *BucketsInsertCall) Projection(projection string) *BucketsInsertCall {
  3055. c.urlParams_.Set("projection", projection)
  3056. return c
  3057. }
  3058. // UserProject sets the optional parameter "userProject": The project to
  3059. // be billed for this request.
  3060. func (c *BucketsInsertCall) UserProject(userProject string) *BucketsInsertCall {
  3061. c.urlParams_.Set("userProject", userProject)
  3062. return c
  3063. }
  3064. // Fields allows partial responses to be retrieved. See
  3065. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3066. // for more information.
  3067. func (c *BucketsInsertCall) Fields(s ...googleapi.Field) *BucketsInsertCall {
  3068. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3069. return c
  3070. }
  3071. // Context sets the context to be used in this call's Do method. Any
  3072. // pending HTTP request will be aborted if the provided context is
  3073. // canceled.
  3074. func (c *BucketsInsertCall) Context(ctx context.Context) *BucketsInsertCall {
  3075. c.ctx_ = ctx
  3076. return c
  3077. }
  3078. // Header returns an http.Header that can be modified by the caller to
  3079. // add HTTP headers to the request.
  3080. func (c *BucketsInsertCall) Header() http.Header {
  3081. if c.header_ == nil {
  3082. c.header_ = make(http.Header)
  3083. }
  3084. return c.header_
  3085. }
  3086. func (c *BucketsInsertCall) doRequest(alt string) (*http.Response, error) {
  3087. reqHeaders := make(http.Header)
  3088. for k, v := range c.header_ {
  3089. reqHeaders[k] = v
  3090. }
  3091. reqHeaders.Set("User-Agent", c.s.userAgent())
  3092. var body io.Reader = nil
  3093. body, err := googleapi.WithoutDataWrapper.JSONReader(c.bucket)
  3094. if err != nil {
  3095. return nil, err
  3096. }
  3097. reqHeaders.Set("Content-Type", "application/json")
  3098. c.urlParams_.Set("alt", alt)
  3099. c.urlParams_.Set("prettyPrint", "false")
  3100. urls := googleapi.ResolveRelative(c.s.BasePath, "b")
  3101. urls += "?" + c.urlParams_.Encode()
  3102. req, err := http.NewRequest("POST", urls, body)
  3103. if err != nil {
  3104. return nil, err
  3105. }
  3106. req.Header = reqHeaders
  3107. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3108. }
  3109. // Do executes the "storage.buckets.insert" call.
  3110. // Exactly one of *Bucket or error will be non-nil. Any non-2xx status
  3111. // code is an error. Response headers are in either
  3112. // *Bucket.ServerResponse.Header or (if a response was returned at all)
  3113. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3114. // check whether the returned error was because http.StatusNotModified
  3115. // was returned.
  3116. func (c *BucketsInsertCall) Do(opts ...googleapi.CallOption) (*Bucket, error) {
  3117. gensupport.SetOptions(c.urlParams_, opts...)
  3118. res, err := c.doRequest("json")
  3119. if res != nil && res.StatusCode == http.StatusNotModified {
  3120. if res.Body != nil {
  3121. res.Body.Close()
  3122. }
  3123. return nil, &googleapi.Error{
  3124. Code: res.StatusCode,
  3125. Header: res.Header,
  3126. }
  3127. }
  3128. if err != nil {
  3129. return nil, err
  3130. }
  3131. defer googleapi.CloseBody(res)
  3132. if err := googleapi.CheckResponse(res); err != nil {
  3133. return nil, err
  3134. }
  3135. ret := &Bucket{
  3136. ServerResponse: googleapi.ServerResponse{
  3137. Header: res.Header,
  3138. HTTPStatusCode: res.StatusCode,
  3139. },
  3140. }
  3141. target := &ret
  3142. if err := gensupport.DecodeResponse(target, res); err != nil {
  3143. return nil, err
  3144. }
  3145. return ret, nil
  3146. // {
  3147. // "description": "Creates a new bucket.",
  3148. // "httpMethod": "POST",
  3149. // "id": "storage.buckets.insert",
  3150. // "parameterOrder": [
  3151. // "project"
  3152. // ],
  3153. // "parameters": {
  3154. // "predefinedAcl": {
  3155. // "description": "Apply a predefined set of access controls to this bucket.",
  3156. // "enum": [
  3157. // "authenticatedRead",
  3158. // "private",
  3159. // "projectPrivate",
  3160. // "publicRead",
  3161. // "publicReadWrite"
  3162. // ],
  3163. // "enumDescriptions": [
  3164. // "Project team owners get OWNER access, and allAuthenticatedUsers get READER access.",
  3165. // "Project team owners get OWNER access.",
  3166. // "Project team members get access according to their roles.",
  3167. // "Project team owners get OWNER access, and allUsers get READER access.",
  3168. // "Project team owners get OWNER access, and allUsers get WRITER access."
  3169. // ],
  3170. // "location": "query",
  3171. // "type": "string"
  3172. // },
  3173. // "predefinedDefaultObjectAcl": {
  3174. // "description": "Apply a predefined set of default object access controls to this bucket.",
  3175. // "enum": [
  3176. // "authenticatedRead",
  3177. // "bucketOwnerFullControl",
  3178. // "bucketOwnerRead",
  3179. // "private",
  3180. // "projectPrivate",
  3181. // "publicRead"
  3182. // ],
  3183. // "enumDescriptions": [
  3184. // "Object owner gets OWNER access, and allAuthenticatedUsers get READER access.",
  3185. // "Object owner gets OWNER access, and project team owners get OWNER access.",
  3186. // "Object owner gets OWNER access, and project team owners get READER access.",
  3187. // "Object owner gets OWNER access.",
  3188. // "Object owner gets OWNER access, and project team members get access according to their roles.",
  3189. // "Object owner gets OWNER access, and allUsers get READER access."
  3190. // ],
  3191. // "location": "query",
  3192. // "type": "string"
  3193. // },
  3194. // "project": {
  3195. // "description": "A valid API project identifier.",
  3196. // "location": "query",
  3197. // "required": true,
  3198. // "type": "string"
  3199. // },
  3200. // "projection": {
  3201. // "description": "Set of properties to return. Defaults to noAcl, unless the bucket resource specifies acl or defaultObjectAcl properties, when it defaults to full.",
  3202. // "enum": [
  3203. // "full",
  3204. // "noAcl"
  3205. // ],
  3206. // "enumDescriptions": [
  3207. // "Include all properties.",
  3208. // "Omit owner, acl and defaultObjectAcl properties."
  3209. // ],
  3210. // "location": "query",
  3211. // "type": "string"
  3212. // },
  3213. // "userProject": {
  3214. // "description": "The project to be billed for this request.",
  3215. // "location": "query",
  3216. // "type": "string"
  3217. // }
  3218. // },
  3219. // "path": "b",
  3220. // "request": {
  3221. // "$ref": "Bucket"
  3222. // },
  3223. // "response": {
  3224. // "$ref": "Bucket"
  3225. // },
  3226. // "scopes": [
  3227. // "https://www.googleapis.com/auth/cloud-platform",
  3228. // "https://www.googleapis.com/auth/devstorage.full_control",
  3229. // "https://www.googleapis.com/auth/devstorage.read_write"
  3230. // ]
  3231. // }
  3232. }
  3233. // method id "storage.buckets.list":
  3234. type BucketsListCall struct {
  3235. s *Service
  3236. urlParams_ gensupport.URLParams
  3237. ifNoneMatch_ string
  3238. ctx_ context.Context
  3239. header_ http.Header
  3240. }
  3241. // List: Retrieves a list of buckets for a given project.
  3242. func (r *BucketsService) List(projectid string) *BucketsListCall {
  3243. c := &BucketsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3244. c.urlParams_.Set("project", projectid)
  3245. return c
  3246. }
  3247. // MaxResults sets the optional parameter "maxResults": Maximum number
  3248. // of buckets to return in a single response. The service will use this
  3249. // parameter or 1,000 items, whichever is smaller.
  3250. func (c *BucketsListCall) MaxResults(maxResults int64) *BucketsListCall {
  3251. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  3252. return c
  3253. }
  3254. // PageToken sets the optional parameter "pageToken": A
  3255. // previously-returned page token representing part of the larger set of
  3256. // results to view.
  3257. func (c *BucketsListCall) PageToken(pageToken string) *BucketsListCall {
  3258. c.urlParams_.Set("pageToken", pageToken)
  3259. return c
  3260. }
  3261. // Prefix sets the optional parameter "prefix": Filter results to
  3262. // buckets whose names begin with this prefix.
  3263. func (c *BucketsListCall) Prefix(prefix string) *BucketsListCall {
  3264. c.urlParams_.Set("prefix", prefix)
  3265. return c
  3266. }
  3267. // Projection sets the optional parameter "projection": Set of
  3268. // properties to return. Defaults to noAcl.
  3269. //
  3270. // Possible values:
  3271. // "full" - Include all properties.
  3272. // "noAcl" - Omit owner, acl and defaultObjectAcl properties.
  3273. func (c *BucketsListCall) Projection(projection string) *BucketsListCall {
  3274. c.urlParams_.Set("projection", projection)
  3275. return c
  3276. }
  3277. // UserProject sets the optional parameter "userProject": The project to
  3278. // be billed for this request.
  3279. func (c *BucketsListCall) UserProject(userProject string) *BucketsListCall {
  3280. c.urlParams_.Set("userProject", userProject)
  3281. return c
  3282. }
  3283. // Fields allows partial responses to be retrieved. See
  3284. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3285. // for more information.
  3286. func (c *BucketsListCall) Fields(s ...googleapi.Field) *BucketsListCall {
  3287. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3288. return c
  3289. }
  3290. // IfNoneMatch sets the optional parameter which makes the operation
  3291. // fail if the object's ETag matches the given value. This is useful for
  3292. // getting updates only after the object has changed since the last
  3293. // request. Use googleapi.IsNotModified to check whether the response
  3294. // error from Do is the result of In-None-Match.
  3295. func (c *BucketsListCall) IfNoneMatch(entityTag string) *BucketsListCall {
  3296. c.ifNoneMatch_ = entityTag
  3297. return c
  3298. }
  3299. // Context sets the context to be used in this call's Do method. Any
  3300. // pending HTTP request will be aborted if the provided context is
  3301. // canceled.
  3302. func (c *BucketsListCall) Context(ctx context.Context) *BucketsListCall {
  3303. c.ctx_ = ctx
  3304. return c
  3305. }
  3306. // Header returns an http.Header that can be modified by the caller to
  3307. // add HTTP headers to the request.
  3308. func (c *BucketsListCall) Header() http.Header {
  3309. if c.header_ == nil {
  3310. c.header_ = make(http.Header)
  3311. }
  3312. return c.header_
  3313. }
  3314. func (c *BucketsListCall) doRequest(alt string) (*http.Response, error) {
  3315. reqHeaders := make(http.Header)
  3316. for k, v := range c.header_ {
  3317. reqHeaders[k] = v
  3318. }
  3319. reqHeaders.Set("User-Agent", c.s.userAgent())
  3320. if c.ifNoneMatch_ != "" {
  3321. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3322. }
  3323. var body io.Reader = nil
  3324. c.urlParams_.Set("alt", alt)
  3325. c.urlParams_.Set("prettyPrint", "false")
  3326. urls := googleapi.ResolveRelative(c.s.BasePath, "b")
  3327. urls += "?" + c.urlParams_.Encode()
  3328. req, err := http.NewRequest("GET", urls, body)
  3329. if err != nil {
  3330. return nil, err
  3331. }
  3332. req.Header = reqHeaders
  3333. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3334. }
  3335. // Do executes the "storage.buckets.list" call.
  3336. // Exactly one of *Buckets or error will be non-nil. Any non-2xx status
  3337. // code is an error. Response headers are in either
  3338. // *Buckets.ServerResponse.Header or (if a response was returned at all)
  3339. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3340. // check whether the returned error was because http.StatusNotModified
  3341. // was returned.
  3342. func (c *BucketsListCall) Do(opts ...googleapi.CallOption) (*Buckets, error) {
  3343. gensupport.SetOptions(c.urlParams_, opts...)
  3344. res, err := c.doRequest("json")
  3345. if res != nil && res.StatusCode == http.StatusNotModified {
  3346. if res.Body != nil {
  3347. res.Body.Close()
  3348. }
  3349. return nil, &googleapi.Error{
  3350. Code: res.StatusCode,
  3351. Header: res.Header,
  3352. }
  3353. }
  3354. if err != nil {
  3355. return nil, err
  3356. }
  3357. defer googleapi.CloseBody(res)
  3358. if err := googleapi.CheckResponse(res); err != nil {
  3359. return nil, err
  3360. }
  3361. ret := &Buckets{
  3362. ServerResponse: googleapi.ServerResponse{
  3363. Header: res.Header,
  3364. HTTPStatusCode: res.StatusCode,
  3365. },
  3366. }
  3367. target := &ret
  3368. if err := gensupport.DecodeResponse(target, res); err != nil {
  3369. return nil, err
  3370. }
  3371. return ret, nil
  3372. // {
  3373. // "description": "Retrieves a list of buckets for a given project.",
  3374. // "httpMethod": "GET",
  3375. // "id": "storage.buckets.list",
  3376. // "parameterOrder": [
  3377. // "project"
  3378. // ],
  3379. // "parameters": {
  3380. // "maxResults": {
  3381. // "default": "1000",
  3382. // "description": "Maximum number of buckets to return in a single response. The service will use this parameter or 1,000 items, whichever is smaller.",
  3383. // "format": "uint32",
  3384. // "location": "query",
  3385. // "minimum": "0",
  3386. // "type": "integer"
  3387. // },
  3388. // "pageToken": {
  3389. // "description": "A previously-returned page token representing part of the larger set of results to view.",
  3390. // "location": "query",
  3391. // "type": "string"
  3392. // },
  3393. // "prefix": {
  3394. // "description": "Filter results to buckets whose names begin with this prefix.",
  3395. // "location": "query",
  3396. // "type": "string"
  3397. // },
  3398. // "project": {
  3399. // "description": "A valid API project identifier.",
  3400. // "location": "query",
  3401. // "required": true,
  3402. // "type": "string"
  3403. // },
  3404. // "projection": {
  3405. // "description": "Set of properties to return. Defaults to noAcl.",
  3406. // "enum": [
  3407. // "full",
  3408. // "noAcl"
  3409. // ],
  3410. // "enumDescriptions": [
  3411. // "Include all properties.",
  3412. // "Omit owner, acl and defaultObjectAcl properties."
  3413. // ],
  3414. // "location": "query",
  3415. // "type": "string"
  3416. // },
  3417. // "userProject": {
  3418. // "description": "The project to be billed for this request.",
  3419. // "location": "query",
  3420. // "type": "string"
  3421. // }
  3422. // },
  3423. // "path": "b",
  3424. // "response": {
  3425. // "$ref": "Buckets"
  3426. // },
  3427. // "scopes": [
  3428. // "https://www.googleapis.com/auth/cloud-platform",
  3429. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  3430. // "https://www.googleapis.com/auth/devstorage.full_control",
  3431. // "https://www.googleapis.com/auth/devstorage.read_only",
  3432. // "https://www.googleapis.com/auth/devstorage.read_write"
  3433. // ]
  3434. // }
  3435. }
  3436. // Pages invokes f for each page of results.
  3437. // A non-nil error returned from f will halt the iteration.
  3438. // The provided context supersedes any context provided to the Context method.
  3439. func (c *BucketsListCall) Pages(ctx context.Context, f func(*Buckets) error) error {
  3440. c.ctx_ = ctx
  3441. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  3442. for {
  3443. x, err := c.Do()
  3444. if err != nil {
  3445. return err
  3446. }
  3447. if err := f(x); err != nil {
  3448. return err
  3449. }
  3450. if x.NextPageToken == "" {
  3451. return nil
  3452. }
  3453. c.PageToken(x.NextPageToken)
  3454. }
  3455. }
  3456. // method id "storage.buckets.lockRetentionPolicy":
  3457. type BucketsLockRetentionPolicyCall struct {
  3458. s *Service
  3459. bucket string
  3460. urlParams_ gensupport.URLParams
  3461. ctx_ context.Context
  3462. header_ http.Header
  3463. }
  3464. // LockRetentionPolicy: Locks retention policy on a bucket.
  3465. func (r *BucketsService) LockRetentionPolicy(bucket string, ifMetagenerationMatch int64) *BucketsLockRetentionPolicyCall {
  3466. c := &BucketsLockRetentionPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3467. c.bucket = bucket
  3468. c.urlParams_.Set("ifMetagenerationMatch", fmt.Sprint(ifMetagenerationMatch))
  3469. return c
  3470. }
  3471. // UserProject sets the optional parameter "userProject": The project to
  3472. // be billed for this request. Required for Requester Pays buckets.
  3473. func (c *BucketsLockRetentionPolicyCall) UserProject(userProject string) *BucketsLockRetentionPolicyCall {
  3474. c.urlParams_.Set("userProject", userProject)
  3475. return c
  3476. }
  3477. // Fields allows partial responses to be retrieved. See
  3478. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3479. // for more information.
  3480. func (c *BucketsLockRetentionPolicyCall) Fields(s ...googleapi.Field) *BucketsLockRetentionPolicyCall {
  3481. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3482. return c
  3483. }
  3484. // Context sets the context to be used in this call's Do method. Any
  3485. // pending HTTP request will be aborted if the provided context is
  3486. // canceled.
  3487. func (c *BucketsLockRetentionPolicyCall) Context(ctx context.Context) *BucketsLockRetentionPolicyCall {
  3488. c.ctx_ = ctx
  3489. return c
  3490. }
  3491. // Header returns an http.Header that can be modified by the caller to
  3492. // add HTTP headers to the request.
  3493. func (c *BucketsLockRetentionPolicyCall) Header() http.Header {
  3494. if c.header_ == nil {
  3495. c.header_ = make(http.Header)
  3496. }
  3497. return c.header_
  3498. }
  3499. func (c *BucketsLockRetentionPolicyCall) doRequest(alt string) (*http.Response, error) {
  3500. reqHeaders := make(http.Header)
  3501. for k, v := range c.header_ {
  3502. reqHeaders[k] = v
  3503. }
  3504. reqHeaders.Set("User-Agent", c.s.userAgent())
  3505. var body io.Reader = nil
  3506. c.urlParams_.Set("alt", alt)
  3507. c.urlParams_.Set("prettyPrint", "false")
  3508. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/lockRetentionPolicy")
  3509. urls += "?" + c.urlParams_.Encode()
  3510. req, err := http.NewRequest("POST", urls, body)
  3511. if err != nil {
  3512. return nil, err
  3513. }
  3514. req.Header = reqHeaders
  3515. googleapi.Expand(req.URL, map[string]string{
  3516. "bucket": c.bucket,
  3517. })
  3518. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3519. }
  3520. // Do executes the "storage.buckets.lockRetentionPolicy" call.
  3521. // Exactly one of *Bucket or error will be non-nil. Any non-2xx status
  3522. // code is an error. Response headers are in either
  3523. // *Bucket.ServerResponse.Header or (if a response was returned at all)
  3524. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3525. // check whether the returned error was because http.StatusNotModified
  3526. // was returned.
  3527. func (c *BucketsLockRetentionPolicyCall) Do(opts ...googleapi.CallOption) (*Bucket, error) {
  3528. gensupport.SetOptions(c.urlParams_, opts...)
  3529. res, err := c.doRequest("json")
  3530. if res != nil && res.StatusCode == http.StatusNotModified {
  3531. if res.Body != nil {
  3532. res.Body.Close()
  3533. }
  3534. return nil, &googleapi.Error{
  3535. Code: res.StatusCode,
  3536. Header: res.Header,
  3537. }
  3538. }
  3539. if err != nil {
  3540. return nil, err
  3541. }
  3542. defer googleapi.CloseBody(res)
  3543. if err := googleapi.CheckResponse(res); err != nil {
  3544. return nil, err
  3545. }
  3546. ret := &Bucket{
  3547. ServerResponse: googleapi.ServerResponse{
  3548. Header: res.Header,
  3549. HTTPStatusCode: res.StatusCode,
  3550. },
  3551. }
  3552. target := &ret
  3553. if err := gensupport.DecodeResponse(target, res); err != nil {
  3554. return nil, err
  3555. }
  3556. return ret, nil
  3557. // {
  3558. // "description": "Locks retention policy on a bucket.",
  3559. // "httpMethod": "POST",
  3560. // "id": "storage.buckets.lockRetentionPolicy",
  3561. // "parameterOrder": [
  3562. // "bucket",
  3563. // "ifMetagenerationMatch"
  3564. // ],
  3565. // "parameters": {
  3566. // "bucket": {
  3567. // "description": "Name of a bucket.",
  3568. // "location": "path",
  3569. // "required": true,
  3570. // "type": "string"
  3571. // },
  3572. // "ifMetagenerationMatch": {
  3573. // "description": "Makes the operation conditional on whether bucket's current metageneration matches the given value.",
  3574. // "format": "int64",
  3575. // "location": "query",
  3576. // "required": true,
  3577. // "type": "string"
  3578. // },
  3579. // "userProject": {
  3580. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  3581. // "location": "query",
  3582. // "type": "string"
  3583. // }
  3584. // },
  3585. // "path": "b/{bucket}/lockRetentionPolicy",
  3586. // "response": {
  3587. // "$ref": "Bucket"
  3588. // },
  3589. // "scopes": [
  3590. // "https://www.googleapis.com/auth/cloud-platform",
  3591. // "https://www.googleapis.com/auth/devstorage.full_control",
  3592. // "https://www.googleapis.com/auth/devstorage.read_write"
  3593. // ]
  3594. // }
  3595. }
  3596. // method id "storage.buckets.patch":
  3597. type BucketsPatchCall struct {
  3598. s *Service
  3599. bucket string
  3600. bucket2 *Bucket
  3601. urlParams_ gensupport.URLParams
  3602. ctx_ context.Context
  3603. header_ http.Header
  3604. }
  3605. // Patch: Patches a bucket. Changes to the bucket will be readable
  3606. // immediately after writing, but configuration changes may take time to
  3607. // propagate.
  3608. func (r *BucketsService) Patch(bucket string, bucket2 *Bucket) *BucketsPatchCall {
  3609. c := &BucketsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3610. c.bucket = bucket
  3611. c.bucket2 = bucket2
  3612. return c
  3613. }
  3614. // IfMetagenerationMatch sets the optional parameter
  3615. // "ifMetagenerationMatch": Makes the return of the bucket metadata
  3616. // conditional on whether the bucket's current metageneration matches
  3617. // the given value.
  3618. func (c *BucketsPatchCall) IfMetagenerationMatch(ifMetagenerationMatch int64) *BucketsPatchCall {
  3619. c.urlParams_.Set("ifMetagenerationMatch", fmt.Sprint(ifMetagenerationMatch))
  3620. return c
  3621. }
  3622. // IfMetagenerationNotMatch sets the optional parameter
  3623. // "ifMetagenerationNotMatch": Makes the return of the bucket metadata
  3624. // conditional on whether the bucket's current metageneration does not
  3625. // match the given value.
  3626. func (c *BucketsPatchCall) IfMetagenerationNotMatch(ifMetagenerationNotMatch int64) *BucketsPatchCall {
  3627. c.urlParams_.Set("ifMetagenerationNotMatch", fmt.Sprint(ifMetagenerationNotMatch))
  3628. return c
  3629. }
  3630. // PredefinedAcl sets the optional parameter "predefinedAcl": Apply a
  3631. // predefined set of access controls to this bucket.
  3632. //
  3633. // Possible values:
  3634. // "authenticatedRead" - Project team owners get OWNER access, and
  3635. // allAuthenticatedUsers get READER access.
  3636. // "private" - Project team owners get OWNER access.
  3637. // "projectPrivate" - Project team members get access according to
  3638. // their roles.
  3639. // "publicRead" - Project team owners get OWNER access, and allUsers
  3640. // get READER access.
  3641. // "publicReadWrite" - Project team owners get OWNER access, and
  3642. // allUsers get WRITER access.
  3643. func (c *BucketsPatchCall) PredefinedAcl(predefinedAcl string) *BucketsPatchCall {
  3644. c.urlParams_.Set("predefinedAcl", predefinedAcl)
  3645. return c
  3646. }
  3647. // PredefinedDefaultObjectAcl sets the optional parameter
  3648. // "predefinedDefaultObjectAcl": Apply a predefined set of default
  3649. // object access controls to this bucket.
  3650. //
  3651. // Possible values:
  3652. // "authenticatedRead" - Object owner gets OWNER access, and
  3653. // allAuthenticatedUsers get READER access.
  3654. // "bucketOwnerFullControl" - Object owner gets OWNER access, and
  3655. // project team owners get OWNER access.
  3656. // "bucketOwnerRead" - Object owner gets OWNER access, and project
  3657. // team owners get READER access.
  3658. // "private" - Object owner gets OWNER access.
  3659. // "projectPrivate" - Object owner gets OWNER access, and project team
  3660. // members get access according to their roles.
  3661. // "publicRead" - Object owner gets OWNER access, and allUsers get
  3662. // READER access.
  3663. func (c *BucketsPatchCall) PredefinedDefaultObjectAcl(predefinedDefaultObjectAcl string) *BucketsPatchCall {
  3664. c.urlParams_.Set("predefinedDefaultObjectAcl", predefinedDefaultObjectAcl)
  3665. return c
  3666. }
  3667. // Projection sets the optional parameter "projection": Set of
  3668. // properties to return. Defaults to full.
  3669. //
  3670. // Possible values:
  3671. // "full" - Include all properties.
  3672. // "noAcl" - Omit owner, acl and defaultObjectAcl properties.
  3673. func (c *BucketsPatchCall) Projection(projection string) *BucketsPatchCall {
  3674. c.urlParams_.Set("projection", projection)
  3675. return c
  3676. }
  3677. // UserProject sets the optional parameter "userProject": The project to
  3678. // be billed for this request. Required for Requester Pays buckets.
  3679. func (c *BucketsPatchCall) UserProject(userProject string) *BucketsPatchCall {
  3680. c.urlParams_.Set("userProject", userProject)
  3681. return c
  3682. }
  3683. // Fields allows partial responses to be retrieved. See
  3684. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3685. // for more information.
  3686. func (c *BucketsPatchCall) Fields(s ...googleapi.Field) *BucketsPatchCall {
  3687. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3688. return c
  3689. }
  3690. // Context sets the context to be used in this call's Do method. Any
  3691. // pending HTTP request will be aborted if the provided context is
  3692. // canceled.
  3693. func (c *BucketsPatchCall) Context(ctx context.Context) *BucketsPatchCall {
  3694. c.ctx_ = ctx
  3695. return c
  3696. }
  3697. // Header returns an http.Header that can be modified by the caller to
  3698. // add HTTP headers to the request.
  3699. func (c *BucketsPatchCall) Header() http.Header {
  3700. if c.header_ == nil {
  3701. c.header_ = make(http.Header)
  3702. }
  3703. return c.header_
  3704. }
  3705. func (c *BucketsPatchCall) doRequest(alt string) (*http.Response, error) {
  3706. reqHeaders := make(http.Header)
  3707. for k, v := range c.header_ {
  3708. reqHeaders[k] = v
  3709. }
  3710. reqHeaders.Set("User-Agent", c.s.userAgent())
  3711. var body io.Reader = nil
  3712. body, err := googleapi.WithoutDataWrapper.JSONReader(c.bucket2)
  3713. if err != nil {
  3714. return nil, err
  3715. }
  3716. reqHeaders.Set("Content-Type", "application/json")
  3717. c.urlParams_.Set("alt", alt)
  3718. c.urlParams_.Set("prettyPrint", "false")
  3719. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}")
  3720. urls += "?" + c.urlParams_.Encode()
  3721. req, err := http.NewRequest("PATCH", urls, body)
  3722. if err != nil {
  3723. return nil, err
  3724. }
  3725. req.Header = reqHeaders
  3726. googleapi.Expand(req.URL, map[string]string{
  3727. "bucket": c.bucket,
  3728. })
  3729. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3730. }
  3731. // Do executes the "storage.buckets.patch" call.
  3732. // Exactly one of *Bucket or error will be non-nil. Any non-2xx status
  3733. // code is an error. Response headers are in either
  3734. // *Bucket.ServerResponse.Header or (if a response was returned at all)
  3735. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3736. // check whether the returned error was because http.StatusNotModified
  3737. // was returned.
  3738. func (c *BucketsPatchCall) Do(opts ...googleapi.CallOption) (*Bucket, error) {
  3739. gensupport.SetOptions(c.urlParams_, opts...)
  3740. res, err := c.doRequest("json")
  3741. if res != nil && res.StatusCode == http.StatusNotModified {
  3742. if res.Body != nil {
  3743. res.Body.Close()
  3744. }
  3745. return nil, &googleapi.Error{
  3746. Code: res.StatusCode,
  3747. Header: res.Header,
  3748. }
  3749. }
  3750. if err != nil {
  3751. return nil, err
  3752. }
  3753. defer googleapi.CloseBody(res)
  3754. if err := googleapi.CheckResponse(res); err != nil {
  3755. return nil, err
  3756. }
  3757. ret := &Bucket{
  3758. ServerResponse: googleapi.ServerResponse{
  3759. Header: res.Header,
  3760. HTTPStatusCode: res.StatusCode,
  3761. },
  3762. }
  3763. target := &ret
  3764. if err := gensupport.DecodeResponse(target, res); err != nil {
  3765. return nil, err
  3766. }
  3767. return ret, nil
  3768. // {
  3769. // "description": "Patches a bucket. Changes to the bucket will be readable immediately after writing, but configuration changes may take time to propagate.",
  3770. // "httpMethod": "PATCH",
  3771. // "id": "storage.buckets.patch",
  3772. // "parameterOrder": [
  3773. // "bucket"
  3774. // ],
  3775. // "parameters": {
  3776. // "bucket": {
  3777. // "description": "Name of a bucket.",
  3778. // "location": "path",
  3779. // "required": true,
  3780. // "type": "string"
  3781. // },
  3782. // "ifMetagenerationMatch": {
  3783. // "description": "Makes the return of the bucket metadata conditional on whether the bucket's current metageneration matches the given value.",
  3784. // "format": "int64",
  3785. // "location": "query",
  3786. // "type": "string"
  3787. // },
  3788. // "ifMetagenerationNotMatch": {
  3789. // "description": "Makes the return of the bucket metadata conditional on whether the bucket's current metageneration does not match the given value.",
  3790. // "format": "int64",
  3791. // "location": "query",
  3792. // "type": "string"
  3793. // },
  3794. // "predefinedAcl": {
  3795. // "description": "Apply a predefined set of access controls to this bucket.",
  3796. // "enum": [
  3797. // "authenticatedRead",
  3798. // "private",
  3799. // "projectPrivate",
  3800. // "publicRead",
  3801. // "publicReadWrite"
  3802. // ],
  3803. // "enumDescriptions": [
  3804. // "Project team owners get OWNER access, and allAuthenticatedUsers get READER access.",
  3805. // "Project team owners get OWNER access.",
  3806. // "Project team members get access according to their roles.",
  3807. // "Project team owners get OWNER access, and allUsers get READER access.",
  3808. // "Project team owners get OWNER access, and allUsers get WRITER access."
  3809. // ],
  3810. // "location": "query",
  3811. // "type": "string"
  3812. // },
  3813. // "predefinedDefaultObjectAcl": {
  3814. // "description": "Apply a predefined set of default object access controls to this bucket.",
  3815. // "enum": [
  3816. // "authenticatedRead",
  3817. // "bucketOwnerFullControl",
  3818. // "bucketOwnerRead",
  3819. // "private",
  3820. // "projectPrivate",
  3821. // "publicRead"
  3822. // ],
  3823. // "enumDescriptions": [
  3824. // "Object owner gets OWNER access, and allAuthenticatedUsers get READER access.",
  3825. // "Object owner gets OWNER access, and project team owners get OWNER access.",
  3826. // "Object owner gets OWNER access, and project team owners get READER access.",
  3827. // "Object owner gets OWNER access.",
  3828. // "Object owner gets OWNER access, and project team members get access according to their roles.",
  3829. // "Object owner gets OWNER access, and allUsers get READER access."
  3830. // ],
  3831. // "location": "query",
  3832. // "type": "string"
  3833. // },
  3834. // "projection": {
  3835. // "description": "Set of properties to return. Defaults to full.",
  3836. // "enum": [
  3837. // "full",
  3838. // "noAcl"
  3839. // ],
  3840. // "enumDescriptions": [
  3841. // "Include all properties.",
  3842. // "Omit owner, acl and defaultObjectAcl properties."
  3843. // ],
  3844. // "location": "query",
  3845. // "type": "string"
  3846. // },
  3847. // "userProject": {
  3848. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  3849. // "location": "query",
  3850. // "type": "string"
  3851. // }
  3852. // },
  3853. // "path": "b/{bucket}",
  3854. // "request": {
  3855. // "$ref": "Bucket"
  3856. // },
  3857. // "response": {
  3858. // "$ref": "Bucket"
  3859. // },
  3860. // "scopes": [
  3861. // "https://www.googleapis.com/auth/cloud-platform",
  3862. // "https://www.googleapis.com/auth/devstorage.full_control"
  3863. // ]
  3864. // }
  3865. }
  3866. // method id "storage.buckets.setIamPolicy":
  3867. type BucketsSetIamPolicyCall struct {
  3868. s *Service
  3869. bucket string
  3870. policy *Policy
  3871. urlParams_ gensupport.URLParams
  3872. ctx_ context.Context
  3873. header_ http.Header
  3874. }
  3875. // SetIamPolicy: Updates an IAM policy for the specified bucket.
  3876. func (r *BucketsService) SetIamPolicy(bucket string, policy *Policy) *BucketsSetIamPolicyCall {
  3877. c := &BucketsSetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3878. c.bucket = bucket
  3879. c.policy = policy
  3880. return c
  3881. }
  3882. // UserProject sets the optional parameter "userProject": The project to
  3883. // be billed for this request. Required for Requester Pays buckets.
  3884. func (c *BucketsSetIamPolicyCall) UserProject(userProject string) *BucketsSetIamPolicyCall {
  3885. c.urlParams_.Set("userProject", userProject)
  3886. return c
  3887. }
  3888. // Fields allows partial responses to be retrieved. See
  3889. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3890. // for more information.
  3891. func (c *BucketsSetIamPolicyCall) Fields(s ...googleapi.Field) *BucketsSetIamPolicyCall {
  3892. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3893. return c
  3894. }
  3895. // Context sets the context to be used in this call's Do method. Any
  3896. // pending HTTP request will be aborted if the provided context is
  3897. // canceled.
  3898. func (c *BucketsSetIamPolicyCall) Context(ctx context.Context) *BucketsSetIamPolicyCall {
  3899. c.ctx_ = ctx
  3900. return c
  3901. }
  3902. // Header returns an http.Header that can be modified by the caller to
  3903. // add HTTP headers to the request.
  3904. func (c *BucketsSetIamPolicyCall) Header() http.Header {
  3905. if c.header_ == nil {
  3906. c.header_ = make(http.Header)
  3907. }
  3908. return c.header_
  3909. }
  3910. func (c *BucketsSetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
  3911. reqHeaders := make(http.Header)
  3912. for k, v := range c.header_ {
  3913. reqHeaders[k] = v
  3914. }
  3915. reqHeaders.Set("User-Agent", c.s.userAgent())
  3916. var body io.Reader = nil
  3917. body, err := googleapi.WithoutDataWrapper.JSONReader(c.policy)
  3918. if err != nil {
  3919. return nil, err
  3920. }
  3921. reqHeaders.Set("Content-Type", "application/json")
  3922. c.urlParams_.Set("alt", alt)
  3923. c.urlParams_.Set("prettyPrint", "false")
  3924. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/iam")
  3925. urls += "?" + c.urlParams_.Encode()
  3926. req, err := http.NewRequest("PUT", urls, body)
  3927. if err != nil {
  3928. return nil, err
  3929. }
  3930. req.Header = reqHeaders
  3931. googleapi.Expand(req.URL, map[string]string{
  3932. "bucket": c.bucket,
  3933. })
  3934. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3935. }
  3936. // Do executes the "storage.buckets.setIamPolicy" call.
  3937. // Exactly one of *Policy or error will be non-nil. Any non-2xx status
  3938. // code is an error. Response headers are in either
  3939. // *Policy.ServerResponse.Header or (if a response was returned at all)
  3940. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3941. // check whether the returned error was because http.StatusNotModified
  3942. // was returned.
  3943. func (c *BucketsSetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) {
  3944. gensupport.SetOptions(c.urlParams_, opts...)
  3945. res, err := c.doRequest("json")
  3946. if res != nil && res.StatusCode == http.StatusNotModified {
  3947. if res.Body != nil {
  3948. res.Body.Close()
  3949. }
  3950. return nil, &googleapi.Error{
  3951. Code: res.StatusCode,
  3952. Header: res.Header,
  3953. }
  3954. }
  3955. if err != nil {
  3956. return nil, err
  3957. }
  3958. defer googleapi.CloseBody(res)
  3959. if err := googleapi.CheckResponse(res); err != nil {
  3960. return nil, err
  3961. }
  3962. ret := &Policy{
  3963. ServerResponse: googleapi.ServerResponse{
  3964. Header: res.Header,
  3965. HTTPStatusCode: res.StatusCode,
  3966. },
  3967. }
  3968. target := &ret
  3969. if err := gensupport.DecodeResponse(target, res); err != nil {
  3970. return nil, err
  3971. }
  3972. return ret, nil
  3973. // {
  3974. // "description": "Updates an IAM policy for the specified bucket.",
  3975. // "httpMethod": "PUT",
  3976. // "id": "storage.buckets.setIamPolicy",
  3977. // "parameterOrder": [
  3978. // "bucket"
  3979. // ],
  3980. // "parameters": {
  3981. // "bucket": {
  3982. // "description": "Name of a bucket.",
  3983. // "location": "path",
  3984. // "required": true,
  3985. // "type": "string"
  3986. // },
  3987. // "userProject": {
  3988. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  3989. // "location": "query",
  3990. // "type": "string"
  3991. // }
  3992. // },
  3993. // "path": "b/{bucket}/iam",
  3994. // "request": {
  3995. // "$ref": "Policy"
  3996. // },
  3997. // "response": {
  3998. // "$ref": "Policy"
  3999. // },
  4000. // "scopes": [
  4001. // "https://www.googleapis.com/auth/cloud-platform",
  4002. // "https://www.googleapis.com/auth/devstorage.full_control",
  4003. // "https://www.googleapis.com/auth/devstorage.read_write"
  4004. // ]
  4005. // }
  4006. }
  4007. // method id "storage.buckets.testIamPermissions":
  4008. type BucketsTestIamPermissionsCall struct {
  4009. s *Service
  4010. bucket string
  4011. urlParams_ gensupport.URLParams
  4012. ifNoneMatch_ string
  4013. ctx_ context.Context
  4014. header_ http.Header
  4015. }
  4016. // TestIamPermissions: Tests a set of permissions on the given bucket to
  4017. // see which, if any, are held by the caller.
  4018. func (r *BucketsService) TestIamPermissions(bucket string, permissions []string) *BucketsTestIamPermissionsCall {
  4019. c := &BucketsTestIamPermissionsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4020. c.bucket = bucket
  4021. c.urlParams_.SetMulti("permissions", append([]string{}, permissions...))
  4022. return c
  4023. }
  4024. // UserProject sets the optional parameter "userProject": The project to
  4025. // be billed for this request. Required for Requester Pays buckets.
  4026. func (c *BucketsTestIamPermissionsCall) UserProject(userProject string) *BucketsTestIamPermissionsCall {
  4027. c.urlParams_.Set("userProject", userProject)
  4028. return c
  4029. }
  4030. // Fields allows partial responses to be retrieved. See
  4031. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4032. // for more information.
  4033. func (c *BucketsTestIamPermissionsCall) Fields(s ...googleapi.Field) *BucketsTestIamPermissionsCall {
  4034. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4035. return c
  4036. }
  4037. // IfNoneMatch sets the optional parameter which makes the operation
  4038. // fail if the object's ETag matches the given value. This is useful for
  4039. // getting updates only after the object has changed since the last
  4040. // request. Use googleapi.IsNotModified to check whether the response
  4041. // error from Do is the result of In-None-Match.
  4042. func (c *BucketsTestIamPermissionsCall) IfNoneMatch(entityTag string) *BucketsTestIamPermissionsCall {
  4043. c.ifNoneMatch_ = entityTag
  4044. return c
  4045. }
  4046. // Context sets the context to be used in this call's Do method. Any
  4047. // pending HTTP request will be aborted if the provided context is
  4048. // canceled.
  4049. func (c *BucketsTestIamPermissionsCall) Context(ctx context.Context) *BucketsTestIamPermissionsCall {
  4050. c.ctx_ = ctx
  4051. return c
  4052. }
  4053. // Header returns an http.Header that can be modified by the caller to
  4054. // add HTTP headers to the request.
  4055. func (c *BucketsTestIamPermissionsCall) Header() http.Header {
  4056. if c.header_ == nil {
  4057. c.header_ = make(http.Header)
  4058. }
  4059. return c.header_
  4060. }
  4061. func (c *BucketsTestIamPermissionsCall) doRequest(alt string) (*http.Response, error) {
  4062. reqHeaders := make(http.Header)
  4063. for k, v := range c.header_ {
  4064. reqHeaders[k] = v
  4065. }
  4066. reqHeaders.Set("User-Agent", c.s.userAgent())
  4067. if c.ifNoneMatch_ != "" {
  4068. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  4069. }
  4070. var body io.Reader = nil
  4071. c.urlParams_.Set("alt", alt)
  4072. c.urlParams_.Set("prettyPrint", "false")
  4073. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/iam/testPermissions")
  4074. urls += "?" + c.urlParams_.Encode()
  4075. req, err := http.NewRequest("GET", urls, body)
  4076. if err != nil {
  4077. return nil, err
  4078. }
  4079. req.Header = reqHeaders
  4080. googleapi.Expand(req.URL, map[string]string{
  4081. "bucket": c.bucket,
  4082. })
  4083. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4084. }
  4085. // Do executes the "storage.buckets.testIamPermissions" call.
  4086. // Exactly one of *TestIamPermissionsResponse or error will be non-nil.
  4087. // Any non-2xx status code is an error. Response headers are in either
  4088. // *TestIamPermissionsResponse.ServerResponse.Header or (if a response
  4089. // was returned at all) in error.(*googleapi.Error).Header. Use
  4090. // googleapi.IsNotModified to check whether the returned error was
  4091. // because http.StatusNotModified was returned.
  4092. func (c *BucketsTestIamPermissionsCall) Do(opts ...googleapi.CallOption) (*TestIamPermissionsResponse, error) {
  4093. gensupport.SetOptions(c.urlParams_, opts...)
  4094. res, err := c.doRequest("json")
  4095. if res != nil && res.StatusCode == http.StatusNotModified {
  4096. if res.Body != nil {
  4097. res.Body.Close()
  4098. }
  4099. return nil, &googleapi.Error{
  4100. Code: res.StatusCode,
  4101. Header: res.Header,
  4102. }
  4103. }
  4104. if err != nil {
  4105. return nil, err
  4106. }
  4107. defer googleapi.CloseBody(res)
  4108. if err := googleapi.CheckResponse(res); err != nil {
  4109. return nil, err
  4110. }
  4111. ret := &TestIamPermissionsResponse{
  4112. ServerResponse: googleapi.ServerResponse{
  4113. Header: res.Header,
  4114. HTTPStatusCode: res.StatusCode,
  4115. },
  4116. }
  4117. target := &ret
  4118. if err := gensupport.DecodeResponse(target, res); err != nil {
  4119. return nil, err
  4120. }
  4121. return ret, nil
  4122. // {
  4123. // "description": "Tests a set of permissions on the given bucket to see which, if any, are held by the caller.",
  4124. // "httpMethod": "GET",
  4125. // "id": "storage.buckets.testIamPermissions",
  4126. // "parameterOrder": [
  4127. // "bucket",
  4128. // "permissions"
  4129. // ],
  4130. // "parameters": {
  4131. // "bucket": {
  4132. // "description": "Name of a bucket.",
  4133. // "location": "path",
  4134. // "required": true,
  4135. // "type": "string"
  4136. // },
  4137. // "permissions": {
  4138. // "description": "Permissions to test.",
  4139. // "location": "query",
  4140. // "repeated": true,
  4141. // "required": true,
  4142. // "type": "string"
  4143. // },
  4144. // "userProject": {
  4145. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  4146. // "location": "query",
  4147. // "type": "string"
  4148. // }
  4149. // },
  4150. // "path": "b/{bucket}/iam/testPermissions",
  4151. // "response": {
  4152. // "$ref": "TestIamPermissionsResponse"
  4153. // },
  4154. // "scopes": [
  4155. // "https://www.googleapis.com/auth/cloud-platform",
  4156. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  4157. // "https://www.googleapis.com/auth/devstorage.full_control",
  4158. // "https://www.googleapis.com/auth/devstorage.read_only",
  4159. // "https://www.googleapis.com/auth/devstorage.read_write"
  4160. // ]
  4161. // }
  4162. }
  4163. // method id "storage.buckets.update":
  4164. type BucketsUpdateCall struct {
  4165. s *Service
  4166. bucket string
  4167. bucket2 *Bucket
  4168. urlParams_ gensupport.URLParams
  4169. ctx_ context.Context
  4170. header_ http.Header
  4171. }
  4172. // Update: Updates a bucket. Changes to the bucket will be readable
  4173. // immediately after writing, but configuration changes may take time to
  4174. // propagate.
  4175. func (r *BucketsService) Update(bucket string, bucket2 *Bucket) *BucketsUpdateCall {
  4176. c := &BucketsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4177. c.bucket = bucket
  4178. c.bucket2 = bucket2
  4179. return c
  4180. }
  4181. // IfMetagenerationMatch sets the optional parameter
  4182. // "ifMetagenerationMatch": Makes the return of the bucket metadata
  4183. // conditional on whether the bucket's current metageneration matches
  4184. // the given value.
  4185. func (c *BucketsUpdateCall) IfMetagenerationMatch(ifMetagenerationMatch int64) *BucketsUpdateCall {
  4186. c.urlParams_.Set("ifMetagenerationMatch", fmt.Sprint(ifMetagenerationMatch))
  4187. return c
  4188. }
  4189. // IfMetagenerationNotMatch sets the optional parameter
  4190. // "ifMetagenerationNotMatch": Makes the return of the bucket metadata
  4191. // conditional on whether the bucket's current metageneration does not
  4192. // match the given value.
  4193. func (c *BucketsUpdateCall) IfMetagenerationNotMatch(ifMetagenerationNotMatch int64) *BucketsUpdateCall {
  4194. c.urlParams_.Set("ifMetagenerationNotMatch", fmt.Sprint(ifMetagenerationNotMatch))
  4195. return c
  4196. }
  4197. // PredefinedAcl sets the optional parameter "predefinedAcl": Apply a
  4198. // predefined set of access controls to this bucket.
  4199. //
  4200. // Possible values:
  4201. // "authenticatedRead" - Project team owners get OWNER access, and
  4202. // allAuthenticatedUsers get READER access.
  4203. // "private" - Project team owners get OWNER access.
  4204. // "projectPrivate" - Project team members get access according to
  4205. // their roles.
  4206. // "publicRead" - Project team owners get OWNER access, and allUsers
  4207. // get READER access.
  4208. // "publicReadWrite" - Project team owners get OWNER access, and
  4209. // allUsers get WRITER access.
  4210. func (c *BucketsUpdateCall) PredefinedAcl(predefinedAcl string) *BucketsUpdateCall {
  4211. c.urlParams_.Set("predefinedAcl", predefinedAcl)
  4212. return c
  4213. }
  4214. // PredefinedDefaultObjectAcl sets the optional parameter
  4215. // "predefinedDefaultObjectAcl": Apply a predefined set of default
  4216. // object access controls to this bucket.
  4217. //
  4218. // Possible values:
  4219. // "authenticatedRead" - Object owner gets OWNER access, and
  4220. // allAuthenticatedUsers get READER access.
  4221. // "bucketOwnerFullControl" - Object owner gets OWNER access, and
  4222. // project team owners get OWNER access.
  4223. // "bucketOwnerRead" - Object owner gets OWNER access, and project
  4224. // team owners get READER access.
  4225. // "private" - Object owner gets OWNER access.
  4226. // "projectPrivate" - Object owner gets OWNER access, and project team
  4227. // members get access according to their roles.
  4228. // "publicRead" - Object owner gets OWNER access, and allUsers get
  4229. // READER access.
  4230. func (c *BucketsUpdateCall) PredefinedDefaultObjectAcl(predefinedDefaultObjectAcl string) *BucketsUpdateCall {
  4231. c.urlParams_.Set("predefinedDefaultObjectAcl", predefinedDefaultObjectAcl)
  4232. return c
  4233. }
  4234. // Projection sets the optional parameter "projection": Set of
  4235. // properties to return. Defaults to full.
  4236. //
  4237. // Possible values:
  4238. // "full" - Include all properties.
  4239. // "noAcl" - Omit owner, acl and defaultObjectAcl properties.
  4240. func (c *BucketsUpdateCall) Projection(projection string) *BucketsUpdateCall {
  4241. c.urlParams_.Set("projection", projection)
  4242. return c
  4243. }
  4244. // UserProject sets the optional parameter "userProject": The project to
  4245. // be billed for this request. Required for Requester Pays buckets.
  4246. func (c *BucketsUpdateCall) UserProject(userProject string) *BucketsUpdateCall {
  4247. c.urlParams_.Set("userProject", userProject)
  4248. return c
  4249. }
  4250. // Fields allows partial responses to be retrieved. See
  4251. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4252. // for more information.
  4253. func (c *BucketsUpdateCall) Fields(s ...googleapi.Field) *BucketsUpdateCall {
  4254. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4255. return c
  4256. }
  4257. // Context sets the context to be used in this call's Do method. Any
  4258. // pending HTTP request will be aborted if the provided context is
  4259. // canceled.
  4260. func (c *BucketsUpdateCall) Context(ctx context.Context) *BucketsUpdateCall {
  4261. c.ctx_ = ctx
  4262. return c
  4263. }
  4264. // Header returns an http.Header that can be modified by the caller to
  4265. // add HTTP headers to the request.
  4266. func (c *BucketsUpdateCall) Header() http.Header {
  4267. if c.header_ == nil {
  4268. c.header_ = make(http.Header)
  4269. }
  4270. return c.header_
  4271. }
  4272. func (c *BucketsUpdateCall) doRequest(alt string) (*http.Response, error) {
  4273. reqHeaders := make(http.Header)
  4274. for k, v := range c.header_ {
  4275. reqHeaders[k] = v
  4276. }
  4277. reqHeaders.Set("User-Agent", c.s.userAgent())
  4278. var body io.Reader = nil
  4279. body, err := googleapi.WithoutDataWrapper.JSONReader(c.bucket2)
  4280. if err != nil {
  4281. return nil, err
  4282. }
  4283. reqHeaders.Set("Content-Type", "application/json")
  4284. c.urlParams_.Set("alt", alt)
  4285. c.urlParams_.Set("prettyPrint", "false")
  4286. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}")
  4287. urls += "?" + c.urlParams_.Encode()
  4288. req, err := http.NewRequest("PUT", urls, body)
  4289. if err != nil {
  4290. return nil, err
  4291. }
  4292. req.Header = reqHeaders
  4293. googleapi.Expand(req.URL, map[string]string{
  4294. "bucket": c.bucket,
  4295. })
  4296. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4297. }
  4298. // Do executes the "storage.buckets.update" call.
  4299. // Exactly one of *Bucket or error will be non-nil. Any non-2xx status
  4300. // code is an error. Response headers are in either
  4301. // *Bucket.ServerResponse.Header or (if a response was returned at all)
  4302. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  4303. // check whether the returned error was because http.StatusNotModified
  4304. // was returned.
  4305. func (c *BucketsUpdateCall) Do(opts ...googleapi.CallOption) (*Bucket, error) {
  4306. gensupport.SetOptions(c.urlParams_, opts...)
  4307. res, err := c.doRequest("json")
  4308. if res != nil && res.StatusCode == http.StatusNotModified {
  4309. if res.Body != nil {
  4310. res.Body.Close()
  4311. }
  4312. return nil, &googleapi.Error{
  4313. Code: res.StatusCode,
  4314. Header: res.Header,
  4315. }
  4316. }
  4317. if err != nil {
  4318. return nil, err
  4319. }
  4320. defer googleapi.CloseBody(res)
  4321. if err := googleapi.CheckResponse(res); err != nil {
  4322. return nil, err
  4323. }
  4324. ret := &Bucket{
  4325. ServerResponse: googleapi.ServerResponse{
  4326. Header: res.Header,
  4327. HTTPStatusCode: res.StatusCode,
  4328. },
  4329. }
  4330. target := &ret
  4331. if err := gensupport.DecodeResponse(target, res); err != nil {
  4332. return nil, err
  4333. }
  4334. return ret, nil
  4335. // {
  4336. // "description": "Updates a bucket. Changes to the bucket will be readable immediately after writing, but configuration changes may take time to propagate.",
  4337. // "httpMethod": "PUT",
  4338. // "id": "storage.buckets.update",
  4339. // "parameterOrder": [
  4340. // "bucket"
  4341. // ],
  4342. // "parameters": {
  4343. // "bucket": {
  4344. // "description": "Name of a bucket.",
  4345. // "location": "path",
  4346. // "required": true,
  4347. // "type": "string"
  4348. // },
  4349. // "ifMetagenerationMatch": {
  4350. // "description": "Makes the return of the bucket metadata conditional on whether the bucket's current metageneration matches the given value.",
  4351. // "format": "int64",
  4352. // "location": "query",
  4353. // "type": "string"
  4354. // },
  4355. // "ifMetagenerationNotMatch": {
  4356. // "description": "Makes the return of the bucket metadata conditional on whether the bucket's current metageneration does not match the given value.",
  4357. // "format": "int64",
  4358. // "location": "query",
  4359. // "type": "string"
  4360. // },
  4361. // "predefinedAcl": {
  4362. // "description": "Apply a predefined set of access controls to this bucket.",
  4363. // "enum": [
  4364. // "authenticatedRead",
  4365. // "private",
  4366. // "projectPrivate",
  4367. // "publicRead",
  4368. // "publicReadWrite"
  4369. // ],
  4370. // "enumDescriptions": [
  4371. // "Project team owners get OWNER access, and allAuthenticatedUsers get READER access.",
  4372. // "Project team owners get OWNER access.",
  4373. // "Project team members get access according to their roles.",
  4374. // "Project team owners get OWNER access, and allUsers get READER access.",
  4375. // "Project team owners get OWNER access, and allUsers get WRITER access."
  4376. // ],
  4377. // "location": "query",
  4378. // "type": "string"
  4379. // },
  4380. // "predefinedDefaultObjectAcl": {
  4381. // "description": "Apply a predefined set of default object access controls to this bucket.",
  4382. // "enum": [
  4383. // "authenticatedRead",
  4384. // "bucketOwnerFullControl",
  4385. // "bucketOwnerRead",
  4386. // "private",
  4387. // "projectPrivate",
  4388. // "publicRead"
  4389. // ],
  4390. // "enumDescriptions": [
  4391. // "Object owner gets OWNER access, and allAuthenticatedUsers get READER access.",
  4392. // "Object owner gets OWNER access, and project team owners get OWNER access.",
  4393. // "Object owner gets OWNER access, and project team owners get READER access.",
  4394. // "Object owner gets OWNER access.",
  4395. // "Object owner gets OWNER access, and project team members get access according to their roles.",
  4396. // "Object owner gets OWNER access, and allUsers get READER access."
  4397. // ],
  4398. // "location": "query",
  4399. // "type": "string"
  4400. // },
  4401. // "projection": {
  4402. // "description": "Set of properties to return. Defaults to full.",
  4403. // "enum": [
  4404. // "full",
  4405. // "noAcl"
  4406. // ],
  4407. // "enumDescriptions": [
  4408. // "Include all properties.",
  4409. // "Omit owner, acl and defaultObjectAcl properties."
  4410. // ],
  4411. // "location": "query",
  4412. // "type": "string"
  4413. // },
  4414. // "userProject": {
  4415. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  4416. // "location": "query",
  4417. // "type": "string"
  4418. // }
  4419. // },
  4420. // "path": "b/{bucket}",
  4421. // "request": {
  4422. // "$ref": "Bucket"
  4423. // },
  4424. // "response": {
  4425. // "$ref": "Bucket"
  4426. // },
  4427. // "scopes": [
  4428. // "https://www.googleapis.com/auth/cloud-platform",
  4429. // "https://www.googleapis.com/auth/devstorage.full_control"
  4430. // ]
  4431. // }
  4432. }
  4433. // method id "storage.channels.stop":
  4434. type ChannelsStopCall struct {
  4435. s *Service
  4436. channel *Channel
  4437. urlParams_ gensupport.URLParams
  4438. ctx_ context.Context
  4439. header_ http.Header
  4440. }
  4441. // Stop: Stop watching resources through this channel
  4442. func (r *ChannelsService) Stop(channel *Channel) *ChannelsStopCall {
  4443. c := &ChannelsStopCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4444. c.channel = channel
  4445. return c
  4446. }
  4447. // Fields allows partial responses to be retrieved. See
  4448. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4449. // for more information.
  4450. func (c *ChannelsStopCall) Fields(s ...googleapi.Field) *ChannelsStopCall {
  4451. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4452. return c
  4453. }
  4454. // Context sets the context to be used in this call's Do method. Any
  4455. // pending HTTP request will be aborted if the provided context is
  4456. // canceled.
  4457. func (c *ChannelsStopCall) Context(ctx context.Context) *ChannelsStopCall {
  4458. c.ctx_ = ctx
  4459. return c
  4460. }
  4461. // Header returns an http.Header that can be modified by the caller to
  4462. // add HTTP headers to the request.
  4463. func (c *ChannelsStopCall) Header() http.Header {
  4464. if c.header_ == nil {
  4465. c.header_ = make(http.Header)
  4466. }
  4467. return c.header_
  4468. }
  4469. func (c *ChannelsStopCall) doRequest(alt string) (*http.Response, error) {
  4470. reqHeaders := make(http.Header)
  4471. for k, v := range c.header_ {
  4472. reqHeaders[k] = v
  4473. }
  4474. reqHeaders.Set("User-Agent", c.s.userAgent())
  4475. var body io.Reader = nil
  4476. body, err := googleapi.WithoutDataWrapper.JSONReader(c.channel)
  4477. if err != nil {
  4478. return nil, err
  4479. }
  4480. reqHeaders.Set("Content-Type", "application/json")
  4481. c.urlParams_.Set("alt", alt)
  4482. c.urlParams_.Set("prettyPrint", "false")
  4483. urls := googleapi.ResolveRelative(c.s.BasePath, "channels/stop")
  4484. urls += "?" + c.urlParams_.Encode()
  4485. req, err := http.NewRequest("POST", urls, body)
  4486. if err != nil {
  4487. return nil, err
  4488. }
  4489. req.Header = reqHeaders
  4490. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4491. }
  4492. // Do executes the "storage.channels.stop" call.
  4493. func (c *ChannelsStopCall) Do(opts ...googleapi.CallOption) error {
  4494. gensupport.SetOptions(c.urlParams_, opts...)
  4495. res, err := c.doRequest("json")
  4496. if err != nil {
  4497. return err
  4498. }
  4499. defer googleapi.CloseBody(res)
  4500. if err := googleapi.CheckResponse(res); err != nil {
  4501. return err
  4502. }
  4503. return nil
  4504. // {
  4505. // "description": "Stop watching resources through this channel",
  4506. // "httpMethod": "POST",
  4507. // "id": "storage.channels.stop",
  4508. // "path": "channels/stop",
  4509. // "request": {
  4510. // "$ref": "Channel",
  4511. // "parameterName": "resource"
  4512. // },
  4513. // "scopes": [
  4514. // "https://www.googleapis.com/auth/cloud-platform",
  4515. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  4516. // "https://www.googleapis.com/auth/devstorage.full_control",
  4517. // "https://www.googleapis.com/auth/devstorage.read_only",
  4518. // "https://www.googleapis.com/auth/devstorage.read_write"
  4519. // ]
  4520. // }
  4521. }
  4522. // method id "storage.defaultObjectAccessControls.delete":
  4523. type DefaultObjectAccessControlsDeleteCall struct {
  4524. s *Service
  4525. bucket string
  4526. entity string
  4527. urlParams_ gensupport.URLParams
  4528. ctx_ context.Context
  4529. header_ http.Header
  4530. }
  4531. // Delete: Permanently deletes the default object ACL entry for the
  4532. // specified entity on the specified bucket.
  4533. func (r *DefaultObjectAccessControlsService) Delete(bucket string, entity string) *DefaultObjectAccessControlsDeleteCall {
  4534. c := &DefaultObjectAccessControlsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4535. c.bucket = bucket
  4536. c.entity = entity
  4537. return c
  4538. }
  4539. // UserProject sets the optional parameter "userProject": The project to
  4540. // be billed for this request. Required for Requester Pays buckets.
  4541. func (c *DefaultObjectAccessControlsDeleteCall) UserProject(userProject string) *DefaultObjectAccessControlsDeleteCall {
  4542. c.urlParams_.Set("userProject", userProject)
  4543. return c
  4544. }
  4545. // Fields allows partial responses to be retrieved. See
  4546. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4547. // for more information.
  4548. func (c *DefaultObjectAccessControlsDeleteCall) Fields(s ...googleapi.Field) *DefaultObjectAccessControlsDeleteCall {
  4549. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4550. return c
  4551. }
  4552. // Context sets the context to be used in this call's Do method. Any
  4553. // pending HTTP request will be aborted if the provided context is
  4554. // canceled.
  4555. func (c *DefaultObjectAccessControlsDeleteCall) Context(ctx context.Context) *DefaultObjectAccessControlsDeleteCall {
  4556. c.ctx_ = ctx
  4557. return c
  4558. }
  4559. // Header returns an http.Header that can be modified by the caller to
  4560. // add HTTP headers to the request.
  4561. func (c *DefaultObjectAccessControlsDeleteCall) Header() http.Header {
  4562. if c.header_ == nil {
  4563. c.header_ = make(http.Header)
  4564. }
  4565. return c.header_
  4566. }
  4567. func (c *DefaultObjectAccessControlsDeleteCall) doRequest(alt string) (*http.Response, error) {
  4568. reqHeaders := make(http.Header)
  4569. for k, v := range c.header_ {
  4570. reqHeaders[k] = v
  4571. }
  4572. reqHeaders.Set("User-Agent", c.s.userAgent())
  4573. var body io.Reader = nil
  4574. c.urlParams_.Set("alt", alt)
  4575. c.urlParams_.Set("prettyPrint", "false")
  4576. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/defaultObjectAcl/{entity}")
  4577. urls += "?" + c.urlParams_.Encode()
  4578. req, err := http.NewRequest("DELETE", urls, body)
  4579. if err != nil {
  4580. return nil, err
  4581. }
  4582. req.Header = reqHeaders
  4583. googleapi.Expand(req.URL, map[string]string{
  4584. "bucket": c.bucket,
  4585. "entity": c.entity,
  4586. })
  4587. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4588. }
  4589. // Do executes the "storage.defaultObjectAccessControls.delete" call.
  4590. func (c *DefaultObjectAccessControlsDeleteCall) Do(opts ...googleapi.CallOption) error {
  4591. gensupport.SetOptions(c.urlParams_, opts...)
  4592. res, err := c.doRequest("json")
  4593. if err != nil {
  4594. return err
  4595. }
  4596. defer googleapi.CloseBody(res)
  4597. if err := googleapi.CheckResponse(res); err != nil {
  4598. return err
  4599. }
  4600. return nil
  4601. // {
  4602. // "description": "Permanently deletes the default object ACL entry for the specified entity on the specified bucket.",
  4603. // "httpMethod": "DELETE",
  4604. // "id": "storage.defaultObjectAccessControls.delete",
  4605. // "parameterOrder": [
  4606. // "bucket",
  4607. // "entity"
  4608. // ],
  4609. // "parameters": {
  4610. // "bucket": {
  4611. // "description": "Name of a bucket.",
  4612. // "location": "path",
  4613. // "required": true,
  4614. // "type": "string"
  4615. // },
  4616. // "entity": {
  4617. // "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.",
  4618. // "location": "path",
  4619. // "required": true,
  4620. // "type": "string"
  4621. // },
  4622. // "userProject": {
  4623. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  4624. // "location": "query",
  4625. // "type": "string"
  4626. // }
  4627. // },
  4628. // "path": "b/{bucket}/defaultObjectAcl/{entity}",
  4629. // "scopes": [
  4630. // "https://www.googleapis.com/auth/cloud-platform",
  4631. // "https://www.googleapis.com/auth/devstorage.full_control"
  4632. // ]
  4633. // }
  4634. }
  4635. // method id "storage.defaultObjectAccessControls.get":
  4636. type DefaultObjectAccessControlsGetCall struct {
  4637. s *Service
  4638. bucket string
  4639. entity string
  4640. urlParams_ gensupport.URLParams
  4641. ifNoneMatch_ string
  4642. ctx_ context.Context
  4643. header_ http.Header
  4644. }
  4645. // Get: Returns the default object ACL entry for the specified entity on
  4646. // the specified bucket.
  4647. func (r *DefaultObjectAccessControlsService) Get(bucket string, entity string) *DefaultObjectAccessControlsGetCall {
  4648. c := &DefaultObjectAccessControlsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4649. c.bucket = bucket
  4650. c.entity = entity
  4651. return c
  4652. }
  4653. // UserProject sets the optional parameter "userProject": The project to
  4654. // be billed for this request. Required for Requester Pays buckets.
  4655. func (c *DefaultObjectAccessControlsGetCall) UserProject(userProject string) *DefaultObjectAccessControlsGetCall {
  4656. c.urlParams_.Set("userProject", userProject)
  4657. return c
  4658. }
  4659. // Fields allows partial responses to be retrieved. See
  4660. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4661. // for more information.
  4662. func (c *DefaultObjectAccessControlsGetCall) Fields(s ...googleapi.Field) *DefaultObjectAccessControlsGetCall {
  4663. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4664. return c
  4665. }
  4666. // IfNoneMatch sets the optional parameter which makes the operation
  4667. // fail if the object's ETag matches the given value. This is useful for
  4668. // getting updates only after the object has changed since the last
  4669. // request. Use googleapi.IsNotModified to check whether the response
  4670. // error from Do is the result of In-None-Match.
  4671. func (c *DefaultObjectAccessControlsGetCall) IfNoneMatch(entityTag string) *DefaultObjectAccessControlsGetCall {
  4672. c.ifNoneMatch_ = entityTag
  4673. return c
  4674. }
  4675. // Context sets the context to be used in this call's Do method. Any
  4676. // pending HTTP request will be aborted if the provided context is
  4677. // canceled.
  4678. func (c *DefaultObjectAccessControlsGetCall) Context(ctx context.Context) *DefaultObjectAccessControlsGetCall {
  4679. c.ctx_ = ctx
  4680. return c
  4681. }
  4682. // Header returns an http.Header that can be modified by the caller to
  4683. // add HTTP headers to the request.
  4684. func (c *DefaultObjectAccessControlsGetCall) Header() http.Header {
  4685. if c.header_ == nil {
  4686. c.header_ = make(http.Header)
  4687. }
  4688. return c.header_
  4689. }
  4690. func (c *DefaultObjectAccessControlsGetCall) doRequest(alt string) (*http.Response, error) {
  4691. reqHeaders := make(http.Header)
  4692. for k, v := range c.header_ {
  4693. reqHeaders[k] = v
  4694. }
  4695. reqHeaders.Set("User-Agent", c.s.userAgent())
  4696. if c.ifNoneMatch_ != "" {
  4697. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  4698. }
  4699. var body io.Reader = nil
  4700. c.urlParams_.Set("alt", alt)
  4701. c.urlParams_.Set("prettyPrint", "false")
  4702. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/defaultObjectAcl/{entity}")
  4703. urls += "?" + c.urlParams_.Encode()
  4704. req, err := http.NewRequest("GET", urls, body)
  4705. if err != nil {
  4706. return nil, err
  4707. }
  4708. req.Header = reqHeaders
  4709. googleapi.Expand(req.URL, map[string]string{
  4710. "bucket": c.bucket,
  4711. "entity": c.entity,
  4712. })
  4713. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4714. }
  4715. // Do executes the "storage.defaultObjectAccessControls.get" call.
  4716. // Exactly one of *ObjectAccessControl or error will be non-nil. Any
  4717. // non-2xx status code is an error. Response headers are in either
  4718. // *ObjectAccessControl.ServerResponse.Header or (if a response was
  4719. // returned at all) in error.(*googleapi.Error).Header. Use
  4720. // googleapi.IsNotModified to check whether the returned error was
  4721. // because http.StatusNotModified was returned.
  4722. func (c *DefaultObjectAccessControlsGetCall) Do(opts ...googleapi.CallOption) (*ObjectAccessControl, error) {
  4723. gensupport.SetOptions(c.urlParams_, opts...)
  4724. res, err := c.doRequest("json")
  4725. if res != nil && res.StatusCode == http.StatusNotModified {
  4726. if res.Body != nil {
  4727. res.Body.Close()
  4728. }
  4729. return nil, &googleapi.Error{
  4730. Code: res.StatusCode,
  4731. Header: res.Header,
  4732. }
  4733. }
  4734. if err != nil {
  4735. return nil, err
  4736. }
  4737. defer googleapi.CloseBody(res)
  4738. if err := googleapi.CheckResponse(res); err != nil {
  4739. return nil, err
  4740. }
  4741. ret := &ObjectAccessControl{
  4742. ServerResponse: googleapi.ServerResponse{
  4743. Header: res.Header,
  4744. HTTPStatusCode: res.StatusCode,
  4745. },
  4746. }
  4747. target := &ret
  4748. if err := gensupport.DecodeResponse(target, res); err != nil {
  4749. return nil, err
  4750. }
  4751. return ret, nil
  4752. // {
  4753. // "description": "Returns the default object ACL entry for the specified entity on the specified bucket.",
  4754. // "httpMethod": "GET",
  4755. // "id": "storage.defaultObjectAccessControls.get",
  4756. // "parameterOrder": [
  4757. // "bucket",
  4758. // "entity"
  4759. // ],
  4760. // "parameters": {
  4761. // "bucket": {
  4762. // "description": "Name of a bucket.",
  4763. // "location": "path",
  4764. // "required": true,
  4765. // "type": "string"
  4766. // },
  4767. // "entity": {
  4768. // "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.",
  4769. // "location": "path",
  4770. // "required": true,
  4771. // "type": "string"
  4772. // },
  4773. // "userProject": {
  4774. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  4775. // "location": "query",
  4776. // "type": "string"
  4777. // }
  4778. // },
  4779. // "path": "b/{bucket}/defaultObjectAcl/{entity}",
  4780. // "response": {
  4781. // "$ref": "ObjectAccessControl"
  4782. // },
  4783. // "scopes": [
  4784. // "https://www.googleapis.com/auth/cloud-platform",
  4785. // "https://www.googleapis.com/auth/devstorage.full_control"
  4786. // ]
  4787. // }
  4788. }
  4789. // method id "storage.defaultObjectAccessControls.insert":
  4790. type DefaultObjectAccessControlsInsertCall struct {
  4791. s *Service
  4792. bucket string
  4793. objectaccesscontrol *ObjectAccessControl
  4794. urlParams_ gensupport.URLParams
  4795. ctx_ context.Context
  4796. header_ http.Header
  4797. }
  4798. // Insert: Creates a new default object ACL entry on the specified
  4799. // bucket.
  4800. func (r *DefaultObjectAccessControlsService) Insert(bucket string, objectaccesscontrol *ObjectAccessControl) *DefaultObjectAccessControlsInsertCall {
  4801. c := &DefaultObjectAccessControlsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4802. c.bucket = bucket
  4803. c.objectaccesscontrol = objectaccesscontrol
  4804. return c
  4805. }
  4806. // UserProject sets the optional parameter "userProject": The project to
  4807. // be billed for this request. Required for Requester Pays buckets.
  4808. func (c *DefaultObjectAccessControlsInsertCall) UserProject(userProject string) *DefaultObjectAccessControlsInsertCall {
  4809. c.urlParams_.Set("userProject", userProject)
  4810. return c
  4811. }
  4812. // Fields allows partial responses to be retrieved. See
  4813. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4814. // for more information.
  4815. func (c *DefaultObjectAccessControlsInsertCall) Fields(s ...googleapi.Field) *DefaultObjectAccessControlsInsertCall {
  4816. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4817. return c
  4818. }
  4819. // Context sets the context to be used in this call's Do method. Any
  4820. // pending HTTP request will be aborted if the provided context is
  4821. // canceled.
  4822. func (c *DefaultObjectAccessControlsInsertCall) Context(ctx context.Context) *DefaultObjectAccessControlsInsertCall {
  4823. c.ctx_ = ctx
  4824. return c
  4825. }
  4826. // Header returns an http.Header that can be modified by the caller to
  4827. // add HTTP headers to the request.
  4828. func (c *DefaultObjectAccessControlsInsertCall) Header() http.Header {
  4829. if c.header_ == nil {
  4830. c.header_ = make(http.Header)
  4831. }
  4832. return c.header_
  4833. }
  4834. func (c *DefaultObjectAccessControlsInsertCall) doRequest(alt string) (*http.Response, error) {
  4835. reqHeaders := make(http.Header)
  4836. for k, v := range c.header_ {
  4837. reqHeaders[k] = v
  4838. }
  4839. reqHeaders.Set("User-Agent", c.s.userAgent())
  4840. var body io.Reader = nil
  4841. body, err := googleapi.WithoutDataWrapper.JSONReader(c.objectaccesscontrol)
  4842. if err != nil {
  4843. return nil, err
  4844. }
  4845. reqHeaders.Set("Content-Type", "application/json")
  4846. c.urlParams_.Set("alt", alt)
  4847. c.urlParams_.Set("prettyPrint", "false")
  4848. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/defaultObjectAcl")
  4849. urls += "?" + c.urlParams_.Encode()
  4850. req, err := http.NewRequest("POST", urls, body)
  4851. if err != nil {
  4852. return nil, err
  4853. }
  4854. req.Header = reqHeaders
  4855. googleapi.Expand(req.URL, map[string]string{
  4856. "bucket": c.bucket,
  4857. })
  4858. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4859. }
  4860. // Do executes the "storage.defaultObjectAccessControls.insert" call.
  4861. // Exactly one of *ObjectAccessControl or error will be non-nil. Any
  4862. // non-2xx status code is an error. Response headers are in either
  4863. // *ObjectAccessControl.ServerResponse.Header or (if a response was
  4864. // returned at all) in error.(*googleapi.Error).Header. Use
  4865. // googleapi.IsNotModified to check whether the returned error was
  4866. // because http.StatusNotModified was returned.
  4867. func (c *DefaultObjectAccessControlsInsertCall) Do(opts ...googleapi.CallOption) (*ObjectAccessControl, error) {
  4868. gensupport.SetOptions(c.urlParams_, opts...)
  4869. res, err := c.doRequest("json")
  4870. if res != nil && res.StatusCode == http.StatusNotModified {
  4871. if res.Body != nil {
  4872. res.Body.Close()
  4873. }
  4874. return nil, &googleapi.Error{
  4875. Code: res.StatusCode,
  4876. Header: res.Header,
  4877. }
  4878. }
  4879. if err != nil {
  4880. return nil, err
  4881. }
  4882. defer googleapi.CloseBody(res)
  4883. if err := googleapi.CheckResponse(res); err != nil {
  4884. return nil, err
  4885. }
  4886. ret := &ObjectAccessControl{
  4887. ServerResponse: googleapi.ServerResponse{
  4888. Header: res.Header,
  4889. HTTPStatusCode: res.StatusCode,
  4890. },
  4891. }
  4892. target := &ret
  4893. if err := gensupport.DecodeResponse(target, res); err != nil {
  4894. return nil, err
  4895. }
  4896. return ret, nil
  4897. // {
  4898. // "description": "Creates a new default object ACL entry on the specified bucket.",
  4899. // "httpMethod": "POST",
  4900. // "id": "storage.defaultObjectAccessControls.insert",
  4901. // "parameterOrder": [
  4902. // "bucket"
  4903. // ],
  4904. // "parameters": {
  4905. // "bucket": {
  4906. // "description": "Name of a bucket.",
  4907. // "location": "path",
  4908. // "required": true,
  4909. // "type": "string"
  4910. // },
  4911. // "userProject": {
  4912. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  4913. // "location": "query",
  4914. // "type": "string"
  4915. // }
  4916. // },
  4917. // "path": "b/{bucket}/defaultObjectAcl",
  4918. // "request": {
  4919. // "$ref": "ObjectAccessControl"
  4920. // },
  4921. // "response": {
  4922. // "$ref": "ObjectAccessControl"
  4923. // },
  4924. // "scopes": [
  4925. // "https://www.googleapis.com/auth/cloud-platform",
  4926. // "https://www.googleapis.com/auth/devstorage.full_control"
  4927. // ]
  4928. // }
  4929. }
  4930. // method id "storage.defaultObjectAccessControls.list":
  4931. type DefaultObjectAccessControlsListCall struct {
  4932. s *Service
  4933. bucket string
  4934. urlParams_ gensupport.URLParams
  4935. ifNoneMatch_ string
  4936. ctx_ context.Context
  4937. header_ http.Header
  4938. }
  4939. // List: Retrieves default object ACL entries on the specified bucket.
  4940. func (r *DefaultObjectAccessControlsService) List(bucket string) *DefaultObjectAccessControlsListCall {
  4941. c := &DefaultObjectAccessControlsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4942. c.bucket = bucket
  4943. return c
  4944. }
  4945. // IfMetagenerationMatch sets the optional parameter
  4946. // "ifMetagenerationMatch": If present, only return default ACL listing
  4947. // if the bucket's current metageneration matches this value.
  4948. func (c *DefaultObjectAccessControlsListCall) IfMetagenerationMatch(ifMetagenerationMatch int64) *DefaultObjectAccessControlsListCall {
  4949. c.urlParams_.Set("ifMetagenerationMatch", fmt.Sprint(ifMetagenerationMatch))
  4950. return c
  4951. }
  4952. // IfMetagenerationNotMatch sets the optional parameter
  4953. // "ifMetagenerationNotMatch": If present, only return default ACL
  4954. // listing if the bucket's current metageneration does not match the
  4955. // given value.
  4956. func (c *DefaultObjectAccessControlsListCall) IfMetagenerationNotMatch(ifMetagenerationNotMatch int64) *DefaultObjectAccessControlsListCall {
  4957. c.urlParams_.Set("ifMetagenerationNotMatch", fmt.Sprint(ifMetagenerationNotMatch))
  4958. return c
  4959. }
  4960. // UserProject sets the optional parameter "userProject": The project to
  4961. // be billed for this request. Required for Requester Pays buckets.
  4962. func (c *DefaultObjectAccessControlsListCall) UserProject(userProject string) *DefaultObjectAccessControlsListCall {
  4963. c.urlParams_.Set("userProject", userProject)
  4964. return c
  4965. }
  4966. // Fields allows partial responses to be retrieved. See
  4967. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4968. // for more information.
  4969. func (c *DefaultObjectAccessControlsListCall) Fields(s ...googleapi.Field) *DefaultObjectAccessControlsListCall {
  4970. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4971. return c
  4972. }
  4973. // IfNoneMatch sets the optional parameter which makes the operation
  4974. // fail if the object's ETag matches the given value. This is useful for
  4975. // getting updates only after the object has changed since the last
  4976. // request. Use googleapi.IsNotModified to check whether the response
  4977. // error from Do is the result of In-None-Match.
  4978. func (c *DefaultObjectAccessControlsListCall) IfNoneMatch(entityTag string) *DefaultObjectAccessControlsListCall {
  4979. c.ifNoneMatch_ = entityTag
  4980. return c
  4981. }
  4982. // Context sets the context to be used in this call's Do method. Any
  4983. // pending HTTP request will be aborted if the provided context is
  4984. // canceled.
  4985. func (c *DefaultObjectAccessControlsListCall) Context(ctx context.Context) *DefaultObjectAccessControlsListCall {
  4986. c.ctx_ = ctx
  4987. return c
  4988. }
  4989. // Header returns an http.Header that can be modified by the caller to
  4990. // add HTTP headers to the request.
  4991. func (c *DefaultObjectAccessControlsListCall) Header() http.Header {
  4992. if c.header_ == nil {
  4993. c.header_ = make(http.Header)
  4994. }
  4995. return c.header_
  4996. }
  4997. func (c *DefaultObjectAccessControlsListCall) doRequest(alt string) (*http.Response, error) {
  4998. reqHeaders := make(http.Header)
  4999. for k, v := range c.header_ {
  5000. reqHeaders[k] = v
  5001. }
  5002. reqHeaders.Set("User-Agent", c.s.userAgent())
  5003. if c.ifNoneMatch_ != "" {
  5004. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  5005. }
  5006. var body io.Reader = nil
  5007. c.urlParams_.Set("alt", alt)
  5008. c.urlParams_.Set("prettyPrint", "false")
  5009. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/defaultObjectAcl")
  5010. urls += "?" + c.urlParams_.Encode()
  5011. req, err := http.NewRequest("GET", urls, body)
  5012. if err != nil {
  5013. return nil, err
  5014. }
  5015. req.Header = reqHeaders
  5016. googleapi.Expand(req.URL, map[string]string{
  5017. "bucket": c.bucket,
  5018. })
  5019. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5020. }
  5021. // Do executes the "storage.defaultObjectAccessControls.list" call.
  5022. // Exactly one of *ObjectAccessControls or error will be non-nil. Any
  5023. // non-2xx status code is an error. Response headers are in either
  5024. // *ObjectAccessControls.ServerResponse.Header or (if a response was
  5025. // returned at all) in error.(*googleapi.Error).Header. Use
  5026. // googleapi.IsNotModified to check whether the returned error was
  5027. // because http.StatusNotModified was returned.
  5028. func (c *DefaultObjectAccessControlsListCall) Do(opts ...googleapi.CallOption) (*ObjectAccessControls, error) {
  5029. gensupport.SetOptions(c.urlParams_, opts...)
  5030. res, err := c.doRequest("json")
  5031. if res != nil && res.StatusCode == http.StatusNotModified {
  5032. if res.Body != nil {
  5033. res.Body.Close()
  5034. }
  5035. return nil, &googleapi.Error{
  5036. Code: res.StatusCode,
  5037. Header: res.Header,
  5038. }
  5039. }
  5040. if err != nil {
  5041. return nil, err
  5042. }
  5043. defer googleapi.CloseBody(res)
  5044. if err := googleapi.CheckResponse(res); err != nil {
  5045. return nil, err
  5046. }
  5047. ret := &ObjectAccessControls{
  5048. ServerResponse: googleapi.ServerResponse{
  5049. Header: res.Header,
  5050. HTTPStatusCode: res.StatusCode,
  5051. },
  5052. }
  5053. target := &ret
  5054. if err := gensupport.DecodeResponse(target, res); err != nil {
  5055. return nil, err
  5056. }
  5057. return ret, nil
  5058. // {
  5059. // "description": "Retrieves default object ACL entries on the specified bucket.",
  5060. // "httpMethod": "GET",
  5061. // "id": "storage.defaultObjectAccessControls.list",
  5062. // "parameterOrder": [
  5063. // "bucket"
  5064. // ],
  5065. // "parameters": {
  5066. // "bucket": {
  5067. // "description": "Name of a bucket.",
  5068. // "location": "path",
  5069. // "required": true,
  5070. // "type": "string"
  5071. // },
  5072. // "ifMetagenerationMatch": {
  5073. // "description": "If present, only return default ACL listing if the bucket's current metageneration matches this value.",
  5074. // "format": "int64",
  5075. // "location": "query",
  5076. // "type": "string"
  5077. // },
  5078. // "ifMetagenerationNotMatch": {
  5079. // "description": "If present, only return default ACL listing if the bucket's current metageneration does not match the given value.",
  5080. // "format": "int64",
  5081. // "location": "query",
  5082. // "type": "string"
  5083. // },
  5084. // "userProject": {
  5085. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  5086. // "location": "query",
  5087. // "type": "string"
  5088. // }
  5089. // },
  5090. // "path": "b/{bucket}/defaultObjectAcl",
  5091. // "response": {
  5092. // "$ref": "ObjectAccessControls"
  5093. // },
  5094. // "scopes": [
  5095. // "https://www.googleapis.com/auth/cloud-platform",
  5096. // "https://www.googleapis.com/auth/devstorage.full_control"
  5097. // ]
  5098. // }
  5099. }
  5100. // method id "storage.defaultObjectAccessControls.patch":
  5101. type DefaultObjectAccessControlsPatchCall struct {
  5102. s *Service
  5103. bucket string
  5104. entity string
  5105. objectaccesscontrol *ObjectAccessControl
  5106. urlParams_ gensupport.URLParams
  5107. ctx_ context.Context
  5108. header_ http.Header
  5109. }
  5110. // Patch: Patches a default object ACL entry on the specified bucket.
  5111. func (r *DefaultObjectAccessControlsService) Patch(bucket string, entity string, objectaccesscontrol *ObjectAccessControl) *DefaultObjectAccessControlsPatchCall {
  5112. c := &DefaultObjectAccessControlsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5113. c.bucket = bucket
  5114. c.entity = entity
  5115. c.objectaccesscontrol = objectaccesscontrol
  5116. return c
  5117. }
  5118. // UserProject sets the optional parameter "userProject": The project to
  5119. // be billed for this request. Required for Requester Pays buckets.
  5120. func (c *DefaultObjectAccessControlsPatchCall) UserProject(userProject string) *DefaultObjectAccessControlsPatchCall {
  5121. c.urlParams_.Set("userProject", userProject)
  5122. return c
  5123. }
  5124. // Fields allows partial responses to be retrieved. See
  5125. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5126. // for more information.
  5127. func (c *DefaultObjectAccessControlsPatchCall) Fields(s ...googleapi.Field) *DefaultObjectAccessControlsPatchCall {
  5128. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5129. return c
  5130. }
  5131. // Context sets the context to be used in this call's Do method. Any
  5132. // pending HTTP request will be aborted if the provided context is
  5133. // canceled.
  5134. func (c *DefaultObjectAccessControlsPatchCall) Context(ctx context.Context) *DefaultObjectAccessControlsPatchCall {
  5135. c.ctx_ = ctx
  5136. return c
  5137. }
  5138. // Header returns an http.Header that can be modified by the caller to
  5139. // add HTTP headers to the request.
  5140. func (c *DefaultObjectAccessControlsPatchCall) Header() http.Header {
  5141. if c.header_ == nil {
  5142. c.header_ = make(http.Header)
  5143. }
  5144. return c.header_
  5145. }
  5146. func (c *DefaultObjectAccessControlsPatchCall) doRequest(alt string) (*http.Response, error) {
  5147. reqHeaders := make(http.Header)
  5148. for k, v := range c.header_ {
  5149. reqHeaders[k] = v
  5150. }
  5151. reqHeaders.Set("User-Agent", c.s.userAgent())
  5152. var body io.Reader = nil
  5153. body, err := googleapi.WithoutDataWrapper.JSONReader(c.objectaccesscontrol)
  5154. if err != nil {
  5155. return nil, err
  5156. }
  5157. reqHeaders.Set("Content-Type", "application/json")
  5158. c.urlParams_.Set("alt", alt)
  5159. c.urlParams_.Set("prettyPrint", "false")
  5160. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/defaultObjectAcl/{entity}")
  5161. urls += "?" + c.urlParams_.Encode()
  5162. req, err := http.NewRequest("PATCH", urls, body)
  5163. if err != nil {
  5164. return nil, err
  5165. }
  5166. req.Header = reqHeaders
  5167. googleapi.Expand(req.URL, map[string]string{
  5168. "bucket": c.bucket,
  5169. "entity": c.entity,
  5170. })
  5171. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5172. }
  5173. // Do executes the "storage.defaultObjectAccessControls.patch" call.
  5174. // Exactly one of *ObjectAccessControl or error will be non-nil. Any
  5175. // non-2xx status code is an error. Response headers are in either
  5176. // *ObjectAccessControl.ServerResponse.Header or (if a response was
  5177. // returned at all) in error.(*googleapi.Error).Header. Use
  5178. // googleapi.IsNotModified to check whether the returned error was
  5179. // because http.StatusNotModified was returned.
  5180. func (c *DefaultObjectAccessControlsPatchCall) Do(opts ...googleapi.CallOption) (*ObjectAccessControl, error) {
  5181. gensupport.SetOptions(c.urlParams_, opts...)
  5182. res, err := c.doRequest("json")
  5183. if res != nil && res.StatusCode == http.StatusNotModified {
  5184. if res.Body != nil {
  5185. res.Body.Close()
  5186. }
  5187. return nil, &googleapi.Error{
  5188. Code: res.StatusCode,
  5189. Header: res.Header,
  5190. }
  5191. }
  5192. if err != nil {
  5193. return nil, err
  5194. }
  5195. defer googleapi.CloseBody(res)
  5196. if err := googleapi.CheckResponse(res); err != nil {
  5197. return nil, err
  5198. }
  5199. ret := &ObjectAccessControl{
  5200. ServerResponse: googleapi.ServerResponse{
  5201. Header: res.Header,
  5202. HTTPStatusCode: res.StatusCode,
  5203. },
  5204. }
  5205. target := &ret
  5206. if err := gensupport.DecodeResponse(target, res); err != nil {
  5207. return nil, err
  5208. }
  5209. return ret, nil
  5210. // {
  5211. // "description": "Patches a default object ACL entry on the specified bucket.",
  5212. // "httpMethod": "PATCH",
  5213. // "id": "storage.defaultObjectAccessControls.patch",
  5214. // "parameterOrder": [
  5215. // "bucket",
  5216. // "entity"
  5217. // ],
  5218. // "parameters": {
  5219. // "bucket": {
  5220. // "description": "Name of a bucket.",
  5221. // "location": "path",
  5222. // "required": true,
  5223. // "type": "string"
  5224. // },
  5225. // "entity": {
  5226. // "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.",
  5227. // "location": "path",
  5228. // "required": true,
  5229. // "type": "string"
  5230. // },
  5231. // "userProject": {
  5232. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  5233. // "location": "query",
  5234. // "type": "string"
  5235. // }
  5236. // },
  5237. // "path": "b/{bucket}/defaultObjectAcl/{entity}",
  5238. // "request": {
  5239. // "$ref": "ObjectAccessControl"
  5240. // },
  5241. // "response": {
  5242. // "$ref": "ObjectAccessControl"
  5243. // },
  5244. // "scopes": [
  5245. // "https://www.googleapis.com/auth/cloud-platform",
  5246. // "https://www.googleapis.com/auth/devstorage.full_control"
  5247. // ]
  5248. // }
  5249. }
  5250. // method id "storage.defaultObjectAccessControls.update":
  5251. type DefaultObjectAccessControlsUpdateCall struct {
  5252. s *Service
  5253. bucket string
  5254. entity string
  5255. objectaccesscontrol *ObjectAccessControl
  5256. urlParams_ gensupport.URLParams
  5257. ctx_ context.Context
  5258. header_ http.Header
  5259. }
  5260. // Update: Updates a default object ACL entry on the specified bucket.
  5261. func (r *DefaultObjectAccessControlsService) Update(bucket string, entity string, objectaccesscontrol *ObjectAccessControl) *DefaultObjectAccessControlsUpdateCall {
  5262. c := &DefaultObjectAccessControlsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5263. c.bucket = bucket
  5264. c.entity = entity
  5265. c.objectaccesscontrol = objectaccesscontrol
  5266. return c
  5267. }
  5268. // UserProject sets the optional parameter "userProject": The project to
  5269. // be billed for this request. Required for Requester Pays buckets.
  5270. func (c *DefaultObjectAccessControlsUpdateCall) UserProject(userProject string) *DefaultObjectAccessControlsUpdateCall {
  5271. c.urlParams_.Set("userProject", userProject)
  5272. return c
  5273. }
  5274. // Fields allows partial responses to be retrieved. See
  5275. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5276. // for more information.
  5277. func (c *DefaultObjectAccessControlsUpdateCall) Fields(s ...googleapi.Field) *DefaultObjectAccessControlsUpdateCall {
  5278. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5279. return c
  5280. }
  5281. // Context sets the context to be used in this call's Do method. Any
  5282. // pending HTTP request will be aborted if the provided context is
  5283. // canceled.
  5284. func (c *DefaultObjectAccessControlsUpdateCall) Context(ctx context.Context) *DefaultObjectAccessControlsUpdateCall {
  5285. c.ctx_ = ctx
  5286. return c
  5287. }
  5288. // Header returns an http.Header that can be modified by the caller to
  5289. // add HTTP headers to the request.
  5290. func (c *DefaultObjectAccessControlsUpdateCall) Header() http.Header {
  5291. if c.header_ == nil {
  5292. c.header_ = make(http.Header)
  5293. }
  5294. return c.header_
  5295. }
  5296. func (c *DefaultObjectAccessControlsUpdateCall) doRequest(alt string) (*http.Response, error) {
  5297. reqHeaders := make(http.Header)
  5298. for k, v := range c.header_ {
  5299. reqHeaders[k] = v
  5300. }
  5301. reqHeaders.Set("User-Agent", c.s.userAgent())
  5302. var body io.Reader = nil
  5303. body, err := googleapi.WithoutDataWrapper.JSONReader(c.objectaccesscontrol)
  5304. if err != nil {
  5305. return nil, err
  5306. }
  5307. reqHeaders.Set("Content-Type", "application/json")
  5308. c.urlParams_.Set("alt", alt)
  5309. c.urlParams_.Set("prettyPrint", "false")
  5310. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/defaultObjectAcl/{entity}")
  5311. urls += "?" + c.urlParams_.Encode()
  5312. req, err := http.NewRequest("PUT", urls, body)
  5313. if err != nil {
  5314. return nil, err
  5315. }
  5316. req.Header = reqHeaders
  5317. googleapi.Expand(req.URL, map[string]string{
  5318. "bucket": c.bucket,
  5319. "entity": c.entity,
  5320. })
  5321. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5322. }
  5323. // Do executes the "storage.defaultObjectAccessControls.update" call.
  5324. // Exactly one of *ObjectAccessControl or error will be non-nil. Any
  5325. // non-2xx status code is an error. Response headers are in either
  5326. // *ObjectAccessControl.ServerResponse.Header or (if a response was
  5327. // returned at all) in error.(*googleapi.Error).Header. Use
  5328. // googleapi.IsNotModified to check whether the returned error was
  5329. // because http.StatusNotModified was returned.
  5330. func (c *DefaultObjectAccessControlsUpdateCall) Do(opts ...googleapi.CallOption) (*ObjectAccessControl, error) {
  5331. gensupport.SetOptions(c.urlParams_, opts...)
  5332. res, err := c.doRequest("json")
  5333. if res != nil && res.StatusCode == http.StatusNotModified {
  5334. if res.Body != nil {
  5335. res.Body.Close()
  5336. }
  5337. return nil, &googleapi.Error{
  5338. Code: res.StatusCode,
  5339. Header: res.Header,
  5340. }
  5341. }
  5342. if err != nil {
  5343. return nil, err
  5344. }
  5345. defer googleapi.CloseBody(res)
  5346. if err := googleapi.CheckResponse(res); err != nil {
  5347. return nil, err
  5348. }
  5349. ret := &ObjectAccessControl{
  5350. ServerResponse: googleapi.ServerResponse{
  5351. Header: res.Header,
  5352. HTTPStatusCode: res.StatusCode,
  5353. },
  5354. }
  5355. target := &ret
  5356. if err := gensupport.DecodeResponse(target, res); err != nil {
  5357. return nil, err
  5358. }
  5359. return ret, nil
  5360. // {
  5361. // "description": "Updates a default object ACL entry on the specified bucket.",
  5362. // "httpMethod": "PUT",
  5363. // "id": "storage.defaultObjectAccessControls.update",
  5364. // "parameterOrder": [
  5365. // "bucket",
  5366. // "entity"
  5367. // ],
  5368. // "parameters": {
  5369. // "bucket": {
  5370. // "description": "Name of a bucket.",
  5371. // "location": "path",
  5372. // "required": true,
  5373. // "type": "string"
  5374. // },
  5375. // "entity": {
  5376. // "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.",
  5377. // "location": "path",
  5378. // "required": true,
  5379. // "type": "string"
  5380. // },
  5381. // "userProject": {
  5382. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  5383. // "location": "query",
  5384. // "type": "string"
  5385. // }
  5386. // },
  5387. // "path": "b/{bucket}/defaultObjectAcl/{entity}",
  5388. // "request": {
  5389. // "$ref": "ObjectAccessControl"
  5390. // },
  5391. // "response": {
  5392. // "$ref": "ObjectAccessControl"
  5393. // },
  5394. // "scopes": [
  5395. // "https://www.googleapis.com/auth/cloud-platform",
  5396. // "https://www.googleapis.com/auth/devstorage.full_control"
  5397. // ]
  5398. // }
  5399. }
  5400. // method id "storage.notifications.delete":
  5401. type NotificationsDeleteCall struct {
  5402. s *Service
  5403. bucket string
  5404. notification string
  5405. urlParams_ gensupport.URLParams
  5406. ctx_ context.Context
  5407. header_ http.Header
  5408. }
  5409. // Delete: Permanently deletes a notification subscription.
  5410. func (r *NotificationsService) Delete(bucket string, notification string) *NotificationsDeleteCall {
  5411. c := &NotificationsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5412. c.bucket = bucket
  5413. c.notification = notification
  5414. return c
  5415. }
  5416. // UserProject sets the optional parameter "userProject": The project to
  5417. // be billed for this request. Required for Requester Pays buckets.
  5418. func (c *NotificationsDeleteCall) UserProject(userProject string) *NotificationsDeleteCall {
  5419. c.urlParams_.Set("userProject", userProject)
  5420. return c
  5421. }
  5422. // Fields allows partial responses to be retrieved. See
  5423. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5424. // for more information.
  5425. func (c *NotificationsDeleteCall) Fields(s ...googleapi.Field) *NotificationsDeleteCall {
  5426. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5427. return c
  5428. }
  5429. // Context sets the context to be used in this call's Do method. Any
  5430. // pending HTTP request will be aborted if the provided context is
  5431. // canceled.
  5432. func (c *NotificationsDeleteCall) Context(ctx context.Context) *NotificationsDeleteCall {
  5433. c.ctx_ = ctx
  5434. return c
  5435. }
  5436. // Header returns an http.Header that can be modified by the caller to
  5437. // add HTTP headers to the request.
  5438. func (c *NotificationsDeleteCall) Header() http.Header {
  5439. if c.header_ == nil {
  5440. c.header_ = make(http.Header)
  5441. }
  5442. return c.header_
  5443. }
  5444. func (c *NotificationsDeleteCall) doRequest(alt string) (*http.Response, error) {
  5445. reqHeaders := make(http.Header)
  5446. for k, v := range c.header_ {
  5447. reqHeaders[k] = v
  5448. }
  5449. reqHeaders.Set("User-Agent", c.s.userAgent())
  5450. var body io.Reader = nil
  5451. c.urlParams_.Set("alt", alt)
  5452. c.urlParams_.Set("prettyPrint", "false")
  5453. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/notificationConfigs/{notification}")
  5454. urls += "?" + c.urlParams_.Encode()
  5455. req, err := http.NewRequest("DELETE", urls, body)
  5456. if err != nil {
  5457. return nil, err
  5458. }
  5459. req.Header = reqHeaders
  5460. googleapi.Expand(req.URL, map[string]string{
  5461. "bucket": c.bucket,
  5462. "notification": c.notification,
  5463. })
  5464. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5465. }
  5466. // Do executes the "storage.notifications.delete" call.
  5467. func (c *NotificationsDeleteCall) Do(opts ...googleapi.CallOption) error {
  5468. gensupport.SetOptions(c.urlParams_, opts...)
  5469. res, err := c.doRequest("json")
  5470. if err != nil {
  5471. return err
  5472. }
  5473. defer googleapi.CloseBody(res)
  5474. if err := googleapi.CheckResponse(res); err != nil {
  5475. return err
  5476. }
  5477. return nil
  5478. // {
  5479. // "description": "Permanently deletes a notification subscription.",
  5480. // "httpMethod": "DELETE",
  5481. // "id": "storage.notifications.delete",
  5482. // "parameterOrder": [
  5483. // "bucket",
  5484. // "notification"
  5485. // ],
  5486. // "parameters": {
  5487. // "bucket": {
  5488. // "description": "The parent bucket of the notification.",
  5489. // "location": "path",
  5490. // "required": true,
  5491. // "type": "string"
  5492. // },
  5493. // "notification": {
  5494. // "description": "ID of the notification to delete.",
  5495. // "location": "path",
  5496. // "required": true,
  5497. // "type": "string"
  5498. // },
  5499. // "userProject": {
  5500. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  5501. // "location": "query",
  5502. // "type": "string"
  5503. // }
  5504. // },
  5505. // "path": "b/{bucket}/notificationConfigs/{notification}",
  5506. // "scopes": [
  5507. // "https://www.googleapis.com/auth/cloud-platform",
  5508. // "https://www.googleapis.com/auth/devstorage.full_control",
  5509. // "https://www.googleapis.com/auth/devstorage.read_write"
  5510. // ]
  5511. // }
  5512. }
  5513. // method id "storage.notifications.get":
  5514. type NotificationsGetCall struct {
  5515. s *Service
  5516. bucket string
  5517. notification string
  5518. urlParams_ gensupport.URLParams
  5519. ifNoneMatch_ string
  5520. ctx_ context.Context
  5521. header_ http.Header
  5522. }
  5523. // Get: View a notification configuration.
  5524. func (r *NotificationsService) Get(bucket string, notification string) *NotificationsGetCall {
  5525. c := &NotificationsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5526. c.bucket = bucket
  5527. c.notification = notification
  5528. return c
  5529. }
  5530. // UserProject sets the optional parameter "userProject": The project to
  5531. // be billed for this request. Required for Requester Pays buckets.
  5532. func (c *NotificationsGetCall) UserProject(userProject string) *NotificationsGetCall {
  5533. c.urlParams_.Set("userProject", userProject)
  5534. return c
  5535. }
  5536. // Fields allows partial responses to be retrieved. See
  5537. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5538. // for more information.
  5539. func (c *NotificationsGetCall) Fields(s ...googleapi.Field) *NotificationsGetCall {
  5540. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5541. return c
  5542. }
  5543. // IfNoneMatch sets the optional parameter which makes the operation
  5544. // fail if the object's ETag matches the given value. This is useful for
  5545. // getting updates only after the object has changed since the last
  5546. // request. Use googleapi.IsNotModified to check whether the response
  5547. // error from Do is the result of In-None-Match.
  5548. func (c *NotificationsGetCall) IfNoneMatch(entityTag string) *NotificationsGetCall {
  5549. c.ifNoneMatch_ = entityTag
  5550. return c
  5551. }
  5552. // Context sets the context to be used in this call's Do method. Any
  5553. // pending HTTP request will be aborted if the provided context is
  5554. // canceled.
  5555. func (c *NotificationsGetCall) Context(ctx context.Context) *NotificationsGetCall {
  5556. c.ctx_ = ctx
  5557. return c
  5558. }
  5559. // Header returns an http.Header that can be modified by the caller to
  5560. // add HTTP headers to the request.
  5561. func (c *NotificationsGetCall) Header() http.Header {
  5562. if c.header_ == nil {
  5563. c.header_ = make(http.Header)
  5564. }
  5565. return c.header_
  5566. }
  5567. func (c *NotificationsGetCall) doRequest(alt string) (*http.Response, error) {
  5568. reqHeaders := make(http.Header)
  5569. for k, v := range c.header_ {
  5570. reqHeaders[k] = v
  5571. }
  5572. reqHeaders.Set("User-Agent", c.s.userAgent())
  5573. if c.ifNoneMatch_ != "" {
  5574. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  5575. }
  5576. var body io.Reader = nil
  5577. c.urlParams_.Set("alt", alt)
  5578. c.urlParams_.Set("prettyPrint", "false")
  5579. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/notificationConfigs/{notification}")
  5580. urls += "?" + c.urlParams_.Encode()
  5581. req, err := http.NewRequest("GET", urls, body)
  5582. if err != nil {
  5583. return nil, err
  5584. }
  5585. req.Header = reqHeaders
  5586. googleapi.Expand(req.URL, map[string]string{
  5587. "bucket": c.bucket,
  5588. "notification": c.notification,
  5589. })
  5590. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5591. }
  5592. // Do executes the "storage.notifications.get" call.
  5593. // Exactly one of *Notification or error will be non-nil. Any non-2xx
  5594. // status code is an error. Response headers are in either
  5595. // *Notification.ServerResponse.Header or (if a response was returned at
  5596. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  5597. // to check whether the returned error was because
  5598. // http.StatusNotModified was returned.
  5599. func (c *NotificationsGetCall) Do(opts ...googleapi.CallOption) (*Notification, error) {
  5600. gensupport.SetOptions(c.urlParams_, opts...)
  5601. res, err := c.doRequest("json")
  5602. if res != nil && res.StatusCode == http.StatusNotModified {
  5603. if res.Body != nil {
  5604. res.Body.Close()
  5605. }
  5606. return nil, &googleapi.Error{
  5607. Code: res.StatusCode,
  5608. Header: res.Header,
  5609. }
  5610. }
  5611. if err != nil {
  5612. return nil, err
  5613. }
  5614. defer googleapi.CloseBody(res)
  5615. if err := googleapi.CheckResponse(res); err != nil {
  5616. return nil, err
  5617. }
  5618. ret := &Notification{
  5619. ServerResponse: googleapi.ServerResponse{
  5620. Header: res.Header,
  5621. HTTPStatusCode: res.StatusCode,
  5622. },
  5623. }
  5624. target := &ret
  5625. if err := gensupport.DecodeResponse(target, res); err != nil {
  5626. return nil, err
  5627. }
  5628. return ret, nil
  5629. // {
  5630. // "description": "View a notification configuration.",
  5631. // "httpMethod": "GET",
  5632. // "id": "storage.notifications.get",
  5633. // "parameterOrder": [
  5634. // "bucket",
  5635. // "notification"
  5636. // ],
  5637. // "parameters": {
  5638. // "bucket": {
  5639. // "description": "The parent bucket of the notification.",
  5640. // "location": "path",
  5641. // "required": true,
  5642. // "type": "string"
  5643. // },
  5644. // "notification": {
  5645. // "description": "Notification ID",
  5646. // "location": "path",
  5647. // "required": true,
  5648. // "type": "string"
  5649. // },
  5650. // "userProject": {
  5651. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  5652. // "location": "query",
  5653. // "type": "string"
  5654. // }
  5655. // },
  5656. // "path": "b/{bucket}/notificationConfigs/{notification}",
  5657. // "response": {
  5658. // "$ref": "Notification"
  5659. // },
  5660. // "scopes": [
  5661. // "https://www.googleapis.com/auth/cloud-platform",
  5662. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  5663. // "https://www.googleapis.com/auth/devstorage.full_control",
  5664. // "https://www.googleapis.com/auth/devstorage.read_only",
  5665. // "https://www.googleapis.com/auth/devstorage.read_write"
  5666. // ]
  5667. // }
  5668. }
  5669. // method id "storage.notifications.insert":
  5670. type NotificationsInsertCall struct {
  5671. s *Service
  5672. bucket string
  5673. notification *Notification
  5674. urlParams_ gensupport.URLParams
  5675. ctx_ context.Context
  5676. header_ http.Header
  5677. }
  5678. // Insert: Creates a notification subscription for a given bucket.
  5679. func (r *NotificationsService) Insert(bucket string, notification *Notification) *NotificationsInsertCall {
  5680. c := &NotificationsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5681. c.bucket = bucket
  5682. c.notification = notification
  5683. return c
  5684. }
  5685. // UserProject sets the optional parameter "userProject": The project to
  5686. // be billed for this request. Required for Requester Pays buckets.
  5687. func (c *NotificationsInsertCall) UserProject(userProject string) *NotificationsInsertCall {
  5688. c.urlParams_.Set("userProject", userProject)
  5689. return c
  5690. }
  5691. // Fields allows partial responses to be retrieved. See
  5692. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5693. // for more information.
  5694. func (c *NotificationsInsertCall) Fields(s ...googleapi.Field) *NotificationsInsertCall {
  5695. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5696. return c
  5697. }
  5698. // Context sets the context to be used in this call's Do method. Any
  5699. // pending HTTP request will be aborted if the provided context is
  5700. // canceled.
  5701. func (c *NotificationsInsertCall) Context(ctx context.Context) *NotificationsInsertCall {
  5702. c.ctx_ = ctx
  5703. return c
  5704. }
  5705. // Header returns an http.Header that can be modified by the caller to
  5706. // add HTTP headers to the request.
  5707. func (c *NotificationsInsertCall) Header() http.Header {
  5708. if c.header_ == nil {
  5709. c.header_ = make(http.Header)
  5710. }
  5711. return c.header_
  5712. }
  5713. func (c *NotificationsInsertCall) doRequest(alt string) (*http.Response, error) {
  5714. reqHeaders := make(http.Header)
  5715. for k, v := range c.header_ {
  5716. reqHeaders[k] = v
  5717. }
  5718. reqHeaders.Set("User-Agent", c.s.userAgent())
  5719. var body io.Reader = nil
  5720. body, err := googleapi.WithoutDataWrapper.JSONReader(c.notification)
  5721. if err != nil {
  5722. return nil, err
  5723. }
  5724. reqHeaders.Set("Content-Type", "application/json")
  5725. c.urlParams_.Set("alt", alt)
  5726. c.urlParams_.Set("prettyPrint", "false")
  5727. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/notificationConfigs")
  5728. urls += "?" + c.urlParams_.Encode()
  5729. req, err := http.NewRequest("POST", urls, body)
  5730. if err != nil {
  5731. return nil, err
  5732. }
  5733. req.Header = reqHeaders
  5734. googleapi.Expand(req.URL, map[string]string{
  5735. "bucket": c.bucket,
  5736. })
  5737. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5738. }
  5739. // Do executes the "storage.notifications.insert" call.
  5740. // Exactly one of *Notification or error will be non-nil. Any non-2xx
  5741. // status code is an error. Response headers are in either
  5742. // *Notification.ServerResponse.Header or (if a response was returned at
  5743. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  5744. // to check whether the returned error was because
  5745. // http.StatusNotModified was returned.
  5746. func (c *NotificationsInsertCall) Do(opts ...googleapi.CallOption) (*Notification, error) {
  5747. gensupport.SetOptions(c.urlParams_, opts...)
  5748. res, err := c.doRequest("json")
  5749. if res != nil && res.StatusCode == http.StatusNotModified {
  5750. if res.Body != nil {
  5751. res.Body.Close()
  5752. }
  5753. return nil, &googleapi.Error{
  5754. Code: res.StatusCode,
  5755. Header: res.Header,
  5756. }
  5757. }
  5758. if err != nil {
  5759. return nil, err
  5760. }
  5761. defer googleapi.CloseBody(res)
  5762. if err := googleapi.CheckResponse(res); err != nil {
  5763. return nil, err
  5764. }
  5765. ret := &Notification{
  5766. ServerResponse: googleapi.ServerResponse{
  5767. Header: res.Header,
  5768. HTTPStatusCode: res.StatusCode,
  5769. },
  5770. }
  5771. target := &ret
  5772. if err := gensupport.DecodeResponse(target, res); err != nil {
  5773. return nil, err
  5774. }
  5775. return ret, nil
  5776. // {
  5777. // "description": "Creates a notification subscription for a given bucket.",
  5778. // "httpMethod": "POST",
  5779. // "id": "storage.notifications.insert",
  5780. // "parameterOrder": [
  5781. // "bucket"
  5782. // ],
  5783. // "parameters": {
  5784. // "bucket": {
  5785. // "description": "The parent bucket of the notification.",
  5786. // "location": "path",
  5787. // "required": true,
  5788. // "type": "string"
  5789. // },
  5790. // "userProject": {
  5791. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  5792. // "location": "query",
  5793. // "type": "string"
  5794. // }
  5795. // },
  5796. // "path": "b/{bucket}/notificationConfigs",
  5797. // "request": {
  5798. // "$ref": "Notification"
  5799. // },
  5800. // "response": {
  5801. // "$ref": "Notification"
  5802. // },
  5803. // "scopes": [
  5804. // "https://www.googleapis.com/auth/cloud-platform",
  5805. // "https://www.googleapis.com/auth/devstorage.full_control",
  5806. // "https://www.googleapis.com/auth/devstorage.read_write"
  5807. // ]
  5808. // }
  5809. }
  5810. // method id "storage.notifications.list":
  5811. type NotificationsListCall struct {
  5812. s *Service
  5813. bucket string
  5814. urlParams_ gensupport.URLParams
  5815. ifNoneMatch_ string
  5816. ctx_ context.Context
  5817. header_ http.Header
  5818. }
  5819. // List: Retrieves a list of notification subscriptions for a given
  5820. // bucket.
  5821. func (r *NotificationsService) List(bucket string) *NotificationsListCall {
  5822. c := &NotificationsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5823. c.bucket = bucket
  5824. return c
  5825. }
  5826. // UserProject sets the optional parameter "userProject": The project to
  5827. // be billed for this request. Required for Requester Pays buckets.
  5828. func (c *NotificationsListCall) UserProject(userProject string) *NotificationsListCall {
  5829. c.urlParams_.Set("userProject", userProject)
  5830. return c
  5831. }
  5832. // Fields allows partial responses to be retrieved. See
  5833. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5834. // for more information.
  5835. func (c *NotificationsListCall) Fields(s ...googleapi.Field) *NotificationsListCall {
  5836. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5837. return c
  5838. }
  5839. // IfNoneMatch sets the optional parameter which makes the operation
  5840. // fail if the object's ETag matches the given value. This is useful for
  5841. // getting updates only after the object has changed since the last
  5842. // request. Use googleapi.IsNotModified to check whether the response
  5843. // error from Do is the result of In-None-Match.
  5844. func (c *NotificationsListCall) IfNoneMatch(entityTag string) *NotificationsListCall {
  5845. c.ifNoneMatch_ = entityTag
  5846. return c
  5847. }
  5848. // Context sets the context to be used in this call's Do method. Any
  5849. // pending HTTP request will be aborted if the provided context is
  5850. // canceled.
  5851. func (c *NotificationsListCall) Context(ctx context.Context) *NotificationsListCall {
  5852. c.ctx_ = ctx
  5853. return c
  5854. }
  5855. // Header returns an http.Header that can be modified by the caller to
  5856. // add HTTP headers to the request.
  5857. func (c *NotificationsListCall) Header() http.Header {
  5858. if c.header_ == nil {
  5859. c.header_ = make(http.Header)
  5860. }
  5861. return c.header_
  5862. }
  5863. func (c *NotificationsListCall) doRequest(alt string) (*http.Response, error) {
  5864. reqHeaders := make(http.Header)
  5865. for k, v := range c.header_ {
  5866. reqHeaders[k] = v
  5867. }
  5868. reqHeaders.Set("User-Agent", c.s.userAgent())
  5869. if c.ifNoneMatch_ != "" {
  5870. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  5871. }
  5872. var body io.Reader = nil
  5873. c.urlParams_.Set("alt", alt)
  5874. c.urlParams_.Set("prettyPrint", "false")
  5875. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/notificationConfigs")
  5876. urls += "?" + c.urlParams_.Encode()
  5877. req, err := http.NewRequest("GET", urls, body)
  5878. if err != nil {
  5879. return nil, err
  5880. }
  5881. req.Header = reqHeaders
  5882. googleapi.Expand(req.URL, map[string]string{
  5883. "bucket": c.bucket,
  5884. })
  5885. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5886. }
  5887. // Do executes the "storage.notifications.list" call.
  5888. // Exactly one of *Notifications or error will be non-nil. Any non-2xx
  5889. // status code is an error. Response headers are in either
  5890. // *Notifications.ServerResponse.Header or (if a response was returned
  5891. // at all) in error.(*googleapi.Error).Header. Use
  5892. // googleapi.IsNotModified to check whether the returned error was
  5893. // because http.StatusNotModified was returned.
  5894. func (c *NotificationsListCall) Do(opts ...googleapi.CallOption) (*Notifications, error) {
  5895. gensupport.SetOptions(c.urlParams_, opts...)
  5896. res, err := c.doRequest("json")
  5897. if res != nil && res.StatusCode == http.StatusNotModified {
  5898. if res.Body != nil {
  5899. res.Body.Close()
  5900. }
  5901. return nil, &googleapi.Error{
  5902. Code: res.StatusCode,
  5903. Header: res.Header,
  5904. }
  5905. }
  5906. if err != nil {
  5907. return nil, err
  5908. }
  5909. defer googleapi.CloseBody(res)
  5910. if err := googleapi.CheckResponse(res); err != nil {
  5911. return nil, err
  5912. }
  5913. ret := &Notifications{
  5914. ServerResponse: googleapi.ServerResponse{
  5915. Header: res.Header,
  5916. HTTPStatusCode: res.StatusCode,
  5917. },
  5918. }
  5919. target := &ret
  5920. if err := gensupport.DecodeResponse(target, res); err != nil {
  5921. return nil, err
  5922. }
  5923. return ret, nil
  5924. // {
  5925. // "description": "Retrieves a list of notification subscriptions for a given bucket.",
  5926. // "httpMethod": "GET",
  5927. // "id": "storage.notifications.list",
  5928. // "parameterOrder": [
  5929. // "bucket"
  5930. // ],
  5931. // "parameters": {
  5932. // "bucket": {
  5933. // "description": "Name of a Google Cloud Storage bucket.",
  5934. // "location": "path",
  5935. // "required": true,
  5936. // "type": "string"
  5937. // },
  5938. // "userProject": {
  5939. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  5940. // "location": "query",
  5941. // "type": "string"
  5942. // }
  5943. // },
  5944. // "path": "b/{bucket}/notificationConfigs",
  5945. // "response": {
  5946. // "$ref": "Notifications"
  5947. // },
  5948. // "scopes": [
  5949. // "https://www.googleapis.com/auth/cloud-platform",
  5950. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  5951. // "https://www.googleapis.com/auth/devstorage.full_control",
  5952. // "https://www.googleapis.com/auth/devstorage.read_only",
  5953. // "https://www.googleapis.com/auth/devstorage.read_write"
  5954. // ]
  5955. // }
  5956. }
  5957. // method id "storage.objectAccessControls.delete":
  5958. type ObjectAccessControlsDeleteCall struct {
  5959. s *Service
  5960. bucket string
  5961. object string
  5962. entity string
  5963. urlParams_ gensupport.URLParams
  5964. ctx_ context.Context
  5965. header_ http.Header
  5966. }
  5967. // Delete: Permanently deletes the ACL entry for the specified entity on
  5968. // the specified object.
  5969. func (r *ObjectAccessControlsService) Delete(bucket string, object string, entity string) *ObjectAccessControlsDeleteCall {
  5970. c := &ObjectAccessControlsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5971. c.bucket = bucket
  5972. c.object = object
  5973. c.entity = entity
  5974. return c
  5975. }
  5976. // Generation sets the optional parameter "generation": If present,
  5977. // selects a specific revision of this object (as opposed to the latest
  5978. // version, the default).
  5979. func (c *ObjectAccessControlsDeleteCall) Generation(generation int64) *ObjectAccessControlsDeleteCall {
  5980. c.urlParams_.Set("generation", fmt.Sprint(generation))
  5981. return c
  5982. }
  5983. // UserProject sets the optional parameter "userProject": The project to
  5984. // be billed for this request. Required for Requester Pays buckets.
  5985. func (c *ObjectAccessControlsDeleteCall) UserProject(userProject string) *ObjectAccessControlsDeleteCall {
  5986. c.urlParams_.Set("userProject", userProject)
  5987. return c
  5988. }
  5989. // Fields allows partial responses to be retrieved. See
  5990. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5991. // for more information.
  5992. func (c *ObjectAccessControlsDeleteCall) Fields(s ...googleapi.Field) *ObjectAccessControlsDeleteCall {
  5993. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5994. return c
  5995. }
  5996. // Context sets the context to be used in this call's Do method. Any
  5997. // pending HTTP request will be aborted if the provided context is
  5998. // canceled.
  5999. func (c *ObjectAccessControlsDeleteCall) Context(ctx context.Context) *ObjectAccessControlsDeleteCall {
  6000. c.ctx_ = ctx
  6001. return c
  6002. }
  6003. // Header returns an http.Header that can be modified by the caller to
  6004. // add HTTP headers to the request.
  6005. func (c *ObjectAccessControlsDeleteCall) Header() http.Header {
  6006. if c.header_ == nil {
  6007. c.header_ = make(http.Header)
  6008. }
  6009. return c.header_
  6010. }
  6011. func (c *ObjectAccessControlsDeleteCall) doRequest(alt string) (*http.Response, error) {
  6012. reqHeaders := make(http.Header)
  6013. for k, v := range c.header_ {
  6014. reqHeaders[k] = v
  6015. }
  6016. reqHeaders.Set("User-Agent", c.s.userAgent())
  6017. var body io.Reader = nil
  6018. c.urlParams_.Set("alt", alt)
  6019. c.urlParams_.Set("prettyPrint", "false")
  6020. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}/acl/{entity}")
  6021. urls += "?" + c.urlParams_.Encode()
  6022. req, err := http.NewRequest("DELETE", urls, body)
  6023. if err != nil {
  6024. return nil, err
  6025. }
  6026. req.Header = reqHeaders
  6027. googleapi.Expand(req.URL, map[string]string{
  6028. "bucket": c.bucket,
  6029. "object": c.object,
  6030. "entity": c.entity,
  6031. })
  6032. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6033. }
  6034. // Do executes the "storage.objectAccessControls.delete" call.
  6035. func (c *ObjectAccessControlsDeleteCall) Do(opts ...googleapi.CallOption) error {
  6036. gensupport.SetOptions(c.urlParams_, opts...)
  6037. res, err := c.doRequest("json")
  6038. if err != nil {
  6039. return err
  6040. }
  6041. defer googleapi.CloseBody(res)
  6042. if err := googleapi.CheckResponse(res); err != nil {
  6043. return err
  6044. }
  6045. return nil
  6046. // {
  6047. // "description": "Permanently deletes the ACL entry for the specified entity on the specified object.",
  6048. // "httpMethod": "DELETE",
  6049. // "id": "storage.objectAccessControls.delete",
  6050. // "parameterOrder": [
  6051. // "bucket",
  6052. // "object",
  6053. // "entity"
  6054. // ],
  6055. // "parameters": {
  6056. // "bucket": {
  6057. // "description": "Name of a bucket.",
  6058. // "location": "path",
  6059. // "required": true,
  6060. // "type": "string"
  6061. // },
  6062. // "entity": {
  6063. // "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.",
  6064. // "location": "path",
  6065. // "required": true,
  6066. // "type": "string"
  6067. // },
  6068. // "generation": {
  6069. // "description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).",
  6070. // "format": "int64",
  6071. // "location": "query",
  6072. // "type": "string"
  6073. // },
  6074. // "object": {
  6075. // "description": "Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
  6076. // "location": "path",
  6077. // "required": true,
  6078. // "type": "string"
  6079. // },
  6080. // "userProject": {
  6081. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  6082. // "location": "query",
  6083. // "type": "string"
  6084. // }
  6085. // },
  6086. // "path": "b/{bucket}/o/{object}/acl/{entity}",
  6087. // "scopes": [
  6088. // "https://www.googleapis.com/auth/cloud-platform",
  6089. // "https://www.googleapis.com/auth/devstorage.full_control"
  6090. // ]
  6091. // }
  6092. }
  6093. // method id "storage.objectAccessControls.get":
  6094. type ObjectAccessControlsGetCall struct {
  6095. s *Service
  6096. bucket string
  6097. object string
  6098. entity string
  6099. urlParams_ gensupport.URLParams
  6100. ifNoneMatch_ string
  6101. ctx_ context.Context
  6102. header_ http.Header
  6103. }
  6104. // Get: Returns the ACL entry for the specified entity on the specified
  6105. // object.
  6106. func (r *ObjectAccessControlsService) Get(bucket string, object string, entity string) *ObjectAccessControlsGetCall {
  6107. c := &ObjectAccessControlsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6108. c.bucket = bucket
  6109. c.object = object
  6110. c.entity = entity
  6111. return c
  6112. }
  6113. // Generation sets the optional parameter "generation": If present,
  6114. // selects a specific revision of this object (as opposed to the latest
  6115. // version, the default).
  6116. func (c *ObjectAccessControlsGetCall) Generation(generation int64) *ObjectAccessControlsGetCall {
  6117. c.urlParams_.Set("generation", fmt.Sprint(generation))
  6118. return c
  6119. }
  6120. // UserProject sets the optional parameter "userProject": The project to
  6121. // be billed for this request. Required for Requester Pays buckets.
  6122. func (c *ObjectAccessControlsGetCall) UserProject(userProject string) *ObjectAccessControlsGetCall {
  6123. c.urlParams_.Set("userProject", userProject)
  6124. return c
  6125. }
  6126. // Fields allows partial responses to be retrieved. See
  6127. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6128. // for more information.
  6129. func (c *ObjectAccessControlsGetCall) Fields(s ...googleapi.Field) *ObjectAccessControlsGetCall {
  6130. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6131. return c
  6132. }
  6133. // IfNoneMatch sets the optional parameter which makes the operation
  6134. // fail if the object's ETag matches the given value. This is useful for
  6135. // getting updates only after the object has changed since the last
  6136. // request. Use googleapi.IsNotModified to check whether the response
  6137. // error from Do is the result of In-None-Match.
  6138. func (c *ObjectAccessControlsGetCall) IfNoneMatch(entityTag string) *ObjectAccessControlsGetCall {
  6139. c.ifNoneMatch_ = entityTag
  6140. return c
  6141. }
  6142. // Context sets the context to be used in this call's Do method. Any
  6143. // pending HTTP request will be aborted if the provided context is
  6144. // canceled.
  6145. func (c *ObjectAccessControlsGetCall) Context(ctx context.Context) *ObjectAccessControlsGetCall {
  6146. c.ctx_ = ctx
  6147. return c
  6148. }
  6149. // Header returns an http.Header that can be modified by the caller to
  6150. // add HTTP headers to the request.
  6151. func (c *ObjectAccessControlsGetCall) Header() http.Header {
  6152. if c.header_ == nil {
  6153. c.header_ = make(http.Header)
  6154. }
  6155. return c.header_
  6156. }
  6157. func (c *ObjectAccessControlsGetCall) doRequest(alt string) (*http.Response, error) {
  6158. reqHeaders := make(http.Header)
  6159. for k, v := range c.header_ {
  6160. reqHeaders[k] = v
  6161. }
  6162. reqHeaders.Set("User-Agent", c.s.userAgent())
  6163. if c.ifNoneMatch_ != "" {
  6164. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  6165. }
  6166. var body io.Reader = nil
  6167. c.urlParams_.Set("alt", alt)
  6168. c.urlParams_.Set("prettyPrint", "false")
  6169. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}/acl/{entity}")
  6170. urls += "?" + c.urlParams_.Encode()
  6171. req, err := http.NewRequest("GET", urls, body)
  6172. if err != nil {
  6173. return nil, err
  6174. }
  6175. req.Header = reqHeaders
  6176. googleapi.Expand(req.URL, map[string]string{
  6177. "bucket": c.bucket,
  6178. "object": c.object,
  6179. "entity": c.entity,
  6180. })
  6181. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6182. }
  6183. // Do executes the "storage.objectAccessControls.get" call.
  6184. // Exactly one of *ObjectAccessControl or error will be non-nil. Any
  6185. // non-2xx status code is an error. Response headers are in either
  6186. // *ObjectAccessControl.ServerResponse.Header or (if a response was
  6187. // returned at all) in error.(*googleapi.Error).Header. Use
  6188. // googleapi.IsNotModified to check whether the returned error was
  6189. // because http.StatusNotModified was returned.
  6190. func (c *ObjectAccessControlsGetCall) Do(opts ...googleapi.CallOption) (*ObjectAccessControl, error) {
  6191. gensupport.SetOptions(c.urlParams_, opts...)
  6192. res, err := c.doRequest("json")
  6193. if res != nil && res.StatusCode == http.StatusNotModified {
  6194. if res.Body != nil {
  6195. res.Body.Close()
  6196. }
  6197. return nil, &googleapi.Error{
  6198. Code: res.StatusCode,
  6199. Header: res.Header,
  6200. }
  6201. }
  6202. if err != nil {
  6203. return nil, err
  6204. }
  6205. defer googleapi.CloseBody(res)
  6206. if err := googleapi.CheckResponse(res); err != nil {
  6207. return nil, err
  6208. }
  6209. ret := &ObjectAccessControl{
  6210. ServerResponse: googleapi.ServerResponse{
  6211. Header: res.Header,
  6212. HTTPStatusCode: res.StatusCode,
  6213. },
  6214. }
  6215. target := &ret
  6216. if err := gensupport.DecodeResponse(target, res); err != nil {
  6217. return nil, err
  6218. }
  6219. return ret, nil
  6220. // {
  6221. // "description": "Returns the ACL entry for the specified entity on the specified object.",
  6222. // "httpMethod": "GET",
  6223. // "id": "storage.objectAccessControls.get",
  6224. // "parameterOrder": [
  6225. // "bucket",
  6226. // "object",
  6227. // "entity"
  6228. // ],
  6229. // "parameters": {
  6230. // "bucket": {
  6231. // "description": "Name of a bucket.",
  6232. // "location": "path",
  6233. // "required": true,
  6234. // "type": "string"
  6235. // },
  6236. // "entity": {
  6237. // "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.",
  6238. // "location": "path",
  6239. // "required": true,
  6240. // "type": "string"
  6241. // },
  6242. // "generation": {
  6243. // "description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).",
  6244. // "format": "int64",
  6245. // "location": "query",
  6246. // "type": "string"
  6247. // },
  6248. // "object": {
  6249. // "description": "Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
  6250. // "location": "path",
  6251. // "required": true,
  6252. // "type": "string"
  6253. // },
  6254. // "userProject": {
  6255. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  6256. // "location": "query",
  6257. // "type": "string"
  6258. // }
  6259. // },
  6260. // "path": "b/{bucket}/o/{object}/acl/{entity}",
  6261. // "response": {
  6262. // "$ref": "ObjectAccessControl"
  6263. // },
  6264. // "scopes": [
  6265. // "https://www.googleapis.com/auth/cloud-platform",
  6266. // "https://www.googleapis.com/auth/devstorage.full_control"
  6267. // ]
  6268. // }
  6269. }
  6270. // method id "storage.objectAccessControls.insert":
  6271. type ObjectAccessControlsInsertCall struct {
  6272. s *Service
  6273. bucket string
  6274. object string
  6275. objectaccesscontrol *ObjectAccessControl
  6276. urlParams_ gensupport.URLParams
  6277. ctx_ context.Context
  6278. header_ http.Header
  6279. }
  6280. // Insert: Creates a new ACL entry on the specified object.
  6281. func (r *ObjectAccessControlsService) Insert(bucket string, object string, objectaccesscontrol *ObjectAccessControl) *ObjectAccessControlsInsertCall {
  6282. c := &ObjectAccessControlsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6283. c.bucket = bucket
  6284. c.object = object
  6285. c.objectaccesscontrol = objectaccesscontrol
  6286. return c
  6287. }
  6288. // Generation sets the optional parameter "generation": If present,
  6289. // selects a specific revision of this object (as opposed to the latest
  6290. // version, the default).
  6291. func (c *ObjectAccessControlsInsertCall) Generation(generation int64) *ObjectAccessControlsInsertCall {
  6292. c.urlParams_.Set("generation", fmt.Sprint(generation))
  6293. return c
  6294. }
  6295. // UserProject sets the optional parameter "userProject": The project to
  6296. // be billed for this request. Required for Requester Pays buckets.
  6297. func (c *ObjectAccessControlsInsertCall) UserProject(userProject string) *ObjectAccessControlsInsertCall {
  6298. c.urlParams_.Set("userProject", userProject)
  6299. return c
  6300. }
  6301. // Fields allows partial responses to be retrieved. See
  6302. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6303. // for more information.
  6304. func (c *ObjectAccessControlsInsertCall) Fields(s ...googleapi.Field) *ObjectAccessControlsInsertCall {
  6305. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6306. return c
  6307. }
  6308. // Context sets the context to be used in this call's Do method. Any
  6309. // pending HTTP request will be aborted if the provided context is
  6310. // canceled.
  6311. func (c *ObjectAccessControlsInsertCall) Context(ctx context.Context) *ObjectAccessControlsInsertCall {
  6312. c.ctx_ = ctx
  6313. return c
  6314. }
  6315. // Header returns an http.Header that can be modified by the caller to
  6316. // add HTTP headers to the request.
  6317. func (c *ObjectAccessControlsInsertCall) Header() http.Header {
  6318. if c.header_ == nil {
  6319. c.header_ = make(http.Header)
  6320. }
  6321. return c.header_
  6322. }
  6323. func (c *ObjectAccessControlsInsertCall) doRequest(alt string) (*http.Response, error) {
  6324. reqHeaders := make(http.Header)
  6325. for k, v := range c.header_ {
  6326. reqHeaders[k] = v
  6327. }
  6328. reqHeaders.Set("User-Agent", c.s.userAgent())
  6329. var body io.Reader = nil
  6330. body, err := googleapi.WithoutDataWrapper.JSONReader(c.objectaccesscontrol)
  6331. if err != nil {
  6332. return nil, err
  6333. }
  6334. reqHeaders.Set("Content-Type", "application/json")
  6335. c.urlParams_.Set("alt", alt)
  6336. c.urlParams_.Set("prettyPrint", "false")
  6337. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}/acl")
  6338. urls += "?" + c.urlParams_.Encode()
  6339. req, err := http.NewRequest("POST", urls, body)
  6340. if err != nil {
  6341. return nil, err
  6342. }
  6343. req.Header = reqHeaders
  6344. googleapi.Expand(req.URL, map[string]string{
  6345. "bucket": c.bucket,
  6346. "object": c.object,
  6347. })
  6348. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6349. }
  6350. // Do executes the "storage.objectAccessControls.insert" call.
  6351. // Exactly one of *ObjectAccessControl or error will be non-nil. Any
  6352. // non-2xx status code is an error. Response headers are in either
  6353. // *ObjectAccessControl.ServerResponse.Header or (if a response was
  6354. // returned at all) in error.(*googleapi.Error).Header. Use
  6355. // googleapi.IsNotModified to check whether the returned error was
  6356. // because http.StatusNotModified was returned.
  6357. func (c *ObjectAccessControlsInsertCall) Do(opts ...googleapi.CallOption) (*ObjectAccessControl, error) {
  6358. gensupport.SetOptions(c.urlParams_, opts...)
  6359. res, err := c.doRequest("json")
  6360. if res != nil && res.StatusCode == http.StatusNotModified {
  6361. if res.Body != nil {
  6362. res.Body.Close()
  6363. }
  6364. return nil, &googleapi.Error{
  6365. Code: res.StatusCode,
  6366. Header: res.Header,
  6367. }
  6368. }
  6369. if err != nil {
  6370. return nil, err
  6371. }
  6372. defer googleapi.CloseBody(res)
  6373. if err := googleapi.CheckResponse(res); err != nil {
  6374. return nil, err
  6375. }
  6376. ret := &ObjectAccessControl{
  6377. ServerResponse: googleapi.ServerResponse{
  6378. Header: res.Header,
  6379. HTTPStatusCode: res.StatusCode,
  6380. },
  6381. }
  6382. target := &ret
  6383. if err := gensupport.DecodeResponse(target, res); err != nil {
  6384. return nil, err
  6385. }
  6386. return ret, nil
  6387. // {
  6388. // "description": "Creates a new ACL entry on the specified object.",
  6389. // "httpMethod": "POST",
  6390. // "id": "storage.objectAccessControls.insert",
  6391. // "parameterOrder": [
  6392. // "bucket",
  6393. // "object"
  6394. // ],
  6395. // "parameters": {
  6396. // "bucket": {
  6397. // "description": "Name of a bucket.",
  6398. // "location": "path",
  6399. // "required": true,
  6400. // "type": "string"
  6401. // },
  6402. // "generation": {
  6403. // "description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).",
  6404. // "format": "int64",
  6405. // "location": "query",
  6406. // "type": "string"
  6407. // },
  6408. // "object": {
  6409. // "description": "Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
  6410. // "location": "path",
  6411. // "required": true,
  6412. // "type": "string"
  6413. // },
  6414. // "userProject": {
  6415. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  6416. // "location": "query",
  6417. // "type": "string"
  6418. // }
  6419. // },
  6420. // "path": "b/{bucket}/o/{object}/acl",
  6421. // "request": {
  6422. // "$ref": "ObjectAccessControl"
  6423. // },
  6424. // "response": {
  6425. // "$ref": "ObjectAccessControl"
  6426. // },
  6427. // "scopes": [
  6428. // "https://www.googleapis.com/auth/cloud-platform",
  6429. // "https://www.googleapis.com/auth/devstorage.full_control"
  6430. // ]
  6431. // }
  6432. }
  6433. // method id "storage.objectAccessControls.list":
  6434. type ObjectAccessControlsListCall struct {
  6435. s *Service
  6436. bucket string
  6437. object string
  6438. urlParams_ gensupport.URLParams
  6439. ifNoneMatch_ string
  6440. ctx_ context.Context
  6441. header_ http.Header
  6442. }
  6443. // List: Retrieves ACL entries on the specified object.
  6444. func (r *ObjectAccessControlsService) List(bucket string, object string) *ObjectAccessControlsListCall {
  6445. c := &ObjectAccessControlsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6446. c.bucket = bucket
  6447. c.object = object
  6448. return c
  6449. }
  6450. // Generation sets the optional parameter "generation": If present,
  6451. // selects a specific revision of this object (as opposed to the latest
  6452. // version, the default).
  6453. func (c *ObjectAccessControlsListCall) Generation(generation int64) *ObjectAccessControlsListCall {
  6454. c.urlParams_.Set("generation", fmt.Sprint(generation))
  6455. return c
  6456. }
  6457. // UserProject sets the optional parameter "userProject": The project to
  6458. // be billed for this request. Required for Requester Pays buckets.
  6459. func (c *ObjectAccessControlsListCall) UserProject(userProject string) *ObjectAccessControlsListCall {
  6460. c.urlParams_.Set("userProject", userProject)
  6461. return c
  6462. }
  6463. // Fields allows partial responses to be retrieved. See
  6464. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6465. // for more information.
  6466. func (c *ObjectAccessControlsListCall) Fields(s ...googleapi.Field) *ObjectAccessControlsListCall {
  6467. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6468. return c
  6469. }
  6470. // IfNoneMatch sets the optional parameter which makes the operation
  6471. // fail if the object's ETag matches the given value. This is useful for
  6472. // getting updates only after the object has changed since the last
  6473. // request. Use googleapi.IsNotModified to check whether the response
  6474. // error from Do is the result of In-None-Match.
  6475. func (c *ObjectAccessControlsListCall) IfNoneMatch(entityTag string) *ObjectAccessControlsListCall {
  6476. c.ifNoneMatch_ = entityTag
  6477. return c
  6478. }
  6479. // Context sets the context to be used in this call's Do method. Any
  6480. // pending HTTP request will be aborted if the provided context is
  6481. // canceled.
  6482. func (c *ObjectAccessControlsListCall) Context(ctx context.Context) *ObjectAccessControlsListCall {
  6483. c.ctx_ = ctx
  6484. return c
  6485. }
  6486. // Header returns an http.Header that can be modified by the caller to
  6487. // add HTTP headers to the request.
  6488. func (c *ObjectAccessControlsListCall) Header() http.Header {
  6489. if c.header_ == nil {
  6490. c.header_ = make(http.Header)
  6491. }
  6492. return c.header_
  6493. }
  6494. func (c *ObjectAccessControlsListCall) doRequest(alt string) (*http.Response, error) {
  6495. reqHeaders := make(http.Header)
  6496. for k, v := range c.header_ {
  6497. reqHeaders[k] = v
  6498. }
  6499. reqHeaders.Set("User-Agent", c.s.userAgent())
  6500. if c.ifNoneMatch_ != "" {
  6501. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  6502. }
  6503. var body io.Reader = nil
  6504. c.urlParams_.Set("alt", alt)
  6505. c.urlParams_.Set("prettyPrint", "false")
  6506. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}/acl")
  6507. urls += "?" + c.urlParams_.Encode()
  6508. req, err := http.NewRequest("GET", urls, body)
  6509. if err != nil {
  6510. return nil, err
  6511. }
  6512. req.Header = reqHeaders
  6513. googleapi.Expand(req.URL, map[string]string{
  6514. "bucket": c.bucket,
  6515. "object": c.object,
  6516. })
  6517. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6518. }
  6519. // Do executes the "storage.objectAccessControls.list" call.
  6520. // Exactly one of *ObjectAccessControls or error will be non-nil. Any
  6521. // non-2xx status code is an error. Response headers are in either
  6522. // *ObjectAccessControls.ServerResponse.Header or (if a response was
  6523. // returned at all) in error.(*googleapi.Error).Header. Use
  6524. // googleapi.IsNotModified to check whether the returned error was
  6525. // because http.StatusNotModified was returned.
  6526. func (c *ObjectAccessControlsListCall) Do(opts ...googleapi.CallOption) (*ObjectAccessControls, error) {
  6527. gensupport.SetOptions(c.urlParams_, opts...)
  6528. res, err := c.doRequest("json")
  6529. if res != nil && res.StatusCode == http.StatusNotModified {
  6530. if res.Body != nil {
  6531. res.Body.Close()
  6532. }
  6533. return nil, &googleapi.Error{
  6534. Code: res.StatusCode,
  6535. Header: res.Header,
  6536. }
  6537. }
  6538. if err != nil {
  6539. return nil, err
  6540. }
  6541. defer googleapi.CloseBody(res)
  6542. if err := googleapi.CheckResponse(res); err != nil {
  6543. return nil, err
  6544. }
  6545. ret := &ObjectAccessControls{
  6546. ServerResponse: googleapi.ServerResponse{
  6547. Header: res.Header,
  6548. HTTPStatusCode: res.StatusCode,
  6549. },
  6550. }
  6551. target := &ret
  6552. if err := gensupport.DecodeResponse(target, res); err != nil {
  6553. return nil, err
  6554. }
  6555. return ret, nil
  6556. // {
  6557. // "description": "Retrieves ACL entries on the specified object.",
  6558. // "httpMethod": "GET",
  6559. // "id": "storage.objectAccessControls.list",
  6560. // "parameterOrder": [
  6561. // "bucket",
  6562. // "object"
  6563. // ],
  6564. // "parameters": {
  6565. // "bucket": {
  6566. // "description": "Name of a bucket.",
  6567. // "location": "path",
  6568. // "required": true,
  6569. // "type": "string"
  6570. // },
  6571. // "generation": {
  6572. // "description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).",
  6573. // "format": "int64",
  6574. // "location": "query",
  6575. // "type": "string"
  6576. // },
  6577. // "object": {
  6578. // "description": "Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
  6579. // "location": "path",
  6580. // "required": true,
  6581. // "type": "string"
  6582. // },
  6583. // "userProject": {
  6584. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  6585. // "location": "query",
  6586. // "type": "string"
  6587. // }
  6588. // },
  6589. // "path": "b/{bucket}/o/{object}/acl",
  6590. // "response": {
  6591. // "$ref": "ObjectAccessControls"
  6592. // },
  6593. // "scopes": [
  6594. // "https://www.googleapis.com/auth/cloud-platform",
  6595. // "https://www.googleapis.com/auth/devstorage.full_control"
  6596. // ]
  6597. // }
  6598. }
  6599. // method id "storage.objectAccessControls.patch":
  6600. type ObjectAccessControlsPatchCall struct {
  6601. s *Service
  6602. bucket string
  6603. object string
  6604. entity string
  6605. objectaccesscontrol *ObjectAccessControl
  6606. urlParams_ gensupport.URLParams
  6607. ctx_ context.Context
  6608. header_ http.Header
  6609. }
  6610. // Patch: Patches an ACL entry on the specified object.
  6611. func (r *ObjectAccessControlsService) Patch(bucket string, object string, entity string, objectaccesscontrol *ObjectAccessControl) *ObjectAccessControlsPatchCall {
  6612. c := &ObjectAccessControlsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6613. c.bucket = bucket
  6614. c.object = object
  6615. c.entity = entity
  6616. c.objectaccesscontrol = objectaccesscontrol
  6617. return c
  6618. }
  6619. // Generation sets the optional parameter "generation": If present,
  6620. // selects a specific revision of this object (as opposed to the latest
  6621. // version, the default).
  6622. func (c *ObjectAccessControlsPatchCall) Generation(generation int64) *ObjectAccessControlsPatchCall {
  6623. c.urlParams_.Set("generation", fmt.Sprint(generation))
  6624. return c
  6625. }
  6626. // UserProject sets the optional parameter "userProject": The project to
  6627. // be billed for this request. Required for Requester Pays buckets.
  6628. func (c *ObjectAccessControlsPatchCall) UserProject(userProject string) *ObjectAccessControlsPatchCall {
  6629. c.urlParams_.Set("userProject", userProject)
  6630. return c
  6631. }
  6632. // Fields allows partial responses to be retrieved. See
  6633. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6634. // for more information.
  6635. func (c *ObjectAccessControlsPatchCall) Fields(s ...googleapi.Field) *ObjectAccessControlsPatchCall {
  6636. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6637. return c
  6638. }
  6639. // Context sets the context to be used in this call's Do method. Any
  6640. // pending HTTP request will be aborted if the provided context is
  6641. // canceled.
  6642. func (c *ObjectAccessControlsPatchCall) Context(ctx context.Context) *ObjectAccessControlsPatchCall {
  6643. c.ctx_ = ctx
  6644. return c
  6645. }
  6646. // Header returns an http.Header that can be modified by the caller to
  6647. // add HTTP headers to the request.
  6648. func (c *ObjectAccessControlsPatchCall) Header() http.Header {
  6649. if c.header_ == nil {
  6650. c.header_ = make(http.Header)
  6651. }
  6652. return c.header_
  6653. }
  6654. func (c *ObjectAccessControlsPatchCall) doRequest(alt string) (*http.Response, error) {
  6655. reqHeaders := make(http.Header)
  6656. for k, v := range c.header_ {
  6657. reqHeaders[k] = v
  6658. }
  6659. reqHeaders.Set("User-Agent", c.s.userAgent())
  6660. var body io.Reader = nil
  6661. body, err := googleapi.WithoutDataWrapper.JSONReader(c.objectaccesscontrol)
  6662. if err != nil {
  6663. return nil, err
  6664. }
  6665. reqHeaders.Set("Content-Type", "application/json")
  6666. c.urlParams_.Set("alt", alt)
  6667. c.urlParams_.Set("prettyPrint", "false")
  6668. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}/acl/{entity}")
  6669. urls += "?" + c.urlParams_.Encode()
  6670. req, err := http.NewRequest("PATCH", urls, body)
  6671. if err != nil {
  6672. return nil, err
  6673. }
  6674. req.Header = reqHeaders
  6675. googleapi.Expand(req.URL, map[string]string{
  6676. "bucket": c.bucket,
  6677. "object": c.object,
  6678. "entity": c.entity,
  6679. })
  6680. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6681. }
  6682. // Do executes the "storage.objectAccessControls.patch" call.
  6683. // Exactly one of *ObjectAccessControl or error will be non-nil. Any
  6684. // non-2xx status code is an error. Response headers are in either
  6685. // *ObjectAccessControl.ServerResponse.Header or (if a response was
  6686. // returned at all) in error.(*googleapi.Error).Header. Use
  6687. // googleapi.IsNotModified to check whether the returned error was
  6688. // because http.StatusNotModified was returned.
  6689. func (c *ObjectAccessControlsPatchCall) Do(opts ...googleapi.CallOption) (*ObjectAccessControl, error) {
  6690. gensupport.SetOptions(c.urlParams_, opts...)
  6691. res, err := c.doRequest("json")
  6692. if res != nil && res.StatusCode == http.StatusNotModified {
  6693. if res.Body != nil {
  6694. res.Body.Close()
  6695. }
  6696. return nil, &googleapi.Error{
  6697. Code: res.StatusCode,
  6698. Header: res.Header,
  6699. }
  6700. }
  6701. if err != nil {
  6702. return nil, err
  6703. }
  6704. defer googleapi.CloseBody(res)
  6705. if err := googleapi.CheckResponse(res); err != nil {
  6706. return nil, err
  6707. }
  6708. ret := &ObjectAccessControl{
  6709. ServerResponse: googleapi.ServerResponse{
  6710. Header: res.Header,
  6711. HTTPStatusCode: res.StatusCode,
  6712. },
  6713. }
  6714. target := &ret
  6715. if err := gensupport.DecodeResponse(target, res); err != nil {
  6716. return nil, err
  6717. }
  6718. return ret, nil
  6719. // {
  6720. // "description": "Patches an ACL entry on the specified object.",
  6721. // "httpMethod": "PATCH",
  6722. // "id": "storage.objectAccessControls.patch",
  6723. // "parameterOrder": [
  6724. // "bucket",
  6725. // "object",
  6726. // "entity"
  6727. // ],
  6728. // "parameters": {
  6729. // "bucket": {
  6730. // "description": "Name of a bucket.",
  6731. // "location": "path",
  6732. // "required": true,
  6733. // "type": "string"
  6734. // },
  6735. // "entity": {
  6736. // "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.",
  6737. // "location": "path",
  6738. // "required": true,
  6739. // "type": "string"
  6740. // },
  6741. // "generation": {
  6742. // "description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).",
  6743. // "format": "int64",
  6744. // "location": "query",
  6745. // "type": "string"
  6746. // },
  6747. // "object": {
  6748. // "description": "Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
  6749. // "location": "path",
  6750. // "required": true,
  6751. // "type": "string"
  6752. // },
  6753. // "userProject": {
  6754. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  6755. // "location": "query",
  6756. // "type": "string"
  6757. // }
  6758. // },
  6759. // "path": "b/{bucket}/o/{object}/acl/{entity}",
  6760. // "request": {
  6761. // "$ref": "ObjectAccessControl"
  6762. // },
  6763. // "response": {
  6764. // "$ref": "ObjectAccessControl"
  6765. // },
  6766. // "scopes": [
  6767. // "https://www.googleapis.com/auth/cloud-platform",
  6768. // "https://www.googleapis.com/auth/devstorage.full_control"
  6769. // ]
  6770. // }
  6771. }
  6772. // method id "storage.objectAccessControls.update":
  6773. type ObjectAccessControlsUpdateCall struct {
  6774. s *Service
  6775. bucket string
  6776. object string
  6777. entity string
  6778. objectaccesscontrol *ObjectAccessControl
  6779. urlParams_ gensupport.URLParams
  6780. ctx_ context.Context
  6781. header_ http.Header
  6782. }
  6783. // Update: Updates an ACL entry on the specified object.
  6784. func (r *ObjectAccessControlsService) Update(bucket string, object string, entity string, objectaccesscontrol *ObjectAccessControl) *ObjectAccessControlsUpdateCall {
  6785. c := &ObjectAccessControlsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6786. c.bucket = bucket
  6787. c.object = object
  6788. c.entity = entity
  6789. c.objectaccesscontrol = objectaccesscontrol
  6790. return c
  6791. }
  6792. // Generation sets the optional parameter "generation": If present,
  6793. // selects a specific revision of this object (as opposed to the latest
  6794. // version, the default).
  6795. func (c *ObjectAccessControlsUpdateCall) Generation(generation int64) *ObjectAccessControlsUpdateCall {
  6796. c.urlParams_.Set("generation", fmt.Sprint(generation))
  6797. return c
  6798. }
  6799. // UserProject sets the optional parameter "userProject": The project to
  6800. // be billed for this request. Required for Requester Pays buckets.
  6801. func (c *ObjectAccessControlsUpdateCall) UserProject(userProject string) *ObjectAccessControlsUpdateCall {
  6802. c.urlParams_.Set("userProject", userProject)
  6803. return c
  6804. }
  6805. // Fields allows partial responses to be retrieved. See
  6806. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6807. // for more information.
  6808. func (c *ObjectAccessControlsUpdateCall) Fields(s ...googleapi.Field) *ObjectAccessControlsUpdateCall {
  6809. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6810. return c
  6811. }
  6812. // Context sets the context to be used in this call's Do method. Any
  6813. // pending HTTP request will be aborted if the provided context is
  6814. // canceled.
  6815. func (c *ObjectAccessControlsUpdateCall) Context(ctx context.Context) *ObjectAccessControlsUpdateCall {
  6816. c.ctx_ = ctx
  6817. return c
  6818. }
  6819. // Header returns an http.Header that can be modified by the caller to
  6820. // add HTTP headers to the request.
  6821. func (c *ObjectAccessControlsUpdateCall) Header() http.Header {
  6822. if c.header_ == nil {
  6823. c.header_ = make(http.Header)
  6824. }
  6825. return c.header_
  6826. }
  6827. func (c *ObjectAccessControlsUpdateCall) doRequest(alt string) (*http.Response, error) {
  6828. reqHeaders := make(http.Header)
  6829. for k, v := range c.header_ {
  6830. reqHeaders[k] = v
  6831. }
  6832. reqHeaders.Set("User-Agent", c.s.userAgent())
  6833. var body io.Reader = nil
  6834. body, err := googleapi.WithoutDataWrapper.JSONReader(c.objectaccesscontrol)
  6835. if err != nil {
  6836. return nil, err
  6837. }
  6838. reqHeaders.Set("Content-Type", "application/json")
  6839. c.urlParams_.Set("alt", alt)
  6840. c.urlParams_.Set("prettyPrint", "false")
  6841. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}/acl/{entity}")
  6842. urls += "?" + c.urlParams_.Encode()
  6843. req, err := http.NewRequest("PUT", urls, body)
  6844. if err != nil {
  6845. return nil, err
  6846. }
  6847. req.Header = reqHeaders
  6848. googleapi.Expand(req.URL, map[string]string{
  6849. "bucket": c.bucket,
  6850. "object": c.object,
  6851. "entity": c.entity,
  6852. })
  6853. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6854. }
  6855. // Do executes the "storage.objectAccessControls.update" call.
  6856. // Exactly one of *ObjectAccessControl or error will be non-nil. Any
  6857. // non-2xx status code is an error. Response headers are in either
  6858. // *ObjectAccessControl.ServerResponse.Header or (if a response was
  6859. // returned at all) in error.(*googleapi.Error).Header. Use
  6860. // googleapi.IsNotModified to check whether the returned error was
  6861. // because http.StatusNotModified was returned.
  6862. func (c *ObjectAccessControlsUpdateCall) Do(opts ...googleapi.CallOption) (*ObjectAccessControl, error) {
  6863. gensupport.SetOptions(c.urlParams_, opts...)
  6864. res, err := c.doRequest("json")
  6865. if res != nil && res.StatusCode == http.StatusNotModified {
  6866. if res.Body != nil {
  6867. res.Body.Close()
  6868. }
  6869. return nil, &googleapi.Error{
  6870. Code: res.StatusCode,
  6871. Header: res.Header,
  6872. }
  6873. }
  6874. if err != nil {
  6875. return nil, err
  6876. }
  6877. defer googleapi.CloseBody(res)
  6878. if err := googleapi.CheckResponse(res); err != nil {
  6879. return nil, err
  6880. }
  6881. ret := &ObjectAccessControl{
  6882. ServerResponse: googleapi.ServerResponse{
  6883. Header: res.Header,
  6884. HTTPStatusCode: res.StatusCode,
  6885. },
  6886. }
  6887. target := &ret
  6888. if err := gensupport.DecodeResponse(target, res); err != nil {
  6889. return nil, err
  6890. }
  6891. return ret, nil
  6892. // {
  6893. // "description": "Updates an ACL entry on the specified object.",
  6894. // "httpMethod": "PUT",
  6895. // "id": "storage.objectAccessControls.update",
  6896. // "parameterOrder": [
  6897. // "bucket",
  6898. // "object",
  6899. // "entity"
  6900. // ],
  6901. // "parameters": {
  6902. // "bucket": {
  6903. // "description": "Name of a bucket.",
  6904. // "location": "path",
  6905. // "required": true,
  6906. // "type": "string"
  6907. // },
  6908. // "entity": {
  6909. // "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.",
  6910. // "location": "path",
  6911. // "required": true,
  6912. // "type": "string"
  6913. // },
  6914. // "generation": {
  6915. // "description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).",
  6916. // "format": "int64",
  6917. // "location": "query",
  6918. // "type": "string"
  6919. // },
  6920. // "object": {
  6921. // "description": "Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
  6922. // "location": "path",
  6923. // "required": true,
  6924. // "type": "string"
  6925. // },
  6926. // "userProject": {
  6927. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  6928. // "location": "query",
  6929. // "type": "string"
  6930. // }
  6931. // },
  6932. // "path": "b/{bucket}/o/{object}/acl/{entity}",
  6933. // "request": {
  6934. // "$ref": "ObjectAccessControl"
  6935. // },
  6936. // "response": {
  6937. // "$ref": "ObjectAccessControl"
  6938. // },
  6939. // "scopes": [
  6940. // "https://www.googleapis.com/auth/cloud-platform",
  6941. // "https://www.googleapis.com/auth/devstorage.full_control"
  6942. // ]
  6943. // }
  6944. }
  6945. // method id "storage.objects.compose":
  6946. type ObjectsComposeCall struct {
  6947. s *Service
  6948. destinationBucket string
  6949. destinationObject string
  6950. composerequest *ComposeRequest
  6951. urlParams_ gensupport.URLParams
  6952. ctx_ context.Context
  6953. header_ http.Header
  6954. }
  6955. // Compose: Concatenates a list of existing objects into a new object in
  6956. // the same bucket.
  6957. func (r *ObjectsService) Compose(destinationBucket string, destinationObject string, composerequest *ComposeRequest) *ObjectsComposeCall {
  6958. c := &ObjectsComposeCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6959. c.destinationBucket = destinationBucket
  6960. c.destinationObject = destinationObject
  6961. c.composerequest = composerequest
  6962. return c
  6963. }
  6964. // DestinationPredefinedAcl sets the optional parameter
  6965. // "destinationPredefinedAcl": Apply a predefined set of access controls
  6966. // to the destination object.
  6967. //
  6968. // Possible values:
  6969. // "authenticatedRead" - Object owner gets OWNER access, and
  6970. // allAuthenticatedUsers get READER access.
  6971. // "bucketOwnerFullControl" - Object owner gets OWNER access, and
  6972. // project team owners get OWNER access.
  6973. // "bucketOwnerRead" - Object owner gets OWNER access, and project
  6974. // team owners get READER access.
  6975. // "private" - Object owner gets OWNER access.
  6976. // "projectPrivate" - Object owner gets OWNER access, and project team
  6977. // members get access according to their roles.
  6978. // "publicRead" - Object owner gets OWNER access, and allUsers get
  6979. // READER access.
  6980. func (c *ObjectsComposeCall) DestinationPredefinedAcl(destinationPredefinedAcl string) *ObjectsComposeCall {
  6981. c.urlParams_.Set("destinationPredefinedAcl", destinationPredefinedAcl)
  6982. return c
  6983. }
  6984. // IfGenerationMatch sets the optional parameter "ifGenerationMatch":
  6985. // Makes the operation conditional on whether the object's current
  6986. // generation matches the given value. Setting to 0 makes the operation
  6987. // succeed only if there are no live versions of the object.
  6988. func (c *ObjectsComposeCall) IfGenerationMatch(ifGenerationMatch int64) *ObjectsComposeCall {
  6989. c.urlParams_.Set("ifGenerationMatch", fmt.Sprint(ifGenerationMatch))
  6990. return c
  6991. }
  6992. // IfMetagenerationMatch sets the optional parameter
  6993. // "ifMetagenerationMatch": Makes the operation conditional on whether
  6994. // the object's current metageneration matches the given value.
  6995. func (c *ObjectsComposeCall) IfMetagenerationMatch(ifMetagenerationMatch int64) *ObjectsComposeCall {
  6996. c.urlParams_.Set("ifMetagenerationMatch", fmt.Sprint(ifMetagenerationMatch))
  6997. return c
  6998. }
  6999. // KmsKeyName sets the optional parameter "kmsKeyName": Resource name of
  7000. // the Cloud KMS key, of the form
  7001. // projects/my-project/locations/global/keyRings/my-kr/cryptoKeys/my-key,
  7002. // that will be used to encrypt the object. Overrides the object
  7003. // metadata's kms_key_name value, if any.
  7004. func (c *ObjectsComposeCall) KmsKeyName(kmsKeyName string) *ObjectsComposeCall {
  7005. c.urlParams_.Set("kmsKeyName", kmsKeyName)
  7006. return c
  7007. }
  7008. // UserProject sets the optional parameter "userProject": The project to
  7009. // be billed for this request. Required for Requester Pays buckets.
  7010. func (c *ObjectsComposeCall) UserProject(userProject string) *ObjectsComposeCall {
  7011. c.urlParams_.Set("userProject", userProject)
  7012. return c
  7013. }
  7014. // Fields allows partial responses to be retrieved. See
  7015. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7016. // for more information.
  7017. func (c *ObjectsComposeCall) Fields(s ...googleapi.Field) *ObjectsComposeCall {
  7018. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7019. return c
  7020. }
  7021. // Context sets the context to be used in this call's Do method. Any
  7022. // pending HTTP request will be aborted if the provided context is
  7023. // canceled.
  7024. func (c *ObjectsComposeCall) Context(ctx context.Context) *ObjectsComposeCall {
  7025. c.ctx_ = ctx
  7026. return c
  7027. }
  7028. // Header returns an http.Header that can be modified by the caller to
  7029. // add HTTP headers to the request.
  7030. func (c *ObjectsComposeCall) Header() http.Header {
  7031. if c.header_ == nil {
  7032. c.header_ = make(http.Header)
  7033. }
  7034. return c.header_
  7035. }
  7036. func (c *ObjectsComposeCall) doRequest(alt string) (*http.Response, error) {
  7037. reqHeaders := make(http.Header)
  7038. for k, v := range c.header_ {
  7039. reqHeaders[k] = v
  7040. }
  7041. reqHeaders.Set("User-Agent", c.s.userAgent())
  7042. var body io.Reader = nil
  7043. body, err := googleapi.WithoutDataWrapper.JSONReader(c.composerequest)
  7044. if err != nil {
  7045. return nil, err
  7046. }
  7047. reqHeaders.Set("Content-Type", "application/json")
  7048. c.urlParams_.Set("alt", alt)
  7049. c.urlParams_.Set("prettyPrint", "false")
  7050. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{destinationBucket}/o/{destinationObject}/compose")
  7051. urls += "?" + c.urlParams_.Encode()
  7052. req, err := http.NewRequest("POST", urls, body)
  7053. if err != nil {
  7054. return nil, err
  7055. }
  7056. req.Header = reqHeaders
  7057. googleapi.Expand(req.URL, map[string]string{
  7058. "destinationBucket": c.destinationBucket,
  7059. "destinationObject": c.destinationObject,
  7060. })
  7061. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7062. }
  7063. // Do executes the "storage.objects.compose" call.
  7064. // Exactly one of *Object or error will be non-nil. Any non-2xx status
  7065. // code is an error. Response headers are in either
  7066. // *Object.ServerResponse.Header or (if a response was returned at all)
  7067. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  7068. // check whether the returned error was because http.StatusNotModified
  7069. // was returned.
  7070. func (c *ObjectsComposeCall) Do(opts ...googleapi.CallOption) (*Object, error) {
  7071. gensupport.SetOptions(c.urlParams_, opts...)
  7072. res, err := c.doRequest("json")
  7073. if res != nil && res.StatusCode == http.StatusNotModified {
  7074. if res.Body != nil {
  7075. res.Body.Close()
  7076. }
  7077. return nil, &googleapi.Error{
  7078. Code: res.StatusCode,
  7079. Header: res.Header,
  7080. }
  7081. }
  7082. if err != nil {
  7083. return nil, err
  7084. }
  7085. defer googleapi.CloseBody(res)
  7086. if err := googleapi.CheckResponse(res); err != nil {
  7087. return nil, err
  7088. }
  7089. ret := &Object{
  7090. ServerResponse: googleapi.ServerResponse{
  7091. Header: res.Header,
  7092. HTTPStatusCode: res.StatusCode,
  7093. },
  7094. }
  7095. target := &ret
  7096. if err := gensupport.DecodeResponse(target, res); err != nil {
  7097. return nil, err
  7098. }
  7099. return ret, nil
  7100. // {
  7101. // "description": "Concatenates a list of existing objects into a new object in the same bucket.",
  7102. // "httpMethod": "POST",
  7103. // "id": "storage.objects.compose",
  7104. // "parameterOrder": [
  7105. // "destinationBucket",
  7106. // "destinationObject"
  7107. // ],
  7108. // "parameters": {
  7109. // "destinationBucket": {
  7110. // "description": "Name of the bucket containing the source objects. The destination object is stored in this bucket.",
  7111. // "location": "path",
  7112. // "required": true,
  7113. // "type": "string"
  7114. // },
  7115. // "destinationObject": {
  7116. // "description": "Name of the new object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
  7117. // "location": "path",
  7118. // "required": true,
  7119. // "type": "string"
  7120. // },
  7121. // "destinationPredefinedAcl": {
  7122. // "description": "Apply a predefined set of access controls to the destination object.",
  7123. // "enum": [
  7124. // "authenticatedRead",
  7125. // "bucketOwnerFullControl",
  7126. // "bucketOwnerRead",
  7127. // "private",
  7128. // "projectPrivate",
  7129. // "publicRead"
  7130. // ],
  7131. // "enumDescriptions": [
  7132. // "Object owner gets OWNER access, and allAuthenticatedUsers get READER access.",
  7133. // "Object owner gets OWNER access, and project team owners get OWNER access.",
  7134. // "Object owner gets OWNER access, and project team owners get READER access.",
  7135. // "Object owner gets OWNER access.",
  7136. // "Object owner gets OWNER access, and project team members get access according to their roles.",
  7137. // "Object owner gets OWNER access, and allUsers get READER access."
  7138. // ],
  7139. // "location": "query",
  7140. // "type": "string"
  7141. // },
  7142. // "ifGenerationMatch": {
  7143. // "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.",
  7144. // "format": "int64",
  7145. // "location": "query",
  7146. // "type": "string"
  7147. // },
  7148. // "ifMetagenerationMatch": {
  7149. // "description": "Makes the operation conditional on whether the object's current metageneration matches the given value.",
  7150. // "format": "int64",
  7151. // "location": "query",
  7152. // "type": "string"
  7153. // },
  7154. // "kmsKeyName": {
  7155. // "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.",
  7156. // "location": "query",
  7157. // "type": "string"
  7158. // },
  7159. // "userProject": {
  7160. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  7161. // "location": "query",
  7162. // "type": "string"
  7163. // }
  7164. // },
  7165. // "path": "b/{destinationBucket}/o/{destinationObject}/compose",
  7166. // "request": {
  7167. // "$ref": "ComposeRequest"
  7168. // },
  7169. // "response": {
  7170. // "$ref": "Object"
  7171. // },
  7172. // "scopes": [
  7173. // "https://www.googleapis.com/auth/cloud-platform",
  7174. // "https://www.googleapis.com/auth/devstorage.full_control",
  7175. // "https://www.googleapis.com/auth/devstorage.read_write"
  7176. // ]
  7177. // }
  7178. }
  7179. // method id "storage.objects.copy":
  7180. type ObjectsCopyCall struct {
  7181. s *Service
  7182. sourceBucket string
  7183. sourceObject string
  7184. destinationBucket string
  7185. destinationObject string
  7186. object *Object
  7187. urlParams_ gensupport.URLParams
  7188. ctx_ context.Context
  7189. header_ http.Header
  7190. }
  7191. // Copy: Copies a source object to a destination object. Optionally
  7192. // overrides metadata.
  7193. func (r *ObjectsService) Copy(sourceBucket string, sourceObject string, destinationBucket string, destinationObject string, object *Object) *ObjectsCopyCall {
  7194. c := &ObjectsCopyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7195. c.sourceBucket = sourceBucket
  7196. c.sourceObject = sourceObject
  7197. c.destinationBucket = destinationBucket
  7198. c.destinationObject = destinationObject
  7199. c.object = object
  7200. return c
  7201. }
  7202. // DestinationPredefinedAcl sets the optional parameter
  7203. // "destinationPredefinedAcl": Apply a predefined set of access controls
  7204. // to the destination object.
  7205. //
  7206. // Possible values:
  7207. // "authenticatedRead" - Object owner gets OWNER access, and
  7208. // allAuthenticatedUsers get READER access.
  7209. // "bucketOwnerFullControl" - Object owner gets OWNER access, and
  7210. // project team owners get OWNER access.
  7211. // "bucketOwnerRead" - Object owner gets OWNER access, and project
  7212. // team owners get READER access.
  7213. // "private" - Object owner gets OWNER access.
  7214. // "projectPrivate" - Object owner gets OWNER access, and project team
  7215. // members get access according to their roles.
  7216. // "publicRead" - Object owner gets OWNER access, and allUsers get
  7217. // READER access.
  7218. func (c *ObjectsCopyCall) DestinationPredefinedAcl(destinationPredefinedAcl string) *ObjectsCopyCall {
  7219. c.urlParams_.Set("destinationPredefinedAcl", destinationPredefinedAcl)
  7220. return c
  7221. }
  7222. // IfGenerationMatch sets the optional parameter "ifGenerationMatch":
  7223. // Makes the operation conditional on whether the destination object's
  7224. // current generation matches the given value. Setting to 0 makes the
  7225. // operation succeed only if there are no live versions of the object.
  7226. func (c *ObjectsCopyCall) IfGenerationMatch(ifGenerationMatch int64) *ObjectsCopyCall {
  7227. c.urlParams_.Set("ifGenerationMatch", fmt.Sprint(ifGenerationMatch))
  7228. return c
  7229. }
  7230. // IfGenerationNotMatch sets the optional parameter
  7231. // "ifGenerationNotMatch": Makes the operation conditional on whether
  7232. // the destination object's current generation does not match the given
  7233. // value. If no live object exists, the precondition fails. Setting to 0
  7234. // makes the operation succeed only if there is a live version of the
  7235. // object.
  7236. func (c *ObjectsCopyCall) IfGenerationNotMatch(ifGenerationNotMatch int64) *ObjectsCopyCall {
  7237. c.urlParams_.Set("ifGenerationNotMatch", fmt.Sprint(ifGenerationNotMatch))
  7238. return c
  7239. }
  7240. // IfMetagenerationMatch sets the optional parameter
  7241. // "ifMetagenerationMatch": Makes the operation conditional on whether
  7242. // the destination object's current metageneration matches the given
  7243. // value.
  7244. func (c *ObjectsCopyCall) IfMetagenerationMatch(ifMetagenerationMatch int64) *ObjectsCopyCall {
  7245. c.urlParams_.Set("ifMetagenerationMatch", fmt.Sprint(ifMetagenerationMatch))
  7246. return c
  7247. }
  7248. // IfMetagenerationNotMatch sets the optional parameter
  7249. // "ifMetagenerationNotMatch": Makes the operation conditional on
  7250. // whether the destination object's current metageneration does not
  7251. // match the given value.
  7252. func (c *ObjectsCopyCall) IfMetagenerationNotMatch(ifMetagenerationNotMatch int64) *ObjectsCopyCall {
  7253. c.urlParams_.Set("ifMetagenerationNotMatch", fmt.Sprint(ifMetagenerationNotMatch))
  7254. return c
  7255. }
  7256. // IfSourceGenerationMatch sets the optional parameter
  7257. // "ifSourceGenerationMatch": Makes the operation conditional on whether
  7258. // the source object's current generation matches the given value.
  7259. func (c *ObjectsCopyCall) IfSourceGenerationMatch(ifSourceGenerationMatch int64) *ObjectsCopyCall {
  7260. c.urlParams_.Set("ifSourceGenerationMatch", fmt.Sprint(ifSourceGenerationMatch))
  7261. return c
  7262. }
  7263. // IfSourceGenerationNotMatch sets the optional parameter
  7264. // "ifSourceGenerationNotMatch": Makes the operation conditional on
  7265. // whether the source object's current generation does not match the
  7266. // given value.
  7267. func (c *ObjectsCopyCall) IfSourceGenerationNotMatch(ifSourceGenerationNotMatch int64) *ObjectsCopyCall {
  7268. c.urlParams_.Set("ifSourceGenerationNotMatch", fmt.Sprint(ifSourceGenerationNotMatch))
  7269. return c
  7270. }
  7271. // IfSourceMetagenerationMatch sets the optional parameter
  7272. // "ifSourceMetagenerationMatch": Makes the operation conditional on
  7273. // whether the source object's current metageneration matches the given
  7274. // value.
  7275. func (c *ObjectsCopyCall) IfSourceMetagenerationMatch(ifSourceMetagenerationMatch int64) *ObjectsCopyCall {
  7276. c.urlParams_.Set("ifSourceMetagenerationMatch", fmt.Sprint(ifSourceMetagenerationMatch))
  7277. return c
  7278. }
  7279. // IfSourceMetagenerationNotMatch sets the optional parameter
  7280. // "ifSourceMetagenerationNotMatch": Makes the operation conditional on
  7281. // whether the source object's current metageneration does not match the
  7282. // given value.
  7283. func (c *ObjectsCopyCall) IfSourceMetagenerationNotMatch(ifSourceMetagenerationNotMatch int64) *ObjectsCopyCall {
  7284. c.urlParams_.Set("ifSourceMetagenerationNotMatch", fmt.Sprint(ifSourceMetagenerationNotMatch))
  7285. return c
  7286. }
  7287. // Projection sets the optional parameter "projection": Set of
  7288. // properties to return. Defaults to noAcl, unless the object resource
  7289. // specifies the acl property, when it defaults to full.
  7290. //
  7291. // Possible values:
  7292. // "full" - Include all properties.
  7293. // "noAcl" - Omit the owner, acl property.
  7294. func (c *ObjectsCopyCall) Projection(projection string) *ObjectsCopyCall {
  7295. c.urlParams_.Set("projection", projection)
  7296. return c
  7297. }
  7298. // SourceGeneration sets the optional parameter "sourceGeneration": If
  7299. // present, selects a specific revision of the source object (as opposed
  7300. // to the latest version, the default).
  7301. func (c *ObjectsCopyCall) SourceGeneration(sourceGeneration int64) *ObjectsCopyCall {
  7302. c.urlParams_.Set("sourceGeneration", fmt.Sprint(sourceGeneration))
  7303. return c
  7304. }
  7305. // UserProject sets the optional parameter "userProject": The project to
  7306. // be billed for this request. Required for Requester Pays buckets.
  7307. func (c *ObjectsCopyCall) UserProject(userProject string) *ObjectsCopyCall {
  7308. c.urlParams_.Set("userProject", userProject)
  7309. return c
  7310. }
  7311. // Fields allows partial responses to be retrieved. See
  7312. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7313. // for more information.
  7314. func (c *ObjectsCopyCall) Fields(s ...googleapi.Field) *ObjectsCopyCall {
  7315. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7316. return c
  7317. }
  7318. // Context sets the context to be used in this call's Do method. Any
  7319. // pending HTTP request will be aborted if the provided context is
  7320. // canceled.
  7321. func (c *ObjectsCopyCall) Context(ctx context.Context) *ObjectsCopyCall {
  7322. c.ctx_ = ctx
  7323. return c
  7324. }
  7325. // Header returns an http.Header that can be modified by the caller to
  7326. // add HTTP headers to the request.
  7327. func (c *ObjectsCopyCall) Header() http.Header {
  7328. if c.header_ == nil {
  7329. c.header_ = make(http.Header)
  7330. }
  7331. return c.header_
  7332. }
  7333. func (c *ObjectsCopyCall) doRequest(alt string) (*http.Response, error) {
  7334. reqHeaders := make(http.Header)
  7335. for k, v := range c.header_ {
  7336. reqHeaders[k] = v
  7337. }
  7338. reqHeaders.Set("User-Agent", c.s.userAgent())
  7339. var body io.Reader = nil
  7340. body, err := googleapi.WithoutDataWrapper.JSONReader(c.object)
  7341. if err != nil {
  7342. return nil, err
  7343. }
  7344. reqHeaders.Set("Content-Type", "application/json")
  7345. c.urlParams_.Set("alt", alt)
  7346. c.urlParams_.Set("prettyPrint", "false")
  7347. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{sourceBucket}/o/{sourceObject}/copyTo/b/{destinationBucket}/o/{destinationObject}")
  7348. urls += "?" + c.urlParams_.Encode()
  7349. req, err := http.NewRequest("POST", urls, body)
  7350. if err != nil {
  7351. return nil, err
  7352. }
  7353. req.Header = reqHeaders
  7354. googleapi.Expand(req.URL, map[string]string{
  7355. "sourceBucket": c.sourceBucket,
  7356. "sourceObject": c.sourceObject,
  7357. "destinationBucket": c.destinationBucket,
  7358. "destinationObject": c.destinationObject,
  7359. })
  7360. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7361. }
  7362. // Do executes the "storage.objects.copy" call.
  7363. // Exactly one of *Object or error will be non-nil. Any non-2xx status
  7364. // code is an error. Response headers are in either
  7365. // *Object.ServerResponse.Header or (if a response was returned at all)
  7366. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  7367. // check whether the returned error was because http.StatusNotModified
  7368. // was returned.
  7369. func (c *ObjectsCopyCall) Do(opts ...googleapi.CallOption) (*Object, error) {
  7370. gensupport.SetOptions(c.urlParams_, opts...)
  7371. res, err := c.doRequest("json")
  7372. if res != nil && res.StatusCode == http.StatusNotModified {
  7373. if res.Body != nil {
  7374. res.Body.Close()
  7375. }
  7376. return nil, &googleapi.Error{
  7377. Code: res.StatusCode,
  7378. Header: res.Header,
  7379. }
  7380. }
  7381. if err != nil {
  7382. return nil, err
  7383. }
  7384. defer googleapi.CloseBody(res)
  7385. if err := googleapi.CheckResponse(res); err != nil {
  7386. return nil, err
  7387. }
  7388. ret := &Object{
  7389. ServerResponse: googleapi.ServerResponse{
  7390. Header: res.Header,
  7391. HTTPStatusCode: res.StatusCode,
  7392. },
  7393. }
  7394. target := &ret
  7395. if err := gensupport.DecodeResponse(target, res); err != nil {
  7396. return nil, err
  7397. }
  7398. return ret, nil
  7399. // {
  7400. // "description": "Copies a source object to a destination object. Optionally overrides metadata.",
  7401. // "httpMethod": "POST",
  7402. // "id": "storage.objects.copy",
  7403. // "parameterOrder": [
  7404. // "sourceBucket",
  7405. // "sourceObject",
  7406. // "destinationBucket",
  7407. // "destinationObject"
  7408. // ],
  7409. // "parameters": {
  7410. // "destinationBucket": {
  7411. // "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.",
  7412. // "location": "path",
  7413. // "required": true,
  7414. // "type": "string"
  7415. // },
  7416. // "destinationObject": {
  7417. // "description": "Name of the new object. Required when the object metadata is not otherwise provided. Overrides the object metadata's name value, if any.",
  7418. // "location": "path",
  7419. // "required": true,
  7420. // "type": "string"
  7421. // },
  7422. // "destinationPredefinedAcl": {
  7423. // "description": "Apply a predefined set of access controls to the destination object.",
  7424. // "enum": [
  7425. // "authenticatedRead",
  7426. // "bucketOwnerFullControl",
  7427. // "bucketOwnerRead",
  7428. // "private",
  7429. // "projectPrivate",
  7430. // "publicRead"
  7431. // ],
  7432. // "enumDescriptions": [
  7433. // "Object owner gets OWNER access, and allAuthenticatedUsers get READER access.",
  7434. // "Object owner gets OWNER access, and project team owners get OWNER access.",
  7435. // "Object owner gets OWNER access, and project team owners get READER access.",
  7436. // "Object owner gets OWNER access.",
  7437. // "Object owner gets OWNER access, and project team members get access according to their roles.",
  7438. // "Object owner gets OWNER access, and allUsers get READER access."
  7439. // ],
  7440. // "location": "query",
  7441. // "type": "string"
  7442. // },
  7443. // "ifGenerationMatch": {
  7444. // "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.",
  7445. // "format": "int64",
  7446. // "location": "query",
  7447. // "type": "string"
  7448. // },
  7449. // "ifGenerationNotMatch": {
  7450. // "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.",
  7451. // "format": "int64",
  7452. // "location": "query",
  7453. // "type": "string"
  7454. // },
  7455. // "ifMetagenerationMatch": {
  7456. // "description": "Makes the operation conditional on whether the destination object's current metageneration matches the given value.",
  7457. // "format": "int64",
  7458. // "location": "query",
  7459. // "type": "string"
  7460. // },
  7461. // "ifMetagenerationNotMatch": {
  7462. // "description": "Makes the operation conditional on whether the destination object's current metageneration does not match the given value.",
  7463. // "format": "int64",
  7464. // "location": "query",
  7465. // "type": "string"
  7466. // },
  7467. // "ifSourceGenerationMatch": {
  7468. // "description": "Makes the operation conditional on whether the source object's current generation matches the given value.",
  7469. // "format": "int64",
  7470. // "location": "query",
  7471. // "type": "string"
  7472. // },
  7473. // "ifSourceGenerationNotMatch": {
  7474. // "description": "Makes the operation conditional on whether the source object's current generation does not match the given value.",
  7475. // "format": "int64",
  7476. // "location": "query",
  7477. // "type": "string"
  7478. // },
  7479. // "ifSourceMetagenerationMatch": {
  7480. // "description": "Makes the operation conditional on whether the source object's current metageneration matches the given value.",
  7481. // "format": "int64",
  7482. // "location": "query",
  7483. // "type": "string"
  7484. // },
  7485. // "ifSourceMetagenerationNotMatch": {
  7486. // "description": "Makes the operation conditional on whether the source object's current metageneration does not match the given value.",
  7487. // "format": "int64",
  7488. // "location": "query",
  7489. // "type": "string"
  7490. // },
  7491. // "projection": {
  7492. // "description": "Set of properties to return. Defaults to noAcl, unless the object resource specifies the acl property, when it defaults to full.",
  7493. // "enum": [
  7494. // "full",
  7495. // "noAcl"
  7496. // ],
  7497. // "enumDescriptions": [
  7498. // "Include all properties.",
  7499. // "Omit the owner, acl property."
  7500. // ],
  7501. // "location": "query",
  7502. // "type": "string"
  7503. // },
  7504. // "sourceBucket": {
  7505. // "description": "Name of the bucket in which to find the source object.",
  7506. // "location": "path",
  7507. // "required": true,
  7508. // "type": "string"
  7509. // },
  7510. // "sourceGeneration": {
  7511. // "description": "If present, selects a specific revision of the source object (as opposed to the latest version, the default).",
  7512. // "format": "int64",
  7513. // "location": "query",
  7514. // "type": "string"
  7515. // },
  7516. // "sourceObject": {
  7517. // "description": "Name of the source object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
  7518. // "location": "path",
  7519. // "required": true,
  7520. // "type": "string"
  7521. // },
  7522. // "userProject": {
  7523. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  7524. // "location": "query",
  7525. // "type": "string"
  7526. // }
  7527. // },
  7528. // "path": "b/{sourceBucket}/o/{sourceObject}/copyTo/b/{destinationBucket}/o/{destinationObject}",
  7529. // "request": {
  7530. // "$ref": "Object"
  7531. // },
  7532. // "response": {
  7533. // "$ref": "Object"
  7534. // },
  7535. // "scopes": [
  7536. // "https://www.googleapis.com/auth/cloud-platform",
  7537. // "https://www.googleapis.com/auth/devstorage.full_control",
  7538. // "https://www.googleapis.com/auth/devstorage.read_write"
  7539. // ]
  7540. // }
  7541. }
  7542. // method id "storage.objects.delete":
  7543. type ObjectsDeleteCall struct {
  7544. s *Service
  7545. bucket string
  7546. object string
  7547. urlParams_ gensupport.URLParams
  7548. ctx_ context.Context
  7549. header_ http.Header
  7550. }
  7551. // Delete: Deletes an object and its metadata. Deletions are permanent
  7552. // if versioning is not enabled for the bucket, or if the generation
  7553. // parameter is used.
  7554. func (r *ObjectsService) Delete(bucket string, object string) *ObjectsDeleteCall {
  7555. c := &ObjectsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7556. c.bucket = bucket
  7557. c.object = object
  7558. return c
  7559. }
  7560. // Generation sets the optional parameter "generation": If present,
  7561. // permanently deletes a specific revision of this object (as opposed to
  7562. // the latest version, the default).
  7563. func (c *ObjectsDeleteCall) Generation(generation int64) *ObjectsDeleteCall {
  7564. c.urlParams_.Set("generation", fmt.Sprint(generation))
  7565. return c
  7566. }
  7567. // IfGenerationMatch sets the optional parameter "ifGenerationMatch":
  7568. // Makes the operation conditional on whether the object's current
  7569. // generation matches the given value. Setting to 0 makes the operation
  7570. // succeed only if there are no live versions of the object.
  7571. func (c *ObjectsDeleteCall) IfGenerationMatch(ifGenerationMatch int64) *ObjectsDeleteCall {
  7572. c.urlParams_.Set("ifGenerationMatch", fmt.Sprint(ifGenerationMatch))
  7573. return c
  7574. }
  7575. // IfGenerationNotMatch sets the optional parameter
  7576. // "ifGenerationNotMatch": Makes the operation conditional on whether
  7577. // the object's current generation does not match the given value. If no
  7578. // live object exists, the precondition fails. Setting to 0 makes the
  7579. // operation succeed only if there is a live version of the object.
  7580. func (c *ObjectsDeleteCall) IfGenerationNotMatch(ifGenerationNotMatch int64) *ObjectsDeleteCall {
  7581. c.urlParams_.Set("ifGenerationNotMatch", fmt.Sprint(ifGenerationNotMatch))
  7582. return c
  7583. }
  7584. // IfMetagenerationMatch sets the optional parameter
  7585. // "ifMetagenerationMatch": Makes the operation conditional on whether
  7586. // the object's current metageneration matches the given value.
  7587. func (c *ObjectsDeleteCall) IfMetagenerationMatch(ifMetagenerationMatch int64) *ObjectsDeleteCall {
  7588. c.urlParams_.Set("ifMetagenerationMatch", fmt.Sprint(ifMetagenerationMatch))
  7589. return c
  7590. }
  7591. // IfMetagenerationNotMatch sets the optional parameter
  7592. // "ifMetagenerationNotMatch": Makes the operation conditional on
  7593. // whether the object's current metageneration does not match the given
  7594. // value.
  7595. func (c *ObjectsDeleteCall) IfMetagenerationNotMatch(ifMetagenerationNotMatch int64) *ObjectsDeleteCall {
  7596. c.urlParams_.Set("ifMetagenerationNotMatch", fmt.Sprint(ifMetagenerationNotMatch))
  7597. return c
  7598. }
  7599. // UserProject sets the optional parameter "userProject": The project to
  7600. // be billed for this request. Required for Requester Pays buckets.
  7601. func (c *ObjectsDeleteCall) UserProject(userProject string) *ObjectsDeleteCall {
  7602. c.urlParams_.Set("userProject", userProject)
  7603. return c
  7604. }
  7605. // Fields allows partial responses to be retrieved. See
  7606. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7607. // for more information.
  7608. func (c *ObjectsDeleteCall) Fields(s ...googleapi.Field) *ObjectsDeleteCall {
  7609. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7610. return c
  7611. }
  7612. // Context sets the context to be used in this call's Do method. Any
  7613. // pending HTTP request will be aborted if the provided context is
  7614. // canceled.
  7615. func (c *ObjectsDeleteCall) Context(ctx context.Context) *ObjectsDeleteCall {
  7616. c.ctx_ = ctx
  7617. return c
  7618. }
  7619. // Header returns an http.Header that can be modified by the caller to
  7620. // add HTTP headers to the request.
  7621. func (c *ObjectsDeleteCall) Header() http.Header {
  7622. if c.header_ == nil {
  7623. c.header_ = make(http.Header)
  7624. }
  7625. return c.header_
  7626. }
  7627. func (c *ObjectsDeleteCall) doRequest(alt string) (*http.Response, error) {
  7628. reqHeaders := make(http.Header)
  7629. for k, v := range c.header_ {
  7630. reqHeaders[k] = v
  7631. }
  7632. reqHeaders.Set("User-Agent", c.s.userAgent())
  7633. var body io.Reader = nil
  7634. c.urlParams_.Set("alt", alt)
  7635. c.urlParams_.Set("prettyPrint", "false")
  7636. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}")
  7637. urls += "?" + c.urlParams_.Encode()
  7638. req, err := http.NewRequest("DELETE", urls, body)
  7639. if err != nil {
  7640. return nil, err
  7641. }
  7642. req.Header = reqHeaders
  7643. googleapi.Expand(req.URL, map[string]string{
  7644. "bucket": c.bucket,
  7645. "object": c.object,
  7646. })
  7647. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7648. }
  7649. // Do executes the "storage.objects.delete" call.
  7650. func (c *ObjectsDeleteCall) Do(opts ...googleapi.CallOption) error {
  7651. gensupport.SetOptions(c.urlParams_, opts...)
  7652. res, err := c.doRequest("json")
  7653. if err != nil {
  7654. return err
  7655. }
  7656. defer googleapi.CloseBody(res)
  7657. if err := googleapi.CheckResponse(res); err != nil {
  7658. return err
  7659. }
  7660. return nil
  7661. // {
  7662. // "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.",
  7663. // "httpMethod": "DELETE",
  7664. // "id": "storage.objects.delete",
  7665. // "parameterOrder": [
  7666. // "bucket",
  7667. // "object"
  7668. // ],
  7669. // "parameters": {
  7670. // "bucket": {
  7671. // "description": "Name of the bucket in which the object resides.",
  7672. // "location": "path",
  7673. // "required": true,
  7674. // "type": "string"
  7675. // },
  7676. // "generation": {
  7677. // "description": "If present, permanently deletes a specific revision of this object (as opposed to the latest version, the default).",
  7678. // "format": "int64",
  7679. // "location": "query",
  7680. // "type": "string"
  7681. // },
  7682. // "ifGenerationMatch": {
  7683. // "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.",
  7684. // "format": "int64",
  7685. // "location": "query",
  7686. // "type": "string"
  7687. // },
  7688. // "ifGenerationNotMatch": {
  7689. // "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.",
  7690. // "format": "int64",
  7691. // "location": "query",
  7692. // "type": "string"
  7693. // },
  7694. // "ifMetagenerationMatch": {
  7695. // "description": "Makes the operation conditional on whether the object's current metageneration matches the given value.",
  7696. // "format": "int64",
  7697. // "location": "query",
  7698. // "type": "string"
  7699. // },
  7700. // "ifMetagenerationNotMatch": {
  7701. // "description": "Makes the operation conditional on whether the object's current metageneration does not match the given value.",
  7702. // "format": "int64",
  7703. // "location": "query",
  7704. // "type": "string"
  7705. // },
  7706. // "object": {
  7707. // "description": "Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
  7708. // "location": "path",
  7709. // "required": true,
  7710. // "type": "string"
  7711. // },
  7712. // "userProject": {
  7713. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  7714. // "location": "query",
  7715. // "type": "string"
  7716. // }
  7717. // },
  7718. // "path": "b/{bucket}/o/{object}",
  7719. // "scopes": [
  7720. // "https://www.googleapis.com/auth/cloud-platform",
  7721. // "https://www.googleapis.com/auth/devstorage.full_control",
  7722. // "https://www.googleapis.com/auth/devstorage.read_write"
  7723. // ]
  7724. // }
  7725. }
  7726. // method id "storage.objects.get":
  7727. type ObjectsGetCall struct {
  7728. s *Service
  7729. bucket string
  7730. object string
  7731. urlParams_ gensupport.URLParams
  7732. ifNoneMatch_ string
  7733. ctx_ context.Context
  7734. header_ http.Header
  7735. }
  7736. // Get: Retrieves an object or its metadata.
  7737. func (r *ObjectsService) Get(bucket string, object string) *ObjectsGetCall {
  7738. c := &ObjectsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7739. c.bucket = bucket
  7740. c.object = object
  7741. return c
  7742. }
  7743. // Generation sets the optional parameter "generation": If present,
  7744. // selects a specific revision of this object (as opposed to the latest
  7745. // version, the default).
  7746. func (c *ObjectsGetCall) Generation(generation int64) *ObjectsGetCall {
  7747. c.urlParams_.Set("generation", fmt.Sprint(generation))
  7748. return c
  7749. }
  7750. // IfGenerationMatch sets the optional parameter "ifGenerationMatch":
  7751. // Makes the operation conditional on whether the object's current
  7752. // generation matches the given value. Setting to 0 makes the operation
  7753. // succeed only if there are no live versions of the object.
  7754. func (c *ObjectsGetCall) IfGenerationMatch(ifGenerationMatch int64) *ObjectsGetCall {
  7755. c.urlParams_.Set("ifGenerationMatch", fmt.Sprint(ifGenerationMatch))
  7756. return c
  7757. }
  7758. // IfGenerationNotMatch sets the optional parameter
  7759. // "ifGenerationNotMatch": Makes the operation conditional on whether
  7760. // the object's current generation does not match the given value. If no
  7761. // live object exists, the precondition fails. Setting to 0 makes the
  7762. // operation succeed only if there is a live version of the object.
  7763. func (c *ObjectsGetCall) IfGenerationNotMatch(ifGenerationNotMatch int64) *ObjectsGetCall {
  7764. c.urlParams_.Set("ifGenerationNotMatch", fmt.Sprint(ifGenerationNotMatch))
  7765. return c
  7766. }
  7767. // IfMetagenerationMatch sets the optional parameter
  7768. // "ifMetagenerationMatch": Makes the operation conditional on whether
  7769. // the object's current metageneration matches the given value.
  7770. func (c *ObjectsGetCall) IfMetagenerationMatch(ifMetagenerationMatch int64) *ObjectsGetCall {
  7771. c.urlParams_.Set("ifMetagenerationMatch", fmt.Sprint(ifMetagenerationMatch))
  7772. return c
  7773. }
  7774. // IfMetagenerationNotMatch sets the optional parameter
  7775. // "ifMetagenerationNotMatch": Makes the operation conditional on
  7776. // whether the object's current metageneration does not match the given
  7777. // value.
  7778. func (c *ObjectsGetCall) IfMetagenerationNotMatch(ifMetagenerationNotMatch int64) *ObjectsGetCall {
  7779. c.urlParams_.Set("ifMetagenerationNotMatch", fmt.Sprint(ifMetagenerationNotMatch))
  7780. return c
  7781. }
  7782. // Projection sets the optional parameter "projection": Set of
  7783. // properties to return. Defaults to noAcl.
  7784. //
  7785. // Possible values:
  7786. // "full" - Include all properties.
  7787. // "noAcl" - Omit the owner, acl property.
  7788. func (c *ObjectsGetCall) Projection(projection string) *ObjectsGetCall {
  7789. c.urlParams_.Set("projection", projection)
  7790. return c
  7791. }
  7792. // UserProject sets the optional parameter "userProject": The project to
  7793. // be billed for this request. Required for Requester Pays buckets.
  7794. func (c *ObjectsGetCall) UserProject(userProject string) *ObjectsGetCall {
  7795. c.urlParams_.Set("userProject", userProject)
  7796. return c
  7797. }
  7798. // Fields allows partial responses to be retrieved. See
  7799. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7800. // for more information.
  7801. func (c *ObjectsGetCall) Fields(s ...googleapi.Field) *ObjectsGetCall {
  7802. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7803. return c
  7804. }
  7805. // IfNoneMatch sets the optional parameter which makes the operation
  7806. // fail if the object's ETag matches the given value. This is useful for
  7807. // getting updates only after the object has changed since the last
  7808. // request. Use googleapi.IsNotModified to check whether the response
  7809. // error from Do is the result of In-None-Match.
  7810. func (c *ObjectsGetCall) IfNoneMatch(entityTag string) *ObjectsGetCall {
  7811. c.ifNoneMatch_ = entityTag
  7812. return c
  7813. }
  7814. // Context sets the context to be used in this call's Do and Download
  7815. // methods. Any pending HTTP request will be aborted if the provided
  7816. // context is canceled.
  7817. func (c *ObjectsGetCall) Context(ctx context.Context) *ObjectsGetCall {
  7818. c.ctx_ = ctx
  7819. return c
  7820. }
  7821. // Header returns an http.Header that can be modified by the caller to
  7822. // add HTTP headers to the request.
  7823. func (c *ObjectsGetCall) Header() http.Header {
  7824. if c.header_ == nil {
  7825. c.header_ = make(http.Header)
  7826. }
  7827. return c.header_
  7828. }
  7829. func (c *ObjectsGetCall) doRequest(alt string) (*http.Response, error) {
  7830. reqHeaders := make(http.Header)
  7831. for k, v := range c.header_ {
  7832. reqHeaders[k] = v
  7833. }
  7834. reqHeaders.Set("User-Agent", c.s.userAgent())
  7835. if c.ifNoneMatch_ != "" {
  7836. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  7837. }
  7838. var body io.Reader = nil
  7839. c.urlParams_.Set("alt", alt)
  7840. c.urlParams_.Set("prettyPrint", "false")
  7841. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}")
  7842. urls += "?" + c.urlParams_.Encode()
  7843. req, err := http.NewRequest("GET", urls, body)
  7844. if err != nil {
  7845. return nil, err
  7846. }
  7847. req.Header = reqHeaders
  7848. googleapi.Expand(req.URL, map[string]string{
  7849. "bucket": c.bucket,
  7850. "object": c.object,
  7851. })
  7852. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7853. }
  7854. // Download fetches the API endpoint's "media" value, instead of the normal
  7855. // API response value. If the returned error is nil, the Response is guaranteed to
  7856. // have a 2xx status code. Callers must close the Response.Body as usual.
  7857. func (c *ObjectsGetCall) Download(opts ...googleapi.CallOption) (*http.Response, error) {
  7858. gensupport.SetOptions(c.urlParams_, opts...)
  7859. res, err := c.doRequest("media")
  7860. if err != nil {
  7861. return nil, err
  7862. }
  7863. if err := googleapi.CheckMediaResponse(res); err != nil {
  7864. res.Body.Close()
  7865. return nil, err
  7866. }
  7867. return res, nil
  7868. }
  7869. // Do executes the "storage.objects.get" call.
  7870. // Exactly one of *Object or error will be non-nil. Any non-2xx status
  7871. // code is an error. Response headers are in either
  7872. // *Object.ServerResponse.Header or (if a response was returned at all)
  7873. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  7874. // check whether the returned error was because http.StatusNotModified
  7875. // was returned.
  7876. func (c *ObjectsGetCall) Do(opts ...googleapi.CallOption) (*Object, error) {
  7877. gensupport.SetOptions(c.urlParams_, opts...)
  7878. res, err := c.doRequest("json")
  7879. if res != nil && res.StatusCode == http.StatusNotModified {
  7880. if res.Body != nil {
  7881. res.Body.Close()
  7882. }
  7883. return nil, &googleapi.Error{
  7884. Code: res.StatusCode,
  7885. Header: res.Header,
  7886. }
  7887. }
  7888. if err != nil {
  7889. return nil, err
  7890. }
  7891. defer googleapi.CloseBody(res)
  7892. if err := googleapi.CheckResponse(res); err != nil {
  7893. return nil, err
  7894. }
  7895. ret := &Object{
  7896. ServerResponse: googleapi.ServerResponse{
  7897. Header: res.Header,
  7898. HTTPStatusCode: res.StatusCode,
  7899. },
  7900. }
  7901. target := &ret
  7902. if err := gensupport.DecodeResponse(target, res); err != nil {
  7903. return nil, err
  7904. }
  7905. return ret, nil
  7906. // {
  7907. // "description": "Retrieves an object or its metadata.",
  7908. // "httpMethod": "GET",
  7909. // "id": "storage.objects.get",
  7910. // "parameterOrder": [
  7911. // "bucket",
  7912. // "object"
  7913. // ],
  7914. // "parameters": {
  7915. // "bucket": {
  7916. // "description": "Name of the bucket in which the object resides.",
  7917. // "location": "path",
  7918. // "required": true,
  7919. // "type": "string"
  7920. // },
  7921. // "generation": {
  7922. // "description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).",
  7923. // "format": "int64",
  7924. // "location": "query",
  7925. // "type": "string"
  7926. // },
  7927. // "ifGenerationMatch": {
  7928. // "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.",
  7929. // "format": "int64",
  7930. // "location": "query",
  7931. // "type": "string"
  7932. // },
  7933. // "ifGenerationNotMatch": {
  7934. // "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.",
  7935. // "format": "int64",
  7936. // "location": "query",
  7937. // "type": "string"
  7938. // },
  7939. // "ifMetagenerationMatch": {
  7940. // "description": "Makes the operation conditional on whether the object's current metageneration matches the given value.",
  7941. // "format": "int64",
  7942. // "location": "query",
  7943. // "type": "string"
  7944. // },
  7945. // "ifMetagenerationNotMatch": {
  7946. // "description": "Makes the operation conditional on whether the object's current metageneration does not match the given value.",
  7947. // "format": "int64",
  7948. // "location": "query",
  7949. // "type": "string"
  7950. // },
  7951. // "object": {
  7952. // "description": "Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
  7953. // "location": "path",
  7954. // "required": true,
  7955. // "type": "string"
  7956. // },
  7957. // "projection": {
  7958. // "description": "Set of properties to return. Defaults to noAcl.",
  7959. // "enum": [
  7960. // "full",
  7961. // "noAcl"
  7962. // ],
  7963. // "enumDescriptions": [
  7964. // "Include all properties.",
  7965. // "Omit the owner, acl property."
  7966. // ],
  7967. // "location": "query",
  7968. // "type": "string"
  7969. // },
  7970. // "userProject": {
  7971. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  7972. // "location": "query",
  7973. // "type": "string"
  7974. // }
  7975. // },
  7976. // "path": "b/{bucket}/o/{object}",
  7977. // "response": {
  7978. // "$ref": "Object"
  7979. // },
  7980. // "scopes": [
  7981. // "https://www.googleapis.com/auth/cloud-platform",
  7982. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  7983. // "https://www.googleapis.com/auth/devstorage.full_control",
  7984. // "https://www.googleapis.com/auth/devstorage.read_only",
  7985. // "https://www.googleapis.com/auth/devstorage.read_write"
  7986. // ],
  7987. // "supportsMediaDownload": true,
  7988. // "useMediaDownloadService": true
  7989. // }
  7990. }
  7991. // method id "storage.objects.getIamPolicy":
  7992. type ObjectsGetIamPolicyCall struct {
  7993. s *Service
  7994. bucket string
  7995. object string
  7996. urlParams_ gensupport.URLParams
  7997. ifNoneMatch_ string
  7998. ctx_ context.Context
  7999. header_ http.Header
  8000. }
  8001. // GetIamPolicy: Returns an IAM policy for the specified object.
  8002. func (r *ObjectsService) GetIamPolicy(bucket string, object string) *ObjectsGetIamPolicyCall {
  8003. c := &ObjectsGetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8004. c.bucket = bucket
  8005. c.object = object
  8006. return c
  8007. }
  8008. // Generation sets the optional parameter "generation": If present,
  8009. // selects a specific revision of this object (as opposed to the latest
  8010. // version, the default).
  8011. func (c *ObjectsGetIamPolicyCall) Generation(generation int64) *ObjectsGetIamPolicyCall {
  8012. c.urlParams_.Set("generation", fmt.Sprint(generation))
  8013. return c
  8014. }
  8015. // UserProject sets the optional parameter "userProject": The project to
  8016. // be billed for this request. Required for Requester Pays buckets.
  8017. func (c *ObjectsGetIamPolicyCall) UserProject(userProject string) *ObjectsGetIamPolicyCall {
  8018. c.urlParams_.Set("userProject", userProject)
  8019. return c
  8020. }
  8021. // Fields allows partial responses to be retrieved. See
  8022. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  8023. // for more information.
  8024. func (c *ObjectsGetIamPolicyCall) Fields(s ...googleapi.Field) *ObjectsGetIamPolicyCall {
  8025. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8026. return c
  8027. }
  8028. // IfNoneMatch sets the optional parameter which makes the operation
  8029. // fail if the object's ETag matches the given value. This is useful for
  8030. // getting updates only after the object has changed since the last
  8031. // request. Use googleapi.IsNotModified to check whether the response
  8032. // error from Do is the result of In-None-Match.
  8033. func (c *ObjectsGetIamPolicyCall) IfNoneMatch(entityTag string) *ObjectsGetIamPolicyCall {
  8034. c.ifNoneMatch_ = entityTag
  8035. return c
  8036. }
  8037. // Context sets the context to be used in this call's Do method. Any
  8038. // pending HTTP request will be aborted if the provided context is
  8039. // canceled.
  8040. func (c *ObjectsGetIamPolicyCall) Context(ctx context.Context) *ObjectsGetIamPolicyCall {
  8041. c.ctx_ = ctx
  8042. return c
  8043. }
  8044. // Header returns an http.Header that can be modified by the caller to
  8045. // add HTTP headers to the request.
  8046. func (c *ObjectsGetIamPolicyCall) Header() http.Header {
  8047. if c.header_ == nil {
  8048. c.header_ = make(http.Header)
  8049. }
  8050. return c.header_
  8051. }
  8052. func (c *ObjectsGetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
  8053. reqHeaders := make(http.Header)
  8054. for k, v := range c.header_ {
  8055. reqHeaders[k] = v
  8056. }
  8057. reqHeaders.Set("User-Agent", c.s.userAgent())
  8058. if c.ifNoneMatch_ != "" {
  8059. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  8060. }
  8061. var body io.Reader = nil
  8062. c.urlParams_.Set("alt", alt)
  8063. c.urlParams_.Set("prettyPrint", "false")
  8064. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}/iam")
  8065. urls += "?" + c.urlParams_.Encode()
  8066. req, err := http.NewRequest("GET", urls, body)
  8067. if err != nil {
  8068. return nil, err
  8069. }
  8070. req.Header = reqHeaders
  8071. googleapi.Expand(req.URL, map[string]string{
  8072. "bucket": c.bucket,
  8073. "object": c.object,
  8074. })
  8075. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  8076. }
  8077. // Do executes the "storage.objects.getIamPolicy" call.
  8078. // Exactly one of *Policy or error will be non-nil. Any non-2xx status
  8079. // code is an error. Response headers are in either
  8080. // *Policy.ServerResponse.Header or (if a response was returned at all)
  8081. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  8082. // check whether the returned error was because http.StatusNotModified
  8083. // was returned.
  8084. func (c *ObjectsGetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) {
  8085. gensupport.SetOptions(c.urlParams_, opts...)
  8086. res, err := c.doRequest("json")
  8087. if res != nil && res.StatusCode == http.StatusNotModified {
  8088. if res.Body != nil {
  8089. res.Body.Close()
  8090. }
  8091. return nil, &googleapi.Error{
  8092. Code: res.StatusCode,
  8093. Header: res.Header,
  8094. }
  8095. }
  8096. if err != nil {
  8097. return nil, err
  8098. }
  8099. defer googleapi.CloseBody(res)
  8100. if err := googleapi.CheckResponse(res); err != nil {
  8101. return nil, err
  8102. }
  8103. ret := &Policy{
  8104. ServerResponse: googleapi.ServerResponse{
  8105. Header: res.Header,
  8106. HTTPStatusCode: res.StatusCode,
  8107. },
  8108. }
  8109. target := &ret
  8110. if err := gensupport.DecodeResponse(target, res); err != nil {
  8111. return nil, err
  8112. }
  8113. return ret, nil
  8114. // {
  8115. // "description": "Returns an IAM policy for the specified object.",
  8116. // "httpMethod": "GET",
  8117. // "id": "storage.objects.getIamPolicy",
  8118. // "parameterOrder": [
  8119. // "bucket",
  8120. // "object"
  8121. // ],
  8122. // "parameters": {
  8123. // "bucket": {
  8124. // "description": "Name of the bucket in which the object resides.",
  8125. // "location": "path",
  8126. // "required": true,
  8127. // "type": "string"
  8128. // },
  8129. // "generation": {
  8130. // "description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).",
  8131. // "format": "int64",
  8132. // "location": "query",
  8133. // "type": "string"
  8134. // },
  8135. // "object": {
  8136. // "description": "Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
  8137. // "location": "path",
  8138. // "required": true,
  8139. // "type": "string"
  8140. // },
  8141. // "userProject": {
  8142. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  8143. // "location": "query",
  8144. // "type": "string"
  8145. // }
  8146. // },
  8147. // "path": "b/{bucket}/o/{object}/iam",
  8148. // "response": {
  8149. // "$ref": "Policy"
  8150. // },
  8151. // "scopes": [
  8152. // "https://www.googleapis.com/auth/cloud-platform",
  8153. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  8154. // "https://www.googleapis.com/auth/devstorage.full_control",
  8155. // "https://www.googleapis.com/auth/devstorage.read_only",
  8156. // "https://www.googleapis.com/auth/devstorage.read_write"
  8157. // ]
  8158. // }
  8159. }
  8160. // method id "storage.objects.insert":
  8161. type ObjectsInsertCall struct {
  8162. s *Service
  8163. bucket string
  8164. object *Object
  8165. urlParams_ gensupport.URLParams
  8166. mediaInfo_ *gensupport.MediaInfo
  8167. ctx_ context.Context
  8168. header_ http.Header
  8169. }
  8170. // Insert: Stores a new object and metadata.
  8171. func (r *ObjectsService) Insert(bucket string, object *Object) *ObjectsInsertCall {
  8172. c := &ObjectsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8173. c.bucket = bucket
  8174. c.object = object
  8175. return c
  8176. }
  8177. // ContentEncoding sets the optional parameter "contentEncoding": If
  8178. // set, sets the contentEncoding property of the final object to this
  8179. // value. Setting this parameter is equivalent to setting the
  8180. // contentEncoding metadata property. This can be useful when uploading
  8181. // an object with uploadType=media to indicate the encoding of the
  8182. // content being uploaded.
  8183. func (c *ObjectsInsertCall) ContentEncoding(contentEncoding string) *ObjectsInsertCall {
  8184. c.urlParams_.Set("contentEncoding", contentEncoding)
  8185. return c
  8186. }
  8187. // IfGenerationMatch sets the optional parameter "ifGenerationMatch":
  8188. // Makes the operation conditional on whether the object's current
  8189. // generation matches the given value. Setting to 0 makes the operation
  8190. // succeed only if there are no live versions of the object.
  8191. func (c *ObjectsInsertCall) IfGenerationMatch(ifGenerationMatch int64) *ObjectsInsertCall {
  8192. c.urlParams_.Set("ifGenerationMatch", fmt.Sprint(ifGenerationMatch))
  8193. return c
  8194. }
  8195. // IfGenerationNotMatch sets the optional parameter
  8196. // "ifGenerationNotMatch": Makes the operation conditional on whether
  8197. // the object's current generation does not match the given value. If no
  8198. // live object exists, the precondition fails. Setting to 0 makes the
  8199. // operation succeed only if there is a live version of the object.
  8200. func (c *ObjectsInsertCall) IfGenerationNotMatch(ifGenerationNotMatch int64) *ObjectsInsertCall {
  8201. c.urlParams_.Set("ifGenerationNotMatch", fmt.Sprint(ifGenerationNotMatch))
  8202. return c
  8203. }
  8204. // IfMetagenerationMatch sets the optional parameter
  8205. // "ifMetagenerationMatch": Makes the operation conditional on whether
  8206. // the object's current metageneration matches the given value.
  8207. func (c *ObjectsInsertCall) IfMetagenerationMatch(ifMetagenerationMatch int64) *ObjectsInsertCall {
  8208. c.urlParams_.Set("ifMetagenerationMatch", fmt.Sprint(ifMetagenerationMatch))
  8209. return c
  8210. }
  8211. // IfMetagenerationNotMatch sets the optional parameter
  8212. // "ifMetagenerationNotMatch": Makes the operation conditional on
  8213. // whether the object's current metageneration does not match the given
  8214. // value.
  8215. func (c *ObjectsInsertCall) IfMetagenerationNotMatch(ifMetagenerationNotMatch int64) *ObjectsInsertCall {
  8216. c.urlParams_.Set("ifMetagenerationNotMatch", fmt.Sprint(ifMetagenerationNotMatch))
  8217. return c
  8218. }
  8219. // KmsKeyName sets the optional parameter "kmsKeyName": Resource name of
  8220. // the Cloud KMS key, of the form
  8221. // projects/my-project/locations/global/keyRings/my-kr/cryptoKeys/my-key,
  8222. // that will be used to encrypt the object. Overrides the object
  8223. // metadata's kms_key_name value, if any.
  8224. func (c *ObjectsInsertCall) KmsKeyName(kmsKeyName string) *ObjectsInsertCall {
  8225. c.urlParams_.Set("kmsKeyName", kmsKeyName)
  8226. return c
  8227. }
  8228. // Name sets the optional parameter "name": Name of the object. Required
  8229. // when the object metadata is not otherwise provided. Overrides the
  8230. // object metadata's name value, if any. For information about how to
  8231. // URL encode object names to be path safe, see Encoding URI Path Parts.
  8232. func (c *ObjectsInsertCall) Name(name string) *ObjectsInsertCall {
  8233. c.urlParams_.Set("name", name)
  8234. return c
  8235. }
  8236. // PredefinedAcl sets the optional parameter "predefinedAcl": Apply a
  8237. // predefined set of access controls to this object.
  8238. //
  8239. // Possible values:
  8240. // "authenticatedRead" - Object owner gets OWNER access, and
  8241. // allAuthenticatedUsers get READER access.
  8242. // "bucketOwnerFullControl" - Object owner gets OWNER access, and
  8243. // project team owners get OWNER access.
  8244. // "bucketOwnerRead" - Object owner gets OWNER access, and project
  8245. // team owners get READER access.
  8246. // "private" - Object owner gets OWNER access.
  8247. // "projectPrivate" - Object owner gets OWNER access, and project team
  8248. // members get access according to their roles.
  8249. // "publicRead" - Object owner gets OWNER access, and allUsers get
  8250. // READER access.
  8251. func (c *ObjectsInsertCall) PredefinedAcl(predefinedAcl string) *ObjectsInsertCall {
  8252. c.urlParams_.Set("predefinedAcl", predefinedAcl)
  8253. return c
  8254. }
  8255. // Projection sets the optional parameter "projection": Set of
  8256. // properties to return. Defaults to noAcl, unless the object resource
  8257. // specifies the acl property, when it defaults to full.
  8258. //
  8259. // Possible values:
  8260. // "full" - Include all properties.
  8261. // "noAcl" - Omit the owner, acl property.
  8262. func (c *ObjectsInsertCall) Projection(projection string) *ObjectsInsertCall {
  8263. c.urlParams_.Set("projection", projection)
  8264. return c
  8265. }
  8266. // UserProject sets the optional parameter "userProject": The project to
  8267. // be billed for this request. Required for Requester Pays buckets.
  8268. func (c *ObjectsInsertCall) UserProject(userProject string) *ObjectsInsertCall {
  8269. c.urlParams_.Set("userProject", userProject)
  8270. return c
  8271. }
  8272. // Media specifies the media to upload in one or more chunks. The chunk
  8273. // size may be controlled by supplying a MediaOption generated by
  8274. // googleapi.ChunkSize. The chunk size defaults to
  8275. // googleapi.DefaultUploadChunkSize.The Content-Type header used in the
  8276. // upload request will be determined by sniffing the contents of r,
  8277. // unless a MediaOption generated by googleapi.ContentType is
  8278. // supplied.
  8279. // At most one of Media and ResumableMedia may be set.
  8280. func (c *ObjectsInsertCall) Media(r io.Reader, options ...googleapi.MediaOption) *ObjectsInsertCall {
  8281. if ct := c.object.ContentType; ct != "" {
  8282. options = append([]googleapi.MediaOption{googleapi.ContentType(ct)}, options...)
  8283. }
  8284. c.mediaInfo_ = gensupport.NewInfoFromMedia(r, options)
  8285. return c
  8286. }
  8287. // ResumableMedia specifies the media to upload in chunks and can be
  8288. // canceled with ctx.
  8289. //
  8290. // Deprecated: use Media instead.
  8291. //
  8292. // At most one of Media and ResumableMedia may be set. mediaType
  8293. // identifies the MIME media type of the upload, such as "image/png". If
  8294. // mediaType is "", it will be auto-detected. The provided ctx will
  8295. // supersede any context previously provided to the Context method.
  8296. func (c *ObjectsInsertCall) ResumableMedia(ctx context.Context, r io.ReaderAt, size int64, mediaType string) *ObjectsInsertCall {
  8297. c.ctx_ = ctx
  8298. c.mediaInfo_ = gensupport.NewInfoFromResumableMedia(r, size, mediaType)
  8299. return c
  8300. }
  8301. // ProgressUpdater provides a callback function that will be called
  8302. // after every chunk. It should be a low-latency function in order to
  8303. // not slow down the upload operation. This should only be called when
  8304. // using ResumableMedia (as opposed to Media).
  8305. func (c *ObjectsInsertCall) ProgressUpdater(pu googleapi.ProgressUpdater) *ObjectsInsertCall {
  8306. c.mediaInfo_.SetProgressUpdater(pu)
  8307. return c
  8308. }
  8309. // Fields allows partial responses to be retrieved. See
  8310. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  8311. // for more information.
  8312. func (c *ObjectsInsertCall) Fields(s ...googleapi.Field) *ObjectsInsertCall {
  8313. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8314. return c
  8315. }
  8316. // Context sets the context to be used in this call's Do method. Any
  8317. // pending HTTP request will be aborted if the provided context is
  8318. // canceled.
  8319. // This context will supersede any context previously provided to the
  8320. // ResumableMedia method.
  8321. func (c *ObjectsInsertCall) Context(ctx context.Context) *ObjectsInsertCall {
  8322. c.ctx_ = ctx
  8323. return c
  8324. }
  8325. // Header returns an http.Header that can be modified by the caller to
  8326. // add HTTP headers to the request.
  8327. func (c *ObjectsInsertCall) Header() http.Header {
  8328. if c.header_ == nil {
  8329. c.header_ = make(http.Header)
  8330. }
  8331. return c.header_
  8332. }
  8333. func (c *ObjectsInsertCall) doRequest(alt string) (*http.Response, error) {
  8334. reqHeaders := make(http.Header)
  8335. for k, v := range c.header_ {
  8336. reqHeaders[k] = v
  8337. }
  8338. reqHeaders.Set("User-Agent", c.s.userAgent())
  8339. var body io.Reader = nil
  8340. body, err := googleapi.WithoutDataWrapper.JSONReader(c.object)
  8341. if err != nil {
  8342. return nil, err
  8343. }
  8344. reqHeaders.Set("Content-Type", "application/json")
  8345. c.urlParams_.Set("alt", alt)
  8346. c.urlParams_.Set("prettyPrint", "false")
  8347. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o")
  8348. if c.mediaInfo_ != nil {
  8349. urls = strings.Replace(urls, "https://www.googleapis.com/", "https://www.googleapis.com/upload/", 1)
  8350. c.urlParams_.Set("uploadType", c.mediaInfo_.UploadType())
  8351. }
  8352. if body == nil {
  8353. body = new(bytes.Buffer)
  8354. reqHeaders.Set("Content-Type", "application/json")
  8355. }
  8356. body, getBody, cleanup := c.mediaInfo_.UploadRequest(reqHeaders, body)
  8357. defer cleanup()
  8358. urls += "?" + c.urlParams_.Encode()
  8359. req, err := http.NewRequest("POST", urls, body)
  8360. if err != nil {
  8361. return nil, err
  8362. }
  8363. req.Header = reqHeaders
  8364. gensupport.SetGetBody(req, getBody)
  8365. googleapi.Expand(req.URL, map[string]string{
  8366. "bucket": c.bucket,
  8367. })
  8368. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  8369. }
  8370. // Do executes the "storage.objects.insert" call.
  8371. // Exactly one of *Object or error will be non-nil. Any non-2xx status
  8372. // code is an error. Response headers are in either
  8373. // *Object.ServerResponse.Header or (if a response was returned at all)
  8374. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  8375. // check whether the returned error was because http.StatusNotModified
  8376. // was returned.
  8377. func (c *ObjectsInsertCall) Do(opts ...googleapi.CallOption) (*Object, error) {
  8378. gensupport.SetOptions(c.urlParams_, opts...)
  8379. res, err := c.doRequest("json")
  8380. if res != nil && res.StatusCode == http.StatusNotModified {
  8381. if res.Body != nil {
  8382. res.Body.Close()
  8383. }
  8384. return nil, &googleapi.Error{
  8385. Code: res.StatusCode,
  8386. Header: res.Header,
  8387. }
  8388. }
  8389. if err != nil {
  8390. return nil, err
  8391. }
  8392. defer googleapi.CloseBody(res)
  8393. if err := googleapi.CheckResponse(res); err != nil {
  8394. return nil, err
  8395. }
  8396. rx := c.mediaInfo_.ResumableUpload(res.Header.Get("Location"))
  8397. if rx != nil {
  8398. rx.Client = c.s.client
  8399. rx.UserAgent = c.s.userAgent()
  8400. ctx := c.ctx_
  8401. if ctx == nil {
  8402. ctx = context.TODO()
  8403. }
  8404. res, err = rx.Upload(ctx)
  8405. if err != nil {
  8406. return nil, err
  8407. }
  8408. defer res.Body.Close()
  8409. if err := googleapi.CheckResponse(res); err != nil {
  8410. return nil, err
  8411. }
  8412. }
  8413. ret := &Object{
  8414. ServerResponse: googleapi.ServerResponse{
  8415. Header: res.Header,
  8416. HTTPStatusCode: res.StatusCode,
  8417. },
  8418. }
  8419. target := &ret
  8420. if err := gensupport.DecodeResponse(target, res); err != nil {
  8421. return nil, err
  8422. }
  8423. return ret, nil
  8424. // {
  8425. // "description": "Stores a new object and metadata.",
  8426. // "httpMethod": "POST",
  8427. // "id": "storage.objects.insert",
  8428. // "mediaUpload": {
  8429. // "accept": [
  8430. // "*/*"
  8431. // ],
  8432. // "protocols": {
  8433. // "resumable": {
  8434. // "multipart": true,
  8435. // "path": "/resumable/upload/storage/v1/b/{bucket}/o"
  8436. // },
  8437. // "simple": {
  8438. // "multipart": true,
  8439. // "path": "/upload/storage/v1/b/{bucket}/o"
  8440. // }
  8441. // }
  8442. // },
  8443. // "parameterOrder": [
  8444. // "bucket"
  8445. // ],
  8446. // "parameters": {
  8447. // "bucket": {
  8448. // "description": "Name of the bucket in which to store the new object. Overrides the provided object metadata's bucket value, if any.",
  8449. // "location": "path",
  8450. // "required": true,
  8451. // "type": "string"
  8452. // },
  8453. // "contentEncoding": {
  8454. // "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.",
  8455. // "location": "query",
  8456. // "type": "string"
  8457. // },
  8458. // "ifGenerationMatch": {
  8459. // "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.",
  8460. // "format": "int64",
  8461. // "location": "query",
  8462. // "type": "string"
  8463. // },
  8464. // "ifGenerationNotMatch": {
  8465. // "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.",
  8466. // "format": "int64",
  8467. // "location": "query",
  8468. // "type": "string"
  8469. // },
  8470. // "ifMetagenerationMatch": {
  8471. // "description": "Makes the operation conditional on whether the object's current metageneration matches the given value.",
  8472. // "format": "int64",
  8473. // "location": "query",
  8474. // "type": "string"
  8475. // },
  8476. // "ifMetagenerationNotMatch": {
  8477. // "description": "Makes the operation conditional on whether the object's current metageneration does not match the given value.",
  8478. // "format": "int64",
  8479. // "location": "query",
  8480. // "type": "string"
  8481. // },
  8482. // "kmsKeyName": {
  8483. // "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.",
  8484. // "location": "query",
  8485. // "type": "string"
  8486. // },
  8487. // "name": {
  8488. // "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.",
  8489. // "location": "query",
  8490. // "type": "string"
  8491. // },
  8492. // "predefinedAcl": {
  8493. // "description": "Apply a predefined set of access controls to this object.",
  8494. // "enum": [
  8495. // "authenticatedRead",
  8496. // "bucketOwnerFullControl",
  8497. // "bucketOwnerRead",
  8498. // "private",
  8499. // "projectPrivate",
  8500. // "publicRead"
  8501. // ],
  8502. // "enumDescriptions": [
  8503. // "Object owner gets OWNER access, and allAuthenticatedUsers get READER access.",
  8504. // "Object owner gets OWNER access, and project team owners get OWNER access.",
  8505. // "Object owner gets OWNER access, and project team owners get READER access.",
  8506. // "Object owner gets OWNER access.",
  8507. // "Object owner gets OWNER access, and project team members get access according to their roles.",
  8508. // "Object owner gets OWNER access, and allUsers get READER access."
  8509. // ],
  8510. // "location": "query",
  8511. // "type": "string"
  8512. // },
  8513. // "projection": {
  8514. // "description": "Set of properties to return. Defaults to noAcl, unless the object resource specifies the acl property, when it defaults to full.",
  8515. // "enum": [
  8516. // "full",
  8517. // "noAcl"
  8518. // ],
  8519. // "enumDescriptions": [
  8520. // "Include all properties.",
  8521. // "Omit the owner, acl property."
  8522. // ],
  8523. // "location": "query",
  8524. // "type": "string"
  8525. // },
  8526. // "userProject": {
  8527. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  8528. // "location": "query",
  8529. // "type": "string"
  8530. // }
  8531. // },
  8532. // "path": "b/{bucket}/o",
  8533. // "request": {
  8534. // "$ref": "Object"
  8535. // },
  8536. // "response": {
  8537. // "$ref": "Object"
  8538. // },
  8539. // "scopes": [
  8540. // "https://www.googleapis.com/auth/cloud-platform",
  8541. // "https://www.googleapis.com/auth/devstorage.full_control",
  8542. // "https://www.googleapis.com/auth/devstorage.read_write"
  8543. // ],
  8544. // "supportsMediaUpload": true
  8545. // }
  8546. }
  8547. // method id "storage.objects.list":
  8548. type ObjectsListCall struct {
  8549. s *Service
  8550. bucket string
  8551. urlParams_ gensupport.URLParams
  8552. ifNoneMatch_ string
  8553. ctx_ context.Context
  8554. header_ http.Header
  8555. }
  8556. // List: Retrieves a list of objects matching the criteria.
  8557. func (r *ObjectsService) List(bucket string) *ObjectsListCall {
  8558. c := &ObjectsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8559. c.bucket = bucket
  8560. return c
  8561. }
  8562. // Delimiter sets the optional parameter "delimiter": Returns results in
  8563. // a directory-like mode. items will contain only objects whose names,
  8564. // aside from the prefix, do not contain delimiter. Objects whose names,
  8565. // aside from the prefix, contain delimiter will have their name,
  8566. // truncated after the delimiter, returned in prefixes. Duplicate
  8567. // prefixes are omitted.
  8568. func (c *ObjectsListCall) Delimiter(delimiter string) *ObjectsListCall {
  8569. c.urlParams_.Set("delimiter", delimiter)
  8570. return c
  8571. }
  8572. // IncludeTrailingDelimiter sets the optional parameter
  8573. // "includeTrailingDelimiter": If true, objects that end in exactly one
  8574. // instance of delimiter will have their metadata included in items in
  8575. // addition to prefixes.
  8576. func (c *ObjectsListCall) IncludeTrailingDelimiter(includeTrailingDelimiter bool) *ObjectsListCall {
  8577. c.urlParams_.Set("includeTrailingDelimiter", fmt.Sprint(includeTrailingDelimiter))
  8578. return c
  8579. }
  8580. // MaxResults sets the optional parameter "maxResults": Maximum number
  8581. // of items plus prefixes to return in a single page of responses. As
  8582. // duplicate prefixes are omitted, fewer total results may be returned
  8583. // than requested. The service will use this parameter or 1,000 items,
  8584. // whichever is smaller.
  8585. func (c *ObjectsListCall) MaxResults(maxResults int64) *ObjectsListCall {
  8586. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  8587. return c
  8588. }
  8589. // PageToken sets the optional parameter "pageToken": A
  8590. // previously-returned page token representing part of the larger set of
  8591. // results to view.
  8592. func (c *ObjectsListCall) PageToken(pageToken string) *ObjectsListCall {
  8593. c.urlParams_.Set("pageToken", pageToken)
  8594. return c
  8595. }
  8596. // Prefix sets the optional parameter "prefix": Filter results to
  8597. // objects whose names begin with this prefix.
  8598. func (c *ObjectsListCall) Prefix(prefix string) *ObjectsListCall {
  8599. c.urlParams_.Set("prefix", prefix)
  8600. return c
  8601. }
  8602. // Projection sets the optional parameter "projection": Set of
  8603. // properties to return. Defaults to noAcl.
  8604. //
  8605. // Possible values:
  8606. // "full" - Include all properties.
  8607. // "noAcl" - Omit the owner, acl property.
  8608. func (c *ObjectsListCall) Projection(projection string) *ObjectsListCall {
  8609. c.urlParams_.Set("projection", projection)
  8610. return c
  8611. }
  8612. // UserProject sets the optional parameter "userProject": The project to
  8613. // be billed for this request. Required for Requester Pays buckets.
  8614. func (c *ObjectsListCall) UserProject(userProject string) *ObjectsListCall {
  8615. c.urlParams_.Set("userProject", userProject)
  8616. return c
  8617. }
  8618. // Versions sets the optional parameter "versions": If true, lists all
  8619. // versions of an object as distinct results. The default is false. For
  8620. // more information, see Object Versioning.
  8621. func (c *ObjectsListCall) Versions(versions bool) *ObjectsListCall {
  8622. c.urlParams_.Set("versions", fmt.Sprint(versions))
  8623. return c
  8624. }
  8625. // Fields allows partial responses to be retrieved. See
  8626. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  8627. // for more information.
  8628. func (c *ObjectsListCall) Fields(s ...googleapi.Field) *ObjectsListCall {
  8629. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8630. return c
  8631. }
  8632. // IfNoneMatch sets the optional parameter which makes the operation
  8633. // fail if the object's ETag matches the given value. This is useful for
  8634. // getting updates only after the object has changed since the last
  8635. // request. Use googleapi.IsNotModified to check whether the response
  8636. // error from Do is the result of In-None-Match.
  8637. func (c *ObjectsListCall) IfNoneMatch(entityTag string) *ObjectsListCall {
  8638. c.ifNoneMatch_ = entityTag
  8639. return c
  8640. }
  8641. // Context sets the context to be used in this call's Do method. Any
  8642. // pending HTTP request will be aborted if the provided context is
  8643. // canceled.
  8644. func (c *ObjectsListCall) Context(ctx context.Context) *ObjectsListCall {
  8645. c.ctx_ = ctx
  8646. return c
  8647. }
  8648. // Header returns an http.Header that can be modified by the caller to
  8649. // add HTTP headers to the request.
  8650. func (c *ObjectsListCall) Header() http.Header {
  8651. if c.header_ == nil {
  8652. c.header_ = make(http.Header)
  8653. }
  8654. return c.header_
  8655. }
  8656. func (c *ObjectsListCall) doRequest(alt string) (*http.Response, error) {
  8657. reqHeaders := make(http.Header)
  8658. for k, v := range c.header_ {
  8659. reqHeaders[k] = v
  8660. }
  8661. reqHeaders.Set("User-Agent", c.s.userAgent())
  8662. if c.ifNoneMatch_ != "" {
  8663. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  8664. }
  8665. var body io.Reader = nil
  8666. c.urlParams_.Set("alt", alt)
  8667. c.urlParams_.Set("prettyPrint", "false")
  8668. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o")
  8669. urls += "?" + c.urlParams_.Encode()
  8670. req, err := http.NewRequest("GET", urls, body)
  8671. if err != nil {
  8672. return nil, err
  8673. }
  8674. req.Header = reqHeaders
  8675. googleapi.Expand(req.URL, map[string]string{
  8676. "bucket": c.bucket,
  8677. })
  8678. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  8679. }
  8680. // Do executes the "storage.objects.list" call.
  8681. // Exactly one of *Objects or error will be non-nil. Any non-2xx status
  8682. // code is an error. Response headers are in either
  8683. // *Objects.ServerResponse.Header or (if a response was returned at all)
  8684. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  8685. // check whether the returned error was because http.StatusNotModified
  8686. // was returned.
  8687. func (c *ObjectsListCall) Do(opts ...googleapi.CallOption) (*Objects, error) {
  8688. gensupport.SetOptions(c.urlParams_, opts...)
  8689. res, err := c.doRequest("json")
  8690. if res != nil && res.StatusCode == http.StatusNotModified {
  8691. if res.Body != nil {
  8692. res.Body.Close()
  8693. }
  8694. return nil, &googleapi.Error{
  8695. Code: res.StatusCode,
  8696. Header: res.Header,
  8697. }
  8698. }
  8699. if err != nil {
  8700. return nil, err
  8701. }
  8702. defer googleapi.CloseBody(res)
  8703. if err := googleapi.CheckResponse(res); err != nil {
  8704. return nil, err
  8705. }
  8706. ret := &Objects{
  8707. ServerResponse: googleapi.ServerResponse{
  8708. Header: res.Header,
  8709. HTTPStatusCode: res.StatusCode,
  8710. },
  8711. }
  8712. target := &ret
  8713. if err := gensupport.DecodeResponse(target, res); err != nil {
  8714. return nil, err
  8715. }
  8716. return ret, nil
  8717. // {
  8718. // "description": "Retrieves a list of objects matching the criteria.",
  8719. // "httpMethod": "GET",
  8720. // "id": "storage.objects.list",
  8721. // "parameterOrder": [
  8722. // "bucket"
  8723. // ],
  8724. // "parameters": {
  8725. // "bucket": {
  8726. // "description": "Name of the bucket in which to look for objects.",
  8727. // "location": "path",
  8728. // "required": true,
  8729. // "type": "string"
  8730. // },
  8731. // "delimiter": {
  8732. // "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.",
  8733. // "location": "query",
  8734. // "type": "string"
  8735. // },
  8736. // "includeTrailingDelimiter": {
  8737. // "description": "If true, objects that end in exactly one instance of delimiter will have their metadata included in items in addition to prefixes.",
  8738. // "location": "query",
  8739. // "type": "boolean"
  8740. // },
  8741. // "maxResults": {
  8742. // "default": "1000",
  8743. // "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.",
  8744. // "format": "uint32",
  8745. // "location": "query",
  8746. // "minimum": "0",
  8747. // "type": "integer"
  8748. // },
  8749. // "pageToken": {
  8750. // "description": "A previously-returned page token representing part of the larger set of results to view.",
  8751. // "location": "query",
  8752. // "type": "string"
  8753. // },
  8754. // "prefix": {
  8755. // "description": "Filter results to objects whose names begin with this prefix.",
  8756. // "location": "query",
  8757. // "type": "string"
  8758. // },
  8759. // "projection": {
  8760. // "description": "Set of properties to return. Defaults to noAcl.",
  8761. // "enum": [
  8762. // "full",
  8763. // "noAcl"
  8764. // ],
  8765. // "enumDescriptions": [
  8766. // "Include all properties.",
  8767. // "Omit the owner, acl property."
  8768. // ],
  8769. // "location": "query",
  8770. // "type": "string"
  8771. // },
  8772. // "userProject": {
  8773. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  8774. // "location": "query",
  8775. // "type": "string"
  8776. // },
  8777. // "versions": {
  8778. // "description": "If true, lists all versions of an object as distinct results. The default is false. For more information, see Object Versioning.",
  8779. // "location": "query",
  8780. // "type": "boolean"
  8781. // }
  8782. // },
  8783. // "path": "b/{bucket}/o",
  8784. // "response": {
  8785. // "$ref": "Objects"
  8786. // },
  8787. // "scopes": [
  8788. // "https://www.googleapis.com/auth/cloud-platform",
  8789. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  8790. // "https://www.googleapis.com/auth/devstorage.full_control",
  8791. // "https://www.googleapis.com/auth/devstorage.read_only",
  8792. // "https://www.googleapis.com/auth/devstorage.read_write"
  8793. // ],
  8794. // "supportsSubscription": true
  8795. // }
  8796. }
  8797. // Pages invokes f for each page of results.
  8798. // A non-nil error returned from f will halt the iteration.
  8799. // The provided context supersedes any context provided to the Context method.
  8800. func (c *ObjectsListCall) Pages(ctx context.Context, f func(*Objects) error) error {
  8801. c.ctx_ = ctx
  8802. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  8803. for {
  8804. x, err := c.Do()
  8805. if err != nil {
  8806. return err
  8807. }
  8808. if err := f(x); err != nil {
  8809. return err
  8810. }
  8811. if x.NextPageToken == "" {
  8812. return nil
  8813. }
  8814. c.PageToken(x.NextPageToken)
  8815. }
  8816. }
  8817. // method id "storage.objects.patch":
  8818. type ObjectsPatchCall struct {
  8819. s *Service
  8820. bucket string
  8821. object string
  8822. object2 *Object
  8823. urlParams_ gensupport.URLParams
  8824. ctx_ context.Context
  8825. header_ http.Header
  8826. }
  8827. // Patch: Patches an object's metadata.
  8828. func (r *ObjectsService) Patch(bucket string, object string, object2 *Object) *ObjectsPatchCall {
  8829. c := &ObjectsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8830. c.bucket = bucket
  8831. c.object = object
  8832. c.object2 = object2
  8833. return c
  8834. }
  8835. // Generation sets the optional parameter "generation": If present,
  8836. // selects a specific revision of this object (as opposed to the latest
  8837. // version, the default).
  8838. func (c *ObjectsPatchCall) Generation(generation int64) *ObjectsPatchCall {
  8839. c.urlParams_.Set("generation", fmt.Sprint(generation))
  8840. return c
  8841. }
  8842. // IfGenerationMatch sets the optional parameter "ifGenerationMatch":
  8843. // Makes the operation conditional on whether the object's current
  8844. // generation matches the given value. Setting to 0 makes the operation
  8845. // succeed only if there are no live versions of the object.
  8846. func (c *ObjectsPatchCall) IfGenerationMatch(ifGenerationMatch int64) *ObjectsPatchCall {
  8847. c.urlParams_.Set("ifGenerationMatch", fmt.Sprint(ifGenerationMatch))
  8848. return c
  8849. }
  8850. // IfGenerationNotMatch sets the optional parameter
  8851. // "ifGenerationNotMatch": Makes the operation conditional on whether
  8852. // the object's current generation does not match the given value. If no
  8853. // live object exists, the precondition fails. Setting to 0 makes the
  8854. // operation succeed only if there is a live version of the object.
  8855. func (c *ObjectsPatchCall) IfGenerationNotMatch(ifGenerationNotMatch int64) *ObjectsPatchCall {
  8856. c.urlParams_.Set("ifGenerationNotMatch", fmt.Sprint(ifGenerationNotMatch))
  8857. return c
  8858. }
  8859. // IfMetagenerationMatch sets the optional parameter
  8860. // "ifMetagenerationMatch": Makes the operation conditional on whether
  8861. // the object's current metageneration matches the given value.
  8862. func (c *ObjectsPatchCall) IfMetagenerationMatch(ifMetagenerationMatch int64) *ObjectsPatchCall {
  8863. c.urlParams_.Set("ifMetagenerationMatch", fmt.Sprint(ifMetagenerationMatch))
  8864. return c
  8865. }
  8866. // IfMetagenerationNotMatch sets the optional parameter
  8867. // "ifMetagenerationNotMatch": Makes the operation conditional on
  8868. // whether the object's current metageneration does not match the given
  8869. // value.
  8870. func (c *ObjectsPatchCall) IfMetagenerationNotMatch(ifMetagenerationNotMatch int64) *ObjectsPatchCall {
  8871. c.urlParams_.Set("ifMetagenerationNotMatch", fmt.Sprint(ifMetagenerationNotMatch))
  8872. return c
  8873. }
  8874. // PredefinedAcl sets the optional parameter "predefinedAcl": Apply a
  8875. // predefined set of access controls to this object.
  8876. //
  8877. // Possible values:
  8878. // "authenticatedRead" - Object owner gets OWNER access, and
  8879. // allAuthenticatedUsers get READER access.
  8880. // "bucketOwnerFullControl" - Object owner gets OWNER access, and
  8881. // project team owners get OWNER access.
  8882. // "bucketOwnerRead" - Object owner gets OWNER access, and project
  8883. // team owners get READER access.
  8884. // "private" - Object owner gets OWNER access.
  8885. // "projectPrivate" - Object owner gets OWNER access, and project team
  8886. // members get access according to their roles.
  8887. // "publicRead" - Object owner gets OWNER access, and allUsers get
  8888. // READER access.
  8889. func (c *ObjectsPatchCall) PredefinedAcl(predefinedAcl string) *ObjectsPatchCall {
  8890. c.urlParams_.Set("predefinedAcl", predefinedAcl)
  8891. return c
  8892. }
  8893. // Projection sets the optional parameter "projection": Set of
  8894. // properties to return. Defaults to full.
  8895. //
  8896. // Possible values:
  8897. // "full" - Include all properties.
  8898. // "noAcl" - Omit the owner, acl property.
  8899. func (c *ObjectsPatchCall) Projection(projection string) *ObjectsPatchCall {
  8900. c.urlParams_.Set("projection", projection)
  8901. return c
  8902. }
  8903. // UserProject sets the optional parameter "userProject": The project to
  8904. // be billed for this request, for Requester Pays buckets.
  8905. func (c *ObjectsPatchCall) UserProject(userProject string) *ObjectsPatchCall {
  8906. c.urlParams_.Set("userProject", userProject)
  8907. return c
  8908. }
  8909. // Fields allows partial responses to be retrieved. See
  8910. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  8911. // for more information.
  8912. func (c *ObjectsPatchCall) Fields(s ...googleapi.Field) *ObjectsPatchCall {
  8913. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8914. return c
  8915. }
  8916. // Context sets the context to be used in this call's Do method. Any
  8917. // pending HTTP request will be aborted if the provided context is
  8918. // canceled.
  8919. func (c *ObjectsPatchCall) Context(ctx context.Context) *ObjectsPatchCall {
  8920. c.ctx_ = ctx
  8921. return c
  8922. }
  8923. // Header returns an http.Header that can be modified by the caller to
  8924. // add HTTP headers to the request.
  8925. func (c *ObjectsPatchCall) Header() http.Header {
  8926. if c.header_ == nil {
  8927. c.header_ = make(http.Header)
  8928. }
  8929. return c.header_
  8930. }
  8931. func (c *ObjectsPatchCall) doRequest(alt string) (*http.Response, error) {
  8932. reqHeaders := make(http.Header)
  8933. for k, v := range c.header_ {
  8934. reqHeaders[k] = v
  8935. }
  8936. reqHeaders.Set("User-Agent", c.s.userAgent())
  8937. var body io.Reader = nil
  8938. body, err := googleapi.WithoutDataWrapper.JSONReader(c.object2)
  8939. if err != nil {
  8940. return nil, err
  8941. }
  8942. reqHeaders.Set("Content-Type", "application/json")
  8943. c.urlParams_.Set("alt", alt)
  8944. c.urlParams_.Set("prettyPrint", "false")
  8945. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}")
  8946. urls += "?" + c.urlParams_.Encode()
  8947. req, err := http.NewRequest("PATCH", urls, body)
  8948. if err != nil {
  8949. return nil, err
  8950. }
  8951. req.Header = reqHeaders
  8952. googleapi.Expand(req.URL, map[string]string{
  8953. "bucket": c.bucket,
  8954. "object": c.object,
  8955. })
  8956. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  8957. }
  8958. // Do executes the "storage.objects.patch" call.
  8959. // Exactly one of *Object or error will be non-nil. Any non-2xx status
  8960. // code is an error. Response headers are in either
  8961. // *Object.ServerResponse.Header or (if a response was returned at all)
  8962. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  8963. // check whether the returned error was because http.StatusNotModified
  8964. // was returned.
  8965. func (c *ObjectsPatchCall) Do(opts ...googleapi.CallOption) (*Object, error) {
  8966. gensupport.SetOptions(c.urlParams_, opts...)
  8967. res, err := c.doRequest("json")
  8968. if res != nil && res.StatusCode == http.StatusNotModified {
  8969. if res.Body != nil {
  8970. res.Body.Close()
  8971. }
  8972. return nil, &googleapi.Error{
  8973. Code: res.StatusCode,
  8974. Header: res.Header,
  8975. }
  8976. }
  8977. if err != nil {
  8978. return nil, err
  8979. }
  8980. defer googleapi.CloseBody(res)
  8981. if err := googleapi.CheckResponse(res); err != nil {
  8982. return nil, err
  8983. }
  8984. ret := &Object{
  8985. ServerResponse: googleapi.ServerResponse{
  8986. Header: res.Header,
  8987. HTTPStatusCode: res.StatusCode,
  8988. },
  8989. }
  8990. target := &ret
  8991. if err := gensupport.DecodeResponse(target, res); err != nil {
  8992. return nil, err
  8993. }
  8994. return ret, nil
  8995. // {
  8996. // "description": "Patches an object's metadata.",
  8997. // "httpMethod": "PATCH",
  8998. // "id": "storage.objects.patch",
  8999. // "parameterOrder": [
  9000. // "bucket",
  9001. // "object"
  9002. // ],
  9003. // "parameters": {
  9004. // "bucket": {
  9005. // "description": "Name of the bucket in which the object resides.",
  9006. // "location": "path",
  9007. // "required": true,
  9008. // "type": "string"
  9009. // },
  9010. // "generation": {
  9011. // "description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).",
  9012. // "format": "int64",
  9013. // "location": "query",
  9014. // "type": "string"
  9015. // },
  9016. // "ifGenerationMatch": {
  9017. // "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.",
  9018. // "format": "int64",
  9019. // "location": "query",
  9020. // "type": "string"
  9021. // },
  9022. // "ifGenerationNotMatch": {
  9023. // "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.",
  9024. // "format": "int64",
  9025. // "location": "query",
  9026. // "type": "string"
  9027. // },
  9028. // "ifMetagenerationMatch": {
  9029. // "description": "Makes the operation conditional on whether the object's current metageneration matches the given value.",
  9030. // "format": "int64",
  9031. // "location": "query",
  9032. // "type": "string"
  9033. // },
  9034. // "ifMetagenerationNotMatch": {
  9035. // "description": "Makes the operation conditional on whether the object's current metageneration does not match the given value.",
  9036. // "format": "int64",
  9037. // "location": "query",
  9038. // "type": "string"
  9039. // },
  9040. // "object": {
  9041. // "description": "Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
  9042. // "location": "path",
  9043. // "required": true,
  9044. // "type": "string"
  9045. // },
  9046. // "predefinedAcl": {
  9047. // "description": "Apply a predefined set of access controls to this object.",
  9048. // "enum": [
  9049. // "authenticatedRead",
  9050. // "bucketOwnerFullControl",
  9051. // "bucketOwnerRead",
  9052. // "private",
  9053. // "projectPrivate",
  9054. // "publicRead"
  9055. // ],
  9056. // "enumDescriptions": [
  9057. // "Object owner gets OWNER access, and allAuthenticatedUsers get READER access.",
  9058. // "Object owner gets OWNER access, and project team owners get OWNER access.",
  9059. // "Object owner gets OWNER access, and project team owners get READER access.",
  9060. // "Object owner gets OWNER access.",
  9061. // "Object owner gets OWNER access, and project team members get access according to their roles.",
  9062. // "Object owner gets OWNER access, and allUsers get READER access."
  9063. // ],
  9064. // "location": "query",
  9065. // "type": "string"
  9066. // },
  9067. // "projection": {
  9068. // "description": "Set of properties to return. Defaults to full.",
  9069. // "enum": [
  9070. // "full",
  9071. // "noAcl"
  9072. // ],
  9073. // "enumDescriptions": [
  9074. // "Include all properties.",
  9075. // "Omit the owner, acl property."
  9076. // ],
  9077. // "location": "query",
  9078. // "type": "string"
  9079. // },
  9080. // "userProject": {
  9081. // "description": "The project to be billed for this request, for Requester Pays buckets.",
  9082. // "location": "query",
  9083. // "type": "string"
  9084. // }
  9085. // },
  9086. // "path": "b/{bucket}/o/{object}",
  9087. // "request": {
  9088. // "$ref": "Object"
  9089. // },
  9090. // "response": {
  9091. // "$ref": "Object"
  9092. // },
  9093. // "scopes": [
  9094. // "https://www.googleapis.com/auth/cloud-platform",
  9095. // "https://www.googleapis.com/auth/devstorage.full_control"
  9096. // ]
  9097. // }
  9098. }
  9099. // method id "storage.objects.rewrite":
  9100. type ObjectsRewriteCall struct {
  9101. s *Service
  9102. sourceBucket string
  9103. sourceObject string
  9104. destinationBucket string
  9105. destinationObject string
  9106. object *Object
  9107. urlParams_ gensupport.URLParams
  9108. ctx_ context.Context
  9109. header_ http.Header
  9110. }
  9111. // Rewrite: Rewrites a source object to a destination object. Optionally
  9112. // overrides metadata.
  9113. func (r *ObjectsService) Rewrite(sourceBucket string, sourceObject string, destinationBucket string, destinationObject string, object *Object) *ObjectsRewriteCall {
  9114. c := &ObjectsRewriteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  9115. c.sourceBucket = sourceBucket
  9116. c.sourceObject = sourceObject
  9117. c.destinationBucket = destinationBucket
  9118. c.destinationObject = destinationObject
  9119. c.object = object
  9120. return c
  9121. }
  9122. // DestinationKmsKeyName sets the optional parameter
  9123. // "destinationKmsKeyName": Resource name of the Cloud KMS key, of the
  9124. // form
  9125. // projects/my-project/locations/global/keyRings/my-kr/cryptoKeys/my-key,
  9126. // that will be used to encrypt the object. Overrides the object
  9127. // metadata's kms_key_name value, if any.
  9128. func (c *ObjectsRewriteCall) DestinationKmsKeyName(destinationKmsKeyName string) *ObjectsRewriteCall {
  9129. c.urlParams_.Set("destinationKmsKeyName", destinationKmsKeyName)
  9130. return c
  9131. }
  9132. // DestinationPredefinedAcl sets the optional parameter
  9133. // "destinationPredefinedAcl": Apply a predefined set of access controls
  9134. // to the destination object.
  9135. //
  9136. // Possible values:
  9137. // "authenticatedRead" - Object owner gets OWNER access, and
  9138. // allAuthenticatedUsers get READER access.
  9139. // "bucketOwnerFullControl" - Object owner gets OWNER access, and
  9140. // project team owners get OWNER access.
  9141. // "bucketOwnerRead" - Object owner gets OWNER access, and project
  9142. // team owners get READER access.
  9143. // "private" - Object owner gets OWNER access.
  9144. // "projectPrivate" - Object owner gets OWNER access, and project team
  9145. // members get access according to their roles.
  9146. // "publicRead" - Object owner gets OWNER access, and allUsers get
  9147. // READER access.
  9148. func (c *ObjectsRewriteCall) DestinationPredefinedAcl(destinationPredefinedAcl string) *ObjectsRewriteCall {
  9149. c.urlParams_.Set("destinationPredefinedAcl", destinationPredefinedAcl)
  9150. return c
  9151. }
  9152. // IfGenerationMatch sets the optional parameter "ifGenerationMatch":
  9153. // Makes the operation conditional on whether the object's current
  9154. // generation matches the given value. Setting to 0 makes the operation
  9155. // succeed only if there are no live versions of the object.
  9156. func (c *ObjectsRewriteCall) IfGenerationMatch(ifGenerationMatch int64) *ObjectsRewriteCall {
  9157. c.urlParams_.Set("ifGenerationMatch", fmt.Sprint(ifGenerationMatch))
  9158. return c
  9159. }
  9160. // IfGenerationNotMatch sets the optional parameter
  9161. // "ifGenerationNotMatch": Makes the operation conditional on whether
  9162. // the object's current generation does not match the given value. If no
  9163. // live object exists, the precondition fails. Setting to 0 makes the
  9164. // operation succeed only if there is a live version of the object.
  9165. func (c *ObjectsRewriteCall) IfGenerationNotMatch(ifGenerationNotMatch int64) *ObjectsRewriteCall {
  9166. c.urlParams_.Set("ifGenerationNotMatch", fmt.Sprint(ifGenerationNotMatch))
  9167. return c
  9168. }
  9169. // IfMetagenerationMatch sets the optional parameter
  9170. // "ifMetagenerationMatch": Makes the operation conditional on whether
  9171. // the destination object's current metageneration matches the given
  9172. // value.
  9173. func (c *ObjectsRewriteCall) IfMetagenerationMatch(ifMetagenerationMatch int64) *ObjectsRewriteCall {
  9174. c.urlParams_.Set("ifMetagenerationMatch", fmt.Sprint(ifMetagenerationMatch))
  9175. return c
  9176. }
  9177. // IfMetagenerationNotMatch sets the optional parameter
  9178. // "ifMetagenerationNotMatch": Makes the operation conditional on
  9179. // whether the destination object's current metageneration does not
  9180. // match the given value.
  9181. func (c *ObjectsRewriteCall) IfMetagenerationNotMatch(ifMetagenerationNotMatch int64) *ObjectsRewriteCall {
  9182. c.urlParams_.Set("ifMetagenerationNotMatch", fmt.Sprint(ifMetagenerationNotMatch))
  9183. return c
  9184. }
  9185. // IfSourceGenerationMatch sets the optional parameter
  9186. // "ifSourceGenerationMatch": Makes the operation conditional on whether
  9187. // the source object's current generation matches the given value.
  9188. func (c *ObjectsRewriteCall) IfSourceGenerationMatch(ifSourceGenerationMatch int64) *ObjectsRewriteCall {
  9189. c.urlParams_.Set("ifSourceGenerationMatch", fmt.Sprint(ifSourceGenerationMatch))
  9190. return c
  9191. }
  9192. // IfSourceGenerationNotMatch sets the optional parameter
  9193. // "ifSourceGenerationNotMatch": Makes the operation conditional on
  9194. // whether the source object's current generation does not match the
  9195. // given value.
  9196. func (c *ObjectsRewriteCall) IfSourceGenerationNotMatch(ifSourceGenerationNotMatch int64) *ObjectsRewriteCall {
  9197. c.urlParams_.Set("ifSourceGenerationNotMatch", fmt.Sprint(ifSourceGenerationNotMatch))
  9198. return c
  9199. }
  9200. // IfSourceMetagenerationMatch sets the optional parameter
  9201. // "ifSourceMetagenerationMatch": Makes the operation conditional on
  9202. // whether the source object's current metageneration matches the given
  9203. // value.
  9204. func (c *ObjectsRewriteCall) IfSourceMetagenerationMatch(ifSourceMetagenerationMatch int64) *ObjectsRewriteCall {
  9205. c.urlParams_.Set("ifSourceMetagenerationMatch", fmt.Sprint(ifSourceMetagenerationMatch))
  9206. return c
  9207. }
  9208. // IfSourceMetagenerationNotMatch sets the optional parameter
  9209. // "ifSourceMetagenerationNotMatch": Makes the operation conditional on
  9210. // whether the source object's current metageneration does not match the
  9211. // given value.
  9212. func (c *ObjectsRewriteCall) IfSourceMetagenerationNotMatch(ifSourceMetagenerationNotMatch int64) *ObjectsRewriteCall {
  9213. c.urlParams_.Set("ifSourceMetagenerationNotMatch", fmt.Sprint(ifSourceMetagenerationNotMatch))
  9214. return c
  9215. }
  9216. // MaxBytesRewrittenPerCall sets the optional parameter
  9217. // "maxBytesRewrittenPerCall": The maximum number of bytes that will be
  9218. // rewritten per rewrite request. Most callers shouldn't need to specify
  9219. // this parameter - it is primarily in place to support testing. If
  9220. // specified the value must be an integral multiple of 1 MiB (1048576).
  9221. // Also, this only applies to requests where the source and destination
  9222. // span locations and/or storage classes. Finally, this value must not
  9223. // change across rewrite calls else you'll get an error that the
  9224. // rewriteToken is invalid.
  9225. func (c *ObjectsRewriteCall) MaxBytesRewrittenPerCall(maxBytesRewrittenPerCall int64) *ObjectsRewriteCall {
  9226. c.urlParams_.Set("maxBytesRewrittenPerCall", fmt.Sprint(maxBytesRewrittenPerCall))
  9227. return c
  9228. }
  9229. // Projection sets the optional parameter "projection": Set of
  9230. // properties to return. Defaults to noAcl, unless the object resource
  9231. // specifies the acl property, when it defaults to full.
  9232. //
  9233. // Possible values:
  9234. // "full" - Include all properties.
  9235. // "noAcl" - Omit the owner, acl property.
  9236. func (c *ObjectsRewriteCall) Projection(projection string) *ObjectsRewriteCall {
  9237. c.urlParams_.Set("projection", projection)
  9238. return c
  9239. }
  9240. // RewriteToken sets the optional parameter "rewriteToken": Include this
  9241. // field (from the previous rewrite response) on each rewrite request
  9242. // after the first one, until the rewrite response 'done' flag is true.
  9243. // Calls that provide a rewriteToken can omit all other request fields,
  9244. // but if included those fields must match the values provided in the
  9245. // first rewrite request.
  9246. func (c *ObjectsRewriteCall) RewriteToken(rewriteToken string) *ObjectsRewriteCall {
  9247. c.urlParams_.Set("rewriteToken", rewriteToken)
  9248. return c
  9249. }
  9250. // SourceGeneration sets the optional parameter "sourceGeneration": If
  9251. // present, selects a specific revision of the source object (as opposed
  9252. // to the latest version, the default).
  9253. func (c *ObjectsRewriteCall) SourceGeneration(sourceGeneration int64) *ObjectsRewriteCall {
  9254. c.urlParams_.Set("sourceGeneration", fmt.Sprint(sourceGeneration))
  9255. return c
  9256. }
  9257. // UserProject sets the optional parameter "userProject": The project to
  9258. // be billed for this request. Required for Requester Pays buckets.
  9259. func (c *ObjectsRewriteCall) UserProject(userProject string) *ObjectsRewriteCall {
  9260. c.urlParams_.Set("userProject", userProject)
  9261. return c
  9262. }
  9263. // Fields allows partial responses to be retrieved. See
  9264. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  9265. // for more information.
  9266. func (c *ObjectsRewriteCall) Fields(s ...googleapi.Field) *ObjectsRewriteCall {
  9267. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  9268. return c
  9269. }
  9270. // Context sets the context to be used in this call's Do method. Any
  9271. // pending HTTP request will be aborted if the provided context is
  9272. // canceled.
  9273. func (c *ObjectsRewriteCall) Context(ctx context.Context) *ObjectsRewriteCall {
  9274. c.ctx_ = ctx
  9275. return c
  9276. }
  9277. // Header returns an http.Header that can be modified by the caller to
  9278. // add HTTP headers to the request.
  9279. func (c *ObjectsRewriteCall) Header() http.Header {
  9280. if c.header_ == nil {
  9281. c.header_ = make(http.Header)
  9282. }
  9283. return c.header_
  9284. }
  9285. func (c *ObjectsRewriteCall) doRequest(alt string) (*http.Response, error) {
  9286. reqHeaders := make(http.Header)
  9287. for k, v := range c.header_ {
  9288. reqHeaders[k] = v
  9289. }
  9290. reqHeaders.Set("User-Agent", c.s.userAgent())
  9291. var body io.Reader = nil
  9292. body, err := googleapi.WithoutDataWrapper.JSONReader(c.object)
  9293. if err != nil {
  9294. return nil, err
  9295. }
  9296. reqHeaders.Set("Content-Type", "application/json")
  9297. c.urlParams_.Set("alt", alt)
  9298. c.urlParams_.Set("prettyPrint", "false")
  9299. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{sourceBucket}/o/{sourceObject}/rewriteTo/b/{destinationBucket}/o/{destinationObject}")
  9300. urls += "?" + c.urlParams_.Encode()
  9301. req, err := http.NewRequest("POST", urls, body)
  9302. if err != nil {
  9303. return nil, err
  9304. }
  9305. req.Header = reqHeaders
  9306. googleapi.Expand(req.URL, map[string]string{
  9307. "sourceBucket": c.sourceBucket,
  9308. "sourceObject": c.sourceObject,
  9309. "destinationBucket": c.destinationBucket,
  9310. "destinationObject": c.destinationObject,
  9311. })
  9312. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  9313. }
  9314. // Do executes the "storage.objects.rewrite" call.
  9315. // Exactly one of *RewriteResponse or error will be non-nil. Any non-2xx
  9316. // status code is an error. Response headers are in either
  9317. // *RewriteResponse.ServerResponse.Header or (if a response was returned
  9318. // at all) in error.(*googleapi.Error).Header. Use
  9319. // googleapi.IsNotModified to check whether the returned error was
  9320. // because http.StatusNotModified was returned.
  9321. func (c *ObjectsRewriteCall) Do(opts ...googleapi.CallOption) (*RewriteResponse, error) {
  9322. gensupport.SetOptions(c.urlParams_, opts...)
  9323. res, err := c.doRequest("json")
  9324. if res != nil && res.StatusCode == http.StatusNotModified {
  9325. if res.Body != nil {
  9326. res.Body.Close()
  9327. }
  9328. return nil, &googleapi.Error{
  9329. Code: res.StatusCode,
  9330. Header: res.Header,
  9331. }
  9332. }
  9333. if err != nil {
  9334. return nil, err
  9335. }
  9336. defer googleapi.CloseBody(res)
  9337. if err := googleapi.CheckResponse(res); err != nil {
  9338. return nil, err
  9339. }
  9340. ret := &RewriteResponse{
  9341. ServerResponse: googleapi.ServerResponse{
  9342. Header: res.Header,
  9343. HTTPStatusCode: res.StatusCode,
  9344. },
  9345. }
  9346. target := &ret
  9347. if err := gensupport.DecodeResponse(target, res); err != nil {
  9348. return nil, err
  9349. }
  9350. return ret, nil
  9351. // {
  9352. // "description": "Rewrites a source object to a destination object. Optionally overrides metadata.",
  9353. // "httpMethod": "POST",
  9354. // "id": "storage.objects.rewrite",
  9355. // "parameterOrder": [
  9356. // "sourceBucket",
  9357. // "sourceObject",
  9358. // "destinationBucket",
  9359. // "destinationObject"
  9360. // ],
  9361. // "parameters": {
  9362. // "destinationBucket": {
  9363. // "description": "Name of the bucket in which to store the new object. Overrides the provided object metadata's bucket value, if any.",
  9364. // "location": "path",
  9365. // "required": true,
  9366. // "type": "string"
  9367. // },
  9368. // "destinationKmsKeyName": {
  9369. // "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.",
  9370. // "location": "query",
  9371. // "type": "string"
  9372. // },
  9373. // "destinationObject": {
  9374. // "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.",
  9375. // "location": "path",
  9376. // "required": true,
  9377. // "type": "string"
  9378. // },
  9379. // "destinationPredefinedAcl": {
  9380. // "description": "Apply a predefined set of access controls to the destination object.",
  9381. // "enum": [
  9382. // "authenticatedRead",
  9383. // "bucketOwnerFullControl",
  9384. // "bucketOwnerRead",
  9385. // "private",
  9386. // "projectPrivate",
  9387. // "publicRead"
  9388. // ],
  9389. // "enumDescriptions": [
  9390. // "Object owner gets OWNER access, and allAuthenticatedUsers get READER access.",
  9391. // "Object owner gets OWNER access, and project team owners get OWNER access.",
  9392. // "Object owner gets OWNER access, and project team owners get READER access.",
  9393. // "Object owner gets OWNER access.",
  9394. // "Object owner gets OWNER access, and project team members get access according to their roles.",
  9395. // "Object owner gets OWNER access, and allUsers get READER access."
  9396. // ],
  9397. // "location": "query",
  9398. // "type": "string"
  9399. // },
  9400. // "ifGenerationMatch": {
  9401. // "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.",
  9402. // "format": "int64",
  9403. // "location": "query",
  9404. // "type": "string"
  9405. // },
  9406. // "ifGenerationNotMatch": {
  9407. // "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.",
  9408. // "format": "int64",
  9409. // "location": "query",
  9410. // "type": "string"
  9411. // },
  9412. // "ifMetagenerationMatch": {
  9413. // "description": "Makes the operation conditional on whether the destination object's current metageneration matches the given value.",
  9414. // "format": "int64",
  9415. // "location": "query",
  9416. // "type": "string"
  9417. // },
  9418. // "ifMetagenerationNotMatch": {
  9419. // "description": "Makes the operation conditional on whether the destination object's current metageneration does not match the given value.",
  9420. // "format": "int64",
  9421. // "location": "query",
  9422. // "type": "string"
  9423. // },
  9424. // "ifSourceGenerationMatch": {
  9425. // "description": "Makes the operation conditional on whether the source object's current generation matches the given value.",
  9426. // "format": "int64",
  9427. // "location": "query",
  9428. // "type": "string"
  9429. // },
  9430. // "ifSourceGenerationNotMatch": {
  9431. // "description": "Makes the operation conditional on whether the source object's current generation does not match the given value.",
  9432. // "format": "int64",
  9433. // "location": "query",
  9434. // "type": "string"
  9435. // },
  9436. // "ifSourceMetagenerationMatch": {
  9437. // "description": "Makes the operation conditional on whether the source object's current metageneration matches the given value.",
  9438. // "format": "int64",
  9439. // "location": "query",
  9440. // "type": "string"
  9441. // },
  9442. // "ifSourceMetagenerationNotMatch": {
  9443. // "description": "Makes the operation conditional on whether the source object's current metageneration does not match the given value.",
  9444. // "format": "int64",
  9445. // "location": "query",
  9446. // "type": "string"
  9447. // },
  9448. // "maxBytesRewrittenPerCall": {
  9449. // "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.",
  9450. // "format": "int64",
  9451. // "location": "query",
  9452. // "type": "string"
  9453. // },
  9454. // "projection": {
  9455. // "description": "Set of properties to return. Defaults to noAcl, unless the object resource specifies the acl property, when it defaults to full.",
  9456. // "enum": [
  9457. // "full",
  9458. // "noAcl"
  9459. // ],
  9460. // "enumDescriptions": [
  9461. // "Include all properties.",
  9462. // "Omit the owner, acl property."
  9463. // ],
  9464. // "location": "query",
  9465. // "type": "string"
  9466. // },
  9467. // "rewriteToken": {
  9468. // "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.",
  9469. // "location": "query",
  9470. // "type": "string"
  9471. // },
  9472. // "sourceBucket": {
  9473. // "description": "Name of the bucket in which to find the source object.",
  9474. // "location": "path",
  9475. // "required": true,
  9476. // "type": "string"
  9477. // },
  9478. // "sourceGeneration": {
  9479. // "description": "If present, selects a specific revision of the source object (as opposed to the latest version, the default).",
  9480. // "format": "int64",
  9481. // "location": "query",
  9482. // "type": "string"
  9483. // },
  9484. // "sourceObject": {
  9485. // "description": "Name of the source object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
  9486. // "location": "path",
  9487. // "required": true,
  9488. // "type": "string"
  9489. // },
  9490. // "userProject": {
  9491. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  9492. // "location": "query",
  9493. // "type": "string"
  9494. // }
  9495. // },
  9496. // "path": "b/{sourceBucket}/o/{sourceObject}/rewriteTo/b/{destinationBucket}/o/{destinationObject}",
  9497. // "request": {
  9498. // "$ref": "Object"
  9499. // },
  9500. // "response": {
  9501. // "$ref": "RewriteResponse"
  9502. // },
  9503. // "scopes": [
  9504. // "https://www.googleapis.com/auth/cloud-platform",
  9505. // "https://www.googleapis.com/auth/devstorage.full_control",
  9506. // "https://www.googleapis.com/auth/devstorage.read_write"
  9507. // ]
  9508. // }
  9509. }
  9510. // method id "storage.objects.setIamPolicy":
  9511. type ObjectsSetIamPolicyCall struct {
  9512. s *Service
  9513. bucket string
  9514. object string
  9515. policy *Policy
  9516. urlParams_ gensupport.URLParams
  9517. ctx_ context.Context
  9518. header_ http.Header
  9519. }
  9520. // SetIamPolicy: Updates an IAM policy for the specified object.
  9521. func (r *ObjectsService) SetIamPolicy(bucket string, object string, policy *Policy) *ObjectsSetIamPolicyCall {
  9522. c := &ObjectsSetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  9523. c.bucket = bucket
  9524. c.object = object
  9525. c.policy = policy
  9526. return c
  9527. }
  9528. // Generation sets the optional parameter "generation": If present,
  9529. // selects a specific revision of this object (as opposed to the latest
  9530. // version, the default).
  9531. func (c *ObjectsSetIamPolicyCall) Generation(generation int64) *ObjectsSetIamPolicyCall {
  9532. c.urlParams_.Set("generation", fmt.Sprint(generation))
  9533. return c
  9534. }
  9535. // UserProject sets the optional parameter "userProject": The project to
  9536. // be billed for this request. Required for Requester Pays buckets.
  9537. func (c *ObjectsSetIamPolicyCall) UserProject(userProject string) *ObjectsSetIamPolicyCall {
  9538. c.urlParams_.Set("userProject", userProject)
  9539. return c
  9540. }
  9541. // Fields allows partial responses to be retrieved. See
  9542. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  9543. // for more information.
  9544. func (c *ObjectsSetIamPolicyCall) Fields(s ...googleapi.Field) *ObjectsSetIamPolicyCall {
  9545. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  9546. return c
  9547. }
  9548. // Context sets the context to be used in this call's Do method. Any
  9549. // pending HTTP request will be aborted if the provided context is
  9550. // canceled.
  9551. func (c *ObjectsSetIamPolicyCall) Context(ctx context.Context) *ObjectsSetIamPolicyCall {
  9552. c.ctx_ = ctx
  9553. return c
  9554. }
  9555. // Header returns an http.Header that can be modified by the caller to
  9556. // add HTTP headers to the request.
  9557. func (c *ObjectsSetIamPolicyCall) Header() http.Header {
  9558. if c.header_ == nil {
  9559. c.header_ = make(http.Header)
  9560. }
  9561. return c.header_
  9562. }
  9563. func (c *ObjectsSetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
  9564. reqHeaders := make(http.Header)
  9565. for k, v := range c.header_ {
  9566. reqHeaders[k] = v
  9567. }
  9568. reqHeaders.Set("User-Agent", c.s.userAgent())
  9569. var body io.Reader = nil
  9570. body, err := googleapi.WithoutDataWrapper.JSONReader(c.policy)
  9571. if err != nil {
  9572. return nil, err
  9573. }
  9574. reqHeaders.Set("Content-Type", "application/json")
  9575. c.urlParams_.Set("alt", alt)
  9576. c.urlParams_.Set("prettyPrint", "false")
  9577. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}/iam")
  9578. urls += "?" + c.urlParams_.Encode()
  9579. req, err := http.NewRequest("PUT", urls, body)
  9580. if err != nil {
  9581. return nil, err
  9582. }
  9583. req.Header = reqHeaders
  9584. googleapi.Expand(req.URL, map[string]string{
  9585. "bucket": c.bucket,
  9586. "object": c.object,
  9587. })
  9588. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  9589. }
  9590. // Do executes the "storage.objects.setIamPolicy" call.
  9591. // Exactly one of *Policy or error will be non-nil. Any non-2xx status
  9592. // code is an error. Response headers are in either
  9593. // *Policy.ServerResponse.Header or (if a response was returned at all)
  9594. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  9595. // check whether the returned error was because http.StatusNotModified
  9596. // was returned.
  9597. func (c *ObjectsSetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) {
  9598. gensupport.SetOptions(c.urlParams_, opts...)
  9599. res, err := c.doRequest("json")
  9600. if res != nil && res.StatusCode == http.StatusNotModified {
  9601. if res.Body != nil {
  9602. res.Body.Close()
  9603. }
  9604. return nil, &googleapi.Error{
  9605. Code: res.StatusCode,
  9606. Header: res.Header,
  9607. }
  9608. }
  9609. if err != nil {
  9610. return nil, err
  9611. }
  9612. defer googleapi.CloseBody(res)
  9613. if err := googleapi.CheckResponse(res); err != nil {
  9614. return nil, err
  9615. }
  9616. ret := &Policy{
  9617. ServerResponse: googleapi.ServerResponse{
  9618. Header: res.Header,
  9619. HTTPStatusCode: res.StatusCode,
  9620. },
  9621. }
  9622. target := &ret
  9623. if err := gensupport.DecodeResponse(target, res); err != nil {
  9624. return nil, err
  9625. }
  9626. return ret, nil
  9627. // {
  9628. // "description": "Updates an IAM policy for the specified object.",
  9629. // "httpMethod": "PUT",
  9630. // "id": "storage.objects.setIamPolicy",
  9631. // "parameterOrder": [
  9632. // "bucket",
  9633. // "object"
  9634. // ],
  9635. // "parameters": {
  9636. // "bucket": {
  9637. // "description": "Name of the bucket in which the object resides.",
  9638. // "location": "path",
  9639. // "required": true,
  9640. // "type": "string"
  9641. // },
  9642. // "generation": {
  9643. // "description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).",
  9644. // "format": "int64",
  9645. // "location": "query",
  9646. // "type": "string"
  9647. // },
  9648. // "object": {
  9649. // "description": "Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
  9650. // "location": "path",
  9651. // "required": true,
  9652. // "type": "string"
  9653. // },
  9654. // "userProject": {
  9655. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  9656. // "location": "query",
  9657. // "type": "string"
  9658. // }
  9659. // },
  9660. // "path": "b/{bucket}/o/{object}/iam",
  9661. // "request": {
  9662. // "$ref": "Policy"
  9663. // },
  9664. // "response": {
  9665. // "$ref": "Policy"
  9666. // },
  9667. // "scopes": [
  9668. // "https://www.googleapis.com/auth/cloud-platform",
  9669. // "https://www.googleapis.com/auth/devstorage.full_control",
  9670. // "https://www.googleapis.com/auth/devstorage.read_write"
  9671. // ]
  9672. // }
  9673. }
  9674. // method id "storage.objects.testIamPermissions":
  9675. type ObjectsTestIamPermissionsCall struct {
  9676. s *Service
  9677. bucket string
  9678. object string
  9679. urlParams_ gensupport.URLParams
  9680. ifNoneMatch_ string
  9681. ctx_ context.Context
  9682. header_ http.Header
  9683. }
  9684. // TestIamPermissions: Tests a set of permissions on the given object to
  9685. // see which, if any, are held by the caller.
  9686. func (r *ObjectsService) TestIamPermissions(bucket string, object string, permissions []string) *ObjectsTestIamPermissionsCall {
  9687. c := &ObjectsTestIamPermissionsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  9688. c.bucket = bucket
  9689. c.object = object
  9690. c.urlParams_.SetMulti("permissions", append([]string{}, permissions...))
  9691. return c
  9692. }
  9693. // Generation sets the optional parameter "generation": If present,
  9694. // selects a specific revision of this object (as opposed to the latest
  9695. // version, the default).
  9696. func (c *ObjectsTestIamPermissionsCall) Generation(generation int64) *ObjectsTestIamPermissionsCall {
  9697. c.urlParams_.Set("generation", fmt.Sprint(generation))
  9698. return c
  9699. }
  9700. // UserProject sets the optional parameter "userProject": The project to
  9701. // be billed for this request. Required for Requester Pays buckets.
  9702. func (c *ObjectsTestIamPermissionsCall) UserProject(userProject string) *ObjectsTestIamPermissionsCall {
  9703. c.urlParams_.Set("userProject", userProject)
  9704. return c
  9705. }
  9706. // Fields allows partial responses to be retrieved. See
  9707. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  9708. // for more information.
  9709. func (c *ObjectsTestIamPermissionsCall) Fields(s ...googleapi.Field) *ObjectsTestIamPermissionsCall {
  9710. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  9711. return c
  9712. }
  9713. // IfNoneMatch sets the optional parameter which makes the operation
  9714. // fail if the object's ETag matches the given value. This is useful for
  9715. // getting updates only after the object has changed since the last
  9716. // request. Use googleapi.IsNotModified to check whether the response
  9717. // error from Do is the result of In-None-Match.
  9718. func (c *ObjectsTestIamPermissionsCall) IfNoneMatch(entityTag string) *ObjectsTestIamPermissionsCall {
  9719. c.ifNoneMatch_ = entityTag
  9720. return c
  9721. }
  9722. // Context sets the context to be used in this call's Do method. Any
  9723. // pending HTTP request will be aborted if the provided context is
  9724. // canceled.
  9725. func (c *ObjectsTestIamPermissionsCall) Context(ctx context.Context) *ObjectsTestIamPermissionsCall {
  9726. c.ctx_ = ctx
  9727. return c
  9728. }
  9729. // Header returns an http.Header that can be modified by the caller to
  9730. // add HTTP headers to the request.
  9731. func (c *ObjectsTestIamPermissionsCall) Header() http.Header {
  9732. if c.header_ == nil {
  9733. c.header_ = make(http.Header)
  9734. }
  9735. return c.header_
  9736. }
  9737. func (c *ObjectsTestIamPermissionsCall) doRequest(alt string) (*http.Response, error) {
  9738. reqHeaders := make(http.Header)
  9739. for k, v := range c.header_ {
  9740. reqHeaders[k] = v
  9741. }
  9742. reqHeaders.Set("User-Agent", c.s.userAgent())
  9743. if c.ifNoneMatch_ != "" {
  9744. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  9745. }
  9746. var body io.Reader = nil
  9747. c.urlParams_.Set("alt", alt)
  9748. c.urlParams_.Set("prettyPrint", "false")
  9749. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}/iam/testPermissions")
  9750. urls += "?" + c.urlParams_.Encode()
  9751. req, err := http.NewRequest("GET", urls, body)
  9752. if err != nil {
  9753. return nil, err
  9754. }
  9755. req.Header = reqHeaders
  9756. googleapi.Expand(req.URL, map[string]string{
  9757. "bucket": c.bucket,
  9758. "object": c.object,
  9759. })
  9760. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  9761. }
  9762. // Do executes the "storage.objects.testIamPermissions" call.
  9763. // Exactly one of *TestIamPermissionsResponse or error will be non-nil.
  9764. // Any non-2xx status code is an error. Response headers are in either
  9765. // *TestIamPermissionsResponse.ServerResponse.Header or (if a response
  9766. // was returned at all) in error.(*googleapi.Error).Header. Use
  9767. // googleapi.IsNotModified to check whether the returned error was
  9768. // because http.StatusNotModified was returned.
  9769. func (c *ObjectsTestIamPermissionsCall) Do(opts ...googleapi.CallOption) (*TestIamPermissionsResponse, error) {
  9770. gensupport.SetOptions(c.urlParams_, opts...)
  9771. res, err := c.doRequest("json")
  9772. if res != nil && res.StatusCode == http.StatusNotModified {
  9773. if res.Body != nil {
  9774. res.Body.Close()
  9775. }
  9776. return nil, &googleapi.Error{
  9777. Code: res.StatusCode,
  9778. Header: res.Header,
  9779. }
  9780. }
  9781. if err != nil {
  9782. return nil, err
  9783. }
  9784. defer googleapi.CloseBody(res)
  9785. if err := googleapi.CheckResponse(res); err != nil {
  9786. return nil, err
  9787. }
  9788. ret := &TestIamPermissionsResponse{
  9789. ServerResponse: googleapi.ServerResponse{
  9790. Header: res.Header,
  9791. HTTPStatusCode: res.StatusCode,
  9792. },
  9793. }
  9794. target := &ret
  9795. if err := gensupport.DecodeResponse(target, res); err != nil {
  9796. return nil, err
  9797. }
  9798. return ret, nil
  9799. // {
  9800. // "description": "Tests a set of permissions on the given object to see which, if any, are held by the caller.",
  9801. // "httpMethod": "GET",
  9802. // "id": "storage.objects.testIamPermissions",
  9803. // "parameterOrder": [
  9804. // "bucket",
  9805. // "object",
  9806. // "permissions"
  9807. // ],
  9808. // "parameters": {
  9809. // "bucket": {
  9810. // "description": "Name of the bucket in which the object resides.",
  9811. // "location": "path",
  9812. // "required": true,
  9813. // "type": "string"
  9814. // },
  9815. // "generation": {
  9816. // "description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).",
  9817. // "format": "int64",
  9818. // "location": "query",
  9819. // "type": "string"
  9820. // },
  9821. // "object": {
  9822. // "description": "Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
  9823. // "location": "path",
  9824. // "required": true,
  9825. // "type": "string"
  9826. // },
  9827. // "permissions": {
  9828. // "description": "Permissions to test.",
  9829. // "location": "query",
  9830. // "repeated": true,
  9831. // "required": true,
  9832. // "type": "string"
  9833. // },
  9834. // "userProject": {
  9835. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  9836. // "location": "query",
  9837. // "type": "string"
  9838. // }
  9839. // },
  9840. // "path": "b/{bucket}/o/{object}/iam/testPermissions",
  9841. // "response": {
  9842. // "$ref": "TestIamPermissionsResponse"
  9843. // },
  9844. // "scopes": [
  9845. // "https://www.googleapis.com/auth/cloud-platform",
  9846. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  9847. // "https://www.googleapis.com/auth/devstorage.full_control",
  9848. // "https://www.googleapis.com/auth/devstorage.read_only",
  9849. // "https://www.googleapis.com/auth/devstorage.read_write"
  9850. // ]
  9851. // }
  9852. }
  9853. // method id "storage.objects.update":
  9854. type ObjectsUpdateCall struct {
  9855. s *Service
  9856. bucket string
  9857. object string
  9858. object2 *Object
  9859. urlParams_ gensupport.URLParams
  9860. ctx_ context.Context
  9861. header_ http.Header
  9862. }
  9863. // Update: Updates an object's metadata.
  9864. func (r *ObjectsService) Update(bucket string, object string, object2 *Object) *ObjectsUpdateCall {
  9865. c := &ObjectsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  9866. c.bucket = bucket
  9867. c.object = object
  9868. c.object2 = object2
  9869. return c
  9870. }
  9871. // Generation sets the optional parameter "generation": If present,
  9872. // selects a specific revision of this object (as opposed to the latest
  9873. // version, the default).
  9874. func (c *ObjectsUpdateCall) Generation(generation int64) *ObjectsUpdateCall {
  9875. c.urlParams_.Set("generation", fmt.Sprint(generation))
  9876. return c
  9877. }
  9878. // IfGenerationMatch sets the optional parameter "ifGenerationMatch":
  9879. // Makes the operation conditional on whether the object's current
  9880. // generation matches the given value. Setting to 0 makes the operation
  9881. // succeed only if there are no live versions of the object.
  9882. func (c *ObjectsUpdateCall) IfGenerationMatch(ifGenerationMatch int64) *ObjectsUpdateCall {
  9883. c.urlParams_.Set("ifGenerationMatch", fmt.Sprint(ifGenerationMatch))
  9884. return c
  9885. }
  9886. // IfGenerationNotMatch sets the optional parameter
  9887. // "ifGenerationNotMatch": Makes the operation conditional on whether
  9888. // the object's current generation does not match the given value. If no
  9889. // live object exists, the precondition fails. Setting to 0 makes the
  9890. // operation succeed only if there is a live version of the object.
  9891. func (c *ObjectsUpdateCall) IfGenerationNotMatch(ifGenerationNotMatch int64) *ObjectsUpdateCall {
  9892. c.urlParams_.Set("ifGenerationNotMatch", fmt.Sprint(ifGenerationNotMatch))
  9893. return c
  9894. }
  9895. // IfMetagenerationMatch sets the optional parameter
  9896. // "ifMetagenerationMatch": Makes the operation conditional on whether
  9897. // the object's current metageneration matches the given value.
  9898. func (c *ObjectsUpdateCall) IfMetagenerationMatch(ifMetagenerationMatch int64) *ObjectsUpdateCall {
  9899. c.urlParams_.Set("ifMetagenerationMatch", fmt.Sprint(ifMetagenerationMatch))
  9900. return c
  9901. }
  9902. // IfMetagenerationNotMatch sets the optional parameter
  9903. // "ifMetagenerationNotMatch": Makes the operation conditional on
  9904. // whether the object's current metageneration does not match the given
  9905. // value.
  9906. func (c *ObjectsUpdateCall) IfMetagenerationNotMatch(ifMetagenerationNotMatch int64) *ObjectsUpdateCall {
  9907. c.urlParams_.Set("ifMetagenerationNotMatch", fmt.Sprint(ifMetagenerationNotMatch))
  9908. return c
  9909. }
  9910. // PredefinedAcl sets the optional parameter "predefinedAcl": Apply a
  9911. // predefined set of access controls to this object.
  9912. //
  9913. // Possible values:
  9914. // "authenticatedRead" - Object owner gets OWNER access, and
  9915. // allAuthenticatedUsers get READER access.
  9916. // "bucketOwnerFullControl" - Object owner gets OWNER access, and
  9917. // project team owners get OWNER access.
  9918. // "bucketOwnerRead" - Object owner gets OWNER access, and project
  9919. // team owners get READER access.
  9920. // "private" - Object owner gets OWNER access.
  9921. // "projectPrivate" - Object owner gets OWNER access, and project team
  9922. // members get access according to their roles.
  9923. // "publicRead" - Object owner gets OWNER access, and allUsers get
  9924. // READER access.
  9925. func (c *ObjectsUpdateCall) PredefinedAcl(predefinedAcl string) *ObjectsUpdateCall {
  9926. c.urlParams_.Set("predefinedAcl", predefinedAcl)
  9927. return c
  9928. }
  9929. // Projection sets the optional parameter "projection": Set of
  9930. // properties to return. Defaults to full.
  9931. //
  9932. // Possible values:
  9933. // "full" - Include all properties.
  9934. // "noAcl" - Omit the owner, acl property.
  9935. func (c *ObjectsUpdateCall) Projection(projection string) *ObjectsUpdateCall {
  9936. c.urlParams_.Set("projection", projection)
  9937. return c
  9938. }
  9939. // UserProject sets the optional parameter "userProject": The project to
  9940. // be billed for this request. Required for Requester Pays buckets.
  9941. func (c *ObjectsUpdateCall) UserProject(userProject string) *ObjectsUpdateCall {
  9942. c.urlParams_.Set("userProject", userProject)
  9943. return c
  9944. }
  9945. // Fields allows partial responses to be retrieved. See
  9946. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  9947. // for more information.
  9948. func (c *ObjectsUpdateCall) Fields(s ...googleapi.Field) *ObjectsUpdateCall {
  9949. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  9950. return c
  9951. }
  9952. // Context sets the context to be used in this call's Do method. Any
  9953. // pending HTTP request will be aborted if the provided context is
  9954. // canceled.
  9955. func (c *ObjectsUpdateCall) Context(ctx context.Context) *ObjectsUpdateCall {
  9956. c.ctx_ = ctx
  9957. return c
  9958. }
  9959. // Header returns an http.Header that can be modified by the caller to
  9960. // add HTTP headers to the request.
  9961. func (c *ObjectsUpdateCall) Header() http.Header {
  9962. if c.header_ == nil {
  9963. c.header_ = make(http.Header)
  9964. }
  9965. return c.header_
  9966. }
  9967. func (c *ObjectsUpdateCall) doRequest(alt string) (*http.Response, error) {
  9968. reqHeaders := make(http.Header)
  9969. for k, v := range c.header_ {
  9970. reqHeaders[k] = v
  9971. }
  9972. reqHeaders.Set("User-Agent", c.s.userAgent())
  9973. var body io.Reader = nil
  9974. body, err := googleapi.WithoutDataWrapper.JSONReader(c.object2)
  9975. if err != nil {
  9976. return nil, err
  9977. }
  9978. reqHeaders.Set("Content-Type", "application/json")
  9979. c.urlParams_.Set("alt", alt)
  9980. c.urlParams_.Set("prettyPrint", "false")
  9981. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}")
  9982. urls += "?" + c.urlParams_.Encode()
  9983. req, err := http.NewRequest("PUT", urls, body)
  9984. if err != nil {
  9985. return nil, err
  9986. }
  9987. req.Header = reqHeaders
  9988. googleapi.Expand(req.URL, map[string]string{
  9989. "bucket": c.bucket,
  9990. "object": c.object,
  9991. })
  9992. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  9993. }
  9994. // Do executes the "storage.objects.update" call.
  9995. // Exactly one of *Object or error will be non-nil. Any non-2xx status
  9996. // code is an error. Response headers are in either
  9997. // *Object.ServerResponse.Header or (if a response was returned at all)
  9998. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  9999. // check whether the returned error was because http.StatusNotModified
  10000. // was returned.
  10001. func (c *ObjectsUpdateCall) Do(opts ...googleapi.CallOption) (*Object, error) {
  10002. gensupport.SetOptions(c.urlParams_, opts...)
  10003. res, err := c.doRequest("json")
  10004. if res != nil && res.StatusCode == http.StatusNotModified {
  10005. if res.Body != nil {
  10006. res.Body.Close()
  10007. }
  10008. return nil, &googleapi.Error{
  10009. Code: res.StatusCode,
  10010. Header: res.Header,
  10011. }
  10012. }
  10013. if err != nil {
  10014. return nil, err
  10015. }
  10016. defer googleapi.CloseBody(res)
  10017. if err := googleapi.CheckResponse(res); err != nil {
  10018. return nil, err
  10019. }
  10020. ret := &Object{
  10021. ServerResponse: googleapi.ServerResponse{
  10022. Header: res.Header,
  10023. HTTPStatusCode: res.StatusCode,
  10024. },
  10025. }
  10026. target := &ret
  10027. if err := gensupport.DecodeResponse(target, res); err != nil {
  10028. return nil, err
  10029. }
  10030. return ret, nil
  10031. // {
  10032. // "description": "Updates an object's metadata.",
  10033. // "httpMethod": "PUT",
  10034. // "id": "storage.objects.update",
  10035. // "parameterOrder": [
  10036. // "bucket",
  10037. // "object"
  10038. // ],
  10039. // "parameters": {
  10040. // "bucket": {
  10041. // "description": "Name of the bucket in which the object resides.",
  10042. // "location": "path",
  10043. // "required": true,
  10044. // "type": "string"
  10045. // },
  10046. // "generation": {
  10047. // "description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).",
  10048. // "format": "int64",
  10049. // "location": "query",
  10050. // "type": "string"
  10051. // },
  10052. // "ifGenerationMatch": {
  10053. // "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.",
  10054. // "format": "int64",
  10055. // "location": "query",
  10056. // "type": "string"
  10057. // },
  10058. // "ifGenerationNotMatch": {
  10059. // "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.",
  10060. // "format": "int64",
  10061. // "location": "query",
  10062. // "type": "string"
  10063. // },
  10064. // "ifMetagenerationMatch": {
  10065. // "description": "Makes the operation conditional on whether the object's current metageneration matches the given value.",
  10066. // "format": "int64",
  10067. // "location": "query",
  10068. // "type": "string"
  10069. // },
  10070. // "ifMetagenerationNotMatch": {
  10071. // "description": "Makes the operation conditional on whether the object's current metageneration does not match the given value.",
  10072. // "format": "int64",
  10073. // "location": "query",
  10074. // "type": "string"
  10075. // },
  10076. // "object": {
  10077. // "description": "Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
  10078. // "location": "path",
  10079. // "required": true,
  10080. // "type": "string"
  10081. // },
  10082. // "predefinedAcl": {
  10083. // "description": "Apply a predefined set of access controls to this object.",
  10084. // "enum": [
  10085. // "authenticatedRead",
  10086. // "bucketOwnerFullControl",
  10087. // "bucketOwnerRead",
  10088. // "private",
  10089. // "projectPrivate",
  10090. // "publicRead"
  10091. // ],
  10092. // "enumDescriptions": [
  10093. // "Object owner gets OWNER access, and allAuthenticatedUsers get READER access.",
  10094. // "Object owner gets OWNER access, and project team owners get OWNER access.",
  10095. // "Object owner gets OWNER access, and project team owners get READER access.",
  10096. // "Object owner gets OWNER access.",
  10097. // "Object owner gets OWNER access, and project team members get access according to their roles.",
  10098. // "Object owner gets OWNER access, and allUsers get READER access."
  10099. // ],
  10100. // "location": "query",
  10101. // "type": "string"
  10102. // },
  10103. // "projection": {
  10104. // "description": "Set of properties to return. Defaults to full.",
  10105. // "enum": [
  10106. // "full",
  10107. // "noAcl"
  10108. // ],
  10109. // "enumDescriptions": [
  10110. // "Include all properties.",
  10111. // "Omit the owner, acl property."
  10112. // ],
  10113. // "location": "query",
  10114. // "type": "string"
  10115. // },
  10116. // "userProject": {
  10117. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  10118. // "location": "query",
  10119. // "type": "string"
  10120. // }
  10121. // },
  10122. // "path": "b/{bucket}/o/{object}",
  10123. // "request": {
  10124. // "$ref": "Object"
  10125. // },
  10126. // "response": {
  10127. // "$ref": "Object"
  10128. // },
  10129. // "scopes": [
  10130. // "https://www.googleapis.com/auth/cloud-platform",
  10131. // "https://www.googleapis.com/auth/devstorage.full_control"
  10132. // ]
  10133. // }
  10134. }
  10135. // method id "storage.objects.watchAll":
  10136. type ObjectsWatchAllCall struct {
  10137. s *Service
  10138. bucket string
  10139. channel *Channel
  10140. urlParams_ gensupport.URLParams
  10141. ctx_ context.Context
  10142. header_ http.Header
  10143. }
  10144. // WatchAll: Watch for changes on all objects in a bucket.
  10145. func (r *ObjectsService) WatchAll(bucket string, channel *Channel) *ObjectsWatchAllCall {
  10146. c := &ObjectsWatchAllCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  10147. c.bucket = bucket
  10148. c.channel = channel
  10149. return c
  10150. }
  10151. // Delimiter sets the optional parameter "delimiter": Returns results in
  10152. // a directory-like mode. items will contain only objects whose names,
  10153. // aside from the prefix, do not contain delimiter. Objects whose names,
  10154. // aside from the prefix, contain delimiter will have their name,
  10155. // truncated after the delimiter, returned in prefixes. Duplicate
  10156. // prefixes are omitted.
  10157. func (c *ObjectsWatchAllCall) Delimiter(delimiter string) *ObjectsWatchAllCall {
  10158. c.urlParams_.Set("delimiter", delimiter)
  10159. return c
  10160. }
  10161. // IncludeTrailingDelimiter sets the optional parameter
  10162. // "includeTrailingDelimiter": If true, objects that end in exactly one
  10163. // instance of delimiter will have their metadata included in items in
  10164. // addition to prefixes.
  10165. func (c *ObjectsWatchAllCall) IncludeTrailingDelimiter(includeTrailingDelimiter bool) *ObjectsWatchAllCall {
  10166. c.urlParams_.Set("includeTrailingDelimiter", fmt.Sprint(includeTrailingDelimiter))
  10167. return c
  10168. }
  10169. // MaxResults sets the optional parameter "maxResults": Maximum number
  10170. // of items plus prefixes to return in a single page of responses. As
  10171. // duplicate prefixes are omitted, fewer total results may be returned
  10172. // than requested. The service will use this parameter or 1,000 items,
  10173. // whichever is smaller.
  10174. func (c *ObjectsWatchAllCall) MaxResults(maxResults int64) *ObjectsWatchAllCall {
  10175. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  10176. return c
  10177. }
  10178. // PageToken sets the optional parameter "pageToken": A
  10179. // previously-returned page token representing part of the larger set of
  10180. // results to view.
  10181. func (c *ObjectsWatchAllCall) PageToken(pageToken string) *ObjectsWatchAllCall {
  10182. c.urlParams_.Set("pageToken", pageToken)
  10183. return c
  10184. }
  10185. // Prefix sets the optional parameter "prefix": Filter results to
  10186. // objects whose names begin with this prefix.
  10187. func (c *ObjectsWatchAllCall) Prefix(prefix string) *ObjectsWatchAllCall {
  10188. c.urlParams_.Set("prefix", prefix)
  10189. return c
  10190. }
  10191. // Projection sets the optional parameter "projection": Set of
  10192. // properties to return. Defaults to noAcl.
  10193. //
  10194. // Possible values:
  10195. // "full" - Include all properties.
  10196. // "noAcl" - Omit the owner, acl property.
  10197. func (c *ObjectsWatchAllCall) Projection(projection string) *ObjectsWatchAllCall {
  10198. c.urlParams_.Set("projection", projection)
  10199. return c
  10200. }
  10201. // UserProject sets the optional parameter "userProject": The project to
  10202. // be billed for this request. Required for Requester Pays buckets.
  10203. func (c *ObjectsWatchAllCall) UserProject(userProject string) *ObjectsWatchAllCall {
  10204. c.urlParams_.Set("userProject", userProject)
  10205. return c
  10206. }
  10207. // Versions sets the optional parameter "versions": If true, lists all
  10208. // versions of an object as distinct results. The default is false. For
  10209. // more information, see Object Versioning.
  10210. func (c *ObjectsWatchAllCall) Versions(versions bool) *ObjectsWatchAllCall {
  10211. c.urlParams_.Set("versions", fmt.Sprint(versions))
  10212. return c
  10213. }
  10214. // Fields allows partial responses to be retrieved. See
  10215. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  10216. // for more information.
  10217. func (c *ObjectsWatchAllCall) Fields(s ...googleapi.Field) *ObjectsWatchAllCall {
  10218. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  10219. return c
  10220. }
  10221. // Context sets the context to be used in this call's Do method. Any
  10222. // pending HTTP request will be aborted if the provided context is
  10223. // canceled.
  10224. func (c *ObjectsWatchAllCall) Context(ctx context.Context) *ObjectsWatchAllCall {
  10225. c.ctx_ = ctx
  10226. return c
  10227. }
  10228. // Header returns an http.Header that can be modified by the caller to
  10229. // add HTTP headers to the request.
  10230. func (c *ObjectsWatchAllCall) Header() http.Header {
  10231. if c.header_ == nil {
  10232. c.header_ = make(http.Header)
  10233. }
  10234. return c.header_
  10235. }
  10236. func (c *ObjectsWatchAllCall) doRequest(alt string) (*http.Response, error) {
  10237. reqHeaders := make(http.Header)
  10238. for k, v := range c.header_ {
  10239. reqHeaders[k] = v
  10240. }
  10241. reqHeaders.Set("User-Agent", c.s.userAgent())
  10242. var body io.Reader = nil
  10243. body, err := googleapi.WithoutDataWrapper.JSONReader(c.channel)
  10244. if err != nil {
  10245. return nil, err
  10246. }
  10247. reqHeaders.Set("Content-Type", "application/json")
  10248. c.urlParams_.Set("alt", alt)
  10249. c.urlParams_.Set("prettyPrint", "false")
  10250. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/watch")
  10251. urls += "?" + c.urlParams_.Encode()
  10252. req, err := http.NewRequest("POST", urls, body)
  10253. if err != nil {
  10254. return nil, err
  10255. }
  10256. req.Header = reqHeaders
  10257. googleapi.Expand(req.URL, map[string]string{
  10258. "bucket": c.bucket,
  10259. })
  10260. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  10261. }
  10262. // Do executes the "storage.objects.watchAll" call.
  10263. // Exactly one of *Channel or error will be non-nil. Any non-2xx status
  10264. // code is an error. Response headers are in either
  10265. // *Channel.ServerResponse.Header or (if a response was returned at all)
  10266. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  10267. // check whether the returned error was because http.StatusNotModified
  10268. // was returned.
  10269. func (c *ObjectsWatchAllCall) Do(opts ...googleapi.CallOption) (*Channel, error) {
  10270. gensupport.SetOptions(c.urlParams_, opts...)
  10271. res, err := c.doRequest("json")
  10272. if res != nil && res.StatusCode == http.StatusNotModified {
  10273. if res.Body != nil {
  10274. res.Body.Close()
  10275. }
  10276. return nil, &googleapi.Error{
  10277. Code: res.StatusCode,
  10278. Header: res.Header,
  10279. }
  10280. }
  10281. if err != nil {
  10282. return nil, err
  10283. }
  10284. defer googleapi.CloseBody(res)
  10285. if err := googleapi.CheckResponse(res); err != nil {
  10286. return nil, err
  10287. }
  10288. ret := &Channel{
  10289. ServerResponse: googleapi.ServerResponse{
  10290. Header: res.Header,
  10291. HTTPStatusCode: res.StatusCode,
  10292. },
  10293. }
  10294. target := &ret
  10295. if err := gensupport.DecodeResponse(target, res); err != nil {
  10296. return nil, err
  10297. }
  10298. return ret, nil
  10299. // {
  10300. // "description": "Watch for changes on all objects in a bucket.",
  10301. // "httpMethod": "POST",
  10302. // "id": "storage.objects.watchAll",
  10303. // "parameterOrder": [
  10304. // "bucket"
  10305. // ],
  10306. // "parameters": {
  10307. // "bucket": {
  10308. // "description": "Name of the bucket in which to look for objects.",
  10309. // "location": "path",
  10310. // "required": true,
  10311. // "type": "string"
  10312. // },
  10313. // "delimiter": {
  10314. // "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.",
  10315. // "location": "query",
  10316. // "type": "string"
  10317. // },
  10318. // "includeTrailingDelimiter": {
  10319. // "description": "If true, objects that end in exactly one instance of delimiter will have their metadata included in items in addition to prefixes.",
  10320. // "location": "query",
  10321. // "type": "boolean"
  10322. // },
  10323. // "maxResults": {
  10324. // "default": "1000",
  10325. // "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.",
  10326. // "format": "uint32",
  10327. // "location": "query",
  10328. // "minimum": "0",
  10329. // "type": "integer"
  10330. // },
  10331. // "pageToken": {
  10332. // "description": "A previously-returned page token representing part of the larger set of results to view.",
  10333. // "location": "query",
  10334. // "type": "string"
  10335. // },
  10336. // "prefix": {
  10337. // "description": "Filter results to objects whose names begin with this prefix.",
  10338. // "location": "query",
  10339. // "type": "string"
  10340. // },
  10341. // "projection": {
  10342. // "description": "Set of properties to return. Defaults to noAcl.",
  10343. // "enum": [
  10344. // "full",
  10345. // "noAcl"
  10346. // ],
  10347. // "enumDescriptions": [
  10348. // "Include all properties.",
  10349. // "Omit the owner, acl property."
  10350. // ],
  10351. // "location": "query",
  10352. // "type": "string"
  10353. // },
  10354. // "userProject": {
  10355. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  10356. // "location": "query",
  10357. // "type": "string"
  10358. // },
  10359. // "versions": {
  10360. // "description": "If true, lists all versions of an object as distinct results. The default is false. For more information, see Object Versioning.",
  10361. // "location": "query",
  10362. // "type": "boolean"
  10363. // }
  10364. // },
  10365. // "path": "b/{bucket}/o/watch",
  10366. // "request": {
  10367. // "$ref": "Channel",
  10368. // "parameterName": "resource"
  10369. // },
  10370. // "response": {
  10371. // "$ref": "Channel"
  10372. // },
  10373. // "scopes": [
  10374. // "https://www.googleapis.com/auth/cloud-platform",
  10375. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  10376. // "https://www.googleapis.com/auth/devstorage.full_control",
  10377. // "https://www.googleapis.com/auth/devstorage.read_only",
  10378. // "https://www.googleapis.com/auth/devstorage.read_write"
  10379. // ],
  10380. // "supportsSubscription": true
  10381. // }
  10382. }
  10383. // method id "storage.projects.serviceAccount.get":
  10384. type ProjectsServiceAccountGetCall struct {
  10385. s *Service
  10386. projectId string
  10387. urlParams_ gensupport.URLParams
  10388. ifNoneMatch_ string
  10389. ctx_ context.Context
  10390. header_ http.Header
  10391. }
  10392. // Get: Get the email address of this project's Google Cloud Storage
  10393. // service account.
  10394. func (r *ProjectsServiceAccountService) Get(projectId string) *ProjectsServiceAccountGetCall {
  10395. c := &ProjectsServiceAccountGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  10396. c.projectId = projectId
  10397. return c
  10398. }
  10399. // UserProject sets the optional parameter "userProject": The project to
  10400. // be billed for this request.
  10401. func (c *ProjectsServiceAccountGetCall) UserProject(userProject string) *ProjectsServiceAccountGetCall {
  10402. c.urlParams_.Set("userProject", userProject)
  10403. return c
  10404. }
  10405. // Fields allows partial responses to be retrieved. See
  10406. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  10407. // for more information.
  10408. func (c *ProjectsServiceAccountGetCall) Fields(s ...googleapi.Field) *ProjectsServiceAccountGetCall {
  10409. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  10410. return c
  10411. }
  10412. // IfNoneMatch sets the optional parameter which makes the operation
  10413. // fail if the object's ETag matches the given value. This is useful for
  10414. // getting updates only after the object has changed since the last
  10415. // request. Use googleapi.IsNotModified to check whether the response
  10416. // error from Do is the result of In-None-Match.
  10417. func (c *ProjectsServiceAccountGetCall) IfNoneMatch(entityTag string) *ProjectsServiceAccountGetCall {
  10418. c.ifNoneMatch_ = entityTag
  10419. return c
  10420. }
  10421. // Context sets the context to be used in this call's Do method. Any
  10422. // pending HTTP request will be aborted if the provided context is
  10423. // canceled.
  10424. func (c *ProjectsServiceAccountGetCall) Context(ctx context.Context) *ProjectsServiceAccountGetCall {
  10425. c.ctx_ = ctx
  10426. return c
  10427. }
  10428. // Header returns an http.Header that can be modified by the caller to
  10429. // add HTTP headers to the request.
  10430. func (c *ProjectsServiceAccountGetCall) Header() http.Header {
  10431. if c.header_ == nil {
  10432. c.header_ = make(http.Header)
  10433. }
  10434. return c.header_
  10435. }
  10436. func (c *ProjectsServiceAccountGetCall) doRequest(alt string) (*http.Response, error) {
  10437. reqHeaders := make(http.Header)
  10438. for k, v := range c.header_ {
  10439. reqHeaders[k] = v
  10440. }
  10441. reqHeaders.Set("User-Agent", c.s.userAgent())
  10442. if c.ifNoneMatch_ != "" {
  10443. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  10444. }
  10445. var body io.Reader = nil
  10446. c.urlParams_.Set("alt", alt)
  10447. c.urlParams_.Set("prettyPrint", "false")
  10448. urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{projectId}/serviceAccount")
  10449. urls += "?" + c.urlParams_.Encode()
  10450. req, err := http.NewRequest("GET", urls, body)
  10451. if err != nil {
  10452. return nil, err
  10453. }
  10454. req.Header = reqHeaders
  10455. googleapi.Expand(req.URL, map[string]string{
  10456. "projectId": c.projectId,
  10457. })
  10458. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  10459. }
  10460. // Do executes the "storage.projects.serviceAccount.get" call.
  10461. // Exactly one of *ServiceAccount or error will be non-nil. Any non-2xx
  10462. // status code is an error. Response headers are in either
  10463. // *ServiceAccount.ServerResponse.Header or (if a response was returned
  10464. // at all) in error.(*googleapi.Error).Header. Use
  10465. // googleapi.IsNotModified to check whether the returned error was
  10466. // because http.StatusNotModified was returned.
  10467. func (c *ProjectsServiceAccountGetCall) Do(opts ...googleapi.CallOption) (*ServiceAccount, error) {
  10468. gensupport.SetOptions(c.urlParams_, opts...)
  10469. res, err := c.doRequest("json")
  10470. if res != nil && res.StatusCode == http.StatusNotModified {
  10471. if res.Body != nil {
  10472. res.Body.Close()
  10473. }
  10474. return nil, &googleapi.Error{
  10475. Code: res.StatusCode,
  10476. Header: res.Header,
  10477. }
  10478. }
  10479. if err != nil {
  10480. return nil, err
  10481. }
  10482. defer googleapi.CloseBody(res)
  10483. if err := googleapi.CheckResponse(res); err != nil {
  10484. return nil, err
  10485. }
  10486. ret := &ServiceAccount{
  10487. ServerResponse: googleapi.ServerResponse{
  10488. Header: res.Header,
  10489. HTTPStatusCode: res.StatusCode,
  10490. },
  10491. }
  10492. target := &ret
  10493. if err := gensupport.DecodeResponse(target, res); err != nil {
  10494. return nil, err
  10495. }
  10496. return ret, nil
  10497. // {
  10498. // "description": "Get the email address of this project's Google Cloud Storage service account.",
  10499. // "httpMethod": "GET",
  10500. // "id": "storage.projects.serviceAccount.get",
  10501. // "parameterOrder": [
  10502. // "projectId"
  10503. // ],
  10504. // "parameters": {
  10505. // "projectId": {
  10506. // "description": "Project ID",
  10507. // "location": "path",
  10508. // "required": true,
  10509. // "type": "string"
  10510. // },
  10511. // "userProject": {
  10512. // "description": "The project to be billed for this request.",
  10513. // "location": "query",
  10514. // "type": "string"
  10515. // }
  10516. // },
  10517. // "path": "projects/{projectId}/serviceAccount",
  10518. // "response": {
  10519. // "$ref": "ServiceAccount"
  10520. // },
  10521. // "scopes": [
  10522. // "https://www.googleapis.com/auth/cloud-platform",
  10523. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  10524. // "https://www.googleapis.com/auth/devstorage.full_control",
  10525. // "https://www.googleapis.com/auth/devstorage.read_only",
  10526. // "https://www.googleapis.com/auth/devstorage.read_write"
  10527. // ]
  10528. // }
  10529. }