pubsub-gen.go 234 KB

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