logging-gen.go 160 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696
  1. // Package logging provides access to the Google Cloud Logging API.
  2. //
  3. // See https://cloud.google.com/logging/docs/
  4. //
  5. // Usage example:
  6. //
  7. // import "google.golang.org/api/logging/v1beta3"
  8. // ...
  9. // loggingService, err := logging.New(oauthHttpClient)
  10. package logging // import "google.golang.org/api/logging/v1beta3"
  11. import (
  12. "bytes"
  13. "encoding/json"
  14. "errors"
  15. "fmt"
  16. context "golang.org/x/net/context"
  17. ctxhttp "golang.org/x/net/context/ctxhttp"
  18. gensupport "google.golang.org/api/gensupport"
  19. googleapi "google.golang.org/api/googleapi"
  20. "io"
  21. "net/http"
  22. "net/url"
  23. "strconv"
  24. "strings"
  25. )
  26. // Always reference these packages, just in case the auto-generated code
  27. // below doesn't.
  28. var _ = bytes.NewBuffer
  29. var _ = strconv.Itoa
  30. var _ = fmt.Sprintf
  31. var _ = json.NewDecoder
  32. var _ = io.Copy
  33. var _ = url.Parse
  34. var _ = gensupport.MarshalJSON
  35. var _ = googleapi.Version
  36. var _ = errors.New
  37. var _ = strings.Replace
  38. var _ = context.Canceled
  39. var _ = ctxhttp.Do
  40. const apiId = "logging:v1beta3"
  41. const apiName = "logging"
  42. const apiVersion = "v1beta3"
  43. const basePath = "https://logging.googleapis.com/"
  44. // OAuth2 scopes used by this API.
  45. const (
  46. // View and manage your data across Google Cloud Platform services
  47. CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform"
  48. // View your data across Google Cloud Platform services
  49. CloudPlatformReadOnlyScope = "https://www.googleapis.com/auth/cloud-platform.read-only"
  50. // Administrate log data for your projects
  51. LoggingAdminScope = "https://www.googleapis.com/auth/logging.admin"
  52. // View log data for your projects
  53. LoggingReadScope = "https://www.googleapis.com/auth/logging.read"
  54. // Submit log data for your projects
  55. LoggingWriteScope = "https://www.googleapis.com/auth/logging.write"
  56. )
  57. func New(client *http.Client) (*Service, error) {
  58. if client == nil {
  59. return nil, errors.New("client is nil")
  60. }
  61. s := &Service{client: client, BasePath: basePath}
  62. s.Projects = NewProjectsService(s)
  63. return s, nil
  64. }
  65. type Service struct {
  66. client *http.Client
  67. BasePath string // API endpoint base URL
  68. UserAgent string // optional additional User-Agent fragment
  69. Projects *ProjectsService
  70. }
  71. func (s *Service) userAgent() string {
  72. if s.UserAgent == "" {
  73. return googleapi.UserAgent
  74. }
  75. return googleapi.UserAgent + " " + s.UserAgent
  76. }
  77. func NewProjectsService(s *Service) *ProjectsService {
  78. rs := &ProjectsService{s: s}
  79. rs.LogServices = NewProjectsLogServicesService(s)
  80. rs.Logs = NewProjectsLogsService(s)
  81. rs.Metrics = NewProjectsMetricsService(s)
  82. rs.Sinks = NewProjectsSinksService(s)
  83. return rs
  84. }
  85. type ProjectsService struct {
  86. s *Service
  87. LogServices *ProjectsLogServicesService
  88. Logs *ProjectsLogsService
  89. Metrics *ProjectsMetricsService
  90. Sinks *ProjectsSinksService
  91. }
  92. func NewProjectsLogServicesService(s *Service) *ProjectsLogServicesService {
  93. rs := &ProjectsLogServicesService{s: s}
  94. rs.Indexes = NewProjectsLogServicesIndexesService(s)
  95. rs.Sinks = NewProjectsLogServicesSinksService(s)
  96. return rs
  97. }
  98. type ProjectsLogServicesService struct {
  99. s *Service
  100. Indexes *ProjectsLogServicesIndexesService
  101. Sinks *ProjectsLogServicesSinksService
  102. }
  103. func NewProjectsLogServicesIndexesService(s *Service) *ProjectsLogServicesIndexesService {
  104. rs := &ProjectsLogServicesIndexesService{s: s}
  105. return rs
  106. }
  107. type ProjectsLogServicesIndexesService struct {
  108. s *Service
  109. }
  110. func NewProjectsLogServicesSinksService(s *Service) *ProjectsLogServicesSinksService {
  111. rs := &ProjectsLogServicesSinksService{s: s}
  112. return rs
  113. }
  114. type ProjectsLogServicesSinksService struct {
  115. s *Service
  116. }
  117. func NewProjectsLogsService(s *Service) *ProjectsLogsService {
  118. rs := &ProjectsLogsService{s: s}
  119. rs.Entries = NewProjectsLogsEntriesService(s)
  120. rs.Sinks = NewProjectsLogsSinksService(s)
  121. return rs
  122. }
  123. type ProjectsLogsService struct {
  124. s *Service
  125. Entries *ProjectsLogsEntriesService
  126. Sinks *ProjectsLogsSinksService
  127. }
  128. func NewProjectsLogsEntriesService(s *Service) *ProjectsLogsEntriesService {
  129. rs := &ProjectsLogsEntriesService{s: s}
  130. return rs
  131. }
  132. type ProjectsLogsEntriesService struct {
  133. s *Service
  134. }
  135. func NewProjectsLogsSinksService(s *Service) *ProjectsLogsSinksService {
  136. rs := &ProjectsLogsSinksService{s: s}
  137. return rs
  138. }
  139. type ProjectsLogsSinksService struct {
  140. s *Service
  141. }
  142. func NewProjectsMetricsService(s *Service) *ProjectsMetricsService {
  143. rs := &ProjectsMetricsService{s: s}
  144. return rs
  145. }
  146. type ProjectsMetricsService struct {
  147. s *Service
  148. }
  149. func NewProjectsSinksService(s *Service) *ProjectsSinksService {
  150. rs := &ProjectsSinksService{s: s}
  151. return rs
  152. }
  153. type ProjectsSinksService struct {
  154. s *Service
  155. }
  156. // Empty: A generic empty message that you can re-use to avoid defining
  157. // duplicated empty messages in your APIs. A typical example is to use
  158. // it as the request or the response type of an API method. For
  159. // instance: service Foo { rpc Bar(google.protobuf.Empty) returns
  160. // (google.protobuf.Empty); } The JSON representation for `Empty` is
  161. // empty JSON object `{}`.
  162. type Empty struct {
  163. // ServerResponse contains the HTTP response code and headers from the
  164. // server.
  165. googleapi.ServerResponse `json:"-"`
  166. }
  167. // HttpRequest: A common proto for logging HTTP requests.
  168. type HttpRequest struct {
  169. // CacheHit: Whether or not an entity was served from cache (with or
  170. // without validation).
  171. CacheHit bool `json:"cacheHit,omitempty"`
  172. // Referer: Referer (a.k.a. referrer) URL of request, as defined in
  173. // http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html.
  174. Referer string `json:"referer,omitempty"`
  175. // RemoteIp: IP address of the client who issues the HTTP request. Could
  176. // be either IPv4 or IPv6.
  177. RemoteIp string `json:"remoteIp,omitempty"`
  178. // RequestMethod: Request method, such as `GET`, `HEAD`, `PUT` or
  179. // `POST`.
  180. RequestMethod string `json:"requestMethod,omitempty"`
  181. // RequestSize: Size of the HTTP request message in bytes, including
  182. // request headers and the request body.
  183. RequestSize int64 `json:"requestSize,omitempty,string"`
  184. // RequestUrl: Contains the scheme (http|https), the host name, the path
  185. // and the query portion of the URL that was requested.
  186. RequestUrl string `json:"requestUrl,omitempty"`
  187. // ResponseSize: Size of the HTTP response message in bytes sent back to
  188. // the client, including response headers and response body.
  189. ResponseSize int64 `json:"responseSize,omitempty,string"`
  190. // Status: A response code indicates the status of response, e.g., 200.
  191. Status int64 `json:"status,omitempty"`
  192. // UserAgent: User agent sent by the client, e.g., "Mozilla/4.0
  193. // (compatible; MSIE 6.0; Windows 98; Q312461; .NET CLR 1.0.3705)".
  194. UserAgent string `json:"userAgent,omitempty"`
  195. // ValidatedWithOriginServer: Whether or not the response was validated
  196. // with the origin server before being served from cache. This field is
  197. // only meaningful if cache_hit is True.
  198. ValidatedWithOriginServer bool `json:"validatedWithOriginServer,omitempty"`
  199. // ForceSendFields is a list of field names (e.g. "CacheHit") to
  200. // unconditionally include in API requests. By default, fields with
  201. // empty values are omitted from API requests. However, any non-pointer,
  202. // non-interface field appearing in ForceSendFields will be sent to the
  203. // server regardless of whether the field is empty or not. This may be
  204. // used to include empty fields in Patch requests.
  205. ForceSendFields []string `json:"-"`
  206. }
  207. func (s *HttpRequest) MarshalJSON() ([]byte, error) {
  208. type noMethod HttpRequest
  209. raw := noMethod(*s)
  210. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  211. }
  212. // ListLogMetricsResponse: Result returned from ListLogMetrics.
  213. type ListLogMetricsResponse struct {
  214. // Metrics: The list of metrics that was requested.
  215. Metrics []*LogMetric `json:"metrics,omitempty"`
  216. // NextPageToken: If there are more results, then `nextPageToken` is
  217. // returned in the response. To get the next batch of entries, use the
  218. // value of `nextPageToken` as `pageToken` in the next call of
  219. // `ListLogMetrics`. If `nextPageToken` is empty, then there are no more
  220. // results.
  221. NextPageToken string `json:"nextPageToken,omitempty"`
  222. // ServerResponse contains the HTTP response code and headers from the
  223. // server.
  224. googleapi.ServerResponse `json:"-"`
  225. // ForceSendFields is a list of field names (e.g. "Metrics") to
  226. // unconditionally include in API requests. By default, fields with
  227. // empty values are omitted from API requests. However, any non-pointer,
  228. // non-interface field appearing in ForceSendFields will be sent to the
  229. // server regardless of whether the field is empty or not. This may be
  230. // used to include empty fields in Patch requests.
  231. ForceSendFields []string `json:"-"`
  232. }
  233. func (s *ListLogMetricsResponse) MarshalJSON() ([]byte, error) {
  234. type noMethod ListLogMetricsResponse
  235. raw := noMethod(*s)
  236. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  237. }
  238. // ListLogServiceIndexesResponse: Result returned from
  239. // ListLogServiceIndexesRequest.
  240. type ListLogServiceIndexesResponse struct {
  241. // NextPageToken: If there are more results, then `nextPageToken` is
  242. // returned in the response. To get the next batch of indexes, use the
  243. // value of `nextPageToken` as `pageToken` in the next call of
  244. // `ListLogServiceIndexes`. If `nextPageToken` is empty, then there are
  245. // no more results.
  246. NextPageToken string `json:"nextPageToken,omitempty"`
  247. // ServiceIndexPrefixes: A list of log service index values. Each index
  248. // value has the form "/value1/value2/...", where `value1` is a value
  249. // in the primary index, `value2` is a value in the secondary index, and
  250. // so forth.
  251. ServiceIndexPrefixes []string `json:"serviceIndexPrefixes,omitempty"`
  252. // ServerResponse contains the HTTP response code and headers from the
  253. // server.
  254. googleapi.ServerResponse `json:"-"`
  255. // ForceSendFields is a list of field names (e.g. "NextPageToken") to
  256. // unconditionally include in API requests. By default, fields with
  257. // empty values are omitted from API requests. However, any non-pointer,
  258. // non-interface field appearing in ForceSendFields will be sent to the
  259. // server regardless of whether the field is empty or not. This may be
  260. // used to include empty fields in Patch requests.
  261. ForceSendFields []string `json:"-"`
  262. }
  263. func (s *ListLogServiceIndexesResponse) MarshalJSON() ([]byte, error) {
  264. type noMethod ListLogServiceIndexesResponse
  265. raw := noMethod(*s)
  266. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  267. }
  268. // ListLogServiceSinksResponse: Result returned from
  269. // `ListLogServiceSinks`.
  270. type ListLogServiceSinksResponse struct {
  271. // Sinks: The requested log service sinks. If a returned `LogSink`
  272. // object has an empty `destination` field, the client can retrieve the
  273. // complete `LogSink` object by calling `logServices.sinks.get`.
  274. Sinks []*LogSink `json:"sinks,omitempty"`
  275. // ServerResponse contains the HTTP response code and headers from the
  276. // server.
  277. googleapi.ServerResponse `json:"-"`
  278. // ForceSendFields is a list of field names (e.g. "Sinks") to
  279. // unconditionally include in API requests. By default, fields with
  280. // empty values are omitted from API requests. However, any non-pointer,
  281. // non-interface field appearing in ForceSendFields will be sent to the
  282. // server regardless of whether the field is empty or not. This may be
  283. // used to include empty fields in Patch requests.
  284. ForceSendFields []string `json:"-"`
  285. }
  286. func (s *ListLogServiceSinksResponse) MarshalJSON() ([]byte, error) {
  287. type noMethod ListLogServiceSinksResponse
  288. raw := noMethod(*s)
  289. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  290. }
  291. // ListLogServicesResponse: Result returned from
  292. // `ListLogServicesRequest`.
  293. type ListLogServicesResponse struct {
  294. // LogServices: A list of log services.
  295. LogServices []*LogService `json:"logServices,omitempty"`
  296. // NextPageToken: If there are more results, then `nextPageToken` is
  297. // returned in the response. To get the next batch of services, use the
  298. // value of `nextPageToken` as `pageToken` in the next call of
  299. // `ListLogServices`. If `nextPageToken` is empty, then there are no
  300. // more results.
  301. NextPageToken string `json:"nextPageToken,omitempty"`
  302. // ServerResponse contains the HTTP response code and headers from the
  303. // server.
  304. googleapi.ServerResponse `json:"-"`
  305. // ForceSendFields is a list of field names (e.g. "LogServices") to
  306. // unconditionally include in API requests. By default, fields with
  307. // empty values are omitted from API requests. However, any non-pointer,
  308. // non-interface field appearing in ForceSendFields will be sent to the
  309. // server regardless of whether the field is empty or not. This may be
  310. // used to include empty fields in Patch requests.
  311. ForceSendFields []string `json:"-"`
  312. }
  313. func (s *ListLogServicesResponse) MarshalJSON() ([]byte, error) {
  314. type noMethod ListLogServicesResponse
  315. raw := noMethod(*s)
  316. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  317. }
  318. // ListLogSinksResponse: Result returned from `ListLogSinks`.
  319. type ListLogSinksResponse struct {
  320. // Sinks: The requested log sinks. If a returned `LogSink` object has an
  321. // empty `destination` field, the client can retrieve the complete
  322. // `LogSink` object by calling `log.sinks.get`.
  323. Sinks []*LogSink `json:"sinks,omitempty"`
  324. // ServerResponse contains the HTTP response code and headers from the
  325. // server.
  326. googleapi.ServerResponse `json:"-"`
  327. // ForceSendFields is a list of field names (e.g. "Sinks") to
  328. // unconditionally include in API requests. By default, fields with
  329. // empty values are omitted from API requests. However, any non-pointer,
  330. // non-interface field appearing in ForceSendFields will be sent to the
  331. // server regardless of whether the field is empty or not. This may be
  332. // used to include empty fields in Patch requests.
  333. ForceSendFields []string `json:"-"`
  334. }
  335. func (s *ListLogSinksResponse) MarshalJSON() ([]byte, error) {
  336. type noMethod ListLogSinksResponse
  337. raw := noMethod(*s)
  338. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  339. }
  340. // ListLogsResponse: Result returned from ListLogs.
  341. type ListLogsResponse struct {
  342. // Logs: A list of log descriptions matching the criteria.
  343. Logs []*Log `json:"logs,omitempty"`
  344. // NextPageToken: If there are more results, then `nextPageToken` is
  345. // returned in the response. To get the next batch of logs, use the
  346. // value of `nextPageToken` as `pageToken` in the next call of
  347. // `ListLogs`. If `nextPageToken` is empty, then there are no more
  348. // results.
  349. NextPageToken string `json:"nextPageToken,omitempty"`
  350. // ServerResponse contains the HTTP response code and headers from the
  351. // server.
  352. googleapi.ServerResponse `json:"-"`
  353. // ForceSendFields is a list of field names (e.g. "Logs") to
  354. // unconditionally include in API requests. By default, fields with
  355. // empty values are omitted from API requests. However, any non-pointer,
  356. // non-interface field appearing in ForceSendFields will be sent to the
  357. // server regardless of whether the field is empty or not. This may be
  358. // used to include empty fields in Patch requests.
  359. ForceSendFields []string `json:"-"`
  360. }
  361. func (s *ListLogsResponse) MarshalJSON() ([]byte, error) {
  362. type noMethod ListLogsResponse
  363. raw := noMethod(*s)
  364. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  365. }
  366. // ListSinksResponse: Result returned from `ListSinks`.
  367. type ListSinksResponse struct {
  368. // Sinks: The requested sinks. If a returned `LogSink` object has an
  369. // empty `destination` field, the client can retrieve the complete
  370. // `LogSink` object by calling `projects.sinks.get`.
  371. Sinks []*LogSink `json:"sinks,omitempty"`
  372. // ServerResponse contains the HTTP response code and headers from the
  373. // server.
  374. googleapi.ServerResponse `json:"-"`
  375. // ForceSendFields is a list of field names (e.g. "Sinks") to
  376. // unconditionally include in API requests. By default, fields with
  377. // empty values are omitted from API requests. However, any non-pointer,
  378. // non-interface field appearing in ForceSendFields will be sent to the
  379. // server regardless of whether the field is empty or not. This may be
  380. // used to include empty fields in Patch requests.
  381. ForceSendFields []string `json:"-"`
  382. }
  383. func (s *ListSinksResponse) MarshalJSON() ([]byte, error) {
  384. type noMethod ListSinksResponse
  385. raw := noMethod(*s)
  386. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  387. }
  388. // Log: _Output only._ Describes a log, which is a named stream of log
  389. // entries.
  390. type Log struct {
  391. // DisplayName: _Optional._ The common name of the log. Example:
  392. // "request_log".
  393. DisplayName string `json:"displayName,omitempty"`
  394. // Name: The resource name of the log. Example:
  395. // "/projects/my-gcp-project-id/logs/LOG_NAME", where `LOG_NAME` is
  396. // the URL-encoded given name of the log. The log includes those log
  397. // entries whose `LogEntry.log` field contains this given name. To avoid
  398. // name collisions, it is a best practice to prefix the given log name
  399. // with the service name, but this is not required. Examples of log
  400. // given names: "appengine.googleapis.com/request_log",
  401. // "apache-access".
  402. Name string `json:"name,omitempty"`
  403. // PayloadType: _Optional_. A URI representing the expected payload type
  404. // for log entries.
  405. PayloadType string `json:"payloadType,omitempty"`
  406. // ForceSendFields is a list of field names (e.g. "DisplayName") to
  407. // unconditionally include in API requests. By default, fields with
  408. // empty values are omitted from API requests. However, any non-pointer,
  409. // non-interface field appearing in ForceSendFields will be sent to the
  410. // server regardless of whether the field is empty or not. This may be
  411. // used to include empty fields in Patch requests.
  412. ForceSendFields []string `json:"-"`
  413. }
  414. func (s *Log) MarshalJSON() ([]byte, error) {
  415. type noMethod Log
  416. raw := noMethod(*s)
  417. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  418. }
  419. // LogEntry: An individual entry in a log.
  420. type LogEntry struct {
  421. // HttpRequest: Information about the HTTP request associated with this
  422. // log entry, if applicable.
  423. HttpRequest *HttpRequest `json:"httpRequest,omitempty"`
  424. // InsertId: A unique ID for the log entry. If you provide this field,
  425. // the logging service considers other log entries in the same log with
  426. // the same ID as duplicates which can be removed.
  427. InsertId string `json:"insertId,omitempty"`
  428. // Log: The log to which this entry belongs. When a log entry is
  429. // ingested, the value of this field is set by the logging system.
  430. Log string `json:"log,omitempty"`
  431. // Metadata: Information about the log entry.
  432. Metadata *LogEntryMetadata `json:"metadata,omitempty"`
  433. // ProtoPayload: The log entry payload, represented as a protocol buffer
  434. // that is expressed as a JSON object. You can only pass `protoPayload`
  435. // values that belong to a set of approved types.
  436. ProtoPayload LogEntryProtoPayload `json:"protoPayload,omitempty"`
  437. // StructPayload: The log entry payload, represented as a structure that
  438. // is expressed as a JSON object.
  439. StructPayload LogEntryStructPayload `json:"structPayload,omitempty"`
  440. // TextPayload: The log entry payload, represented as a Unicode string
  441. // (UTF-8).
  442. TextPayload string `json:"textPayload,omitempty"`
  443. // ForceSendFields is a list of field names (e.g. "HttpRequest") to
  444. // unconditionally include in API requests. By default, fields with
  445. // empty values are omitted from API requests. However, any non-pointer,
  446. // non-interface field appearing in ForceSendFields will be sent to the
  447. // server regardless of whether the field is empty or not. This may be
  448. // used to include empty fields in Patch requests.
  449. ForceSendFields []string `json:"-"`
  450. }
  451. func (s *LogEntry) MarshalJSON() ([]byte, error) {
  452. type noMethod LogEntry
  453. raw := noMethod(*s)
  454. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  455. }
  456. type LogEntryProtoPayload interface{}
  457. type LogEntryStructPayload interface{}
  458. // LogEntryMetadata: Additional data that is associated with a log
  459. // entry, set by the service creating the log entry.
  460. type LogEntryMetadata struct {
  461. // Labels: A set of (key, value) data that provides additional
  462. // information about the log entry. If the log entry is from one of the
  463. // Google Cloud Platform sources listed below, the indicated (key,
  464. // value) information must be provided: Google App Engine, service_name
  465. // `appengine.googleapis.com`: "appengine.googleapis.com/module_id",
  466. // "appengine.googleapis.com/version_id", and one of:
  467. // "appengine.googleapis.com/replica_index",
  468. // "appengine.googleapis.com/clone_id", or else provide the following
  469. // Compute Engine labels: Google Compute Engine, service_name
  470. // `compute.googleapis.com`: "compute.googleapis.com/resource_type",
  471. // "instance" "compute.googleapis.com/resource_id",
  472. Labels map[string]string `json:"labels,omitempty"`
  473. // ProjectId: The project ID of the Google Cloud Platform service that
  474. // created the log entry.
  475. ProjectId string `json:"projectId,omitempty"`
  476. // Region: The region name of the Google Cloud Platform service that
  477. // created the log entry. For example, "us-central1".
  478. Region string `json:"region,omitempty"`
  479. // ServiceName: The API name of the Google Cloud Platform service that
  480. // created the log entry. For example, "compute.googleapis.com".
  481. ServiceName string `json:"serviceName,omitempty"`
  482. // Severity: The severity of the log entry.
  483. //
  484. // Possible values:
  485. // "DEFAULT"
  486. // "DEBUG"
  487. // "INFO"
  488. // "NOTICE"
  489. // "WARNING"
  490. // "ERROR"
  491. // "CRITICAL"
  492. // "ALERT"
  493. // "EMERGENCY"
  494. Severity string `json:"severity,omitempty"`
  495. // Timestamp: The time the event described by the log entry occurred.
  496. // Timestamps must be later than January 1, 1970.
  497. Timestamp string `json:"timestamp,omitempty"`
  498. // UserId: The fully-qualified email address of the authenticated user
  499. // that performed or requested the action represented by the log entry.
  500. // If the log entry does not apply to an action taken by an
  501. // authenticated user, then the field should be empty.
  502. UserId string `json:"userId,omitempty"`
  503. // Zone: The zone of the Google Cloud Platform service that created the
  504. // log entry. For example, "us-central1-a".
  505. Zone string `json:"zone,omitempty"`
  506. // ForceSendFields is a list of field names (e.g. "Labels") to
  507. // unconditionally include in API requests. By default, fields with
  508. // empty values are omitted from API requests. However, any non-pointer,
  509. // non-interface field appearing in ForceSendFields will be sent to the
  510. // server regardless of whether the field is empty or not. This may be
  511. // used to include empty fields in Patch requests.
  512. ForceSendFields []string `json:"-"`
  513. }
  514. func (s *LogEntryMetadata) MarshalJSON() ([]byte, error) {
  515. type noMethod LogEntryMetadata
  516. raw := noMethod(*s)
  517. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  518. }
  519. // LogError: Describes a problem with a logging resource or operation.
  520. type LogError struct {
  521. // Resource: A resource name associated with this error. For example,
  522. // the name of a Cloud Storage bucket that has insufficient permissions
  523. // to be a destination for log entries.
  524. Resource string `json:"resource,omitempty"`
  525. // Status: The error description, including a classification code, an
  526. // error message, and other details.
  527. Status *Status `json:"status,omitempty"`
  528. // TimeNanos: The time the error was observed, in nanoseconds since the
  529. // Unix epoch.
  530. TimeNanos int64 `json:"timeNanos,omitempty,string"`
  531. // ForceSendFields is a list of field names (e.g. "Resource") to
  532. // unconditionally include in API requests. By default, fields with
  533. // empty values are omitted from API requests. However, any non-pointer,
  534. // non-interface field appearing in ForceSendFields will be sent to the
  535. // server regardless of whether the field is empty or not. This may be
  536. // used to include empty fields in Patch requests.
  537. ForceSendFields []string `json:"-"`
  538. }
  539. func (s *LogError) MarshalJSON() ([]byte, error) {
  540. type noMethod LogError
  541. raw := noMethod(*s)
  542. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  543. }
  544. // LogLine: Application log line emitted while processing a request.
  545. type LogLine struct {
  546. // LogMessage: App provided log message.
  547. LogMessage string `json:"logMessage,omitempty"`
  548. // Severity: Severity of log.
  549. //
  550. // Possible values:
  551. // "DEFAULT"
  552. // "DEBUG"
  553. // "INFO"
  554. // "NOTICE"
  555. // "WARNING"
  556. // "ERROR"
  557. // "CRITICAL"
  558. // "ALERT"
  559. // "EMERGENCY"
  560. Severity string `json:"severity,omitempty"`
  561. // SourceLocation: Line of code that generated this log message.
  562. SourceLocation *SourceLocation `json:"sourceLocation,omitempty"`
  563. // Time: Time when log entry was made. May be inaccurate.
  564. Time string `json:"time,omitempty"`
  565. // ForceSendFields is a list of field names (e.g. "LogMessage") to
  566. // unconditionally include in API requests. By default, fields with
  567. // empty values are omitted from API requests. However, any non-pointer,
  568. // non-interface field appearing in ForceSendFields will be sent to the
  569. // server regardless of whether the field is empty or not. This may be
  570. // used to include empty fields in Patch requests.
  571. ForceSendFields []string `json:"-"`
  572. }
  573. func (s *LogLine) MarshalJSON() ([]byte, error) {
  574. type noMethod LogLine
  575. raw := noMethod(*s)
  576. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  577. }
  578. // LogMetric: Describes a logs-based metric. The value of the metric is
  579. // the number of log entries in your project that match a logs filter.
  580. type LogMetric struct {
  581. // Description: A description of this metric.
  582. Description string `json:"description,omitempty"`
  583. // Filter: An [advanced logs
  584. // filter](/logging/docs/view/advanced_filters). Example: "log:syslog
  585. // AND metadata.severity>=ERROR".
  586. Filter string `json:"filter,omitempty"`
  587. // Name: The client-assigned name for this metric, such as
  588. // "severe_errors". Metric names are limited to 1000 characters and
  589. // can include only the following characters: `A-Z`, `a-z`, `0-9`, and
  590. // the special characters `_-.,+!*',()%/\`. The slash character (`/`)
  591. // denotes a hierarchy of name pieces, and it cannot be the first
  592. // character of the name.
  593. Name string `json:"name,omitempty"`
  594. // ServerResponse contains the HTTP response code and headers from the
  595. // server.
  596. googleapi.ServerResponse `json:"-"`
  597. // ForceSendFields is a list of field names (e.g. "Description") to
  598. // unconditionally include in API requests. By default, fields with
  599. // empty values are omitted from API requests. However, any non-pointer,
  600. // non-interface field appearing in ForceSendFields will be sent to the
  601. // server regardless of whether the field is empty or not. This may be
  602. // used to include empty fields in Patch requests.
  603. ForceSendFields []string `json:"-"`
  604. }
  605. func (s *LogMetric) MarshalJSON() ([]byte, error) {
  606. type noMethod LogMetric
  607. raw := noMethod(*s)
  608. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  609. }
  610. // LogService: _Output only._ Describes a service that writes log
  611. // entries.
  612. type LogService struct {
  613. // IndexKeys: A list of the names of the keys used to index and label
  614. // individual log entries from this service. The first two keys are used
  615. // as the primary and secondary index, respectively. Additional keys may
  616. // be used to label the entries. For example, App Engine indexes its
  617. // entries by module and by version, so its `indexKeys` field is the
  618. // following: [ "appengine.googleapis.com/module_id",
  619. // "appengine.googleapis.com/version_id" ]
  620. IndexKeys []string `json:"indexKeys,omitempty"`
  621. // Name: The service's name. Example: "appengine.googleapis.com". Log
  622. // names beginning with this string are reserved for this service. This
  623. // value can appear in the `LogEntry.metadata.serviceName` field of log
  624. // entries associated with this log service.
  625. Name string `json:"name,omitempty"`
  626. // ForceSendFields is a list of field names (e.g. "IndexKeys") to
  627. // unconditionally include in API requests. By default, fields with
  628. // empty values are omitted from API requests. However, any non-pointer,
  629. // non-interface field appearing in ForceSendFields will be sent to the
  630. // server regardless of whether the field is empty or not. This may be
  631. // used to include empty fields in Patch requests.
  632. ForceSendFields []string `json:"-"`
  633. }
  634. func (s *LogService) MarshalJSON() ([]byte, error) {
  635. type noMethod LogService
  636. raw := noMethod(*s)
  637. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  638. }
  639. // LogSink: Describes where log entries are written outside of Cloud
  640. // Logging.
  641. type LogSink struct {
  642. // Destination: The resource name of the destination. Cloud Logging
  643. // writes designated log entries to this destination. For example,
  644. // "storage.googleapis.com/my-output-bucket".
  645. Destination string `json:"destination,omitempty"`
  646. // Errors: _Output only._ If any errors occur when invoking a sink
  647. // method, then this field contains descriptions of the errors.
  648. Errors []*LogError `json:"errors,omitempty"`
  649. // Filter: An advanced logs filter. If present, only log entries
  650. // matching the filter are written. Only project sinks use this field;
  651. // log sinks and log service sinks must not include a filter.
  652. Filter string `json:"filter,omitempty"`
  653. // Name: The client-assigned name of this sink. For example,
  654. // "my-syslog-sink". The name must be unique among the sinks of a
  655. // similar kind in the project.
  656. Name string `json:"name,omitempty"`
  657. // ServerResponse contains the HTTP response code and headers from the
  658. // server.
  659. googleapi.ServerResponse `json:"-"`
  660. // ForceSendFields is a list of field names (e.g. "Destination") to
  661. // unconditionally include in API requests. By default, fields with
  662. // empty values are omitted from API requests. However, any non-pointer,
  663. // non-interface field appearing in ForceSendFields will be sent to the
  664. // server regardless of whether the field is empty or not. This may be
  665. // used to include empty fields in Patch requests.
  666. ForceSendFields []string `json:"-"`
  667. }
  668. func (s *LogSink) MarshalJSON() ([]byte, error) {
  669. type noMethod LogSink
  670. raw := noMethod(*s)
  671. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  672. }
  673. // RequestLog: Complete log information about a single request to an
  674. // application.
  675. type RequestLog struct {
  676. // AppEngineRelease: App Engine release version string.
  677. AppEngineRelease string `json:"appEngineRelease,omitempty"`
  678. // AppId: Identifies the application that handled this request.
  679. AppId string `json:"appId,omitempty"`
  680. // Cost: An indication of the relative cost of serving this request.
  681. Cost float64 `json:"cost,omitempty"`
  682. // EndTime: Time at which request was known to end processing.
  683. EndTime string `json:"endTime,omitempty"`
  684. // Finished: If true, represents a finished request. Otherwise, the
  685. // request is active.
  686. Finished bool `json:"finished,omitempty"`
  687. // Host: The Internet host and port number of the resource being
  688. // requested.
  689. Host string `json:"host,omitempty"`
  690. // HttpVersion: HTTP version of request.
  691. HttpVersion string `json:"httpVersion,omitempty"`
  692. // InstanceId: An opaque identifier for the instance that handled the
  693. // request.
  694. InstanceId string `json:"instanceId,omitempty"`
  695. // InstanceIndex: If the instance that processed this request was
  696. // individually addressable (i.e. belongs to a manually scaled module),
  697. // this is the index of the instance.
  698. InstanceIndex int64 `json:"instanceIndex,omitempty"`
  699. // Ip: Origin IP address.
  700. Ip string `json:"ip,omitempty"`
  701. // Latency: Latency of the request.
  702. Latency string `json:"latency,omitempty"`
  703. // Line: List of log lines emitted by the application while serving this
  704. // request, if requested.
  705. Line []*LogLine `json:"line,omitempty"`
  706. // MegaCycles: Number of CPU megacycles used to process request.
  707. MegaCycles int64 `json:"megaCycles,omitempty,string"`
  708. // Method: Request method, such as `GET`, `HEAD`, `PUT`, `POST`, or
  709. // `DELETE`.
  710. Method string `json:"method,omitempty"`
  711. // ModuleId: Identifies the module of the application that handled this
  712. // request.
  713. ModuleId string `json:"moduleId,omitempty"`
  714. // Nickname: A string that identifies a logged-in user who made this
  715. // request, or empty if the user is not logged in. Most likely, this is
  716. // the part of the user's email before the '@' sign. The field value is
  717. // the same for different requests from the same user, but different
  718. // users may have a similar name. This information is also available to
  719. // the application via Users API. This field will be populated starting
  720. // with App Engine 1.9.21.
  721. Nickname string `json:"nickname,omitempty"`
  722. // PendingTime: Time this request spent in the pending request queue, if
  723. // it was pending at all.
  724. PendingTime string `json:"pendingTime,omitempty"`
  725. // Referrer: Referrer URL of request.
  726. Referrer string `json:"referrer,omitempty"`
  727. // RequestId: Globally unique identifier for a request, based on request
  728. // start time. Request IDs for requests which started later will compare
  729. // greater as strings than those for requests which started earlier.
  730. RequestId string `json:"requestId,omitempty"`
  731. // Resource: Contains the path and query portion of the URL that was
  732. // requested. For example, if the URL was
  733. // "http://example.com/app?name=val", the resource would be
  734. // "/app?name=val". Any trailing fragment (separated by a '#' character)
  735. // will not be included.
  736. Resource string `json:"resource,omitempty"`
  737. // ResponseSize: Size in bytes sent back to client by request.
  738. ResponseSize int64 `json:"responseSize,omitempty,string"`
  739. // SourceReference: Source code for the application that handled this
  740. // request. There can be more than one source reference per deployed
  741. // application if source code is distributed among multiple
  742. // repositories.
  743. SourceReference []*SourceReference `json:"sourceReference,omitempty"`
  744. // StartTime: Time at which request was known to have begun processing.
  745. StartTime string `json:"startTime,omitempty"`
  746. // Status: Response status of request.
  747. Status int64 `json:"status,omitempty"`
  748. // TaskName: Task name of the request (for an offline request).
  749. TaskName string `json:"taskName,omitempty"`
  750. // TaskQueueName: Queue name of the request (for an offline request).
  751. TaskQueueName string `json:"taskQueueName,omitempty"`
  752. // TraceId: Cloud Trace identifier of the trace for this request.
  753. TraceId string `json:"traceId,omitempty"`
  754. // UrlMapEntry: File or class within URL mapping used for request.
  755. // Useful for tracking down the source code which was responsible for
  756. // managing request. Especially for multiply mapped handlers.
  757. UrlMapEntry string `json:"urlMapEntry,omitempty"`
  758. // UserAgent: User agent used for making request.
  759. UserAgent string `json:"userAgent,omitempty"`
  760. // VersionId: Version of the application that handled this request.
  761. VersionId string `json:"versionId,omitempty"`
  762. // WasLoadingRequest: Was this request a loading request for this
  763. // instance?
  764. WasLoadingRequest bool `json:"wasLoadingRequest,omitempty"`
  765. // ForceSendFields is a list of field names (e.g. "AppEngineRelease") to
  766. // unconditionally include in API requests. By default, fields with
  767. // empty values are omitted from API requests. However, any non-pointer,
  768. // non-interface field appearing in ForceSendFields will be sent to the
  769. // server regardless of whether the field is empty or not. This may be
  770. // used to include empty fields in Patch requests.
  771. ForceSendFields []string `json:"-"`
  772. }
  773. func (s *RequestLog) MarshalJSON() ([]byte, error) {
  774. type noMethod RequestLog
  775. raw := noMethod(*s)
  776. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  777. }
  778. // SourceLocation: Specifies a location in a source file.
  779. type SourceLocation struct {
  780. // File: Source file name. May or may not be a fully qualified name,
  781. // depending on the runtime environment.
  782. File string `json:"file,omitempty"`
  783. // FunctionName: Human-readable name of the function or method being
  784. // invoked, with optional context such as the class or package name, for
  785. // use in contexts such as the logs viewer where file:line number is
  786. // less meaningful. This may vary by language, for example: in Java:
  787. // qual.if.ied.Class.method in Go: dir/package.func in Python: function
  788. // ...
  789. FunctionName string `json:"functionName,omitempty"`
  790. // Line: Line within the source file.
  791. Line int64 `json:"line,omitempty,string"`
  792. // ForceSendFields is a list of field names (e.g. "File") to
  793. // unconditionally include in API requests. By default, fields with
  794. // empty values are omitted from API requests. However, any non-pointer,
  795. // non-interface field appearing in ForceSendFields will be sent to the
  796. // server regardless of whether the field is empty or not. This may be
  797. // used to include empty fields in Patch requests.
  798. ForceSendFields []string `json:"-"`
  799. }
  800. func (s *SourceLocation) MarshalJSON() ([]byte, error) {
  801. type noMethod SourceLocation
  802. raw := noMethod(*s)
  803. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  804. }
  805. // SourceReference: A reference to a particular snapshot of the source
  806. // tree used to build and deploy an application.
  807. type SourceReference struct {
  808. // Repository: Optional. A URI string identifying the repository.
  809. // Example: "https://github.com/GoogleCloudPlatform/kubernetes.git"
  810. Repository string `json:"repository,omitempty"`
  811. // RevisionId: The canonical (and persistent) identifier of the deployed
  812. // revision. Example (git): "0035781c50ec7aa23385dc841529ce8a4b70db1b"
  813. RevisionId string `json:"revisionId,omitempty"`
  814. // ForceSendFields is a list of field names (e.g. "Repository") to
  815. // unconditionally include in API requests. By default, fields with
  816. // empty values are omitted from API requests. However, any non-pointer,
  817. // non-interface field appearing in ForceSendFields will be sent to the
  818. // server regardless of whether the field is empty or not. This may be
  819. // used to include empty fields in Patch requests.
  820. ForceSendFields []string `json:"-"`
  821. }
  822. func (s *SourceReference) MarshalJSON() ([]byte, error) {
  823. type noMethod SourceReference
  824. raw := noMethod(*s)
  825. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  826. }
  827. // Status: The `Status` type defines a logical error model that is
  828. // suitable for different programming environments, including REST APIs
  829. // and RPC APIs. It is used by [gRPC](https://github.com/grpc). The
  830. // error model is designed to be: - Simple to use and understand for
  831. // most users - Flexible enough to meet unexpected needs # Overview The
  832. // `Status` message contains three pieces of data: error code, error
  833. // message, and error details. The error code should be an enum value of
  834. // google.rpc.Code, but it may accept additional error codes if needed.
  835. // The error message should be a developer-facing English message that
  836. // helps developers *understand* and *resolve* the error. If a localized
  837. // user-facing error message is needed, put the localized message in the
  838. // error details or localize it in the client. The optional error
  839. // details may contain arbitrary information about the error. There is a
  840. // predefined set of error detail types in the package `google.rpc`
  841. // which can be used for common error conditions. # Language mapping The
  842. // `Status` message is the logical representation of the error model,
  843. // but it is not necessarily the actual wire format. When the `Status`
  844. // message is exposed in different client libraries and different wire
  845. // protocols, it can be mapped differently. For example, it will likely
  846. // be mapped to some exceptions in Java, but more likely mapped to some
  847. // error codes in C. # Other uses The error model and the `Status`
  848. // message can be used in a variety of environments, either with or
  849. // without APIs, to provide a consistent developer experience across
  850. // different environments. Example uses of this error model include: -
  851. // Partial errors. If a service needs to return partial errors to the
  852. // client, it may embed the `Status` in the normal response to indicate
  853. // the partial errors. - Workflow errors. A typical workflow has
  854. // multiple steps. Each step may have a `Status` message for error
  855. // reporting purpose. - Batch operations. If a client uses batch request
  856. // and batch response, the `Status` message should be used directly
  857. // inside batch response, one for each error sub-response. -
  858. // Asynchronous operations. If an API call embeds asynchronous operation
  859. // results in its response, the status of those operations should be
  860. // represented directly using the `Status` message. - Logging. If some
  861. // API errors are stored in logs, the message `Status` could be used
  862. // directly after any stripping needed for security/privacy reasons.
  863. type Status struct {
  864. // Code: The status code, which should be an enum value of
  865. // google.rpc.Code.
  866. Code int64 `json:"code,omitempty"`
  867. // Details: A list of messages that carry the error details. There will
  868. // be a common set of message types for APIs to use.
  869. Details []StatusDetails `json:"details,omitempty"`
  870. // Message: A developer-facing error message, which should be in
  871. // English. Any user-facing error message should be localized and sent
  872. // in the google.rpc.Status.details field, or localized by the client.
  873. Message string `json:"message,omitempty"`
  874. // ForceSendFields is a list of field names (e.g. "Code") to
  875. // unconditionally include in API requests. By default, fields with
  876. // empty values are omitted from API requests. However, any non-pointer,
  877. // non-interface field appearing in ForceSendFields will be sent to the
  878. // server regardless of whether the field is empty or not. This may be
  879. // used to include empty fields in Patch requests.
  880. ForceSendFields []string `json:"-"`
  881. }
  882. func (s *Status) MarshalJSON() ([]byte, error) {
  883. type noMethod Status
  884. raw := noMethod(*s)
  885. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  886. }
  887. type StatusDetails interface{}
  888. // WriteLogEntriesRequest: The parameters to WriteLogEntries.
  889. type WriteLogEntriesRequest struct {
  890. // CommonLabels: Metadata labels that apply to all log entries in this
  891. // request, so that you don't have to repeat them in each log entry's
  892. // `metadata.labels` field. If any of the log entries contains a (key,
  893. // value) with the same key that is in `commonLabels`, then the entry's
  894. // (key, value) overrides the one in `commonLabels`.
  895. CommonLabels map[string]string `json:"commonLabels,omitempty"`
  896. // Entries: Log entries to insert.
  897. Entries []*LogEntry `json:"entries,omitempty"`
  898. // ForceSendFields is a list of field names (e.g. "CommonLabels") to
  899. // unconditionally include in API requests. By default, fields with
  900. // empty values are omitted from API requests. However, any non-pointer,
  901. // non-interface field appearing in ForceSendFields will be sent to the
  902. // server regardless of whether the field is empty or not. This may be
  903. // used to include empty fields in Patch requests.
  904. ForceSendFields []string `json:"-"`
  905. }
  906. func (s *WriteLogEntriesRequest) MarshalJSON() ([]byte, error) {
  907. type noMethod WriteLogEntriesRequest
  908. raw := noMethod(*s)
  909. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  910. }
  911. // WriteLogEntriesResponse: Result returned from WriteLogEntries. empty
  912. type WriteLogEntriesResponse struct {
  913. // ServerResponse contains the HTTP response code and headers from the
  914. // server.
  915. googleapi.ServerResponse `json:"-"`
  916. }
  917. // method id "logging.projects.logServices.list":
  918. type ProjectsLogServicesListCall struct {
  919. s *Service
  920. projectsId string
  921. urlParams_ gensupport.URLParams
  922. ifNoneMatch_ string
  923. ctx_ context.Context
  924. }
  925. // List: Lists the log services that have log entries in this project.
  926. func (r *ProjectsLogServicesService) List(projectsId string) *ProjectsLogServicesListCall {
  927. c := &ProjectsLogServicesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  928. c.projectsId = projectsId
  929. return c
  930. }
  931. // PageSize sets the optional parameter "pageSize": The maximum number
  932. // of `LogService` objects to return in one operation.
  933. func (c *ProjectsLogServicesListCall) PageSize(pageSize int64) *ProjectsLogServicesListCall {
  934. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  935. return c
  936. }
  937. // PageToken sets the optional parameter "pageToken": An opaque token,
  938. // returned as `nextPageToken` by a prior `ListLogServices` operation.
  939. // If `pageToken` is supplied, then the other fields of this request are
  940. // ignored, and instead the previous `ListLogServices` operation is
  941. // continued.
  942. func (c *ProjectsLogServicesListCall) PageToken(pageToken string) *ProjectsLogServicesListCall {
  943. c.urlParams_.Set("pageToken", pageToken)
  944. return c
  945. }
  946. // Fields allows partial responses to be retrieved. See
  947. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  948. // for more information.
  949. func (c *ProjectsLogServicesListCall) Fields(s ...googleapi.Field) *ProjectsLogServicesListCall {
  950. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  951. return c
  952. }
  953. // IfNoneMatch sets the optional parameter which makes the operation
  954. // fail if the object's ETag matches the given value. This is useful for
  955. // getting updates only after the object has changed since the last
  956. // request. Use googleapi.IsNotModified to check whether the response
  957. // error from Do is the result of In-None-Match.
  958. func (c *ProjectsLogServicesListCall) IfNoneMatch(entityTag string) *ProjectsLogServicesListCall {
  959. c.ifNoneMatch_ = entityTag
  960. return c
  961. }
  962. // Context sets the context to be used in this call's Do method. Any
  963. // pending HTTP request will be aborted if the provided context is
  964. // canceled.
  965. func (c *ProjectsLogServicesListCall) Context(ctx context.Context) *ProjectsLogServicesListCall {
  966. c.ctx_ = ctx
  967. return c
  968. }
  969. func (c *ProjectsLogServicesListCall) doRequest(alt string) (*http.Response, error) {
  970. var body io.Reader = nil
  971. c.urlParams_.Set("alt", alt)
  972. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta3/projects/{projectsId}/logServices")
  973. urls += "?" + c.urlParams_.Encode()
  974. req, _ := http.NewRequest("GET", urls, body)
  975. googleapi.Expand(req.URL, map[string]string{
  976. "projectsId": c.projectsId,
  977. })
  978. req.Header.Set("User-Agent", c.s.userAgent())
  979. if c.ifNoneMatch_ != "" {
  980. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  981. }
  982. if c.ctx_ != nil {
  983. return ctxhttp.Do(c.ctx_, c.s.client, req)
  984. }
  985. return c.s.client.Do(req)
  986. }
  987. // Do executes the "logging.projects.logServices.list" call.
  988. // Exactly one of *ListLogServicesResponse or error will be non-nil. Any
  989. // non-2xx status code is an error. Response headers are in either
  990. // *ListLogServicesResponse.ServerResponse.Header or (if a response was
  991. // returned at all) in error.(*googleapi.Error).Header. Use
  992. // googleapi.IsNotModified to check whether the returned error was
  993. // because http.StatusNotModified was returned.
  994. func (c *ProjectsLogServicesListCall) Do(opts ...googleapi.CallOption) (*ListLogServicesResponse, error) {
  995. gensupport.SetOptions(c.urlParams_, opts...)
  996. res, err := c.doRequest("json")
  997. if res != nil && res.StatusCode == http.StatusNotModified {
  998. if res.Body != nil {
  999. res.Body.Close()
  1000. }
  1001. return nil, &googleapi.Error{
  1002. Code: res.StatusCode,
  1003. Header: res.Header,
  1004. }
  1005. }
  1006. if err != nil {
  1007. return nil, err
  1008. }
  1009. defer googleapi.CloseBody(res)
  1010. if err := googleapi.CheckResponse(res); err != nil {
  1011. return nil, err
  1012. }
  1013. ret := &ListLogServicesResponse{
  1014. ServerResponse: googleapi.ServerResponse{
  1015. Header: res.Header,
  1016. HTTPStatusCode: res.StatusCode,
  1017. },
  1018. }
  1019. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  1020. return nil, err
  1021. }
  1022. return ret, nil
  1023. // {
  1024. // "description": "Lists the log services that have log entries in this project.",
  1025. // "httpMethod": "GET",
  1026. // "id": "logging.projects.logServices.list",
  1027. // "parameterOrder": [
  1028. // "projectsId"
  1029. // ],
  1030. // "parameters": {
  1031. // "pageSize": {
  1032. // "description": "The maximum number of `LogService` objects to return in one operation.",
  1033. // "format": "int32",
  1034. // "location": "query",
  1035. // "type": "integer"
  1036. // },
  1037. // "pageToken": {
  1038. // "description": "An opaque token, returned as `nextPageToken` by a prior `ListLogServices` operation. If `pageToken` is supplied, then the other fields of this request are ignored, and instead the previous `ListLogServices` operation is continued.",
  1039. // "location": "query",
  1040. // "type": "string"
  1041. // },
  1042. // "projectsId": {
  1043. // "description": "Part of `projectName`. The resource name of the project whose services are to be listed.",
  1044. // "location": "path",
  1045. // "required": true,
  1046. // "type": "string"
  1047. // }
  1048. // },
  1049. // "path": "v1beta3/projects/{projectsId}/logServices",
  1050. // "response": {
  1051. // "$ref": "ListLogServicesResponse"
  1052. // },
  1053. // "scopes": [
  1054. // "https://www.googleapis.com/auth/cloud-platform",
  1055. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  1056. // "https://www.googleapis.com/auth/logging.admin",
  1057. // "https://www.googleapis.com/auth/logging.read"
  1058. // ]
  1059. // }
  1060. }
  1061. // Pages invokes f for each page of results.
  1062. // A non-nil error returned from f will halt the iteration.
  1063. // The provided context supersedes any context provided to the Context method.
  1064. func (c *ProjectsLogServicesListCall) Pages(ctx context.Context, f func(*ListLogServicesResponse) error) error {
  1065. c.ctx_ = ctx
  1066. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  1067. for {
  1068. x, err := c.Do()
  1069. if err != nil {
  1070. return err
  1071. }
  1072. if err := f(x); err != nil {
  1073. return err
  1074. }
  1075. if x.NextPageToken == "" {
  1076. return nil
  1077. }
  1078. c.PageToken(x.NextPageToken)
  1079. }
  1080. }
  1081. // method id "logging.projects.logServices.indexes.list":
  1082. type ProjectsLogServicesIndexesListCall struct {
  1083. s *Service
  1084. projectsId string
  1085. logServicesId string
  1086. urlParams_ gensupport.URLParams
  1087. ifNoneMatch_ string
  1088. ctx_ context.Context
  1089. }
  1090. // List: Lists the current index values for a log service.
  1091. func (r *ProjectsLogServicesIndexesService) List(projectsId string, logServicesId string) *ProjectsLogServicesIndexesListCall {
  1092. c := &ProjectsLogServicesIndexesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1093. c.projectsId = projectsId
  1094. c.logServicesId = logServicesId
  1095. return c
  1096. }
  1097. // Depth sets the optional parameter "depth": A non-negative integer
  1098. // that limits the number of levels of the index hierarchy that are
  1099. // returned. If `depth` is 1 (default), only the first index key value
  1100. // is returned. If `depth` is 2, both primary and secondary key values
  1101. // are returned. If `depth` is 0, the depth is the number of
  1102. // slash-separators in the `indexPrefix` field, not counting a slash
  1103. // appearing as the last character of the prefix. If the `indexPrefix`
  1104. // field is empty, the default depth is 1. It is an error for `depth` to
  1105. // be any positive value less than the number of components in
  1106. // `indexPrefix`.
  1107. func (c *ProjectsLogServicesIndexesListCall) Depth(depth int64) *ProjectsLogServicesIndexesListCall {
  1108. c.urlParams_.Set("depth", fmt.Sprint(depth))
  1109. return c
  1110. }
  1111. // IndexPrefix sets the optional parameter "indexPrefix": Restricts the
  1112. // index values returned to be those with a specified prefix for each
  1113. // index key. This field has the form "/prefix1/prefix2/...", in order
  1114. // corresponding to the `LogService indexKeys`. Non-empty prefixes must
  1115. // begin with `/`. For example, App Engine's two keys are the module ID
  1116. // and the version ID. Following is the effect of using various values
  1117. // for `indexPrefix`: + "/Mod/" retrieves `/Mod/10` and `/Mod/11` but
  1118. // not `/ModA/10`. + "/Mod` retrieves `/Mod/10`, `/Mod/11` and
  1119. // `/ModA/10` but not `/XXX/33`. + "/Mod/1" retrieves `/Mod/10` and
  1120. // `/Mod/11` but not `/ModA/10`. + "/Mod/10/" retrieves `/Mod/10`
  1121. // only. + An empty prefix or "/" retrieves all values.
  1122. func (c *ProjectsLogServicesIndexesListCall) IndexPrefix(indexPrefix string) *ProjectsLogServicesIndexesListCall {
  1123. c.urlParams_.Set("indexPrefix", indexPrefix)
  1124. return c
  1125. }
  1126. // PageSize sets the optional parameter "pageSize": The maximum number
  1127. // of log service index resources to return in one operation.
  1128. func (c *ProjectsLogServicesIndexesListCall) PageSize(pageSize int64) *ProjectsLogServicesIndexesListCall {
  1129. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  1130. return c
  1131. }
  1132. // PageToken sets the optional parameter "pageToken": An opaque token,
  1133. // returned as `nextPageToken` by a prior `ListLogServiceIndexes`
  1134. // operation. If `pageToken` is supplied, then the other fields of this
  1135. // request are ignored, and instead the previous `ListLogServiceIndexes`
  1136. // operation is continued.
  1137. func (c *ProjectsLogServicesIndexesListCall) PageToken(pageToken string) *ProjectsLogServicesIndexesListCall {
  1138. c.urlParams_.Set("pageToken", pageToken)
  1139. return c
  1140. }
  1141. // Fields allows partial responses to be retrieved. See
  1142. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1143. // for more information.
  1144. func (c *ProjectsLogServicesIndexesListCall) Fields(s ...googleapi.Field) *ProjectsLogServicesIndexesListCall {
  1145. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1146. return c
  1147. }
  1148. // IfNoneMatch sets the optional parameter which makes the operation
  1149. // fail if the object's ETag matches the given value. This is useful for
  1150. // getting updates only after the object has changed since the last
  1151. // request. Use googleapi.IsNotModified to check whether the response
  1152. // error from Do is the result of In-None-Match.
  1153. func (c *ProjectsLogServicesIndexesListCall) IfNoneMatch(entityTag string) *ProjectsLogServicesIndexesListCall {
  1154. c.ifNoneMatch_ = entityTag
  1155. return c
  1156. }
  1157. // Context sets the context to be used in this call's Do method. Any
  1158. // pending HTTP request will be aborted if the provided context is
  1159. // canceled.
  1160. func (c *ProjectsLogServicesIndexesListCall) Context(ctx context.Context) *ProjectsLogServicesIndexesListCall {
  1161. c.ctx_ = ctx
  1162. return c
  1163. }
  1164. func (c *ProjectsLogServicesIndexesListCall) doRequest(alt string) (*http.Response, error) {
  1165. var body io.Reader = nil
  1166. c.urlParams_.Set("alt", alt)
  1167. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta3/projects/{projectsId}/logServices/{logServicesId}/indexes")
  1168. urls += "?" + c.urlParams_.Encode()
  1169. req, _ := http.NewRequest("GET", urls, body)
  1170. googleapi.Expand(req.URL, map[string]string{
  1171. "projectsId": c.projectsId,
  1172. "logServicesId": c.logServicesId,
  1173. })
  1174. req.Header.Set("User-Agent", c.s.userAgent())
  1175. if c.ifNoneMatch_ != "" {
  1176. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  1177. }
  1178. if c.ctx_ != nil {
  1179. return ctxhttp.Do(c.ctx_, c.s.client, req)
  1180. }
  1181. return c.s.client.Do(req)
  1182. }
  1183. // Do executes the "logging.projects.logServices.indexes.list" call.
  1184. // Exactly one of *ListLogServiceIndexesResponse or error will be
  1185. // non-nil. Any non-2xx status code is an error. Response headers are in
  1186. // either *ListLogServiceIndexesResponse.ServerResponse.Header or (if a
  1187. // response was returned at all) in error.(*googleapi.Error).Header. Use
  1188. // googleapi.IsNotModified to check whether the returned error was
  1189. // because http.StatusNotModified was returned.
  1190. func (c *ProjectsLogServicesIndexesListCall) Do(opts ...googleapi.CallOption) (*ListLogServiceIndexesResponse, error) {
  1191. gensupport.SetOptions(c.urlParams_, opts...)
  1192. res, err := c.doRequest("json")
  1193. if res != nil && res.StatusCode == http.StatusNotModified {
  1194. if res.Body != nil {
  1195. res.Body.Close()
  1196. }
  1197. return nil, &googleapi.Error{
  1198. Code: res.StatusCode,
  1199. Header: res.Header,
  1200. }
  1201. }
  1202. if err != nil {
  1203. return nil, err
  1204. }
  1205. defer googleapi.CloseBody(res)
  1206. if err := googleapi.CheckResponse(res); err != nil {
  1207. return nil, err
  1208. }
  1209. ret := &ListLogServiceIndexesResponse{
  1210. ServerResponse: googleapi.ServerResponse{
  1211. Header: res.Header,
  1212. HTTPStatusCode: res.StatusCode,
  1213. },
  1214. }
  1215. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  1216. return nil, err
  1217. }
  1218. return ret, nil
  1219. // {
  1220. // "description": "Lists the current index values for a log service.",
  1221. // "httpMethod": "GET",
  1222. // "id": "logging.projects.logServices.indexes.list",
  1223. // "parameterOrder": [
  1224. // "projectsId",
  1225. // "logServicesId"
  1226. // ],
  1227. // "parameters": {
  1228. // "depth": {
  1229. // "description": "A non-negative integer that limits the number of levels of the index hierarchy that are returned. If `depth` is 1 (default), only the first index key value is returned. If `depth` is 2, both primary and secondary key values are returned. If `depth` is 0, the depth is the number of slash-separators in the `indexPrefix` field, not counting a slash appearing as the last character of the prefix. If the `indexPrefix` field is empty, the default depth is 1. It is an error for `depth` to be any positive value less than the number of components in `indexPrefix`.",
  1230. // "format": "int32",
  1231. // "location": "query",
  1232. // "type": "integer"
  1233. // },
  1234. // "indexPrefix": {
  1235. // "description": "Restricts the index values returned to be those with a specified prefix for each index key. This field has the form `\"/prefix1/prefix2/...\"`, in order corresponding to the `LogService indexKeys`. Non-empty prefixes must begin with `/`. For example, App Engine's two keys are the module ID and the version ID. Following is the effect of using various values for `indexPrefix`: + `\"/Mod/\"` retrieves `/Mod/10` and `/Mod/11` but not `/ModA/10`. + `\"/Mod` retrieves `/Mod/10`, `/Mod/11` and `/ModA/10` but not `/XXX/33`. + `\"/Mod/1\"` retrieves `/Mod/10` and `/Mod/11` but not `/ModA/10`. + `\"/Mod/10/\"` retrieves `/Mod/10` only. + An empty prefix or `\"/\"` retrieves all values.",
  1236. // "location": "query",
  1237. // "type": "string"
  1238. // },
  1239. // "logServicesId": {
  1240. // "description": "Part of `serviceName`. See documentation of `projectsId`.",
  1241. // "location": "path",
  1242. // "required": true,
  1243. // "type": "string"
  1244. // },
  1245. // "pageSize": {
  1246. // "description": "The maximum number of log service index resources to return in one operation.",
  1247. // "format": "int32",
  1248. // "location": "query",
  1249. // "type": "integer"
  1250. // },
  1251. // "pageToken": {
  1252. // "description": "An opaque token, returned as `nextPageToken` by a prior `ListLogServiceIndexes` operation. If `pageToken` is supplied, then the other fields of this request are ignored, and instead the previous `ListLogServiceIndexes` operation is continued.",
  1253. // "location": "query",
  1254. // "type": "string"
  1255. // },
  1256. // "projectsId": {
  1257. // "description": "Part of `serviceName`. The resource name of a log service whose service indexes are requested. Example: `\"projects/my-project-id/logServices/appengine.googleapis.com\"`.",
  1258. // "location": "path",
  1259. // "required": true,
  1260. // "type": "string"
  1261. // }
  1262. // },
  1263. // "path": "v1beta3/projects/{projectsId}/logServices/{logServicesId}/indexes",
  1264. // "response": {
  1265. // "$ref": "ListLogServiceIndexesResponse"
  1266. // },
  1267. // "scopes": [
  1268. // "https://www.googleapis.com/auth/cloud-platform",
  1269. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  1270. // "https://www.googleapis.com/auth/logging.admin",
  1271. // "https://www.googleapis.com/auth/logging.read"
  1272. // ]
  1273. // }
  1274. }
  1275. // Pages invokes f for each page of results.
  1276. // A non-nil error returned from f will halt the iteration.
  1277. // The provided context supersedes any context provided to the Context method.
  1278. func (c *ProjectsLogServicesIndexesListCall) Pages(ctx context.Context, f func(*ListLogServiceIndexesResponse) error) error {
  1279. c.ctx_ = ctx
  1280. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  1281. for {
  1282. x, err := c.Do()
  1283. if err != nil {
  1284. return err
  1285. }
  1286. if err := f(x); err != nil {
  1287. return err
  1288. }
  1289. if x.NextPageToken == "" {
  1290. return nil
  1291. }
  1292. c.PageToken(x.NextPageToken)
  1293. }
  1294. }
  1295. // method id "logging.projects.logServices.sinks.create":
  1296. type ProjectsLogServicesSinksCreateCall struct {
  1297. s *Service
  1298. projectsId string
  1299. logServicesId string
  1300. logsink *LogSink
  1301. urlParams_ gensupport.URLParams
  1302. ctx_ context.Context
  1303. }
  1304. // Create: Creates a log service sink. All log entries from a specified
  1305. // log service are written to the destination.
  1306. func (r *ProjectsLogServicesSinksService) Create(projectsId string, logServicesId string, logsink *LogSink) *ProjectsLogServicesSinksCreateCall {
  1307. c := &ProjectsLogServicesSinksCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1308. c.projectsId = projectsId
  1309. c.logServicesId = logServicesId
  1310. c.logsink = logsink
  1311. return c
  1312. }
  1313. // Fields allows partial responses to be retrieved. See
  1314. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1315. // for more information.
  1316. func (c *ProjectsLogServicesSinksCreateCall) Fields(s ...googleapi.Field) *ProjectsLogServicesSinksCreateCall {
  1317. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1318. return c
  1319. }
  1320. // Context sets the context to be used in this call's Do method. Any
  1321. // pending HTTP request will be aborted if the provided context is
  1322. // canceled.
  1323. func (c *ProjectsLogServicesSinksCreateCall) Context(ctx context.Context) *ProjectsLogServicesSinksCreateCall {
  1324. c.ctx_ = ctx
  1325. return c
  1326. }
  1327. func (c *ProjectsLogServicesSinksCreateCall) doRequest(alt string) (*http.Response, error) {
  1328. var body io.Reader = nil
  1329. body, err := googleapi.WithoutDataWrapper.JSONReader(c.logsink)
  1330. if err != nil {
  1331. return nil, err
  1332. }
  1333. ctype := "application/json"
  1334. c.urlParams_.Set("alt", alt)
  1335. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta3/projects/{projectsId}/logServices/{logServicesId}/sinks")
  1336. urls += "?" + c.urlParams_.Encode()
  1337. req, _ := http.NewRequest("POST", urls, body)
  1338. googleapi.Expand(req.URL, map[string]string{
  1339. "projectsId": c.projectsId,
  1340. "logServicesId": c.logServicesId,
  1341. })
  1342. req.Header.Set("Content-Type", ctype)
  1343. req.Header.Set("User-Agent", c.s.userAgent())
  1344. if c.ctx_ != nil {
  1345. return ctxhttp.Do(c.ctx_, c.s.client, req)
  1346. }
  1347. return c.s.client.Do(req)
  1348. }
  1349. // Do executes the "logging.projects.logServices.sinks.create" call.
  1350. // Exactly one of *LogSink or error will be non-nil. Any non-2xx status
  1351. // code is an error. Response headers are in either
  1352. // *LogSink.ServerResponse.Header or (if a response was returned at all)
  1353. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1354. // check whether the returned error was because http.StatusNotModified
  1355. // was returned.
  1356. func (c *ProjectsLogServicesSinksCreateCall) Do(opts ...googleapi.CallOption) (*LogSink, error) {
  1357. gensupport.SetOptions(c.urlParams_, opts...)
  1358. res, err := c.doRequest("json")
  1359. if res != nil && res.StatusCode == http.StatusNotModified {
  1360. if res.Body != nil {
  1361. res.Body.Close()
  1362. }
  1363. return nil, &googleapi.Error{
  1364. Code: res.StatusCode,
  1365. Header: res.Header,
  1366. }
  1367. }
  1368. if err != nil {
  1369. return nil, err
  1370. }
  1371. defer googleapi.CloseBody(res)
  1372. if err := googleapi.CheckResponse(res); err != nil {
  1373. return nil, err
  1374. }
  1375. ret := &LogSink{
  1376. ServerResponse: googleapi.ServerResponse{
  1377. Header: res.Header,
  1378. HTTPStatusCode: res.StatusCode,
  1379. },
  1380. }
  1381. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  1382. return nil, err
  1383. }
  1384. return ret, nil
  1385. // {
  1386. // "description": "Creates a log service sink. All log entries from a specified log service are written to the destination.",
  1387. // "httpMethod": "POST",
  1388. // "id": "logging.projects.logServices.sinks.create",
  1389. // "parameterOrder": [
  1390. // "projectsId",
  1391. // "logServicesId"
  1392. // ],
  1393. // "parameters": {
  1394. // "logServicesId": {
  1395. // "description": "Part of `serviceName`. See documentation of `projectsId`.",
  1396. // "location": "path",
  1397. // "required": true,
  1398. // "type": "string"
  1399. // },
  1400. // "projectsId": {
  1401. // "description": "Part of `serviceName`. The resource name of the log service to which the sink is bound.",
  1402. // "location": "path",
  1403. // "required": true,
  1404. // "type": "string"
  1405. // }
  1406. // },
  1407. // "path": "v1beta3/projects/{projectsId}/logServices/{logServicesId}/sinks",
  1408. // "request": {
  1409. // "$ref": "LogSink"
  1410. // },
  1411. // "response": {
  1412. // "$ref": "LogSink"
  1413. // },
  1414. // "scopes": [
  1415. // "https://www.googleapis.com/auth/cloud-platform",
  1416. // "https://www.googleapis.com/auth/logging.admin"
  1417. // ]
  1418. // }
  1419. }
  1420. // method id "logging.projects.logServices.sinks.delete":
  1421. type ProjectsLogServicesSinksDeleteCall struct {
  1422. s *Service
  1423. projectsId string
  1424. logServicesId string
  1425. sinksId string
  1426. urlParams_ gensupport.URLParams
  1427. ctx_ context.Context
  1428. }
  1429. // Delete: Deletes a log service sink. After deletion, no new log
  1430. // entries are written to the destination.
  1431. func (r *ProjectsLogServicesSinksService) Delete(projectsId string, logServicesId string, sinksId string) *ProjectsLogServicesSinksDeleteCall {
  1432. c := &ProjectsLogServicesSinksDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1433. c.projectsId = projectsId
  1434. c.logServicesId = logServicesId
  1435. c.sinksId = sinksId
  1436. return c
  1437. }
  1438. // Fields allows partial responses to be retrieved. See
  1439. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1440. // for more information.
  1441. func (c *ProjectsLogServicesSinksDeleteCall) Fields(s ...googleapi.Field) *ProjectsLogServicesSinksDeleteCall {
  1442. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1443. return c
  1444. }
  1445. // Context sets the context to be used in this call's Do method. Any
  1446. // pending HTTP request will be aborted if the provided context is
  1447. // canceled.
  1448. func (c *ProjectsLogServicesSinksDeleteCall) Context(ctx context.Context) *ProjectsLogServicesSinksDeleteCall {
  1449. c.ctx_ = ctx
  1450. return c
  1451. }
  1452. func (c *ProjectsLogServicesSinksDeleteCall) doRequest(alt string) (*http.Response, error) {
  1453. var body io.Reader = nil
  1454. c.urlParams_.Set("alt", alt)
  1455. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta3/projects/{projectsId}/logServices/{logServicesId}/sinks/{sinksId}")
  1456. urls += "?" + c.urlParams_.Encode()
  1457. req, _ := http.NewRequest("DELETE", urls, body)
  1458. googleapi.Expand(req.URL, map[string]string{
  1459. "projectsId": c.projectsId,
  1460. "logServicesId": c.logServicesId,
  1461. "sinksId": c.sinksId,
  1462. })
  1463. req.Header.Set("User-Agent", c.s.userAgent())
  1464. if c.ctx_ != nil {
  1465. return ctxhttp.Do(c.ctx_, c.s.client, req)
  1466. }
  1467. return c.s.client.Do(req)
  1468. }
  1469. // Do executes the "logging.projects.logServices.sinks.delete" call.
  1470. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  1471. // code is an error. Response headers are in either
  1472. // *Empty.ServerResponse.Header or (if a response was returned at all)
  1473. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1474. // check whether the returned error was because http.StatusNotModified
  1475. // was returned.
  1476. func (c *ProjectsLogServicesSinksDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  1477. gensupport.SetOptions(c.urlParams_, opts...)
  1478. res, err := c.doRequest("json")
  1479. if res != nil && res.StatusCode == http.StatusNotModified {
  1480. if res.Body != nil {
  1481. res.Body.Close()
  1482. }
  1483. return nil, &googleapi.Error{
  1484. Code: res.StatusCode,
  1485. Header: res.Header,
  1486. }
  1487. }
  1488. if err != nil {
  1489. return nil, err
  1490. }
  1491. defer googleapi.CloseBody(res)
  1492. if err := googleapi.CheckResponse(res); err != nil {
  1493. return nil, err
  1494. }
  1495. ret := &Empty{
  1496. ServerResponse: googleapi.ServerResponse{
  1497. Header: res.Header,
  1498. HTTPStatusCode: res.StatusCode,
  1499. },
  1500. }
  1501. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  1502. return nil, err
  1503. }
  1504. return ret, nil
  1505. // {
  1506. // "description": "Deletes a log service sink. After deletion, no new log entries are written to the destination.",
  1507. // "httpMethod": "DELETE",
  1508. // "id": "logging.projects.logServices.sinks.delete",
  1509. // "parameterOrder": [
  1510. // "projectsId",
  1511. // "logServicesId",
  1512. // "sinksId"
  1513. // ],
  1514. // "parameters": {
  1515. // "logServicesId": {
  1516. // "description": "Part of `sinkName`. See documentation of `projectsId`.",
  1517. // "location": "path",
  1518. // "required": true,
  1519. // "type": "string"
  1520. // },
  1521. // "projectsId": {
  1522. // "description": "Part of `sinkName`. The resource name of the log service sink to delete.",
  1523. // "location": "path",
  1524. // "required": true,
  1525. // "type": "string"
  1526. // },
  1527. // "sinksId": {
  1528. // "description": "Part of `sinkName`. See documentation of `projectsId`.",
  1529. // "location": "path",
  1530. // "required": true,
  1531. // "type": "string"
  1532. // }
  1533. // },
  1534. // "path": "v1beta3/projects/{projectsId}/logServices/{logServicesId}/sinks/{sinksId}",
  1535. // "response": {
  1536. // "$ref": "Empty"
  1537. // },
  1538. // "scopes": [
  1539. // "https://www.googleapis.com/auth/cloud-platform",
  1540. // "https://www.googleapis.com/auth/logging.admin"
  1541. // ]
  1542. // }
  1543. }
  1544. // method id "logging.projects.logServices.sinks.get":
  1545. type ProjectsLogServicesSinksGetCall struct {
  1546. s *Service
  1547. projectsId string
  1548. logServicesId string
  1549. sinksId string
  1550. urlParams_ gensupport.URLParams
  1551. ifNoneMatch_ string
  1552. ctx_ context.Context
  1553. }
  1554. // Get: Gets a log service sink.
  1555. func (r *ProjectsLogServicesSinksService) Get(projectsId string, logServicesId string, sinksId string) *ProjectsLogServicesSinksGetCall {
  1556. c := &ProjectsLogServicesSinksGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1557. c.projectsId = projectsId
  1558. c.logServicesId = logServicesId
  1559. c.sinksId = sinksId
  1560. return c
  1561. }
  1562. // Fields allows partial responses to be retrieved. See
  1563. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1564. // for more information.
  1565. func (c *ProjectsLogServicesSinksGetCall) Fields(s ...googleapi.Field) *ProjectsLogServicesSinksGetCall {
  1566. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1567. return c
  1568. }
  1569. // IfNoneMatch sets the optional parameter which makes the operation
  1570. // fail if the object's ETag matches the given value. This is useful for
  1571. // getting updates only after the object has changed since the last
  1572. // request. Use googleapi.IsNotModified to check whether the response
  1573. // error from Do is the result of In-None-Match.
  1574. func (c *ProjectsLogServicesSinksGetCall) IfNoneMatch(entityTag string) *ProjectsLogServicesSinksGetCall {
  1575. c.ifNoneMatch_ = entityTag
  1576. return c
  1577. }
  1578. // Context sets the context to be used in this call's Do method. Any
  1579. // pending HTTP request will be aborted if the provided context is
  1580. // canceled.
  1581. func (c *ProjectsLogServicesSinksGetCall) Context(ctx context.Context) *ProjectsLogServicesSinksGetCall {
  1582. c.ctx_ = ctx
  1583. return c
  1584. }
  1585. func (c *ProjectsLogServicesSinksGetCall) doRequest(alt string) (*http.Response, error) {
  1586. var body io.Reader = nil
  1587. c.urlParams_.Set("alt", alt)
  1588. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta3/projects/{projectsId}/logServices/{logServicesId}/sinks/{sinksId}")
  1589. urls += "?" + c.urlParams_.Encode()
  1590. req, _ := http.NewRequest("GET", urls, body)
  1591. googleapi.Expand(req.URL, map[string]string{
  1592. "projectsId": c.projectsId,
  1593. "logServicesId": c.logServicesId,
  1594. "sinksId": c.sinksId,
  1595. })
  1596. req.Header.Set("User-Agent", c.s.userAgent())
  1597. if c.ifNoneMatch_ != "" {
  1598. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  1599. }
  1600. if c.ctx_ != nil {
  1601. return ctxhttp.Do(c.ctx_, c.s.client, req)
  1602. }
  1603. return c.s.client.Do(req)
  1604. }
  1605. // Do executes the "logging.projects.logServices.sinks.get" call.
  1606. // Exactly one of *LogSink or error will be non-nil. Any non-2xx status
  1607. // code is an error. Response headers are in either
  1608. // *LogSink.ServerResponse.Header or (if a response was returned at all)
  1609. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1610. // check whether the returned error was because http.StatusNotModified
  1611. // was returned.
  1612. func (c *ProjectsLogServicesSinksGetCall) Do(opts ...googleapi.CallOption) (*LogSink, error) {
  1613. gensupport.SetOptions(c.urlParams_, opts...)
  1614. res, err := c.doRequest("json")
  1615. if res != nil && res.StatusCode == http.StatusNotModified {
  1616. if res.Body != nil {
  1617. res.Body.Close()
  1618. }
  1619. return nil, &googleapi.Error{
  1620. Code: res.StatusCode,
  1621. Header: res.Header,
  1622. }
  1623. }
  1624. if err != nil {
  1625. return nil, err
  1626. }
  1627. defer googleapi.CloseBody(res)
  1628. if err := googleapi.CheckResponse(res); err != nil {
  1629. return nil, err
  1630. }
  1631. ret := &LogSink{
  1632. ServerResponse: googleapi.ServerResponse{
  1633. Header: res.Header,
  1634. HTTPStatusCode: res.StatusCode,
  1635. },
  1636. }
  1637. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  1638. return nil, err
  1639. }
  1640. return ret, nil
  1641. // {
  1642. // "description": "Gets a log service sink.",
  1643. // "httpMethod": "GET",
  1644. // "id": "logging.projects.logServices.sinks.get",
  1645. // "parameterOrder": [
  1646. // "projectsId",
  1647. // "logServicesId",
  1648. // "sinksId"
  1649. // ],
  1650. // "parameters": {
  1651. // "logServicesId": {
  1652. // "description": "Part of `sinkName`. See documentation of `projectsId`.",
  1653. // "location": "path",
  1654. // "required": true,
  1655. // "type": "string"
  1656. // },
  1657. // "projectsId": {
  1658. // "description": "Part of `sinkName`. The resource name of the log service sink to return.",
  1659. // "location": "path",
  1660. // "required": true,
  1661. // "type": "string"
  1662. // },
  1663. // "sinksId": {
  1664. // "description": "Part of `sinkName`. See documentation of `projectsId`.",
  1665. // "location": "path",
  1666. // "required": true,
  1667. // "type": "string"
  1668. // }
  1669. // },
  1670. // "path": "v1beta3/projects/{projectsId}/logServices/{logServicesId}/sinks/{sinksId}",
  1671. // "response": {
  1672. // "$ref": "LogSink"
  1673. // },
  1674. // "scopes": [
  1675. // "https://www.googleapis.com/auth/cloud-platform",
  1676. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  1677. // "https://www.googleapis.com/auth/logging.admin",
  1678. // "https://www.googleapis.com/auth/logging.read"
  1679. // ]
  1680. // }
  1681. }
  1682. // method id "logging.projects.logServices.sinks.list":
  1683. type ProjectsLogServicesSinksListCall struct {
  1684. s *Service
  1685. projectsId string
  1686. logServicesId string
  1687. urlParams_ gensupport.URLParams
  1688. ifNoneMatch_ string
  1689. ctx_ context.Context
  1690. }
  1691. // List: Lists log service sinks associated with a log service.
  1692. func (r *ProjectsLogServicesSinksService) List(projectsId string, logServicesId string) *ProjectsLogServicesSinksListCall {
  1693. c := &ProjectsLogServicesSinksListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1694. c.projectsId = projectsId
  1695. c.logServicesId = logServicesId
  1696. return c
  1697. }
  1698. // Fields allows partial responses to be retrieved. See
  1699. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1700. // for more information.
  1701. func (c *ProjectsLogServicesSinksListCall) Fields(s ...googleapi.Field) *ProjectsLogServicesSinksListCall {
  1702. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1703. return c
  1704. }
  1705. // IfNoneMatch sets the optional parameter which makes the operation
  1706. // fail if the object's ETag matches the given value. This is useful for
  1707. // getting updates only after the object has changed since the last
  1708. // request. Use googleapi.IsNotModified to check whether the response
  1709. // error from Do is the result of In-None-Match.
  1710. func (c *ProjectsLogServicesSinksListCall) IfNoneMatch(entityTag string) *ProjectsLogServicesSinksListCall {
  1711. c.ifNoneMatch_ = entityTag
  1712. return c
  1713. }
  1714. // Context sets the context to be used in this call's Do method. Any
  1715. // pending HTTP request will be aborted if the provided context is
  1716. // canceled.
  1717. func (c *ProjectsLogServicesSinksListCall) Context(ctx context.Context) *ProjectsLogServicesSinksListCall {
  1718. c.ctx_ = ctx
  1719. return c
  1720. }
  1721. func (c *ProjectsLogServicesSinksListCall) doRequest(alt string) (*http.Response, error) {
  1722. var body io.Reader = nil
  1723. c.urlParams_.Set("alt", alt)
  1724. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta3/projects/{projectsId}/logServices/{logServicesId}/sinks")
  1725. urls += "?" + c.urlParams_.Encode()
  1726. req, _ := http.NewRequest("GET", urls, body)
  1727. googleapi.Expand(req.URL, map[string]string{
  1728. "projectsId": c.projectsId,
  1729. "logServicesId": c.logServicesId,
  1730. })
  1731. req.Header.Set("User-Agent", c.s.userAgent())
  1732. if c.ifNoneMatch_ != "" {
  1733. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  1734. }
  1735. if c.ctx_ != nil {
  1736. return ctxhttp.Do(c.ctx_, c.s.client, req)
  1737. }
  1738. return c.s.client.Do(req)
  1739. }
  1740. // Do executes the "logging.projects.logServices.sinks.list" call.
  1741. // Exactly one of *ListLogServiceSinksResponse or error will be non-nil.
  1742. // Any non-2xx status code is an error. Response headers are in either
  1743. // *ListLogServiceSinksResponse.ServerResponse.Header or (if a response
  1744. // was returned at all) in error.(*googleapi.Error).Header. Use
  1745. // googleapi.IsNotModified to check whether the returned error was
  1746. // because http.StatusNotModified was returned.
  1747. func (c *ProjectsLogServicesSinksListCall) Do(opts ...googleapi.CallOption) (*ListLogServiceSinksResponse, error) {
  1748. gensupport.SetOptions(c.urlParams_, opts...)
  1749. res, err := c.doRequest("json")
  1750. if res != nil && res.StatusCode == http.StatusNotModified {
  1751. if res.Body != nil {
  1752. res.Body.Close()
  1753. }
  1754. return nil, &googleapi.Error{
  1755. Code: res.StatusCode,
  1756. Header: res.Header,
  1757. }
  1758. }
  1759. if err != nil {
  1760. return nil, err
  1761. }
  1762. defer googleapi.CloseBody(res)
  1763. if err := googleapi.CheckResponse(res); err != nil {
  1764. return nil, err
  1765. }
  1766. ret := &ListLogServiceSinksResponse{
  1767. ServerResponse: googleapi.ServerResponse{
  1768. Header: res.Header,
  1769. HTTPStatusCode: res.StatusCode,
  1770. },
  1771. }
  1772. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  1773. return nil, err
  1774. }
  1775. return ret, nil
  1776. // {
  1777. // "description": "Lists log service sinks associated with a log service.",
  1778. // "httpMethod": "GET",
  1779. // "id": "logging.projects.logServices.sinks.list",
  1780. // "parameterOrder": [
  1781. // "projectsId",
  1782. // "logServicesId"
  1783. // ],
  1784. // "parameters": {
  1785. // "logServicesId": {
  1786. // "description": "Part of `serviceName`. See documentation of `projectsId`.",
  1787. // "location": "path",
  1788. // "required": true,
  1789. // "type": "string"
  1790. // },
  1791. // "projectsId": {
  1792. // "description": "Part of `serviceName`. The log service whose sinks are wanted.",
  1793. // "location": "path",
  1794. // "required": true,
  1795. // "type": "string"
  1796. // }
  1797. // },
  1798. // "path": "v1beta3/projects/{projectsId}/logServices/{logServicesId}/sinks",
  1799. // "response": {
  1800. // "$ref": "ListLogServiceSinksResponse"
  1801. // },
  1802. // "scopes": [
  1803. // "https://www.googleapis.com/auth/cloud-platform",
  1804. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  1805. // "https://www.googleapis.com/auth/logging.admin",
  1806. // "https://www.googleapis.com/auth/logging.read"
  1807. // ]
  1808. // }
  1809. }
  1810. // method id "logging.projects.logServices.sinks.update":
  1811. type ProjectsLogServicesSinksUpdateCall struct {
  1812. s *Service
  1813. projectsId string
  1814. logServicesId string
  1815. sinksId string
  1816. logsink *LogSink
  1817. urlParams_ gensupport.URLParams
  1818. ctx_ context.Context
  1819. }
  1820. // Update: Updates a log service sink. If the sink does not exist, it is
  1821. // created.
  1822. func (r *ProjectsLogServicesSinksService) Update(projectsId string, logServicesId string, sinksId string, logsink *LogSink) *ProjectsLogServicesSinksUpdateCall {
  1823. c := &ProjectsLogServicesSinksUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1824. c.projectsId = projectsId
  1825. c.logServicesId = logServicesId
  1826. c.sinksId = sinksId
  1827. c.logsink = logsink
  1828. return c
  1829. }
  1830. // Fields allows partial responses to be retrieved. See
  1831. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1832. // for more information.
  1833. func (c *ProjectsLogServicesSinksUpdateCall) Fields(s ...googleapi.Field) *ProjectsLogServicesSinksUpdateCall {
  1834. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1835. return c
  1836. }
  1837. // Context sets the context to be used in this call's Do method. Any
  1838. // pending HTTP request will be aborted if the provided context is
  1839. // canceled.
  1840. func (c *ProjectsLogServicesSinksUpdateCall) Context(ctx context.Context) *ProjectsLogServicesSinksUpdateCall {
  1841. c.ctx_ = ctx
  1842. return c
  1843. }
  1844. func (c *ProjectsLogServicesSinksUpdateCall) doRequest(alt string) (*http.Response, error) {
  1845. var body io.Reader = nil
  1846. body, err := googleapi.WithoutDataWrapper.JSONReader(c.logsink)
  1847. if err != nil {
  1848. return nil, err
  1849. }
  1850. ctype := "application/json"
  1851. c.urlParams_.Set("alt", alt)
  1852. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta3/projects/{projectsId}/logServices/{logServicesId}/sinks/{sinksId}")
  1853. urls += "?" + c.urlParams_.Encode()
  1854. req, _ := http.NewRequest("PUT", urls, body)
  1855. googleapi.Expand(req.URL, map[string]string{
  1856. "projectsId": c.projectsId,
  1857. "logServicesId": c.logServicesId,
  1858. "sinksId": c.sinksId,
  1859. })
  1860. req.Header.Set("Content-Type", ctype)
  1861. req.Header.Set("User-Agent", c.s.userAgent())
  1862. if c.ctx_ != nil {
  1863. return ctxhttp.Do(c.ctx_, c.s.client, req)
  1864. }
  1865. return c.s.client.Do(req)
  1866. }
  1867. // Do executes the "logging.projects.logServices.sinks.update" call.
  1868. // Exactly one of *LogSink or error will be non-nil. Any non-2xx status
  1869. // code is an error. Response headers are in either
  1870. // *LogSink.ServerResponse.Header or (if a response was returned at all)
  1871. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1872. // check whether the returned error was because http.StatusNotModified
  1873. // was returned.
  1874. func (c *ProjectsLogServicesSinksUpdateCall) Do(opts ...googleapi.CallOption) (*LogSink, error) {
  1875. gensupport.SetOptions(c.urlParams_, opts...)
  1876. res, err := c.doRequest("json")
  1877. if res != nil && res.StatusCode == http.StatusNotModified {
  1878. if res.Body != nil {
  1879. res.Body.Close()
  1880. }
  1881. return nil, &googleapi.Error{
  1882. Code: res.StatusCode,
  1883. Header: res.Header,
  1884. }
  1885. }
  1886. if err != nil {
  1887. return nil, err
  1888. }
  1889. defer googleapi.CloseBody(res)
  1890. if err := googleapi.CheckResponse(res); err != nil {
  1891. return nil, err
  1892. }
  1893. ret := &LogSink{
  1894. ServerResponse: googleapi.ServerResponse{
  1895. Header: res.Header,
  1896. HTTPStatusCode: res.StatusCode,
  1897. },
  1898. }
  1899. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  1900. return nil, err
  1901. }
  1902. return ret, nil
  1903. // {
  1904. // "description": "Updates a log service sink. If the sink does not exist, it is created.",
  1905. // "httpMethod": "PUT",
  1906. // "id": "logging.projects.logServices.sinks.update",
  1907. // "parameterOrder": [
  1908. // "projectsId",
  1909. // "logServicesId",
  1910. // "sinksId"
  1911. // ],
  1912. // "parameters": {
  1913. // "logServicesId": {
  1914. // "description": "Part of `sinkName`. See documentation of `projectsId`.",
  1915. // "location": "path",
  1916. // "required": true,
  1917. // "type": "string"
  1918. // },
  1919. // "projectsId": {
  1920. // "description": "Part of `sinkName`. The resource name of the log service sink to update.",
  1921. // "location": "path",
  1922. // "required": true,
  1923. // "type": "string"
  1924. // },
  1925. // "sinksId": {
  1926. // "description": "Part of `sinkName`. See documentation of `projectsId`.",
  1927. // "location": "path",
  1928. // "required": true,
  1929. // "type": "string"
  1930. // }
  1931. // },
  1932. // "path": "v1beta3/projects/{projectsId}/logServices/{logServicesId}/sinks/{sinksId}",
  1933. // "request": {
  1934. // "$ref": "LogSink"
  1935. // },
  1936. // "response": {
  1937. // "$ref": "LogSink"
  1938. // },
  1939. // "scopes": [
  1940. // "https://www.googleapis.com/auth/cloud-platform",
  1941. // "https://www.googleapis.com/auth/logging.admin"
  1942. // ]
  1943. // }
  1944. }
  1945. // method id "logging.projects.logs.delete":
  1946. type ProjectsLogsDeleteCall struct {
  1947. s *Service
  1948. projectsId string
  1949. logsId string
  1950. urlParams_ gensupport.URLParams
  1951. ctx_ context.Context
  1952. }
  1953. // Delete: Deletes a log and all its log entries. The log will reappear
  1954. // if it receives new entries.
  1955. func (r *ProjectsLogsService) Delete(projectsId string, logsId string) *ProjectsLogsDeleteCall {
  1956. c := &ProjectsLogsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1957. c.projectsId = projectsId
  1958. c.logsId = logsId
  1959. return c
  1960. }
  1961. // Fields allows partial responses to be retrieved. See
  1962. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1963. // for more information.
  1964. func (c *ProjectsLogsDeleteCall) Fields(s ...googleapi.Field) *ProjectsLogsDeleteCall {
  1965. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1966. return c
  1967. }
  1968. // Context sets the context to be used in this call's Do method. Any
  1969. // pending HTTP request will be aborted if the provided context is
  1970. // canceled.
  1971. func (c *ProjectsLogsDeleteCall) Context(ctx context.Context) *ProjectsLogsDeleteCall {
  1972. c.ctx_ = ctx
  1973. return c
  1974. }
  1975. func (c *ProjectsLogsDeleteCall) doRequest(alt string) (*http.Response, error) {
  1976. var body io.Reader = nil
  1977. c.urlParams_.Set("alt", alt)
  1978. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta3/projects/{projectsId}/logs/{logsId}")
  1979. urls += "?" + c.urlParams_.Encode()
  1980. req, _ := http.NewRequest("DELETE", urls, body)
  1981. googleapi.Expand(req.URL, map[string]string{
  1982. "projectsId": c.projectsId,
  1983. "logsId": c.logsId,
  1984. })
  1985. req.Header.Set("User-Agent", c.s.userAgent())
  1986. if c.ctx_ != nil {
  1987. return ctxhttp.Do(c.ctx_, c.s.client, req)
  1988. }
  1989. return c.s.client.Do(req)
  1990. }
  1991. // Do executes the "logging.projects.logs.delete" call.
  1992. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  1993. // code is an error. Response headers are in either
  1994. // *Empty.ServerResponse.Header or (if a response was returned at all)
  1995. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1996. // check whether the returned error was because http.StatusNotModified
  1997. // was returned.
  1998. func (c *ProjectsLogsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  1999. gensupport.SetOptions(c.urlParams_, opts...)
  2000. res, err := c.doRequest("json")
  2001. if res != nil && res.StatusCode == http.StatusNotModified {
  2002. if res.Body != nil {
  2003. res.Body.Close()
  2004. }
  2005. return nil, &googleapi.Error{
  2006. Code: res.StatusCode,
  2007. Header: res.Header,
  2008. }
  2009. }
  2010. if err != nil {
  2011. return nil, err
  2012. }
  2013. defer googleapi.CloseBody(res)
  2014. if err := googleapi.CheckResponse(res); err != nil {
  2015. return nil, err
  2016. }
  2017. ret := &Empty{
  2018. ServerResponse: googleapi.ServerResponse{
  2019. Header: res.Header,
  2020. HTTPStatusCode: res.StatusCode,
  2021. },
  2022. }
  2023. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  2024. return nil, err
  2025. }
  2026. return ret, nil
  2027. // {
  2028. // "description": "Deletes a log and all its log entries. The log will reappear if it receives new entries.",
  2029. // "httpMethod": "DELETE",
  2030. // "id": "logging.projects.logs.delete",
  2031. // "parameterOrder": [
  2032. // "projectsId",
  2033. // "logsId"
  2034. // ],
  2035. // "parameters": {
  2036. // "logsId": {
  2037. // "description": "Part of `logName`. See documentation of `projectsId`.",
  2038. // "location": "path",
  2039. // "required": true,
  2040. // "type": "string"
  2041. // },
  2042. // "projectsId": {
  2043. // "description": "Part of `logName`. The resource name of the log to be deleted.",
  2044. // "location": "path",
  2045. // "required": true,
  2046. // "type": "string"
  2047. // }
  2048. // },
  2049. // "path": "v1beta3/projects/{projectsId}/logs/{logsId}",
  2050. // "response": {
  2051. // "$ref": "Empty"
  2052. // },
  2053. // "scopes": [
  2054. // "https://www.googleapis.com/auth/cloud-platform",
  2055. // "https://www.googleapis.com/auth/logging.admin"
  2056. // ]
  2057. // }
  2058. }
  2059. // method id "logging.projects.logs.list":
  2060. type ProjectsLogsListCall struct {
  2061. s *Service
  2062. projectsId string
  2063. urlParams_ gensupport.URLParams
  2064. ifNoneMatch_ string
  2065. ctx_ context.Context
  2066. }
  2067. // List: Lists the logs in the project. Only logs that have entries are
  2068. // listed.
  2069. func (r *ProjectsLogsService) List(projectsId string) *ProjectsLogsListCall {
  2070. c := &ProjectsLogsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2071. c.projectsId = projectsId
  2072. return c
  2073. }
  2074. // PageSize sets the optional parameter "pageSize": The maximum number
  2075. // of results to return.
  2076. func (c *ProjectsLogsListCall) PageSize(pageSize int64) *ProjectsLogsListCall {
  2077. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  2078. return c
  2079. }
  2080. // PageToken sets the optional parameter "pageToken": An opaque token,
  2081. // returned as `nextPageToken` by a prior `ListLogs` operation. If
  2082. // `pageToken` is supplied, then the other fields of this request are
  2083. // ignored, and instead the previous `ListLogs` operation is continued.
  2084. func (c *ProjectsLogsListCall) PageToken(pageToken string) *ProjectsLogsListCall {
  2085. c.urlParams_.Set("pageToken", pageToken)
  2086. return c
  2087. }
  2088. // ServiceIndexPrefix sets the optional parameter "serviceIndexPrefix":
  2089. // The purpose of this field is to restrict the listed logs to those
  2090. // with entries of a certain kind. If `serviceName` is the name of a log
  2091. // service, then this field may contain values for the log service's
  2092. // indexes. Only logs that have entries whose indexes include the values
  2093. // are listed. The format for this field is "/val1/val2.../valN",
  2094. // where `val1` is a value for the first index, `val2` for the second
  2095. // index, etc. An empty value (a single slash) for an index matches all
  2096. // values, and you can omit values for later indexes entirely.
  2097. func (c *ProjectsLogsListCall) ServiceIndexPrefix(serviceIndexPrefix string) *ProjectsLogsListCall {
  2098. c.urlParams_.Set("serviceIndexPrefix", serviceIndexPrefix)
  2099. return c
  2100. }
  2101. // ServiceName sets the optional parameter "serviceName": If not empty,
  2102. // this field must be a log service name such as
  2103. // "compute.googleapis.com". Only logs associated with that that log
  2104. // service are listed.
  2105. func (c *ProjectsLogsListCall) ServiceName(serviceName string) *ProjectsLogsListCall {
  2106. c.urlParams_.Set("serviceName", serviceName)
  2107. return c
  2108. }
  2109. // Fields allows partial responses to be retrieved. See
  2110. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2111. // for more information.
  2112. func (c *ProjectsLogsListCall) Fields(s ...googleapi.Field) *ProjectsLogsListCall {
  2113. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2114. return c
  2115. }
  2116. // IfNoneMatch sets the optional parameter which makes the operation
  2117. // fail if the object's ETag matches the given value. This is useful for
  2118. // getting updates only after the object has changed since the last
  2119. // request. Use googleapi.IsNotModified to check whether the response
  2120. // error from Do is the result of In-None-Match.
  2121. func (c *ProjectsLogsListCall) IfNoneMatch(entityTag string) *ProjectsLogsListCall {
  2122. c.ifNoneMatch_ = entityTag
  2123. return c
  2124. }
  2125. // Context sets the context to be used in this call's Do method. Any
  2126. // pending HTTP request will be aborted if the provided context is
  2127. // canceled.
  2128. func (c *ProjectsLogsListCall) Context(ctx context.Context) *ProjectsLogsListCall {
  2129. c.ctx_ = ctx
  2130. return c
  2131. }
  2132. func (c *ProjectsLogsListCall) doRequest(alt string) (*http.Response, error) {
  2133. var body io.Reader = nil
  2134. c.urlParams_.Set("alt", alt)
  2135. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta3/projects/{projectsId}/logs")
  2136. urls += "?" + c.urlParams_.Encode()
  2137. req, _ := http.NewRequest("GET", urls, body)
  2138. googleapi.Expand(req.URL, map[string]string{
  2139. "projectsId": c.projectsId,
  2140. })
  2141. req.Header.Set("User-Agent", c.s.userAgent())
  2142. if c.ifNoneMatch_ != "" {
  2143. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  2144. }
  2145. if c.ctx_ != nil {
  2146. return ctxhttp.Do(c.ctx_, c.s.client, req)
  2147. }
  2148. return c.s.client.Do(req)
  2149. }
  2150. // Do executes the "logging.projects.logs.list" call.
  2151. // Exactly one of *ListLogsResponse or error will be non-nil. Any
  2152. // non-2xx status code is an error. Response headers are in either
  2153. // *ListLogsResponse.ServerResponse.Header or (if a response was
  2154. // returned at all) in error.(*googleapi.Error).Header. Use
  2155. // googleapi.IsNotModified to check whether the returned error was
  2156. // because http.StatusNotModified was returned.
  2157. func (c *ProjectsLogsListCall) Do(opts ...googleapi.CallOption) (*ListLogsResponse, error) {
  2158. gensupport.SetOptions(c.urlParams_, opts...)
  2159. res, err := c.doRequest("json")
  2160. if res != nil && res.StatusCode == http.StatusNotModified {
  2161. if res.Body != nil {
  2162. res.Body.Close()
  2163. }
  2164. return nil, &googleapi.Error{
  2165. Code: res.StatusCode,
  2166. Header: res.Header,
  2167. }
  2168. }
  2169. if err != nil {
  2170. return nil, err
  2171. }
  2172. defer googleapi.CloseBody(res)
  2173. if err := googleapi.CheckResponse(res); err != nil {
  2174. return nil, err
  2175. }
  2176. ret := &ListLogsResponse{
  2177. ServerResponse: googleapi.ServerResponse{
  2178. Header: res.Header,
  2179. HTTPStatusCode: res.StatusCode,
  2180. },
  2181. }
  2182. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  2183. return nil, err
  2184. }
  2185. return ret, nil
  2186. // {
  2187. // "description": "Lists the logs in the project. Only logs that have entries are listed.",
  2188. // "httpMethod": "GET",
  2189. // "id": "logging.projects.logs.list",
  2190. // "parameterOrder": [
  2191. // "projectsId"
  2192. // ],
  2193. // "parameters": {
  2194. // "pageSize": {
  2195. // "description": "The maximum number of results to return.",
  2196. // "format": "int32",
  2197. // "location": "query",
  2198. // "type": "integer"
  2199. // },
  2200. // "pageToken": {
  2201. // "description": "An opaque token, returned as `nextPageToken` by a prior `ListLogs` operation. If `pageToken` is supplied, then the other fields of this request are ignored, and instead the previous `ListLogs` operation is continued.",
  2202. // "location": "query",
  2203. // "type": "string"
  2204. // },
  2205. // "projectsId": {
  2206. // "description": "Part of `projectName`. The resource name of the project whose logs are requested. If both `serviceName` and `serviceIndexPrefix` are empty, then all logs with entries in this project are listed.",
  2207. // "location": "path",
  2208. // "required": true,
  2209. // "type": "string"
  2210. // },
  2211. // "serviceIndexPrefix": {
  2212. // "description": "The purpose of this field is to restrict the listed logs to those with entries of a certain kind. If `serviceName` is the name of a log service, then this field may contain values for the log service's indexes. Only logs that have entries whose indexes include the values are listed. The format for this field is `\"/val1/val2.../valN\"`, where `val1` is a value for the first index, `val2` for the second index, etc. An empty value (a single slash) for an index matches all values, and you can omit values for later indexes entirely.",
  2213. // "location": "query",
  2214. // "type": "string"
  2215. // },
  2216. // "serviceName": {
  2217. // "description": "If not empty, this field must be a log service name such as `\"compute.googleapis.com\"`. Only logs associated with that that log service are listed.",
  2218. // "location": "query",
  2219. // "type": "string"
  2220. // }
  2221. // },
  2222. // "path": "v1beta3/projects/{projectsId}/logs",
  2223. // "response": {
  2224. // "$ref": "ListLogsResponse"
  2225. // },
  2226. // "scopes": [
  2227. // "https://www.googleapis.com/auth/cloud-platform",
  2228. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  2229. // "https://www.googleapis.com/auth/logging.admin",
  2230. // "https://www.googleapis.com/auth/logging.read"
  2231. // ]
  2232. // }
  2233. }
  2234. // Pages invokes f for each page of results.
  2235. // A non-nil error returned from f will halt the iteration.
  2236. // The provided context supersedes any context provided to the Context method.
  2237. func (c *ProjectsLogsListCall) Pages(ctx context.Context, f func(*ListLogsResponse) error) error {
  2238. c.ctx_ = ctx
  2239. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  2240. for {
  2241. x, err := c.Do()
  2242. if err != nil {
  2243. return err
  2244. }
  2245. if err := f(x); err != nil {
  2246. return err
  2247. }
  2248. if x.NextPageToken == "" {
  2249. return nil
  2250. }
  2251. c.PageToken(x.NextPageToken)
  2252. }
  2253. }
  2254. // method id "logging.projects.logs.entries.write":
  2255. type ProjectsLogsEntriesWriteCall struct {
  2256. s *Service
  2257. projectsId string
  2258. logsId string
  2259. writelogentriesrequest *WriteLogEntriesRequest
  2260. urlParams_ gensupport.URLParams
  2261. ctx_ context.Context
  2262. }
  2263. // Write: Writes log entries to Cloud Logging. Each entry consists of a
  2264. // `LogEntry` object. You must fill in all the fields of the object,
  2265. // including one of the payload fields. You may supply a map,
  2266. // `commonLabels`, that holds default (key, value) data for the
  2267. // `entries[].metadata.labels` map in each entry, saving you the trouble
  2268. // of creating identical copies for each entry.
  2269. func (r *ProjectsLogsEntriesService) Write(projectsId string, logsId string, writelogentriesrequest *WriteLogEntriesRequest) *ProjectsLogsEntriesWriteCall {
  2270. c := &ProjectsLogsEntriesWriteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2271. c.projectsId = projectsId
  2272. c.logsId = logsId
  2273. c.writelogentriesrequest = writelogentriesrequest
  2274. return c
  2275. }
  2276. // Fields allows partial responses to be retrieved. See
  2277. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2278. // for more information.
  2279. func (c *ProjectsLogsEntriesWriteCall) Fields(s ...googleapi.Field) *ProjectsLogsEntriesWriteCall {
  2280. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2281. return c
  2282. }
  2283. // Context sets the context to be used in this call's Do method. Any
  2284. // pending HTTP request will be aborted if the provided context is
  2285. // canceled.
  2286. func (c *ProjectsLogsEntriesWriteCall) Context(ctx context.Context) *ProjectsLogsEntriesWriteCall {
  2287. c.ctx_ = ctx
  2288. return c
  2289. }
  2290. func (c *ProjectsLogsEntriesWriteCall) doRequest(alt string) (*http.Response, error) {
  2291. var body io.Reader = nil
  2292. body, err := googleapi.WithoutDataWrapper.JSONReader(c.writelogentriesrequest)
  2293. if err != nil {
  2294. return nil, err
  2295. }
  2296. ctype := "application/json"
  2297. c.urlParams_.Set("alt", alt)
  2298. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta3/projects/{projectsId}/logs/{logsId}/entries:write")
  2299. urls += "?" + c.urlParams_.Encode()
  2300. req, _ := http.NewRequest("POST", urls, body)
  2301. googleapi.Expand(req.URL, map[string]string{
  2302. "projectsId": c.projectsId,
  2303. "logsId": c.logsId,
  2304. })
  2305. req.Header.Set("Content-Type", ctype)
  2306. req.Header.Set("User-Agent", c.s.userAgent())
  2307. if c.ctx_ != nil {
  2308. return ctxhttp.Do(c.ctx_, c.s.client, req)
  2309. }
  2310. return c.s.client.Do(req)
  2311. }
  2312. // Do executes the "logging.projects.logs.entries.write" call.
  2313. // Exactly one of *WriteLogEntriesResponse or error will be non-nil. Any
  2314. // non-2xx status code is an error. Response headers are in either
  2315. // *WriteLogEntriesResponse.ServerResponse.Header or (if a response was
  2316. // returned at all) in error.(*googleapi.Error).Header. Use
  2317. // googleapi.IsNotModified to check whether the returned error was
  2318. // because http.StatusNotModified was returned.
  2319. func (c *ProjectsLogsEntriesWriteCall) Do(opts ...googleapi.CallOption) (*WriteLogEntriesResponse, error) {
  2320. gensupport.SetOptions(c.urlParams_, opts...)
  2321. res, err := c.doRequest("json")
  2322. if res != nil && res.StatusCode == http.StatusNotModified {
  2323. if res.Body != nil {
  2324. res.Body.Close()
  2325. }
  2326. return nil, &googleapi.Error{
  2327. Code: res.StatusCode,
  2328. Header: res.Header,
  2329. }
  2330. }
  2331. if err != nil {
  2332. return nil, err
  2333. }
  2334. defer googleapi.CloseBody(res)
  2335. if err := googleapi.CheckResponse(res); err != nil {
  2336. return nil, err
  2337. }
  2338. ret := &WriteLogEntriesResponse{
  2339. ServerResponse: googleapi.ServerResponse{
  2340. Header: res.Header,
  2341. HTTPStatusCode: res.StatusCode,
  2342. },
  2343. }
  2344. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  2345. return nil, err
  2346. }
  2347. return ret, nil
  2348. // {
  2349. // "description": "Writes log entries to Cloud Logging. Each entry consists of a `LogEntry` object. You must fill in all the fields of the object, including one of the payload fields. You may supply a map, `commonLabels`, that holds default (key, value) data for the `entries[].metadata.labels` map in each entry, saving you the trouble of creating identical copies for each entry.",
  2350. // "httpMethod": "POST",
  2351. // "id": "logging.projects.logs.entries.write",
  2352. // "parameterOrder": [
  2353. // "projectsId",
  2354. // "logsId"
  2355. // ],
  2356. // "parameters": {
  2357. // "logsId": {
  2358. // "description": "Part of `logName`. See documentation of `projectsId`.",
  2359. // "location": "path",
  2360. // "required": true,
  2361. // "type": "string"
  2362. // },
  2363. // "projectsId": {
  2364. // "description": "Part of `logName`. The resource name of the log that will receive the log entries.",
  2365. // "location": "path",
  2366. // "required": true,
  2367. // "type": "string"
  2368. // }
  2369. // },
  2370. // "path": "v1beta3/projects/{projectsId}/logs/{logsId}/entries:write",
  2371. // "request": {
  2372. // "$ref": "WriteLogEntriesRequest"
  2373. // },
  2374. // "response": {
  2375. // "$ref": "WriteLogEntriesResponse"
  2376. // },
  2377. // "scopes": [
  2378. // "https://www.googleapis.com/auth/cloud-platform",
  2379. // "https://www.googleapis.com/auth/logging.admin",
  2380. // "https://www.googleapis.com/auth/logging.write"
  2381. // ]
  2382. // }
  2383. }
  2384. // method id "logging.projects.logs.sinks.create":
  2385. type ProjectsLogsSinksCreateCall struct {
  2386. s *Service
  2387. projectsId string
  2388. logsId string
  2389. logsink *LogSink
  2390. urlParams_ gensupport.URLParams
  2391. ctx_ context.Context
  2392. }
  2393. // Create: Creates a log sink. All log entries for a specified log are
  2394. // written to the destination.
  2395. func (r *ProjectsLogsSinksService) Create(projectsId string, logsId string, logsink *LogSink) *ProjectsLogsSinksCreateCall {
  2396. c := &ProjectsLogsSinksCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2397. c.projectsId = projectsId
  2398. c.logsId = logsId
  2399. c.logsink = logsink
  2400. return c
  2401. }
  2402. // Fields allows partial responses to be retrieved. See
  2403. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2404. // for more information.
  2405. func (c *ProjectsLogsSinksCreateCall) Fields(s ...googleapi.Field) *ProjectsLogsSinksCreateCall {
  2406. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2407. return c
  2408. }
  2409. // Context sets the context to be used in this call's Do method. Any
  2410. // pending HTTP request will be aborted if the provided context is
  2411. // canceled.
  2412. func (c *ProjectsLogsSinksCreateCall) Context(ctx context.Context) *ProjectsLogsSinksCreateCall {
  2413. c.ctx_ = ctx
  2414. return c
  2415. }
  2416. func (c *ProjectsLogsSinksCreateCall) doRequest(alt string) (*http.Response, error) {
  2417. var body io.Reader = nil
  2418. body, err := googleapi.WithoutDataWrapper.JSONReader(c.logsink)
  2419. if err != nil {
  2420. return nil, err
  2421. }
  2422. ctype := "application/json"
  2423. c.urlParams_.Set("alt", alt)
  2424. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta3/projects/{projectsId}/logs/{logsId}/sinks")
  2425. urls += "?" + c.urlParams_.Encode()
  2426. req, _ := http.NewRequest("POST", urls, body)
  2427. googleapi.Expand(req.URL, map[string]string{
  2428. "projectsId": c.projectsId,
  2429. "logsId": c.logsId,
  2430. })
  2431. req.Header.Set("Content-Type", ctype)
  2432. req.Header.Set("User-Agent", c.s.userAgent())
  2433. if c.ctx_ != nil {
  2434. return ctxhttp.Do(c.ctx_, c.s.client, req)
  2435. }
  2436. return c.s.client.Do(req)
  2437. }
  2438. // Do executes the "logging.projects.logs.sinks.create" call.
  2439. // Exactly one of *LogSink or error will be non-nil. Any non-2xx status
  2440. // code is an error. Response headers are in either
  2441. // *LogSink.ServerResponse.Header or (if a response was returned at all)
  2442. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2443. // check whether the returned error was because http.StatusNotModified
  2444. // was returned.
  2445. func (c *ProjectsLogsSinksCreateCall) Do(opts ...googleapi.CallOption) (*LogSink, error) {
  2446. gensupport.SetOptions(c.urlParams_, opts...)
  2447. res, err := c.doRequest("json")
  2448. if res != nil && res.StatusCode == http.StatusNotModified {
  2449. if res.Body != nil {
  2450. res.Body.Close()
  2451. }
  2452. return nil, &googleapi.Error{
  2453. Code: res.StatusCode,
  2454. Header: res.Header,
  2455. }
  2456. }
  2457. if err != nil {
  2458. return nil, err
  2459. }
  2460. defer googleapi.CloseBody(res)
  2461. if err := googleapi.CheckResponse(res); err != nil {
  2462. return nil, err
  2463. }
  2464. ret := &LogSink{
  2465. ServerResponse: googleapi.ServerResponse{
  2466. Header: res.Header,
  2467. HTTPStatusCode: res.StatusCode,
  2468. },
  2469. }
  2470. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  2471. return nil, err
  2472. }
  2473. return ret, nil
  2474. // {
  2475. // "description": "Creates a log sink. All log entries for a specified log are written to the destination.",
  2476. // "httpMethod": "POST",
  2477. // "id": "logging.projects.logs.sinks.create",
  2478. // "parameterOrder": [
  2479. // "projectsId",
  2480. // "logsId"
  2481. // ],
  2482. // "parameters": {
  2483. // "logsId": {
  2484. // "description": "Part of `logName`. See documentation of `projectsId`.",
  2485. // "location": "path",
  2486. // "required": true,
  2487. // "type": "string"
  2488. // },
  2489. // "projectsId": {
  2490. // "description": "Part of `logName`. The resource name of the log to which to the sink is bound.",
  2491. // "location": "path",
  2492. // "required": true,
  2493. // "type": "string"
  2494. // }
  2495. // },
  2496. // "path": "v1beta3/projects/{projectsId}/logs/{logsId}/sinks",
  2497. // "request": {
  2498. // "$ref": "LogSink"
  2499. // },
  2500. // "response": {
  2501. // "$ref": "LogSink"
  2502. // },
  2503. // "scopes": [
  2504. // "https://www.googleapis.com/auth/cloud-platform",
  2505. // "https://www.googleapis.com/auth/logging.admin"
  2506. // ]
  2507. // }
  2508. }
  2509. // method id "logging.projects.logs.sinks.delete":
  2510. type ProjectsLogsSinksDeleteCall struct {
  2511. s *Service
  2512. projectsId string
  2513. logsId string
  2514. sinksId string
  2515. urlParams_ gensupport.URLParams
  2516. ctx_ context.Context
  2517. }
  2518. // Delete: Deletes a log sink. After deletion, no new log entries are
  2519. // written to the destination.
  2520. func (r *ProjectsLogsSinksService) Delete(projectsId string, logsId string, sinksId string) *ProjectsLogsSinksDeleteCall {
  2521. c := &ProjectsLogsSinksDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2522. c.projectsId = projectsId
  2523. c.logsId = logsId
  2524. c.sinksId = sinksId
  2525. return c
  2526. }
  2527. // Fields allows partial responses to be retrieved. See
  2528. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2529. // for more information.
  2530. func (c *ProjectsLogsSinksDeleteCall) Fields(s ...googleapi.Field) *ProjectsLogsSinksDeleteCall {
  2531. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2532. return c
  2533. }
  2534. // Context sets the context to be used in this call's Do method. Any
  2535. // pending HTTP request will be aborted if the provided context is
  2536. // canceled.
  2537. func (c *ProjectsLogsSinksDeleteCall) Context(ctx context.Context) *ProjectsLogsSinksDeleteCall {
  2538. c.ctx_ = ctx
  2539. return c
  2540. }
  2541. func (c *ProjectsLogsSinksDeleteCall) doRequest(alt string) (*http.Response, error) {
  2542. var body io.Reader = nil
  2543. c.urlParams_.Set("alt", alt)
  2544. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta3/projects/{projectsId}/logs/{logsId}/sinks/{sinksId}")
  2545. urls += "?" + c.urlParams_.Encode()
  2546. req, _ := http.NewRequest("DELETE", urls, body)
  2547. googleapi.Expand(req.URL, map[string]string{
  2548. "projectsId": c.projectsId,
  2549. "logsId": c.logsId,
  2550. "sinksId": c.sinksId,
  2551. })
  2552. req.Header.Set("User-Agent", c.s.userAgent())
  2553. if c.ctx_ != nil {
  2554. return ctxhttp.Do(c.ctx_, c.s.client, req)
  2555. }
  2556. return c.s.client.Do(req)
  2557. }
  2558. // Do executes the "logging.projects.logs.sinks.delete" call.
  2559. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  2560. // code is an error. Response headers are in either
  2561. // *Empty.ServerResponse.Header or (if a response was returned at all)
  2562. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2563. // check whether the returned error was because http.StatusNotModified
  2564. // was returned.
  2565. func (c *ProjectsLogsSinksDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  2566. gensupport.SetOptions(c.urlParams_, opts...)
  2567. res, err := c.doRequest("json")
  2568. if res != nil && res.StatusCode == http.StatusNotModified {
  2569. if res.Body != nil {
  2570. res.Body.Close()
  2571. }
  2572. return nil, &googleapi.Error{
  2573. Code: res.StatusCode,
  2574. Header: res.Header,
  2575. }
  2576. }
  2577. if err != nil {
  2578. return nil, err
  2579. }
  2580. defer googleapi.CloseBody(res)
  2581. if err := googleapi.CheckResponse(res); err != nil {
  2582. return nil, err
  2583. }
  2584. ret := &Empty{
  2585. ServerResponse: googleapi.ServerResponse{
  2586. Header: res.Header,
  2587. HTTPStatusCode: res.StatusCode,
  2588. },
  2589. }
  2590. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  2591. return nil, err
  2592. }
  2593. return ret, nil
  2594. // {
  2595. // "description": "Deletes a log sink. After deletion, no new log entries are written to the destination.",
  2596. // "httpMethod": "DELETE",
  2597. // "id": "logging.projects.logs.sinks.delete",
  2598. // "parameterOrder": [
  2599. // "projectsId",
  2600. // "logsId",
  2601. // "sinksId"
  2602. // ],
  2603. // "parameters": {
  2604. // "logsId": {
  2605. // "description": "Part of `sinkName`. See documentation of `projectsId`.",
  2606. // "location": "path",
  2607. // "required": true,
  2608. // "type": "string"
  2609. // },
  2610. // "projectsId": {
  2611. // "description": "Part of `sinkName`. The resource name of the log sink to delete.",
  2612. // "location": "path",
  2613. // "required": true,
  2614. // "type": "string"
  2615. // },
  2616. // "sinksId": {
  2617. // "description": "Part of `sinkName`. See documentation of `projectsId`.",
  2618. // "location": "path",
  2619. // "required": true,
  2620. // "type": "string"
  2621. // }
  2622. // },
  2623. // "path": "v1beta3/projects/{projectsId}/logs/{logsId}/sinks/{sinksId}",
  2624. // "response": {
  2625. // "$ref": "Empty"
  2626. // },
  2627. // "scopes": [
  2628. // "https://www.googleapis.com/auth/cloud-platform",
  2629. // "https://www.googleapis.com/auth/logging.admin"
  2630. // ]
  2631. // }
  2632. }
  2633. // method id "logging.projects.logs.sinks.get":
  2634. type ProjectsLogsSinksGetCall struct {
  2635. s *Service
  2636. projectsId string
  2637. logsId string
  2638. sinksId string
  2639. urlParams_ gensupport.URLParams
  2640. ifNoneMatch_ string
  2641. ctx_ context.Context
  2642. }
  2643. // Get: Gets a log sink.
  2644. func (r *ProjectsLogsSinksService) Get(projectsId string, logsId string, sinksId string) *ProjectsLogsSinksGetCall {
  2645. c := &ProjectsLogsSinksGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2646. c.projectsId = projectsId
  2647. c.logsId = logsId
  2648. c.sinksId = sinksId
  2649. return c
  2650. }
  2651. // Fields allows partial responses to be retrieved. See
  2652. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2653. // for more information.
  2654. func (c *ProjectsLogsSinksGetCall) Fields(s ...googleapi.Field) *ProjectsLogsSinksGetCall {
  2655. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2656. return c
  2657. }
  2658. // IfNoneMatch sets the optional parameter which makes the operation
  2659. // fail if the object's ETag matches the given value. This is useful for
  2660. // getting updates only after the object has changed since the last
  2661. // request. Use googleapi.IsNotModified to check whether the response
  2662. // error from Do is the result of In-None-Match.
  2663. func (c *ProjectsLogsSinksGetCall) IfNoneMatch(entityTag string) *ProjectsLogsSinksGetCall {
  2664. c.ifNoneMatch_ = entityTag
  2665. return c
  2666. }
  2667. // Context sets the context to be used in this call's Do method. Any
  2668. // pending HTTP request will be aborted if the provided context is
  2669. // canceled.
  2670. func (c *ProjectsLogsSinksGetCall) Context(ctx context.Context) *ProjectsLogsSinksGetCall {
  2671. c.ctx_ = ctx
  2672. return c
  2673. }
  2674. func (c *ProjectsLogsSinksGetCall) doRequest(alt string) (*http.Response, error) {
  2675. var body io.Reader = nil
  2676. c.urlParams_.Set("alt", alt)
  2677. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta3/projects/{projectsId}/logs/{logsId}/sinks/{sinksId}")
  2678. urls += "?" + c.urlParams_.Encode()
  2679. req, _ := http.NewRequest("GET", urls, body)
  2680. googleapi.Expand(req.URL, map[string]string{
  2681. "projectsId": c.projectsId,
  2682. "logsId": c.logsId,
  2683. "sinksId": c.sinksId,
  2684. })
  2685. req.Header.Set("User-Agent", c.s.userAgent())
  2686. if c.ifNoneMatch_ != "" {
  2687. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  2688. }
  2689. if c.ctx_ != nil {
  2690. return ctxhttp.Do(c.ctx_, c.s.client, req)
  2691. }
  2692. return c.s.client.Do(req)
  2693. }
  2694. // Do executes the "logging.projects.logs.sinks.get" call.
  2695. // Exactly one of *LogSink or error will be non-nil. Any non-2xx status
  2696. // code is an error. Response headers are in either
  2697. // *LogSink.ServerResponse.Header or (if a response was returned at all)
  2698. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2699. // check whether the returned error was because http.StatusNotModified
  2700. // was returned.
  2701. func (c *ProjectsLogsSinksGetCall) Do(opts ...googleapi.CallOption) (*LogSink, error) {
  2702. gensupport.SetOptions(c.urlParams_, opts...)
  2703. res, err := c.doRequest("json")
  2704. if res != nil && res.StatusCode == http.StatusNotModified {
  2705. if res.Body != nil {
  2706. res.Body.Close()
  2707. }
  2708. return nil, &googleapi.Error{
  2709. Code: res.StatusCode,
  2710. Header: res.Header,
  2711. }
  2712. }
  2713. if err != nil {
  2714. return nil, err
  2715. }
  2716. defer googleapi.CloseBody(res)
  2717. if err := googleapi.CheckResponse(res); err != nil {
  2718. return nil, err
  2719. }
  2720. ret := &LogSink{
  2721. ServerResponse: googleapi.ServerResponse{
  2722. Header: res.Header,
  2723. HTTPStatusCode: res.StatusCode,
  2724. },
  2725. }
  2726. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  2727. return nil, err
  2728. }
  2729. return ret, nil
  2730. // {
  2731. // "description": "Gets a log sink.",
  2732. // "httpMethod": "GET",
  2733. // "id": "logging.projects.logs.sinks.get",
  2734. // "parameterOrder": [
  2735. // "projectsId",
  2736. // "logsId",
  2737. // "sinksId"
  2738. // ],
  2739. // "parameters": {
  2740. // "logsId": {
  2741. // "description": "Part of `sinkName`. See documentation of `projectsId`.",
  2742. // "location": "path",
  2743. // "required": true,
  2744. // "type": "string"
  2745. // },
  2746. // "projectsId": {
  2747. // "description": "Part of `sinkName`. The resource name of the log sink to return.",
  2748. // "location": "path",
  2749. // "required": true,
  2750. // "type": "string"
  2751. // },
  2752. // "sinksId": {
  2753. // "description": "Part of `sinkName`. See documentation of `projectsId`.",
  2754. // "location": "path",
  2755. // "required": true,
  2756. // "type": "string"
  2757. // }
  2758. // },
  2759. // "path": "v1beta3/projects/{projectsId}/logs/{logsId}/sinks/{sinksId}",
  2760. // "response": {
  2761. // "$ref": "LogSink"
  2762. // },
  2763. // "scopes": [
  2764. // "https://www.googleapis.com/auth/cloud-platform",
  2765. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  2766. // "https://www.googleapis.com/auth/logging.admin",
  2767. // "https://www.googleapis.com/auth/logging.read"
  2768. // ]
  2769. // }
  2770. }
  2771. // method id "logging.projects.logs.sinks.list":
  2772. type ProjectsLogsSinksListCall struct {
  2773. s *Service
  2774. projectsId string
  2775. logsId string
  2776. urlParams_ gensupport.URLParams
  2777. ifNoneMatch_ string
  2778. ctx_ context.Context
  2779. }
  2780. // List: Lists log sinks associated with a log.
  2781. func (r *ProjectsLogsSinksService) List(projectsId string, logsId string) *ProjectsLogsSinksListCall {
  2782. c := &ProjectsLogsSinksListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2783. c.projectsId = projectsId
  2784. c.logsId = logsId
  2785. return c
  2786. }
  2787. // Fields allows partial responses to be retrieved. See
  2788. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2789. // for more information.
  2790. func (c *ProjectsLogsSinksListCall) Fields(s ...googleapi.Field) *ProjectsLogsSinksListCall {
  2791. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2792. return c
  2793. }
  2794. // IfNoneMatch sets the optional parameter which makes the operation
  2795. // fail if the object's ETag matches the given value. This is useful for
  2796. // getting updates only after the object has changed since the last
  2797. // request. Use googleapi.IsNotModified to check whether the response
  2798. // error from Do is the result of In-None-Match.
  2799. func (c *ProjectsLogsSinksListCall) IfNoneMatch(entityTag string) *ProjectsLogsSinksListCall {
  2800. c.ifNoneMatch_ = entityTag
  2801. return c
  2802. }
  2803. // Context sets the context to be used in this call's Do method. Any
  2804. // pending HTTP request will be aborted if the provided context is
  2805. // canceled.
  2806. func (c *ProjectsLogsSinksListCall) Context(ctx context.Context) *ProjectsLogsSinksListCall {
  2807. c.ctx_ = ctx
  2808. return c
  2809. }
  2810. func (c *ProjectsLogsSinksListCall) doRequest(alt string) (*http.Response, error) {
  2811. var body io.Reader = nil
  2812. c.urlParams_.Set("alt", alt)
  2813. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta3/projects/{projectsId}/logs/{logsId}/sinks")
  2814. urls += "?" + c.urlParams_.Encode()
  2815. req, _ := http.NewRequest("GET", urls, body)
  2816. googleapi.Expand(req.URL, map[string]string{
  2817. "projectsId": c.projectsId,
  2818. "logsId": c.logsId,
  2819. })
  2820. req.Header.Set("User-Agent", c.s.userAgent())
  2821. if c.ifNoneMatch_ != "" {
  2822. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  2823. }
  2824. if c.ctx_ != nil {
  2825. return ctxhttp.Do(c.ctx_, c.s.client, req)
  2826. }
  2827. return c.s.client.Do(req)
  2828. }
  2829. // Do executes the "logging.projects.logs.sinks.list" call.
  2830. // Exactly one of *ListLogSinksResponse or error will be non-nil. Any
  2831. // non-2xx status code is an error. Response headers are in either
  2832. // *ListLogSinksResponse.ServerResponse.Header or (if a response was
  2833. // returned at all) in error.(*googleapi.Error).Header. Use
  2834. // googleapi.IsNotModified to check whether the returned error was
  2835. // because http.StatusNotModified was returned.
  2836. func (c *ProjectsLogsSinksListCall) Do(opts ...googleapi.CallOption) (*ListLogSinksResponse, error) {
  2837. gensupport.SetOptions(c.urlParams_, opts...)
  2838. res, err := c.doRequest("json")
  2839. if res != nil && res.StatusCode == http.StatusNotModified {
  2840. if res.Body != nil {
  2841. res.Body.Close()
  2842. }
  2843. return nil, &googleapi.Error{
  2844. Code: res.StatusCode,
  2845. Header: res.Header,
  2846. }
  2847. }
  2848. if err != nil {
  2849. return nil, err
  2850. }
  2851. defer googleapi.CloseBody(res)
  2852. if err := googleapi.CheckResponse(res); err != nil {
  2853. return nil, err
  2854. }
  2855. ret := &ListLogSinksResponse{
  2856. ServerResponse: googleapi.ServerResponse{
  2857. Header: res.Header,
  2858. HTTPStatusCode: res.StatusCode,
  2859. },
  2860. }
  2861. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  2862. return nil, err
  2863. }
  2864. return ret, nil
  2865. // {
  2866. // "description": "Lists log sinks associated with a log.",
  2867. // "httpMethod": "GET",
  2868. // "id": "logging.projects.logs.sinks.list",
  2869. // "parameterOrder": [
  2870. // "projectsId",
  2871. // "logsId"
  2872. // ],
  2873. // "parameters": {
  2874. // "logsId": {
  2875. // "description": "Part of `logName`. See documentation of `projectsId`.",
  2876. // "location": "path",
  2877. // "required": true,
  2878. // "type": "string"
  2879. // },
  2880. // "projectsId": {
  2881. // "description": "Part of `logName`. The log whose sinks are wanted. For example, `\"compute.google.com/syslog\"`.",
  2882. // "location": "path",
  2883. // "required": true,
  2884. // "type": "string"
  2885. // }
  2886. // },
  2887. // "path": "v1beta3/projects/{projectsId}/logs/{logsId}/sinks",
  2888. // "response": {
  2889. // "$ref": "ListLogSinksResponse"
  2890. // },
  2891. // "scopes": [
  2892. // "https://www.googleapis.com/auth/cloud-platform",
  2893. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  2894. // "https://www.googleapis.com/auth/logging.admin",
  2895. // "https://www.googleapis.com/auth/logging.read"
  2896. // ]
  2897. // }
  2898. }
  2899. // method id "logging.projects.logs.sinks.update":
  2900. type ProjectsLogsSinksUpdateCall struct {
  2901. s *Service
  2902. projectsId string
  2903. logsId string
  2904. sinksId string
  2905. logsink *LogSink
  2906. urlParams_ gensupport.URLParams
  2907. ctx_ context.Context
  2908. }
  2909. // Update: Updates a log sink. If the sink does not exist, it is
  2910. // created.
  2911. func (r *ProjectsLogsSinksService) Update(projectsId string, logsId string, sinksId string, logsink *LogSink) *ProjectsLogsSinksUpdateCall {
  2912. c := &ProjectsLogsSinksUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2913. c.projectsId = projectsId
  2914. c.logsId = logsId
  2915. c.sinksId = sinksId
  2916. c.logsink = logsink
  2917. return c
  2918. }
  2919. // Fields allows partial responses to be retrieved. See
  2920. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2921. // for more information.
  2922. func (c *ProjectsLogsSinksUpdateCall) Fields(s ...googleapi.Field) *ProjectsLogsSinksUpdateCall {
  2923. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2924. return c
  2925. }
  2926. // Context sets the context to be used in this call's Do method. Any
  2927. // pending HTTP request will be aborted if the provided context is
  2928. // canceled.
  2929. func (c *ProjectsLogsSinksUpdateCall) Context(ctx context.Context) *ProjectsLogsSinksUpdateCall {
  2930. c.ctx_ = ctx
  2931. return c
  2932. }
  2933. func (c *ProjectsLogsSinksUpdateCall) doRequest(alt string) (*http.Response, error) {
  2934. var body io.Reader = nil
  2935. body, err := googleapi.WithoutDataWrapper.JSONReader(c.logsink)
  2936. if err != nil {
  2937. return nil, err
  2938. }
  2939. ctype := "application/json"
  2940. c.urlParams_.Set("alt", alt)
  2941. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta3/projects/{projectsId}/logs/{logsId}/sinks/{sinksId}")
  2942. urls += "?" + c.urlParams_.Encode()
  2943. req, _ := http.NewRequest("PUT", urls, body)
  2944. googleapi.Expand(req.URL, map[string]string{
  2945. "projectsId": c.projectsId,
  2946. "logsId": c.logsId,
  2947. "sinksId": c.sinksId,
  2948. })
  2949. req.Header.Set("Content-Type", ctype)
  2950. req.Header.Set("User-Agent", c.s.userAgent())
  2951. if c.ctx_ != nil {
  2952. return ctxhttp.Do(c.ctx_, c.s.client, req)
  2953. }
  2954. return c.s.client.Do(req)
  2955. }
  2956. // Do executes the "logging.projects.logs.sinks.update" call.
  2957. // Exactly one of *LogSink or error will be non-nil. Any non-2xx status
  2958. // code is an error. Response headers are in either
  2959. // *LogSink.ServerResponse.Header or (if a response was returned at all)
  2960. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2961. // check whether the returned error was because http.StatusNotModified
  2962. // was returned.
  2963. func (c *ProjectsLogsSinksUpdateCall) Do(opts ...googleapi.CallOption) (*LogSink, error) {
  2964. gensupport.SetOptions(c.urlParams_, opts...)
  2965. res, err := c.doRequest("json")
  2966. if res != nil && res.StatusCode == http.StatusNotModified {
  2967. if res.Body != nil {
  2968. res.Body.Close()
  2969. }
  2970. return nil, &googleapi.Error{
  2971. Code: res.StatusCode,
  2972. Header: res.Header,
  2973. }
  2974. }
  2975. if err != nil {
  2976. return nil, err
  2977. }
  2978. defer googleapi.CloseBody(res)
  2979. if err := googleapi.CheckResponse(res); err != nil {
  2980. return nil, err
  2981. }
  2982. ret := &LogSink{
  2983. ServerResponse: googleapi.ServerResponse{
  2984. Header: res.Header,
  2985. HTTPStatusCode: res.StatusCode,
  2986. },
  2987. }
  2988. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  2989. return nil, err
  2990. }
  2991. return ret, nil
  2992. // {
  2993. // "description": "Updates a log sink. If the sink does not exist, it is created.",
  2994. // "httpMethod": "PUT",
  2995. // "id": "logging.projects.logs.sinks.update",
  2996. // "parameterOrder": [
  2997. // "projectsId",
  2998. // "logsId",
  2999. // "sinksId"
  3000. // ],
  3001. // "parameters": {
  3002. // "logsId": {
  3003. // "description": "Part of `sinkName`. See documentation of `projectsId`.",
  3004. // "location": "path",
  3005. // "required": true,
  3006. // "type": "string"
  3007. // },
  3008. // "projectsId": {
  3009. // "description": "Part of `sinkName`. The resource name of the sink to update.",
  3010. // "location": "path",
  3011. // "required": true,
  3012. // "type": "string"
  3013. // },
  3014. // "sinksId": {
  3015. // "description": "Part of `sinkName`. See documentation of `projectsId`.",
  3016. // "location": "path",
  3017. // "required": true,
  3018. // "type": "string"
  3019. // }
  3020. // },
  3021. // "path": "v1beta3/projects/{projectsId}/logs/{logsId}/sinks/{sinksId}",
  3022. // "request": {
  3023. // "$ref": "LogSink"
  3024. // },
  3025. // "response": {
  3026. // "$ref": "LogSink"
  3027. // },
  3028. // "scopes": [
  3029. // "https://www.googleapis.com/auth/cloud-platform",
  3030. // "https://www.googleapis.com/auth/logging.admin"
  3031. // ]
  3032. // }
  3033. }
  3034. // method id "logging.projects.metrics.create":
  3035. type ProjectsMetricsCreateCall struct {
  3036. s *Service
  3037. projectsId string
  3038. logmetric *LogMetric
  3039. urlParams_ gensupport.URLParams
  3040. ctx_ context.Context
  3041. }
  3042. // Create: Creates a logs-based metric.
  3043. func (r *ProjectsMetricsService) Create(projectsId string, logmetric *LogMetric) *ProjectsMetricsCreateCall {
  3044. c := &ProjectsMetricsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3045. c.projectsId = projectsId
  3046. c.logmetric = logmetric
  3047. return c
  3048. }
  3049. // Fields allows partial responses to be retrieved. See
  3050. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3051. // for more information.
  3052. func (c *ProjectsMetricsCreateCall) Fields(s ...googleapi.Field) *ProjectsMetricsCreateCall {
  3053. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3054. return c
  3055. }
  3056. // Context sets the context to be used in this call's Do method. Any
  3057. // pending HTTP request will be aborted if the provided context is
  3058. // canceled.
  3059. func (c *ProjectsMetricsCreateCall) Context(ctx context.Context) *ProjectsMetricsCreateCall {
  3060. c.ctx_ = ctx
  3061. return c
  3062. }
  3063. func (c *ProjectsMetricsCreateCall) doRequest(alt string) (*http.Response, error) {
  3064. var body io.Reader = nil
  3065. body, err := googleapi.WithoutDataWrapper.JSONReader(c.logmetric)
  3066. if err != nil {
  3067. return nil, err
  3068. }
  3069. ctype := "application/json"
  3070. c.urlParams_.Set("alt", alt)
  3071. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta3/projects/{projectsId}/metrics")
  3072. urls += "?" + c.urlParams_.Encode()
  3073. req, _ := http.NewRequest("POST", urls, body)
  3074. googleapi.Expand(req.URL, map[string]string{
  3075. "projectsId": c.projectsId,
  3076. })
  3077. req.Header.Set("Content-Type", ctype)
  3078. req.Header.Set("User-Agent", c.s.userAgent())
  3079. if c.ctx_ != nil {
  3080. return ctxhttp.Do(c.ctx_, c.s.client, req)
  3081. }
  3082. return c.s.client.Do(req)
  3083. }
  3084. // Do executes the "logging.projects.metrics.create" call.
  3085. // Exactly one of *LogMetric or error will be non-nil. Any non-2xx
  3086. // status code is an error. Response headers are in either
  3087. // *LogMetric.ServerResponse.Header or (if a response was returned at
  3088. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  3089. // to check whether the returned error was because
  3090. // http.StatusNotModified was returned.
  3091. func (c *ProjectsMetricsCreateCall) Do(opts ...googleapi.CallOption) (*LogMetric, error) {
  3092. gensupport.SetOptions(c.urlParams_, opts...)
  3093. res, err := c.doRequest("json")
  3094. if res != nil && res.StatusCode == http.StatusNotModified {
  3095. if res.Body != nil {
  3096. res.Body.Close()
  3097. }
  3098. return nil, &googleapi.Error{
  3099. Code: res.StatusCode,
  3100. Header: res.Header,
  3101. }
  3102. }
  3103. if err != nil {
  3104. return nil, err
  3105. }
  3106. defer googleapi.CloseBody(res)
  3107. if err := googleapi.CheckResponse(res); err != nil {
  3108. return nil, err
  3109. }
  3110. ret := &LogMetric{
  3111. ServerResponse: googleapi.ServerResponse{
  3112. Header: res.Header,
  3113. HTTPStatusCode: res.StatusCode,
  3114. },
  3115. }
  3116. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  3117. return nil, err
  3118. }
  3119. return ret, nil
  3120. // {
  3121. // "description": "Creates a logs-based metric.",
  3122. // "httpMethod": "POST",
  3123. // "id": "logging.projects.metrics.create",
  3124. // "parameterOrder": [
  3125. // "projectsId"
  3126. // ],
  3127. // "parameters": {
  3128. // "projectsId": {
  3129. // "description": "Part of `projectName`. The resource name of the project in which to create the metric.",
  3130. // "location": "path",
  3131. // "required": true,
  3132. // "type": "string"
  3133. // }
  3134. // },
  3135. // "path": "v1beta3/projects/{projectsId}/metrics",
  3136. // "request": {
  3137. // "$ref": "LogMetric"
  3138. // },
  3139. // "response": {
  3140. // "$ref": "LogMetric"
  3141. // },
  3142. // "scopes": [
  3143. // "https://www.googleapis.com/auth/cloud-platform",
  3144. // "https://www.googleapis.com/auth/logging.admin",
  3145. // "https://www.googleapis.com/auth/logging.write"
  3146. // ]
  3147. // }
  3148. }
  3149. // method id "logging.projects.metrics.delete":
  3150. type ProjectsMetricsDeleteCall struct {
  3151. s *Service
  3152. projectsId string
  3153. metricsId string
  3154. urlParams_ gensupport.URLParams
  3155. ctx_ context.Context
  3156. }
  3157. // Delete: Deletes a logs-based metric.
  3158. func (r *ProjectsMetricsService) Delete(projectsId string, metricsId string) *ProjectsMetricsDeleteCall {
  3159. c := &ProjectsMetricsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3160. c.projectsId = projectsId
  3161. c.metricsId = metricsId
  3162. return c
  3163. }
  3164. // Fields allows partial responses to be retrieved. See
  3165. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3166. // for more information.
  3167. func (c *ProjectsMetricsDeleteCall) Fields(s ...googleapi.Field) *ProjectsMetricsDeleteCall {
  3168. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3169. return c
  3170. }
  3171. // Context sets the context to be used in this call's Do method. Any
  3172. // pending HTTP request will be aborted if the provided context is
  3173. // canceled.
  3174. func (c *ProjectsMetricsDeleteCall) Context(ctx context.Context) *ProjectsMetricsDeleteCall {
  3175. c.ctx_ = ctx
  3176. return c
  3177. }
  3178. func (c *ProjectsMetricsDeleteCall) doRequest(alt string) (*http.Response, error) {
  3179. var body io.Reader = nil
  3180. c.urlParams_.Set("alt", alt)
  3181. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta3/projects/{projectsId}/metrics/{metricsId}")
  3182. urls += "?" + c.urlParams_.Encode()
  3183. req, _ := http.NewRequest("DELETE", urls, body)
  3184. googleapi.Expand(req.URL, map[string]string{
  3185. "projectsId": c.projectsId,
  3186. "metricsId": c.metricsId,
  3187. })
  3188. req.Header.Set("User-Agent", c.s.userAgent())
  3189. if c.ctx_ != nil {
  3190. return ctxhttp.Do(c.ctx_, c.s.client, req)
  3191. }
  3192. return c.s.client.Do(req)
  3193. }
  3194. // Do executes the "logging.projects.metrics.delete" call.
  3195. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  3196. // code is an error. Response headers are in either
  3197. // *Empty.ServerResponse.Header or (if a response was returned at all)
  3198. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3199. // check whether the returned error was because http.StatusNotModified
  3200. // was returned.
  3201. func (c *ProjectsMetricsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  3202. gensupport.SetOptions(c.urlParams_, opts...)
  3203. res, err := c.doRequest("json")
  3204. if res != nil && res.StatusCode == http.StatusNotModified {
  3205. if res.Body != nil {
  3206. res.Body.Close()
  3207. }
  3208. return nil, &googleapi.Error{
  3209. Code: res.StatusCode,
  3210. Header: res.Header,
  3211. }
  3212. }
  3213. if err != nil {
  3214. return nil, err
  3215. }
  3216. defer googleapi.CloseBody(res)
  3217. if err := googleapi.CheckResponse(res); err != nil {
  3218. return nil, err
  3219. }
  3220. ret := &Empty{
  3221. ServerResponse: googleapi.ServerResponse{
  3222. Header: res.Header,
  3223. HTTPStatusCode: res.StatusCode,
  3224. },
  3225. }
  3226. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  3227. return nil, err
  3228. }
  3229. return ret, nil
  3230. // {
  3231. // "description": "Deletes a logs-based metric.",
  3232. // "httpMethod": "DELETE",
  3233. // "id": "logging.projects.metrics.delete",
  3234. // "parameterOrder": [
  3235. // "projectsId",
  3236. // "metricsId"
  3237. // ],
  3238. // "parameters": {
  3239. // "metricsId": {
  3240. // "description": "Part of `metricName`. See documentation of `projectsId`.",
  3241. // "location": "path",
  3242. // "required": true,
  3243. // "type": "string"
  3244. // },
  3245. // "projectsId": {
  3246. // "description": "Part of `metricName`. The resource name of the metric to delete.",
  3247. // "location": "path",
  3248. // "required": true,
  3249. // "type": "string"
  3250. // }
  3251. // },
  3252. // "path": "v1beta3/projects/{projectsId}/metrics/{metricsId}",
  3253. // "response": {
  3254. // "$ref": "Empty"
  3255. // },
  3256. // "scopes": [
  3257. // "https://www.googleapis.com/auth/cloud-platform",
  3258. // "https://www.googleapis.com/auth/logging.admin",
  3259. // "https://www.googleapis.com/auth/logging.write"
  3260. // ]
  3261. // }
  3262. }
  3263. // method id "logging.projects.metrics.get":
  3264. type ProjectsMetricsGetCall struct {
  3265. s *Service
  3266. projectsId string
  3267. metricsId string
  3268. urlParams_ gensupport.URLParams
  3269. ifNoneMatch_ string
  3270. ctx_ context.Context
  3271. }
  3272. // Get: Gets a logs-based metric.
  3273. func (r *ProjectsMetricsService) Get(projectsId string, metricsId string) *ProjectsMetricsGetCall {
  3274. c := &ProjectsMetricsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3275. c.projectsId = projectsId
  3276. c.metricsId = metricsId
  3277. return c
  3278. }
  3279. // Fields allows partial responses to be retrieved. See
  3280. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3281. // for more information.
  3282. func (c *ProjectsMetricsGetCall) Fields(s ...googleapi.Field) *ProjectsMetricsGetCall {
  3283. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3284. return c
  3285. }
  3286. // IfNoneMatch sets the optional parameter which makes the operation
  3287. // fail if the object's ETag matches the given value. This is useful for
  3288. // getting updates only after the object has changed since the last
  3289. // request. Use googleapi.IsNotModified to check whether the response
  3290. // error from Do is the result of In-None-Match.
  3291. func (c *ProjectsMetricsGetCall) IfNoneMatch(entityTag string) *ProjectsMetricsGetCall {
  3292. c.ifNoneMatch_ = entityTag
  3293. return c
  3294. }
  3295. // Context sets the context to be used in this call's Do method. Any
  3296. // pending HTTP request will be aborted if the provided context is
  3297. // canceled.
  3298. func (c *ProjectsMetricsGetCall) Context(ctx context.Context) *ProjectsMetricsGetCall {
  3299. c.ctx_ = ctx
  3300. return c
  3301. }
  3302. func (c *ProjectsMetricsGetCall) doRequest(alt string) (*http.Response, error) {
  3303. var body io.Reader = nil
  3304. c.urlParams_.Set("alt", alt)
  3305. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta3/projects/{projectsId}/metrics/{metricsId}")
  3306. urls += "?" + c.urlParams_.Encode()
  3307. req, _ := http.NewRequest("GET", urls, body)
  3308. googleapi.Expand(req.URL, map[string]string{
  3309. "projectsId": c.projectsId,
  3310. "metricsId": c.metricsId,
  3311. })
  3312. req.Header.Set("User-Agent", c.s.userAgent())
  3313. if c.ifNoneMatch_ != "" {
  3314. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  3315. }
  3316. if c.ctx_ != nil {
  3317. return ctxhttp.Do(c.ctx_, c.s.client, req)
  3318. }
  3319. return c.s.client.Do(req)
  3320. }
  3321. // Do executes the "logging.projects.metrics.get" call.
  3322. // Exactly one of *LogMetric or error will be non-nil. Any non-2xx
  3323. // status code is an error. Response headers are in either
  3324. // *LogMetric.ServerResponse.Header or (if a response was returned at
  3325. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  3326. // to check whether the returned error was because
  3327. // http.StatusNotModified was returned.
  3328. func (c *ProjectsMetricsGetCall) Do(opts ...googleapi.CallOption) (*LogMetric, error) {
  3329. gensupport.SetOptions(c.urlParams_, opts...)
  3330. res, err := c.doRequest("json")
  3331. if res != nil && res.StatusCode == http.StatusNotModified {
  3332. if res.Body != nil {
  3333. res.Body.Close()
  3334. }
  3335. return nil, &googleapi.Error{
  3336. Code: res.StatusCode,
  3337. Header: res.Header,
  3338. }
  3339. }
  3340. if err != nil {
  3341. return nil, err
  3342. }
  3343. defer googleapi.CloseBody(res)
  3344. if err := googleapi.CheckResponse(res); err != nil {
  3345. return nil, err
  3346. }
  3347. ret := &LogMetric{
  3348. ServerResponse: googleapi.ServerResponse{
  3349. Header: res.Header,
  3350. HTTPStatusCode: res.StatusCode,
  3351. },
  3352. }
  3353. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  3354. return nil, err
  3355. }
  3356. return ret, nil
  3357. // {
  3358. // "description": "Gets a logs-based metric.",
  3359. // "httpMethod": "GET",
  3360. // "id": "logging.projects.metrics.get",
  3361. // "parameterOrder": [
  3362. // "projectsId",
  3363. // "metricsId"
  3364. // ],
  3365. // "parameters": {
  3366. // "metricsId": {
  3367. // "description": "Part of `metricName`. See documentation of `projectsId`.",
  3368. // "location": "path",
  3369. // "required": true,
  3370. // "type": "string"
  3371. // },
  3372. // "projectsId": {
  3373. // "description": "Part of `metricName`. The resource name of the desired metric.",
  3374. // "location": "path",
  3375. // "required": true,
  3376. // "type": "string"
  3377. // }
  3378. // },
  3379. // "path": "v1beta3/projects/{projectsId}/metrics/{metricsId}",
  3380. // "response": {
  3381. // "$ref": "LogMetric"
  3382. // },
  3383. // "scopes": [
  3384. // "https://www.googleapis.com/auth/cloud-platform",
  3385. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  3386. // "https://www.googleapis.com/auth/logging.admin",
  3387. // "https://www.googleapis.com/auth/logging.read"
  3388. // ]
  3389. // }
  3390. }
  3391. // method id "logging.projects.metrics.list":
  3392. type ProjectsMetricsListCall struct {
  3393. s *Service
  3394. projectsId string
  3395. urlParams_ gensupport.URLParams
  3396. ifNoneMatch_ string
  3397. ctx_ context.Context
  3398. }
  3399. // List: Lists the logs-based metrics associated with a project.
  3400. func (r *ProjectsMetricsService) List(projectsId string) *ProjectsMetricsListCall {
  3401. c := &ProjectsMetricsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3402. c.projectsId = projectsId
  3403. return c
  3404. }
  3405. // PageSize sets the optional parameter "pageSize": The maximum number
  3406. // of `LogMetric` objects to return in one operation.
  3407. func (c *ProjectsMetricsListCall) PageSize(pageSize int64) *ProjectsMetricsListCall {
  3408. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  3409. return c
  3410. }
  3411. // PageToken sets the optional parameter "pageToken": An opaque token,
  3412. // returned as `nextPageToken` by a prior `ListLogMetrics` operation. If
  3413. // `pageToken` is supplied, then the other fields of this request are
  3414. // ignored, and instead the previous `ListLogMetrics` operation is
  3415. // continued.
  3416. func (c *ProjectsMetricsListCall) PageToken(pageToken string) *ProjectsMetricsListCall {
  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 *ProjectsMetricsListCall) Fields(s ...googleapi.Field) *ProjectsMetricsListCall {
  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 *ProjectsMetricsListCall) IfNoneMatch(entityTag string) *ProjectsMetricsListCall {
  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 *ProjectsMetricsListCall) Context(ctx context.Context) *ProjectsMetricsListCall {
  3440. c.ctx_ = ctx
  3441. return c
  3442. }
  3443. func (c *ProjectsMetricsListCall) doRequest(alt string) (*http.Response, error) {
  3444. var body io.Reader = nil
  3445. c.urlParams_.Set("alt", alt)
  3446. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta3/projects/{projectsId}/metrics")
  3447. urls += "?" + c.urlParams_.Encode()
  3448. req, _ := http.NewRequest("GET", urls, body)
  3449. googleapi.Expand(req.URL, map[string]string{
  3450. "projectsId": c.projectsId,
  3451. })
  3452. req.Header.Set("User-Agent", c.s.userAgent())
  3453. if c.ifNoneMatch_ != "" {
  3454. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  3455. }
  3456. if c.ctx_ != nil {
  3457. return ctxhttp.Do(c.ctx_, c.s.client, req)
  3458. }
  3459. return c.s.client.Do(req)
  3460. }
  3461. // Do executes the "logging.projects.metrics.list" call.
  3462. // Exactly one of *ListLogMetricsResponse or error will be non-nil. Any
  3463. // non-2xx status code is an error. Response headers are in either
  3464. // *ListLogMetricsResponse.ServerResponse.Header or (if a response was
  3465. // returned at all) in error.(*googleapi.Error).Header. Use
  3466. // googleapi.IsNotModified to check whether the returned error was
  3467. // because http.StatusNotModified was returned.
  3468. func (c *ProjectsMetricsListCall) Do(opts ...googleapi.CallOption) (*ListLogMetricsResponse, error) {
  3469. gensupport.SetOptions(c.urlParams_, opts...)
  3470. res, err := c.doRequest("json")
  3471. if res != nil && res.StatusCode == http.StatusNotModified {
  3472. if res.Body != nil {
  3473. res.Body.Close()
  3474. }
  3475. return nil, &googleapi.Error{
  3476. Code: res.StatusCode,
  3477. Header: res.Header,
  3478. }
  3479. }
  3480. if err != nil {
  3481. return nil, err
  3482. }
  3483. defer googleapi.CloseBody(res)
  3484. if err := googleapi.CheckResponse(res); err != nil {
  3485. return nil, err
  3486. }
  3487. ret := &ListLogMetricsResponse{
  3488. ServerResponse: googleapi.ServerResponse{
  3489. Header: res.Header,
  3490. HTTPStatusCode: res.StatusCode,
  3491. },
  3492. }
  3493. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  3494. return nil, err
  3495. }
  3496. return ret, nil
  3497. // {
  3498. // "description": "Lists the logs-based metrics associated with a project.",
  3499. // "httpMethod": "GET",
  3500. // "id": "logging.projects.metrics.list",
  3501. // "parameterOrder": [
  3502. // "projectsId"
  3503. // ],
  3504. // "parameters": {
  3505. // "pageSize": {
  3506. // "description": "The maximum number of `LogMetric` objects to return in one operation.",
  3507. // "format": "int32",
  3508. // "location": "query",
  3509. // "type": "integer"
  3510. // },
  3511. // "pageToken": {
  3512. // "description": "An opaque token, returned as `nextPageToken` by a prior `ListLogMetrics` operation. If `pageToken` is supplied, then the other fields of this request are ignored, and instead the previous `ListLogMetrics` operation is continued.",
  3513. // "location": "query",
  3514. // "type": "string"
  3515. // },
  3516. // "projectsId": {
  3517. // "description": "Part of `projectName`. The resource name for the project whose metrics are wanted.",
  3518. // "location": "path",
  3519. // "required": true,
  3520. // "type": "string"
  3521. // }
  3522. // },
  3523. // "path": "v1beta3/projects/{projectsId}/metrics",
  3524. // "response": {
  3525. // "$ref": "ListLogMetricsResponse"
  3526. // },
  3527. // "scopes": [
  3528. // "https://www.googleapis.com/auth/cloud-platform",
  3529. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  3530. // "https://www.googleapis.com/auth/logging.admin",
  3531. // "https://www.googleapis.com/auth/logging.read"
  3532. // ]
  3533. // }
  3534. }
  3535. // Pages invokes f for each page of results.
  3536. // A non-nil error returned from f will halt the iteration.
  3537. // The provided context supersedes any context provided to the Context method.
  3538. func (c *ProjectsMetricsListCall) Pages(ctx context.Context, f func(*ListLogMetricsResponse) error) error {
  3539. c.ctx_ = ctx
  3540. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  3541. for {
  3542. x, err := c.Do()
  3543. if err != nil {
  3544. return err
  3545. }
  3546. if err := f(x); err != nil {
  3547. return err
  3548. }
  3549. if x.NextPageToken == "" {
  3550. return nil
  3551. }
  3552. c.PageToken(x.NextPageToken)
  3553. }
  3554. }
  3555. // method id "logging.projects.metrics.update":
  3556. type ProjectsMetricsUpdateCall struct {
  3557. s *Service
  3558. projectsId string
  3559. metricsId string
  3560. logmetric *LogMetric
  3561. urlParams_ gensupport.URLParams
  3562. ctx_ context.Context
  3563. }
  3564. // Update: Creates or updates a logs-based metric.
  3565. func (r *ProjectsMetricsService) Update(projectsId string, metricsId string, logmetric *LogMetric) *ProjectsMetricsUpdateCall {
  3566. c := &ProjectsMetricsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3567. c.projectsId = projectsId
  3568. c.metricsId = metricsId
  3569. c.logmetric = logmetric
  3570. return c
  3571. }
  3572. // Fields allows partial responses to be retrieved. See
  3573. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3574. // for more information.
  3575. func (c *ProjectsMetricsUpdateCall) Fields(s ...googleapi.Field) *ProjectsMetricsUpdateCall {
  3576. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3577. return c
  3578. }
  3579. // Context sets the context to be used in this call's Do method. Any
  3580. // pending HTTP request will be aborted if the provided context is
  3581. // canceled.
  3582. func (c *ProjectsMetricsUpdateCall) Context(ctx context.Context) *ProjectsMetricsUpdateCall {
  3583. c.ctx_ = ctx
  3584. return c
  3585. }
  3586. func (c *ProjectsMetricsUpdateCall) doRequest(alt string) (*http.Response, error) {
  3587. var body io.Reader = nil
  3588. body, err := googleapi.WithoutDataWrapper.JSONReader(c.logmetric)
  3589. if err != nil {
  3590. return nil, err
  3591. }
  3592. ctype := "application/json"
  3593. c.urlParams_.Set("alt", alt)
  3594. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta3/projects/{projectsId}/metrics/{metricsId}")
  3595. urls += "?" + c.urlParams_.Encode()
  3596. req, _ := http.NewRequest("PUT", urls, body)
  3597. googleapi.Expand(req.URL, map[string]string{
  3598. "projectsId": c.projectsId,
  3599. "metricsId": c.metricsId,
  3600. })
  3601. req.Header.Set("Content-Type", ctype)
  3602. req.Header.Set("User-Agent", c.s.userAgent())
  3603. if c.ctx_ != nil {
  3604. return ctxhttp.Do(c.ctx_, c.s.client, req)
  3605. }
  3606. return c.s.client.Do(req)
  3607. }
  3608. // Do executes the "logging.projects.metrics.update" call.
  3609. // Exactly one of *LogMetric or error will be non-nil. Any non-2xx
  3610. // status code is an error. Response headers are in either
  3611. // *LogMetric.ServerResponse.Header or (if a response was returned at
  3612. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  3613. // to check whether the returned error was because
  3614. // http.StatusNotModified was returned.
  3615. func (c *ProjectsMetricsUpdateCall) Do(opts ...googleapi.CallOption) (*LogMetric, error) {
  3616. gensupport.SetOptions(c.urlParams_, opts...)
  3617. res, err := c.doRequest("json")
  3618. if res != nil && res.StatusCode == http.StatusNotModified {
  3619. if res.Body != nil {
  3620. res.Body.Close()
  3621. }
  3622. return nil, &googleapi.Error{
  3623. Code: res.StatusCode,
  3624. Header: res.Header,
  3625. }
  3626. }
  3627. if err != nil {
  3628. return nil, err
  3629. }
  3630. defer googleapi.CloseBody(res)
  3631. if err := googleapi.CheckResponse(res); err != nil {
  3632. return nil, err
  3633. }
  3634. ret := &LogMetric{
  3635. ServerResponse: googleapi.ServerResponse{
  3636. Header: res.Header,
  3637. HTTPStatusCode: res.StatusCode,
  3638. },
  3639. }
  3640. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  3641. return nil, err
  3642. }
  3643. return ret, nil
  3644. // {
  3645. // "description": "Creates or updates a logs-based metric.",
  3646. // "httpMethod": "PUT",
  3647. // "id": "logging.projects.metrics.update",
  3648. // "parameterOrder": [
  3649. // "projectsId",
  3650. // "metricsId"
  3651. // ],
  3652. // "parameters": {
  3653. // "metricsId": {
  3654. // "description": "Part of `metricName`. See documentation of `projectsId`.",
  3655. // "location": "path",
  3656. // "required": true,
  3657. // "type": "string"
  3658. // },
  3659. // "projectsId": {
  3660. // "description": "Part of `metricName`. The resource name of the metric to update.",
  3661. // "location": "path",
  3662. // "required": true,
  3663. // "type": "string"
  3664. // }
  3665. // },
  3666. // "path": "v1beta3/projects/{projectsId}/metrics/{metricsId}",
  3667. // "request": {
  3668. // "$ref": "LogMetric"
  3669. // },
  3670. // "response": {
  3671. // "$ref": "LogMetric"
  3672. // },
  3673. // "scopes": [
  3674. // "https://www.googleapis.com/auth/cloud-platform",
  3675. // "https://www.googleapis.com/auth/logging.admin",
  3676. // "https://www.googleapis.com/auth/logging.write"
  3677. // ]
  3678. // }
  3679. }
  3680. // method id "logging.projects.sinks.create":
  3681. type ProjectsSinksCreateCall struct {
  3682. s *Service
  3683. projectsId string
  3684. logsink *LogSink
  3685. urlParams_ gensupport.URLParams
  3686. ctx_ context.Context
  3687. }
  3688. // Create: Creates a project sink. A logs filter determines which log
  3689. // entries are written to the destination.
  3690. func (r *ProjectsSinksService) Create(projectsId string, logsink *LogSink) *ProjectsSinksCreateCall {
  3691. c := &ProjectsSinksCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3692. c.projectsId = projectsId
  3693. c.logsink = logsink
  3694. return c
  3695. }
  3696. // Fields allows partial responses to be retrieved. See
  3697. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3698. // for more information.
  3699. func (c *ProjectsSinksCreateCall) Fields(s ...googleapi.Field) *ProjectsSinksCreateCall {
  3700. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3701. return c
  3702. }
  3703. // Context sets the context to be used in this call's Do method. Any
  3704. // pending HTTP request will be aborted if the provided context is
  3705. // canceled.
  3706. func (c *ProjectsSinksCreateCall) Context(ctx context.Context) *ProjectsSinksCreateCall {
  3707. c.ctx_ = ctx
  3708. return c
  3709. }
  3710. func (c *ProjectsSinksCreateCall) doRequest(alt string) (*http.Response, error) {
  3711. var body io.Reader = nil
  3712. body, err := googleapi.WithoutDataWrapper.JSONReader(c.logsink)
  3713. if err != nil {
  3714. return nil, err
  3715. }
  3716. ctype := "application/json"
  3717. c.urlParams_.Set("alt", alt)
  3718. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta3/projects/{projectsId}/sinks")
  3719. urls += "?" + c.urlParams_.Encode()
  3720. req, _ := http.NewRequest("POST", urls, body)
  3721. googleapi.Expand(req.URL, map[string]string{
  3722. "projectsId": c.projectsId,
  3723. })
  3724. req.Header.Set("Content-Type", ctype)
  3725. req.Header.Set("User-Agent", c.s.userAgent())
  3726. if c.ctx_ != nil {
  3727. return ctxhttp.Do(c.ctx_, c.s.client, req)
  3728. }
  3729. return c.s.client.Do(req)
  3730. }
  3731. // Do executes the "logging.projects.sinks.create" call.
  3732. // Exactly one of *LogSink or error will be non-nil. Any non-2xx status
  3733. // code is an error. Response headers are in either
  3734. // *LogSink.ServerResponse.Header or (if a response was returned at all)
  3735. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3736. // check whether the returned error was because http.StatusNotModified
  3737. // was returned.
  3738. func (c *ProjectsSinksCreateCall) Do(opts ...googleapi.CallOption) (*LogSink, error) {
  3739. gensupport.SetOptions(c.urlParams_, opts...)
  3740. res, err := c.doRequest("json")
  3741. if res != nil && res.StatusCode == http.StatusNotModified {
  3742. if res.Body != nil {
  3743. res.Body.Close()
  3744. }
  3745. return nil, &googleapi.Error{
  3746. Code: res.StatusCode,
  3747. Header: res.Header,
  3748. }
  3749. }
  3750. if err != nil {
  3751. return nil, err
  3752. }
  3753. defer googleapi.CloseBody(res)
  3754. if err := googleapi.CheckResponse(res); err != nil {
  3755. return nil, err
  3756. }
  3757. ret := &LogSink{
  3758. ServerResponse: googleapi.ServerResponse{
  3759. Header: res.Header,
  3760. HTTPStatusCode: res.StatusCode,
  3761. },
  3762. }
  3763. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  3764. return nil, err
  3765. }
  3766. return ret, nil
  3767. // {
  3768. // "description": "Creates a project sink. A logs filter determines which log entries are written to the destination.",
  3769. // "httpMethod": "POST",
  3770. // "id": "logging.projects.sinks.create",
  3771. // "parameterOrder": [
  3772. // "projectsId"
  3773. // ],
  3774. // "parameters": {
  3775. // "projectsId": {
  3776. // "description": "Part of `projectName`. The resource name of the project to which the sink is bound.",
  3777. // "location": "path",
  3778. // "required": true,
  3779. // "type": "string"
  3780. // }
  3781. // },
  3782. // "path": "v1beta3/projects/{projectsId}/sinks",
  3783. // "request": {
  3784. // "$ref": "LogSink"
  3785. // },
  3786. // "response": {
  3787. // "$ref": "LogSink"
  3788. // },
  3789. // "scopes": [
  3790. // "https://www.googleapis.com/auth/cloud-platform",
  3791. // "https://www.googleapis.com/auth/logging.admin"
  3792. // ]
  3793. // }
  3794. }
  3795. // method id "logging.projects.sinks.delete":
  3796. type ProjectsSinksDeleteCall struct {
  3797. s *Service
  3798. projectsId string
  3799. sinksId string
  3800. urlParams_ gensupport.URLParams
  3801. ctx_ context.Context
  3802. }
  3803. // Delete: Deletes a project sink. After deletion, no new log entries
  3804. // are written to the destination.
  3805. func (r *ProjectsSinksService) Delete(projectsId string, sinksId string) *ProjectsSinksDeleteCall {
  3806. c := &ProjectsSinksDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3807. c.projectsId = projectsId
  3808. c.sinksId = sinksId
  3809. return c
  3810. }
  3811. // Fields allows partial responses to be retrieved. See
  3812. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3813. // for more information.
  3814. func (c *ProjectsSinksDeleteCall) Fields(s ...googleapi.Field) *ProjectsSinksDeleteCall {
  3815. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3816. return c
  3817. }
  3818. // Context sets the context to be used in this call's Do method. Any
  3819. // pending HTTP request will be aborted if the provided context is
  3820. // canceled.
  3821. func (c *ProjectsSinksDeleteCall) Context(ctx context.Context) *ProjectsSinksDeleteCall {
  3822. c.ctx_ = ctx
  3823. return c
  3824. }
  3825. func (c *ProjectsSinksDeleteCall) doRequest(alt string) (*http.Response, error) {
  3826. var body io.Reader = nil
  3827. c.urlParams_.Set("alt", alt)
  3828. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta3/projects/{projectsId}/sinks/{sinksId}")
  3829. urls += "?" + c.urlParams_.Encode()
  3830. req, _ := http.NewRequest("DELETE", urls, body)
  3831. googleapi.Expand(req.URL, map[string]string{
  3832. "projectsId": c.projectsId,
  3833. "sinksId": c.sinksId,
  3834. })
  3835. req.Header.Set("User-Agent", c.s.userAgent())
  3836. if c.ctx_ != nil {
  3837. return ctxhttp.Do(c.ctx_, c.s.client, req)
  3838. }
  3839. return c.s.client.Do(req)
  3840. }
  3841. // Do executes the "logging.projects.sinks.delete" call.
  3842. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  3843. // code is an error. Response headers are in either
  3844. // *Empty.ServerResponse.Header or (if a response was returned at all)
  3845. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3846. // check whether the returned error was because http.StatusNotModified
  3847. // was returned.
  3848. func (c *ProjectsSinksDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  3849. gensupport.SetOptions(c.urlParams_, opts...)
  3850. res, err := c.doRequest("json")
  3851. if res != nil && res.StatusCode == http.StatusNotModified {
  3852. if res.Body != nil {
  3853. res.Body.Close()
  3854. }
  3855. return nil, &googleapi.Error{
  3856. Code: res.StatusCode,
  3857. Header: res.Header,
  3858. }
  3859. }
  3860. if err != nil {
  3861. return nil, err
  3862. }
  3863. defer googleapi.CloseBody(res)
  3864. if err := googleapi.CheckResponse(res); err != nil {
  3865. return nil, err
  3866. }
  3867. ret := &Empty{
  3868. ServerResponse: googleapi.ServerResponse{
  3869. Header: res.Header,
  3870. HTTPStatusCode: res.StatusCode,
  3871. },
  3872. }
  3873. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  3874. return nil, err
  3875. }
  3876. return ret, nil
  3877. // {
  3878. // "description": "Deletes a project sink. After deletion, no new log entries are written to the destination.",
  3879. // "httpMethod": "DELETE",
  3880. // "id": "logging.projects.sinks.delete",
  3881. // "parameterOrder": [
  3882. // "projectsId",
  3883. // "sinksId"
  3884. // ],
  3885. // "parameters": {
  3886. // "projectsId": {
  3887. // "description": "Part of `sinkName`. The resource name of the project sink to delete.",
  3888. // "location": "path",
  3889. // "required": true,
  3890. // "type": "string"
  3891. // },
  3892. // "sinksId": {
  3893. // "description": "Part of `sinkName`. See documentation of `projectsId`.",
  3894. // "location": "path",
  3895. // "required": true,
  3896. // "type": "string"
  3897. // }
  3898. // },
  3899. // "path": "v1beta3/projects/{projectsId}/sinks/{sinksId}",
  3900. // "response": {
  3901. // "$ref": "Empty"
  3902. // },
  3903. // "scopes": [
  3904. // "https://www.googleapis.com/auth/cloud-platform",
  3905. // "https://www.googleapis.com/auth/logging.admin"
  3906. // ]
  3907. // }
  3908. }
  3909. // method id "logging.projects.sinks.get":
  3910. type ProjectsSinksGetCall struct {
  3911. s *Service
  3912. projectsId string
  3913. sinksId string
  3914. urlParams_ gensupport.URLParams
  3915. ifNoneMatch_ string
  3916. ctx_ context.Context
  3917. }
  3918. // Get: Gets a project sink.
  3919. func (r *ProjectsSinksService) Get(projectsId string, sinksId string) *ProjectsSinksGetCall {
  3920. c := &ProjectsSinksGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3921. c.projectsId = projectsId
  3922. c.sinksId = sinksId
  3923. return c
  3924. }
  3925. // Fields allows partial responses to be retrieved. See
  3926. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3927. // for more information.
  3928. func (c *ProjectsSinksGetCall) Fields(s ...googleapi.Field) *ProjectsSinksGetCall {
  3929. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3930. return c
  3931. }
  3932. // IfNoneMatch sets the optional parameter which makes the operation
  3933. // fail if the object's ETag matches the given value. This is useful for
  3934. // getting updates only after the object has changed since the last
  3935. // request. Use googleapi.IsNotModified to check whether the response
  3936. // error from Do is the result of In-None-Match.
  3937. func (c *ProjectsSinksGetCall) IfNoneMatch(entityTag string) *ProjectsSinksGetCall {
  3938. c.ifNoneMatch_ = entityTag
  3939. return c
  3940. }
  3941. // Context sets the context to be used in this call's Do method. Any
  3942. // pending HTTP request will be aborted if the provided context is
  3943. // canceled.
  3944. func (c *ProjectsSinksGetCall) Context(ctx context.Context) *ProjectsSinksGetCall {
  3945. c.ctx_ = ctx
  3946. return c
  3947. }
  3948. func (c *ProjectsSinksGetCall) doRequest(alt string) (*http.Response, error) {
  3949. var body io.Reader = nil
  3950. c.urlParams_.Set("alt", alt)
  3951. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta3/projects/{projectsId}/sinks/{sinksId}")
  3952. urls += "?" + c.urlParams_.Encode()
  3953. req, _ := http.NewRequest("GET", urls, body)
  3954. googleapi.Expand(req.URL, map[string]string{
  3955. "projectsId": c.projectsId,
  3956. "sinksId": c.sinksId,
  3957. })
  3958. req.Header.Set("User-Agent", c.s.userAgent())
  3959. if c.ifNoneMatch_ != "" {
  3960. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  3961. }
  3962. if c.ctx_ != nil {
  3963. return ctxhttp.Do(c.ctx_, c.s.client, req)
  3964. }
  3965. return c.s.client.Do(req)
  3966. }
  3967. // Do executes the "logging.projects.sinks.get" call.
  3968. // Exactly one of *LogSink or error will be non-nil. Any non-2xx status
  3969. // code is an error. Response headers are in either
  3970. // *LogSink.ServerResponse.Header or (if a response was returned at all)
  3971. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3972. // check whether the returned error was because http.StatusNotModified
  3973. // was returned.
  3974. func (c *ProjectsSinksGetCall) Do(opts ...googleapi.CallOption) (*LogSink, error) {
  3975. gensupport.SetOptions(c.urlParams_, opts...)
  3976. res, err := c.doRequest("json")
  3977. if res != nil && res.StatusCode == http.StatusNotModified {
  3978. if res.Body != nil {
  3979. res.Body.Close()
  3980. }
  3981. return nil, &googleapi.Error{
  3982. Code: res.StatusCode,
  3983. Header: res.Header,
  3984. }
  3985. }
  3986. if err != nil {
  3987. return nil, err
  3988. }
  3989. defer googleapi.CloseBody(res)
  3990. if err := googleapi.CheckResponse(res); err != nil {
  3991. return nil, err
  3992. }
  3993. ret := &LogSink{
  3994. ServerResponse: googleapi.ServerResponse{
  3995. Header: res.Header,
  3996. HTTPStatusCode: res.StatusCode,
  3997. },
  3998. }
  3999. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  4000. return nil, err
  4001. }
  4002. return ret, nil
  4003. // {
  4004. // "description": "Gets a project sink.",
  4005. // "httpMethod": "GET",
  4006. // "id": "logging.projects.sinks.get",
  4007. // "parameterOrder": [
  4008. // "projectsId",
  4009. // "sinksId"
  4010. // ],
  4011. // "parameters": {
  4012. // "projectsId": {
  4013. // "description": "Part of `sinkName`. The resource name of the project sink to return.",
  4014. // "location": "path",
  4015. // "required": true,
  4016. // "type": "string"
  4017. // },
  4018. // "sinksId": {
  4019. // "description": "Part of `sinkName`. See documentation of `projectsId`.",
  4020. // "location": "path",
  4021. // "required": true,
  4022. // "type": "string"
  4023. // }
  4024. // },
  4025. // "path": "v1beta3/projects/{projectsId}/sinks/{sinksId}",
  4026. // "response": {
  4027. // "$ref": "LogSink"
  4028. // },
  4029. // "scopes": [
  4030. // "https://www.googleapis.com/auth/cloud-platform",
  4031. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  4032. // "https://www.googleapis.com/auth/logging.admin",
  4033. // "https://www.googleapis.com/auth/logging.read"
  4034. // ]
  4035. // }
  4036. }
  4037. // method id "logging.projects.sinks.list":
  4038. type ProjectsSinksListCall struct {
  4039. s *Service
  4040. projectsId string
  4041. urlParams_ gensupport.URLParams
  4042. ifNoneMatch_ string
  4043. ctx_ context.Context
  4044. }
  4045. // List: Lists project sinks associated with a project.
  4046. func (r *ProjectsSinksService) List(projectsId string) *ProjectsSinksListCall {
  4047. c := &ProjectsSinksListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4048. c.projectsId = projectsId
  4049. return c
  4050. }
  4051. // Fields allows partial responses to be retrieved. See
  4052. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4053. // for more information.
  4054. func (c *ProjectsSinksListCall) Fields(s ...googleapi.Field) *ProjectsSinksListCall {
  4055. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4056. return c
  4057. }
  4058. // IfNoneMatch sets the optional parameter which makes the operation
  4059. // fail if the object's ETag matches the given value. This is useful for
  4060. // getting updates only after the object has changed since the last
  4061. // request. Use googleapi.IsNotModified to check whether the response
  4062. // error from Do is the result of In-None-Match.
  4063. func (c *ProjectsSinksListCall) IfNoneMatch(entityTag string) *ProjectsSinksListCall {
  4064. c.ifNoneMatch_ = entityTag
  4065. return c
  4066. }
  4067. // Context sets the context to be used in this call's Do method. Any
  4068. // pending HTTP request will be aborted if the provided context is
  4069. // canceled.
  4070. func (c *ProjectsSinksListCall) Context(ctx context.Context) *ProjectsSinksListCall {
  4071. c.ctx_ = ctx
  4072. return c
  4073. }
  4074. func (c *ProjectsSinksListCall) doRequest(alt string) (*http.Response, error) {
  4075. var body io.Reader = nil
  4076. c.urlParams_.Set("alt", alt)
  4077. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta3/projects/{projectsId}/sinks")
  4078. urls += "?" + c.urlParams_.Encode()
  4079. req, _ := http.NewRequest("GET", urls, body)
  4080. googleapi.Expand(req.URL, map[string]string{
  4081. "projectsId": c.projectsId,
  4082. })
  4083. req.Header.Set("User-Agent", c.s.userAgent())
  4084. if c.ifNoneMatch_ != "" {
  4085. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  4086. }
  4087. if c.ctx_ != nil {
  4088. return ctxhttp.Do(c.ctx_, c.s.client, req)
  4089. }
  4090. return c.s.client.Do(req)
  4091. }
  4092. // Do executes the "logging.projects.sinks.list" call.
  4093. // Exactly one of *ListSinksResponse or error will be non-nil. Any
  4094. // non-2xx status code is an error. Response headers are in either
  4095. // *ListSinksResponse.ServerResponse.Header or (if a response was
  4096. // returned at all) in error.(*googleapi.Error).Header. Use
  4097. // googleapi.IsNotModified to check whether the returned error was
  4098. // because http.StatusNotModified was returned.
  4099. func (c *ProjectsSinksListCall) Do(opts ...googleapi.CallOption) (*ListSinksResponse, error) {
  4100. gensupport.SetOptions(c.urlParams_, opts...)
  4101. res, err := c.doRequest("json")
  4102. if res != nil && res.StatusCode == http.StatusNotModified {
  4103. if res.Body != nil {
  4104. res.Body.Close()
  4105. }
  4106. return nil, &googleapi.Error{
  4107. Code: res.StatusCode,
  4108. Header: res.Header,
  4109. }
  4110. }
  4111. if err != nil {
  4112. return nil, err
  4113. }
  4114. defer googleapi.CloseBody(res)
  4115. if err := googleapi.CheckResponse(res); err != nil {
  4116. return nil, err
  4117. }
  4118. ret := &ListSinksResponse{
  4119. ServerResponse: googleapi.ServerResponse{
  4120. Header: res.Header,
  4121. HTTPStatusCode: res.StatusCode,
  4122. },
  4123. }
  4124. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  4125. return nil, err
  4126. }
  4127. return ret, nil
  4128. // {
  4129. // "description": "Lists project sinks associated with a project.",
  4130. // "httpMethod": "GET",
  4131. // "id": "logging.projects.sinks.list",
  4132. // "parameterOrder": [
  4133. // "projectsId"
  4134. // ],
  4135. // "parameters": {
  4136. // "projectsId": {
  4137. // "description": "Part of `projectName`. The project whose sinks are wanted.",
  4138. // "location": "path",
  4139. // "required": true,
  4140. // "type": "string"
  4141. // }
  4142. // },
  4143. // "path": "v1beta3/projects/{projectsId}/sinks",
  4144. // "response": {
  4145. // "$ref": "ListSinksResponse"
  4146. // },
  4147. // "scopes": [
  4148. // "https://www.googleapis.com/auth/cloud-platform",
  4149. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  4150. // "https://www.googleapis.com/auth/logging.admin",
  4151. // "https://www.googleapis.com/auth/logging.read"
  4152. // ]
  4153. // }
  4154. }
  4155. // method id "logging.projects.sinks.update":
  4156. type ProjectsSinksUpdateCall struct {
  4157. s *Service
  4158. projectsId string
  4159. sinksId string
  4160. logsink *LogSink
  4161. urlParams_ gensupport.URLParams
  4162. ctx_ context.Context
  4163. }
  4164. // Update: Updates a project sink. If the sink does not exist, it is
  4165. // created. The destination, filter, or both may be updated.
  4166. func (r *ProjectsSinksService) Update(projectsId string, sinksId string, logsink *LogSink) *ProjectsSinksUpdateCall {
  4167. c := &ProjectsSinksUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4168. c.projectsId = projectsId
  4169. c.sinksId = sinksId
  4170. c.logsink = logsink
  4171. return c
  4172. }
  4173. // Fields allows partial responses to be retrieved. See
  4174. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4175. // for more information.
  4176. func (c *ProjectsSinksUpdateCall) Fields(s ...googleapi.Field) *ProjectsSinksUpdateCall {
  4177. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4178. return c
  4179. }
  4180. // Context sets the context to be used in this call's Do method. Any
  4181. // pending HTTP request will be aborted if the provided context is
  4182. // canceled.
  4183. func (c *ProjectsSinksUpdateCall) Context(ctx context.Context) *ProjectsSinksUpdateCall {
  4184. c.ctx_ = ctx
  4185. return c
  4186. }
  4187. func (c *ProjectsSinksUpdateCall) doRequest(alt string) (*http.Response, error) {
  4188. var body io.Reader = nil
  4189. body, err := googleapi.WithoutDataWrapper.JSONReader(c.logsink)
  4190. if err != nil {
  4191. return nil, err
  4192. }
  4193. ctype := "application/json"
  4194. c.urlParams_.Set("alt", alt)
  4195. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta3/projects/{projectsId}/sinks/{sinksId}")
  4196. urls += "?" + c.urlParams_.Encode()
  4197. req, _ := http.NewRequest("PUT", urls, body)
  4198. googleapi.Expand(req.URL, map[string]string{
  4199. "projectsId": c.projectsId,
  4200. "sinksId": c.sinksId,
  4201. })
  4202. req.Header.Set("Content-Type", ctype)
  4203. req.Header.Set("User-Agent", c.s.userAgent())
  4204. if c.ctx_ != nil {
  4205. return ctxhttp.Do(c.ctx_, c.s.client, req)
  4206. }
  4207. return c.s.client.Do(req)
  4208. }
  4209. // Do executes the "logging.projects.sinks.update" call.
  4210. // Exactly one of *LogSink or error will be non-nil. Any non-2xx status
  4211. // code is an error. Response headers are in either
  4212. // *LogSink.ServerResponse.Header or (if a response was returned at all)
  4213. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  4214. // check whether the returned error was because http.StatusNotModified
  4215. // was returned.
  4216. func (c *ProjectsSinksUpdateCall) Do(opts ...googleapi.CallOption) (*LogSink, error) {
  4217. gensupport.SetOptions(c.urlParams_, opts...)
  4218. res, err := c.doRequest("json")
  4219. if res != nil && res.StatusCode == http.StatusNotModified {
  4220. if res.Body != nil {
  4221. res.Body.Close()
  4222. }
  4223. return nil, &googleapi.Error{
  4224. Code: res.StatusCode,
  4225. Header: res.Header,
  4226. }
  4227. }
  4228. if err != nil {
  4229. return nil, err
  4230. }
  4231. defer googleapi.CloseBody(res)
  4232. if err := googleapi.CheckResponse(res); err != nil {
  4233. return nil, err
  4234. }
  4235. ret := &LogSink{
  4236. ServerResponse: googleapi.ServerResponse{
  4237. Header: res.Header,
  4238. HTTPStatusCode: res.StatusCode,
  4239. },
  4240. }
  4241. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  4242. return nil, err
  4243. }
  4244. return ret, nil
  4245. // {
  4246. // "description": "Updates a project sink. If the sink does not exist, it is created. The destination, filter, or both may be updated.",
  4247. // "httpMethod": "PUT",
  4248. // "id": "logging.projects.sinks.update",
  4249. // "parameterOrder": [
  4250. // "projectsId",
  4251. // "sinksId"
  4252. // ],
  4253. // "parameters": {
  4254. // "projectsId": {
  4255. // "description": "Part of `sinkName`. The resource name of the project sink to update.",
  4256. // "location": "path",
  4257. // "required": true,
  4258. // "type": "string"
  4259. // },
  4260. // "sinksId": {
  4261. // "description": "Part of `sinkName`. See documentation of `projectsId`.",
  4262. // "location": "path",
  4263. // "required": true,
  4264. // "type": "string"
  4265. // }
  4266. // },
  4267. // "path": "v1beta3/projects/{projectsId}/sinks/{sinksId}",
  4268. // "request": {
  4269. // "$ref": "LogSink"
  4270. // },
  4271. // "response": {
  4272. // "$ref": "LogSink"
  4273. // },
  4274. // "scopes": [
  4275. // "https://www.googleapis.com/auth/cloud-platform",
  4276. // "https://www.googleapis.com/auth/logging.admin"
  4277. // ]
  4278. // }
  4279. }