logging-gen.go 157 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078
  1. // Copyright 2019 Google LLC.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. // Code generated file. DO NOT EDIT.
  5. // Package logging provides access to the Stackdriver Logging API.
  6. //
  7. // This package is DEPRECATED. Use package cloud.google.com/go/logging instead.
  8. //
  9. // For product documentation, see: https://cloud.google.com/logging/docs/
  10. //
  11. // Creating a client
  12. //
  13. // Usage example:
  14. //
  15. // import "google.golang.org/api/logging/v2beta1"
  16. // ...
  17. // ctx := context.Background()
  18. // loggingService, err := logging.NewService(ctx)
  19. //
  20. // In this example, Google Application Default Credentials are used for authentication.
  21. //
  22. // For information on how to create and obtain Application Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials.
  23. //
  24. // Other authentication options
  25. //
  26. // By default, all available scopes (see "Constants") are used to authenticate. To restrict scopes, use option.WithScopes:
  27. //
  28. // loggingService, err := logging.NewService(ctx, option.WithScopes(logging.LoggingWriteScope))
  29. //
  30. // To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey:
  31. //
  32. // loggingService, err := logging.NewService(ctx, option.WithAPIKey("AIza..."))
  33. //
  34. // To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource:
  35. //
  36. // config := &oauth2.Config{...}
  37. // // ...
  38. // token, err := config.Exchange(ctx, ...)
  39. // loggingService, err := logging.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
  40. //
  41. // See https://godoc.org/google.golang.org/api/option/ for details on options.
  42. package logging // import "google.golang.org/api/logging/v2beta1"
  43. import (
  44. "bytes"
  45. "context"
  46. "encoding/json"
  47. "errors"
  48. "fmt"
  49. "io"
  50. "net/http"
  51. "net/url"
  52. "strconv"
  53. "strings"
  54. gensupport "google.golang.org/api/gensupport"
  55. googleapi "google.golang.org/api/googleapi"
  56. option "google.golang.org/api/option"
  57. htransport "google.golang.org/api/transport/http"
  58. )
  59. // Always reference these packages, just in case the auto-generated code
  60. // below doesn't.
  61. var _ = bytes.NewBuffer
  62. var _ = strconv.Itoa
  63. var _ = fmt.Sprintf
  64. var _ = json.NewDecoder
  65. var _ = io.Copy
  66. var _ = url.Parse
  67. var _ = gensupport.MarshalJSON
  68. var _ = googleapi.Version
  69. var _ = errors.New
  70. var _ = strings.Replace
  71. var _ = context.Canceled
  72. const apiId = "logging:v2beta1"
  73. const apiName = "logging"
  74. const apiVersion = "v2beta1"
  75. const basePath = "https://logging.googleapis.com/"
  76. // OAuth2 scopes used by this API.
  77. const (
  78. // View and manage your data across Google Cloud Platform services
  79. CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform"
  80. // View your data across Google Cloud Platform services
  81. CloudPlatformReadOnlyScope = "https://www.googleapis.com/auth/cloud-platform.read-only"
  82. // Administrate log data for your projects
  83. LoggingAdminScope = "https://www.googleapis.com/auth/logging.admin"
  84. // View log data for your projects
  85. LoggingReadScope = "https://www.googleapis.com/auth/logging.read"
  86. // Submit log data for your projects
  87. LoggingWriteScope = "https://www.googleapis.com/auth/logging.write"
  88. )
  89. // NewService creates a new Service.
  90. func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
  91. scopesOption := option.WithScopes(
  92. "https://www.googleapis.com/auth/cloud-platform",
  93. "https://www.googleapis.com/auth/cloud-platform.read-only",
  94. "https://www.googleapis.com/auth/logging.admin",
  95. "https://www.googleapis.com/auth/logging.read",
  96. "https://www.googleapis.com/auth/logging.write",
  97. )
  98. // NOTE: prepend, so we don't override user-specified scopes.
  99. opts = append([]option.ClientOption{scopesOption}, opts...)
  100. client, endpoint, err := htransport.NewClient(ctx, opts...)
  101. if err != nil {
  102. return nil, err
  103. }
  104. s, err := New(client)
  105. if err != nil {
  106. return nil, err
  107. }
  108. if endpoint != "" {
  109. s.BasePath = endpoint
  110. }
  111. return s, nil
  112. }
  113. // New creates a new Service. It uses the provided http.Client for requests.
  114. //
  115. // Deprecated: please use NewService instead.
  116. // To provide a custom HTTP client, use option.WithHTTPClient.
  117. // If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
  118. func New(client *http.Client) (*Service, error) {
  119. if client == nil {
  120. return nil, errors.New("client is nil")
  121. }
  122. s := &Service{client: client, BasePath: basePath}
  123. s.Entries = NewEntriesService(s)
  124. s.MonitoredResourceDescriptors = NewMonitoredResourceDescriptorsService(s)
  125. s.Projects = NewProjectsService(s)
  126. return s, nil
  127. }
  128. type Service struct {
  129. client *http.Client
  130. BasePath string // API endpoint base URL
  131. UserAgent string // optional additional User-Agent fragment
  132. Entries *EntriesService
  133. MonitoredResourceDescriptors *MonitoredResourceDescriptorsService
  134. Projects *ProjectsService
  135. }
  136. func (s *Service) userAgent() string {
  137. if s.UserAgent == "" {
  138. return googleapi.UserAgent
  139. }
  140. return googleapi.UserAgent + " " + s.UserAgent
  141. }
  142. func NewEntriesService(s *Service) *EntriesService {
  143. rs := &EntriesService{s: s}
  144. return rs
  145. }
  146. type EntriesService struct {
  147. s *Service
  148. }
  149. func NewMonitoredResourceDescriptorsService(s *Service) *MonitoredResourceDescriptorsService {
  150. rs := &MonitoredResourceDescriptorsService{s: s}
  151. return rs
  152. }
  153. type MonitoredResourceDescriptorsService struct {
  154. s *Service
  155. }
  156. func NewProjectsService(s *Service) *ProjectsService {
  157. rs := &ProjectsService{s: s}
  158. rs.Metrics = NewProjectsMetricsService(s)
  159. rs.Sinks = NewProjectsSinksService(s)
  160. return rs
  161. }
  162. type ProjectsService struct {
  163. s *Service
  164. Metrics *ProjectsMetricsService
  165. Sinks *ProjectsSinksService
  166. }
  167. func NewProjectsMetricsService(s *Service) *ProjectsMetricsService {
  168. rs := &ProjectsMetricsService{s: s}
  169. return rs
  170. }
  171. type ProjectsMetricsService struct {
  172. s *Service
  173. }
  174. func NewProjectsSinksService(s *Service) *ProjectsSinksService {
  175. rs := &ProjectsSinksService{s: s}
  176. return rs
  177. }
  178. type ProjectsSinksService struct {
  179. s *Service
  180. }
  181. // BucketOptions: BucketOptions describes the bucket boundaries used to
  182. // create a histogram for the distribution. The buckets can be in a
  183. // linear sequence, an exponential sequence, or each bucket can be
  184. // specified explicitly. BucketOptions does not include the number of
  185. // values in each bucket.A bucket has an inclusive lower bound and
  186. // exclusive upper bound for the values that are counted for that
  187. // bucket. The upper bound of a bucket must be strictly greater than the
  188. // lower bound. The sequence of N buckets for a distribution consists of
  189. // an underflow bucket (number 0), zero or more finite buckets (number 1
  190. // through N - 2) and an overflow bucket (number N - 1). The buckets are
  191. // contiguous: the lower bound of bucket i (i > 0) is the same as the
  192. // upper bound of bucket i - 1. The buckets span the whole range of
  193. // finite values: lower bound of the underflow bucket is -infinity and
  194. // the upper bound of the overflow bucket is +infinity. The finite
  195. // buckets are so-called because both bounds are finite.
  196. type BucketOptions struct {
  197. // ExplicitBuckets: The explicit buckets.
  198. ExplicitBuckets *Explicit `json:"explicitBuckets,omitempty"`
  199. // ExponentialBuckets: The exponential buckets.
  200. ExponentialBuckets *Exponential `json:"exponentialBuckets,omitempty"`
  201. // LinearBuckets: The linear bucket.
  202. LinearBuckets *Linear `json:"linearBuckets,omitempty"`
  203. // ForceSendFields is a list of field names (e.g. "ExplicitBuckets") to
  204. // unconditionally include in API requests. By default, fields with
  205. // empty values are omitted from API requests. However, any non-pointer,
  206. // non-interface field appearing in ForceSendFields will be sent to the
  207. // server regardless of whether the field is empty or not. This may be
  208. // used to include empty fields in Patch requests.
  209. ForceSendFields []string `json:"-"`
  210. // NullFields is a list of field names (e.g. "ExplicitBuckets") to
  211. // include in API requests with the JSON null value. By default, fields
  212. // with empty values are omitted from API requests. However, any field
  213. // with an empty value appearing in NullFields will be sent to the
  214. // server as null. It is an error if a field in this list has a
  215. // non-empty value. This may be used to include null fields in Patch
  216. // requests.
  217. NullFields []string `json:"-"`
  218. }
  219. func (s *BucketOptions) MarshalJSON() ([]byte, error) {
  220. type NoMethod BucketOptions
  221. raw := NoMethod(*s)
  222. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  223. }
  224. // Empty: A generic empty message that you can re-use to avoid defining
  225. // duplicated empty messages in your APIs. A typical example is to use
  226. // it as the request or the response type of an API method. For
  227. // instance:
  228. // service Foo {
  229. // rpc Bar(google.protobuf.Empty) returns
  230. // (google.protobuf.Empty);
  231. // }
  232. // The JSON representation for Empty is empty JSON object {}.
  233. type Empty struct {
  234. // ServerResponse contains the HTTP response code and headers from the
  235. // server.
  236. googleapi.ServerResponse `json:"-"`
  237. }
  238. // Explicit: Specifies a set of buckets with arbitrary widths.There are
  239. // size(bounds) + 1 (= N) buckets. Bucket i has the following
  240. // boundaries:Upper bound (0 <= i < N-1): boundsi Lower bound (1 <= i <
  241. // N); boundsi - 1The bounds field must contain at least one element. If
  242. // bounds has only one element, then there are no finite buckets, and
  243. // that single element is the common boundary of the overflow and
  244. // underflow buckets.
  245. type Explicit struct {
  246. // Bounds: The values must be monotonically increasing.
  247. Bounds []float64 `json:"bounds,omitempty"`
  248. // ForceSendFields is a list of field names (e.g. "Bounds") to
  249. // unconditionally include in API requests. By default, fields with
  250. // empty values are omitted from API requests. However, any non-pointer,
  251. // non-interface field appearing in ForceSendFields will be sent to the
  252. // server regardless of whether the field is empty or not. This may be
  253. // used to include empty fields in Patch requests.
  254. ForceSendFields []string `json:"-"`
  255. // NullFields is a list of field names (e.g. "Bounds") to include in API
  256. // requests with the JSON null value. By default, fields with empty
  257. // values are omitted from API requests. However, any field with an
  258. // empty value appearing in NullFields will be sent to the server as
  259. // null. It is an error if a field in this list has a non-empty value.
  260. // This may be used to include null fields in Patch requests.
  261. NullFields []string `json:"-"`
  262. }
  263. func (s *Explicit) MarshalJSON() ([]byte, error) {
  264. type NoMethod Explicit
  265. raw := NoMethod(*s)
  266. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  267. }
  268. // Exponential: Specifies an exponential sequence of buckets that have a
  269. // width that is proportional to the value of the lower bound. Each
  270. // bucket represents a constant relative uncertainty on a specific value
  271. // in the bucket.There are num_finite_buckets + 2 (= N) buckets. Bucket
  272. // i has the following boundaries:Upper bound (0 <= i < N-1): scale *
  273. // (growth_factor ^ i). Lower bound (1 <= i < N): scale *
  274. // (growth_factor ^ (i - 1)).
  275. type Exponential struct {
  276. // GrowthFactor: Must be greater than 1.
  277. GrowthFactor float64 `json:"growthFactor,omitempty"`
  278. // NumFiniteBuckets: Must be greater than 0.
  279. NumFiniteBuckets int64 `json:"numFiniteBuckets,omitempty"`
  280. // Scale: Must be greater than 0.
  281. Scale float64 `json:"scale,omitempty"`
  282. // ForceSendFields is a list of field names (e.g. "GrowthFactor") to
  283. // unconditionally include in API requests. By default, fields with
  284. // empty values are omitted from API requests. However, any non-pointer,
  285. // non-interface field appearing in ForceSendFields will be sent to the
  286. // server regardless of whether the field is empty or not. This may be
  287. // used to include empty fields in Patch requests.
  288. ForceSendFields []string `json:"-"`
  289. // NullFields is a list of field names (e.g. "GrowthFactor") to include
  290. // in API requests with the JSON null value. By default, fields with
  291. // empty values are omitted from API requests. However, any field with
  292. // an empty value appearing in NullFields will be sent to the server as
  293. // null. It is an error if a field in this list has a non-empty value.
  294. // This may be used to include null fields in Patch requests.
  295. NullFields []string `json:"-"`
  296. }
  297. func (s *Exponential) MarshalJSON() ([]byte, error) {
  298. type NoMethod Exponential
  299. raw := NoMethod(*s)
  300. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  301. }
  302. func (s *Exponential) UnmarshalJSON(data []byte) error {
  303. type NoMethod Exponential
  304. var s1 struct {
  305. GrowthFactor gensupport.JSONFloat64 `json:"growthFactor"`
  306. Scale gensupport.JSONFloat64 `json:"scale"`
  307. *NoMethod
  308. }
  309. s1.NoMethod = (*NoMethod)(s)
  310. if err := json.Unmarshal(data, &s1); err != nil {
  311. return err
  312. }
  313. s.GrowthFactor = float64(s1.GrowthFactor)
  314. s.Scale = float64(s1.Scale)
  315. return nil
  316. }
  317. // HttpRequest: A common proto for logging HTTP requests. Only contains
  318. // semantics defined by the HTTP specification. Product-specific logging
  319. // information MUST be defined in a separate message.
  320. type HttpRequest struct {
  321. // CacheFillBytes: The number of HTTP response bytes inserted into
  322. // cache. Set only when a cache fill was attempted.
  323. CacheFillBytes int64 `json:"cacheFillBytes,omitempty,string"`
  324. // CacheHit: Whether or not an entity was served from cache (with or
  325. // without validation).
  326. CacheHit bool `json:"cacheHit,omitempty"`
  327. // CacheLookup: Whether or not a cache lookup was attempted.
  328. CacheLookup bool `json:"cacheLookup,omitempty"`
  329. // CacheValidatedWithOriginServer: Whether or not the response was
  330. // validated with the origin server before being served from cache. This
  331. // field is only meaningful if cache_hit is True.
  332. CacheValidatedWithOriginServer bool `json:"cacheValidatedWithOriginServer,omitempty"`
  333. // Latency: The request processing latency on the server, from the time
  334. // the request was received until the response was sent.
  335. Latency string `json:"latency,omitempty"`
  336. // Protocol: Protocol used for the request. Examples: "HTTP/1.1",
  337. // "HTTP/2", "websocket"
  338. Protocol string `json:"protocol,omitempty"`
  339. // Referer: The referer URL of the request, as defined in HTTP/1.1
  340. // Header Field Definitions
  341. // (http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html).
  342. Referer string `json:"referer,omitempty"`
  343. // RemoteIp: The IP address (IPv4 or IPv6) of the client that issued the
  344. // HTTP request. Examples: "192.168.1.1", "FE80::0202:B3FF:FE1E:8329".
  345. RemoteIp string `json:"remoteIp,omitempty"`
  346. // RequestMethod: The request method. Examples: "GET", "HEAD", "PUT",
  347. // "POST".
  348. RequestMethod string `json:"requestMethod,omitempty"`
  349. // RequestSize: The size of the HTTP request message in bytes, including
  350. // the request headers and the request body.
  351. RequestSize int64 `json:"requestSize,omitempty,string"`
  352. // RequestUrl: The scheme (http, https), the host name, the path and the
  353. // query portion of the URL that was requested. Example:
  354. // "http://example.com/some/info?color=red".
  355. RequestUrl string `json:"requestUrl,omitempty"`
  356. // ResponseSize: The size of the HTTP response message sent back to the
  357. // client, in bytes, including the response headers and the response
  358. // body.
  359. ResponseSize int64 `json:"responseSize,omitempty,string"`
  360. // ServerIp: The IP address (IPv4 or IPv6) of the origin server that the
  361. // request was sent to.
  362. ServerIp string `json:"serverIp,omitempty"`
  363. // Status: The response code indicating the status of response.
  364. // Examples: 200, 404.
  365. Status int64 `json:"status,omitempty"`
  366. // UserAgent: The user agent sent by the client. Example: "Mozilla/4.0
  367. // (compatible; MSIE 6.0; Windows 98; Q312461; .NET
  368. // CLR 1.0.3705)".
  369. UserAgent string `json:"userAgent,omitempty"`
  370. // ForceSendFields is a list of field names (e.g. "CacheFillBytes") to
  371. // unconditionally include in API requests. By default, fields with
  372. // empty values are omitted from API requests. However, any non-pointer,
  373. // non-interface field appearing in ForceSendFields will be sent to the
  374. // server regardless of whether the field is empty or not. This may be
  375. // used to include empty fields in Patch requests.
  376. ForceSendFields []string `json:"-"`
  377. // NullFields is a list of field names (e.g. "CacheFillBytes") to
  378. // include in API requests with the JSON null value. By default, fields
  379. // with empty values are omitted from API requests. However, any field
  380. // with an empty value appearing in NullFields will be sent to the
  381. // server as null. It is an error if a field in this list has a
  382. // non-empty value. This may be used to include null fields in Patch
  383. // requests.
  384. NullFields []string `json:"-"`
  385. }
  386. func (s *HttpRequest) MarshalJSON() ([]byte, error) {
  387. type NoMethod HttpRequest
  388. raw := NoMethod(*s)
  389. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  390. }
  391. // LabelDescriptor: A description of a label.
  392. type LabelDescriptor struct {
  393. // Description: A human-readable description for the label.
  394. Description string `json:"description,omitempty"`
  395. // Key: The label key.
  396. Key string `json:"key,omitempty"`
  397. // ValueType: The type of data that can be assigned to the label.
  398. //
  399. // Possible values:
  400. // "STRING" - A variable-length string. This is the default.
  401. // "BOOL" - Boolean; true or false.
  402. // "INT64" - A 64-bit signed integer.
  403. ValueType string `json:"valueType,omitempty"`
  404. // ForceSendFields is a list of field names (e.g. "Description") to
  405. // unconditionally include in API requests. By default, fields with
  406. // empty values are omitted from API requests. However, any non-pointer,
  407. // non-interface field appearing in ForceSendFields will be sent to the
  408. // server regardless of whether the field is empty or not. This may be
  409. // used to include empty fields in Patch requests.
  410. ForceSendFields []string `json:"-"`
  411. // NullFields is a list of field names (e.g. "Description") to include
  412. // in API requests with the JSON null value. By default, fields with
  413. // empty values are omitted from API requests. However, any field with
  414. // an empty value appearing in NullFields will be sent to the server as
  415. // null. It is an error if a field in this list has a non-empty value.
  416. // This may be used to include null fields in Patch requests.
  417. NullFields []string `json:"-"`
  418. }
  419. func (s *LabelDescriptor) MarshalJSON() ([]byte, error) {
  420. type NoMethod LabelDescriptor
  421. raw := NoMethod(*s)
  422. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  423. }
  424. // Linear: Specifies a linear sequence of buckets that all have the same
  425. // width (except overflow and underflow). Each bucket represents a
  426. // constant absolute uncertainty on the specific value in the
  427. // bucket.There are num_finite_buckets + 2 (= N) buckets. Bucket i has
  428. // the following boundaries:Upper bound (0 <= i < N-1): offset + (width
  429. // * i). Lower bound (1 <= i < N): offset + (width * (i - 1)).
  430. type Linear struct {
  431. // NumFiniteBuckets: Must be greater than 0.
  432. NumFiniteBuckets int64 `json:"numFiniteBuckets,omitempty"`
  433. // Offset: Lower bound of the first bucket.
  434. Offset float64 `json:"offset,omitempty"`
  435. // Width: Must be greater than 0.
  436. Width float64 `json:"width,omitempty"`
  437. // ForceSendFields is a list of field names (e.g. "NumFiniteBuckets") to
  438. // unconditionally include in API requests. By default, fields with
  439. // empty values are omitted from API requests. However, any non-pointer,
  440. // non-interface field appearing in ForceSendFields will be sent to the
  441. // server regardless of whether the field is empty or not. This may be
  442. // used to include empty fields in Patch requests.
  443. ForceSendFields []string `json:"-"`
  444. // NullFields is a list of field names (e.g. "NumFiniteBuckets") to
  445. // include in API requests with the JSON null value. By default, fields
  446. // with empty values are omitted from API requests. However, any field
  447. // with an empty value appearing in NullFields will be sent to the
  448. // server as null. It is an error if a field in this list has a
  449. // non-empty value. This may be used to include null fields in Patch
  450. // requests.
  451. NullFields []string `json:"-"`
  452. }
  453. func (s *Linear) MarshalJSON() ([]byte, error) {
  454. type NoMethod Linear
  455. raw := NoMethod(*s)
  456. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  457. }
  458. func (s *Linear) UnmarshalJSON(data []byte) error {
  459. type NoMethod Linear
  460. var s1 struct {
  461. Offset gensupport.JSONFloat64 `json:"offset"`
  462. Width gensupport.JSONFloat64 `json:"width"`
  463. *NoMethod
  464. }
  465. s1.NoMethod = (*NoMethod)(s)
  466. if err := json.Unmarshal(data, &s1); err != nil {
  467. return err
  468. }
  469. s.Offset = float64(s1.Offset)
  470. s.Width = float64(s1.Width)
  471. return nil
  472. }
  473. // ListLogEntriesRequest: The parameters to ListLogEntries.
  474. type ListLogEntriesRequest struct {
  475. // Filter: Optional. A filter that chooses which log entries to return.
  476. // See Advanced Logs Filters. Only log entries that match the filter are
  477. // returned. An empty filter matches all log entries in the resources
  478. // listed in resource_names. Referencing a parent resource that is not
  479. // listed in resource_names will cause the filter to return no results.
  480. // The maximum length of the filter is 20000 characters.
  481. Filter string `json:"filter,omitempty"`
  482. // OrderBy: Optional. How the results should be sorted. Presently, the
  483. // only permitted values are "timestamp asc" (default) and "timestamp
  484. // desc". The first option returns entries in order of increasing values
  485. // of LogEntry.timestamp (oldest first), and the second option returns
  486. // entries in order of decreasing timestamps (newest first). Entries
  487. // with equal timestamps are returned in order of their insert_id
  488. // values.
  489. OrderBy string `json:"orderBy,omitempty"`
  490. // PageSize: Optional. The maximum number of results to return from this
  491. // request. Non-positive values are ignored. The presence of
  492. // next_page_token in the response indicates that more results might be
  493. // available.
  494. PageSize int64 `json:"pageSize,omitempty"`
  495. // PageToken: Optional. If present, then retrieve the next batch of
  496. // results from the preceding call to this method. page_token must be
  497. // the value of next_page_token from the previous response. The values
  498. // of other method parameters should be identical to those in the
  499. // previous call.
  500. PageToken string `json:"pageToken,omitempty"`
  501. // ProjectIds: Deprecated. Use resource_names instead. One or more
  502. // project identifiers or project numbers from which to retrieve log
  503. // entries. Example: "my-project-1A".
  504. ProjectIds []string `json:"projectIds,omitempty"`
  505. // ResourceNames: Required. Names of one or more parent resources from
  506. // which to retrieve log
  507. // entries:
  508. // "projects/[PROJECT_ID]"
  509. // "organizations/[ORGANIZATION_ID]"
  510. // "bi
  511. // llingAccounts/[BILLING_ACCOUNT_ID]"
  512. // "folders/[FOLDER_ID]"
  513. // Projects listed in the project_ids field are added to this list.
  514. ResourceNames []string `json:"resourceNames,omitempty"`
  515. // ForceSendFields is a list of field names (e.g. "Filter") to
  516. // unconditionally include in API requests. By default, fields with
  517. // empty values are omitted from API requests. However, any non-pointer,
  518. // non-interface field appearing in ForceSendFields will be sent to the
  519. // server regardless of whether the field is empty or not. This may be
  520. // used to include empty fields in Patch requests.
  521. ForceSendFields []string `json:"-"`
  522. // NullFields is a list of field names (e.g. "Filter") to include in API
  523. // requests with the JSON null value. By default, fields with empty
  524. // values are omitted from API requests. However, any field with an
  525. // empty value appearing in NullFields will be sent to the server as
  526. // null. It is an error if a field in this list has a non-empty value.
  527. // This may be used to include null fields in Patch requests.
  528. NullFields []string `json:"-"`
  529. }
  530. func (s *ListLogEntriesRequest) MarshalJSON() ([]byte, error) {
  531. type NoMethod ListLogEntriesRequest
  532. raw := NoMethod(*s)
  533. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  534. }
  535. // ListLogEntriesResponse: Result returned from ListLogEntries.
  536. type ListLogEntriesResponse struct {
  537. // Entries: A list of log entries. If entries is empty, nextPageToken
  538. // may still be returned, indicating that more entries may exist. See
  539. // nextPageToken for more information.
  540. Entries []*LogEntry `json:"entries,omitempty"`
  541. // NextPageToken: If there might be more results than those appearing in
  542. // this response, then nextPageToken is included. To get the next set of
  543. // results, call this method again using the value of nextPageToken as
  544. // pageToken.If a value for next_page_token appears and the entries
  545. // field is empty, it means that the search found no log entries so far
  546. // but it did not have time to search all the possible log entries.
  547. // Retry the method with this value for page_token to continue the
  548. // search. Alternatively, consider speeding up the search by changing
  549. // your filter to specify a single log name or resource type, or to
  550. // narrow the time range of the search.
  551. NextPageToken string `json:"nextPageToken,omitempty"`
  552. // ServerResponse contains the HTTP response code and headers from the
  553. // server.
  554. googleapi.ServerResponse `json:"-"`
  555. // ForceSendFields is a list of field names (e.g. "Entries") to
  556. // unconditionally include in API requests. By default, fields with
  557. // empty values are omitted from API requests. However, any non-pointer,
  558. // non-interface field appearing in ForceSendFields will be sent to the
  559. // server regardless of whether the field is empty or not. This may be
  560. // used to include empty fields in Patch requests.
  561. ForceSendFields []string `json:"-"`
  562. // NullFields is a list of field names (e.g. "Entries") to include in
  563. // API requests with the JSON null value. By default, fields with empty
  564. // values are omitted from API requests. However, any field with an
  565. // empty value appearing in NullFields will be sent to the server as
  566. // null. It is an error if a field in this list has a non-empty value.
  567. // This may be used to include null fields in Patch requests.
  568. NullFields []string `json:"-"`
  569. }
  570. func (s *ListLogEntriesResponse) MarshalJSON() ([]byte, error) {
  571. type NoMethod ListLogEntriesResponse
  572. raw := NoMethod(*s)
  573. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  574. }
  575. // ListLogMetricsResponse: Result returned from ListLogMetrics.
  576. type ListLogMetricsResponse struct {
  577. // Metrics: A list of logs-based metrics.
  578. Metrics []*LogMetric `json:"metrics,omitempty"`
  579. // NextPageToken: If there might be more results than appear in this
  580. // response, then nextPageToken is included. To get the next set of
  581. // results, call this method again using the value of nextPageToken as
  582. // pageToken.
  583. NextPageToken string `json:"nextPageToken,omitempty"`
  584. // ServerResponse contains the HTTP response code and headers from the
  585. // server.
  586. googleapi.ServerResponse `json:"-"`
  587. // ForceSendFields is a list of field names (e.g. "Metrics") to
  588. // unconditionally include in API requests. By default, fields with
  589. // empty values are omitted from API requests. However, any non-pointer,
  590. // non-interface field appearing in ForceSendFields will be sent to the
  591. // server regardless of whether the field is empty or not. This may be
  592. // used to include empty fields in Patch requests.
  593. ForceSendFields []string `json:"-"`
  594. // NullFields is a list of field names (e.g. "Metrics") to include in
  595. // API requests with the JSON null value. By default, fields with empty
  596. // values are omitted from API requests. However, any field with an
  597. // empty value appearing in NullFields will be sent to the server as
  598. // null. It is an error if a field in this list has a non-empty value.
  599. // This may be used to include null fields in Patch requests.
  600. NullFields []string `json:"-"`
  601. }
  602. func (s *ListLogMetricsResponse) MarshalJSON() ([]byte, error) {
  603. type NoMethod ListLogMetricsResponse
  604. raw := NoMethod(*s)
  605. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  606. }
  607. // ListMonitoredResourceDescriptorsResponse: Result returned from
  608. // ListMonitoredResourceDescriptors.
  609. type ListMonitoredResourceDescriptorsResponse struct {
  610. // NextPageToken: If there might be more results than those appearing in
  611. // this response, then nextPageToken is included. To get the next set of
  612. // results, call this method again using the value of nextPageToken as
  613. // pageToken.
  614. NextPageToken string `json:"nextPageToken,omitempty"`
  615. // ResourceDescriptors: A list of resource descriptors.
  616. ResourceDescriptors []*MonitoredResourceDescriptor `json:"resourceDescriptors,omitempty"`
  617. // ServerResponse contains the HTTP response code and headers from the
  618. // server.
  619. googleapi.ServerResponse `json:"-"`
  620. // ForceSendFields is a list of field names (e.g. "NextPageToken") to
  621. // unconditionally include in API requests. By default, fields with
  622. // empty values are omitted from API requests. However, any non-pointer,
  623. // non-interface field appearing in ForceSendFields will be sent to the
  624. // server regardless of whether the field is empty or not. This may be
  625. // used to include empty fields in Patch requests.
  626. ForceSendFields []string `json:"-"`
  627. // NullFields is a list of field names (e.g. "NextPageToken") to include
  628. // in API requests with the JSON null value. By default, fields with
  629. // empty values are omitted from API requests. However, any field with
  630. // an empty value appearing in NullFields will be sent to the server as
  631. // null. It is an error if a field in this list has a non-empty value.
  632. // This may be used to include null fields in Patch requests.
  633. NullFields []string `json:"-"`
  634. }
  635. func (s *ListMonitoredResourceDescriptorsResponse) MarshalJSON() ([]byte, error) {
  636. type NoMethod ListMonitoredResourceDescriptorsResponse
  637. raw := NoMethod(*s)
  638. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  639. }
  640. // ListSinksResponse: Result returned from ListSinks.
  641. type ListSinksResponse struct {
  642. // NextPageToken: If there might be more results than appear in this
  643. // response, then nextPageToken is included. To get the next set of
  644. // results, call the same method again using the value of nextPageToken
  645. // as pageToken.
  646. NextPageToken string `json:"nextPageToken,omitempty"`
  647. // Sinks: A list of sinks.
  648. Sinks []*LogSink `json:"sinks,omitempty"`
  649. // ServerResponse contains the HTTP response code and headers from the
  650. // server.
  651. googleapi.ServerResponse `json:"-"`
  652. // ForceSendFields is a list of field names (e.g. "NextPageToken") to
  653. // unconditionally include in API requests. By default, fields with
  654. // empty values are omitted from API requests. However, any non-pointer,
  655. // non-interface field appearing in ForceSendFields will be sent to the
  656. // server regardless of whether the field is empty or not. This may be
  657. // used to include empty fields in Patch requests.
  658. ForceSendFields []string `json:"-"`
  659. // NullFields is a list of field names (e.g. "NextPageToken") to include
  660. // in API requests with the JSON null value. By default, fields with
  661. // empty values are omitted from API requests. However, any field with
  662. // an empty value appearing in NullFields will be sent to the server as
  663. // null. It is an error if a field in this list has a non-empty value.
  664. // This may be used to include null fields in Patch requests.
  665. NullFields []string `json:"-"`
  666. }
  667. func (s *ListSinksResponse) MarshalJSON() ([]byte, error) {
  668. type NoMethod ListSinksResponse
  669. raw := NoMethod(*s)
  670. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  671. }
  672. // LogEntry: An individual entry in a log.
  673. type LogEntry struct {
  674. // HttpRequest: Optional. Information about the HTTP request associated
  675. // with this log entry, if applicable.
  676. HttpRequest *HttpRequest `json:"httpRequest,omitempty"`
  677. // InsertId: Optional. A unique identifier for the log entry. If you
  678. // provide a value, then Logging considers other log entries in the same
  679. // project, with the same timestamp, and with the same insert_id to be
  680. // duplicates which can be removed. If omitted in new log entries, then
  681. // Logging assigns its own unique identifier. The insert_id is also used
  682. // to order log entries that have the same timestamp value.
  683. InsertId string `json:"insertId,omitempty"`
  684. // JsonPayload: The log entry payload, represented as a structure that
  685. // is expressed as a JSON object.
  686. JsonPayload googleapi.RawMessage `json:"jsonPayload,omitempty"`
  687. // Labels: Optional. A set of user-defined (key, value) data that
  688. // provides additional information about the log entry.
  689. Labels map[string]string `json:"labels,omitempty"`
  690. // LogName: Required. The resource name of the log to which this log
  691. // entry
  692. // belongs:
  693. // "projects/[PROJECT_ID]/logs/[LOG_ID]"
  694. // "organizations/[ORGANIZ
  695. // ATION_ID]/logs/[LOG_ID]"
  696. // "billingAccounts/[BILLING_ACCOUNT_ID]/logs/[L
  697. // OG_ID]"
  698. // "folders/[FOLDER_ID]/logs/[LOG_ID]"
  699. // A project number may optionally be used in place of PROJECT_ID. The
  700. // project number is translated to its corresponding PROJECT_ID
  701. // internally and the log_name field will contain PROJECT_ID in queries
  702. // and exports.[LOG_ID] must be URL-encoded within log_name. Example:
  703. // "organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Fa
  704. // ctivity". [LOG_ID] must be less than 512 characters long and can only
  705. // include the following characters: upper and lower case alphanumeric
  706. // characters, forward-slash, underscore, hyphen, and period.For
  707. // backward compatibility, if log_name begins with a forward-slash, such
  708. // as /projects/..., then the log entry is ingested as usual but the
  709. // forward-slash is removed. Listing the log entry will not show the
  710. // leading slash and filtering for a log name with a leading slash will
  711. // never return any results.
  712. LogName string `json:"logName,omitempty"`
  713. // Metadata: Deprecated. Output only. Additional metadata about the
  714. // monitored resource.Only k8s_container, k8s_pod, and k8s_node
  715. // MonitoredResources have this field populated for GKE versions older
  716. // than 1.12.6. For GKE versions 1.12.6 and above, the metadata field
  717. // has been deprecated. The Kubernetes pod labels that used to be in
  718. // metadata.userLabels will now be present in the labels field with a
  719. // key prefix of k8s-pod/. The Stackdriver system labels that were
  720. // present in the metadata.systemLabels field will no longer be
  721. // available in the LogEntry.
  722. Metadata *MonitoredResourceMetadata `json:"metadata,omitempty"`
  723. // Operation: Optional. Information about an operation associated with
  724. // the log entry, if applicable.
  725. Operation *LogEntryOperation `json:"operation,omitempty"`
  726. // ProtoPayload: The log entry payload, represented as a protocol
  727. // buffer. Some Google Cloud Platform services use this field for their
  728. // log entry payloads.
  729. ProtoPayload googleapi.RawMessage `json:"protoPayload,omitempty"`
  730. // ReceiveTimestamp: Output only. The time the log entry was received by
  731. // Logging.
  732. ReceiveTimestamp string `json:"receiveTimestamp,omitempty"`
  733. // Resource: Required. The primary monitored resource associated with
  734. // this log entry.Example: a log entry that reports a database error
  735. // would be associated with the monitored resource designating the
  736. // particular database that reported the error.
  737. Resource *MonitoredResource `json:"resource,omitempty"`
  738. // Severity: Optional. The severity of the log entry. The default value
  739. // is LogSeverity.DEFAULT.
  740. //
  741. // Possible values:
  742. // "DEFAULT" - (0) The log entry has no assigned severity level.
  743. // "DEBUG" - (100) Debug or trace information.
  744. // "INFO" - (200) Routine information, such as ongoing status or
  745. // performance.
  746. // "NOTICE" - (300) Normal but significant events, such as start up,
  747. // shut down, or a configuration change.
  748. // "WARNING" - (400) Warning events might cause problems.
  749. // "ERROR" - (500) Error events are likely to cause problems.
  750. // "CRITICAL" - (600) Critical events cause more severe problems or
  751. // outages.
  752. // "ALERT" - (700) A person must take an action immediately.
  753. // "EMERGENCY" - (800) One or more systems are unusable.
  754. Severity string `json:"severity,omitempty"`
  755. // SourceLocation: Optional. Source code location information associated
  756. // with the log entry, if any.
  757. SourceLocation *LogEntrySourceLocation `json:"sourceLocation,omitempty"`
  758. // SpanId: Optional. The span ID within the trace associated with the
  759. // log entry.For Trace spans, this is the same format that the Trace API
  760. // v2 uses: a 16-character hexadecimal encoding of an 8-byte array, such
  761. // as <code>"000000000000004a"</code>.
  762. SpanId string `json:"spanId,omitempty"`
  763. // TextPayload: The log entry payload, represented as a Unicode string
  764. // (UTF-8).
  765. TextPayload string `json:"textPayload,omitempty"`
  766. // Timestamp: Optional. The time the event described by the log entry
  767. // occurred. This time is used to compute the log entry's age and to
  768. // enforce the logs retention period. If this field is omitted in a new
  769. // log entry, then Logging assigns it the current time. Timestamps have
  770. // nanosecond accuracy, but trailing zeros in the fractional seconds
  771. // might be omitted when the timestamp is displayed.Incoming log entries
  772. // should have timestamps that are no more than the logs retention
  773. // period in the past, and no more than 24 hours in the future. Log
  774. // entries outside those time boundaries will not be available when
  775. // calling entries.list, but those log entries can still be exported
  776. // with LogSinks.
  777. Timestamp string `json:"timestamp,omitempty"`
  778. // Trace: Optional. Resource name of the trace associated with the log
  779. // entry, if any. If it contains a relative resource name, the name is
  780. // assumed to be relative to //tracing.googleapis.com. Example:
  781. // projects/my-projectid/traces/06796866738c859f2f19b7cfb3214824
  782. Trace string `json:"trace,omitempty"`
  783. // TraceSampled: Optional. The sampling decision of the trace associated
  784. // with the log entry.True means that the trace resource name in the
  785. // trace field was sampled for storage in a trace backend. False means
  786. // that the trace was not sampled for storage when this log entry was
  787. // written, or the sampling decision was unknown at the time. A
  788. // non-sampled trace value is still useful as a request correlation
  789. // identifier. The default is False.
  790. TraceSampled bool `json:"traceSampled,omitempty"`
  791. // ForceSendFields is a list of field names (e.g. "HttpRequest") to
  792. // unconditionally include in API requests. By default, fields with
  793. // empty values are omitted from API requests. However, any non-pointer,
  794. // non-interface field appearing in ForceSendFields will be sent to the
  795. // server regardless of whether the field is empty or not. This may be
  796. // used to include empty fields in Patch requests.
  797. ForceSendFields []string `json:"-"`
  798. // NullFields is a list of field names (e.g. "HttpRequest") to include
  799. // in API requests with the JSON null value. By default, fields with
  800. // empty values are omitted from API requests. However, any field with
  801. // an empty value appearing in NullFields will be sent to the server as
  802. // null. It is an error if a field in this list has a non-empty value.
  803. // This may be used to include null fields in Patch requests.
  804. NullFields []string `json:"-"`
  805. }
  806. func (s *LogEntry) MarshalJSON() ([]byte, error) {
  807. type NoMethod LogEntry
  808. raw := NoMethod(*s)
  809. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  810. }
  811. // LogEntryOperation: Additional information about a potentially
  812. // long-running operation with which a log entry is associated.
  813. type LogEntryOperation struct {
  814. // First: Optional. Set this to True if this is the first log entry in
  815. // the operation.
  816. First bool `json:"first,omitempty"`
  817. // Id: Optional. An arbitrary operation identifier. Log entries with the
  818. // same identifier are assumed to be part of the same operation.
  819. Id string `json:"id,omitempty"`
  820. // Last: Optional. Set this to True if this is the last log entry in the
  821. // operation.
  822. Last bool `json:"last,omitempty"`
  823. // Producer: Optional. An arbitrary producer identifier. The combination
  824. // of id and producer must be globally unique. Examples for producer:
  825. // "MyDivision.MyBigCompany.com", "github.com/MyProject/MyApplication".
  826. Producer string `json:"producer,omitempty"`
  827. // ForceSendFields is a list of field names (e.g. "First") to
  828. // unconditionally include in API requests. By default, fields with
  829. // empty values are omitted from API requests. However, any non-pointer,
  830. // non-interface field appearing in ForceSendFields will be sent to the
  831. // server regardless of whether the field is empty or not. This may be
  832. // used to include empty fields in Patch requests.
  833. ForceSendFields []string `json:"-"`
  834. // NullFields is a list of field names (e.g. "First") to include in API
  835. // requests with the JSON null value. By default, fields with empty
  836. // values are omitted from API requests. However, any field with an
  837. // empty value appearing in NullFields will be sent to the server as
  838. // null. It is an error if a field in this list has a non-empty value.
  839. // This may be used to include null fields in Patch requests.
  840. NullFields []string `json:"-"`
  841. }
  842. func (s *LogEntryOperation) MarshalJSON() ([]byte, error) {
  843. type NoMethod LogEntryOperation
  844. raw := NoMethod(*s)
  845. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  846. }
  847. // LogEntrySourceLocation: Additional information about the source code
  848. // location that produced the log entry.
  849. type LogEntrySourceLocation struct {
  850. // File: Optional. Source file name. Depending on the runtime
  851. // environment, this might be a simple name or a fully-qualified name.
  852. File string `json:"file,omitempty"`
  853. // Function: Optional. Human-readable name of the function or method
  854. // being invoked, with optional context such as the class or package
  855. // name. This information may be used in contexts such as the logs
  856. // viewer, where a file and line number are less meaningful. The format
  857. // can vary by language. For example: qual.if.ied.Class.method (Java),
  858. // dir/package.func (Go), function (Python).
  859. Function string `json:"function,omitempty"`
  860. // Line: Optional. Line within the source file. 1-based; 0 indicates no
  861. // line number available.
  862. Line int64 `json:"line,omitempty,string"`
  863. // ForceSendFields is a list of field names (e.g. "File") to
  864. // unconditionally include in API requests. By default, fields with
  865. // empty values are omitted from API requests. However, any non-pointer,
  866. // non-interface field appearing in ForceSendFields will be sent to the
  867. // server regardless of whether the field is empty or not. This may be
  868. // used to include empty fields in Patch requests.
  869. ForceSendFields []string `json:"-"`
  870. // NullFields is a list of field names (e.g. "File") to include in API
  871. // requests with the JSON null value. By default, fields with empty
  872. // values are omitted from API requests. However, any field with an
  873. // empty value appearing in NullFields will be sent to the server as
  874. // null. It is an error if a field in this list has a non-empty value.
  875. // This may be used to include null fields in Patch requests.
  876. NullFields []string `json:"-"`
  877. }
  878. func (s *LogEntrySourceLocation) MarshalJSON() ([]byte, error) {
  879. type NoMethod LogEntrySourceLocation
  880. raw := NoMethod(*s)
  881. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  882. }
  883. // LogLine: Application log line emitted while processing a request.
  884. type LogLine struct {
  885. // LogMessage: App-provided log message.
  886. LogMessage string `json:"logMessage,omitempty"`
  887. // Severity: Severity of this log entry.
  888. //
  889. // Possible values:
  890. // "DEFAULT" - (0) The log entry has no assigned severity level.
  891. // "DEBUG" - (100) Debug or trace information.
  892. // "INFO" - (200) Routine information, such as ongoing status or
  893. // performance.
  894. // "NOTICE" - (300) Normal but significant events, such as start up,
  895. // shut down, or a configuration change.
  896. // "WARNING" - (400) Warning events might cause problems.
  897. // "ERROR" - (500) Error events are likely to cause problems.
  898. // "CRITICAL" - (600) Critical events cause more severe problems or
  899. // outages.
  900. // "ALERT" - (700) A person must take an action immediately.
  901. // "EMERGENCY" - (800) One or more systems are unusable.
  902. Severity string `json:"severity,omitempty"`
  903. // SourceLocation: Where in the source code this log message was
  904. // written.
  905. SourceLocation *SourceLocation `json:"sourceLocation,omitempty"`
  906. // Time: Approximate time when this log entry was made.
  907. Time string `json:"time,omitempty"`
  908. // ForceSendFields is a list of field names (e.g. "LogMessage") to
  909. // unconditionally include in API requests. By default, fields with
  910. // empty values are omitted from API requests. However, any non-pointer,
  911. // non-interface field appearing in ForceSendFields will be sent to the
  912. // server regardless of whether the field is empty or not. This may be
  913. // used to include empty fields in Patch requests.
  914. ForceSendFields []string `json:"-"`
  915. // NullFields is a list of field names (e.g. "LogMessage") to include in
  916. // API requests with the JSON null value. By default, fields with empty
  917. // values are omitted from API requests. However, any field with an
  918. // empty value appearing in NullFields will be sent to the server as
  919. // null. It is an error if a field in this list has a non-empty value.
  920. // This may be used to include null fields in Patch requests.
  921. NullFields []string `json:"-"`
  922. }
  923. func (s *LogLine) MarshalJSON() ([]byte, error) {
  924. type NoMethod LogLine
  925. raw := NoMethod(*s)
  926. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  927. }
  928. // LogMetric: Describes a logs-based metric. The value of the metric is
  929. // the number of log entries that match a logs filter in a given time
  930. // interval.Logs-based metric can also be used to extract values from
  931. // logs and create a a distribution of the values. The distribution
  932. // records the statistics of the extracted values along with an optional
  933. // histogram of the values as specified by the bucket options.
  934. type LogMetric struct {
  935. // BucketOptions: Optional. The bucket_options are required when the
  936. // logs-based metric is using a DISTRIBUTION value type and it describes
  937. // the bucket boundaries used to create a histogram of the extracted
  938. // values.
  939. BucketOptions *BucketOptions `json:"bucketOptions,omitempty"`
  940. // CreateTime: Output only. The creation timestamp of the metric.This
  941. // field may not be present for older metrics.
  942. CreateTime string `json:"createTime,omitempty"`
  943. // Description: Optional. A description of this metric, which is used in
  944. // documentation. The maximum length of the description is 8000
  945. // characters.
  946. Description string `json:"description,omitempty"`
  947. // Filter: Required. An advanced logs filter which is used to match log
  948. // entries. Example:
  949. // "resource.type=gae_app AND severity>=ERROR"
  950. // The maximum length of the filter is 20000 characters.
  951. Filter string `json:"filter,omitempty"`
  952. // LabelExtractors: Optional. A map from a label key string to an
  953. // extractor expression which is used to extract data from a log entry
  954. // field and assign as the label value. Each label key specified in the
  955. // LabelDescriptor must have an associated extractor expression in this
  956. // map. The syntax of the extractor expression is the same as for the
  957. // value_extractor field.The extracted value is converted to the type
  958. // defined in the label descriptor. If the either the extraction or the
  959. // type conversion fails, the label will have a default value. The
  960. // default value for a string label is an empty string, for an integer
  961. // label its 0, and for a boolean label its false.Note that there are
  962. // upper bounds on the maximum number of labels and the number of active
  963. // time series that are allowed in a project.
  964. LabelExtractors map[string]string `json:"labelExtractors,omitempty"`
  965. // MetricDescriptor: Optional. The metric descriptor associated with the
  966. // logs-based metric. If unspecified, it uses a default metric
  967. // descriptor with a DELTA metric kind, INT64 value type, with no labels
  968. // and a unit of "1". Such a metric counts the number of log entries
  969. // matching the filter expression.The name, type, and description fields
  970. // in the metric_descriptor are output only, and is constructed using
  971. // the name and description field in the LogMetric.To create a
  972. // logs-based metric that records a distribution of log values, a DELTA
  973. // metric kind with a DISTRIBUTION value type must be used along with a
  974. // value_extractor expression in the LogMetric.Each label in the metric
  975. // descriptor must have a matching label name as the key and an
  976. // extractor expression as the value in the label_extractors map.The
  977. // metric_kind and value_type fields in the metric_descriptor cannot be
  978. // updated once initially configured. New labels can be added in the
  979. // metric_descriptor, but existing labels cannot be modified except for
  980. // their description.
  981. MetricDescriptor *MetricDescriptor `json:"metricDescriptor,omitempty"`
  982. // Name: Required. The client-assigned metric identifier. Examples:
  983. // "error_count", "nginx/requests".Metric identifiers are limited to 100
  984. // characters and can include only the following characters: A-Z, a-z,
  985. // 0-9, and the special characters _-.,+!*',()%/. The forward-slash
  986. // character (/) denotes a hierarchy of name pieces, and it cannot be
  987. // the first character of the name.The metric identifier in this field
  988. // must not be URL-encoded
  989. // (https://en.wikipedia.org/wiki/Percent-encoding). However, when the
  990. // metric identifier appears as the [METRIC_ID] part of a metric_name
  991. // API parameter, then the metric identifier must be URL-encoded.
  992. // Example: "projects/my-project/metrics/nginx%2Frequests".
  993. Name string `json:"name,omitempty"`
  994. // UpdateTime: Output only. The last update timestamp of the metric.This
  995. // field may not be present for older metrics.
  996. UpdateTime string `json:"updateTime,omitempty"`
  997. // ValueExtractor: Optional. A value_extractor is required when using a
  998. // distribution logs-based metric to extract the values to record from a
  999. // log entry. Two functions are supported for value extraction:
  1000. // EXTRACT(field) or REGEXP_EXTRACT(field, regex). The argument are: 1.
  1001. // field: The name of the log entry field from which the value is to be
  1002. // extracted. 2. regex: A regular expression using the Google RE2
  1003. // syntax (https://github.com/google/re2/wiki/Syntax) with a single
  1004. // capture group to extract data from the specified log entry field.
  1005. // The value of the field is converted to a string before applying the
  1006. // regex. It is an error to specify a regex that does not include
  1007. // exactly one capture group.The result of the extraction must be
  1008. // convertible to a double type, as the distribution always records
  1009. // double values. If either the extraction or the conversion to double
  1010. // fails, then those values are not recorded in the
  1011. // distribution.Example: REGEXP_EXTRACT(jsonPayload.request,
  1012. // ".*quantity=(\d+).*")
  1013. ValueExtractor string `json:"valueExtractor,omitempty"`
  1014. // Version: Deprecated. The API version that created or updated this
  1015. // metric. The v2 format is used by default and cannot be changed.
  1016. //
  1017. // Possible values:
  1018. // "V2" - Logging API v2.
  1019. // "V1" - Logging API v1.
  1020. Version string `json:"version,omitempty"`
  1021. // ServerResponse contains the HTTP response code and headers from the
  1022. // server.
  1023. googleapi.ServerResponse `json:"-"`
  1024. // ForceSendFields is a list of field names (e.g. "BucketOptions") to
  1025. // unconditionally include in API requests. By default, fields with
  1026. // empty values are omitted from API requests. However, any non-pointer,
  1027. // non-interface field appearing in ForceSendFields will be sent to the
  1028. // server regardless of whether the field is empty or not. This may be
  1029. // used to include empty fields in Patch requests.
  1030. ForceSendFields []string `json:"-"`
  1031. // NullFields is a list of field names (e.g. "BucketOptions") to include
  1032. // in API requests with the JSON null value. By default, fields with
  1033. // empty values are omitted from API requests. However, any field with
  1034. // an empty value appearing in NullFields will be sent to the server as
  1035. // null. It is an error if a field in this list has a non-empty value.
  1036. // This may be used to include null fields in Patch requests.
  1037. NullFields []string `json:"-"`
  1038. }
  1039. func (s *LogMetric) MarshalJSON() ([]byte, error) {
  1040. type NoMethod LogMetric
  1041. raw := NoMethod(*s)
  1042. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1043. }
  1044. // LogSink: Describes a sink used to export log entries to one of the
  1045. // following destinations in any project: a Cloud Storage bucket, a
  1046. // BigQuery dataset, or a Cloud Pub/Sub topic. A logs filter controls
  1047. // which log entries are exported. The sink must be created within a
  1048. // project, organization, billing account, or folder.
  1049. type LogSink struct {
  1050. // CreateTime: Output only. The creation timestamp of the sink.This
  1051. // field may not be present for older sinks.
  1052. CreateTime string `json:"createTime,omitempty"`
  1053. // Destination: Required. The export
  1054. // destination:
  1055. // "storage.googleapis.com/[GCS_BUCKET]"
  1056. // "bigquery.googleapi
  1057. // s.com/projects/[PROJECT_ID]/datasets/[DATASET]"
  1058. // "pubsub.googleapis.com
  1059. // /projects/[PROJECT_ID]/topics/[TOPIC_ID]"
  1060. // The sink's writer_identity, set when the sink is created, must have
  1061. // permission to write to the destination or else the log entries are
  1062. // not exported. For more information, see Exporting Logs with Sinks.
  1063. Destination string `json:"destination,omitempty"`
  1064. // Filter: Optional. An advanced logs filter. The only exported log
  1065. // entries are those that are in the resource owning the sink and that
  1066. // match the filter. For
  1067. // example:
  1068. // logName="projects/[PROJECT_ID]/logs/[LOG_ID]" AND severity>=ERROR
  1069. //
  1070. Filter string `json:"filter,omitempty"`
  1071. // IncludeChildren: Optional. This field applies only to sinks owned by
  1072. // organizations and folders. If the field is false, the default, only
  1073. // the logs owned by the sink's parent resource are available for
  1074. // export. If the field is true, then logs from all the projects,
  1075. // folders, and billing accounts contained in the sink's parent resource
  1076. // are also available for export. Whether a particular log entry from
  1077. // the children is exported depends on the sink's filter expression. For
  1078. // example, if this field is true, then the filter
  1079. // resource.type=gce_instance would export all Compute Engine VM
  1080. // instance log entries from all projects in the sink's parent. To only
  1081. // export entries from certain child projects, filter on the project
  1082. // part of the log name:
  1083. // logName:("projects/test-project1/" OR "projects/test-project2/")
  1084. // AND
  1085. // resource.type=gce_instance
  1086. //
  1087. IncludeChildren bool `json:"includeChildren,omitempty"`
  1088. // Name: Required. The client-assigned sink identifier, unique within
  1089. // the project. Example: "my-syslog-errors-to-pubsub". Sink identifiers
  1090. // are limited to 100 characters and can include only the following
  1091. // characters: upper and lower-case alphanumeric characters,
  1092. // underscores, hyphens, and periods.
  1093. Name string `json:"name,omitempty"`
  1094. // OutputVersionFormat: Deprecated. The log entry format to use for this
  1095. // sink's exported log entries. The v2 format is used by default and
  1096. // cannot be changed.
  1097. //
  1098. // Possible values:
  1099. // "VERSION_FORMAT_UNSPECIFIED" - An unspecified format version that
  1100. // will default to V2.
  1101. // "V2" - LogEntry version 2 format.
  1102. // "V1" - LogEntry version 1 format.
  1103. OutputVersionFormat string `json:"outputVersionFormat,omitempty"`
  1104. // UpdateTime: Output only. The last update timestamp of the sink.This
  1105. // field may not be present for older sinks.
  1106. UpdateTime string `json:"updateTime,omitempty"`
  1107. // WriterIdentity: Output only. An IAM identity&mdash;a service account
  1108. // or group&mdash;under which Logging writes the exported log entries to
  1109. // the sink's destination. This field is set by sinks.create and
  1110. // sinks.update based on the value of unique_writer_identity in those
  1111. // methods.Until you grant this identity write-access to the
  1112. // destination, log entry exports from this sink will fail. For more
  1113. // information, see Granting Access for a Resource. Consult the
  1114. // destination service's documentation to determine the appropriate IAM
  1115. // roles to assign to the identity.
  1116. WriterIdentity string `json:"writerIdentity,omitempty"`
  1117. // ServerResponse contains the HTTP response code and headers from the
  1118. // server.
  1119. googleapi.ServerResponse `json:"-"`
  1120. // ForceSendFields is a list of field names (e.g. "CreateTime") to
  1121. // unconditionally include in API requests. By default, fields with
  1122. // empty values are omitted from API requests. However, any non-pointer,
  1123. // non-interface field appearing in ForceSendFields will be sent to the
  1124. // server regardless of whether the field is empty or not. This may be
  1125. // used to include empty fields in Patch requests.
  1126. ForceSendFields []string `json:"-"`
  1127. // NullFields is a list of field names (e.g. "CreateTime") to include in
  1128. // API requests with the JSON null value. By default, fields with empty
  1129. // values are omitted from API requests. However, any field with an
  1130. // empty value appearing in NullFields will be sent to the server as
  1131. // null. It is an error if a field in this list has a non-empty value.
  1132. // This may be used to include null fields in Patch requests.
  1133. NullFields []string `json:"-"`
  1134. }
  1135. func (s *LogSink) MarshalJSON() ([]byte, error) {
  1136. type NoMethod LogSink
  1137. raw := NoMethod(*s)
  1138. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1139. }
  1140. // MetricDescriptor: Defines a metric type and its schema. Once a metric
  1141. // descriptor is created, deleting or altering it stops data collection
  1142. // and makes the metric type's existing data unusable.
  1143. type MetricDescriptor struct {
  1144. // Description: A detailed description of the metric, which can be used
  1145. // in documentation.
  1146. Description string `json:"description,omitempty"`
  1147. // DisplayName: A concise name for the metric, which can be displayed in
  1148. // user interfaces. Use sentence case without an ending period, for
  1149. // example "Request count". This field is optional but it is recommended
  1150. // to be set for any metrics associated with user-visible concepts, such
  1151. // as Quota.
  1152. DisplayName string `json:"displayName,omitempty"`
  1153. // Labels: The set of labels that can be used to describe a specific
  1154. // instance of this metric type. For example, the
  1155. // appengine.googleapis.com/http/server/response_latencies metric type
  1156. // has a label for the HTTP response code, response_code, so you can
  1157. // look at latencies for successful responses or just for responses that
  1158. // failed.
  1159. Labels []*LabelDescriptor `json:"labels,omitempty"`
  1160. // Metadata: Optional. Metadata which can be used to guide usage of the
  1161. // metric.
  1162. Metadata *MetricDescriptorMetadata `json:"metadata,omitempty"`
  1163. // MetricKind: Whether the metric records instantaneous values, changes
  1164. // to a value, etc. Some combinations of metric_kind and value_type
  1165. // might not be supported.
  1166. //
  1167. // Possible values:
  1168. // "METRIC_KIND_UNSPECIFIED" - Do not use this default value.
  1169. // "GAUGE" - An instantaneous measurement of a value.
  1170. // "DELTA" - The change in a value during a time interval.
  1171. // "CUMULATIVE" - A value accumulated over a time interval. Cumulative
  1172. // measurements in a time series should have the same start time and
  1173. // increasing end times, until an event resets the cumulative value to
  1174. // zero and sets a new start time for the following points.
  1175. MetricKind string `json:"metricKind,omitempty"`
  1176. // Name: The resource name of the metric descriptor.
  1177. Name string `json:"name,omitempty"`
  1178. // Type: The metric type, including its DNS name prefix. The type is not
  1179. // URL-encoded. All user-defined metric types have the DNS name
  1180. // custom.googleapis.com or external.googleapis.com. Metric types should
  1181. // use a natural hierarchical grouping. For
  1182. // example:
  1183. // "custom.googleapis.com/invoice/paid/amount"
  1184. // "external.googlea
  1185. // pis.com/prometheus/up"
  1186. // "appengine.googleapis.com/http/server/response_
  1187. // latencies"
  1188. //
  1189. Type string `json:"type,omitempty"`
  1190. // Unit: The unit in which the metric value is reported. It is only
  1191. // applicable if the value_type is INT64, DOUBLE, or DISTRIBUTION. The
  1192. // supported units are a subset of The Unified Code for Units of Measure
  1193. // (http://unitsofmeasure.org/ucum.html) standard:Basic units (UNIT)
  1194. // bit bit
  1195. // By byte
  1196. // s second
  1197. // min minute
  1198. // h hour
  1199. // d dayPrefixes (PREFIX)
  1200. // k kilo (10**3)
  1201. // M mega (10**6)
  1202. // G giga (10**9)
  1203. // T tera (10**12)
  1204. // P peta (10**15)
  1205. // E exa (10**18)
  1206. // Z zetta (10**21)
  1207. // Y yotta (10**24)
  1208. // m milli (10**-3)
  1209. // u micro (10**-6)
  1210. // n nano (10**-9)
  1211. // p pico (10**-12)
  1212. // f femto (10**-15)
  1213. // a atto (10**-18)
  1214. // z zepto (10**-21)
  1215. // y yocto (10**-24)
  1216. // Ki kibi (2**10)
  1217. // Mi mebi (2**20)
  1218. // Gi gibi (2**30)
  1219. // Ti tebi (2**40)GrammarThe grammar also includes these connectors:
  1220. // / division (as an infix operator, e.g. 1/s).
  1221. // . multiplication (as an infix operator, e.g. GBy.d)The grammar for a
  1222. // unit is as follows:
  1223. // Expression = Component { "." Component } { "/" Component }
  1224. // ;
  1225. //
  1226. // Component = ( [ PREFIX ] UNIT | "%" ) [ Annotation ]
  1227. // | Annotation
  1228. // | "1"
  1229. // ;
  1230. //
  1231. // Annotation = "{" NAME "}" ;
  1232. // Notes:
  1233. // Annotation is just a comment if it follows a UNIT and is equivalent
  1234. // to 1 if it is used alone. For examples, {requests}/s == 1/s,
  1235. // By{transmitted}/s == By/s.
  1236. // NAME is a sequence of non-blank printable ASCII characters not
  1237. // containing '{' or '}'.
  1238. // 1 represents dimensionless value 1, such as in 1/s.
  1239. // % represents dimensionless value 1/100, and annotates values giving
  1240. // a percentage.
  1241. Unit string `json:"unit,omitempty"`
  1242. // ValueType: Whether the measurement is an integer, a floating-point
  1243. // number, etc. Some combinations of metric_kind and value_type might
  1244. // not be supported.
  1245. //
  1246. // Possible values:
  1247. // "VALUE_TYPE_UNSPECIFIED" - Do not use this default value.
  1248. // "BOOL" - The value is a boolean. This value type can be used only
  1249. // if the metric kind is GAUGE.
  1250. // "INT64" - The value is a signed 64-bit integer.
  1251. // "DOUBLE" - The value is a double precision floating point number.
  1252. // "STRING" - The value is a text string. This value type can be used
  1253. // only if the metric kind is GAUGE.
  1254. // "DISTRIBUTION" - The value is a Distribution.
  1255. // "MONEY" - The value is money.
  1256. ValueType string `json:"valueType,omitempty"`
  1257. // ForceSendFields is a list of field names (e.g. "Description") to
  1258. // unconditionally include in API requests. By default, fields with
  1259. // empty values are omitted from API requests. However, any non-pointer,
  1260. // non-interface field appearing in ForceSendFields will be sent to the
  1261. // server regardless of whether the field is empty or not. This may be
  1262. // used to include empty fields in Patch requests.
  1263. ForceSendFields []string `json:"-"`
  1264. // NullFields is a list of field names (e.g. "Description") to include
  1265. // in API requests with the JSON null value. By default, fields with
  1266. // empty values are omitted from API requests. However, any field with
  1267. // an empty value appearing in NullFields will be sent to the server as
  1268. // null. It is an error if a field in this list has a non-empty value.
  1269. // This may be used to include null fields in Patch requests.
  1270. NullFields []string `json:"-"`
  1271. }
  1272. func (s *MetricDescriptor) MarshalJSON() ([]byte, error) {
  1273. type NoMethod MetricDescriptor
  1274. raw := NoMethod(*s)
  1275. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1276. }
  1277. // MetricDescriptorMetadata: Additional annotations that can be used to
  1278. // guide the usage of a metric.
  1279. type MetricDescriptorMetadata struct {
  1280. // IngestDelay: The delay of data points caused by ingestion. Data
  1281. // points older than this age are guaranteed to be ingested and
  1282. // available to be read, excluding data loss due to errors.
  1283. IngestDelay string `json:"ingestDelay,omitempty"`
  1284. // LaunchStage: The launch stage of the metric definition.
  1285. //
  1286. // Possible values:
  1287. // "LAUNCH_STAGE_UNSPECIFIED" - Do not use this default value.
  1288. // "EARLY_ACCESS" - Early Access features are limited to a closed
  1289. // group of testers. To use these features, you must sign up in advance
  1290. // and sign a Trusted Tester agreement (which includes confidentiality
  1291. // provisions). These features may be unstable, changed in
  1292. // backward-incompatible ways, and are not guaranteed to be released.
  1293. // "ALPHA" - Alpha is a limited availability test for releases before
  1294. // they are cleared for widespread use. By Alpha, all significant design
  1295. // issues are resolved and we are in the process of verifying
  1296. // functionality. Alpha customers need to apply for access, agree to
  1297. // applicable terms, and have their projects whitelisted. Alpha releases
  1298. // don’t have to be feature complete, no SLAs are provided, and there
  1299. // are no technical support obligations, but they will be far enough
  1300. // along that customers can actually use them in test environments or
  1301. // for limited-use tests -- just like they would in normal production
  1302. // cases.
  1303. // "BETA" - Beta is the point at which we are ready to open a release
  1304. // for any customer to use. There are no SLA or technical support
  1305. // obligations in a Beta release. Products will be complete from a
  1306. // feature perspective, but may have some open outstanding issues. Beta
  1307. // releases are suitable for limited production use cases.
  1308. // "GA" - GA features are open to all developers and are considered
  1309. // stable and fully qualified for production use.
  1310. // "DEPRECATED" - Deprecated features are scheduled to be shut down
  1311. // and removed. For more information, see the “Deprecation Policy”
  1312. // section of our Terms of Service (https://cloud.google.com/terms/) and
  1313. // the Google Cloud Platform Subject to the Deprecation Policy
  1314. // (https://cloud.google.com/terms/deprecation) documentation.
  1315. LaunchStage string `json:"launchStage,omitempty"`
  1316. // SamplePeriod: The sampling period of metric data points. For metrics
  1317. // which are written periodically, consecutive data points are stored at
  1318. // this time interval, excluding data loss due to errors. Metrics with a
  1319. // higher granularity have a smaller sampling period.
  1320. SamplePeriod string `json:"samplePeriod,omitempty"`
  1321. // ForceSendFields is a list of field names (e.g. "IngestDelay") to
  1322. // unconditionally include in API requests. By default, fields with
  1323. // empty values are omitted from API requests. However, any non-pointer,
  1324. // non-interface field appearing in ForceSendFields will be sent to the
  1325. // server regardless of whether the field is empty or not. This may be
  1326. // used to include empty fields in Patch requests.
  1327. ForceSendFields []string `json:"-"`
  1328. // NullFields is a list of field names (e.g. "IngestDelay") to include
  1329. // in API requests with the JSON null value. By default, fields with
  1330. // empty values are omitted from API requests. However, any field with
  1331. // an empty value appearing in NullFields will be sent to the server as
  1332. // null. It is an error if a field in this list has a non-empty value.
  1333. // This may be used to include null fields in Patch requests.
  1334. NullFields []string `json:"-"`
  1335. }
  1336. func (s *MetricDescriptorMetadata) MarshalJSON() ([]byte, error) {
  1337. type NoMethod MetricDescriptorMetadata
  1338. raw := NoMethod(*s)
  1339. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1340. }
  1341. // MonitoredResource: An object representing a resource that can be used
  1342. // for monitoring, logging, billing, or other purposes. Examples include
  1343. // virtual machine instances, databases, and storage devices such as
  1344. // disks. The type field identifies a MonitoredResourceDescriptor object
  1345. // that describes the resource's schema. Information in the labels field
  1346. // identifies the actual resource and its attributes according to the
  1347. // schema. For example, a particular Compute Engine VM instance could be
  1348. // represented by the following object, because the
  1349. // MonitoredResourceDescriptor for "gce_instance" has labels
  1350. // "instance_id" and "zone":
  1351. // { "type": "gce_instance",
  1352. // "labels": { "instance_id": "12345678901234",
  1353. // "zone": "us-central1-a" }}
  1354. //
  1355. type MonitoredResource struct {
  1356. // Labels: Required. Values for all of the labels listed in the
  1357. // associated monitored resource descriptor. For example, Compute Engine
  1358. // VM instances use the labels "project_id", "instance_id", and "zone".
  1359. Labels map[string]string `json:"labels,omitempty"`
  1360. // Type: Required. The monitored resource type. This field must match
  1361. // the type field of a MonitoredResourceDescriptor object. For example,
  1362. // the type of a Compute Engine VM instance is gce_instance.
  1363. Type string `json:"type,omitempty"`
  1364. // ForceSendFields is a list of field names (e.g. "Labels") to
  1365. // unconditionally include in API requests. By default, fields with
  1366. // empty values are omitted from API requests. However, any non-pointer,
  1367. // non-interface field appearing in ForceSendFields will be sent to the
  1368. // server regardless of whether the field is empty or not. This may be
  1369. // used to include empty fields in Patch requests.
  1370. ForceSendFields []string `json:"-"`
  1371. // NullFields is a list of field names (e.g. "Labels") to include in API
  1372. // requests with the JSON null value. By default, fields with empty
  1373. // values are omitted from API requests. However, any field with an
  1374. // empty value appearing in NullFields will be sent to the server as
  1375. // null. It is an error if a field in this list has a non-empty value.
  1376. // This may be used to include null fields in Patch requests.
  1377. NullFields []string `json:"-"`
  1378. }
  1379. func (s *MonitoredResource) MarshalJSON() ([]byte, error) {
  1380. type NoMethod MonitoredResource
  1381. raw := NoMethod(*s)
  1382. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1383. }
  1384. // MonitoredResourceDescriptor: An object that describes the schema of a
  1385. // MonitoredResource object using a type name and a set of labels. For
  1386. // example, the monitored resource descriptor for Google Compute Engine
  1387. // VM instances has a type of "gce_instance" and specifies the use of
  1388. // the labels "instance_id" and "zone" to identify particular VM
  1389. // instances.Different APIs can support different monitored resource
  1390. // types. APIs generally provide a list method that returns the
  1391. // monitored resource descriptors used by the API.
  1392. type MonitoredResourceDescriptor struct {
  1393. // Description: Optional. A detailed description of the monitored
  1394. // resource type that might be used in documentation.
  1395. Description string `json:"description,omitempty"`
  1396. // DisplayName: Optional. A concise name for the monitored resource type
  1397. // that might be displayed in user interfaces. It should be a Title
  1398. // Cased Noun Phrase, without any article or other determiners. For
  1399. // example, "Google Cloud SQL Database".
  1400. DisplayName string `json:"displayName,omitempty"`
  1401. // Labels: Required. A set of labels used to describe instances of this
  1402. // monitored resource type. For example, an individual Google Cloud SQL
  1403. // database is identified by values for the labels "database_id" and
  1404. // "zone".
  1405. Labels []*LabelDescriptor `json:"labels,omitempty"`
  1406. // Name: Optional. The resource name of the monitored resource
  1407. // descriptor:
  1408. // "projects/{project_id}/monitoredResourceDescriptors/{type}" where
  1409. // {type} is the value of the type field in this object and {project_id}
  1410. // is a project ID that provides API-specific context for accessing the
  1411. // type. APIs that do not use project information can use the resource
  1412. // name format "monitoredResourceDescriptors/{type}".
  1413. Name string `json:"name,omitempty"`
  1414. // Type: Required. The monitored resource type. For example, the type
  1415. // "cloudsql_database" represents databases in Google Cloud SQL. The
  1416. // maximum length of this value is 256 characters.
  1417. Type string `json:"type,omitempty"`
  1418. // ForceSendFields is a list of field names (e.g. "Description") to
  1419. // unconditionally include in API requests. By default, fields with
  1420. // empty values are omitted from API requests. However, any non-pointer,
  1421. // non-interface field appearing in ForceSendFields will be sent to the
  1422. // server regardless of whether the field is empty or not. This may be
  1423. // used to include empty fields in Patch requests.
  1424. ForceSendFields []string `json:"-"`
  1425. // NullFields is a list of field names (e.g. "Description") to include
  1426. // in API requests with the JSON null value. By default, fields with
  1427. // empty values are omitted from API requests. However, any field with
  1428. // an empty value appearing in NullFields will be sent to the server as
  1429. // null. It is an error if a field in this list has a non-empty value.
  1430. // This may be used to include null fields in Patch requests.
  1431. NullFields []string `json:"-"`
  1432. }
  1433. func (s *MonitoredResourceDescriptor) MarshalJSON() ([]byte, error) {
  1434. type NoMethod MonitoredResourceDescriptor
  1435. raw := NoMethod(*s)
  1436. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1437. }
  1438. // MonitoredResourceMetadata: Auxiliary metadata for a MonitoredResource
  1439. // object. MonitoredResource objects contain the minimum set of
  1440. // information to uniquely identify a monitored resource instance. There
  1441. // is some other useful auxiliary metadata. Monitoring and Logging use
  1442. // an ingestion pipeline to extract metadata for cloud resources of all
  1443. // types, and store the metadata in this message.
  1444. type MonitoredResourceMetadata struct {
  1445. // SystemLabels: Output only. Values for predefined system metadata
  1446. // labels. System labels are a kind of metadata extracted by Google,
  1447. // including "machine_image", "vpc", "subnet_id", "security_group",
  1448. // "name", etc. System label values can be only strings, Boolean values,
  1449. // or a list of strings. For example:
  1450. // { "name": "my-test-instance",
  1451. // "security_group": ["a", "b", "c"],
  1452. // "spot_instance": false }
  1453. //
  1454. SystemLabels googleapi.RawMessage `json:"systemLabels,omitempty"`
  1455. // UserLabels: Output only. A map of user-defined metadata labels.
  1456. UserLabels map[string]string `json:"userLabels,omitempty"`
  1457. // ForceSendFields is a list of field names (e.g. "SystemLabels") to
  1458. // unconditionally include in API requests. By default, fields with
  1459. // empty values are omitted from API requests. However, any non-pointer,
  1460. // non-interface field appearing in ForceSendFields will be sent to the
  1461. // server regardless of whether the field is empty or not. This may be
  1462. // used to include empty fields in Patch requests.
  1463. ForceSendFields []string `json:"-"`
  1464. // NullFields is a list of field names (e.g. "SystemLabels") to include
  1465. // in API requests with the JSON null value. By default, fields with
  1466. // empty values are omitted from API requests. However, any field with
  1467. // an empty value appearing in NullFields will be sent to the server as
  1468. // null. It is an error if a field in this list has a non-empty value.
  1469. // This may be used to include null fields in Patch requests.
  1470. NullFields []string `json:"-"`
  1471. }
  1472. func (s *MonitoredResourceMetadata) MarshalJSON() ([]byte, error) {
  1473. type NoMethod MonitoredResourceMetadata
  1474. raw := NoMethod(*s)
  1475. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1476. }
  1477. // RequestLog: Complete log information about a single HTTP request to
  1478. // an App Engine application.
  1479. type RequestLog struct {
  1480. // AppEngineRelease: App Engine release version.
  1481. AppEngineRelease string `json:"appEngineRelease,omitempty"`
  1482. // AppId: Application that handled this request.
  1483. AppId string `json:"appId,omitempty"`
  1484. // Cost: An indication of the relative cost of serving this request.
  1485. Cost float64 `json:"cost,omitempty"`
  1486. // EndTime: Time when the request finished.
  1487. EndTime string `json:"endTime,omitempty"`
  1488. // Finished: Whether this request is finished or active.
  1489. Finished bool `json:"finished,omitempty"`
  1490. // First: Whether this is the first RequestLog entry for this request.
  1491. // If an active request has several RequestLog entries written to
  1492. // Stackdriver Logging, then this field will be set for one of them.
  1493. First bool `json:"first,omitempty"`
  1494. // Host: Internet host and port number of the resource being requested.
  1495. Host string `json:"host,omitempty"`
  1496. // HttpVersion: HTTP version of request. Example: "HTTP/1.1".
  1497. HttpVersion string `json:"httpVersion,omitempty"`
  1498. // InstanceId: An identifier for the instance that handled the request.
  1499. InstanceId string `json:"instanceId,omitempty"`
  1500. // InstanceIndex: If the instance processing this request belongs to a
  1501. // manually scaled module, then this is the 0-based index of the
  1502. // instance. Otherwise, this value is -1.
  1503. InstanceIndex int64 `json:"instanceIndex,omitempty"`
  1504. // Ip: Origin IP address.
  1505. Ip string `json:"ip,omitempty"`
  1506. // Latency: Latency of the request.
  1507. Latency string `json:"latency,omitempty"`
  1508. // Line: A list of log lines emitted by the application while serving
  1509. // this request.
  1510. Line []*LogLine `json:"line,omitempty"`
  1511. // MegaCycles: Number of CPU megacycles used to process request.
  1512. MegaCycles int64 `json:"megaCycles,omitempty,string"`
  1513. // Method: Request method. Example: "GET", "HEAD", "PUT", "POST",
  1514. // "DELETE".
  1515. Method string `json:"method,omitempty"`
  1516. // ModuleId: Module of the application that handled this request.
  1517. ModuleId string `json:"moduleId,omitempty"`
  1518. // Nickname: The logged-in user who made the request.Most likely, this
  1519. // is the part of the user's email before the @ sign. The field value is
  1520. // the same for different requests from the same user, but different
  1521. // users can have similar names. This information is also available to
  1522. // the application via the App Engine Users API.This field will be
  1523. // populated starting with App Engine 1.9.21.
  1524. Nickname string `json:"nickname,omitempty"`
  1525. // PendingTime: Time this request spent in the pending request queue.
  1526. PendingTime string `json:"pendingTime,omitempty"`
  1527. // Referrer: Referrer URL of request.
  1528. Referrer string `json:"referrer,omitempty"`
  1529. // RequestId: Globally unique identifier for a request, which is based
  1530. // on the request start time. Request IDs for requests which started
  1531. // later will compare greater as strings than those for requests which
  1532. // started earlier.
  1533. RequestId string `json:"requestId,omitempty"`
  1534. // Resource: Contains the path and query portion of the URL that was
  1535. // requested. For example, if the URL was
  1536. // "http://example.com/app?name=val", the resource would be
  1537. // "/app?name=val". The fragment identifier, which is identified by the
  1538. // # character, is not included.
  1539. Resource string `json:"resource,omitempty"`
  1540. // ResponseSize: Size in bytes sent back to client by request.
  1541. ResponseSize int64 `json:"responseSize,omitempty,string"`
  1542. // SourceReference: Source code for the application that handled this
  1543. // request. There can be more than one source reference per deployed
  1544. // application if source code is distributed among multiple
  1545. // repositories.
  1546. SourceReference []*SourceReference `json:"sourceReference,omitempty"`
  1547. // StartTime: Time when the request started.
  1548. StartTime string `json:"startTime,omitempty"`
  1549. // Status: HTTP response status code. Example: 200, 404.
  1550. Status int64 `json:"status,omitempty"`
  1551. // TaskName: Task name of the request, in the case of an offline
  1552. // request.
  1553. TaskName string `json:"taskName,omitempty"`
  1554. // TaskQueueName: Queue name of the request, in the case of an offline
  1555. // request.
  1556. TaskQueueName string `json:"taskQueueName,omitempty"`
  1557. // TraceId: Stackdriver Trace identifier for this request.
  1558. TraceId string `json:"traceId,omitempty"`
  1559. // TraceSampled: If true, the value in the 'trace_id' field was sampled
  1560. // for storage in a trace backend.
  1561. TraceSampled bool `json:"traceSampled,omitempty"`
  1562. // UrlMapEntry: File or class that handled the request.
  1563. UrlMapEntry string `json:"urlMapEntry,omitempty"`
  1564. // UserAgent: User agent that made the request.
  1565. UserAgent string `json:"userAgent,omitempty"`
  1566. // VersionId: Version of the application that handled this request.
  1567. VersionId string `json:"versionId,omitempty"`
  1568. // WasLoadingRequest: Whether this was a loading request for the
  1569. // instance.
  1570. WasLoadingRequest bool `json:"wasLoadingRequest,omitempty"`
  1571. // ForceSendFields is a list of field names (e.g. "AppEngineRelease") to
  1572. // unconditionally include in API requests. By default, fields with
  1573. // empty values are omitted from API requests. However, any non-pointer,
  1574. // non-interface field appearing in ForceSendFields will be sent to the
  1575. // server regardless of whether the field is empty or not. This may be
  1576. // used to include empty fields in Patch requests.
  1577. ForceSendFields []string `json:"-"`
  1578. // NullFields is a list of field names (e.g. "AppEngineRelease") to
  1579. // include in API requests with the JSON null value. By default, fields
  1580. // with empty values are omitted from API requests. However, any field
  1581. // with an empty value appearing in NullFields will be sent to the
  1582. // server as null. It is an error if a field in this list has a
  1583. // non-empty value. This may be used to include null fields in Patch
  1584. // requests.
  1585. NullFields []string `json:"-"`
  1586. }
  1587. func (s *RequestLog) MarshalJSON() ([]byte, error) {
  1588. type NoMethod RequestLog
  1589. raw := NoMethod(*s)
  1590. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1591. }
  1592. func (s *RequestLog) UnmarshalJSON(data []byte) error {
  1593. type NoMethod RequestLog
  1594. var s1 struct {
  1595. Cost gensupport.JSONFloat64 `json:"cost"`
  1596. *NoMethod
  1597. }
  1598. s1.NoMethod = (*NoMethod)(s)
  1599. if err := json.Unmarshal(data, &s1); err != nil {
  1600. return err
  1601. }
  1602. s.Cost = float64(s1.Cost)
  1603. return nil
  1604. }
  1605. // SourceLocation: Specifies a location in a source code file.
  1606. type SourceLocation struct {
  1607. // File: Source file name. Depending on the runtime environment, this
  1608. // might be a simple name or a fully-qualified name.
  1609. File string `json:"file,omitempty"`
  1610. // FunctionName: Human-readable name of the function or method being
  1611. // invoked, with optional context such as the class or package name.
  1612. // This information is used in contexts such as the logs viewer, where a
  1613. // file and line number are less meaningful. The format can vary by
  1614. // language. For example: qual.if.ied.Class.method (Java),
  1615. // dir/package.func (Go), function (Python).
  1616. FunctionName string `json:"functionName,omitempty"`
  1617. // Line: Line within the source file.
  1618. Line int64 `json:"line,omitempty,string"`
  1619. // ForceSendFields is a list of field names (e.g. "File") to
  1620. // unconditionally include in API requests. By default, fields with
  1621. // empty values are omitted from API requests. However, any non-pointer,
  1622. // non-interface field appearing in ForceSendFields will be sent to the
  1623. // server regardless of whether the field is empty or not. This may be
  1624. // used to include empty fields in Patch requests.
  1625. ForceSendFields []string `json:"-"`
  1626. // NullFields is a list of field names (e.g. "File") to include in API
  1627. // requests with the JSON null value. By default, fields with empty
  1628. // values are omitted from API requests. However, any field with an
  1629. // empty value appearing in NullFields will be sent to the server as
  1630. // null. It is an error if a field in this list has a non-empty value.
  1631. // This may be used to include null fields in Patch requests.
  1632. NullFields []string `json:"-"`
  1633. }
  1634. func (s *SourceLocation) MarshalJSON() ([]byte, error) {
  1635. type NoMethod SourceLocation
  1636. raw := NoMethod(*s)
  1637. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1638. }
  1639. // SourceReference: A reference to a particular snapshot of the source
  1640. // tree used to build and deploy an application.
  1641. type SourceReference struct {
  1642. // Repository: Optional. A URI string identifying the repository.
  1643. // Example: "https://github.com/GoogleCloudPlatform/kubernetes.git"
  1644. Repository string `json:"repository,omitempty"`
  1645. // RevisionId: The canonical and persistent identifier of the deployed
  1646. // revision. Example (git): "0035781c50ec7aa23385dc841529ce8a4b70db1b"
  1647. RevisionId string `json:"revisionId,omitempty"`
  1648. // ForceSendFields is a list of field names (e.g. "Repository") to
  1649. // unconditionally include in API requests. By default, fields with
  1650. // empty values are omitted from API requests. However, any non-pointer,
  1651. // non-interface field appearing in ForceSendFields will be sent to the
  1652. // server regardless of whether the field is empty or not. This may be
  1653. // used to include empty fields in Patch requests.
  1654. ForceSendFields []string `json:"-"`
  1655. // NullFields is a list of field names (e.g. "Repository") to include in
  1656. // API requests with the JSON null value. By default, fields with empty
  1657. // values are omitted from API requests. However, any field with an
  1658. // empty value appearing in NullFields will be sent to the server as
  1659. // null. It is an error if a field in this list has a non-empty value.
  1660. // This may be used to include null fields in Patch requests.
  1661. NullFields []string `json:"-"`
  1662. }
  1663. func (s *SourceReference) MarshalJSON() ([]byte, error) {
  1664. type NoMethod SourceReference
  1665. raw := NoMethod(*s)
  1666. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1667. }
  1668. // WriteLogEntriesRequest: The parameters to WriteLogEntries.
  1669. type WriteLogEntriesRequest struct {
  1670. // DryRun: Optional. If true, the request should expect normal response,
  1671. // but the entries won't be persisted nor exported. Useful for checking
  1672. // whether the logging API endpoints are working properly before sending
  1673. // valuable data.
  1674. DryRun bool `json:"dryRun,omitempty"`
  1675. // Entries: Required. The log entries to send to Logging. The order of
  1676. // log entries in this list does not matter. Values supplied in this
  1677. // method's log_name, resource, and labels fields are copied into those
  1678. // log entries in this list that do not include values for their
  1679. // corresponding fields. For more information, see the LogEntry type.If
  1680. // the timestamp or insert_id fields are missing in log entries, then
  1681. // this method supplies the current time or a unique identifier,
  1682. // respectively. The supplied values are chosen so that, among the log
  1683. // entries that did not supply their own values, the entries earlier in
  1684. // the list will sort before the entries later in the list. See the
  1685. // entries.list method.Log entries with timestamps that are more than
  1686. // the logs retention period in the past or more than 24 hours in the
  1687. // future will not be available when calling entries.list. However,
  1688. // those log entries can still be exported with LogSinks.To improve
  1689. // throughput and to avoid exceeding the quota limit for calls to
  1690. // entries.write, you should try to include several log entries in this
  1691. // list, rather than calling this method for each individual log entry.
  1692. Entries []*LogEntry `json:"entries,omitempty"`
  1693. // Labels: Optional. Default labels that are added to the labels field
  1694. // of all log entries in entries. If a log entry already has a label
  1695. // with the same key as a label in this parameter, then the log entry's
  1696. // label is not changed. See LogEntry.
  1697. Labels map[string]string `json:"labels,omitempty"`
  1698. // LogName: Optional. A default log resource name that is assigned to
  1699. // all log entries in entries that do not specify a value for
  1700. // log_name:
  1701. // "projects/[PROJECT_ID]/logs/[LOG_ID]"
  1702. // "organizations/[ORGANI
  1703. // ZATION_ID]/logs/[LOG_ID]"
  1704. // "billingAccounts/[BILLING_ACCOUNT_ID]/logs/[
  1705. // LOG_ID]"
  1706. // "folders/[FOLDER_ID]/logs/[LOG_ID]"
  1707. // [LOG_ID] must be URL-encoded. For
  1708. // example:
  1709. // "projects/my-project-id/logs/syslog"
  1710. // "organizations/123456789
  1711. // 0/logs/cloudresourcemanager.googleapis.com%2Factivity"
  1712. // The permission <code>logging.logEntries.create</code> is needed on
  1713. // each project, organization, billing account, or folder that is
  1714. // receiving new log entries, whether the resource is specified in
  1715. // <code>logName</code> or in an individual log entry.
  1716. LogName string `json:"logName,omitempty"`
  1717. // PartialSuccess: Optional. Whether valid entries should be written
  1718. // even if some other entries fail due to INVALID_ARGUMENT or
  1719. // PERMISSION_DENIED errors. If any entry is not written, then the
  1720. // response status is the error associated with one of the failed
  1721. // entries and the response includes error details keyed by the entries'
  1722. // zero-based index in the entries.write method.
  1723. PartialSuccess bool `json:"partialSuccess,omitempty"`
  1724. // Resource: Optional. A default monitored resource object that is
  1725. // assigned to all log entries in entries that do not specify a value
  1726. // for resource. Example:
  1727. // { "type": "gce_instance",
  1728. // "labels": {
  1729. // "zone": "us-central1-a", "instance_id": "00000000000000000000"
  1730. // }}
  1731. // See LogEntry.
  1732. Resource *MonitoredResource `json:"resource,omitempty"`
  1733. // ForceSendFields is a list of field names (e.g. "DryRun") to
  1734. // unconditionally include in API requests. By default, fields with
  1735. // empty values are omitted from API requests. However, any non-pointer,
  1736. // non-interface field appearing in ForceSendFields will be sent to the
  1737. // server regardless of whether the field is empty or not. This may be
  1738. // used to include empty fields in Patch requests.
  1739. ForceSendFields []string `json:"-"`
  1740. // NullFields is a list of field names (e.g. "DryRun") to include in API
  1741. // requests with the JSON null value. By default, fields with empty
  1742. // values are omitted from API requests. However, any field with an
  1743. // empty value appearing in NullFields will be sent to the server as
  1744. // null. It is an error if a field in this list has a non-empty value.
  1745. // This may be used to include null fields in Patch requests.
  1746. NullFields []string `json:"-"`
  1747. }
  1748. func (s *WriteLogEntriesRequest) MarshalJSON() ([]byte, error) {
  1749. type NoMethod WriteLogEntriesRequest
  1750. raw := NoMethod(*s)
  1751. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1752. }
  1753. // WriteLogEntriesResponse: Result returned from WriteLogEntries. empty
  1754. type WriteLogEntriesResponse struct {
  1755. // ServerResponse contains the HTTP response code and headers from the
  1756. // server.
  1757. googleapi.ServerResponse `json:"-"`
  1758. }
  1759. // method id "logging.entries.list":
  1760. type EntriesListCall struct {
  1761. s *Service
  1762. listlogentriesrequest *ListLogEntriesRequest
  1763. urlParams_ gensupport.URLParams
  1764. ctx_ context.Context
  1765. header_ http.Header
  1766. }
  1767. // List: Lists log entries. Use this method to retrieve log entries that
  1768. // originated from a project/folder/organization/billing account. For
  1769. // ways to export log entries, see Exporting Logs.
  1770. func (r *EntriesService) List(listlogentriesrequest *ListLogEntriesRequest) *EntriesListCall {
  1771. c := &EntriesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1772. c.listlogentriesrequest = listlogentriesrequest
  1773. return c
  1774. }
  1775. // Fields allows partial responses to be retrieved. See
  1776. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1777. // for more information.
  1778. func (c *EntriesListCall) Fields(s ...googleapi.Field) *EntriesListCall {
  1779. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1780. return c
  1781. }
  1782. // Context sets the context to be used in this call's Do method. Any
  1783. // pending HTTP request will be aborted if the provided context is
  1784. // canceled.
  1785. func (c *EntriesListCall) Context(ctx context.Context) *EntriesListCall {
  1786. c.ctx_ = ctx
  1787. return c
  1788. }
  1789. // Header returns an http.Header that can be modified by the caller to
  1790. // add HTTP headers to the request.
  1791. func (c *EntriesListCall) Header() http.Header {
  1792. if c.header_ == nil {
  1793. c.header_ = make(http.Header)
  1794. }
  1795. return c.header_
  1796. }
  1797. func (c *EntriesListCall) doRequest(alt string) (*http.Response, error) {
  1798. reqHeaders := make(http.Header)
  1799. for k, v := range c.header_ {
  1800. reqHeaders[k] = v
  1801. }
  1802. reqHeaders.Set("User-Agent", c.s.userAgent())
  1803. var body io.Reader = nil
  1804. body, err := googleapi.WithoutDataWrapper.JSONReader(c.listlogentriesrequest)
  1805. if err != nil {
  1806. return nil, err
  1807. }
  1808. reqHeaders.Set("Content-Type", "application/json")
  1809. c.urlParams_.Set("alt", alt)
  1810. c.urlParams_.Set("prettyPrint", "false")
  1811. urls := googleapi.ResolveRelative(c.s.BasePath, "v2beta1/entries:list")
  1812. urls += "?" + c.urlParams_.Encode()
  1813. req, err := http.NewRequest("POST", urls, body)
  1814. if err != nil {
  1815. return nil, err
  1816. }
  1817. req.Header = reqHeaders
  1818. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1819. }
  1820. // Do executes the "logging.entries.list" call.
  1821. // Exactly one of *ListLogEntriesResponse or error will be non-nil. Any
  1822. // non-2xx status code is an error. Response headers are in either
  1823. // *ListLogEntriesResponse.ServerResponse.Header or (if a response was
  1824. // returned at all) in error.(*googleapi.Error).Header. Use
  1825. // googleapi.IsNotModified to check whether the returned error was
  1826. // because http.StatusNotModified was returned.
  1827. func (c *EntriesListCall) Do(opts ...googleapi.CallOption) (*ListLogEntriesResponse, error) {
  1828. gensupport.SetOptions(c.urlParams_, opts...)
  1829. res, err := c.doRequest("json")
  1830. if res != nil && res.StatusCode == http.StatusNotModified {
  1831. if res.Body != nil {
  1832. res.Body.Close()
  1833. }
  1834. return nil, &googleapi.Error{
  1835. Code: res.StatusCode,
  1836. Header: res.Header,
  1837. }
  1838. }
  1839. if err != nil {
  1840. return nil, err
  1841. }
  1842. defer googleapi.CloseBody(res)
  1843. if err := googleapi.CheckResponse(res); err != nil {
  1844. return nil, err
  1845. }
  1846. ret := &ListLogEntriesResponse{
  1847. ServerResponse: googleapi.ServerResponse{
  1848. Header: res.Header,
  1849. HTTPStatusCode: res.StatusCode,
  1850. },
  1851. }
  1852. target := &ret
  1853. if err := gensupport.DecodeResponse(target, res); err != nil {
  1854. return nil, err
  1855. }
  1856. return ret, nil
  1857. // {
  1858. // "description": "Lists log entries. Use this method to retrieve log entries that originated from a project/folder/organization/billing account. For ways to export log entries, see Exporting Logs.",
  1859. // "flatPath": "v2beta1/entries:list",
  1860. // "httpMethod": "POST",
  1861. // "id": "logging.entries.list",
  1862. // "parameterOrder": [],
  1863. // "parameters": {},
  1864. // "path": "v2beta1/entries:list",
  1865. // "request": {
  1866. // "$ref": "ListLogEntriesRequest"
  1867. // },
  1868. // "response": {
  1869. // "$ref": "ListLogEntriesResponse"
  1870. // },
  1871. // "scopes": [
  1872. // "https://www.googleapis.com/auth/cloud-platform",
  1873. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  1874. // "https://www.googleapis.com/auth/logging.admin",
  1875. // "https://www.googleapis.com/auth/logging.read"
  1876. // ]
  1877. // }
  1878. }
  1879. // Pages invokes f for each page of results.
  1880. // A non-nil error returned from f will halt the iteration.
  1881. // The provided context supersedes any context provided to the Context method.
  1882. func (c *EntriesListCall) Pages(ctx context.Context, f func(*ListLogEntriesResponse) error) error {
  1883. c.ctx_ = ctx
  1884. defer func(pt string) { c.listlogentriesrequest.PageToken = pt }(c.listlogentriesrequest.PageToken) // reset paging to original point
  1885. for {
  1886. x, err := c.Do()
  1887. if err != nil {
  1888. return err
  1889. }
  1890. if err := f(x); err != nil {
  1891. return err
  1892. }
  1893. if x.NextPageToken == "" {
  1894. return nil
  1895. }
  1896. c.listlogentriesrequest.PageToken = x.NextPageToken
  1897. }
  1898. }
  1899. // method id "logging.entries.write":
  1900. type EntriesWriteCall struct {
  1901. s *Service
  1902. writelogentriesrequest *WriteLogEntriesRequest
  1903. urlParams_ gensupport.URLParams
  1904. ctx_ context.Context
  1905. header_ http.Header
  1906. }
  1907. // Write: Writes log entries to Logging. This API method is the only way
  1908. // to send log entries to Logging. This method is used, directly or
  1909. // indirectly, by the Logging agent (fluentd) and all logging libraries
  1910. // configured to use Logging. A single request may contain log entries
  1911. // for a maximum of 1000 different resources (projects, organizations,
  1912. // billing accounts or folders)
  1913. func (r *EntriesService) Write(writelogentriesrequest *WriteLogEntriesRequest) *EntriesWriteCall {
  1914. c := &EntriesWriteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1915. c.writelogentriesrequest = writelogentriesrequest
  1916. return c
  1917. }
  1918. // Fields allows partial responses to be retrieved. See
  1919. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1920. // for more information.
  1921. func (c *EntriesWriteCall) Fields(s ...googleapi.Field) *EntriesWriteCall {
  1922. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1923. return c
  1924. }
  1925. // Context sets the context to be used in this call's Do method. Any
  1926. // pending HTTP request will be aborted if the provided context is
  1927. // canceled.
  1928. func (c *EntriesWriteCall) Context(ctx context.Context) *EntriesWriteCall {
  1929. c.ctx_ = ctx
  1930. return c
  1931. }
  1932. // Header returns an http.Header that can be modified by the caller to
  1933. // add HTTP headers to the request.
  1934. func (c *EntriesWriteCall) Header() http.Header {
  1935. if c.header_ == nil {
  1936. c.header_ = make(http.Header)
  1937. }
  1938. return c.header_
  1939. }
  1940. func (c *EntriesWriteCall) doRequest(alt string) (*http.Response, error) {
  1941. reqHeaders := make(http.Header)
  1942. for k, v := range c.header_ {
  1943. reqHeaders[k] = v
  1944. }
  1945. reqHeaders.Set("User-Agent", c.s.userAgent())
  1946. var body io.Reader = nil
  1947. body, err := googleapi.WithoutDataWrapper.JSONReader(c.writelogentriesrequest)
  1948. if err != nil {
  1949. return nil, err
  1950. }
  1951. reqHeaders.Set("Content-Type", "application/json")
  1952. c.urlParams_.Set("alt", alt)
  1953. c.urlParams_.Set("prettyPrint", "false")
  1954. urls := googleapi.ResolveRelative(c.s.BasePath, "v2beta1/entries:write")
  1955. urls += "?" + c.urlParams_.Encode()
  1956. req, err := http.NewRequest("POST", urls, body)
  1957. if err != nil {
  1958. return nil, err
  1959. }
  1960. req.Header = reqHeaders
  1961. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1962. }
  1963. // Do executes the "logging.entries.write" call.
  1964. // Exactly one of *WriteLogEntriesResponse or error will be non-nil. Any
  1965. // non-2xx status code is an error. Response headers are in either
  1966. // *WriteLogEntriesResponse.ServerResponse.Header or (if a response was
  1967. // returned at all) in error.(*googleapi.Error).Header. Use
  1968. // googleapi.IsNotModified to check whether the returned error was
  1969. // because http.StatusNotModified was returned.
  1970. func (c *EntriesWriteCall) Do(opts ...googleapi.CallOption) (*WriteLogEntriesResponse, error) {
  1971. gensupport.SetOptions(c.urlParams_, opts...)
  1972. res, err := c.doRequest("json")
  1973. if res != nil && res.StatusCode == http.StatusNotModified {
  1974. if res.Body != nil {
  1975. res.Body.Close()
  1976. }
  1977. return nil, &googleapi.Error{
  1978. Code: res.StatusCode,
  1979. Header: res.Header,
  1980. }
  1981. }
  1982. if err != nil {
  1983. return nil, err
  1984. }
  1985. defer googleapi.CloseBody(res)
  1986. if err := googleapi.CheckResponse(res); err != nil {
  1987. return nil, err
  1988. }
  1989. ret := &WriteLogEntriesResponse{
  1990. ServerResponse: googleapi.ServerResponse{
  1991. Header: res.Header,
  1992. HTTPStatusCode: res.StatusCode,
  1993. },
  1994. }
  1995. target := &ret
  1996. if err := gensupport.DecodeResponse(target, res); err != nil {
  1997. return nil, err
  1998. }
  1999. return ret, nil
  2000. // {
  2001. // "description": "Writes log entries to Logging. This API method is the only way to send log entries to Logging. This method is used, directly or indirectly, by the Logging agent (fluentd) and all logging libraries configured to use Logging. A single request may contain log entries for a maximum of 1000 different resources (projects, organizations, billing accounts or folders)",
  2002. // "flatPath": "v2beta1/entries:write",
  2003. // "httpMethod": "POST",
  2004. // "id": "logging.entries.write",
  2005. // "parameterOrder": [],
  2006. // "parameters": {},
  2007. // "path": "v2beta1/entries:write",
  2008. // "request": {
  2009. // "$ref": "WriteLogEntriesRequest"
  2010. // },
  2011. // "response": {
  2012. // "$ref": "WriteLogEntriesResponse"
  2013. // },
  2014. // "scopes": [
  2015. // "https://www.googleapis.com/auth/cloud-platform",
  2016. // "https://www.googleapis.com/auth/logging.admin",
  2017. // "https://www.googleapis.com/auth/logging.write"
  2018. // ]
  2019. // }
  2020. }
  2021. // method id "logging.monitoredResourceDescriptors.list":
  2022. type MonitoredResourceDescriptorsListCall struct {
  2023. s *Service
  2024. urlParams_ gensupport.URLParams
  2025. ifNoneMatch_ string
  2026. ctx_ context.Context
  2027. header_ http.Header
  2028. }
  2029. // List: Lists the descriptors for monitored resource types used by
  2030. // Logging.
  2031. func (r *MonitoredResourceDescriptorsService) List() *MonitoredResourceDescriptorsListCall {
  2032. c := &MonitoredResourceDescriptorsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2033. return c
  2034. }
  2035. // PageSize sets the optional parameter "pageSize": The maximum number
  2036. // of results to return from this request. Non-positive values are
  2037. // ignored. The presence of nextPageToken in the response indicates that
  2038. // more results might be available.
  2039. func (c *MonitoredResourceDescriptorsListCall) PageSize(pageSize int64) *MonitoredResourceDescriptorsListCall {
  2040. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  2041. return c
  2042. }
  2043. // PageToken sets the optional parameter "pageToken": If present, then
  2044. // retrieve the next batch of results from the preceding call to this
  2045. // method. pageToken must be the value of nextPageToken from the
  2046. // previous response. The values of other method parameters should be
  2047. // identical to those in the previous call.
  2048. func (c *MonitoredResourceDescriptorsListCall) PageToken(pageToken string) *MonitoredResourceDescriptorsListCall {
  2049. c.urlParams_.Set("pageToken", pageToken)
  2050. return c
  2051. }
  2052. // Fields allows partial responses to be retrieved. See
  2053. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2054. // for more information.
  2055. func (c *MonitoredResourceDescriptorsListCall) Fields(s ...googleapi.Field) *MonitoredResourceDescriptorsListCall {
  2056. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2057. return c
  2058. }
  2059. // IfNoneMatch sets the optional parameter which makes the operation
  2060. // fail if the object's ETag matches the given value. This is useful for
  2061. // getting updates only after the object has changed since the last
  2062. // request. Use googleapi.IsNotModified to check whether the response
  2063. // error from Do is the result of In-None-Match.
  2064. func (c *MonitoredResourceDescriptorsListCall) IfNoneMatch(entityTag string) *MonitoredResourceDescriptorsListCall {
  2065. c.ifNoneMatch_ = entityTag
  2066. return c
  2067. }
  2068. // Context sets the context to be used in this call's Do method. Any
  2069. // pending HTTP request will be aborted if the provided context is
  2070. // canceled.
  2071. func (c *MonitoredResourceDescriptorsListCall) Context(ctx context.Context) *MonitoredResourceDescriptorsListCall {
  2072. c.ctx_ = ctx
  2073. return c
  2074. }
  2075. // Header returns an http.Header that can be modified by the caller to
  2076. // add HTTP headers to the request.
  2077. func (c *MonitoredResourceDescriptorsListCall) Header() http.Header {
  2078. if c.header_ == nil {
  2079. c.header_ = make(http.Header)
  2080. }
  2081. return c.header_
  2082. }
  2083. func (c *MonitoredResourceDescriptorsListCall) doRequest(alt string) (*http.Response, error) {
  2084. reqHeaders := make(http.Header)
  2085. for k, v := range c.header_ {
  2086. reqHeaders[k] = v
  2087. }
  2088. reqHeaders.Set("User-Agent", c.s.userAgent())
  2089. if c.ifNoneMatch_ != "" {
  2090. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2091. }
  2092. var body io.Reader = nil
  2093. c.urlParams_.Set("alt", alt)
  2094. c.urlParams_.Set("prettyPrint", "false")
  2095. urls := googleapi.ResolveRelative(c.s.BasePath, "v2beta1/monitoredResourceDescriptors")
  2096. urls += "?" + c.urlParams_.Encode()
  2097. req, err := http.NewRequest("GET", urls, body)
  2098. if err != nil {
  2099. return nil, err
  2100. }
  2101. req.Header = reqHeaders
  2102. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2103. }
  2104. // Do executes the "logging.monitoredResourceDescriptors.list" call.
  2105. // Exactly one of *ListMonitoredResourceDescriptorsResponse or error
  2106. // will be non-nil. Any non-2xx status code is an error. Response
  2107. // headers are in either
  2108. // *ListMonitoredResourceDescriptorsResponse.ServerResponse.Header or
  2109. // (if a response was returned at all) in
  2110. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  2111. // whether the returned error was because http.StatusNotModified was
  2112. // returned.
  2113. func (c *MonitoredResourceDescriptorsListCall) Do(opts ...googleapi.CallOption) (*ListMonitoredResourceDescriptorsResponse, error) {
  2114. gensupport.SetOptions(c.urlParams_, opts...)
  2115. res, err := c.doRequest("json")
  2116. if res != nil && res.StatusCode == http.StatusNotModified {
  2117. if res.Body != nil {
  2118. res.Body.Close()
  2119. }
  2120. return nil, &googleapi.Error{
  2121. Code: res.StatusCode,
  2122. Header: res.Header,
  2123. }
  2124. }
  2125. if err != nil {
  2126. return nil, err
  2127. }
  2128. defer googleapi.CloseBody(res)
  2129. if err := googleapi.CheckResponse(res); err != nil {
  2130. return nil, err
  2131. }
  2132. ret := &ListMonitoredResourceDescriptorsResponse{
  2133. ServerResponse: googleapi.ServerResponse{
  2134. Header: res.Header,
  2135. HTTPStatusCode: res.StatusCode,
  2136. },
  2137. }
  2138. target := &ret
  2139. if err := gensupport.DecodeResponse(target, res); err != nil {
  2140. return nil, err
  2141. }
  2142. return ret, nil
  2143. // {
  2144. // "description": "Lists the descriptors for monitored resource types used by Logging.",
  2145. // "flatPath": "v2beta1/monitoredResourceDescriptors",
  2146. // "httpMethod": "GET",
  2147. // "id": "logging.monitoredResourceDescriptors.list",
  2148. // "parameterOrder": [],
  2149. // "parameters": {
  2150. // "pageSize": {
  2151. // "description": "Optional. The maximum number of results to return from this request. Non-positive values are ignored. The presence of nextPageToken in the response indicates that more results might be available.",
  2152. // "format": "int32",
  2153. // "location": "query",
  2154. // "type": "integer"
  2155. // },
  2156. // "pageToken": {
  2157. // "description": "Optional. If present, then retrieve the next batch of results from the preceding call to this method. pageToken must be the value of nextPageToken from the previous response. The values of other method parameters should be identical to those in the previous call.",
  2158. // "location": "query",
  2159. // "type": "string"
  2160. // }
  2161. // },
  2162. // "path": "v2beta1/monitoredResourceDescriptors",
  2163. // "response": {
  2164. // "$ref": "ListMonitoredResourceDescriptorsResponse"
  2165. // },
  2166. // "scopes": [
  2167. // "https://www.googleapis.com/auth/cloud-platform",
  2168. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  2169. // "https://www.googleapis.com/auth/logging.admin",
  2170. // "https://www.googleapis.com/auth/logging.read"
  2171. // ]
  2172. // }
  2173. }
  2174. // Pages invokes f for each page of results.
  2175. // A non-nil error returned from f will halt the iteration.
  2176. // The provided context supersedes any context provided to the Context method.
  2177. func (c *MonitoredResourceDescriptorsListCall) Pages(ctx context.Context, f func(*ListMonitoredResourceDescriptorsResponse) error) error {
  2178. c.ctx_ = ctx
  2179. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  2180. for {
  2181. x, err := c.Do()
  2182. if err != nil {
  2183. return err
  2184. }
  2185. if err := f(x); err != nil {
  2186. return err
  2187. }
  2188. if x.NextPageToken == "" {
  2189. return nil
  2190. }
  2191. c.PageToken(x.NextPageToken)
  2192. }
  2193. }
  2194. // method id "logging.projects.metrics.create":
  2195. type ProjectsMetricsCreateCall struct {
  2196. s *Service
  2197. parent string
  2198. logmetric *LogMetric
  2199. urlParams_ gensupport.URLParams
  2200. ctx_ context.Context
  2201. header_ http.Header
  2202. }
  2203. // Create: Creates a logs-based metric.
  2204. func (r *ProjectsMetricsService) Create(parent string, logmetric *LogMetric) *ProjectsMetricsCreateCall {
  2205. c := &ProjectsMetricsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2206. c.parent = parent
  2207. c.logmetric = logmetric
  2208. return c
  2209. }
  2210. // Fields allows partial responses to be retrieved. See
  2211. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2212. // for more information.
  2213. func (c *ProjectsMetricsCreateCall) Fields(s ...googleapi.Field) *ProjectsMetricsCreateCall {
  2214. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2215. return c
  2216. }
  2217. // Context sets the context to be used in this call's Do method. Any
  2218. // pending HTTP request will be aborted if the provided context is
  2219. // canceled.
  2220. func (c *ProjectsMetricsCreateCall) Context(ctx context.Context) *ProjectsMetricsCreateCall {
  2221. c.ctx_ = ctx
  2222. return c
  2223. }
  2224. // Header returns an http.Header that can be modified by the caller to
  2225. // add HTTP headers to the request.
  2226. func (c *ProjectsMetricsCreateCall) Header() http.Header {
  2227. if c.header_ == nil {
  2228. c.header_ = make(http.Header)
  2229. }
  2230. return c.header_
  2231. }
  2232. func (c *ProjectsMetricsCreateCall) doRequest(alt string) (*http.Response, error) {
  2233. reqHeaders := make(http.Header)
  2234. for k, v := range c.header_ {
  2235. reqHeaders[k] = v
  2236. }
  2237. reqHeaders.Set("User-Agent", c.s.userAgent())
  2238. var body io.Reader = nil
  2239. body, err := googleapi.WithoutDataWrapper.JSONReader(c.logmetric)
  2240. if err != nil {
  2241. return nil, err
  2242. }
  2243. reqHeaders.Set("Content-Type", "application/json")
  2244. c.urlParams_.Set("alt", alt)
  2245. c.urlParams_.Set("prettyPrint", "false")
  2246. urls := googleapi.ResolveRelative(c.s.BasePath, "v2beta1/{+parent}/metrics")
  2247. urls += "?" + c.urlParams_.Encode()
  2248. req, err := http.NewRequest("POST", urls, body)
  2249. if err != nil {
  2250. return nil, err
  2251. }
  2252. req.Header = reqHeaders
  2253. googleapi.Expand(req.URL, map[string]string{
  2254. "parent": c.parent,
  2255. })
  2256. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2257. }
  2258. // Do executes the "logging.projects.metrics.create" call.
  2259. // Exactly one of *LogMetric or error will be non-nil. Any non-2xx
  2260. // status code is an error. Response headers are in either
  2261. // *LogMetric.ServerResponse.Header or (if a response was returned at
  2262. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  2263. // to check whether the returned error was because
  2264. // http.StatusNotModified was returned.
  2265. func (c *ProjectsMetricsCreateCall) Do(opts ...googleapi.CallOption) (*LogMetric, error) {
  2266. gensupport.SetOptions(c.urlParams_, opts...)
  2267. res, err := c.doRequest("json")
  2268. if res != nil && res.StatusCode == http.StatusNotModified {
  2269. if res.Body != nil {
  2270. res.Body.Close()
  2271. }
  2272. return nil, &googleapi.Error{
  2273. Code: res.StatusCode,
  2274. Header: res.Header,
  2275. }
  2276. }
  2277. if err != nil {
  2278. return nil, err
  2279. }
  2280. defer googleapi.CloseBody(res)
  2281. if err := googleapi.CheckResponse(res); err != nil {
  2282. return nil, err
  2283. }
  2284. ret := &LogMetric{
  2285. ServerResponse: googleapi.ServerResponse{
  2286. Header: res.Header,
  2287. HTTPStatusCode: res.StatusCode,
  2288. },
  2289. }
  2290. target := &ret
  2291. if err := gensupport.DecodeResponse(target, res); err != nil {
  2292. return nil, err
  2293. }
  2294. return ret, nil
  2295. // {
  2296. // "description": "Creates a logs-based metric.",
  2297. // "flatPath": "v2beta1/projects/{projectsId}/metrics",
  2298. // "httpMethod": "POST",
  2299. // "id": "logging.projects.metrics.create",
  2300. // "parameterOrder": [
  2301. // "parent"
  2302. // ],
  2303. // "parameters": {
  2304. // "parent": {
  2305. // "description": "The resource name of the project in which to create the metric:\n\"projects/[PROJECT_ID]\"\nThe new metric must be provided in the request.",
  2306. // "location": "path",
  2307. // "pattern": "^projects/[^/]+$",
  2308. // "required": true,
  2309. // "type": "string"
  2310. // }
  2311. // },
  2312. // "path": "v2beta1/{+parent}/metrics",
  2313. // "request": {
  2314. // "$ref": "LogMetric"
  2315. // },
  2316. // "response": {
  2317. // "$ref": "LogMetric"
  2318. // },
  2319. // "scopes": [
  2320. // "https://www.googleapis.com/auth/cloud-platform",
  2321. // "https://www.googleapis.com/auth/logging.admin",
  2322. // "https://www.googleapis.com/auth/logging.write"
  2323. // ]
  2324. // }
  2325. }
  2326. // method id "logging.projects.metrics.delete":
  2327. type ProjectsMetricsDeleteCall struct {
  2328. s *Service
  2329. metricName string
  2330. urlParams_ gensupport.URLParams
  2331. ctx_ context.Context
  2332. header_ http.Header
  2333. }
  2334. // Delete: Deletes a logs-based metric.
  2335. func (r *ProjectsMetricsService) Delete(metricName string) *ProjectsMetricsDeleteCall {
  2336. c := &ProjectsMetricsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2337. c.metricName = metricName
  2338. return c
  2339. }
  2340. // Fields allows partial responses to be retrieved. See
  2341. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2342. // for more information.
  2343. func (c *ProjectsMetricsDeleteCall) Fields(s ...googleapi.Field) *ProjectsMetricsDeleteCall {
  2344. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2345. return c
  2346. }
  2347. // Context sets the context to be used in this call's Do method. Any
  2348. // pending HTTP request will be aborted if the provided context is
  2349. // canceled.
  2350. func (c *ProjectsMetricsDeleteCall) Context(ctx context.Context) *ProjectsMetricsDeleteCall {
  2351. c.ctx_ = ctx
  2352. return c
  2353. }
  2354. // Header returns an http.Header that can be modified by the caller to
  2355. // add HTTP headers to the request.
  2356. func (c *ProjectsMetricsDeleteCall) Header() http.Header {
  2357. if c.header_ == nil {
  2358. c.header_ = make(http.Header)
  2359. }
  2360. return c.header_
  2361. }
  2362. func (c *ProjectsMetricsDeleteCall) doRequest(alt string) (*http.Response, error) {
  2363. reqHeaders := make(http.Header)
  2364. for k, v := range c.header_ {
  2365. reqHeaders[k] = v
  2366. }
  2367. reqHeaders.Set("User-Agent", c.s.userAgent())
  2368. var body io.Reader = nil
  2369. c.urlParams_.Set("alt", alt)
  2370. c.urlParams_.Set("prettyPrint", "false")
  2371. urls := googleapi.ResolveRelative(c.s.BasePath, "v2beta1/{+metricName}")
  2372. urls += "?" + c.urlParams_.Encode()
  2373. req, err := http.NewRequest("DELETE", urls, body)
  2374. if err != nil {
  2375. return nil, err
  2376. }
  2377. req.Header = reqHeaders
  2378. googleapi.Expand(req.URL, map[string]string{
  2379. "metricName": c.metricName,
  2380. })
  2381. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2382. }
  2383. // Do executes the "logging.projects.metrics.delete" call.
  2384. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  2385. // code is an error. Response headers are in either
  2386. // *Empty.ServerResponse.Header or (if a response was returned at all)
  2387. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2388. // check whether the returned error was because http.StatusNotModified
  2389. // was returned.
  2390. func (c *ProjectsMetricsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  2391. gensupport.SetOptions(c.urlParams_, opts...)
  2392. res, err := c.doRequest("json")
  2393. if res != nil && res.StatusCode == http.StatusNotModified {
  2394. if res.Body != nil {
  2395. res.Body.Close()
  2396. }
  2397. return nil, &googleapi.Error{
  2398. Code: res.StatusCode,
  2399. Header: res.Header,
  2400. }
  2401. }
  2402. if err != nil {
  2403. return nil, err
  2404. }
  2405. defer googleapi.CloseBody(res)
  2406. if err := googleapi.CheckResponse(res); err != nil {
  2407. return nil, err
  2408. }
  2409. ret := &Empty{
  2410. ServerResponse: googleapi.ServerResponse{
  2411. Header: res.Header,
  2412. HTTPStatusCode: res.StatusCode,
  2413. },
  2414. }
  2415. target := &ret
  2416. if err := gensupport.DecodeResponse(target, res); err != nil {
  2417. return nil, err
  2418. }
  2419. return ret, nil
  2420. // {
  2421. // "description": "Deletes a logs-based metric.",
  2422. // "flatPath": "v2beta1/projects/{projectsId}/metrics/{metricsId}",
  2423. // "httpMethod": "DELETE",
  2424. // "id": "logging.projects.metrics.delete",
  2425. // "parameterOrder": [
  2426. // "metricName"
  2427. // ],
  2428. // "parameters": {
  2429. // "metricName": {
  2430. // "description": "The resource name of the metric to delete:\n\"projects/[PROJECT_ID]/metrics/[METRIC_ID]\"\n",
  2431. // "location": "path",
  2432. // "pattern": "^projects/[^/]+/metrics/[^/]+$",
  2433. // "required": true,
  2434. // "type": "string"
  2435. // }
  2436. // },
  2437. // "path": "v2beta1/{+metricName}",
  2438. // "response": {
  2439. // "$ref": "Empty"
  2440. // },
  2441. // "scopes": [
  2442. // "https://www.googleapis.com/auth/cloud-platform",
  2443. // "https://www.googleapis.com/auth/logging.admin",
  2444. // "https://www.googleapis.com/auth/logging.write"
  2445. // ]
  2446. // }
  2447. }
  2448. // method id "logging.projects.metrics.get":
  2449. type ProjectsMetricsGetCall struct {
  2450. s *Service
  2451. metricName string
  2452. urlParams_ gensupport.URLParams
  2453. ifNoneMatch_ string
  2454. ctx_ context.Context
  2455. header_ http.Header
  2456. }
  2457. // Get: Gets a logs-based metric.
  2458. func (r *ProjectsMetricsService) Get(metricName string) *ProjectsMetricsGetCall {
  2459. c := &ProjectsMetricsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2460. c.metricName = metricName
  2461. return c
  2462. }
  2463. // Fields allows partial responses to be retrieved. See
  2464. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2465. // for more information.
  2466. func (c *ProjectsMetricsGetCall) Fields(s ...googleapi.Field) *ProjectsMetricsGetCall {
  2467. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2468. return c
  2469. }
  2470. // IfNoneMatch sets the optional parameter which makes the operation
  2471. // fail if the object's ETag matches the given value. This is useful for
  2472. // getting updates only after the object has changed since the last
  2473. // request. Use googleapi.IsNotModified to check whether the response
  2474. // error from Do is the result of In-None-Match.
  2475. func (c *ProjectsMetricsGetCall) IfNoneMatch(entityTag string) *ProjectsMetricsGetCall {
  2476. c.ifNoneMatch_ = entityTag
  2477. return c
  2478. }
  2479. // Context sets the context to be used in this call's Do method. Any
  2480. // pending HTTP request will be aborted if the provided context is
  2481. // canceled.
  2482. func (c *ProjectsMetricsGetCall) Context(ctx context.Context) *ProjectsMetricsGetCall {
  2483. c.ctx_ = ctx
  2484. return c
  2485. }
  2486. // Header returns an http.Header that can be modified by the caller to
  2487. // add HTTP headers to the request.
  2488. func (c *ProjectsMetricsGetCall) Header() http.Header {
  2489. if c.header_ == nil {
  2490. c.header_ = make(http.Header)
  2491. }
  2492. return c.header_
  2493. }
  2494. func (c *ProjectsMetricsGetCall) doRequest(alt string) (*http.Response, error) {
  2495. reqHeaders := make(http.Header)
  2496. for k, v := range c.header_ {
  2497. reqHeaders[k] = v
  2498. }
  2499. reqHeaders.Set("User-Agent", c.s.userAgent())
  2500. if c.ifNoneMatch_ != "" {
  2501. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2502. }
  2503. var body io.Reader = nil
  2504. c.urlParams_.Set("alt", alt)
  2505. c.urlParams_.Set("prettyPrint", "false")
  2506. urls := googleapi.ResolveRelative(c.s.BasePath, "v2beta1/{+metricName}")
  2507. urls += "?" + c.urlParams_.Encode()
  2508. req, err := http.NewRequest("GET", urls, body)
  2509. if err != nil {
  2510. return nil, err
  2511. }
  2512. req.Header = reqHeaders
  2513. googleapi.Expand(req.URL, map[string]string{
  2514. "metricName": c.metricName,
  2515. })
  2516. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2517. }
  2518. // Do executes the "logging.projects.metrics.get" call.
  2519. // Exactly one of *LogMetric or error will be non-nil. Any non-2xx
  2520. // status code is an error. Response headers are in either
  2521. // *LogMetric.ServerResponse.Header or (if a response was returned at
  2522. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  2523. // to check whether the returned error was because
  2524. // http.StatusNotModified was returned.
  2525. func (c *ProjectsMetricsGetCall) Do(opts ...googleapi.CallOption) (*LogMetric, error) {
  2526. gensupport.SetOptions(c.urlParams_, opts...)
  2527. res, err := c.doRequest("json")
  2528. if res != nil && res.StatusCode == http.StatusNotModified {
  2529. if res.Body != nil {
  2530. res.Body.Close()
  2531. }
  2532. return nil, &googleapi.Error{
  2533. Code: res.StatusCode,
  2534. Header: res.Header,
  2535. }
  2536. }
  2537. if err != nil {
  2538. return nil, err
  2539. }
  2540. defer googleapi.CloseBody(res)
  2541. if err := googleapi.CheckResponse(res); err != nil {
  2542. return nil, err
  2543. }
  2544. ret := &LogMetric{
  2545. ServerResponse: googleapi.ServerResponse{
  2546. Header: res.Header,
  2547. HTTPStatusCode: res.StatusCode,
  2548. },
  2549. }
  2550. target := &ret
  2551. if err := gensupport.DecodeResponse(target, res); err != nil {
  2552. return nil, err
  2553. }
  2554. return ret, nil
  2555. // {
  2556. // "description": "Gets a logs-based metric.",
  2557. // "flatPath": "v2beta1/projects/{projectsId}/metrics/{metricsId}",
  2558. // "httpMethod": "GET",
  2559. // "id": "logging.projects.metrics.get",
  2560. // "parameterOrder": [
  2561. // "metricName"
  2562. // ],
  2563. // "parameters": {
  2564. // "metricName": {
  2565. // "description": "The resource name of the desired metric:\n\"projects/[PROJECT_ID]/metrics/[METRIC_ID]\"\n",
  2566. // "location": "path",
  2567. // "pattern": "^projects/[^/]+/metrics/[^/]+$",
  2568. // "required": true,
  2569. // "type": "string"
  2570. // }
  2571. // },
  2572. // "path": "v2beta1/{+metricName}",
  2573. // "response": {
  2574. // "$ref": "LogMetric"
  2575. // },
  2576. // "scopes": [
  2577. // "https://www.googleapis.com/auth/cloud-platform",
  2578. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  2579. // "https://www.googleapis.com/auth/logging.admin",
  2580. // "https://www.googleapis.com/auth/logging.read"
  2581. // ]
  2582. // }
  2583. }
  2584. // method id "logging.projects.metrics.list":
  2585. type ProjectsMetricsListCall struct {
  2586. s *Service
  2587. parent string
  2588. urlParams_ gensupport.URLParams
  2589. ifNoneMatch_ string
  2590. ctx_ context.Context
  2591. header_ http.Header
  2592. }
  2593. // List: Lists logs-based metrics.
  2594. func (r *ProjectsMetricsService) List(parent string) *ProjectsMetricsListCall {
  2595. c := &ProjectsMetricsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2596. c.parent = parent
  2597. return c
  2598. }
  2599. // PageSize sets the optional parameter "pageSize": The maximum number
  2600. // of results to return from this request. Non-positive values are
  2601. // ignored. The presence of nextPageToken in the response indicates that
  2602. // more results might be available.
  2603. func (c *ProjectsMetricsListCall) PageSize(pageSize int64) *ProjectsMetricsListCall {
  2604. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  2605. return c
  2606. }
  2607. // PageToken sets the optional parameter "pageToken": If present, then
  2608. // retrieve the next batch of results from the preceding call to this
  2609. // method. pageToken must be the value of nextPageToken from the
  2610. // previous response. The values of other method parameters should be
  2611. // identical to those in the previous call.
  2612. func (c *ProjectsMetricsListCall) PageToken(pageToken string) *ProjectsMetricsListCall {
  2613. c.urlParams_.Set("pageToken", pageToken)
  2614. return c
  2615. }
  2616. // Fields allows partial responses to be retrieved. See
  2617. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2618. // for more information.
  2619. func (c *ProjectsMetricsListCall) Fields(s ...googleapi.Field) *ProjectsMetricsListCall {
  2620. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2621. return c
  2622. }
  2623. // IfNoneMatch sets the optional parameter which makes the operation
  2624. // fail if the object's ETag matches the given value. This is useful for
  2625. // getting updates only after the object has changed since the last
  2626. // request. Use googleapi.IsNotModified to check whether the response
  2627. // error from Do is the result of In-None-Match.
  2628. func (c *ProjectsMetricsListCall) IfNoneMatch(entityTag string) *ProjectsMetricsListCall {
  2629. c.ifNoneMatch_ = entityTag
  2630. return c
  2631. }
  2632. // Context sets the context to be used in this call's Do method. Any
  2633. // pending HTTP request will be aborted if the provided context is
  2634. // canceled.
  2635. func (c *ProjectsMetricsListCall) Context(ctx context.Context) *ProjectsMetricsListCall {
  2636. c.ctx_ = ctx
  2637. return c
  2638. }
  2639. // Header returns an http.Header that can be modified by the caller to
  2640. // add HTTP headers to the request.
  2641. func (c *ProjectsMetricsListCall) Header() http.Header {
  2642. if c.header_ == nil {
  2643. c.header_ = make(http.Header)
  2644. }
  2645. return c.header_
  2646. }
  2647. func (c *ProjectsMetricsListCall) doRequest(alt string) (*http.Response, error) {
  2648. reqHeaders := make(http.Header)
  2649. for k, v := range c.header_ {
  2650. reqHeaders[k] = v
  2651. }
  2652. reqHeaders.Set("User-Agent", c.s.userAgent())
  2653. if c.ifNoneMatch_ != "" {
  2654. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2655. }
  2656. var body io.Reader = nil
  2657. c.urlParams_.Set("alt", alt)
  2658. c.urlParams_.Set("prettyPrint", "false")
  2659. urls := googleapi.ResolveRelative(c.s.BasePath, "v2beta1/{+parent}/metrics")
  2660. urls += "?" + c.urlParams_.Encode()
  2661. req, err := http.NewRequest("GET", urls, body)
  2662. if err != nil {
  2663. return nil, err
  2664. }
  2665. req.Header = reqHeaders
  2666. googleapi.Expand(req.URL, map[string]string{
  2667. "parent": c.parent,
  2668. })
  2669. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2670. }
  2671. // Do executes the "logging.projects.metrics.list" call.
  2672. // Exactly one of *ListLogMetricsResponse or error will be non-nil. Any
  2673. // non-2xx status code is an error. Response headers are in either
  2674. // *ListLogMetricsResponse.ServerResponse.Header or (if a response was
  2675. // returned at all) in error.(*googleapi.Error).Header. Use
  2676. // googleapi.IsNotModified to check whether the returned error was
  2677. // because http.StatusNotModified was returned.
  2678. func (c *ProjectsMetricsListCall) Do(opts ...googleapi.CallOption) (*ListLogMetricsResponse, error) {
  2679. gensupport.SetOptions(c.urlParams_, opts...)
  2680. res, err := c.doRequest("json")
  2681. if res != nil && res.StatusCode == http.StatusNotModified {
  2682. if res.Body != nil {
  2683. res.Body.Close()
  2684. }
  2685. return nil, &googleapi.Error{
  2686. Code: res.StatusCode,
  2687. Header: res.Header,
  2688. }
  2689. }
  2690. if err != nil {
  2691. return nil, err
  2692. }
  2693. defer googleapi.CloseBody(res)
  2694. if err := googleapi.CheckResponse(res); err != nil {
  2695. return nil, err
  2696. }
  2697. ret := &ListLogMetricsResponse{
  2698. ServerResponse: googleapi.ServerResponse{
  2699. Header: res.Header,
  2700. HTTPStatusCode: res.StatusCode,
  2701. },
  2702. }
  2703. target := &ret
  2704. if err := gensupport.DecodeResponse(target, res); err != nil {
  2705. return nil, err
  2706. }
  2707. return ret, nil
  2708. // {
  2709. // "description": "Lists logs-based metrics.",
  2710. // "flatPath": "v2beta1/projects/{projectsId}/metrics",
  2711. // "httpMethod": "GET",
  2712. // "id": "logging.projects.metrics.list",
  2713. // "parameterOrder": [
  2714. // "parent"
  2715. // ],
  2716. // "parameters": {
  2717. // "pageSize": {
  2718. // "description": "Optional. The maximum number of results to return from this request. Non-positive values are ignored. The presence of nextPageToken in the response indicates that more results might be available.",
  2719. // "format": "int32",
  2720. // "location": "query",
  2721. // "type": "integer"
  2722. // },
  2723. // "pageToken": {
  2724. // "description": "Optional. If present, then retrieve the next batch of results from the preceding call to this method. pageToken must be the value of nextPageToken from the previous response. The values of other method parameters should be identical to those in the previous call.",
  2725. // "location": "query",
  2726. // "type": "string"
  2727. // },
  2728. // "parent": {
  2729. // "description": "Required. The name of the project containing the metrics:\n\"projects/[PROJECT_ID]\"\n",
  2730. // "location": "path",
  2731. // "pattern": "^projects/[^/]+$",
  2732. // "required": true,
  2733. // "type": "string"
  2734. // }
  2735. // },
  2736. // "path": "v2beta1/{+parent}/metrics",
  2737. // "response": {
  2738. // "$ref": "ListLogMetricsResponse"
  2739. // },
  2740. // "scopes": [
  2741. // "https://www.googleapis.com/auth/cloud-platform",
  2742. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  2743. // "https://www.googleapis.com/auth/logging.admin",
  2744. // "https://www.googleapis.com/auth/logging.read"
  2745. // ]
  2746. // }
  2747. }
  2748. // Pages invokes f for each page of results.
  2749. // A non-nil error returned from f will halt the iteration.
  2750. // The provided context supersedes any context provided to the Context method.
  2751. func (c *ProjectsMetricsListCall) Pages(ctx context.Context, f func(*ListLogMetricsResponse) error) error {
  2752. c.ctx_ = ctx
  2753. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  2754. for {
  2755. x, err := c.Do()
  2756. if err != nil {
  2757. return err
  2758. }
  2759. if err := f(x); err != nil {
  2760. return err
  2761. }
  2762. if x.NextPageToken == "" {
  2763. return nil
  2764. }
  2765. c.PageToken(x.NextPageToken)
  2766. }
  2767. }
  2768. // method id "logging.projects.metrics.update":
  2769. type ProjectsMetricsUpdateCall struct {
  2770. s *Service
  2771. metricName string
  2772. logmetric *LogMetric
  2773. urlParams_ gensupport.URLParams
  2774. ctx_ context.Context
  2775. header_ http.Header
  2776. }
  2777. // Update: Creates or updates a logs-based metric.
  2778. func (r *ProjectsMetricsService) Update(metricName string, logmetric *LogMetric) *ProjectsMetricsUpdateCall {
  2779. c := &ProjectsMetricsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2780. c.metricName = metricName
  2781. c.logmetric = logmetric
  2782. return c
  2783. }
  2784. // Fields allows partial responses to be retrieved. See
  2785. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2786. // for more information.
  2787. func (c *ProjectsMetricsUpdateCall) Fields(s ...googleapi.Field) *ProjectsMetricsUpdateCall {
  2788. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2789. return c
  2790. }
  2791. // Context sets the context to be used in this call's Do method. Any
  2792. // pending HTTP request will be aborted if the provided context is
  2793. // canceled.
  2794. func (c *ProjectsMetricsUpdateCall) Context(ctx context.Context) *ProjectsMetricsUpdateCall {
  2795. c.ctx_ = ctx
  2796. return c
  2797. }
  2798. // Header returns an http.Header that can be modified by the caller to
  2799. // add HTTP headers to the request.
  2800. func (c *ProjectsMetricsUpdateCall) Header() http.Header {
  2801. if c.header_ == nil {
  2802. c.header_ = make(http.Header)
  2803. }
  2804. return c.header_
  2805. }
  2806. func (c *ProjectsMetricsUpdateCall) doRequest(alt string) (*http.Response, error) {
  2807. reqHeaders := make(http.Header)
  2808. for k, v := range c.header_ {
  2809. reqHeaders[k] = v
  2810. }
  2811. reqHeaders.Set("User-Agent", c.s.userAgent())
  2812. var body io.Reader = nil
  2813. body, err := googleapi.WithoutDataWrapper.JSONReader(c.logmetric)
  2814. if err != nil {
  2815. return nil, err
  2816. }
  2817. reqHeaders.Set("Content-Type", "application/json")
  2818. c.urlParams_.Set("alt", alt)
  2819. c.urlParams_.Set("prettyPrint", "false")
  2820. urls := googleapi.ResolveRelative(c.s.BasePath, "v2beta1/{+metricName}")
  2821. urls += "?" + c.urlParams_.Encode()
  2822. req, err := http.NewRequest("PUT", urls, body)
  2823. if err != nil {
  2824. return nil, err
  2825. }
  2826. req.Header = reqHeaders
  2827. googleapi.Expand(req.URL, map[string]string{
  2828. "metricName": c.metricName,
  2829. })
  2830. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2831. }
  2832. // Do executes the "logging.projects.metrics.update" call.
  2833. // Exactly one of *LogMetric or error will be non-nil. Any non-2xx
  2834. // status code is an error. Response headers are in either
  2835. // *LogMetric.ServerResponse.Header or (if a response was returned at
  2836. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  2837. // to check whether the returned error was because
  2838. // http.StatusNotModified was returned.
  2839. func (c *ProjectsMetricsUpdateCall) Do(opts ...googleapi.CallOption) (*LogMetric, error) {
  2840. gensupport.SetOptions(c.urlParams_, opts...)
  2841. res, err := c.doRequest("json")
  2842. if res != nil && res.StatusCode == http.StatusNotModified {
  2843. if res.Body != nil {
  2844. res.Body.Close()
  2845. }
  2846. return nil, &googleapi.Error{
  2847. Code: res.StatusCode,
  2848. Header: res.Header,
  2849. }
  2850. }
  2851. if err != nil {
  2852. return nil, err
  2853. }
  2854. defer googleapi.CloseBody(res)
  2855. if err := googleapi.CheckResponse(res); err != nil {
  2856. return nil, err
  2857. }
  2858. ret := &LogMetric{
  2859. ServerResponse: googleapi.ServerResponse{
  2860. Header: res.Header,
  2861. HTTPStatusCode: res.StatusCode,
  2862. },
  2863. }
  2864. target := &ret
  2865. if err := gensupport.DecodeResponse(target, res); err != nil {
  2866. return nil, err
  2867. }
  2868. return ret, nil
  2869. // {
  2870. // "description": "Creates or updates a logs-based metric.",
  2871. // "flatPath": "v2beta1/projects/{projectsId}/metrics/{metricsId}",
  2872. // "httpMethod": "PUT",
  2873. // "id": "logging.projects.metrics.update",
  2874. // "parameterOrder": [
  2875. // "metricName"
  2876. // ],
  2877. // "parameters": {
  2878. // "metricName": {
  2879. // "description": "The resource name of the metric to update:\n\"projects/[PROJECT_ID]/metrics/[METRIC_ID]\"\nThe updated metric must be provided in the request and it's name field must be the same as [METRIC_ID] If the metric does not exist in [PROJECT_ID], then a new metric is created.",
  2880. // "location": "path",
  2881. // "pattern": "^projects/[^/]+/metrics/[^/]+$",
  2882. // "required": true,
  2883. // "type": "string"
  2884. // }
  2885. // },
  2886. // "path": "v2beta1/{+metricName}",
  2887. // "request": {
  2888. // "$ref": "LogMetric"
  2889. // },
  2890. // "response": {
  2891. // "$ref": "LogMetric"
  2892. // },
  2893. // "scopes": [
  2894. // "https://www.googleapis.com/auth/cloud-platform",
  2895. // "https://www.googleapis.com/auth/logging.admin",
  2896. // "https://www.googleapis.com/auth/logging.write"
  2897. // ]
  2898. // }
  2899. }
  2900. // method id "logging.projects.sinks.create":
  2901. type ProjectsSinksCreateCall struct {
  2902. s *Service
  2903. parent string
  2904. logsink *LogSink
  2905. urlParams_ gensupport.URLParams
  2906. ctx_ context.Context
  2907. header_ http.Header
  2908. }
  2909. // Create: Creates a sink that exports specified log entries to a
  2910. // destination. The export of newly-ingested log entries begins
  2911. // immediately, unless the sink's writer_identity is not permitted to
  2912. // write to the destination. A sink can export log entries only from the
  2913. // resource owning the sink.
  2914. func (r *ProjectsSinksService) Create(parent string, logsink *LogSink) *ProjectsSinksCreateCall {
  2915. c := &ProjectsSinksCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2916. c.parent = parent
  2917. c.logsink = logsink
  2918. return c
  2919. }
  2920. // UniqueWriterIdentity sets the optional parameter
  2921. // "uniqueWriterIdentity": Determines the kind of IAM identity returned
  2922. // as writer_identity in the new sink. If this value is omitted or set
  2923. // to false, and if the sink's parent is a project, then the value
  2924. // returned as writer_identity is the same group or service account used
  2925. // by Logging before the addition of writer identities to this API. The
  2926. // sink's destination must be in the same project as the sink itself.If
  2927. // this field is set to true, or if the sink is owned by a non-project
  2928. // resource such as an organization, then the value of writer_identity
  2929. // will be a unique service account used only for exports from the new
  2930. // sink. For more information, see writer_identity in LogSink.
  2931. func (c *ProjectsSinksCreateCall) UniqueWriterIdentity(uniqueWriterIdentity bool) *ProjectsSinksCreateCall {
  2932. c.urlParams_.Set("uniqueWriterIdentity", fmt.Sprint(uniqueWriterIdentity))
  2933. return c
  2934. }
  2935. // Fields allows partial responses to be retrieved. See
  2936. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2937. // for more information.
  2938. func (c *ProjectsSinksCreateCall) Fields(s ...googleapi.Field) *ProjectsSinksCreateCall {
  2939. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2940. return c
  2941. }
  2942. // Context sets the context to be used in this call's Do method. Any
  2943. // pending HTTP request will be aborted if the provided context is
  2944. // canceled.
  2945. func (c *ProjectsSinksCreateCall) Context(ctx context.Context) *ProjectsSinksCreateCall {
  2946. c.ctx_ = ctx
  2947. return c
  2948. }
  2949. // Header returns an http.Header that can be modified by the caller to
  2950. // add HTTP headers to the request.
  2951. func (c *ProjectsSinksCreateCall) Header() http.Header {
  2952. if c.header_ == nil {
  2953. c.header_ = make(http.Header)
  2954. }
  2955. return c.header_
  2956. }
  2957. func (c *ProjectsSinksCreateCall) doRequest(alt string) (*http.Response, error) {
  2958. reqHeaders := make(http.Header)
  2959. for k, v := range c.header_ {
  2960. reqHeaders[k] = v
  2961. }
  2962. reqHeaders.Set("User-Agent", c.s.userAgent())
  2963. var body io.Reader = nil
  2964. body, err := googleapi.WithoutDataWrapper.JSONReader(c.logsink)
  2965. if err != nil {
  2966. return nil, err
  2967. }
  2968. reqHeaders.Set("Content-Type", "application/json")
  2969. c.urlParams_.Set("alt", alt)
  2970. c.urlParams_.Set("prettyPrint", "false")
  2971. urls := googleapi.ResolveRelative(c.s.BasePath, "v2beta1/{+parent}/sinks")
  2972. urls += "?" + c.urlParams_.Encode()
  2973. req, err := http.NewRequest("POST", urls, body)
  2974. if err != nil {
  2975. return nil, err
  2976. }
  2977. req.Header = reqHeaders
  2978. googleapi.Expand(req.URL, map[string]string{
  2979. "parent": c.parent,
  2980. })
  2981. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2982. }
  2983. // Do executes the "logging.projects.sinks.create" call.
  2984. // Exactly one of *LogSink or error will be non-nil. Any non-2xx status
  2985. // code is an error. Response headers are in either
  2986. // *LogSink.ServerResponse.Header or (if a response was returned at all)
  2987. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2988. // check whether the returned error was because http.StatusNotModified
  2989. // was returned.
  2990. func (c *ProjectsSinksCreateCall) Do(opts ...googleapi.CallOption) (*LogSink, error) {
  2991. gensupport.SetOptions(c.urlParams_, opts...)
  2992. res, err := c.doRequest("json")
  2993. if res != nil && res.StatusCode == http.StatusNotModified {
  2994. if res.Body != nil {
  2995. res.Body.Close()
  2996. }
  2997. return nil, &googleapi.Error{
  2998. Code: res.StatusCode,
  2999. Header: res.Header,
  3000. }
  3001. }
  3002. if err != nil {
  3003. return nil, err
  3004. }
  3005. defer googleapi.CloseBody(res)
  3006. if err := googleapi.CheckResponse(res); err != nil {
  3007. return nil, err
  3008. }
  3009. ret := &LogSink{
  3010. ServerResponse: googleapi.ServerResponse{
  3011. Header: res.Header,
  3012. HTTPStatusCode: res.StatusCode,
  3013. },
  3014. }
  3015. target := &ret
  3016. if err := gensupport.DecodeResponse(target, res); err != nil {
  3017. return nil, err
  3018. }
  3019. return ret, nil
  3020. // {
  3021. // "description": "Creates a sink that exports specified log entries to a destination. The export of newly-ingested log entries begins immediately, unless the sink's writer_identity is not permitted to write to the destination. A sink can export log entries only from the resource owning the sink.",
  3022. // "flatPath": "v2beta1/projects/{projectsId}/sinks",
  3023. // "httpMethod": "POST",
  3024. // "id": "logging.projects.sinks.create",
  3025. // "parameterOrder": [
  3026. // "parent"
  3027. // ],
  3028. // "parameters": {
  3029. // "parent": {
  3030. // "description": "Required. The resource in which to create the sink:\n\"projects/[PROJECT_ID]\"\n\"organizations/[ORGANIZATION_ID]\"\n\"billingAccounts/[BILLING_ACCOUNT_ID]\"\n\"folders/[FOLDER_ID]\"\nExamples: \"projects/my-logging-project\", \"organizations/123456789\".",
  3031. // "location": "path",
  3032. // "pattern": "^projects/[^/]+$",
  3033. // "required": true,
  3034. // "type": "string"
  3035. // },
  3036. // "uniqueWriterIdentity": {
  3037. // "description": "Optional. Determines the kind of IAM identity returned as writer_identity in the new sink. If this value is omitted or set to false, and if the sink's parent is a project, then the value returned as writer_identity is the same group or service account used by Logging before the addition of writer identities to this API. The sink's destination must be in the same project as the sink itself.If this field is set to true, or if the sink is owned by a non-project resource such as an organization, then the value of writer_identity will be a unique service account used only for exports from the new sink. For more information, see writer_identity in LogSink.",
  3038. // "location": "query",
  3039. // "type": "boolean"
  3040. // }
  3041. // },
  3042. // "path": "v2beta1/{+parent}/sinks",
  3043. // "request": {
  3044. // "$ref": "LogSink"
  3045. // },
  3046. // "response": {
  3047. // "$ref": "LogSink"
  3048. // },
  3049. // "scopes": [
  3050. // "https://www.googleapis.com/auth/cloud-platform",
  3051. // "https://www.googleapis.com/auth/logging.admin"
  3052. // ]
  3053. // }
  3054. }
  3055. // method id "logging.projects.sinks.delete":
  3056. type ProjectsSinksDeleteCall struct {
  3057. s *Service
  3058. sinkNameid string
  3059. urlParams_ gensupport.URLParams
  3060. ctx_ context.Context
  3061. header_ http.Header
  3062. }
  3063. // Delete: Deletes a sink. If the sink has a unique writer_identity,
  3064. // then that service account is also deleted.
  3065. func (r *ProjectsSinksService) Delete(sinkNameid string) *ProjectsSinksDeleteCall {
  3066. c := &ProjectsSinksDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3067. c.sinkNameid = sinkNameid
  3068. return c
  3069. }
  3070. // Fields allows partial responses to be retrieved. See
  3071. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3072. // for more information.
  3073. func (c *ProjectsSinksDeleteCall) Fields(s ...googleapi.Field) *ProjectsSinksDeleteCall {
  3074. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3075. return c
  3076. }
  3077. // Context sets the context to be used in this call's Do method. Any
  3078. // pending HTTP request will be aborted if the provided context is
  3079. // canceled.
  3080. func (c *ProjectsSinksDeleteCall) Context(ctx context.Context) *ProjectsSinksDeleteCall {
  3081. c.ctx_ = ctx
  3082. return c
  3083. }
  3084. // Header returns an http.Header that can be modified by the caller to
  3085. // add HTTP headers to the request.
  3086. func (c *ProjectsSinksDeleteCall) Header() http.Header {
  3087. if c.header_ == nil {
  3088. c.header_ = make(http.Header)
  3089. }
  3090. return c.header_
  3091. }
  3092. func (c *ProjectsSinksDeleteCall) doRequest(alt string) (*http.Response, error) {
  3093. reqHeaders := make(http.Header)
  3094. for k, v := range c.header_ {
  3095. reqHeaders[k] = v
  3096. }
  3097. reqHeaders.Set("User-Agent", c.s.userAgent())
  3098. var body io.Reader = nil
  3099. c.urlParams_.Set("alt", alt)
  3100. c.urlParams_.Set("prettyPrint", "false")
  3101. urls := googleapi.ResolveRelative(c.s.BasePath, "v2beta1/{+sinkName}")
  3102. urls += "?" + c.urlParams_.Encode()
  3103. req, err := http.NewRequest("DELETE", urls, body)
  3104. if err != nil {
  3105. return nil, err
  3106. }
  3107. req.Header = reqHeaders
  3108. googleapi.Expand(req.URL, map[string]string{
  3109. "sinkName": c.sinkNameid,
  3110. })
  3111. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3112. }
  3113. // Do executes the "logging.projects.sinks.delete" call.
  3114. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  3115. // code is an error. Response headers are in either
  3116. // *Empty.ServerResponse.Header or (if a response was returned at all)
  3117. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3118. // check whether the returned error was because http.StatusNotModified
  3119. // was returned.
  3120. func (c *ProjectsSinksDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  3121. gensupport.SetOptions(c.urlParams_, opts...)
  3122. res, err := c.doRequest("json")
  3123. if res != nil && res.StatusCode == http.StatusNotModified {
  3124. if res.Body != nil {
  3125. res.Body.Close()
  3126. }
  3127. return nil, &googleapi.Error{
  3128. Code: res.StatusCode,
  3129. Header: res.Header,
  3130. }
  3131. }
  3132. if err != nil {
  3133. return nil, err
  3134. }
  3135. defer googleapi.CloseBody(res)
  3136. if err := googleapi.CheckResponse(res); err != nil {
  3137. return nil, err
  3138. }
  3139. ret := &Empty{
  3140. ServerResponse: googleapi.ServerResponse{
  3141. Header: res.Header,
  3142. HTTPStatusCode: res.StatusCode,
  3143. },
  3144. }
  3145. target := &ret
  3146. if err := gensupport.DecodeResponse(target, res); err != nil {
  3147. return nil, err
  3148. }
  3149. return ret, nil
  3150. // {
  3151. // "description": "Deletes a sink. If the sink has a unique writer_identity, then that service account is also deleted.",
  3152. // "flatPath": "v2beta1/projects/{projectsId}/sinks/{sinksId}",
  3153. // "httpMethod": "DELETE",
  3154. // "id": "logging.projects.sinks.delete",
  3155. // "parameterOrder": [
  3156. // "sinkName"
  3157. // ],
  3158. // "parameters": {
  3159. // "sinkName": {
  3160. // "description": "Required. The full resource name of the sink to delete, including the parent resource and the sink identifier:\n\"projects/[PROJECT_ID]/sinks/[SINK_ID]\"\n\"organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]\"\n\"billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]\"\n\"folders/[FOLDER_ID]/sinks/[SINK_ID]\"\nExample: \"projects/my-project-id/sinks/my-sink-id\".",
  3161. // "location": "path",
  3162. // "pattern": "^projects/[^/]+/sinks/[^/]+$",
  3163. // "required": true,
  3164. // "type": "string"
  3165. // }
  3166. // },
  3167. // "path": "v2beta1/{+sinkName}",
  3168. // "response": {
  3169. // "$ref": "Empty"
  3170. // },
  3171. // "scopes": [
  3172. // "https://www.googleapis.com/auth/cloud-platform",
  3173. // "https://www.googleapis.com/auth/logging.admin"
  3174. // ]
  3175. // }
  3176. }
  3177. // method id "logging.projects.sinks.get":
  3178. type ProjectsSinksGetCall struct {
  3179. s *Service
  3180. sinkName string
  3181. urlParams_ gensupport.URLParams
  3182. ifNoneMatch_ string
  3183. ctx_ context.Context
  3184. header_ http.Header
  3185. }
  3186. // Get: Gets a sink.
  3187. func (r *ProjectsSinksService) Get(sinkName string) *ProjectsSinksGetCall {
  3188. c := &ProjectsSinksGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3189. c.sinkName = sinkName
  3190. return c
  3191. }
  3192. // Fields allows partial responses to be retrieved. See
  3193. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3194. // for more information.
  3195. func (c *ProjectsSinksGetCall) Fields(s ...googleapi.Field) *ProjectsSinksGetCall {
  3196. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3197. return c
  3198. }
  3199. // IfNoneMatch sets the optional parameter which makes the operation
  3200. // fail if the object's ETag matches the given value. This is useful for
  3201. // getting updates only after the object has changed since the last
  3202. // request. Use googleapi.IsNotModified to check whether the response
  3203. // error from Do is the result of In-None-Match.
  3204. func (c *ProjectsSinksGetCall) IfNoneMatch(entityTag string) *ProjectsSinksGetCall {
  3205. c.ifNoneMatch_ = entityTag
  3206. return c
  3207. }
  3208. // Context sets the context to be used in this call's Do method. Any
  3209. // pending HTTP request will be aborted if the provided context is
  3210. // canceled.
  3211. func (c *ProjectsSinksGetCall) Context(ctx context.Context) *ProjectsSinksGetCall {
  3212. c.ctx_ = ctx
  3213. return c
  3214. }
  3215. // Header returns an http.Header that can be modified by the caller to
  3216. // add HTTP headers to the request.
  3217. func (c *ProjectsSinksGetCall) Header() http.Header {
  3218. if c.header_ == nil {
  3219. c.header_ = make(http.Header)
  3220. }
  3221. return c.header_
  3222. }
  3223. func (c *ProjectsSinksGetCall) doRequest(alt string) (*http.Response, error) {
  3224. reqHeaders := make(http.Header)
  3225. for k, v := range c.header_ {
  3226. reqHeaders[k] = v
  3227. }
  3228. reqHeaders.Set("User-Agent", c.s.userAgent())
  3229. if c.ifNoneMatch_ != "" {
  3230. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3231. }
  3232. var body io.Reader = nil
  3233. c.urlParams_.Set("alt", alt)
  3234. c.urlParams_.Set("prettyPrint", "false")
  3235. urls := googleapi.ResolveRelative(c.s.BasePath, "v2beta1/{+sinkName}")
  3236. urls += "?" + c.urlParams_.Encode()
  3237. req, err := http.NewRequest("GET", urls, body)
  3238. if err != nil {
  3239. return nil, err
  3240. }
  3241. req.Header = reqHeaders
  3242. googleapi.Expand(req.URL, map[string]string{
  3243. "sinkName": c.sinkName,
  3244. })
  3245. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3246. }
  3247. // Do executes the "logging.projects.sinks.get" call.
  3248. // Exactly one of *LogSink or error will be non-nil. Any non-2xx status
  3249. // code is an error. Response headers are in either
  3250. // *LogSink.ServerResponse.Header or (if a response was returned at all)
  3251. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3252. // check whether the returned error was because http.StatusNotModified
  3253. // was returned.
  3254. func (c *ProjectsSinksGetCall) Do(opts ...googleapi.CallOption) (*LogSink, error) {
  3255. gensupport.SetOptions(c.urlParams_, opts...)
  3256. res, err := c.doRequest("json")
  3257. if res != nil && res.StatusCode == http.StatusNotModified {
  3258. if res.Body != nil {
  3259. res.Body.Close()
  3260. }
  3261. return nil, &googleapi.Error{
  3262. Code: res.StatusCode,
  3263. Header: res.Header,
  3264. }
  3265. }
  3266. if err != nil {
  3267. return nil, err
  3268. }
  3269. defer googleapi.CloseBody(res)
  3270. if err := googleapi.CheckResponse(res); err != nil {
  3271. return nil, err
  3272. }
  3273. ret := &LogSink{
  3274. ServerResponse: googleapi.ServerResponse{
  3275. Header: res.Header,
  3276. HTTPStatusCode: res.StatusCode,
  3277. },
  3278. }
  3279. target := &ret
  3280. if err := gensupport.DecodeResponse(target, res); err != nil {
  3281. return nil, err
  3282. }
  3283. return ret, nil
  3284. // {
  3285. // "description": "Gets a sink.",
  3286. // "flatPath": "v2beta1/projects/{projectsId}/sinks/{sinksId}",
  3287. // "httpMethod": "GET",
  3288. // "id": "logging.projects.sinks.get",
  3289. // "parameterOrder": [
  3290. // "sinkName"
  3291. // ],
  3292. // "parameters": {
  3293. // "sinkName": {
  3294. // "description": "Required. The resource name of the sink:\n\"projects/[PROJECT_ID]/sinks/[SINK_ID]\"\n\"organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]\"\n\"billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]\"\n\"folders/[FOLDER_ID]/sinks/[SINK_ID]\"\nExample: \"projects/my-project-id/sinks/my-sink-id\".",
  3295. // "location": "path",
  3296. // "pattern": "^projects/[^/]+/sinks/[^/]+$",
  3297. // "required": true,
  3298. // "type": "string"
  3299. // }
  3300. // },
  3301. // "path": "v2beta1/{+sinkName}",
  3302. // "response": {
  3303. // "$ref": "LogSink"
  3304. // },
  3305. // "scopes": [
  3306. // "https://www.googleapis.com/auth/cloud-platform",
  3307. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  3308. // "https://www.googleapis.com/auth/logging.admin",
  3309. // "https://www.googleapis.com/auth/logging.read"
  3310. // ]
  3311. // }
  3312. }
  3313. // method id "logging.projects.sinks.list":
  3314. type ProjectsSinksListCall struct {
  3315. s *Service
  3316. parent string
  3317. urlParams_ gensupport.URLParams
  3318. ifNoneMatch_ string
  3319. ctx_ context.Context
  3320. header_ http.Header
  3321. }
  3322. // List: Lists sinks.
  3323. func (r *ProjectsSinksService) List(parent string) *ProjectsSinksListCall {
  3324. c := &ProjectsSinksListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3325. c.parent = parent
  3326. return c
  3327. }
  3328. // PageSize sets the optional parameter "pageSize": The maximum number
  3329. // of results to return from this request. Non-positive values are
  3330. // ignored. The presence of nextPageToken in the response indicates that
  3331. // more results might be available.
  3332. func (c *ProjectsSinksListCall) PageSize(pageSize int64) *ProjectsSinksListCall {
  3333. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  3334. return c
  3335. }
  3336. // PageToken sets the optional parameter "pageToken": If present, then
  3337. // retrieve the next batch of results from the preceding call to this
  3338. // method. pageToken must be the value of nextPageToken from the
  3339. // previous response. The values of other method parameters should be
  3340. // identical to those in the previous call.
  3341. func (c *ProjectsSinksListCall) PageToken(pageToken string) *ProjectsSinksListCall {
  3342. c.urlParams_.Set("pageToken", pageToken)
  3343. return c
  3344. }
  3345. // Fields allows partial responses to be retrieved. See
  3346. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3347. // for more information.
  3348. func (c *ProjectsSinksListCall) Fields(s ...googleapi.Field) *ProjectsSinksListCall {
  3349. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3350. return c
  3351. }
  3352. // IfNoneMatch sets the optional parameter which makes the operation
  3353. // fail if the object's ETag matches the given value. This is useful for
  3354. // getting updates only after the object has changed since the last
  3355. // request. Use googleapi.IsNotModified to check whether the response
  3356. // error from Do is the result of In-None-Match.
  3357. func (c *ProjectsSinksListCall) IfNoneMatch(entityTag string) *ProjectsSinksListCall {
  3358. c.ifNoneMatch_ = entityTag
  3359. return c
  3360. }
  3361. // Context sets the context to be used in this call's Do method. Any
  3362. // pending HTTP request will be aborted if the provided context is
  3363. // canceled.
  3364. func (c *ProjectsSinksListCall) Context(ctx context.Context) *ProjectsSinksListCall {
  3365. c.ctx_ = ctx
  3366. return c
  3367. }
  3368. // Header returns an http.Header that can be modified by the caller to
  3369. // add HTTP headers to the request.
  3370. func (c *ProjectsSinksListCall) Header() http.Header {
  3371. if c.header_ == nil {
  3372. c.header_ = make(http.Header)
  3373. }
  3374. return c.header_
  3375. }
  3376. func (c *ProjectsSinksListCall) doRequest(alt string) (*http.Response, error) {
  3377. reqHeaders := make(http.Header)
  3378. for k, v := range c.header_ {
  3379. reqHeaders[k] = v
  3380. }
  3381. reqHeaders.Set("User-Agent", c.s.userAgent())
  3382. if c.ifNoneMatch_ != "" {
  3383. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3384. }
  3385. var body io.Reader = nil
  3386. c.urlParams_.Set("alt", alt)
  3387. c.urlParams_.Set("prettyPrint", "false")
  3388. urls := googleapi.ResolveRelative(c.s.BasePath, "v2beta1/{+parent}/sinks")
  3389. urls += "?" + c.urlParams_.Encode()
  3390. req, err := http.NewRequest("GET", urls, body)
  3391. if err != nil {
  3392. return nil, err
  3393. }
  3394. req.Header = reqHeaders
  3395. googleapi.Expand(req.URL, map[string]string{
  3396. "parent": c.parent,
  3397. })
  3398. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3399. }
  3400. // Do executes the "logging.projects.sinks.list" call.
  3401. // Exactly one of *ListSinksResponse or error will be non-nil. Any
  3402. // non-2xx status code is an error. Response headers are in either
  3403. // *ListSinksResponse.ServerResponse.Header or (if a response was
  3404. // returned at all) in error.(*googleapi.Error).Header. Use
  3405. // googleapi.IsNotModified to check whether the returned error was
  3406. // because http.StatusNotModified was returned.
  3407. func (c *ProjectsSinksListCall) Do(opts ...googleapi.CallOption) (*ListSinksResponse, error) {
  3408. gensupport.SetOptions(c.urlParams_, opts...)
  3409. res, err := c.doRequest("json")
  3410. if res != nil && res.StatusCode == http.StatusNotModified {
  3411. if res.Body != nil {
  3412. res.Body.Close()
  3413. }
  3414. return nil, &googleapi.Error{
  3415. Code: res.StatusCode,
  3416. Header: res.Header,
  3417. }
  3418. }
  3419. if err != nil {
  3420. return nil, err
  3421. }
  3422. defer googleapi.CloseBody(res)
  3423. if err := googleapi.CheckResponse(res); err != nil {
  3424. return nil, err
  3425. }
  3426. ret := &ListSinksResponse{
  3427. ServerResponse: googleapi.ServerResponse{
  3428. Header: res.Header,
  3429. HTTPStatusCode: res.StatusCode,
  3430. },
  3431. }
  3432. target := &ret
  3433. if err := gensupport.DecodeResponse(target, res); err != nil {
  3434. return nil, err
  3435. }
  3436. return ret, nil
  3437. // {
  3438. // "description": "Lists sinks.",
  3439. // "flatPath": "v2beta1/projects/{projectsId}/sinks",
  3440. // "httpMethod": "GET",
  3441. // "id": "logging.projects.sinks.list",
  3442. // "parameterOrder": [
  3443. // "parent"
  3444. // ],
  3445. // "parameters": {
  3446. // "pageSize": {
  3447. // "description": "Optional. The maximum number of results to return from this request. Non-positive values are ignored. The presence of nextPageToken in the response indicates that more results might be available.",
  3448. // "format": "int32",
  3449. // "location": "query",
  3450. // "type": "integer"
  3451. // },
  3452. // "pageToken": {
  3453. // "description": "Optional. If present, then retrieve the next batch of results from the preceding call to this method. pageToken must be the value of nextPageToken from the previous response. The values of other method parameters should be identical to those in the previous call.",
  3454. // "location": "query",
  3455. // "type": "string"
  3456. // },
  3457. // "parent": {
  3458. // "description": "Required. The parent resource whose sinks are to be listed:\n\"projects/[PROJECT_ID]\"\n\"organizations/[ORGANIZATION_ID]\"\n\"billingAccounts/[BILLING_ACCOUNT_ID]\"\n\"folders/[FOLDER_ID]\"\n",
  3459. // "location": "path",
  3460. // "pattern": "^projects/[^/]+$",
  3461. // "required": true,
  3462. // "type": "string"
  3463. // }
  3464. // },
  3465. // "path": "v2beta1/{+parent}/sinks",
  3466. // "response": {
  3467. // "$ref": "ListSinksResponse"
  3468. // },
  3469. // "scopes": [
  3470. // "https://www.googleapis.com/auth/cloud-platform",
  3471. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  3472. // "https://www.googleapis.com/auth/logging.admin",
  3473. // "https://www.googleapis.com/auth/logging.read"
  3474. // ]
  3475. // }
  3476. }
  3477. // Pages invokes f for each page of results.
  3478. // A non-nil error returned from f will halt the iteration.
  3479. // The provided context supersedes any context provided to the Context method.
  3480. func (c *ProjectsSinksListCall) Pages(ctx context.Context, f func(*ListSinksResponse) error) error {
  3481. c.ctx_ = ctx
  3482. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  3483. for {
  3484. x, err := c.Do()
  3485. if err != nil {
  3486. return err
  3487. }
  3488. if err := f(x); err != nil {
  3489. return err
  3490. }
  3491. if x.NextPageToken == "" {
  3492. return nil
  3493. }
  3494. c.PageToken(x.NextPageToken)
  3495. }
  3496. }
  3497. // method id "logging.projects.sinks.update":
  3498. type ProjectsSinksUpdateCall struct {
  3499. s *Service
  3500. sinkNameid string
  3501. logsink *LogSink
  3502. urlParams_ gensupport.URLParams
  3503. ctx_ context.Context
  3504. header_ http.Header
  3505. }
  3506. // Update: Updates a sink. This method replaces the following fields in
  3507. // the existing sink with values from the new sink: destination, and
  3508. // filter.The updated sink might also have a new writer_identity; see
  3509. // the unique_writer_identity field.
  3510. func (r *ProjectsSinksService) Update(sinkNameid string, logsink *LogSink) *ProjectsSinksUpdateCall {
  3511. c := &ProjectsSinksUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3512. c.sinkNameid = sinkNameid
  3513. c.logsink = logsink
  3514. return c
  3515. }
  3516. // UniqueWriterIdentity sets the optional parameter
  3517. // "uniqueWriterIdentity": See sinks.create for a description of this
  3518. // field. When updating a sink, the effect of this field on the value of
  3519. // writer_identity in the updated sink depends on both the old and new
  3520. // values of this field:
  3521. // If the old and new values of this field are both false or both true,
  3522. // then there is no change to the sink's writer_identity.
  3523. // If the old value is false and the new value is true, then
  3524. // writer_identity is changed to a unique service account.
  3525. // It is an error if the old value is true and the new value is set to
  3526. // false or defaulted to false.
  3527. func (c *ProjectsSinksUpdateCall) UniqueWriterIdentity(uniqueWriterIdentity bool) *ProjectsSinksUpdateCall {
  3528. c.urlParams_.Set("uniqueWriterIdentity", fmt.Sprint(uniqueWriterIdentity))
  3529. return c
  3530. }
  3531. // UpdateMask sets the optional parameter "updateMask": Field mask that
  3532. // specifies the fields in sink that need an update. A sink field will
  3533. // be overwritten if, and only if, it is in the update mask. name and
  3534. // output only fields cannot be updated.An empty updateMask is
  3535. // temporarily treated as using the following mask for backwards
  3536. // compatibility purposes: destination,filter,includeChildren At some
  3537. // point in the future, behavior will be removed and specifying an empty
  3538. // updateMask will be an error.For a detailed FieldMask definition, see
  3539. // https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMaskExample:
  3540. // updateMask=filter.
  3541. func (c *ProjectsSinksUpdateCall) UpdateMask(updateMask string) *ProjectsSinksUpdateCall {
  3542. c.urlParams_.Set("updateMask", updateMask)
  3543. return c
  3544. }
  3545. // Fields allows partial responses to be retrieved. See
  3546. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3547. // for more information.
  3548. func (c *ProjectsSinksUpdateCall) Fields(s ...googleapi.Field) *ProjectsSinksUpdateCall {
  3549. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3550. return c
  3551. }
  3552. // Context sets the context to be used in this call's Do method. Any
  3553. // pending HTTP request will be aborted if the provided context is
  3554. // canceled.
  3555. func (c *ProjectsSinksUpdateCall) Context(ctx context.Context) *ProjectsSinksUpdateCall {
  3556. c.ctx_ = ctx
  3557. return c
  3558. }
  3559. // Header returns an http.Header that can be modified by the caller to
  3560. // add HTTP headers to the request.
  3561. func (c *ProjectsSinksUpdateCall) Header() http.Header {
  3562. if c.header_ == nil {
  3563. c.header_ = make(http.Header)
  3564. }
  3565. return c.header_
  3566. }
  3567. func (c *ProjectsSinksUpdateCall) doRequest(alt string) (*http.Response, error) {
  3568. reqHeaders := make(http.Header)
  3569. for k, v := range c.header_ {
  3570. reqHeaders[k] = v
  3571. }
  3572. reqHeaders.Set("User-Agent", c.s.userAgent())
  3573. var body io.Reader = nil
  3574. body, err := googleapi.WithoutDataWrapper.JSONReader(c.logsink)
  3575. if err != nil {
  3576. return nil, err
  3577. }
  3578. reqHeaders.Set("Content-Type", "application/json")
  3579. c.urlParams_.Set("alt", alt)
  3580. c.urlParams_.Set("prettyPrint", "false")
  3581. urls := googleapi.ResolveRelative(c.s.BasePath, "v2beta1/{+sinkName}")
  3582. urls += "?" + c.urlParams_.Encode()
  3583. req, err := http.NewRequest("PUT", urls, body)
  3584. if err != nil {
  3585. return nil, err
  3586. }
  3587. req.Header = reqHeaders
  3588. googleapi.Expand(req.URL, map[string]string{
  3589. "sinkName": c.sinkNameid,
  3590. })
  3591. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3592. }
  3593. // Do executes the "logging.projects.sinks.update" call.
  3594. // Exactly one of *LogSink or error will be non-nil. Any non-2xx status
  3595. // code is an error. Response headers are in either
  3596. // *LogSink.ServerResponse.Header or (if a response was returned at all)
  3597. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3598. // check whether the returned error was because http.StatusNotModified
  3599. // was returned.
  3600. func (c *ProjectsSinksUpdateCall) Do(opts ...googleapi.CallOption) (*LogSink, error) {
  3601. gensupport.SetOptions(c.urlParams_, opts...)
  3602. res, err := c.doRequest("json")
  3603. if res != nil && res.StatusCode == http.StatusNotModified {
  3604. if res.Body != nil {
  3605. res.Body.Close()
  3606. }
  3607. return nil, &googleapi.Error{
  3608. Code: res.StatusCode,
  3609. Header: res.Header,
  3610. }
  3611. }
  3612. if err != nil {
  3613. return nil, err
  3614. }
  3615. defer googleapi.CloseBody(res)
  3616. if err := googleapi.CheckResponse(res); err != nil {
  3617. return nil, err
  3618. }
  3619. ret := &LogSink{
  3620. ServerResponse: googleapi.ServerResponse{
  3621. Header: res.Header,
  3622. HTTPStatusCode: res.StatusCode,
  3623. },
  3624. }
  3625. target := &ret
  3626. if err := gensupport.DecodeResponse(target, res); err != nil {
  3627. return nil, err
  3628. }
  3629. return ret, nil
  3630. // {
  3631. // "description": "Updates a sink. This method replaces the following fields in the existing sink with values from the new sink: destination, and filter.The updated sink might also have a new writer_identity; see the unique_writer_identity field.",
  3632. // "flatPath": "v2beta1/projects/{projectsId}/sinks/{sinksId}",
  3633. // "httpMethod": "PUT",
  3634. // "id": "logging.projects.sinks.update",
  3635. // "parameterOrder": [
  3636. // "sinkName"
  3637. // ],
  3638. // "parameters": {
  3639. // "sinkName": {
  3640. // "description": "Required. The full resource name of the sink to update, including the parent resource and the sink identifier:\n\"projects/[PROJECT_ID]/sinks/[SINK_ID]\"\n\"organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]\"\n\"billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]\"\n\"folders/[FOLDER_ID]/sinks/[SINK_ID]\"\nExample: \"projects/my-project-id/sinks/my-sink-id\".",
  3641. // "location": "path",
  3642. // "pattern": "^projects/[^/]+/sinks/[^/]+$",
  3643. // "required": true,
  3644. // "type": "string"
  3645. // },
  3646. // "uniqueWriterIdentity": {
  3647. // "description": "Optional. See sinks.create for a description of this field. When updating a sink, the effect of this field on the value of writer_identity in the updated sink depends on both the old and new values of this field:\nIf the old and new values of this field are both false or both true, then there is no change to the sink's writer_identity.\nIf the old value is false and the new value is true, then writer_identity is changed to a unique service account.\nIt is an error if the old value is true and the new value is set to false or defaulted to false.",
  3648. // "location": "query",
  3649. // "type": "boolean"
  3650. // },
  3651. // "updateMask": {
  3652. // "description": "Optional. Field mask that specifies the fields in sink that need an update. A sink field will be overwritten if, and only if, it is in the update mask. name and output only fields cannot be updated.An empty updateMask is temporarily treated as using the following mask for backwards compatibility purposes: destination,filter,includeChildren At some point in the future, behavior will be removed and specifying an empty updateMask will be an error.For a detailed FieldMask definition, see https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMaskExample: updateMask=filter.",
  3653. // "format": "google-fieldmask",
  3654. // "location": "query",
  3655. // "type": "string"
  3656. // }
  3657. // },
  3658. // "path": "v2beta1/{+sinkName}",
  3659. // "request": {
  3660. // "$ref": "LogSink"
  3661. // },
  3662. // "response": {
  3663. // "$ref": "LogSink"
  3664. // },
  3665. // "scopes": [
  3666. // "https://www.googleapis.com/auth/cloud-platform",
  3667. // "https://www.googleapis.com/auth/logging.admin"
  3668. // ]
  3669. // }
  3670. }