storage-gen.go 220 KB

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