logging-gen.go 154 KB

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