pubsub-gen.go 233 KB

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