123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835 |
- // Package logging provides access to the Google Cloud Logging API.
- //
- // See https://cloud.google.com/logging/docs/
- //
- // Usage example:
- //
- // import "google.golang.org/api/logging/v2beta1"
- // ...
- // loggingService, err := logging.New(oauthHttpClient)
- package logging // import "google.golang.org/api/logging/v2beta1"
- import (
- "bytes"
- "encoding/json"
- "errors"
- "fmt"
- context "golang.org/x/net/context"
- ctxhttp "golang.org/x/net/context/ctxhttp"
- gensupport "google.golang.org/api/gensupport"
- googleapi "google.golang.org/api/googleapi"
- "io"
- "net/http"
- "net/url"
- "strconv"
- "strings"
- )
- // Always reference these packages, just in case the auto-generated code
- // below doesn't.
- var _ = bytes.NewBuffer
- var _ = strconv.Itoa
- var _ = fmt.Sprintf
- var _ = json.NewDecoder
- var _ = io.Copy
- var _ = url.Parse
- var _ = gensupport.MarshalJSON
- var _ = googleapi.Version
- var _ = errors.New
- var _ = strings.Replace
- var _ = context.Canceled
- var _ = ctxhttp.Do
- const apiId = "logging:v2beta1"
- const apiName = "logging"
- const apiVersion = "v2beta1"
- const basePath = "https://logging.googleapis.com/"
- // OAuth2 scopes used by this API.
- const (
- // View and manage your data across Google Cloud Platform services
- CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform"
- // View your data across Google Cloud Platform services
- CloudPlatformReadOnlyScope = "https://www.googleapis.com/auth/cloud-platform.read-only"
- // Administrate log data for your projects
- LoggingAdminScope = "https://www.googleapis.com/auth/logging.admin"
- // View log data for your projects
- LoggingReadScope = "https://www.googleapis.com/auth/logging.read"
- // Submit log data for your projects
- LoggingWriteScope = "https://www.googleapis.com/auth/logging.write"
- )
- func New(client *http.Client) (*Service, error) {
- if client == nil {
- return nil, errors.New("client is nil")
- }
- s := &Service{client: client, BasePath: basePath}
- s.Entries = NewEntriesService(s)
- s.MonitoredResourceDescriptors = NewMonitoredResourceDescriptorsService(s)
- s.Projects = NewProjectsService(s)
- return s, nil
- }
- type Service struct {
- client *http.Client
- BasePath string // API endpoint base URL
- UserAgent string // optional additional User-Agent fragment
- Entries *EntriesService
- MonitoredResourceDescriptors *MonitoredResourceDescriptorsService
- Projects *ProjectsService
- }
- func (s *Service) userAgent() string {
- if s.UserAgent == "" {
- return googleapi.UserAgent
- }
- return googleapi.UserAgent + " " + s.UserAgent
- }
- func NewEntriesService(s *Service) *EntriesService {
- rs := &EntriesService{s: s}
- return rs
- }
- type EntriesService struct {
- s *Service
- }
- func NewMonitoredResourceDescriptorsService(s *Service) *MonitoredResourceDescriptorsService {
- rs := &MonitoredResourceDescriptorsService{s: s}
- return rs
- }
- type MonitoredResourceDescriptorsService struct {
- s *Service
- }
- func NewProjectsService(s *Service) *ProjectsService {
- rs := &ProjectsService{s: s}
- rs.Logs = NewProjectsLogsService(s)
- rs.Metrics = NewProjectsMetricsService(s)
- rs.Sinks = NewProjectsSinksService(s)
- return rs
- }
- type ProjectsService struct {
- s *Service
- Logs *ProjectsLogsService
- Metrics *ProjectsMetricsService
- Sinks *ProjectsSinksService
- }
- func NewProjectsLogsService(s *Service) *ProjectsLogsService {
- rs := &ProjectsLogsService{s: s}
- return rs
- }
- type ProjectsLogsService struct {
- s *Service
- }
- func NewProjectsMetricsService(s *Service) *ProjectsMetricsService {
- rs := &ProjectsMetricsService{s: s}
- return rs
- }
- type ProjectsMetricsService struct {
- s *Service
- }
- func NewProjectsSinksService(s *Service) *ProjectsSinksService {
- rs := &ProjectsSinksService{s: s}
- return rs
- }
- type ProjectsSinksService struct {
- s *Service
- }
- // Empty: A generic empty message that you can re-use to avoid defining
- // duplicated empty messages in your APIs. A typical example is to use
- // it as the request or the response type of an API method. For
- // instance: service Foo { rpc Bar(google.protobuf.Empty) returns
- // (google.protobuf.Empty); } The JSON representation for `Empty` is
- // empty JSON object `{}`.
- type Empty struct {
- // ServerResponse contains the HTTP response code and headers from the
- // server.
- googleapi.ServerResponse `json:"-"`
- }
- // HttpRequest: A common proto for logging HTTP requests.
- type HttpRequest struct {
- // CacheHit: Whether or not an entity was served from cache (with or
- // without validation).
- CacheHit bool `json:"cacheHit,omitempty"`
- // Referer: The referer URL of the request, as defined in [HTTP/1.1
- // Header Field
- // Definitions](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html).
- Referer string `json:"referer,omitempty"`
- // RemoteIp: The IP address (IPv4 or IPv6) of the client that issued the
- // HTTP request. Examples: "192.168.1.1",
- // "FE80::0202:B3FF:FE1E:8329".
- RemoteIp string `json:"remoteIp,omitempty"`
- // RequestMethod: The request method. Examples: "GET", "HEAD",
- // "PUT", "POST".
- RequestMethod string `json:"requestMethod,omitempty"`
- // RequestSize: The size of the HTTP request message in bytes, including
- // the request headers and the request body.
- RequestSize int64 `json:"requestSize,omitempty,string"`
- // RequestUrl: The scheme (http, https), the host name, the path and the
- // query portion of the URL that was requested. Example:
- // "http://example.com/some/info?color=red".
- RequestUrl string `json:"requestUrl,omitempty"`
- // ResponseSize: The size of the HTTP response message sent back to the
- // client, in bytes, including the response headers and the response
- // body.
- ResponseSize int64 `json:"responseSize,omitempty,string"`
- // Status: The response code indicating the status of response.
- // Examples: 200, 404.
- Status int64 `json:"status,omitempty"`
- // UserAgent: The user agent sent by the client. Example: "Mozilla/4.0
- // (compatible; MSIE 6.0; Windows 98; Q312461; .NET CLR 1.0.3705)".
- UserAgent string `json:"userAgent,omitempty"`
- // ValidatedWithOriginServer: Whether or not the response was validated
- // with the origin server before being served from cache. This field is
- // only meaningful if `cache_hit` is True.
- ValidatedWithOriginServer bool `json:"validatedWithOriginServer,omitempty"`
- // ForceSendFields is a list of field names (e.g. "CacheHit") to
- // unconditionally include in API requests. By default, fields with
- // empty values are omitted from API requests. However, any non-pointer,
- // non-interface field appearing in ForceSendFields will be sent to the
- // server regardless of whether the field is empty or not. This may be
- // used to include empty fields in Patch requests.
- ForceSendFields []string `json:"-"`
- }
- func (s *HttpRequest) MarshalJSON() ([]byte, error) {
- type noMethod HttpRequest
- raw := noMethod(*s)
- return gensupport.MarshalJSON(raw, s.ForceSendFields)
- }
- // LabelDescriptor: A description of a label.
- type LabelDescriptor struct {
- // Description: A human-readable description for the label.
- Description string `json:"description,omitempty"`
- // Key: The label key.
- Key string `json:"key,omitempty"`
- // ValueType: The type of data that can be assigned to the label.
- //
- // Possible values:
- // "STRING"
- // "BOOL"
- // "INT64"
- ValueType string `json:"valueType,omitempty"`
- // ForceSendFields is a list of field names (e.g. "Description") to
- // unconditionally include in API requests. By default, fields with
- // empty values are omitted from API requests. However, any non-pointer,
- // non-interface field appearing in ForceSendFields will be sent to the
- // server regardless of whether the field is empty or not. This may be
- // used to include empty fields in Patch requests.
- ForceSendFields []string `json:"-"`
- }
- func (s *LabelDescriptor) MarshalJSON() ([]byte, error) {
- type noMethod LabelDescriptor
- raw := noMethod(*s)
- return gensupport.MarshalJSON(raw, s.ForceSendFields)
- }
- // ListLogEntriesRequest: The parameters to `ListLogEntries`.
- type ListLogEntriesRequest struct {
- // Filter: Optional. An [advanced logs
- // filter](/logging/docs/view/advanced_filters). The filter is compared
- // against all log entries in the projects specified by `projectIds`.
- // Only entries that match the filter are retrieved. An empty filter
- // matches all log entries.
- Filter string `json:"filter,omitempty"`
- // OrderBy: Optional. How the results should be sorted. Presently, the
- // only permitted values are "timestamp" (default) and "timestamp
- // desc". The first option returns entries in order of increasing
- // values of `LogEntry.timestamp` (oldest first), and the second option
- // returns entries in order of decreasing timestamps (newest first).
- // Entries with equal timestamps are returned in order of
- // `LogEntry.insertId`.
- OrderBy string `json:"orderBy,omitempty"`
- // PageSize: Optional. The maximum number of results to return from this
- // request. Fewer results might be returned. You must check for the
- // `nextPageToken` result to determine if additional results are
- // available, which you can retrieve by passing the `nextPageToken`
- // value in the `pageToken` parameter to the next request.
- PageSize int64 `json:"pageSize,omitempty"`
- // PageToken: Optional. If the `pageToken` request parameter is
- // supplied, then the next page of results in the set are retrieved. The
- // `pageToken` parameter must be set with the value of the
- // `nextPageToken` result parameter from the previous request. The
- // values of `projectIds`, `filter`, and `orderBy` must be the same as
- // in the previous request.
- PageToken string `json:"pageToken,omitempty"`
- // ProjectIds: Required. One or more project IDs or project numbers from
- // which to retrieve log entries. Examples of a project ID:
- // "my-project-1A", "1234567890".
- ProjectIds []string `json:"projectIds,omitempty"`
- // ForceSendFields is a list of field names (e.g. "Filter") to
- // unconditionally include in API requests. By default, fields with
- // empty values are omitted from API requests. However, any non-pointer,
- // non-interface field appearing in ForceSendFields will be sent to the
- // server regardless of whether the field is empty or not. This may be
- // used to include empty fields in Patch requests.
- ForceSendFields []string `json:"-"`
- }
- func (s *ListLogEntriesRequest) MarshalJSON() ([]byte, error) {
- type noMethod ListLogEntriesRequest
- raw := noMethod(*s)
- return gensupport.MarshalJSON(raw, s.ForceSendFields)
- }
- // ListLogEntriesResponse: Result returned from `ListLogEntries`.
- type ListLogEntriesResponse struct {
- // Entries: A list of log entries.
- Entries []*LogEntry `json:"entries,omitempty"`
- // NextPageToken: If there are more results than were returned, then
- // `nextPageToken` is given a value in the response. To get the next
- // batch of results, call this method again using the value of
- // `nextPageToken` as `pageToken`.
- NextPageToken string `json:"nextPageToken,omitempty"`
- // ServerResponse contains the HTTP response code and headers from the
- // server.
- googleapi.ServerResponse `json:"-"`
- // ForceSendFields is a list of field names (e.g. "Entries") to
- // unconditionally include in API requests. By default, fields with
- // empty values are omitted from API requests. However, any non-pointer,
- // non-interface field appearing in ForceSendFields will be sent to the
- // server regardless of whether the field is empty or not. This may be
- // used to include empty fields in Patch requests.
- ForceSendFields []string `json:"-"`
- }
- func (s *ListLogEntriesResponse) MarshalJSON() ([]byte, error) {
- type noMethod ListLogEntriesResponse
- raw := noMethod(*s)
- return gensupport.MarshalJSON(raw, s.ForceSendFields)
- }
- // ListLogMetricsResponse: Result returned from ListLogMetrics.
- type ListLogMetricsResponse struct {
- // Metrics: A list of logs-based metrics.
- Metrics []*LogMetric `json:"metrics,omitempty"`
- // NextPageToken: If there are more results than were returned, then
- // `nextPageToken` is given a value in the response. To get the next
- // batch of results, call this method again using the value of
- // `nextPageToken` as `pageToken`.
- NextPageToken string `json:"nextPageToken,omitempty"`
- // ServerResponse contains the HTTP response code and headers from the
- // server.
- googleapi.ServerResponse `json:"-"`
- // ForceSendFields is a list of field names (e.g. "Metrics") to
- // unconditionally include in API requests. By default, fields with
- // empty values are omitted from API requests. However, any non-pointer,
- // non-interface field appearing in ForceSendFields will be sent to the
- // server regardless of whether the field is empty or not. This may be
- // used to include empty fields in Patch requests.
- ForceSendFields []string `json:"-"`
- }
- func (s *ListLogMetricsResponse) MarshalJSON() ([]byte, error) {
- type noMethod ListLogMetricsResponse
- raw := noMethod(*s)
- return gensupport.MarshalJSON(raw, s.ForceSendFields)
- }
- // ListMonitoredResourceDescriptorsResponse: Result returned from
- // ListMonitoredResourceDescriptors.
- type ListMonitoredResourceDescriptorsResponse struct {
- // NextPageToken: If there are more results than were returned, then
- // `nextPageToken` is returned in the response. To get the next batch of
- // results, call this method again using the value of `nextPageToken` as
- // `pageToken`.
- NextPageToken string `json:"nextPageToken,omitempty"`
- // ResourceDescriptors: A list of resource descriptors.
- ResourceDescriptors []*MonitoredResourceDescriptor `json:"resourceDescriptors,omitempty"`
- // ServerResponse contains the HTTP response code and headers from the
- // server.
- googleapi.ServerResponse `json:"-"`
- // ForceSendFields is a list of field names (e.g. "NextPageToken") to
- // unconditionally include in API requests. By default, fields with
- // empty values are omitted from API requests. However, any non-pointer,
- // non-interface field appearing in ForceSendFields will be sent to the
- // server regardless of whether the field is empty or not. This may be
- // used to include empty fields in Patch requests.
- ForceSendFields []string `json:"-"`
- }
- func (s *ListMonitoredResourceDescriptorsResponse) MarshalJSON() ([]byte, error) {
- type noMethod ListMonitoredResourceDescriptorsResponse
- raw := noMethod(*s)
- return gensupport.MarshalJSON(raw, s.ForceSendFields)
- }
- // ListSinksResponse: Result returned from `ListSinks`.
- type ListSinksResponse struct {
- // NextPageToken: If there are more results than were returned, then
- // `nextPageToken` is given a value in the response. To get the next
- // batch of results, call this method again using the value of
- // `nextPageToken` as `pageToken`.
- NextPageToken string `json:"nextPageToken,omitempty"`
- // Sinks: A list of sinks.
- Sinks []*LogSink `json:"sinks,omitempty"`
- // ServerResponse contains the HTTP response code and headers from the
- // server.
- googleapi.ServerResponse `json:"-"`
- // ForceSendFields is a list of field names (e.g. "NextPageToken") to
- // unconditionally include in API requests. By default, fields with
- // empty values are omitted from API requests. However, any non-pointer,
- // non-interface field appearing in ForceSendFields will be sent to the
- // server regardless of whether the field is empty or not. This may be
- // used to include empty fields in Patch requests.
- ForceSendFields []string `json:"-"`
- }
- func (s *ListSinksResponse) MarshalJSON() ([]byte, error) {
- type noMethod ListSinksResponse
- raw := noMethod(*s)
- return gensupport.MarshalJSON(raw, s.ForceSendFields)
- }
- // LogEntry: An individual entry in a log.
- type LogEntry struct {
- // HttpRequest: Optional. Information about the HTTP request associated
- // with this log entry, if applicable.
- HttpRequest *HttpRequest `json:"httpRequest,omitempty"`
- // InsertId: Optional. A unique ID for the log entry. If you provide
- // this field, the logging service considers other log entries in the
- // same log with the same ID as duplicates which can be removed. If
- // omitted, Cloud Logging will generate a unique ID for this log entry.
- InsertId string `json:"insertId,omitempty"`
- // JsonPayload: The log entry payload, represented as a structure that
- // is expressed as a JSON object.
- JsonPayload LogEntryJsonPayload `json:"jsonPayload,omitempty"`
- // Labels: Optional. A set of user-defined (key, value) data that
- // provides additional information about the log entry.
- Labels map[string]string `json:"labels,omitempty"`
- // LogName: Required. The resource name of the log to which this log
- // entry belongs. The format of the name is
- // `projects/<project-id>/logs/<log-id%gt;`. Examples:
- // "projects/my-projectid/logs/syslog",
- // "projects/1234567890/logs/library.googleapis.com%2Fbook_log". The
- // log ID part of resource name must be less than 512 characters long
- // and can only include the following characters: upper and lower case
- // alphanumeric characters: [A-Za-z0-9]; and punctuation characters:
- // forward-slash, underscore, hyphen, and period. Forward-slash (`/`)
- // characters in the log ID must be URL-encoded.
- LogName string `json:"logName,omitempty"`
- // Operation: Optional. Information about an operation associated with
- // the log entry, if applicable.
- Operation *LogEntryOperation `json:"operation,omitempty"`
- // ProtoPayload: The log entry payload, represented as a protocol
- // buffer. You can only use `protoPayload` values that belong to a set
- // of approved types.
- ProtoPayload LogEntryProtoPayload `json:"protoPayload,omitempty"`
- // Resource: Required. The monitored resource associated with this log
- // entry. Example: a log entry that reports a database error would be
- // associated with the monitored resource designating the particular
- // database that reported the error.
- Resource *MonitoredResource `json:"resource,omitempty"`
- // Severity: Optional. The severity of the log entry. The default value
- // is `LogSeverity.DEFAULT`.
- //
- // Possible values:
- // "DEFAULT"
- // "DEBUG"
- // "INFO"
- // "NOTICE"
- // "WARNING"
- // "ERROR"
- // "CRITICAL"
- // "ALERT"
- // "EMERGENCY"
- Severity string `json:"severity,omitempty"`
- // TextPayload: The log entry payload, represented as a Unicode string
- // (UTF-8).
- TextPayload string `json:"textPayload,omitempty"`
- // Timestamp: Optional. The time the event described by the log entry
- // occurred. If omitted, Cloud Logging will use the time the log entry
- // is written.
- Timestamp string `json:"timestamp,omitempty"`
- // ForceSendFields is a list of field names (e.g. "HttpRequest") to
- // unconditionally include in API requests. By default, fields with
- // empty values are omitted from API requests. However, any non-pointer,
- // non-interface field appearing in ForceSendFields will be sent to the
- // server regardless of whether the field is empty or not. This may be
- // used to include empty fields in Patch requests.
- ForceSendFields []string `json:"-"`
- }
- func (s *LogEntry) MarshalJSON() ([]byte, error) {
- type noMethod LogEntry
- raw := noMethod(*s)
- return gensupport.MarshalJSON(raw, s.ForceSendFields)
- }
- type LogEntryJsonPayload interface{}
- type LogEntryProtoPayload interface{}
- // LogEntryOperation: Additional information about a potentially
- // long-running operation with which a log entry is associated.
- type LogEntryOperation struct {
- // First: Optional. Set this to True if this is the first log entry in
- // the operation.
- First bool `json:"first,omitempty"`
- // Id: Required. An arbitrary operation identifier. Log entries with the
- // same identifier are assumed to be part of the same operation.
- Id string `json:"id,omitempty"`
- // Last: Optional. Set this to True if this is the last log entry in the
- // operation.
- Last bool `json:"last,omitempty"`
- // Producer: Required. An arbitrary producer identifier. The combination
- // of `id` and `producer` must be globally unique. Examples for
- // `producer`: "MyDivision.MyBigCompany.com",
- // "github.com/MyProject/MyApplication".
- Producer string `json:"producer,omitempty"`
- // ForceSendFields is a list of field names (e.g. "First") to
- // unconditionally include in API requests. By default, fields with
- // empty values are omitted from API requests. However, any non-pointer,
- // non-interface field appearing in ForceSendFields will be sent to the
- // server regardless of whether the field is empty or not. This may be
- // used to include empty fields in Patch requests.
- ForceSendFields []string `json:"-"`
- }
- func (s *LogEntryOperation) MarshalJSON() ([]byte, error) {
- type noMethod LogEntryOperation
- raw := noMethod(*s)
- return gensupport.MarshalJSON(raw, s.ForceSendFields)
- }
- // LogLine: Application log line emitted while processing a request.
- type LogLine struct {
- // LogMessage: App-provided log message.
- LogMessage string `json:"logMessage,omitempty"`
- // Severity: Severity of this log entry.
- //
- // Possible values:
- // "DEFAULT"
- // "DEBUG"
- // "INFO"
- // "NOTICE"
- // "WARNING"
- // "ERROR"
- // "CRITICAL"
- // "ALERT"
- // "EMERGENCY"
- Severity string `json:"severity,omitempty"`
- // SourceLocation: Where in the source code this log message was
- // written.
- SourceLocation *SourceLocation `json:"sourceLocation,omitempty"`
- // Time: Approximate time when this log entry was made.
- Time string `json:"time,omitempty"`
- // ForceSendFields is a list of field names (e.g. "LogMessage") to
- // unconditionally include in API requests. By default, fields with
- // empty values are omitted from API requests. However, any non-pointer,
- // non-interface field appearing in ForceSendFields will be sent to the
- // server regardless of whether the field is empty or not. This may be
- // used to include empty fields in Patch requests.
- ForceSendFields []string `json:"-"`
- }
- func (s *LogLine) MarshalJSON() ([]byte, error) {
- type noMethod LogLine
- raw := noMethod(*s)
- return gensupport.MarshalJSON(raw, s.ForceSendFields)
- }
- // LogMetric: Describes a logs-based metric. The value of the metric is
- // the number of log entries that match a logs filter.
- type LogMetric struct {
- // Description: A description of this metric, which is used in
- // documentation.
- Description string `json:"description,omitempty"`
- // Filter: An [advanced logs
- // filter](/logging/docs/view/advanced_filters). Example:
- // "logName:syslog AND severity>=ERROR".
- Filter string `json:"filter,omitempty"`
- // Name: Required. The client-assigned metric identifier. Example:
- // "severe_errors". Metric identifiers are limited to 1000 characters
- // and can include only the following characters: `A-Z`, `a-z`, `0-9`,
- // and the special characters `_-.,+!*',()%/\`. The forward-slash
- // character (`/`) denotes a hierarchy of name pieces, and it cannot be
- // the first character of the name.
- Name string `json:"name,omitempty"`
- // ServerResponse contains the HTTP response code and headers from the
- // server.
- googleapi.ServerResponse `json:"-"`
- // ForceSendFields is a list of field names (e.g. "Description") to
- // unconditionally include in API requests. By default, fields with
- // empty values are omitted from API requests. However, any non-pointer,
- // non-interface field appearing in ForceSendFields will be sent to the
- // server regardless of whether the field is empty or not. This may be
- // used to include empty fields in Patch requests.
- ForceSendFields []string `json:"-"`
- }
- func (s *LogMetric) MarshalJSON() ([]byte, error) {
- type noMethod LogMetric
- raw := noMethod(*s)
- return gensupport.MarshalJSON(raw, s.ForceSendFields)
- }
- // LogSink: Describes a sink used to export log entries outside Cloud
- // Logging.
- type LogSink struct {
- // Destination: The export destination. See [Exporting Logs With
- // Sinks](/logging/docs/api/tasks/exporting-logs). Examples:
- // "storage.googleapis.com/a-bucket",
- // "bigquery.googleapis.com/projects/a-project-id/datasets/a-dataset".
- Destination string `json:"destination,omitempty"`
- // Filter: An [advanced logs
- // filter](/logging/docs/view/advanced_filters) that defines the log
- // entries to be exported. The filter must be consistent with the log
- // entry format designed by the `outputVersionFormat` parameter,
- // regardless of the format of the log entry that was originally written
- // to Cloud Logging. Example: "logName:syslog AND severity>=ERROR".
- Filter string `json:"filter,omitempty"`
- // Name: Required. The client-assigned sink identifier. Example:
- // "my-severe-errors-to-pubsub". Sink identifiers are limited to 1000
- // characters and can include only the following characters: `A-Z`,
- // `a-z`, `0-9`, and the special characters `_-.`.
- Name string `json:"name,omitempty"`
- // OutputVersionFormat: The log entry version used when exporting log
- // entries from this sink. This version does not have to correspond to
- // the version of the log entry when it was written to Cloud Logging.
- //
- // Possible values:
- // "VERSION_FORMAT_UNSPECIFIED"
- // "V2"
- // "V1"
- OutputVersionFormat string `json:"outputVersionFormat,omitempty"`
- // ServerResponse contains the HTTP response code and headers from the
- // server.
- googleapi.ServerResponse `json:"-"`
- // ForceSendFields is a list of field names (e.g. "Destination") to
- // unconditionally include in API requests. By default, fields with
- // empty values are omitted from API requests. However, any non-pointer,
- // non-interface field appearing in ForceSendFields will be sent to the
- // server regardless of whether the field is empty or not. This may be
- // used to include empty fields in Patch requests.
- ForceSendFields []string `json:"-"`
- }
- func (s *LogSink) MarshalJSON() ([]byte, error) {
- type noMethod LogSink
- raw := noMethod(*s)
- return gensupport.MarshalJSON(raw, s.ForceSendFields)
- }
- // MonitoredResource: A specific monitored resource or a group of
- // monitored resources.
- type MonitoredResource struct {
- // Labels: Values for some or all of the labels listed in the associated
- // monitored resource descriptor. For example, specify a specific Cloud
- // SQL database by supplying values for both the "database_id" and
- // "zone" labels. Specify the set of all Cloud SQL databases in a
- // particular location by supplying a value for only the "zone" label.
- Labels map[string]string `json:"labels,omitempty"`
- // Type: The type of monitored resource. This field must match the value
- // of the `type` field in a MonitoredResourceDescriptor object. For
- // example, "cloudsql_database" represents Cloud SQL databases.
- Type string `json:"type,omitempty"`
- // ForceSendFields is a list of field names (e.g. "Labels") to
- // unconditionally include in API requests. By default, fields with
- // empty values are omitted from API requests. However, any non-pointer,
- // non-interface field appearing in ForceSendFields will be sent to the
- // server regardless of whether the field is empty or not. This may be
- // used to include empty fields in Patch requests.
- ForceSendFields []string `json:"-"`
- }
- func (s *MonitoredResource) MarshalJSON() ([]byte, error) {
- type noMethod MonitoredResource
- raw := noMethod(*s)
- return gensupport.MarshalJSON(raw, s.ForceSendFields)
- }
- // MonitoredResourceDescriptor: A description of a type of monitored
- // resource.
- type MonitoredResourceDescriptor struct {
- // Description: A detailed description of the monitored resource type,
- // which is used in documentation.
- Description string `json:"description,omitempty"`
- // DisplayName: A concise name for the monitored resource type, which is
- // displayed in user interfaces. For example, "Cloud SQL Database".
- DisplayName string `json:"displayName,omitempty"`
- // Labels: A set of labels that can be used to describe instances of
- // this monitored resource type. For example, Cloud SQL databases can be
- // labeled with their "database_id" and their "zone".
- Labels []*LabelDescriptor `json:"labels,omitempty"`
- // Type: The monitored resource type. For example, the type
- // "cloudsql_database" represents databases in Google Cloud SQL.
- Type string `json:"type,omitempty"`
- // ForceSendFields is a list of field names (e.g. "Description") to
- // unconditionally include in API requests. By default, fields with
- // empty values are omitted from API requests. However, any non-pointer,
- // non-interface field appearing in ForceSendFields will be sent to the
- // server regardless of whether the field is empty or not. This may be
- // used to include empty fields in Patch requests.
- ForceSendFields []string `json:"-"`
- }
- func (s *MonitoredResourceDescriptor) MarshalJSON() ([]byte, error) {
- type noMethod MonitoredResourceDescriptor
- raw := noMethod(*s)
- return gensupport.MarshalJSON(raw, s.ForceSendFields)
- }
- // RequestLog: Complete log information about a single HTTP request to
- // an App Engine application.
- type RequestLog struct {
- // AppEngineRelease: App Engine release version.
- AppEngineRelease string `json:"appEngineRelease,omitempty"`
- // AppId: Application that handled this request.
- AppId string `json:"appId,omitempty"`
- // Cost: An indication of the relative cost of serving this request.
- Cost float64 `json:"cost,omitempty"`
- // EndTime: Time when the request finished.
- EndTime string `json:"endTime,omitempty"`
- // Finished: Whether this request is finished or active.
- Finished bool `json:"finished,omitempty"`
- // Host: Internet host and port number of the resource being requested.
- Host string `json:"host,omitempty"`
- // HttpVersion: HTTP version of request. Example: "HTTP/1.1".
- HttpVersion string `json:"httpVersion,omitempty"`
- // InstanceId: An identifier for the instance that handled the request.
- InstanceId string `json:"instanceId,omitempty"`
- // InstanceIndex: If the instance processing this request belongs to a
- // manually scaled module, then this is the 0-based index of the
- // instance. Otherwise, this value is -1.
- InstanceIndex int64 `json:"instanceIndex,omitempty"`
- // Ip: Origin IP address.
- Ip string `json:"ip,omitempty"`
- // Latency: Latency of the request.
- Latency string `json:"latency,omitempty"`
- // Line: A list of log lines emitted by the application while serving
- // this request.
- Line []*LogLine `json:"line,omitempty"`
- // MegaCycles: Number of CPU megacycles used to process request.
- MegaCycles int64 `json:"megaCycles,omitempty,string"`
- // Method: Request method. Example: "GET", "HEAD", "PUT",
- // "POST", "DELETE".
- Method string `json:"method,omitempty"`
- // ModuleId: Module of the application that handled this request.
- ModuleId string `json:"moduleId,omitempty"`
- // Nickname: The logged-in user who made the request. Most likely, this
- // is the part of the user's email before the `@` sign. The field value
- // is the same for different requests from the same user, but different
- // users can have similar names. This information is also available to
- // the application via the App Engine Users API. This field will be
- // populated starting with App Engine 1.9.21.
- Nickname string `json:"nickname,omitempty"`
- // PendingTime: Time this request spent in the pending request queue.
- PendingTime string `json:"pendingTime,omitempty"`
- // Referrer: Referrer URL of request.
- Referrer string `json:"referrer,omitempty"`
- // RequestId: Globally unique identifier for a request, which is based
- // on the request start time. Request IDs for requests which started
- // later will compare greater as strings than those for requests which
- // started earlier.
- RequestId string `json:"requestId,omitempty"`
- // Resource: Contains the path and query portion of the URL that was
- // requested. For example, if the URL was
- // "http://example.com/app?name=val", the resource would be
- // "/app?name=val". The fragment identifier, which is identified by the
- // `#` character, is not included.
- Resource string `json:"resource,omitempty"`
- // ResponseSize: Size in bytes sent back to client by request.
- ResponseSize int64 `json:"responseSize,omitempty,string"`
- // SourceReference: Source code for the application that handled this
- // request. There can be more than one source reference per deployed
- // application if source code is distributed among multiple
- // repositories.
- SourceReference []*SourceReference `json:"sourceReference,omitempty"`
- // StartTime: Time when the request started.
- StartTime string `json:"startTime,omitempty"`
- // Status: HTTP response status code. Example: 200, 404.
- Status int64 `json:"status,omitempty"`
- // TaskName: Task name of the request, in the case of an offline
- // request.
- TaskName string `json:"taskName,omitempty"`
- // TaskQueueName: Queue name of the request, in the case of an offline
- // request.
- TaskQueueName string `json:"taskQueueName,omitempty"`
- // TraceId: Cloud Trace identifier for this request.
- TraceId string `json:"traceId,omitempty"`
- // UrlMapEntry: File or class that handled the request.
- UrlMapEntry string `json:"urlMapEntry,omitempty"`
- // UserAgent: User agent that made the request.
- UserAgent string `json:"userAgent,omitempty"`
- // VersionId: Version of the application that handled this request.
- VersionId string `json:"versionId,omitempty"`
- // WasLoadingRequest: Whether this was a loading request for the
- // instance.
- WasLoadingRequest bool `json:"wasLoadingRequest,omitempty"`
- // ForceSendFields is a list of field names (e.g. "AppEngineRelease") to
- // unconditionally include in API requests. By default, fields with
- // empty values are omitted from API requests. However, any non-pointer,
- // non-interface field appearing in ForceSendFields will be sent to the
- // server regardless of whether the field is empty or not. This may be
- // used to include empty fields in Patch requests.
- ForceSendFields []string `json:"-"`
- }
- func (s *RequestLog) MarshalJSON() ([]byte, error) {
- type noMethod RequestLog
- raw := noMethod(*s)
- return gensupport.MarshalJSON(raw, s.ForceSendFields)
- }
- // SourceLocation: Specifies a location in a source code file.
- type SourceLocation struct {
- // File: Source file name. Depending on the runtime environment, this
- // might be a simple name or a fully-qualified name.
- File string `json:"file,omitempty"`
- // FunctionName: Human-readable name of the function or method being
- // invoked, with optional context such as the class or package name.
- // This information is used in contexts such as the logs viewer, where a
- // file and line number are less meaningful. The format can vary by
- // language. For example: `qual.if.ied.Class.method` (Java),
- // `dir/package.func` (Go), `function` (Python).
- FunctionName string `json:"functionName,omitempty"`
- // Line: Line within the source file.
- Line int64 `json:"line,omitempty,string"`
- // ForceSendFields is a list of field names (e.g. "File") to
- // unconditionally include in API requests. By default, fields with
- // empty values are omitted from API requests. However, any non-pointer,
- // non-interface field appearing in ForceSendFields will be sent to the
- // server regardless of whether the field is empty or not. This may be
- // used to include empty fields in Patch requests.
- ForceSendFields []string `json:"-"`
- }
- func (s *SourceLocation) MarshalJSON() ([]byte, error) {
- type noMethod SourceLocation
- raw := noMethod(*s)
- return gensupport.MarshalJSON(raw, s.ForceSendFields)
- }
- // SourceReference: A reference to a particular snapshot of the source
- // tree used to build and deploy an application.
- type SourceReference struct {
- // Repository: Optional. A URI string identifying the repository.
- // Example: "https://github.com/GoogleCloudPlatform/kubernetes.git"
- Repository string `json:"repository,omitempty"`
- // RevisionId: The canonical and persistent identifier of the deployed
- // revision. Example (git): "0035781c50ec7aa23385dc841529ce8a4b70db1b"
- RevisionId string `json:"revisionId,omitempty"`
- // ForceSendFields is a list of field names (e.g. "Repository") to
- // unconditionally include in API requests. By default, fields with
- // empty values are omitted from API requests. However, any non-pointer,
- // non-interface field appearing in ForceSendFields will be sent to the
- // server regardless of whether the field is empty or not. This may be
- // used to include empty fields in Patch requests.
- ForceSendFields []string `json:"-"`
- }
- func (s *SourceReference) MarshalJSON() ([]byte, error) {
- type noMethod SourceReference
- raw := noMethod(*s)
- return gensupport.MarshalJSON(raw, s.ForceSendFields)
- }
- // WriteLogEntriesRequest: The parameters to WriteLogEntries.
- type WriteLogEntriesRequest struct {
- // Entries: Required. The log entries to write. The log entries must
- // have values for all required fields.
- Entries []*LogEntry `json:"entries,omitempty"`
- // Labels: Optional. User-defined `key:value` items that are added to
- // the `labels` field of each log entry in `entries`, except when a log
- // entry specifies its own `key:value` item with the same key. Example:
- // `{ "size": "large", "color":"red" }`
- Labels map[string]string `json:"labels,omitempty"`
- // LogName: Optional. A default log resource name for those log entries
- // in `entries` that do not specify their own `logName`. Example:
- // "projects/my-project/logs/syslog". See LogEntry.
- LogName string `json:"logName,omitempty"`
- // Resource: Optional. A default monitored resource for those log
- // entries in `entries` that do not specify their own `resource`.
- Resource *MonitoredResource `json:"resource,omitempty"`
- // ForceSendFields is a list of field names (e.g. "Entries") to
- // unconditionally include in API requests. By default, fields with
- // empty values are omitted from API requests. However, any non-pointer,
- // non-interface field appearing in ForceSendFields will be sent to the
- // server regardless of whether the field is empty or not. This may be
- // used to include empty fields in Patch requests.
- ForceSendFields []string `json:"-"`
- }
- func (s *WriteLogEntriesRequest) MarshalJSON() ([]byte, error) {
- type noMethod WriteLogEntriesRequest
- raw := noMethod(*s)
- return gensupport.MarshalJSON(raw, s.ForceSendFields)
- }
- // WriteLogEntriesResponse: Result returned from WriteLogEntries. empty
- type WriteLogEntriesResponse struct {
- // ServerResponse contains the HTTP response code and headers from the
- // server.
- googleapi.ServerResponse `json:"-"`
- }
- // method id "logging.entries.list":
- type EntriesListCall struct {
- s *Service
- listlogentriesrequest *ListLogEntriesRequest
- urlParams_ gensupport.URLParams
- ctx_ context.Context
- }
- // List: Lists log entries. Use this method to retrieve log entries from
- // Cloud Logging. For ways to export log entries, see [Exporting
- // Logs](/logging/docs/export).
- func (r *EntriesService) List(listlogentriesrequest *ListLogEntriesRequest) *EntriesListCall {
- c := &EntriesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
- c.listlogentriesrequest = listlogentriesrequest
- return c
- }
- // Fields allows partial responses to be retrieved. See
- // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
- // for more information.
- func (c *EntriesListCall) Fields(s ...googleapi.Field) *EntriesListCall {
- c.urlParams_.Set("fields", googleapi.CombineFields(s))
- return c
- }
- // Context sets the context to be used in this call's Do method. Any
- // pending HTTP request will be aborted if the provided context is
- // canceled.
- func (c *EntriesListCall) Context(ctx context.Context) *EntriesListCall {
- c.ctx_ = ctx
- return c
- }
- func (c *EntriesListCall) doRequest(alt string) (*http.Response, error) {
- var body io.Reader = nil
- body, err := googleapi.WithoutDataWrapper.JSONReader(c.listlogentriesrequest)
- if err != nil {
- return nil, err
- }
- ctype := "application/json"
- c.urlParams_.Set("alt", alt)
- urls := googleapi.ResolveRelative(c.s.BasePath, "v2beta1/entries:list")
- urls += "?" + c.urlParams_.Encode()
- req, _ := http.NewRequest("POST", urls, body)
- googleapi.SetOpaque(req.URL)
- req.Header.Set("Content-Type", ctype)
- req.Header.Set("User-Agent", c.s.userAgent())
- if c.ctx_ != nil {
- return ctxhttp.Do(c.ctx_, c.s.client, req)
- }
- return c.s.client.Do(req)
- }
- // Do executes the "logging.entries.list" call.
- // Exactly one of *ListLogEntriesResponse or error will be non-nil. Any
- // non-2xx status code is an error. Response headers are in either
- // *ListLogEntriesResponse.ServerResponse.Header or (if a response was
- // returned at all) in error.(*googleapi.Error).Header. Use
- // googleapi.IsNotModified to check whether the returned error was
- // because http.StatusNotModified was returned.
- func (c *EntriesListCall) Do(opts ...googleapi.CallOption) (*ListLogEntriesResponse, error) {
- gensupport.SetOptions(c.urlParams_, opts...)
- res, err := c.doRequest("json")
- if res != nil && res.StatusCode == http.StatusNotModified {
- if res.Body != nil {
- res.Body.Close()
- }
- return nil, &googleapi.Error{
- Code: res.StatusCode,
- Header: res.Header,
- }
- }
- if err != nil {
- return nil, err
- }
- defer googleapi.CloseBody(res)
- if err := googleapi.CheckResponse(res); err != nil {
- return nil, err
- }
- ret := &ListLogEntriesResponse{
- ServerResponse: googleapi.ServerResponse{
- Header: res.Header,
- HTTPStatusCode: res.StatusCode,
- },
- }
- if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
- return nil, err
- }
- return ret, nil
- // {
- // "description": "Lists log entries. Use this method to retrieve log entries from Cloud Logging. For ways to export log entries, see [Exporting Logs](/logging/docs/export).",
- // "httpMethod": "POST",
- // "id": "logging.entries.list",
- // "path": "v2beta1/entries:list",
- // "request": {
- // "$ref": "ListLogEntriesRequest"
- // },
- // "response": {
- // "$ref": "ListLogEntriesResponse"
- // },
- // "scopes": [
- // "https://www.googleapis.com/auth/cloud-platform",
- // "https://www.googleapis.com/auth/cloud-platform.read-only",
- // "https://www.googleapis.com/auth/logging.admin",
- // "https://www.googleapis.com/auth/logging.read"
- // ]
- // }
- }
- // method id "logging.entries.write":
- type EntriesWriteCall struct {
- s *Service
- writelogentriesrequest *WriteLogEntriesRequest
- urlParams_ gensupport.URLParams
- ctx_ context.Context
- }
- // Write: Writes log entries to Cloud Logging. All log entries in Cloud
- // Logging are written by this method.
- func (r *EntriesService) Write(writelogentriesrequest *WriteLogEntriesRequest) *EntriesWriteCall {
- c := &EntriesWriteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
- c.writelogentriesrequest = writelogentriesrequest
- return c
- }
- // Fields allows partial responses to be retrieved. See
- // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
- // for more information.
- func (c *EntriesWriteCall) Fields(s ...googleapi.Field) *EntriesWriteCall {
- c.urlParams_.Set("fields", googleapi.CombineFields(s))
- return c
- }
- // Context sets the context to be used in this call's Do method. Any
- // pending HTTP request will be aborted if the provided context is
- // canceled.
- func (c *EntriesWriteCall) Context(ctx context.Context) *EntriesWriteCall {
- c.ctx_ = ctx
- return c
- }
- func (c *EntriesWriteCall) doRequest(alt string) (*http.Response, error) {
- var body io.Reader = nil
- body, err := googleapi.WithoutDataWrapper.JSONReader(c.writelogentriesrequest)
- if err != nil {
- return nil, err
- }
- ctype := "application/json"
- c.urlParams_.Set("alt", alt)
- urls := googleapi.ResolveRelative(c.s.BasePath, "v2beta1/entries:write")
- urls += "?" + c.urlParams_.Encode()
- req, _ := http.NewRequest("POST", urls, body)
- googleapi.SetOpaque(req.URL)
- req.Header.Set("Content-Type", ctype)
- req.Header.Set("User-Agent", c.s.userAgent())
- if c.ctx_ != nil {
- return ctxhttp.Do(c.ctx_, c.s.client, req)
- }
- return c.s.client.Do(req)
- }
- // Do executes the "logging.entries.write" call.
- // Exactly one of *WriteLogEntriesResponse or error will be non-nil. Any
- // non-2xx status code is an error. Response headers are in either
- // *WriteLogEntriesResponse.ServerResponse.Header or (if a response was
- // returned at all) in error.(*googleapi.Error).Header. Use
- // googleapi.IsNotModified to check whether the returned error was
- // because http.StatusNotModified was returned.
- func (c *EntriesWriteCall) Do(opts ...googleapi.CallOption) (*WriteLogEntriesResponse, error) {
- gensupport.SetOptions(c.urlParams_, opts...)
- res, err := c.doRequest("json")
- if res != nil && res.StatusCode == http.StatusNotModified {
- if res.Body != nil {
- res.Body.Close()
- }
- return nil, &googleapi.Error{
- Code: res.StatusCode,
- Header: res.Header,
- }
- }
- if err != nil {
- return nil, err
- }
- defer googleapi.CloseBody(res)
- if err := googleapi.CheckResponse(res); err != nil {
- return nil, err
- }
- ret := &WriteLogEntriesResponse{
- ServerResponse: googleapi.ServerResponse{
- Header: res.Header,
- HTTPStatusCode: res.StatusCode,
- },
- }
- if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
- return nil, err
- }
- return ret, nil
- // {
- // "description": "Writes log entries to Cloud Logging. All log entries in Cloud Logging are written by this method.",
- // "httpMethod": "POST",
- // "id": "logging.entries.write",
- // "path": "v2beta1/entries:write",
- // "request": {
- // "$ref": "WriteLogEntriesRequest"
- // },
- // "response": {
- // "$ref": "WriteLogEntriesResponse"
- // },
- // "scopes": [
- // "https://www.googleapis.com/auth/cloud-platform",
- // "https://www.googleapis.com/auth/logging.admin",
- // "https://www.googleapis.com/auth/logging.write"
- // ]
- // }
- }
- // method id "logging.monitoredResourceDescriptors.list":
- type MonitoredResourceDescriptorsListCall struct {
- s *Service
- urlParams_ gensupport.URLParams
- ifNoneMatch_ string
- ctx_ context.Context
- }
- // List: Lists monitored resource descriptors that are used by Cloud
- // Logging.
- func (r *MonitoredResourceDescriptorsService) List() *MonitoredResourceDescriptorsListCall {
- c := &MonitoredResourceDescriptorsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
- return c
- }
- // PageSize sets the optional parameter "pageSize": The maximum number
- // of results to return from this request. Fewer results might be
- // returned. You must check for the `nextPageToken` result to determine
- // if additional results are available, which you can retrieve by
- // passing the `nextPageToken` value in the `pageToken` parameter to the
- // next request.
- func (c *MonitoredResourceDescriptorsListCall) PageSize(pageSize int64) *MonitoredResourceDescriptorsListCall {
- c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
- return c
- }
- // PageToken sets the optional parameter "pageToken": If the `pageToken`
- // request parameter is supplied, then the next page of results in the
- // set are retrieved. The `pageToken` parameter must be set with the
- // value of the `nextPageToken` result parameter from the previous
- // request.
- func (c *MonitoredResourceDescriptorsListCall) PageToken(pageToken string) *MonitoredResourceDescriptorsListCall {
- c.urlParams_.Set("pageToken", pageToken)
- return c
- }
- // Fields allows partial responses to be retrieved. See
- // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
- // for more information.
- func (c *MonitoredResourceDescriptorsListCall) Fields(s ...googleapi.Field) *MonitoredResourceDescriptorsListCall {
- c.urlParams_.Set("fields", googleapi.CombineFields(s))
- return c
- }
- // IfNoneMatch sets the optional parameter which makes the operation
- // fail if the object's ETag matches the given value. This is useful for
- // getting updates only after the object has changed since the last
- // request. Use googleapi.IsNotModified to check whether the response
- // error from Do is the result of In-None-Match.
- func (c *MonitoredResourceDescriptorsListCall) IfNoneMatch(entityTag string) *MonitoredResourceDescriptorsListCall {
- c.ifNoneMatch_ = entityTag
- return c
- }
- // Context sets the context to be used in this call's Do method. Any
- // pending HTTP request will be aborted if the provided context is
- // canceled.
- func (c *MonitoredResourceDescriptorsListCall) Context(ctx context.Context) *MonitoredResourceDescriptorsListCall {
- c.ctx_ = ctx
- return c
- }
- func (c *MonitoredResourceDescriptorsListCall) doRequest(alt string) (*http.Response, error) {
- var body io.Reader = nil
- c.urlParams_.Set("alt", alt)
- urls := googleapi.ResolveRelative(c.s.BasePath, "v2beta1/monitoredResourceDescriptors")
- urls += "?" + c.urlParams_.Encode()
- req, _ := http.NewRequest("GET", urls, body)
- googleapi.SetOpaque(req.URL)
- req.Header.Set("User-Agent", c.s.userAgent())
- if c.ifNoneMatch_ != "" {
- req.Header.Set("If-None-Match", c.ifNoneMatch_)
- }
- if c.ctx_ != nil {
- return ctxhttp.Do(c.ctx_, c.s.client, req)
- }
- return c.s.client.Do(req)
- }
- // Do executes the "logging.monitoredResourceDescriptors.list" call.
- // Exactly one of *ListMonitoredResourceDescriptorsResponse or error
- // will be non-nil. Any non-2xx status code is an error. Response
- // headers are in either
- // *ListMonitoredResourceDescriptorsResponse.ServerResponse.Header or
- // (if a response was returned at all) in
- // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
- // whether the returned error was because http.StatusNotModified was
- // returned.
- func (c *MonitoredResourceDescriptorsListCall) Do(opts ...googleapi.CallOption) (*ListMonitoredResourceDescriptorsResponse, error) {
- gensupport.SetOptions(c.urlParams_, opts...)
- res, err := c.doRequest("json")
- if res != nil && res.StatusCode == http.StatusNotModified {
- if res.Body != nil {
- res.Body.Close()
- }
- return nil, &googleapi.Error{
- Code: res.StatusCode,
- Header: res.Header,
- }
- }
- if err != nil {
- return nil, err
- }
- defer googleapi.CloseBody(res)
- if err := googleapi.CheckResponse(res); err != nil {
- return nil, err
- }
- ret := &ListMonitoredResourceDescriptorsResponse{
- ServerResponse: googleapi.ServerResponse{
- Header: res.Header,
- HTTPStatusCode: res.StatusCode,
- },
- }
- if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
- return nil, err
- }
- return ret, nil
- // {
- // "description": "Lists monitored resource descriptors that are used by Cloud Logging.",
- // "httpMethod": "GET",
- // "id": "logging.monitoredResourceDescriptors.list",
- // "parameters": {
- // "pageSize": {
- // "description": "Optional. The maximum number of results to return from this request. Fewer results might be returned. You must check for the `nextPageToken` result to determine if additional results are available, which you can retrieve by passing the `nextPageToken` value in the `pageToken` parameter to the next request.",
- // "format": "int32",
- // "location": "query",
- // "type": "integer"
- // },
- // "pageToken": {
- // "description": "Optional. If the `pageToken` request parameter is supplied, then the next page of results in the set are retrieved. The `pageToken` parameter must be set with the value of the `nextPageToken` result parameter from the previous request.",
- // "location": "query",
- // "type": "string"
- // }
- // },
- // "path": "v2beta1/monitoredResourceDescriptors",
- // "response": {
- // "$ref": "ListMonitoredResourceDescriptorsResponse"
- // },
- // "scopes": [
- // "https://www.googleapis.com/auth/cloud-platform",
- // "https://www.googleapis.com/auth/cloud-platform.read-only",
- // "https://www.googleapis.com/auth/logging.admin",
- // "https://www.googleapis.com/auth/logging.read"
- // ]
- // }
- }
- // Pages invokes f for each page of results.
- // A non-nil error returned from f will halt the iteration.
- // The provided context supersedes any context provided to the Context method.
- func (c *MonitoredResourceDescriptorsListCall) Pages(ctx context.Context, f func(*ListMonitoredResourceDescriptorsResponse) error) error {
- c.ctx_ = ctx
- defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
- for {
- x, err := c.Do()
- if err != nil {
- return err
- }
- if err := f(x); err != nil {
- return err
- }
- if x.NextPageToken == "" {
- return nil
- }
- c.PageToken(x.NextPageToken)
- }
- }
- // method id "logging.projects.logs.delete":
- type ProjectsLogsDeleteCall struct {
- s *Service
- logName string
- urlParams_ gensupport.URLParams
- ctx_ context.Context
- }
- // Delete: Deletes a log and all its log entries. The log will reappear
- // if it receives new entries.
- func (r *ProjectsLogsService) Delete(logName string) *ProjectsLogsDeleteCall {
- c := &ProjectsLogsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
- c.logName = logName
- return c
- }
- // Fields allows partial responses to be retrieved. See
- // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
- // for more information.
- func (c *ProjectsLogsDeleteCall) Fields(s ...googleapi.Field) *ProjectsLogsDeleteCall {
- c.urlParams_.Set("fields", googleapi.CombineFields(s))
- return c
- }
- // Context sets the context to be used in this call's Do method. Any
- // pending HTTP request will be aborted if the provided context is
- // canceled.
- func (c *ProjectsLogsDeleteCall) Context(ctx context.Context) *ProjectsLogsDeleteCall {
- c.ctx_ = ctx
- return c
- }
- func (c *ProjectsLogsDeleteCall) doRequest(alt string) (*http.Response, error) {
- var body io.Reader = nil
- c.urlParams_.Set("alt", alt)
- urls := googleapi.ResolveRelative(c.s.BasePath, "v2beta1/{+logName}")
- urls += "?" + c.urlParams_.Encode()
- req, _ := http.NewRequest("DELETE", urls, body)
- googleapi.Expand(req.URL, map[string]string{
- "logName": c.logName,
- })
- req.Header.Set("User-Agent", c.s.userAgent())
- if c.ctx_ != nil {
- return ctxhttp.Do(c.ctx_, c.s.client, req)
- }
- return c.s.client.Do(req)
- }
- // Do executes the "logging.projects.logs.delete" call.
- // Exactly one of *Empty or error will be non-nil. Any non-2xx status
- // code is an error. Response headers are in either
- // *Empty.ServerResponse.Header or (if a response was returned at all)
- // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
- // check whether the returned error was because http.StatusNotModified
- // was returned.
- func (c *ProjectsLogsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
- gensupport.SetOptions(c.urlParams_, opts...)
- res, err := c.doRequest("json")
- if res != nil && res.StatusCode == http.StatusNotModified {
- if res.Body != nil {
- res.Body.Close()
- }
- return nil, &googleapi.Error{
- Code: res.StatusCode,
- Header: res.Header,
- }
- }
- if err != nil {
- return nil, err
- }
- defer googleapi.CloseBody(res)
- if err := googleapi.CheckResponse(res); err != nil {
- return nil, err
- }
- ret := &Empty{
- ServerResponse: googleapi.ServerResponse{
- Header: res.Header,
- HTTPStatusCode: res.StatusCode,
- },
- }
- if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
- return nil, err
- }
- return ret, nil
- // {
- // "description": "Deletes a log and all its log entries. The log will reappear if it receives new entries.",
- // "httpMethod": "DELETE",
- // "id": "logging.projects.logs.delete",
- // "parameterOrder": [
- // "logName"
- // ],
- // "parameters": {
- // "logName": {
- // "description": "Required. The resource name of the log to delete. Example: `\"projects/my-project/logs/syslog\"`.",
- // "location": "path",
- // "pattern": "^projects/[^/]*/logs/[^/]*$",
- // "required": true,
- // "type": "string"
- // }
- // },
- // "path": "v2beta1/{+logName}",
- // "response": {
- // "$ref": "Empty"
- // },
- // "scopes": [
- // "https://www.googleapis.com/auth/cloud-platform",
- // "https://www.googleapis.com/auth/logging.admin"
- // ]
- // }
- }
- // method id "logging.projects.metrics.create":
- type ProjectsMetricsCreateCall struct {
- s *Service
- projectName string
- logmetric *LogMetric
- urlParams_ gensupport.URLParams
- ctx_ context.Context
- }
- // Create: Creates a logs-based metric.
- func (r *ProjectsMetricsService) Create(projectName string, logmetric *LogMetric) *ProjectsMetricsCreateCall {
- c := &ProjectsMetricsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
- c.projectName = projectName
- c.logmetric = logmetric
- return c
- }
- // Fields allows partial responses to be retrieved. See
- // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
- // for more information.
- func (c *ProjectsMetricsCreateCall) Fields(s ...googleapi.Field) *ProjectsMetricsCreateCall {
- c.urlParams_.Set("fields", googleapi.CombineFields(s))
- return c
- }
- // Context sets the context to be used in this call's Do method. Any
- // pending HTTP request will be aborted if the provided context is
- // canceled.
- func (c *ProjectsMetricsCreateCall) Context(ctx context.Context) *ProjectsMetricsCreateCall {
- c.ctx_ = ctx
- return c
- }
- func (c *ProjectsMetricsCreateCall) doRequest(alt string) (*http.Response, error) {
- var body io.Reader = nil
- body, err := googleapi.WithoutDataWrapper.JSONReader(c.logmetric)
- if err != nil {
- return nil, err
- }
- ctype := "application/json"
- c.urlParams_.Set("alt", alt)
- urls := googleapi.ResolveRelative(c.s.BasePath, "v2beta1/{+projectName}/metrics")
- urls += "?" + c.urlParams_.Encode()
- req, _ := http.NewRequest("POST", urls, body)
- googleapi.Expand(req.URL, map[string]string{
- "projectName": c.projectName,
- })
- req.Header.Set("Content-Type", ctype)
- req.Header.Set("User-Agent", c.s.userAgent())
- if c.ctx_ != nil {
- return ctxhttp.Do(c.ctx_, c.s.client, req)
- }
- return c.s.client.Do(req)
- }
- // Do executes the "logging.projects.metrics.create" call.
- // Exactly one of *LogMetric or error will be non-nil. Any non-2xx
- // status code is an error. Response headers are in either
- // *LogMetric.ServerResponse.Header or (if a response was returned at
- // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
- // to check whether the returned error was because
- // http.StatusNotModified was returned.
- func (c *ProjectsMetricsCreateCall) Do(opts ...googleapi.CallOption) (*LogMetric, error) {
- gensupport.SetOptions(c.urlParams_, opts...)
- res, err := c.doRequest("json")
- if res != nil && res.StatusCode == http.StatusNotModified {
- if res.Body != nil {
- res.Body.Close()
- }
- return nil, &googleapi.Error{
- Code: res.StatusCode,
- Header: res.Header,
- }
- }
- if err != nil {
- return nil, err
- }
- defer googleapi.CloseBody(res)
- if err := googleapi.CheckResponse(res); err != nil {
- return nil, err
- }
- ret := &LogMetric{
- ServerResponse: googleapi.ServerResponse{
- Header: res.Header,
- HTTPStatusCode: res.StatusCode,
- },
- }
- if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
- return nil, err
- }
- return ret, nil
- // {
- // "description": "Creates a logs-based metric.",
- // "httpMethod": "POST",
- // "id": "logging.projects.metrics.create",
- // "parameterOrder": [
- // "projectName"
- // ],
- // "parameters": {
- // "projectName": {
- // "description": "The resource name of the project in which to create the metric. Example: `\"projects/my-project-id\"`. The new metric must be provided in the request.",
- // "location": "path",
- // "pattern": "^projects/[^/]*$",
- // "required": true,
- // "type": "string"
- // }
- // },
- // "path": "v2beta1/{+projectName}/metrics",
- // "request": {
- // "$ref": "LogMetric"
- // },
- // "response": {
- // "$ref": "LogMetric"
- // },
- // "scopes": [
- // "https://www.googleapis.com/auth/cloud-platform",
- // "https://www.googleapis.com/auth/logging.admin",
- // "https://www.googleapis.com/auth/logging.write"
- // ]
- // }
- }
- // method id "logging.projects.metrics.delete":
- type ProjectsMetricsDeleteCall struct {
- s *Service
- metricName string
- urlParams_ gensupport.URLParams
- ctx_ context.Context
- }
- // Delete: Deletes a logs-based metric.
- func (r *ProjectsMetricsService) Delete(metricName string) *ProjectsMetricsDeleteCall {
- c := &ProjectsMetricsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
- c.metricName = metricName
- return c
- }
- // Fields allows partial responses to be retrieved. See
- // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
- // for more information.
- func (c *ProjectsMetricsDeleteCall) Fields(s ...googleapi.Field) *ProjectsMetricsDeleteCall {
- c.urlParams_.Set("fields", googleapi.CombineFields(s))
- return c
- }
- // Context sets the context to be used in this call's Do method. Any
- // pending HTTP request will be aborted if the provided context is
- // canceled.
- func (c *ProjectsMetricsDeleteCall) Context(ctx context.Context) *ProjectsMetricsDeleteCall {
- c.ctx_ = ctx
- return c
- }
- func (c *ProjectsMetricsDeleteCall) doRequest(alt string) (*http.Response, error) {
- var body io.Reader = nil
- c.urlParams_.Set("alt", alt)
- urls := googleapi.ResolveRelative(c.s.BasePath, "v2beta1/{+metricName}")
- urls += "?" + c.urlParams_.Encode()
- req, _ := http.NewRequest("DELETE", urls, body)
- googleapi.Expand(req.URL, map[string]string{
- "metricName": c.metricName,
- })
- req.Header.Set("User-Agent", c.s.userAgent())
- if c.ctx_ != nil {
- return ctxhttp.Do(c.ctx_, c.s.client, req)
- }
- return c.s.client.Do(req)
- }
- // Do executes the "logging.projects.metrics.delete" call.
- // Exactly one of *Empty or error will be non-nil. Any non-2xx status
- // code is an error. Response headers are in either
- // *Empty.ServerResponse.Header or (if a response was returned at all)
- // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
- // check whether the returned error was because http.StatusNotModified
- // was returned.
- func (c *ProjectsMetricsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
- gensupport.SetOptions(c.urlParams_, opts...)
- res, err := c.doRequest("json")
- if res != nil && res.StatusCode == http.StatusNotModified {
- if res.Body != nil {
- res.Body.Close()
- }
- return nil, &googleapi.Error{
- Code: res.StatusCode,
- Header: res.Header,
- }
- }
- if err != nil {
- return nil, err
- }
- defer googleapi.CloseBody(res)
- if err := googleapi.CheckResponse(res); err != nil {
- return nil, err
- }
- ret := &Empty{
- ServerResponse: googleapi.ServerResponse{
- Header: res.Header,
- HTTPStatusCode: res.StatusCode,
- },
- }
- if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
- return nil, err
- }
- return ret, nil
- // {
- // "description": "Deletes a logs-based metric.",
- // "httpMethod": "DELETE",
- // "id": "logging.projects.metrics.delete",
- // "parameterOrder": [
- // "metricName"
- // ],
- // "parameters": {
- // "metricName": {
- // "description": "The resource name of the metric to delete. Example: `\"projects/my-project-id/metrics/my-metric-id\"`.",
- // "location": "path",
- // "pattern": "^projects/[^/]*/metrics/[^/]*$",
- // "required": true,
- // "type": "string"
- // }
- // },
- // "path": "v2beta1/{+metricName}",
- // "response": {
- // "$ref": "Empty"
- // },
- // "scopes": [
- // "https://www.googleapis.com/auth/cloud-platform",
- // "https://www.googleapis.com/auth/logging.admin",
- // "https://www.googleapis.com/auth/logging.write"
- // ]
- // }
- }
- // method id "logging.projects.metrics.get":
- type ProjectsMetricsGetCall struct {
- s *Service
- metricName string
- urlParams_ gensupport.URLParams
- ifNoneMatch_ string
- ctx_ context.Context
- }
- // Get: Gets a logs-based metric.
- func (r *ProjectsMetricsService) Get(metricName string) *ProjectsMetricsGetCall {
- c := &ProjectsMetricsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
- c.metricName = metricName
- return c
- }
- // Fields allows partial responses to be retrieved. See
- // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
- // for more information.
- func (c *ProjectsMetricsGetCall) Fields(s ...googleapi.Field) *ProjectsMetricsGetCall {
- c.urlParams_.Set("fields", googleapi.CombineFields(s))
- return c
- }
- // IfNoneMatch sets the optional parameter which makes the operation
- // fail if the object's ETag matches the given value. This is useful for
- // getting updates only after the object has changed since the last
- // request. Use googleapi.IsNotModified to check whether the response
- // error from Do is the result of In-None-Match.
- func (c *ProjectsMetricsGetCall) IfNoneMatch(entityTag string) *ProjectsMetricsGetCall {
- c.ifNoneMatch_ = entityTag
- return c
- }
- // Context sets the context to be used in this call's Do method. Any
- // pending HTTP request will be aborted if the provided context is
- // canceled.
- func (c *ProjectsMetricsGetCall) Context(ctx context.Context) *ProjectsMetricsGetCall {
- c.ctx_ = ctx
- return c
- }
- func (c *ProjectsMetricsGetCall) doRequest(alt string) (*http.Response, error) {
- var body io.Reader = nil
- c.urlParams_.Set("alt", alt)
- urls := googleapi.ResolveRelative(c.s.BasePath, "v2beta1/{+metricName}")
- urls += "?" + c.urlParams_.Encode()
- req, _ := http.NewRequest("GET", urls, body)
- googleapi.Expand(req.URL, map[string]string{
- "metricName": c.metricName,
- })
- req.Header.Set("User-Agent", c.s.userAgent())
- if c.ifNoneMatch_ != "" {
- req.Header.Set("If-None-Match", c.ifNoneMatch_)
- }
- if c.ctx_ != nil {
- return ctxhttp.Do(c.ctx_, c.s.client, req)
- }
- return c.s.client.Do(req)
- }
- // Do executes the "logging.projects.metrics.get" call.
- // Exactly one of *LogMetric or error will be non-nil. Any non-2xx
- // status code is an error. Response headers are in either
- // *LogMetric.ServerResponse.Header or (if a response was returned at
- // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
- // to check whether the returned error was because
- // http.StatusNotModified was returned.
- func (c *ProjectsMetricsGetCall) Do(opts ...googleapi.CallOption) (*LogMetric, error) {
- gensupport.SetOptions(c.urlParams_, opts...)
- res, err := c.doRequest("json")
- if res != nil && res.StatusCode == http.StatusNotModified {
- if res.Body != nil {
- res.Body.Close()
- }
- return nil, &googleapi.Error{
- Code: res.StatusCode,
- Header: res.Header,
- }
- }
- if err != nil {
- return nil, err
- }
- defer googleapi.CloseBody(res)
- if err := googleapi.CheckResponse(res); err != nil {
- return nil, err
- }
- ret := &LogMetric{
- ServerResponse: googleapi.ServerResponse{
- Header: res.Header,
- HTTPStatusCode: res.StatusCode,
- },
- }
- if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
- return nil, err
- }
- return ret, nil
- // {
- // "description": "Gets a logs-based metric.",
- // "httpMethod": "GET",
- // "id": "logging.projects.metrics.get",
- // "parameterOrder": [
- // "metricName"
- // ],
- // "parameters": {
- // "metricName": {
- // "description": "The resource name of the desired metric. Example: `\"projects/my-project-id/metrics/my-metric-id\"`.",
- // "location": "path",
- // "pattern": "^projects/[^/]*/metrics/[^/]*$",
- // "required": true,
- // "type": "string"
- // }
- // },
- // "path": "v2beta1/{+metricName}",
- // "response": {
- // "$ref": "LogMetric"
- // },
- // "scopes": [
- // "https://www.googleapis.com/auth/cloud-platform",
- // "https://www.googleapis.com/auth/cloud-platform.read-only",
- // "https://www.googleapis.com/auth/logging.admin",
- // "https://www.googleapis.com/auth/logging.read"
- // ]
- // }
- }
- // method id "logging.projects.metrics.list":
- type ProjectsMetricsListCall struct {
- s *Service
- projectName string
- urlParams_ gensupport.URLParams
- ifNoneMatch_ string
- ctx_ context.Context
- }
- // List: Lists logs-based metrics.
- func (r *ProjectsMetricsService) List(projectName string) *ProjectsMetricsListCall {
- c := &ProjectsMetricsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
- c.projectName = projectName
- return c
- }
- // PageSize sets the optional parameter "pageSize": The maximum number
- // of results to return from this request. Fewer results might be
- // returned. You must check for the `nextPageToken` result to determine
- // if additional results are available, which you can retrieve by
- // passing the `nextPageToken` value in the `pageToken` parameter to the
- // next request.
- func (c *ProjectsMetricsListCall) PageSize(pageSize int64) *ProjectsMetricsListCall {
- c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
- return c
- }
- // PageToken sets the optional parameter "pageToken": If the `pageToken`
- // request parameter is supplied, then the next page of results in the
- // set are retrieved. The `pageToken` parameter must be set with the
- // value of the `nextPageToken` result parameter from the previous
- // request. The value of `projectName` must be the same as in the
- // previous request.
- func (c *ProjectsMetricsListCall) PageToken(pageToken string) *ProjectsMetricsListCall {
- c.urlParams_.Set("pageToken", pageToken)
- return c
- }
- // Fields allows partial responses to be retrieved. See
- // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
- // for more information.
- func (c *ProjectsMetricsListCall) Fields(s ...googleapi.Field) *ProjectsMetricsListCall {
- c.urlParams_.Set("fields", googleapi.CombineFields(s))
- return c
- }
- // IfNoneMatch sets the optional parameter which makes the operation
- // fail if the object's ETag matches the given value. This is useful for
- // getting updates only after the object has changed since the last
- // request. Use googleapi.IsNotModified to check whether the response
- // error from Do is the result of In-None-Match.
- func (c *ProjectsMetricsListCall) IfNoneMatch(entityTag string) *ProjectsMetricsListCall {
- c.ifNoneMatch_ = entityTag
- return c
- }
- // Context sets the context to be used in this call's Do method. Any
- // pending HTTP request will be aborted if the provided context is
- // canceled.
- func (c *ProjectsMetricsListCall) Context(ctx context.Context) *ProjectsMetricsListCall {
- c.ctx_ = ctx
- return c
- }
- func (c *ProjectsMetricsListCall) doRequest(alt string) (*http.Response, error) {
- var body io.Reader = nil
- c.urlParams_.Set("alt", alt)
- urls := googleapi.ResolveRelative(c.s.BasePath, "v2beta1/{+projectName}/metrics")
- urls += "?" + c.urlParams_.Encode()
- req, _ := http.NewRequest("GET", urls, body)
- googleapi.Expand(req.URL, map[string]string{
- "projectName": c.projectName,
- })
- req.Header.Set("User-Agent", c.s.userAgent())
- if c.ifNoneMatch_ != "" {
- req.Header.Set("If-None-Match", c.ifNoneMatch_)
- }
- if c.ctx_ != nil {
- return ctxhttp.Do(c.ctx_, c.s.client, req)
- }
- return c.s.client.Do(req)
- }
- // Do executes the "logging.projects.metrics.list" call.
- // Exactly one of *ListLogMetricsResponse or error will be non-nil. Any
- // non-2xx status code is an error. Response headers are in either
- // *ListLogMetricsResponse.ServerResponse.Header or (if a response was
- // returned at all) in error.(*googleapi.Error).Header. Use
- // googleapi.IsNotModified to check whether the returned error was
- // because http.StatusNotModified was returned.
- func (c *ProjectsMetricsListCall) Do(opts ...googleapi.CallOption) (*ListLogMetricsResponse, error) {
- gensupport.SetOptions(c.urlParams_, opts...)
- res, err := c.doRequest("json")
- if res != nil && res.StatusCode == http.StatusNotModified {
- if res.Body != nil {
- res.Body.Close()
- }
- return nil, &googleapi.Error{
- Code: res.StatusCode,
- Header: res.Header,
- }
- }
- if err != nil {
- return nil, err
- }
- defer googleapi.CloseBody(res)
- if err := googleapi.CheckResponse(res); err != nil {
- return nil, err
- }
- ret := &ListLogMetricsResponse{
- ServerResponse: googleapi.ServerResponse{
- Header: res.Header,
- HTTPStatusCode: res.StatusCode,
- },
- }
- if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
- return nil, err
- }
- return ret, nil
- // {
- // "description": "Lists logs-based metrics.",
- // "httpMethod": "GET",
- // "id": "logging.projects.metrics.list",
- // "parameterOrder": [
- // "projectName"
- // ],
- // "parameters": {
- // "pageSize": {
- // "description": "Optional. The maximum number of results to return from this request. Fewer results might be returned. You must check for the `nextPageToken` result to determine if additional results are available, which you can retrieve by passing the `nextPageToken` value in the `pageToken` parameter to the next request.",
- // "format": "int32",
- // "location": "query",
- // "type": "integer"
- // },
- // "pageToken": {
- // "description": "Optional. If the `pageToken` request parameter is supplied, then the next page of results in the set are retrieved. The `pageToken` parameter must be set with the value of the `nextPageToken` result parameter from the previous request. The value of `projectName` must be the same as in the previous request.",
- // "location": "query",
- // "type": "string"
- // },
- // "projectName": {
- // "description": "Required. The resource name of the project containing the metrics. Example: `\"projects/my-project-id\"`.",
- // "location": "path",
- // "pattern": "^projects/[^/]*$",
- // "required": true,
- // "type": "string"
- // }
- // },
- // "path": "v2beta1/{+projectName}/metrics",
- // "response": {
- // "$ref": "ListLogMetricsResponse"
- // },
- // "scopes": [
- // "https://www.googleapis.com/auth/cloud-platform",
- // "https://www.googleapis.com/auth/cloud-platform.read-only",
- // "https://www.googleapis.com/auth/logging.admin",
- // "https://www.googleapis.com/auth/logging.read"
- // ]
- // }
- }
- // Pages invokes f for each page of results.
- // A non-nil error returned from f will halt the iteration.
- // The provided context supersedes any context provided to the Context method.
- func (c *ProjectsMetricsListCall) Pages(ctx context.Context, f func(*ListLogMetricsResponse) error) error {
- c.ctx_ = ctx
- defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
- for {
- x, err := c.Do()
- if err != nil {
- return err
- }
- if err := f(x); err != nil {
- return err
- }
- if x.NextPageToken == "" {
- return nil
- }
- c.PageToken(x.NextPageToken)
- }
- }
- // method id "logging.projects.metrics.update":
- type ProjectsMetricsUpdateCall struct {
- s *Service
- metricNameid string
- logmetric *LogMetric
- urlParams_ gensupport.URLParams
- ctx_ context.Context
- }
- // Update: Creates or updates a logs-based metric.
- func (r *ProjectsMetricsService) Update(metricNameid string, logmetric *LogMetric) *ProjectsMetricsUpdateCall {
- c := &ProjectsMetricsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
- c.metricNameid = metricNameid
- c.logmetric = logmetric
- return c
- }
- // Fields allows partial responses to be retrieved. See
- // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
- // for more information.
- func (c *ProjectsMetricsUpdateCall) Fields(s ...googleapi.Field) *ProjectsMetricsUpdateCall {
- c.urlParams_.Set("fields", googleapi.CombineFields(s))
- return c
- }
- // Context sets the context to be used in this call's Do method. Any
- // pending HTTP request will be aborted if the provided context is
- // canceled.
- func (c *ProjectsMetricsUpdateCall) Context(ctx context.Context) *ProjectsMetricsUpdateCall {
- c.ctx_ = ctx
- return c
- }
- func (c *ProjectsMetricsUpdateCall) doRequest(alt string) (*http.Response, error) {
- var body io.Reader = nil
- body, err := googleapi.WithoutDataWrapper.JSONReader(c.logmetric)
- if err != nil {
- return nil, err
- }
- ctype := "application/json"
- c.urlParams_.Set("alt", alt)
- urls := googleapi.ResolveRelative(c.s.BasePath, "v2beta1/{+metricName}")
- urls += "?" + c.urlParams_.Encode()
- req, _ := http.NewRequest("PUT", urls, body)
- googleapi.Expand(req.URL, map[string]string{
- "metricName": c.metricNameid,
- })
- req.Header.Set("Content-Type", ctype)
- req.Header.Set("User-Agent", c.s.userAgent())
- if c.ctx_ != nil {
- return ctxhttp.Do(c.ctx_, c.s.client, req)
- }
- return c.s.client.Do(req)
- }
- // Do executes the "logging.projects.metrics.update" call.
- // Exactly one of *LogMetric or error will be non-nil. Any non-2xx
- // status code is an error. Response headers are in either
- // *LogMetric.ServerResponse.Header or (if a response was returned at
- // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
- // to check whether the returned error was because
- // http.StatusNotModified was returned.
- func (c *ProjectsMetricsUpdateCall) Do(opts ...googleapi.CallOption) (*LogMetric, error) {
- gensupport.SetOptions(c.urlParams_, opts...)
- res, err := c.doRequest("json")
- if res != nil && res.StatusCode == http.StatusNotModified {
- if res.Body != nil {
- res.Body.Close()
- }
- return nil, &googleapi.Error{
- Code: res.StatusCode,
- Header: res.Header,
- }
- }
- if err != nil {
- return nil, err
- }
- defer googleapi.CloseBody(res)
- if err := googleapi.CheckResponse(res); err != nil {
- return nil, err
- }
- ret := &LogMetric{
- ServerResponse: googleapi.ServerResponse{
- Header: res.Header,
- HTTPStatusCode: res.StatusCode,
- },
- }
- if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
- return nil, err
- }
- return ret, nil
- // {
- // "description": "Creates or updates a logs-based metric.",
- // "httpMethod": "PUT",
- // "id": "logging.projects.metrics.update",
- // "parameterOrder": [
- // "metricName"
- // ],
- // "parameters": {
- // "metricName": {
- // "description": "The resource name of the metric to update. Example: `\"projects/my-project-id/metrics/my-metric-id\"`. The updated metric must be provided in the request and have the same identifier that is specified in `metricName`. If the metric does not exist, it is created.",
- // "location": "path",
- // "pattern": "^projects/[^/]*/metrics/[^/]*$",
- // "required": true,
- // "type": "string"
- // }
- // },
- // "path": "v2beta1/{+metricName}",
- // "request": {
- // "$ref": "LogMetric"
- // },
- // "response": {
- // "$ref": "LogMetric"
- // },
- // "scopes": [
- // "https://www.googleapis.com/auth/cloud-platform",
- // "https://www.googleapis.com/auth/logging.admin",
- // "https://www.googleapis.com/auth/logging.write"
- // ]
- // }
- }
- // method id "logging.projects.sinks.create":
- type ProjectsSinksCreateCall struct {
- s *Service
- projectName string
- logsink *LogSink
- urlParams_ gensupport.URLParams
- ctx_ context.Context
- }
- // Create: Creates a sink.
- func (r *ProjectsSinksService) Create(projectName string, logsink *LogSink) *ProjectsSinksCreateCall {
- c := &ProjectsSinksCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
- c.projectName = projectName
- c.logsink = logsink
- return c
- }
- // Fields allows partial responses to be retrieved. See
- // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
- // for more information.
- func (c *ProjectsSinksCreateCall) Fields(s ...googleapi.Field) *ProjectsSinksCreateCall {
- c.urlParams_.Set("fields", googleapi.CombineFields(s))
- return c
- }
- // Context sets the context to be used in this call's Do method. Any
- // pending HTTP request will be aborted if the provided context is
- // canceled.
- func (c *ProjectsSinksCreateCall) Context(ctx context.Context) *ProjectsSinksCreateCall {
- c.ctx_ = ctx
- return c
- }
- func (c *ProjectsSinksCreateCall) doRequest(alt string) (*http.Response, error) {
- var body io.Reader = nil
- body, err := googleapi.WithoutDataWrapper.JSONReader(c.logsink)
- if err != nil {
- return nil, err
- }
- ctype := "application/json"
- c.urlParams_.Set("alt", alt)
- urls := googleapi.ResolveRelative(c.s.BasePath, "v2beta1/{+projectName}/sinks")
- urls += "?" + c.urlParams_.Encode()
- req, _ := http.NewRequest("POST", urls, body)
- googleapi.Expand(req.URL, map[string]string{
- "projectName": c.projectName,
- })
- req.Header.Set("Content-Type", ctype)
- req.Header.Set("User-Agent", c.s.userAgent())
- if c.ctx_ != nil {
- return ctxhttp.Do(c.ctx_, c.s.client, req)
- }
- return c.s.client.Do(req)
- }
- // Do executes the "logging.projects.sinks.create" call.
- // Exactly one of *LogSink or error will be non-nil. Any non-2xx status
- // code is an error. Response headers are in either
- // *LogSink.ServerResponse.Header or (if a response was returned at all)
- // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
- // check whether the returned error was because http.StatusNotModified
- // was returned.
- func (c *ProjectsSinksCreateCall) Do(opts ...googleapi.CallOption) (*LogSink, error) {
- gensupport.SetOptions(c.urlParams_, opts...)
- res, err := c.doRequest("json")
- if res != nil && res.StatusCode == http.StatusNotModified {
- if res.Body != nil {
- res.Body.Close()
- }
- return nil, &googleapi.Error{
- Code: res.StatusCode,
- Header: res.Header,
- }
- }
- if err != nil {
- return nil, err
- }
- defer googleapi.CloseBody(res)
- if err := googleapi.CheckResponse(res); err != nil {
- return nil, err
- }
- ret := &LogSink{
- ServerResponse: googleapi.ServerResponse{
- Header: res.Header,
- HTTPStatusCode: res.StatusCode,
- },
- }
- if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
- return nil, err
- }
- return ret, nil
- // {
- // "description": "Creates a sink.",
- // "httpMethod": "POST",
- // "id": "logging.projects.sinks.create",
- // "parameterOrder": [
- // "projectName"
- // ],
- // "parameters": {
- // "projectName": {
- // "description": "The resource name of the project in which to create the sink. Example: `\"projects/my-project-id\"`. The new sink must be provided in the request.",
- // "location": "path",
- // "pattern": "^projects/[^/]*$",
- // "required": true,
- // "type": "string"
- // }
- // },
- // "path": "v2beta1/{+projectName}/sinks",
- // "request": {
- // "$ref": "LogSink"
- // },
- // "response": {
- // "$ref": "LogSink"
- // },
- // "scopes": [
- // "https://www.googleapis.com/auth/cloud-platform",
- // "https://www.googleapis.com/auth/logging.admin"
- // ]
- // }
- }
- // method id "logging.projects.sinks.delete":
- type ProjectsSinksDeleteCall struct {
- s *Service
- sinkName string
- urlParams_ gensupport.URLParams
- ctx_ context.Context
- }
- // Delete: Deletes a sink.
- func (r *ProjectsSinksService) Delete(sinkName string) *ProjectsSinksDeleteCall {
- c := &ProjectsSinksDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
- c.sinkName = sinkName
- return c
- }
- // Fields allows partial responses to be retrieved. See
- // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
- // for more information.
- func (c *ProjectsSinksDeleteCall) Fields(s ...googleapi.Field) *ProjectsSinksDeleteCall {
- c.urlParams_.Set("fields", googleapi.CombineFields(s))
- return c
- }
- // Context sets the context to be used in this call's Do method. Any
- // pending HTTP request will be aborted if the provided context is
- // canceled.
- func (c *ProjectsSinksDeleteCall) Context(ctx context.Context) *ProjectsSinksDeleteCall {
- c.ctx_ = ctx
- return c
- }
- func (c *ProjectsSinksDeleteCall) doRequest(alt string) (*http.Response, error) {
- var body io.Reader = nil
- c.urlParams_.Set("alt", alt)
- urls := googleapi.ResolveRelative(c.s.BasePath, "v2beta1/{+sinkName}")
- urls += "?" + c.urlParams_.Encode()
- req, _ := http.NewRequest("DELETE", urls, body)
- googleapi.Expand(req.URL, map[string]string{
- "sinkName": c.sinkName,
- })
- req.Header.Set("User-Agent", c.s.userAgent())
- if c.ctx_ != nil {
- return ctxhttp.Do(c.ctx_, c.s.client, req)
- }
- return c.s.client.Do(req)
- }
- // Do executes the "logging.projects.sinks.delete" call.
- // Exactly one of *Empty or error will be non-nil. Any non-2xx status
- // code is an error. Response headers are in either
- // *Empty.ServerResponse.Header or (if a response was returned at all)
- // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
- // check whether the returned error was because http.StatusNotModified
- // was returned.
- func (c *ProjectsSinksDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
- gensupport.SetOptions(c.urlParams_, opts...)
- res, err := c.doRequest("json")
- if res != nil && res.StatusCode == http.StatusNotModified {
- if res.Body != nil {
- res.Body.Close()
- }
- return nil, &googleapi.Error{
- Code: res.StatusCode,
- Header: res.Header,
- }
- }
- if err != nil {
- return nil, err
- }
- defer googleapi.CloseBody(res)
- if err := googleapi.CheckResponse(res); err != nil {
- return nil, err
- }
- ret := &Empty{
- ServerResponse: googleapi.ServerResponse{
- Header: res.Header,
- HTTPStatusCode: res.StatusCode,
- },
- }
- if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
- return nil, err
- }
- return ret, nil
- // {
- // "description": "Deletes a sink.",
- // "httpMethod": "DELETE",
- // "id": "logging.projects.sinks.delete",
- // "parameterOrder": [
- // "sinkName"
- // ],
- // "parameters": {
- // "sinkName": {
- // "description": "The resource name of the sink to delete. Example: `\"projects/my-project-id/sinks/my-sink-id\"`.",
- // "location": "path",
- // "pattern": "^projects/[^/]*/sinks/[^/]*$",
- // "required": true,
- // "type": "string"
- // }
- // },
- // "path": "v2beta1/{+sinkName}",
- // "response": {
- // "$ref": "Empty"
- // },
- // "scopes": [
- // "https://www.googleapis.com/auth/cloud-platform",
- // "https://www.googleapis.com/auth/logging.admin"
- // ]
- // }
- }
- // method id "logging.projects.sinks.get":
- type ProjectsSinksGetCall struct {
- s *Service
- sinkName string
- urlParams_ gensupport.URLParams
- ifNoneMatch_ string
- ctx_ context.Context
- }
- // Get: Gets a sink.
- func (r *ProjectsSinksService) Get(sinkName string) *ProjectsSinksGetCall {
- c := &ProjectsSinksGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
- c.sinkName = sinkName
- return c
- }
- // Fields allows partial responses to be retrieved. See
- // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
- // for more information.
- func (c *ProjectsSinksGetCall) Fields(s ...googleapi.Field) *ProjectsSinksGetCall {
- c.urlParams_.Set("fields", googleapi.CombineFields(s))
- return c
- }
- // IfNoneMatch sets the optional parameter which makes the operation
- // fail if the object's ETag matches the given value. This is useful for
- // getting updates only after the object has changed since the last
- // request. Use googleapi.IsNotModified to check whether the response
- // error from Do is the result of In-None-Match.
- func (c *ProjectsSinksGetCall) IfNoneMatch(entityTag string) *ProjectsSinksGetCall {
- c.ifNoneMatch_ = entityTag
- return c
- }
- // Context sets the context to be used in this call's Do method. Any
- // pending HTTP request will be aborted if the provided context is
- // canceled.
- func (c *ProjectsSinksGetCall) Context(ctx context.Context) *ProjectsSinksGetCall {
- c.ctx_ = ctx
- return c
- }
- func (c *ProjectsSinksGetCall) doRequest(alt string) (*http.Response, error) {
- var body io.Reader = nil
- c.urlParams_.Set("alt", alt)
- urls := googleapi.ResolveRelative(c.s.BasePath, "v2beta1/{+sinkName}")
- urls += "?" + c.urlParams_.Encode()
- req, _ := http.NewRequest("GET", urls, body)
- googleapi.Expand(req.URL, map[string]string{
- "sinkName": c.sinkName,
- })
- req.Header.Set("User-Agent", c.s.userAgent())
- if c.ifNoneMatch_ != "" {
- req.Header.Set("If-None-Match", c.ifNoneMatch_)
- }
- if c.ctx_ != nil {
- return ctxhttp.Do(c.ctx_, c.s.client, req)
- }
- return c.s.client.Do(req)
- }
- // Do executes the "logging.projects.sinks.get" call.
- // Exactly one of *LogSink or error will be non-nil. Any non-2xx status
- // code is an error. Response headers are in either
- // *LogSink.ServerResponse.Header or (if a response was returned at all)
- // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
- // check whether the returned error was because http.StatusNotModified
- // was returned.
- func (c *ProjectsSinksGetCall) Do(opts ...googleapi.CallOption) (*LogSink, error) {
- gensupport.SetOptions(c.urlParams_, opts...)
- res, err := c.doRequest("json")
- if res != nil && res.StatusCode == http.StatusNotModified {
- if res.Body != nil {
- res.Body.Close()
- }
- return nil, &googleapi.Error{
- Code: res.StatusCode,
- Header: res.Header,
- }
- }
- if err != nil {
- return nil, err
- }
- defer googleapi.CloseBody(res)
- if err := googleapi.CheckResponse(res); err != nil {
- return nil, err
- }
- ret := &LogSink{
- ServerResponse: googleapi.ServerResponse{
- Header: res.Header,
- HTTPStatusCode: res.StatusCode,
- },
- }
- if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
- return nil, err
- }
- return ret, nil
- // {
- // "description": "Gets a sink.",
- // "httpMethod": "GET",
- // "id": "logging.projects.sinks.get",
- // "parameterOrder": [
- // "sinkName"
- // ],
- // "parameters": {
- // "sinkName": {
- // "description": "The resource name of the sink to return. Example: `\"projects/my-project-id/sinks/my-sink-id\"`.",
- // "location": "path",
- // "pattern": "^projects/[^/]*/sinks/[^/]*$",
- // "required": true,
- // "type": "string"
- // }
- // },
- // "path": "v2beta1/{+sinkName}",
- // "response": {
- // "$ref": "LogSink"
- // },
- // "scopes": [
- // "https://www.googleapis.com/auth/cloud-platform",
- // "https://www.googleapis.com/auth/cloud-platform.read-only",
- // "https://www.googleapis.com/auth/logging.admin",
- // "https://www.googleapis.com/auth/logging.read"
- // ]
- // }
- }
- // method id "logging.projects.sinks.list":
- type ProjectsSinksListCall struct {
- s *Service
- projectName string
- urlParams_ gensupport.URLParams
- ifNoneMatch_ string
- ctx_ context.Context
- }
- // List: Lists sinks.
- func (r *ProjectsSinksService) List(projectName string) *ProjectsSinksListCall {
- c := &ProjectsSinksListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
- c.projectName = projectName
- return c
- }
- // PageSize sets the optional parameter "pageSize": The maximum number
- // of results to return from this request. Fewer results might be
- // returned. You must check for the `nextPageToken` result to determine
- // if additional results are available, which you can retrieve by
- // passing the `nextPageToken` value in the `pageToken` parameter to the
- // next request.
- func (c *ProjectsSinksListCall) PageSize(pageSize int64) *ProjectsSinksListCall {
- c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
- return c
- }
- // PageToken sets the optional parameter "pageToken": If the `pageToken`
- // request parameter is supplied, then the next page of results in the
- // set are retrieved. The `pageToken` parameter must be set with the
- // value of the `nextPageToken` result parameter from the previous
- // request. The value of `projectName` must be the same as in the
- // previous request.
- func (c *ProjectsSinksListCall) PageToken(pageToken string) *ProjectsSinksListCall {
- c.urlParams_.Set("pageToken", pageToken)
- return c
- }
- // Fields allows partial responses to be retrieved. See
- // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
- // for more information.
- func (c *ProjectsSinksListCall) Fields(s ...googleapi.Field) *ProjectsSinksListCall {
- c.urlParams_.Set("fields", googleapi.CombineFields(s))
- return c
- }
- // IfNoneMatch sets the optional parameter which makes the operation
- // fail if the object's ETag matches the given value. This is useful for
- // getting updates only after the object has changed since the last
- // request. Use googleapi.IsNotModified to check whether the response
- // error from Do is the result of In-None-Match.
- func (c *ProjectsSinksListCall) IfNoneMatch(entityTag string) *ProjectsSinksListCall {
- c.ifNoneMatch_ = entityTag
- return c
- }
- // Context sets the context to be used in this call's Do method. Any
- // pending HTTP request will be aborted if the provided context is
- // canceled.
- func (c *ProjectsSinksListCall) Context(ctx context.Context) *ProjectsSinksListCall {
- c.ctx_ = ctx
- return c
- }
- func (c *ProjectsSinksListCall) doRequest(alt string) (*http.Response, error) {
- var body io.Reader = nil
- c.urlParams_.Set("alt", alt)
- urls := googleapi.ResolveRelative(c.s.BasePath, "v2beta1/{+projectName}/sinks")
- urls += "?" + c.urlParams_.Encode()
- req, _ := http.NewRequest("GET", urls, body)
- googleapi.Expand(req.URL, map[string]string{
- "projectName": c.projectName,
- })
- req.Header.Set("User-Agent", c.s.userAgent())
- if c.ifNoneMatch_ != "" {
- req.Header.Set("If-None-Match", c.ifNoneMatch_)
- }
- if c.ctx_ != nil {
- return ctxhttp.Do(c.ctx_, c.s.client, req)
- }
- return c.s.client.Do(req)
- }
- // Do executes the "logging.projects.sinks.list" call.
- // Exactly one of *ListSinksResponse or error will be non-nil. Any
- // non-2xx status code is an error. Response headers are in either
- // *ListSinksResponse.ServerResponse.Header or (if a response was
- // returned at all) in error.(*googleapi.Error).Header. Use
- // googleapi.IsNotModified to check whether the returned error was
- // because http.StatusNotModified was returned.
- func (c *ProjectsSinksListCall) Do(opts ...googleapi.CallOption) (*ListSinksResponse, error) {
- gensupport.SetOptions(c.urlParams_, opts...)
- res, err := c.doRequest("json")
- if res != nil && res.StatusCode == http.StatusNotModified {
- if res.Body != nil {
- res.Body.Close()
- }
- return nil, &googleapi.Error{
- Code: res.StatusCode,
- Header: res.Header,
- }
- }
- if err != nil {
- return nil, err
- }
- defer googleapi.CloseBody(res)
- if err := googleapi.CheckResponse(res); err != nil {
- return nil, err
- }
- ret := &ListSinksResponse{
- ServerResponse: googleapi.ServerResponse{
- Header: res.Header,
- HTTPStatusCode: res.StatusCode,
- },
- }
- if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
- return nil, err
- }
- return ret, nil
- // {
- // "description": "Lists sinks.",
- // "httpMethod": "GET",
- // "id": "logging.projects.sinks.list",
- // "parameterOrder": [
- // "projectName"
- // ],
- // "parameters": {
- // "pageSize": {
- // "description": "Optional. The maximum number of results to return from this request. Fewer results might be returned. You must check for the `nextPageToken` result to determine if additional results are available, which you can retrieve by passing the `nextPageToken` value in the `pageToken` parameter to the next request.",
- // "format": "int32",
- // "location": "query",
- // "type": "integer"
- // },
- // "pageToken": {
- // "description": "Optional. If the `pageToken` request parameter is supplied, then the next page of results in the set are retrieved. The `pageToken` parameter must be set with the value of the `nextPageToken` result parameter from the previous request. The value of `projectName` must be the same as in the previous request.",
- // "location": "query",
- // "type": "string"
- // },
- // "projectName": {
- // "description": "Required. The resource name of the project containing the sinks. Example: `\"projects/my-logging-project\"`, `\"projects/01234567890\"`.",
- // "location": "path",
- // "pattern": "^projects/[^/]*$",
- // "required": true,
- // "type": "string"
- // }
- // },
- // "path": "v2beta1/{+projectName}/sinks",
- // "response": {
- // "$ref": "ListSinksResponse"
- // },
- // "scopes": [
- // "https://www.googleapis.com/auth/cloud-platform",
- // "https://www.googleapis.com/auth/cloud-platform.read-only",
- // "https://www.googleapis.com/auth/logging.admin",
- // "https://www.googleapis.com/auth/logging.read"
- // ]
- // }
- }
- // Pages invokes f for each page of results.
- // A non-nil error returned from f will halt the iteration.
- // The provided context supersedes any context provided to the Context method.
- func (c *ProjectsSinksListCall) Pages(ctx context.Context, f func(*ListSinksResponse) error) error {
- c.ctx_ = ctx
- defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
- for {
- x, err := c.Do()
- if err != nil {
- return err
- }
- if err := f(x); err != nil {
- return err
- }
- if x.NextPageToken == "" {
- return nil
- }
- c.PageToken(x.NextPageToken)
- }
- }
- // method id "logging.projects.sinks.update":
- type ProjectsSinksUpdateCall struct {
- s *Service
- sinkName string
- logsink *LogSink
- urlParams_ gensupport.URLParams
- ctx_ context.Context
- }
- // Update: Creates or updates a sink.
- func (r *ProjectsSinksService) Update(sinkName string, logsink *LogSink) *ProjectsSinksUpdateCall {
- c := &ProjectsSinksUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
- c.sinkName = sinkName
- c.logsink = logsink
- return c
- }
- // Fields allows partial responses to be retrieved. See
- // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
- // for more information.
- func (c *ProjectsSinksUpdateCall) Fields(s ...googleapi.Field) *ProjectsSinksUpdateCall {
- c.urlParams_.Set("fields", googleapi.CombineFields(s))
- return c
- }
- // Context sets the context to be used in this call's Do method. Any
- // pending HTTP request will be aborted if the provided context is
- // canceled.
- func (c *ProjectsSinksUpdateCall) Context(ctx context.Context) *ProjectsSinksUpdateCall {
- c.ctx_ = ctx
- return c
- }
- func (c *ProjectsSinksUpdateCall) doRequest(alt string) (*http.Response, error) {
- var body io.Reader = nil
- body, err := googleapi.WithoutDataWrapper.JSONReader(c.logsink)
- if err != nil {
- return nil, err
- }
- ctype := "application/json"
- c.urlParams_.Set("alt", alt)
- urls := googleapi.ResolveRelative(c.s.BasePath, "v2beta1/{+sinkName}")
- urls += "?" + c.urlParams_.Encode()
- req, _ := http.NewRequest("PUT", urls, body)
- googleapi.Expand(req.URL, map[string]string{
- "sinkName": c.sinkName,
- })
- req.Header.Set("Content-Type", ctype)
- req.Header.Set("User-Agent", c.s.userAgent())
- if c.ctx_ != nil {
- return ctxhttp.Do(c.ctx_, c.s.client, req)
- }
- return c.s.client.Do(req)
- }
- // Do executes the "logging.projects.sinks.update" call.
- // Exactly one of *LogSink or error will be non-nil. Any non-2xx status
- // code is an error. Response headers are in either
- // *LogSink.ServerResponse.Header or (if a response was returned at all)
- // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
- // check whether the returned error was because http.StatusNotModified
- // was returned.
- func (c *ProjectsSinksUpdateCall) Do(opts ...googleapi.CallOption) (*LogSink, error) {
- gensupport.SetOptions(c.urlParams_, opts...)
- res, err := c.doRequest("json")
- if res != nil && res.StatusCode == http.StatusNotModified {
- if res.Body != nil {
- res.Body.Close()
- }
- return nil, &googleapi.Error{
- Code: res.StatusCode,
- Header: res.Header,
- }
- }
- if err != nil {
- return nil, err
- }
- defer googleapi.CloseBody(res)
- if err := googleapi.CheckResponse(res); err != nil {
- return nil, err
- }
- ret := &LogSink{
- ServerResponse: googleapi.ServerResponse{
- Header: res.Header,
- HTTPStatusCode: res.StatusCode,
- },
- }
- if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
- return nil, err
- }
- return ret, nil
- // {
- // "description": "Creates or updates a sink.",
- // "httpMethod": "PUT",
- // "id": "logging.projects.sinks.update",
- // "parameterOrder": [
- // "sinkName"
- // ],
- // "parameters": {
- // "sinkName": {
- // "description": "The resource name of the sink to update. Example: `\"projects/my-project-id/sinks/my-sink-id\"`. The updated sink must be provided in the request and have the same name that is specified in `sinkName`. If the sink does not exist, it is created.",
- // "location": "path",
- // "pattern": "^projects/[^/]*/sinks/[^/]*$",
- // "required": true,
- // "type": "string"
- // }
- // },
- // "path": "v2beta1/{+sinkName}",
- // "request": {
- // "$ref": "LogSink"
- // },
- // "response": {
- // "$ref": "LogSink"
- // },
- // "scopes": [
- // "https://www.googleapis.com/auth/cloud-platform",
- // "https://www.googleapis.com/auth/logging.admin"
- // ]
- // }
- }
|