1// Copyright YEAR Google LLC.
2// Use of this source code is governed by a BSD-style
3// license that can be found in the LICENSE file.
4
5// Code generated file. DO NOT EDIT.
6
7// Package logging provides access to the Google Cloud Logging API.
8//
9// This package is DEPRECATED. Use package cloud.google.com/go/logging instead.
10//
11// # Library status
12//
13// These client libraries are officially supported by Google. However, this
14// library is considered complete and is in maintenance mode. This means
15// that we will address critical bugs and security issues but will not add
16// any new features.
17//
18// When possible, we recommend using our newer
19// [Cloud Client Libraries for Go](https://pkg.go.dev/cloud.google.com/go)
20// that are still actively being worked and iterated on.
21//
22// # Creating a client
23//
24// Usage example:
25//
26// import "google.golang.org/api/logging/v1beta3"
27// ...
28// ctx := context.Background()
29// loggingService, err := logging.NewService(ctx)
30//
31// In this example, Google Application Default Credentials are used for
32// authentication. For information on how to create and obtain Application
33// Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials.
34//
35// # Other authentication options
36//
37// To use an API key for authentication (note: some APIs do not support API
38// keys), use [google.golang.org/api/option.WithAPIKey]:
39//
40// loggingService, err := logging.NewService(ctx, option.WithAPIKey("AIza..."))
41//
42// To use an OAuth token (e.g., a user token obtained via a three-legged OAuth
43// flow, use [google.golang.org/api/option.WithTokenSource]:
44//
45// config := &oauth2.Config{...}
46// // ...
47// token, err := config.Exchange(ctx, ...)
48// loggingService, err := logging.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
49//
50// See [google.golang.org/api/option.ClientOption] for details on options.
51package logging // import "google.golang.org/api/logging/v1beta3"
52
53import (
54 "bytes"
55 "context"
56 "encoding/json"
57 "errors"
58 "fmt"
59 "io"
60 "net/http"
61 "net/url"
62 "strconv"
63 "strings"
64
65 googleapi "google.golang.org/api/googleapi"
66 internal "google.golang.org/api/internal"
67 gensupport "google.golang.org/api/internal/gensupport"
68 option "google.golang.org/api/option"
69 internaloption "google.golang.org/api/option/internaloption"
70 htransport "google.golang.org/api/transport/http"
71)
72
73// Always reference these packages, just in case the auto-generated code
74// below doesn't.
75var _ = bytes.NewBuffer
76var _ = strconv.Itoa
77var _ = fmt.Sprintf
78var _ = json.NewDecoder
79var _ = io.Copy
80var _ = url.Parse
81var _ = gensupport.MarshalJSON
82var _ = googleapi.Version
83var _ = errors.New
84var _ = strings.Replace
85var _ = context.Canceled
86var _ = internaloption.WithDefaultEndpoint
87var _ = internal.Version
88
89const apiId = "logging:v1beta3"
90const apiName = "logging"
91const apiVersion = "v1beta3"
92const basePath = "https://logging.googleapis.com/"
93const basePathTemplate = "https://logging.UNIVERSE_DOMAIN/"
94const mtlsBasePath = "https://logging.mtls.googleapis.com/"
95
96// OAuth2 scopes used by this API.
97const (
98 // View and manage your data across Google Cloud Platform services
99 CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform"
100)
101
102// NewService creates a new Service.
103func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
104 scopesOption := internaloption.WithDefaultScopes(
105 "https://www.googleapis.com/auth/cloud-platform",
106 )
107 // NOTE: prepend, so we don't override user-specified scopes.
108 opts = append([]option.ClientOption{scopesOption}, opts...)
109 opts = append(opts, internaloption.WithDefaultEndpoint(basePath))
110 opts = append(opts, internaloption.WithDefaultEndpointTemplate(basePathTemplate))
111 opts = append(opts, internaloption.WithDefaultMTLSEndpoint(mtlsBasePath))
112 opts = append(opts, internaloption.EnableNewAuthLibrary())
113 client, endpoint, err := htransport.NewClient(ctx, opts...)
114 if err != nil {
115 return nil, err
116 }
117 s, err := New(client)
118 if err != nil {
119 return nil, err
120 }
121 if endpoint != "" {
122 s.BasePath = endpoint
123 }
124 return s, nil
125}
126
127// New creates a new Service. It uses the provided http.Client for requests.
128//
129// Deprecated: please use NewService instead.
130// To provide a custom HTTP client, use option.WithHTTPClient.
131// If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
132func New(client *http.Client) (*Service, error) {
133 if client == nil {
134 return nil, errors.New("client is nil")
135 }
136 s := &Service{client: client, BasePath: basePath}
137 s.Projects = NewProjectsService(s)
138 return s, nil
139}
140
141type Service struct {
142 client *http.Client
143 BasePath string // API endpoint base URL
144 UserAgent string // optional additional User-Agent fragment
145
146 Projects *ProjectsService
147}
148
149func (s *Service) userAgent() string {
150 if s.UserAgent == "" {
151 return googleapi.UserAgent
152 }
153 return googleapi.UserAgent + " " + s.UserAgent
154}
155
156func NewProjectsService(s *Service) *ProjectsService {
157 rs := &ProjectsService{s: s}
158 rs.LogServices = NewProjectsLogServicesService(s)
159 rs.Logs = NewProjectsLogsService(s)
160 return rs
161}
162
163type ProjectsService struct {
164 s *Service
165
166 LogServices *ProjectsLogServicesService
167
168 Logs *ProjectsLogsService
169}
170
171func NewProjectsLogServicesService(s *Service) *ProjectsLogServicesService {
172 rs := &ProjectsLogServicesService{s: s}
173 rs.Indexes = NewProjectsLogServicesIndexesService(s)
174 rs.Sinks = NewProjectsLogServicesSinksService(s)
175 return rs
176}
177
178type ProjectsLogServicesService struct {
179 s *Service
180
181 Indexes *ProjectsLogServicesIndexesService
182
183 Sinks *ProjectsLogServicesSinksService
184}
185
186func NewProjectsLogServicesIndexesService(s *Service) *ProjectsLogServicesIndexesService {
187 rs := &ProjectsLogServicesIndexesService{s: s}
188 return rs
189}
190
191type ProjectsLogServicesIndexesService struct {
192 s *Service
193}
194
195func NewProjectsLogServicesSinksService(s *Service) *ProjectsLogServicesSinksService {
196 rs := &ProjectsLogServicesSinksService{s: s}
197 return rs
198}
199
200type ProjectsLogServicesSinksService struct {
201 s *Service
202}
203
204func NewProjectsLogsService(s *Service) *ProjectsLogsService {
205 rs := &ProjectsLogsService{s: s}
206 rs.Entries = NewProjectsLogsEntriesService(s)
207 rs.Sinks = NewProjectsLogsSinksService(s)
208 return rs
209}
210
211type ProjectsLogsService struct {
212 s *Service
213
214 Entries *ProjectsLogsEntriesService
215
216 Sinks *ProjectsLogsSinksService
217}
218
219func NewProjectsLogsEntriesService(s *Service) *ProjectsLogsEntriesService {
220 rs := &ProjectsLogsEntriesService{s: s}
221 return rs
222}
223
224type ProjectsLogsEntriesService struct {
225 s *Service
226}
227
228func NewProjectsLogsSinksService(s *Service) *ProjectsLogsSinksService {
229 rs := &ProjectsLogsSinksService{s: s}
230 return rs
231}
232
233type ProjectsLogsSinksService struct {
234 s *Service
235}
236
237// Empty: A generic empty message that you can re-use to avoid defining
238// duplicated empty messages in your APIs. A typical example is to use it as
239// the request or the response type of an API method. For instance: service Foo
240// { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); }
241type Empty struct {
242 // ServerResponse contains the HTTP response code and headers from the server.
243 googleapi.ServerResponse `json:"-"`
244}
245
246// ListLogServiceIndexesResponse: Result returned from
247// ListLogServiceIndexesRequest.
248type ListLogServiceIndexesResponse struct {
249 // NextPageToken: If there are more results, then `nextPageToken` is returned
250 // in the response. To get the next batch of indexes, use the value of
251 // `nextPageToken` as `pageToken` in the next call of `ListLogServiceIndexess`.
252 // If `nextPageToken` is empty, then there are no more results.
253 NextPageToken string `json:"nextPageToken,omitempty"`
254 // ServiceIndexPrefixes: A list of log service index prefixes.
255 ServiceIndexPrefixes []string `json:"serviceIndexPrefixes,omitempty"`
256
257 // ServerResponse contains the HTTP response code and headers from the server.
258 googleapi.ServerResponse `json:"-"`
259 // ForceSendFields is a list of field names (e.g. "NextPageToken") to
260 // unconditionally include in API requests. By default, fields with empty or
261 // default values are omitted from API requests. See
262 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
263 // details.
264 ForceSendFields []string `json:"-"`
265 // NullFields is a list of field names (e.g. "NextPageToken") to include in API
266 // requests with the JSON null value. By default, fields with empty values are
267 // omitted from API requests. See
268 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
269 NullFields []string `json:"-"`
270}
271
272func (s *ListLogServiceIndexesResponse) MarshalJSON() ([]byte, error) {
273 type NoMethod ListLogServiceIndexesResponse
274 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
275}
276
277// ListLogServiceSinksResponse: Result returned from `ListLogServiceSinks`.
278type ListLogServiceSinksResponse struct {
279 // Sinks: The requested log service sinks. If any of the returned `LogSink`
280 // objects have an empty `destination` field, then call `logServices.sinks.get`
281 // to retrieve the complete `LogSink` object.
282 Sinks []*LogSink `json:"sinks,omitempty"`
283
284 // ServerResponse contains the HTTP response code and headers from the server.
285 googleapi.ServerResponse `json:"-"`
286 // ForceSendFields is a list of field names (e.g. "Sinks") to unconditionally
287 // include in API requests. By default, fields with empty or default values are
288 // omitted from API requests. See
289 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
290 // details.
291 ForceSendFields []string `json:"-"`
292 // NullFields is a list of field names (e.g. "Sinks") to include in API
293 // requests with the JSON null value. By default, fields with empty values are
294 // omitted from API requests. See
295 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
296 NullFields []string `json:"-"`
297}
298
299func (s *ListLogServiceSinksResponse) MarshalJSON() ([]byte, error) {
300 type NoMethod ListLogServiceSinksResponse
301 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
302}
303
304// ListLogServicesResponse: Result returned from `ListLogServicesRequest`.
305type ListLogServicesResponse struct {
306 // LogServices: A list of log services.
307 LogServices []*LogService `json:"logServices,omitempty"`
308 // NextPageToken: If there are more results, then `nextPageToken` is returned
309 // in the response. To get the next batch of services, use the value of
310 // `nextPageToken` as `pageToken` in the next call of `ListLogServices`. If
311 // `nextPageToken` is empty, then there are no more results.
312 NextPageToken string `json:"nextPageToken,omitempty"`
313
314 // ServerResponse contains the HTTP response code and headers from the server.
315 googleapi.ServerResponse `json:"-"`
316 // ForceSendFields is a list of field names (e.g. "LogServices") to
317 // unconditionally include in API requests. By default, fields with empty or
318 // default values are omitted from API requests. See
319 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
320 // details.
321 ForceSendFields []string `json:"-"`
322 // NullFields is a list of field names (e.g. "LogServices") to include in API
323 // requests with the JSON null value. By default, fields with empty values are
324 // omitted from API requests. See
325 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
326 NullFields []string `json:"-"`
327}
328
329func (s *ListLogServicesResponse) MarshalJSON() ([]byte, error) {
330 type NoMethod ListLogServicesResponse
331 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
332}
333
334// ListLogSinksResponse: Result returned from `ListLogSinks`.
335type ListLogSinksResponse struct {
336 // Sinks: The requested log sinks. If any of the returned `LogSink` objects
337 // have an empty `destination` field, then call `logServices.sinks.get` to
338 // retrieve the complete `LogSink` object.
339 Sinks []*LogSink `json:"sinks,omitempty"`
340
341 // ServerResponse contains the HTTP response code and headers from the server.
342 googleapi.ServerResponse `json:"-"`
343 // ForceSendFields is a list of field names (e.g. "Sinks") to unconditionally
344 // include in API requests. By default, fields with empty or default values are
345 // omitted from API requests. See
346 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
347 // details.
348 ForceSendFields []string `json:"-"`
349 // NullFields is a list of field names (e.g. "Sinks") to include in API
350 // requests with the JSON null value. By default, fields with empty values are
351 // omitted from API requests. See
352 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
353 NullFields []string `json:"-"`
354}
355
356func (s *ListLogSinksResponse) MarshalJSON() ([]byte, error) {
357 type NoMethod ListLogSinksResponse
358 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
359}
360
361// ListLogsResponse: Result returned from ListLogs.
362type ListLogsResponse struct {
363 // Logs: A list of log resources.
364 Logs []*Log `json:"logs,omitempty"`
365 // NextPageToken: If there are more results, then `nextPageToken` is returned
366 // in the response. To get the next batch of logs, use the value of
367 // `nextPageToken` as `pageToken` in the next call of `ListLogs`. If
368 // `nextPageToken` is empty, then there are no more results.
369 NextPageToken string `json:"nextPageToken,omitempty"`
370
371 // ServerResponse contains the HTTP response code and headers from the server.
372 googleapi.ServerResponse `json:"-"`
373 // ForceSendFields is a list of field names (e.g. "Logs") to unconditionally
374 // include in API requests. By default, fields with empty or default values are
375 // omitted from API requests. See
376 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
377 // details.
378 ForceSendFields []string `json:"-"`
379 // NullFields is a list of field names (e.g. "Logs") to include in API requests
380 // with the JSON null value. By default, fields with empty values are omitted
381 // from API requests. See
382 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
383 NullFields []string `json:"-"`
384}
385
386func (s *ListLogsResponse) MarshalJSON() ([]byte, error) {
387 type NoMethod ListLogsResponse
388 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
389}
390
391// Log: A log object.
392type Log struct {
393 // DisplayName: Name used when displaying the log to the user (for example, in
394 // a UI). Example: "activity_log"
395 DisplayName string `json:"displayName,omitempty"`
396 // Name: REQUIRED: The log's name name. Example:
397 // "compute.googleapis.com/activity_log".
398 Name string `json:"name,omitempty"`
399 // PayloadType: Type URL describing the expected payload type for the log.
400 PayloadType string `json:"payloadType,omitempty"`
401 // ForceSendFields is a list of field names (e.g. "DisplayName") to
402 // unconditionally include in API requests. By default, fields with empty or
403 // default values are omitted from API requests. See
404 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
405 // details.
406 ForceSendFields []string `json:"-"`
407 // NullFields is a list of field names (e.g. "DisplayName") to include in API
408 // requests with the JSON null value. By default, fields with empty values are
409 // omitted from API requests. See
410 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
411 NullFields []string `json:"-"`
412}
413
414func (s *Log) MarshalJSON() ([]byte, error) {
415 type NoMethod Log
416 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
417}
418
419// LogEntry: An individual entry in a log.
420type LogEntry struct {
421 // InsertId: A unique ID for the log entry. If you provide this field, the
422 // logging service considers other log entries in the same log with the same ID
423 // as duplicates which can be removed.
424 InsertId string `json:"insertId,omitempty"`
425 // Log: The log to which this entry belongs. When a log entry is ingested, the
426 // value of this field is set by the logging system.
427 Log string `json:"log,omitempty"`
428 // Metadata: Information about the log entry.
429 Metadata *LogEntryMetadata `json:"metadata,omitempty"`
430 // ProtoPayload: The log entry payload, represented as a protocol buffer that
431 // is expressed as a JSON object. You can only pass `protoPayload` values that
432 // belong to a set of approved types.
433 ProtoPayload googleapi.RawMessage `json:"protoPayload,omitempty"`
434 // StructPayload: The log entry payload, represented as a structure that is
435 // expressed as a JSON object.
436 StructPayload googleapi.RawMessage `json:"structPayload,omitempty"`
437 // TextPayload: The log entry payload, represented as a text string.
438 TextPayload string `json:"textPayload,omitempty"`
439 // ForceSendFields is a list of field names (e.g. "InsertId") to
440 // unconditionally include in API requests. By default, fields with empty or
441 // default values are omitted from API requests. See
442 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
443 // details.
444 ForceSendFields []string `json:"-"`
445 // NullFields is a list of field names (e.g. "InsertId") to include in API
446 // requests with the JSON null value. By default, fields with empty values are
447 // omitted from API requests. See
448 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
449 NullFields []string `json:"-"`
450}
451
452func (s *LogEntry) MarshalJSON() ([]byte, error) {
453 type NoMethod LogEntry
454 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
455}
456
457// LogEntryMetadata: Additional data that is associated with a log entry, set
458// by the service creating the log entry.
459type LogEntryMetadata struct {
460 // Labels: A set of (key, value) data that provides additional information
461 // about the log entry. If the log entry is from one of the Google Cloud
462 // Platform sources listed below, the indicated (key, value) information must
463 // be provided: Google App Engine, service_name `appengine.googleapis.com`:
464 // "appengine.googleapis.com/module_id",
465 // "appengine.googleapis.com/version_id", and one of:
466 // "appengine.googleapis.com/replica_index",
467 // "appengine.googleapis.com/clone_id", or else provide the following Compute
468 // Engine labels: Google Compute Engine, service_name `compute.googleapis.com`:
469 // "compute.googleapis.com/resource_type", "instance"
470 // "compute.googleapis.com/resource_id",
471 Labels map[string]string `json:"labels,omitempty"`
472 // ProjectId: The project ID of the Google Cloud Platform service that created
473 // the log entry.
474 ProjectId string `json:"projectId,omitempty"`
475 // Region: The region name of the Google Cloud Platform service that created
476 // the log entry. For example, "us-central1".
477 Region string `json:"region,omitempty"`
478 // ServiceName: The API name of the Google Cloud Platform service that created
479 // the log entry. For example, "compute.googleapis.com".
480 ServiceName string `json:"serviceName,omitempty"`
481 // Severity: The severity of the log entry.
482 //
483 // Possible values:
484 // "DEFAULT" - This is the DEFAULT description
485 // "DEBUG" - This is the DEBUG description
486 // "INFO" - This is the INFO description
487 // "NOTICE" - This is the NOTICE description
488 // "WARNING" - This is the WARNING description
489 // "ERROR" - This is the ERROR description
490 // "CRITICAL" - This is the CRITICAL description
491 // "ALERT" - This is the ALERT description
492 // "EMERGENCY" (default) - This is the EMERGENCY description
493 Severity string `json:"severity,omitempty"`
494 // Timestamp: The time the event described by the log entry occurred.
495 // Timestamps must be later than January 1, 1970.
496 Timestamp string `json:"timestamp,omitempty"`
497 // UserId: The fully-qualified email address of the authenticated user that
498 // performed or requested the action represented by the log entry. If the log
499 // entry does not apply to an action taken by an authenticated user, then the
500 // field should be empty.
501 UserId string `json:"userId,omitempty"`
502 // Zone: The zone of the Google Cloud Platform service that created the log
503 // entry. For example, "us-central1-a".
504 Zone string `json:"zone,omitempty"`
505 // ForceSendFields is a list of field names (e.g. "Labels") to unconditionally
506 // include in API requests. By default, fields with empty or default values are
507 // omitted from API requests. See
508 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
509 // details.
510 ForceSendFields []string `json:"-"`
511 // NullFields is a list of field names (e.g. "Labels") to include in API
512 // requests with the JSON null value. By default, fields with empty values are
513 // omitted from API requests. See
514 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
515 NullFields []string `json:"-"`
516}
517
518func (s *LogEntryMetadata) MarshalJSON() ([]byte, error) {
519 type NoMethod LogEntryMetadata
520 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
521}
522
523// LogError: A problem in a sink or the sink's configuration.
524type LogError struct {
525 // Resource: The resource associated with the error. It may be different from
526 // the sink destination. For example, the sink may point to a BigQuery dataset,
527 // but the error may refer to a table resource inside the dataset.
528 Resource string `json:"resource,omitempty"`
529 // Status: The description of the last error observed.
530 Status *Status `json:"status,omitempty"`
531 // TimeNanos: The last time the error was observed, in nanoseconds since the
532 // Unix epoch.
533 TimeNanos int64 `json:"timeNanos,omitempty,string"`
534 // ForceSendFields is a list of field names (e.g. "Resource") to
535 // unconditionally include in API requests. By default, fields with empty or
536 // default values are omitted from API requests. See
537 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
538 // details.
539 ForceSendFields []string `json:"-"`
540 // NullFields is a list of field names (e.g. "Resource") to include in API
541 // requests with the JSON null value. By default, fields with empty values are
542 // omitted from API requests. See
543 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
544 NullFields []string `json:"-"`
545}
546
547func (s *LogError) MarshalJSON() ([]byte, error) {
548 type NoMethod LogError
549 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
550}
551
552// LogService: A log service object.
553type LogService struct {
554 // IndexKeys: Label keys used when labeling log entries for this service. The
555 // order of the keys is significant, with higher priority keys coming earlier
556 // in the list.
557 IndexKeys []string `json:"indexKeys,omitempty"`
558 // Name: The service's name.
559 Name string `json:"name,omitempty"`
560 // ForceSendFields is a list of field names (e.g. "IndexKeys") to
561 // unconditionally include in API requests. By default, fields with empty or
562 // default values are omitted from API requests. See
563 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
564 // details.
565 ForceSendFields []string `json:"-"`
566 // NullFields is a list of field names (e.g. "IndexKeys") to include in API
567 // requests with the JSON null value. By default, fields with empty values are
568 // omitted from API requests. See
569 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
570 NullFields []string `json:"-"`
571}
572
573func (s *LogService) MarshalJSON() ([]byte, error) {
574 type NoMethod LogService
575 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
576}
577
578// LogSink: An object that describes where a log may be written.
579type LogSink struct {
580 // Destination: The resource to send log entries to. The supported sink
581 // resource types are: + Google Cloud Storage: `storage.googleapis.com/BUCKET`
582 // or `BUCKET.storage.googleapis.com/` + Google BigQuery:
583 // `bigquery.googleapis.com/projects/PROJECT/datasets/DATASET` Currently the
584 // Cloud Logging API supports at most one sink for each resource type per log
585 // or log service resource.
586 Destination string `json:"destination,omitempty"`
587 // Errors: _Output only._ All active errors found for this sink.
588 Errors []*LogError `json:"errors,omitempty"`
589 // Name: The name of this sink. This is a client-assigned identifier for the
590 // resource. This is ignored by UpdateLogSink and UpdateLogServicesSink.
591 Name string `json:"name,omitempty"`
592
593 // ServerResponse contains the HTTP response code and headers from the server.
594 googleapi.ServerResponse `json:"-"`
595 // ForceSendFields is a list of field names (e.g. "Destination") to
596 // unconditionally include in API requests. By default, fields with empty or
597 // default values are omitted from API requests. See
598 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
599 // details.
600 ForceSendFields []string `json:"-"`
601 // NullFields is a list of field names (e.g. "Destination") to include in API
602 // requests with the JSON null value. By default, fields with empty values are
603 // omitted from API requests. See
604 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
605 NullFields []string `json:"-"`
606}
607
608func (s *LogSink) MarshalJSON() ([]byte, error) {
609 type NoMethod LogSink
610 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
611}
612
613// Status: Represents the RPC error status for Google APIs. See
614// http://go/errormodel for details.
615type Status struct {
616 // Code: The status code, which should be an enum value of [google.rpc.Code][].
617 Code int64 `json:"code,omitempty"`
618 // Details: A list of messages that carry the error details. There will be a
619 // common set of message types for APIs to use.
620 Details []googleapi.RawMessage `json:"details,omitempty"`
621 // Message: A developer-facing error message, which should be in English. The
622 // user-facing error message should be localized and stored in the
623 // [google.rpc.Status.details][google.rpc.Status.details] field.
624 Message string `json:"message,omitempty"`
625 // ForceSendFields is a list of field names (e.g. "Code") to unconditionally
626 // include in API requests. By default, fields with empty or default values are
627 // omitted from API requests. See
628 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
629 // details.
630 ForceSendFields []string `json:"-"`
631 // NullFields is a list of field names (e.g. "Code") to include in API requests
632 // with the JSON null value. By default, fields with empty values are omitted
633 // from API requests. See
634 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
635 NullFields []string `json:"-"`
636}
637
638func (s *Status) MarshalJSON() ([]byte, error) {
639 type NoMethod Status
640 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
641}
642
643// WriteLogEntriesRequest: The parameters to WriteLogEntries.
644type WriteLogEntriesRequest struct {
645 // CommonLabels: Metadata labels that apply to all entries in this request. If
646 // one of the log entries contains a (key, value) with the same key that is in
647 // `commonLabels`, then the entry's (key, value) overrides the one in
648 // `commonLabels`.
649 CommonLabels map[string]string `json:"commonLabels,omitempty"`
650 // Entries: Log entries to insert.
651 Entries []*LogEntry `json:"entries,omitempty"`
652 // ForceSendFields is a list of field names (e.g. "CommonLabels") to
653 // unconditionally include in API requests. By default, fields with empty or
654 // default values are omitted from API requests. See
655 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
656 // details.
657 ForceSendFields []string `json:"-"`
658 // NullFields is a list of field names (e.g. "CommonLabels") to include in API
659 // requests with the JSON null value. By default, fields with empty values are
660 // omitted from API requests. See
661 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
662 NullFields []string `json:"-"`
663}
664
665func (s *WriteLogEntriesRequest) MarshalJSON() ([]byte, error) {
666 type NoMethod WriteLogEntriesRequest
667 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
668}
669
670// WriteLogEntriesResponse: Result returned from WriteLogEntries. empty
671type WriteLogEntriesResponse struct {
672 // ServerResponse contains the HTTP response code and headers from the server.
673 googleapi.ServerResponse `json:"-"`
674}
675
676type ProjectsLogServicesListCall struct {
677 s *Service
678 projectsId string
679 urlParams_ gensupport.URLParams
680 ifNoneMatch_ string
681 ctx_ context.Context
682 header_ http.Header
683}
684
685// List: Lists log services associated with log entries ingested for a project.
686//
687// - projectsId: Part of `projectName`. The project resource whose services are
688// to be listed.
689func (r *ProjectsLogServicesService) List(projectsId string) *ProjectsLogServicesListCall {
690 c := &ProjectsLogServicesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
691 c.projectsId = projectsId
692 return c
693}
694
695// Log sets the optional parameter "log": The name of the log resource whose
696// services are to be listed. log for which to list services. When empty, all
697// services are listed.
698func (c *ProjectsLogServicesListCall) Log(log string) *ProjectsLogServicesListCall {
699 c.urlParams_.Set("log", log)
700 return c
701}
702
703// PageSize sets the optional parameter "pageSize": The maximum number of
704// `LogService` objects to return in one operation.
705func (c *ProjectsLogServicesListCall) PageSize(pageSize int64) *ProjectsLogServicesListCall {
706 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
707 return c
708}
709
710// PageToken sets the optional parameter "pageToken": An opaque token, returned
711// as `nextPageToken` by a prior `ListLogServices` operation. If `pageToken` is
712// supplied, then the other fields of this request are ignored, and instead the
713// previous `ListLogServices` operation is continued.
714func (c *ProjectsLogServicesListCall) PageToken(pageToken string) *ProjectsLogServicesListCall {
715 c.urlParams_.Set("pageToken", pageToken)
716 return c
717}
718
719// Fields allows partial responses to be retrieved. See
720// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
721// details.
722func (c *ProjectsLogServicesListCall) Fields(s ...googleapi.Field) *ProjectsLogServicesListCall {
723 c.urlParams_.Set("fields", googleapi.CombineFields(s))
724 return c
725}
726
727// IfNoneMatch sets an optional parameter which makes the operation fail if the
728// object's ETag matches the given value. This is useful for getting updates
729// only after the object has changed since the last request.
730func (c *ProjectsLogServicesListCall) IfNoneMatch(entityTag string) *ProjectsLogServicesListCall {
731 c.ifNoneMatch_ = entityTag
732 return c
733}
734
735// Context sets the context to be used in this call's Do method.
736func (c *ProjectsLogServicesListCall) Context(ctx context.Context) *ProjectsLogServicesListCall {
737 c.ctx_ = ctx
738 return c
739}
740
741// Header returns a http.Header that can be modified by the caller to add
742// headers to the request.
743func (c *ProjectsLogServicesListCall) Header() http.Header {
744 if c.header_ == nil {
745 c.header_ = make(http.Header)
746 }
747 return c.header_
748}
749
750func (c *ProjectsLogServicesListCall) doRequest(alt string) (*http.Response, error) {
751 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_, "x-goog-api-version", "v1_20240501")
752 if c.ifNoneMatch_ != "" {
753 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
754 }
755 var body io.Reader = nil
756 c.urlParams_.Set("alt", alt)
757 c.urlParams_.Set("prettyPrint", "false")
758 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta3/projects/{projectsId}/logServices")
759 urls += "?" + c.urlParams_.Encode()
760 req, err := http.NewRequest("GET", urls, body)
761 if err != nil {
762 return nil, err
763 }
764 req.Header = reqHeaders
765 googleapi.Expand(req.URL, map[string]string{
766 "projectsId": c.projectsId,
767 })
768 return gensupport.SendRequest(c.ctx_, c.s.client, req)
769}
770
771// Do executes the "logging.projects.logServices.list" call.
772// Any non-2xx status code is an error. Response headers are in either
773// *ListLogServicesResponse.ServerResponse.Header or (if a response was
774// returned at all) in error.(*googleapi.Error).Header. Use
775// googleapi.IsNotModified to check whether the returned error was because
776// http.StatusNotModified was returned.
777func (c *ProjectsLogServicesListCall) Do(opts ...googleapi.CallOption) (*ListLogServicesResponse, error) {
778 gensupport.SetOptions(c.urlParams_, opts...)
779 res, err := c.doRequest("json")
780 if res != nil && res.StatusCode == http.StatusNotModified {
781 if res.Body != nil {
782 res.Body.Close()
783 }
784 return nil, gensupport.WrapError(&googleapi.Error{
785 Code: res.StatusCode,
786 Header: res.Header,
787 })
788 }
789 if err != nil {
790 return nil, err
791 }
792 defer googleapi.CloseBody(res)
793 if err := googleapi.CheckResponse(res); err != nil {
794 return nil, gensupport.WrapError(err)
795 }
796 ret := &ListLogServicesResponse{
797 ServerResponse: googleapi.ServerResponse{
798 Header: res.Header,
799 HTTPStatusCode: res.StatusCode,
800 },
801 }
802 target := &ret
803 if err := gensupport.DecodeResponse(target, res); err != nil {
804 return nil, err
805 }
806 return ret, nil
807}
808
809// Pages invokes f for each page of results.
810// A non-nil error returned from f will halt the iteration.
811// The provided context supersedes any context provided to the Context method.
812func (c *ProjectsLogServicesListCall) Pages(ctx context.Context, f func(*ListLogServicesResponse) error) error {
813 c.ctx_ = ctx
814 defer c.PageToken(c.urlParams_.Get("pageToken"))
815 for {
816 x, err := c.Do()
817 if err != nil {
818 return err
819 }
820 if err := f(x); err != nil {
821 return err
822 }
823 if x.NextPageToken == "" {
824 return nil
825 }
826 c.PageToken(x.NextPageToken)
827 }
828}
829
830type ProjectsLogServicesIndexesListCall struct {
831 s *Service
832 projectsId string
833 logServicesId string
834 urlParams_ gensupport.URLParams
835 ifNoneMatch_ string
836 ctx_ context.Context
837 header_ http.Header
838}
839
840// List: Lists log service indexes associated with a log service.
841//
842// - logServicesId: Part of `serviceName`. See documentation of `projectsId`.
843// - projectsId: Part of `serviceName`. A log service resource of the form
844// `/projects/*/logServices/*`. The service indexes of the log service are
845// returned. Example:
846// "/projects/myProj/logServices/appengine.googleapis.com".
847func (r *ProjectsLogServicesIndexesService) List(projectsId string, logServicesId string) *ProjectsLogServicesIndexesListCall {
848 c := &ProjectsLogServicesIndexesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
849 c.projectsId = projectsId
850 c.logServicesId = logServicesId
851 return c
852}
853
854// Depth sets the optional parameter "depth": A limit to the number of levels
855// of the index hierarchy that are expanded. If `depth` is 0, it defaults to
856// the level specified by the prefix field (the number of slash separators).
857// The default empty prefix implies a `depth` of 1. It is an error for `depth`
858// to be any non-zero value less than the number of components in
859// `indexPrefix`.
860func (c *ProjectsLogServicesIndexesListCall) Depth(depth int64) *ProjectsLogServicesIndexesListCall {
861 c.urlParams_.Set("depth", fmt.Sprint(depth))
862 return c
863}
864
865// IndexPrefix sets the optional parameter "indexPrefix": Restricts the indexes
866// returned to be those with a specified prefix. The prefix has the form
867// "/label_value/label_value/...", in order corresponding to the [`LogService
868// indexKeys`][google.logging.v1.LogService.index_keys]. Non-empty prefixes
869// must begin with `/` . Example prefixes: + "/myModule/" retrieves App
870// Engine versions associated with `myModule`. The trailing slash terminates
871// the value. + "/myModule" retrieves App Engine modules with names beginning
872// with `myModule`. + "" retrieves all indexes.
873func (c *ProjectsLogServicesIndexesListCall) IndexPrefix(indexPrefix string) *ProjectsLogServicesIndexesListCall {
874 c.urlParams_.Set("indexPrefix", indexPrefix)
875 return c
876}
877
878// Log sets the optional parameter "log": A log resource like
879// `/projects/project_id/logs/log_name`, identifying the log for which to list
880// service indexes.
881func (c *ProjectsLogServicesIndexesListCall) Log(log string) *ProjectsLogServicesIndexesListCall {
882 c.urlParams_.Set("log", log)
883 return c
884}
885
886// PageSize sets the optional parameter "pageSize": The maximum number of log
887// service index resources to return in one operation.
888func (c *ProjectsLogServicesIndexesListCall) PageSize(pageSize int64) *ProjectsLogServicesIndexesListCall {
889 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
890 return c
891}
892
893// PageToken sets the optional parameter "pageToken": An opaque token, returned
894// as `nextPageToken` by a prior `ListLogServiceIndexes` operation. If
895// `pageToken` is supplied, then the other fields of this request are ignored,
896// and instead the previous `ListLogServiceIndexes` operation is continued.
897func (c *ProjectsLogServicesIndexesListCall) PageToken(pageToken string) *ProjectsLogServicesIndexesListCall {
898 c.urlParams_.Set("pageToken", pageToken)
899 return c
900}
901
902// Fields allows partial responses to be retrieved. See
903// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
904// details.
905func (c *ProjectsLogServicesIndexesListCall) Fields(s ...googleapi.Field) *ProjectsLogServicesIndexesListCall {
906 c.urlParams_.Set("fields", googleapi.CombineFields(s))
907 return c
908}
909
910// IfNoneMatch sets an optional parameter which makes the operation fail if the
911// object's ETag matches the given value. This is useful for getting updates
912// only after the object has changed since the last request.
913func (c *ProjectsLogServicesIndexesListCall) IfNoneMatch(entityTag string) *ProjectsLogServicesIndexesListCall {
914 c.ifNoneMatch_ = entityTag
915 return c
916}
917
918// Context sets the context to be used in this call's Do method.
919func (c *ProjectsLogServicesIndexesListCall) Context(ctx context.Context) *ProjectsLogServicesIndexesListCall {
920 c.ctx_ = ctx
921 return c
922}
923
924// Header returns a http.Header that can be modified by the caller to add
925// headers to the request.
926func (c *ProjectsLogServicesIndexesListCall) Header() http.Header {
927 if c.header_ == nil {
928 c.header_ = make(http.Header)
929 }
930 return c.header_
931}
932
933func (c *ProjectsLogServicesIndexesListCall) doRequest(alt string) (*http.Response, error) {
934 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_, "x-goog-api-version", "v1_20240501")
935 if c.ifNoneMatch_ != "" {
936 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
937 }
938 var body io.Reader = nil
939 c.urlParams_.Set("alt", alt)
940 c.urlParams_.Set("prettyPrint", "false")
941 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta3/projects/{projectsId}/logServices/{logServicesId}/indexes")
942 urls += "?" + c.urlParams_.Encode()
943 req, err := http.NewRequest("GET", urls, body)
944 if err != nil {
945 return nil, err
946 }
947 req.Header = reqHeaders
948 googleapi.Expand(req.URL, map[string]string{
949 "projectsId": c.projectsId,
950 "logServicesId": c.logServicesId,
951 })
952 return gensupport.SendRequest(c.ctx_, c.s.client, req)
953}
954
955// Do executes the "logging.projects.logServices.indexes.list" call.
956// Any non-2xx status code is an error. Response headers are in either
957// *ListLogServiceIndexesResponse.ServerResponse.Header or (if a response was
958// returned at all) in error.(*googleapi.Error).Header. Use
959// googleapi.IsNotModified to check whether the returned error was because
960// http.StatusNotModified was returned.
961func (c *ProjectsLogServicesIndexesListCall) Do(opts ...googleapi.CallOption) (*ListLogServiceIndexesResponse, error) {
962 gensupport.SetOptions(c.urlParams_, opts...)
963 res, err := c.doRequest("json")
964 if res != nil && res.StatusCode == http.StatusNotModified {
965 if res.Body != nil {
966 res.Body.Close()
967 }
968 return nil, gensupport.WrapError(&googleapi.Error{
969 Code: res.StatusCode,
970 Header: res.Header,
971 })
972 }
973 if err != nil {
974 return nil, err
975 }
976 defer googleapi.CloseBody(res)
977 if err := googleapi.CheckResponse(res); err != nil {
978 return nil, gensupport.WrapError(err)
979 }
980 ret := &ListLogServiceIndexesResponse{
981 ServerResponse: googleapi.ServerResponse{
982 Header: res.Header,
983 HTTPStatusCode: res.StatusCode,
984 },
985 }
986 target := &ret
987 if err := gensupport.DecodeResponse(target, res); err != nil {
988 return nil, err
989 }
990 return ret, nil
991}
992
993// Pages invokes f for each page of results.
994// A non-nil error returned from f will halt the iteration.
995// The provided context supersedes any context provided to the Context method.
996func (c *ProjectsLogServicesIndexesListCall) Pages(ctx context.Context, f func(*ListLogServiceIndexesResponse) error) error {
997 c.ctx_ = ctx
998 defer c.PageToken(c.urlParams_.Get("pageToken"))
999 for {
1000 x, err := c.Do()
1001 if err != nil {
1002 return err
1003 }
1004 if err := f(x); err != nil {
1005 return err
1006 }
1007 if x.NextPageToken == "" {
1008 return nil
1009 }
1010 c.PageToken(x.NextPageToken)
1011 }
1012}
1013
1014type ProjectsLogServicesSinksCreateCall struct {
1015 s *Service
1016 projectsId string
1017 logServicesId string
1018 logsink *LogSink
1019 urlParams_ gensupport.URLParams
1020 ctx_ context.Context
1021 header_ http.Header
1022}
1023
1024// Create: Creates the specified log service sink resource.
1025//
1026// - logServicesId: Part of `serviceName`. See documentation of `projectsId`.
1027// - projectsId: Part of `serviceName`. The name of the service in which to
1028// create a sink.
1029func (r *ProjectsLogServicesSinksService) Create(projectsId string, logServicesId string, logsink *LogSink) *ProjectsLogServicesSinksCreateCall {
1030 c := &ProjectsLogServicesSinksCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1031 c.projectsId = projectsId
1032 c.logServicesId = logServicesId
1033 c.logsink = logsink
1034 return c
1035}
1036
1037// Fields allows partial responses to be retrieved. See
1038// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
1039// details.
1040func (c *ProjectsLogServicesSinksCreateCall) Fields(s ...googleapi.Field) *ProjectsLogServicesSinksCreateCall {
1041 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1042 return c
1043}
1044
1045// Context sets the context to be used in this call's Do method.
1046func (c *ProjectsLogServicesSinksCreateCall) Context(ctx context.Context) *ProjectsLogServicesSinksCreateCall {
1047 c.ctx_ = ctx
1048 return c
1049}
1050
1051// Header returns a http.Header that can be modified by the caller to add
1052// headers to the request.
1053func (c *ProjectsLogServicesSinksCreateCall) Header() http.Header {
1054 if c.header_ == nil {
1055 c.header_ = make(http.Header)
1056 }
1057 return c.header_
1058}
1059
1060func (c *ProjectsLogServicesSinksCreateCall) doRequest(alt string) (*http.Response, error) {
1061 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_, "x-goog-api-version", "v1_20240501")
1062 var body io.Reader = nil
1063 body, err := googleapi.WithoutDataWrapper.JSONReader(c.logsink)
1064 if err != nil {
1065 return nil, err
1066 }
1067 c.urlParams_.Set("alt", alt)
1068 c.urlParams_.Set("prettyPrint", "false")
1069 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta3/projects/{projectsId}/logServices/{logServicesId}/sinks")
1070 urls += "?" + c.urlParams_.Encode()
1071 req, err := http.NewRequest("POST", urls, body)
1072 if err != nil {
1073 return nil, err
1074 }
1075 req.Header = reqHeaders
1076 googleapi.Expand(req.URL, map[string]string{
1077 "projectsId": c.projectsId,
1078 "logServicesId": c.logServicesId,
1079 })
1080 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1081}
1082
1083// Do executes the "logging.projects.logServices.sinks.create" call.
1084// Any non-2xx status code is an error. Response headers are in either
1085// *LogSink.ServerResponse.Header or (if a response was returned at all) in
1086// error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
1087// whether the returned error was because http.StatusNotModified was returned.
1088func (c *ProjectsLogServicesSinksCreateCall) Do(opts ...googleapi.CallOption) (*LogSink, error) {
1089 gensupport.SetOptions(c.urlParams_, opts...)
1090 res, err := c.doRequest("json")
1091 if res != nil && res.StatusCode == http.StatusNotModified {
1092 if res.Body != nil {
1093 res.Body.Close()
1094 }
1095 return nil, gensupport.WrapError(&googleapi.Error{
1096 Code: res.StatusCode,
1097 Header: res.Header,
1098 })
1099 }
1100 if err != nil {
1101 return nil, err
1102 }
1103 defer googleapi.CloseBody(res)
1104 if err := googleapi.CheckResponse(res); err != nil {
1105 return nil, gensupport.WrapError(err)
1106 }
1107 ret := &LogSink{
1108 ServerResponse: googleapi.ServerResponse{
1109 Header: res.Header,
1110 HTTPStatusCode: res.StatusCode,
1111 },
1112 }
1113 target := &ret
1114 if err := gensupport.DecodeResponse(target, res); err != nil {
1115 return nil, err
1116 }
1117 return ret, nil
1118}
1119
1120type ProjectsLogServicesSinksDeleteCall struct {
1121 s *Service
1122 projectsId string
1123 logServicesId string
1124 sinksId string
1125 urlParams_ gensupport.URLParams
1126 ctx_ context.Context
1127 header_ http.Header
1128}
1129
1130// Delete: Deletes the specified log service sink.
1131//
1132// - logServicesId: Part of `sinkName`. See documentation of `projectsId`.
1133// - projectsId: Part of `sinkName`. The name of the sink to delete.
1134// - sinksId: Part of `sinkName`. See documentation of `projectsId`.
1135func (r *ProjectsLogServicesSinksService) Delete(projectsId string, logServicesId string, sinksId string) *ProjectsLogServicesSinksDeleteCall {
1136 c := &ProjectsLogServicesSinksDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1137 c.projectsId = projectsId
1138 c.logServicesId = logServicesId
1139 c.sinksId = sinksId
1140 return c
1141}
1142
1143// Fields allows partial responses to be retrieved. See
1144// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
1145// details.
1146func (c *ProjectsLogServicesSinksDeleteCall) Fields(s ...googleapi.Field) *ProjectsLogServicesSinksDeleteCall {
1147 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1148 return c
1149}
1150
1151// Context sets the context to be used in this call's Do method.
1152func (c *ProjectsLogServicesSinksDeleteCall) Context(ctx context.Context) *ProjectsLogServicesSinksDeleteCall {
1153 c.ctx_ = ctx
1154 return c
1155}
1156
1157// Header returns a http.Header that can be modified by the caller to add
1158// headers to the request.
1159func (c *ProjectsLogServicesSinksDeleteCall) Header() http.Header {
1160 if c.header_ == nil {
1161 c.header_ = make(http.Header)
1162 }
1163 return c.header_
1164}
1165
1166func (c *ProjectsLogServicesSinksDeleteCall) doRequest(alt string) (*http.Response, error) {
1167 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_, "x-goog-api-version", "v1_20240501")
1168 var body io.Reader = nil
1169 c.urlParams_.Set("alt", alt)
1170 c.urlParams_.Set("prettyPrint", "false")
1171 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta3/projects/{projectsId}/logServices/{logServicesId}/sinks/{sinksId}")
1172 urls += "?" + c.urlParams_.Encode()
1173 req, err := http.NewRequest("DELETE", urls, body)
1174 if err != nil {
1175 return nil, err
1176 }
1177 req.Header = reqHeaders
1178 googleapi.Expand(req.URL, map[string]string{
1179 "projectsId": c.projectsId,
1180 "logServicesId": c.logServicesId,
1181 "sinksId": c.sinksId,
1182 })
1183 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1184}
1185
1186// Do executes the "logging.projects.logServices.sinks.delete" call.
1187// Any non-2xx status code is an error. Response headers are in either
1188// *Empty.ServerResponse.Header or (if a response was returned at all) in
1189// error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
1190// whether the returned error was because http.StatusNotModified was returned.
1191func (c *ProjectsLogServicesSinksDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
1192 gensupport.SetOptions(c.urlParams_, opts...)
1193 res, err := c.doRequest("json")
1194 if res != nil && res.StatusCode == http.StatusNotModified {
1195 if res.Body != nil {
1196 res.Body.Close()
1197 }
1198 return nil, gensupport.WrapError(&googleapi.Error{
1199 Code: res.StatusCode,
1200 Header: res.Header,
1201 })
1202 }
1203 if err != nil {
1204 return nil, err
1205 }
1206 defer googleapi.CloseBody(res)
1207 if err := googleapi.CheckResponse(res); err != nil {
1208 return nil, gensupport.WrapError(err)
1209 }
1210 ret := &Empty{
1211 ServerResponse: googleapi.ServerResponse{
1212 Header: res.Header,
1213 HTTPStatusCode: res.StatusCode,
1214 },
1215 }
1216 target := &ret
1217 if err := gensupport.DecodeResponse(target, res); err != nil {
1218 return nil, err
1219 }
1220 return ret, nil
1221}
1222
1223type ProjectsLogServicesSinksGetCall struct {
1224 s *Service
1225 projectsId string
1226 logServicesId string
1227 sinksId string
1228 urlParams_ gensupport.URLParams
1229 ifNoneMatch_ string
1230 ctx_ context.Context
1231 header_ http.Header
1232}
1233
1234// Get: Gets the specified log service sink resource.
1235//
1236// - logServicesId: Part of `sinkName`. See documentation of `projectsId`.
1237// - projectsId: Part of `sinkName`. The name of the sink to return.
1238// - sinksId: Part of `sinkName`. See documentation of `projectsId`.
1239func (r *ProjectsLogServicesSinksService) Get(projectsId string, logServicesId string, sinksId string) *ProjectsLogServicesSinksGetCall {
1240 c := &ProjectsLogServicesSinksGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1241 c.projectsId = projectsId
1242 c.logServicesId = logServicesId
1243 c.sinksId = sinksId
1244 return c
1245}
1246
1247// Fields allows partial responses to be retrieved. See
1248// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
1249// details.
1250func (c *ProjectsLogServicesSinksGetCall) Fields(s ...googleapi.Field) *ProjectsLogServicesSinksGetCall {
1251 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1252 return c
1253}
1254
1255// IfNoneMatch sets an optional parameter which makes the operation fail if the
1256// object's ETag matches the given value. This is useful for getting updates
1257// only after the object has changed since the last request.
1258func (c *ProjectsLogServicesSinksGetCall) IfNoneMatch(entityTag string) *ProjectsLogServicesSinksGetCall {
1259 c.ifNoneMatch_ = entityTag
1260 return c
1261}
1262
1263// Context sets the context to be used in this call's Do method.
1264func (c *ProjectsLogServicesSinksGetCall) Context(ctx context.Context) *ProjectsLogServicesSinksGetCall {
1265 c.ctx_ = ctx
1266 return c
1267}
1268
1269// Header returns a http.Header that can be modified by the caller to add
1270// headers to the request.
1271func (c *ProjectsLogServicesSinksGetCall) Header() http.Header {
1272 if c.header_ == nil {
1273 c.header_ = make(http.Header)
1274 }
1275 return c.header_
1276}
1277
1278func (c *ProjectsLogServicesSinksGetCall) doRequest(alt string) (*http.Response, error) {
1279 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_, "x-goog-api-version", "v1_20240501")
1280 if c.ifNoneMatch_ != "" {
1281 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
1282 }
1283 var body io.Reader = nil
1284 c.urlParams_.Set("alt", alt)
1285 c.urlParams_.Set("prettyPrint", "false")
1286 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta3/projects/{projectsId}/logServices/{logServicesId}/sinks/{sinksId}")
1287 urls += "?" + c.urlParams_.Encode()
1288 req, err := http.NewRequest("GET", urls, body)
1289 if err != nil {
1290 return nil, err
1291 }
1292 req.Header = reqHeaders
1293 googleapi.Expand(req.URL, map[string]string{
1294 "projectsId": c.projectsId,
1295 "logServicesId": c.logServicesId,
1296 "sinksId": c.sinksId,
1297 })
1298 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1299}
1300
1301// Do executes the "logging.projects.logServices.sinks.get" call.
1302// Any non-2xx status code is an error. Response headers are in either
1303// *LogSink.ServerResponse.Header or (if a response was returned at all) in
1304// error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
1305// whether the returned error was because http.StatusNotModified was returned.
1306func (c *ProjectsLogServicesSinksGetCall) Do(opts ...googleapi.CallOption) (*LogSink, error) {
1307 gensupport.SetOptions(c.urlParams_, opts...)
1308 res, err := c.doRequest("json")
1309 if res != nil && res.StatusCode == http.StatusNotModified {
1310 if res.Body != nil {
1311 res.Body.Close()
1312 }
1313 return nil, gensupport.WrapError(&googleapi.Error{
1314 Code: res.StatusCode,
1315 Header: res.Header,
1316 })
1317 }
1318 if err != nil {
1319 return nil, err
1320 }
1321 defer googleapi.CloseBody(res)
1322 if err := googleapi.CheckResponse(res); err != nil {
1323 return nil, gensupport.WrapError(err)
1324 }
1325 ret := &LogSink{
1326 ServerResponse: googleapi.ServerResponse{
1327 Header: res.Header,
1328 HTTPStatusCode: res.StatusCode,
1329 },
1330 }
1331 target := &ret
1332 if err := gensupport.DecodeResponse(target, res); err != nil {
1333 return nil, err
1334 }
1335 return ret, nil
1336}
1337
1338type ProjectsLogServicesSinksListCall struct {
1339 s *Service
1340 projectsId string
1341 logServicesId string
1342 urlParams_ gensupport.URLParams
1343 ifNoneMatch_ string
1344 ctx_ context.Context
1345 header_ http.Header
1346}
1347
1348// List: Lists log service sinks associated with the specified service.
1349//
1350// - logServicesId: Part of `serviceName`. See documentation of `projectsId`.
1351// - projectsId: Part of `serviceName`. The name of the service for which to
1352// list sinks.
1353func (r *ProjectsLogServicesSinksService) List(projectsId string, logServicesId string) *ProjectsLogServicesSinksListCall {
1354 c := &ProjectsLogServicesSinksListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1355 c.projectsId = projectsId
1356 c.logServicesId = logServicesId
1357 return c
1358}
1359
1360// Fields allows partial responses to be retrieved. See
1361// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
1362// details.
1363func (c *ProjectsLogServicesSinksListCall) Fields(s ...googleapi.Field) *ProjectsLogServicesSinksListCall {
1364 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1365 return c
1366}
1367
1368// IfNoneMatch sets an optional parameter which makes the operation fail if the
1369// object's ETag matches the given value. This is useful for getting updates
1370// only after the object has changed since the last request.
1371func (c *ProjectsLogServicesSinksListCall) IfNoneMatch(entityTag string) *ProjectsLogServicesSinksListCall {
1372 c.ifNoneMatch_ = entityTag
1373 return c
1374}
1375
1376// Context sets the context to be used in this call's Do method.
1377func (c *ProjectsLogServicesSinksListCall) Context(ctx context.Context) *ProjectsLogServicesSinksListCall {
1378 c.ctx_ = ctx
1379 return c
1380}
1381
1382// Header returns a http.Header that can be modified by the caller to add
1383// headers to the request.
1384func (c *ProjectsLogServicesSinksListCall) Header() http.Header {
1385 if c.header_ == nil {
1386 c.header_ = make(http.Header)
1387 }
1388 return c.header_
1389}
1390
1391func (c *ProjectsLogServicesSinksListCall) doRequest(alt string) (*http.Response, error) {
1392 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_, "x-goog-api-version", "v1_20240501")
1393 if c.ifNoneMatch_ != "" {
1394 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
1395 }
1396 var body io.Reader = nil
1397 c.urlParams_.Set("alt", alt)
1398 c.urlParams_.Set("prettyPrint", "false")
1399 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta3/projects/{projectsId}/logServices/{logServicesId}/sinks")
1400 urls += "?" + c.urlParams_.Encode()
1401 req, err := http.NewRequest("GET", urls, body)
1402 if err != nil {
1403 return nil, err
1404 }
1405 req.Header = reqHeaders
1406 googleapi.Expand(req.URL, map[string]string{
1407 "projectsId": c.projectsId,
1408 "logServicesId": c.logServicesId,
1409 })
1410 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1411}
1412
1413// Do executes the "logging.projects.logServices.sinks.list" call.
1414// Any non-2xx status code is an error. Response headers are in either
1415// *ListLogServiceSinksResponse.ServerResponse.Header or (if a response was
1416// returned at all) in error.(*googleapi.Error).Header. Use
1417// googleapi.IsNotModified to check whether the returned error was because
1418// http.StatusNotModified was returned.
1419func (c *ProjectsLogServicesSinksListCall) Do(opts ...googleapi.CallOption) (*ListLogServiceSinksResponse, error) {
1420 gensupport.SetOptions(c.urlParams_, opts...)
1421 res, err := c.doRequest("json")
1422 if res != nil && res.StatusCode == http.StatusNotModified {
1423 if res.Body != nil {
1424 res.Body.Close()
1425 }
1426 return nil, gensupport.WrapError(&googleapi.Error{
1427 Code: res.StatusCode,
1428 Header: res.Header,
1429 })
1430 }
1431 if err != nil {
1432 return nil, err
1433 }
1434 defer googleapi.CloseBody(res)
1435 if err := googleapi.CheckResponse(res); err != nil {
1436 return nil, gensupport.WrapError(err)
1437 }
1438 ret := &ListLogServiceSinksResponse{
1439 ServerResponse: googleapi.ServerResponse{
1440 Header: res.Header,
1441 HTTPStatusCode: res.StatusCode,
1442 },
1443 }
1444 target := &ret
1445 if err := gensupport.DecodeResponse(target, res); err != nil {
1446 return nil, err
1447 }
1448 return ret, nil
1449}
1450
1451type ProjectsLogServicesSinksUpdateCall struct {
1452 s *Service
1453 projectsId string
1454 logServicesId string
1455 sinksId string
1456 logsink *LogSink
1457 urlParams_ gensupport.URLParams
1458 ctx_ context.Context
1459 header_ http.Header
1460}
1461
1462// Update: Creates or update the specified log service sink resource.
1463//
1464// - logServicesId: Part of `sinkName`. See documentation of `projectsId`.
1465// - projectsId: Part of `sinkName`. The name of the sink to update.
1466// - sinksId: Part of `sinkName`. See documentation of `projectsId`.
1467func (r *ProjectsLogServicesSinksService) Update(projectsId string, logServicesId string, sinksId string, logsink *LogSink) *ProjectsLogServicesSinksUpdateCall {
1468 c := &ProjectsLogServicesSinksUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1469 c.projectsId = projectsId
1470 c.logServicesId = logServicesId
1471 c.sinksId = sinksId
1472 c.logsink = logsink
1473 return c
1474}
1475
1476// Fields allows partial responses to be retrieved. See
1477// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
1478// details.
1479func (c *ProjectsLogServicesSinksUpdateCall) Fields(s ...googleapi.Field) *ProjectsLogServicesSinksUpdateCall {
1480 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1481 return c
1482}
1483
1484// Context sets the context to be used in this call's Do method.
1485func (c *ProjectsLogServicesSinksUpdateCall) Context(ctx context.Context) *ProjectsLogServicesSinksUpdateCall {
1486 c.ctx_ = ctx
1487 return c
1488}
1489
1490// Header returns a http.Header that can be modified by the caller to add
1491// headers to the request.
1492func (c *ProjectsLogServicesSinksUpdateCall) Header() http.Header {
1493 if c.header_ == nil {
1494 c.header_ = make(http.Header)
1495 }
1496 return c.header_
1497}
1498
1499func (c *ProjectsLogServicesSinksUpdateCall) doRequest(alt string) (*http.Response, error) {
1500 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_, "x-goog-api-version", "v1_20240501")
1501 var body io.Reader = nil
1502 body, err := googleapi.WithoutDataWrapper.JSONReader(c.logsink)
1503 if err != nil {
1504 return nil, err
1505 }
1506 c.urlParams_.Set("alt", alt)
1507 c.urlParams_.Set("prettyPrint", "false")
1508 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta3/projects/{projectsId}/logServices/{logServicesId}/sinks/{sinksId}")
1509 urls += "?" + c.urlParams_.Encode()
1510 req, err := http.NewRequest("PUT", urls, body)
1511 if err != nil {
1512 return nil, err
1513 }
1514 req.Header = reqHeaders
1515 googleapi.Expand(req.URL, map[string]string{
1516 "projectsId": c.projectsId,
1517 "logServicesId": c.logServicesId,
1518 "sinksId": c.sinksId,
1519 })
1520 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1521}
1522
1523// Do executes the "logging.projects.logServices.sinks.update" call.
1524// Any non-2xx status code is an error. Response headers are in either
1525// *LogSink.ServerResponse.Header or (if a response was returned at all) in
1526// error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
1527// whether the returned error was because http.StatusNotModified was returned.
1528func (c *ProjectsLogServicesSinksUpdateCall) Do(opts ...googleapi.CallOption) (*LogSink, error) {
1529 gensupport.SetOptions(c.urlParams_, opts...)
1530 res, err := c.doRequest("json")
1531 if res != nil && res.StatusCode == http.StatusNotModified {
1532 if res.Body != nil {
1533 res.Body.Close()
1534 }
1535 return nil, gensupport.WrapError(&googleapi.Error{
1536 Code: res.StatusCode,
1537 Header: res.Header,
1538 })
1539 }
1540 if err != nil {
1541 return nil, err
1542 }
1543 defer googleapi.CloseBody(res)
1544 if err := googleapi.CheckResponse(res); err != nil {
1545 return nil, gensupport.WrapError(err)
1546 }
1547 ret := &LogSink{
1548 ServerResponse: googleapi.ServerResponse{
1549 Header: res.Header,
1550 HTTPStatusCode: res.StatusCode,
1551 },
1552 }
1553 target := &ret
1554 if err := gensupport.DecodeResponse(target, res); err != nil {
1555 return nil, err
1556 }
1557 return ret, nil
1558}
1559
1560type ProjectsLogsDeleteCall struct {
1561 s *Service
1562 projectsId string
1563 logsId string
1564 urlParams_ gensupport.URLParams
1565 ctx_ context.Context
1566 header_ http.Header
1567}
1568
1569// Delete: Deletes the specified log resource and all log entries contained in
1570// it.
1571//
1572// - logsId: Part of `logName`. See documentation of `projectsId`.
1573// - projectsId: Part of `logName`. The log resource to delete.
1574func (r *ProjectsLogsService) Delete(projectsId string, logsId string) *ProjectsLogsDeleteCall {
1575 c := &ProjectsLogsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1576 c.projectsId = projectsId
1577 c.logsId = logsId
1578 return c
1579}
1580
1581// Fields allows partial responses to be retrieved. See
1582// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
1583// details.
1584func (c *ProjectsLogsDeleteCall) Fields(s ...googleapi.Field) *ProjectsLogsDeleteCall {
1585 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1586 return c
1587}
1588
1589// Context sets the context to be used in this call's Do method.
1590func (c *ProjectsLogsDeleteCall) Context(ctx context.Context) *ProjectsLogsDeleteCall {
1591 c.ctx_ = ctx
1592 return c
1593}
1594
1595// Header returns a http.Header that can be modified by the caller to add
1596// headers to the request.
1597func (c *ProjectsLogsDeleteCall) Header() http.Header {
1598 if c.header_ == nil {
1599 c.header_ = make(http.Header)
1600 }
1601 return c.header_
1602}
1603
1604func (c *ProjectsLogsDeleteCall) doRequest(alt string) (*http.Response, error) {
1605 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_, "x-goog-api-version", "v1_20240501")
1606 var body io.Reader = nil
1607 c.urlParams_.Set("alt", alt)
1608 c.urlParams_.Set("prettyPrint", "false")
1609 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta3/projects/{projectsId}/logs/{logsId}")
1610 urls += "?" + c.urlParams_.Encode()
1611 req, err := http.NewRequest("DELETE", urls, body)
1612 if err != nil {
1613 return nil, err
1614 }
1615 req.Header = reqHeaders
1616 googleapi.Expand(req.URL, map[string]string{
1617 "projectsId": c.projectsId,
1618 "logsId": c.logsId,
1619 })
1620 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1621}
1622
1623// Do executes the "logging.projects.logs.delete" call.
1624// Any non-2xx status code is an error. Response headers are in either
1625// *Empty.ServerResponse.Header or (if a response was returned at all) in
1626// error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
1627// whether the returned error was because http.StatusNotModified was returned.
1628func (c *ProjectsLogsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
1629 gensupport.SetOptions(c.urlParams_, opts...)
1630 res, err := c.doRequest("json")
1631 if res != nil && res.StatusCode == http.StatusNotModified {
1632 if res.Body != nil {
1633 res.Body.Close()
1634 }
1635 return nil, gensupport.WrapError(&googleapi.Error{
1636 Code: res.StatusCode,
1637 Header: res.Header,
1638 })
1639 }
1640 if err != nil {
1641 return nil, err
1642 }
1643 defer googleapi.CloseBody(res)
1644 if err := googleapi.CheckResponse(res); err != nil {
1645 return nil, gensupport.WrapError(err)
1646 }
1647 ret := &Empty{
1648 ServerResponse: googleapi.ServerResponse{
1649 Header: res.Header,
1650 HTTPStatusCode: res.StatusCode,
1651 },
1652 }
1653 target := &ret
1654 if err := gensupport.DecodeResponse(target, res); err != nil {
1655 return nil, err
1656 }
1657 return ret, nil
1658}
1659
1660type ProjectsLogsListCall struct {
1661 s *Service
1662 projectsId string
1663 urlParams_ gensupport.URLParams
1664 ifNoneMatch_ string
1665 ctx_ context.Context
1666 header_ http.Header
1667}
1668
1669// List: Lists log resources belonging to the specified project.
1670//
1671// - projectsId: Part of `projectName`. The project name for which to list the
1672// log resources.
1673func (r *ProjectsLogsService) List(projectsId string) *ProjectsLogsListCall {
1674 c := &ProjectsLogsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1675 c.projectsId = projectsId
1676 return c
1677}
1678
1679// PageSize sets the optional parameter "pageSize": The maximum number of
1680// results to return.
1681func (c *ProjectsLogsListCall) PageSize(pageSize int64) *ProjectsLogsListCall {
1682 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
1683 return c
1684}
1685
1686// PageToken sets the optional parameter "pageToken": An opaque token, returned
1687// as `nextPageToken` by a prior `ListLogs` operation. If `pageToken` is
1688// supplied, then the other fields of this request are ignored, and instead the
1689// previous `ListLogs` operation is continued.
1690func (c *ProjectsLogsListCall) PageToken(pageToken string) *ProjectsLogsListCall {
1691 c.urlParams_.Set("pageToken", pageToken)
1692 return c
1693}
1694
1695// ServiceIndexPrefix sets the optional parameter "serviceIndexPrefix": A log
1696// service index prefix for which to list logs. Only logs containing entries
1697// whose metadata that includes these label values (associated with index keys)
1698// are returned. The prefix is a slash separated list of values, and need not
1699// specify all index labels. An empty index (or a single slash) matches all log
1700// service indexes.
1701func (c *ProjectsLogsListCall) ServiceIndexPrefix(serviceIndexPrefix string) *ProjectsLogsListCall {
1702 c.urlParams_.Set("serviceIndexPrefix", serviceIndexPrefix)
1703 return c
1704}
1705
1706// ServiceName sets the optional parameter "serviceName": A service name for
1707// which to list logs. Only logs containing entries whose metadata includes
1708// this service name are returned. If `serviceName` and `serviceIndexPrefix`
1709// are both empty, then all log names are returned. To list all log names,
1710// regardless of service, leave both the `serviceName` and `serviceIndexPrefix`
1711// empty. To list log names containing entries with a particular service name
1712// (or explicitly empty service name) set `serviceName` to the desired value
1713// and `serviceIndexPrefix` to "/".
1714func (c *ProjectsLogsListCall) ServiceName(serviceName string) *ProjectsLogsListCall {
1715 c.urlParams_.Set("serviceName", serviceName)
1716 return c
1717}
1718
1719// Fields allows partial responses to be retrieved. See
1720// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
1721// details.
1722func (c *ProjectsLogsListCall) Fields(s ...googleapi.Field) *ProjectsLogsListCall {
1723 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1724 return c
1725}
1726
1727// IfNoneMatch sets an optional parameter which makes the operation fail if the
1728// object's ETag matches the given value. This is useful for getting updates
1729// only after the object has changed since the last request.
1730func (c *ProjectsLogsListCall) IfNoneMatch(entityTag string) *ProjectsLogsListCall {
1731 c.ifNoneMatch_ = entityTag
1732 return c
1733}
1734
1735// Context sets the context to be used in this call's Do method.
1736func (c *ProjectsLogsListCall) Context(ctx context.Context) *ProjectsLogsListCall {
1737 c.ctx_ = ctx
1738 return c
1739}
1740
1741// Header returns a http.Header that can be modified by the caller to add
1742// headers to the request.
1743func (c *ProjectsLogsListCall) Header() http.Header {
1744 if c.header_ == nil {
1745 c.header_ = make(http.Header)
1746 }
1747 return c.header_
1748}
1749
1750func (c *ProjectsLogsListCall) doRequest(alt string) (*http.Response, error) {
1751 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_, "x-goog-api-version", "v1_20240501")
1752 if c.ifNoneMatch_ != "" {
1753 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
1754 }
1755 var body io.Reader = nil
1756 c.urlParams_.Set("alt", alt)
1757 c.urlParams_.Set("prettyPrint", "false")
1758 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta3/projects/{projectsId}/logs")
1759 urls += "?" + c.urlParams_.Encode()
1760 req, err := http.NewRequest("GET", urls, body)
1761 if err != nil {
1762 return nil, err
1763 }
1764 req.Header = reqHeaders
1765 googleapi.Expand(req.URL, map[string]string{
1766 "projectsId": c.projectsId,
1767 })
1768 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1769}
1770
1771// Do executes the "logging.projects.logs.list" call.
1772// Any non-2xx status code is an error. Response headers are in either
1773// *ListLogsResponse.ServerResponse.Header or (if a response was returned at
1774// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
1775// check whether the returned error was because http.StatusNotModified was
1776// returned.
1777func (c *ProjectsLogsListCall) Do(opts ...googleapi.CallOption) (*ListLogsResponse, error) {
1778 gensupport.SetOptions(c.urlParams_, opts...)
1779 res, err := c.doRequest("json")
1780 if res != nil && res.StatusCode == http.StatusNotModified {
1781 if res.Body != nil {
1782 res.Body.Close()
1783 }
1784 return nil, gensupport.WrapError(&googleapi.Error{
1785 Code: res.StatusCode,
1786 Header: res.Header,
1787 })
1788 }
1789 if err != nil {
1790 return nil, err
1791 }
1792 defer googleapi.CloseBody(res)
1793 if err := googleapi.CheckResponse(res); err != nil {
1794 return nil, gensupport.WrapError(err)
1795 }
1796 ret := &ListLogsResponse{
1797 ServerResponse: googleapi.ServerResponse{
1798 Header: res.Header,
1799 HTTPStatusCode: res.StatusCode,
1800 },
1801 }
1802 target := &ret
1803 if err := gensupport.DecodeResponse(target, res); err != nil {
1804 return nil, err
1805 }
1806 return ret, nil
1807}
1808
1809// Pages invokes f for each page of results.
1810// A non-nil error returned from f will halt the iteration.
1811// The provided context supersedes any context provided to the Context method.
1812func (c *ProjectsLogsListCall) Pages(ctx context.Context, f func(*ListLogsResponse) error) error {
1813 c.ctx_ = ctx
1814 defer c.PageToken(c.urlParams_.Get("pageToken"))
1815 for {
1816 x, err := c.Do()
1817 if err != nil {
1818 return err
1819 }
1820 if err := f(x); err != nil {
1821 return err
1822 }
1823 if x.NextPageToken == "" {
1824 return nil
1825 }
1826 c.PageToken(x.NextPageToken)
1827 }
1828}
1829
1830type ProjectsLogsEntriesWriteCall struct {
1831 s *Service
1832 projectsId string
1833 logsId string
1834 writelogentriesrequest *WriteLogEntriesRequest
1835 urlParams_ gensupport.URLParams
1836 ctx_ context.Context
1837 header_ http.Header
1838}
1839
1840// Write: Creates one or more log entries in a log. You must supply a list of
1841// `LogEntry` objects, named `entries`. Each `LogEntry` object must contain a
1842// payload object and a `LogEntryMetadata` object that describes the entry. You
1843// must fill in all the fields of the entry, metadata, and payload. You can
1844// also supply a map, `commonLabels`, that supplies default (key, value) data
1845// for the `entries[].metadata.labels` maps, saving you the trouble of creating
1846// identical copies for each entry.
1847//
1848// - logsId: Part of `logName`. See documentation of `projectsId`.
1849// - projectsId: Part of `logName`. The name of the log resource into which to
1850// insert the log entries.
1851func (r *ProjectsLogsEntriesService) Write(projectsId string, logsId string, writelogentriesrequest *WriteLogEntriesRequest) *ProjectsLogsEntriesWriteCall {
1852 c := &ProjectsLogsEntriesWriteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1853 c.projectsId = projectsId
1854 c.logsId = logsId
1855 c.writelogentriesrequest = writelogentriesrequest
1856 return c
1857}
1858
1859// Fields allows partial responses to be retrieved. See
1860// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
1861// details.
1862func (c *ProjectsLogsEntriesWriteCall) Fields(s ...googleapi.Field) *ProjectsLogsEntriesWriteCall {
1863 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1864 return c
1865}
1866
1867// Context sets the context to be used in this call's Do method.
1868func (c *ProjectsLogsEntriesWriteCall) Context(ctx context.Context) *ProjectsLogsEntriesWriteCall {
1869 c.ctx_ = ctx
1870 return c
1871}
1872
1873// Header returns a http.Header that can be modified by the caller to add
1874// headers to the request.
1875func (c *ProjectsLogsEntriesWriteCall) Header() http.Header {
1876 if c.header_ == nil {
1877 c.header_ = make(http.Header)
1878 }
1879 return c.header_
1880}
1881
1882func (c *ProjectsLogsEntriesWriteCall) doRequest(alt string) (*http.Response, error) {
1883 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_, "x-goog-api-version", "v1_20240501")
1884 var body io.Reader = nil
1885 body, err := googleapi.WithoutDataWrapper.JSONReader(c.writelogentriesrequest)
1886 if err != nil {
1887 return nil, err
1888 }
1889 c.urlParams_.Set("alt", alt)
1890 c.urlParams_.Set("prettyPrint", "false")
1891 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta3/projects/{projectsId}/logs/{logsId}/entries:write")
1892 urls += "?" + c.urlParams_.Encode()
1893 req, err := http.NewRequest("POST", urls, body)
1894 if err != nil {
1895 return nil, err
1896 }
1897 req.Header = reqHeaders
1898 googleapi.Expand(req.URL, map[string]string{
1899 "projectsId": c.projectsId,
1900 "logsId": c.logsId,
1901 })
1902 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1903}
1904
1905// Do executes the "logging.projects.logs.entries.write" call.
1906// Any non-2xx status code is an error. Response headers are in either
1907// *WriteLogEntriesResponse.ServerResponse.Header or (if a response was
1908// returned at all) in error.(*googleapi.Error).Header. Use
1909// googleapi.IsNotModified to check whether the returned error was because
1910// http.StatusNotModified was returned.
1911func (c *ProjectsLogsEntriesWriteCall) Do(opts ...googleapi.CallOption) (*WriteLogEntriesResponse, error) {
1912 gensupport.SetOptions(c.urlParams_, opts...)
1913 res, err := c.doRequest("json")
1914 if res != nil && res.StatusCode == http.StatusNotModified {
1915 if res.Body != nil {
1916 res.Body.Close()
1917 }
1918 return nil, gensupport.WrapError(&googleapi.Error{
1919 Code: res.StatusCode,
1920 Header: res.Header,
1921 })
1922 }
1923 if err != nil {
1924 return nil, err
1925 }
1926 defer googleapi.CloseBody(res)
1927 if err := googleapi.CheckResponse(res); err != nil {
1928 return nil, gensupport.WrapError(err)
1929 }
1930 ret := &WriteLogEntriesResponse{
1931 ServerResponse: googleapi.ServerResponse{
1932 Header: res.Header,
1933 HTTPStatusCode: res.StatusCode,
1934 },
1935 }
1936 target := &ret
1937 if err := gensupport.DecodeResponse(target, res); err != nil {
1938 return nil, err
1939 }
1940 return ret, nil
1941}
1942
1943type ProjectsLogsSinksCreateCall struct {
1944 s *Service
1945 projectsId string
1946 logsId string
1947 logsink *LogSink
1948 urlParams_ gensupport.URLParams
1949 ctx_ context.Context
1950 header_ http.Header
1951}
1952
1953// Create: Creates the specified log sink resource.
1954//
1955// - logsId: Part of `logName`. See documentation of `projectsId`.
1956// - projectsId: Part of `logName`. The log in which to create a sink resource.
1957func (r *ProjectsLogsSinksService) Create(projectsId string, logsId string, logsink *LogSink) *ProjectsLogsSinksCreateCall {
1958 c := &ProjectsLogsSinksCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1959 c.projectsId = projectsId
1960 c.logsId = logsId
1961 c.logsink = logsink
1962 return c
1963}
1964
1965// Fields allows partial responses to be retrieved. See
1966// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
1967// details.
1968func (c *ProjectsLogsSinksCreateCall) Fields(s ...googleapi.Field) *ProjectsLogsSinksCreateCall {
1969 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1970 return c
1971}
1972
1973// Context sets the context to be used in this call's Do method.
1974func (c *ProjectsLogsSinksCreateCall) Context(ctx context.Context) *ProjectsLogsSinksCreateCall {
1975 c.ctx_ = ctx
1976 return c
1977}
1978
1979// Header returns a http.Header that can be modified by the caller to add
1980// headers to the request.
1981func (c *ProjectsLogsSinksCreateCall) Header() http.Header {
1982 if c.header_ == nil {
1983 c.header_ = make(http.Header)
1984 }
1985 return c.header_
1986}
1987
1988func (c *ProjectsLogsSinksCreateCall) doRequest(alt string) (*http.Response, error) {
1989 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_, "x-goog-api-version", "v1_20240501")
1990 var body io.Reader = nil
1991 body, err := googleapi.WithoutDataWrapper.JSONReader(c.logsink)
1992 if err != nil {
1993 return nil, err
1994 }
1995 c.urlParams_.Set("alt", alt)
1996 c.urlParams_.Set("prettyPrint", "false")
1997 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta3/projects/{projectsId}/logs/{logsId}/sinks")
1998 urls += "?" + c.urlParams_.Encode()
1999 req, err := http.NewRequest("POST", urls, body)
2000 if err != nil {
2001 return nil, err
2002 }
2003 req.Header = reqHeaders
2004 googleapi.Expand(req.URL, map[string]string{
2005 "projectsId": c.projectsId,
2006 "logsId": c.logsId,
2007 })
2008 return gensupport.SendRequest(c.ctx_, c.s.client, req)
2009}
2010
2011// Do executes the "logging.projects.logs.sinks.create" call.
2012// Any non-2xx status code is an error. Response headers are in either
2013// *LogSink.ServerResponse.Header or (if a response was returned at all) in
2014// error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
2015// whether the returned error was because http.StatusNotModified was returned.
2016func (c *ProjectsLogsSinksCreateCall) Do(opts ...googleapi.CallOption) (*LogSink, error) {
2017 gensupport.SetOptions(c.urlParams_, opts...)
2018 res, err := c.doRequest("json")
2019 if res != nil && res.StatusCode == http.StatusNotModified {
2020 if res.Body != nil {
2021 res.Body.Close()
2022 }
2023 return nil, gensupport.WrapError(&googleapi.Error{
2024 Code: res.StatusCode,
2025 Header: res.Header,
2026 })
2027 }
2028 if err != nil {
2029 return nil, err
2030 }
2031 defer googleapi.CloseBody(res)
2032 if err := googleapi.CheckResponse(res); err != nil {
2033 return nil, gensupport.WrapError(err)
2034 }
2035 ret := &LogSink{
2036 ServerResponse: googleapi.ServerResponse{
2037 Header: res.Header,
2038 HTTPStatusCode: res.StatusCode,
2039 },
2040 }
2041 target := &ret
2042 if err := gensupport.DecodeResponse(target, res); err != nil {
2043 return nil, err
2044 }
2045 return ret, nil
2046}
2047
2048type ProjectsLogsSinksDeleteCall struct {
2049 s *Service
2050 projectsId string
2051 logsId string
2052 sinksId string
2053 urlParams_ gensupport.URLParams
2054 ctx_ context.Context
2055 header_ http.Header
2056}
2057
2058// Delete: Deletes the specified log sink resource.
2059//
2060// - logsId: Part of `sinkName`. See documentation of `projectsId`.
2061// - projectsId: Part of `sinkName`. The name of the sink to delete.
2062// - sinksId: Part of `sinkName`. See documentation of `projectsId`.
2063func (r *ProjectsLogsSinksService) Delete(projectsId string, logsId string, sinksId string) *ProjectsLogsSinksDeleteCall {
2064 c := &ProjectsLogsSinksDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2065 c.projectsId = projectsId
2066 c.logsId = logsId
2067 c.sinksId = sinksId
2068 return c
2069}
2070
2071// Fields allows partial responses to be retrieved. See
2072// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
2073// details.
2074func (c *ProjectsLogsSinksDeleteCall) Fields(s ...googleapi.Field) *ProjectsLogsSinksDeleteCall {
2075 c.urlParams_.Set("fields", googleapi.CombineFields(s))
2076 return c
2077}
2078
2079// Context sets the context to be used in this call's Do method.
2080func (c *ProjectsLogsSinksDeleteCall) Context(ctx context.Context) *ProjectsLogsSinksDeleteCall {
2081 c.ctx_ = ctx
2082 return c
2083}
2084
2085// Header returns a http.Header that can be modified by the caller to add
2086// headers to the request.
2087func (c *ProjectsLogsSinksDeleteCall) Header() http.Header {
2088 if c.header_ == nil {
2089 c.header_ = make(http.Header)
2090 }
2091 return c.header_
2092}
2093
2094func (c *ProjectsLogsSinksDeleteCall) doRequest(alt string) (*http.Response, error) {
2095 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_, "x-goog-api-version", "v1_20240501")
2096 var body io.Reader = nil
2097 c.urlParams_.Set("alt", alt)
2098 c.urlParams_.Set("prettyPrint", "false")
2099 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta3/projects/{projectsId}/logs/{logsId}/sinks/{sinksId}")
2100 urls += "?" + c.urlParams_.Encode()
2101 req, err := http.NewRequest("DELETE", urls, body)
2102 if err != nil {
2103 return nil, err
2104 }
2105 req.Header = reqHeaders
2106 googleapi.Expand(req.URL, map[string]string{
2107 "projectsId": c.projectsId,
2108 "logsId": c.logsId,
2109 "sinksId": c.sinksId,
2110 })
2111 return gensupport.SendRequest(c.ctx_, c.s.client, req)
2112}
2113
2114// Do executes the "logging.projects.logs.sinks.delete" call.
2115// Any non-2xx status code is an error. Response headers are in either
2116// *Empty.ServerResponse.Header or (if a response was returned at all) in
2117// error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
2118// whether the returned error was because http.StatusNotModified was returned.
2119func (c *ProjectsLogsSinksDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
2120 gensupport.SetOptions(c.urlParams_, opts...)
2121 res, err := c.doRequest("json")
2122 if res != nil && res.StatusCode == http.StatusNotModified {
2123 if res.Body != nil {
2124 res.Body.Close()
2125 }
2126 return nil, gensupport.WrapError(&googleapi.Error{
2127 Code: res.StatusCode,
2128 Header: res.Header,
2129 })
2130 }
2131 if err != nil {
2132 return nil, err
2133 }
2134 defer googleapi.CloseBody(res)
2135 if err := googleapi.CheckResponse(res); err != nil {
2136 return nil, gensupport.WrapError(err)
2137 }
2138 ret := &Empty{
2139 ServerResponse: googleapi.ServerResponse{
2140 Header: res.Header,
2141 HTTPStatusCode: res.StatusCode,
2142 },
2143 }
2144 target := &ret
2145 if err := gensupport.DecodeResponse(target, res); err != nil {
2146 return nil, err
2147 }
2148 return ret, nil
2149}
2150
2151type ProjectsLogsSinksGetCall struct {
2152 s *Service
2153 projectsId string
2154 logsId string
2155 sinksId string
2156 urlParams_ gensupport.URLParams
2157 ifNoneMatch_ string
2158 ctx_ context.Context
2159 header_ http.Header
2160}
2161
2162// Get: Gets the specified log sink resource.
2163//
2164// - logsId: Part of `sinkName`. See documentation of `projectsId`.
2165// - projectsId: Part of `sinkName`. The name of the sink resource to return.
2166// - sinksId: Part of `sinkName`. See documentation of `projectsId`.
2167func (r *ProjectsLogsSinksService) Get(projectsId string, logsId string, sinksId string) *ProjectsLogsSinksGetCall {
2168 c := &ProjectsLogsSinksGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2169 c.projectsId = projectsId
2170 c.logsId = logsId
2171 c.sinksId = sinksId
2172 return c
2173}
2174
2175// Fields allows partial responses to be retrieved. See
2176// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
2177// details.
2178func (c *ProjectsLogsSinksGetCall) Fields(s ...googleapi.Field) *ProjectsLogsSinksGetCall {
2179 c.urlParams_.Set("fields", googleapi.CombineFields(s))
2180 return c
2181}
2182
2183// IfNoneMatch sets an optional parameter which makes the operation fail if the
2184// object's ETag matches the given value. This is useful for getting updates
2185// only after the object has changed since the last request.
2186func (c *ProjectsLogsSinksGetCall) IfNoneMatch(entityTag string) *ProjectsLogsSinksGetCall {
2187 c.ifNoneMatch_ = entityTag
2188 return c
2189}
2190
2191// Context sets the context to be used in this call's Do method.
2192func (c *ProjectsLogsSinksGetCall) Context(ctx context.Context) *ProjectsLogsSinksGetCall {
2193 c.ctx_ = ctx
2194 return c
2195}
2196
2197// Header returns a http.Header that can be modified by the caller to add
2198// headers to the request.
2199func (c *ProjectsLogsSinksGetCall) Header() http.Header {
2200 if c.header_ == nil {
2201 c.header_ = make(http.Header)
2202 }
2203 return c.header_
2204}
2205
2206func (c *ProjectsLogsSinksGetCall) doRequest(alt string) (*http.Response, error) {
2207 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_, "x-goog-api-version", "v1_20240501")
2208 if c.ifNoneMatch_ != "" {
2209 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
2210 }
2211 var body io.Reader = nil
2212 c.urlParams_.Set("alt", alt)
2213 c.urlParams_.Set("prettyPrint", "false")
2214 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta3/projects/{projectsId}/logs/{logsId}/sinks/{sinksId}")
2215 urls += "?" + c.urlParams_.Encode()
2216 req, err := http.NewRequest("GET", urls, body)
2217 if err != nil {
2218 return nil, err
2219 }
2220 req.Header = reqHeaders
2221 googleapi.Expand(req.URL, map[string]string{
2222 "projectsId": c.projectsId,
2223 "logsId": c.logsId,
2224 "sinksId": c.sinksId,
2225 })
2226 return gensupport.SendRequest(c.ctx_, c.s.client, req)
2227}
2228
2229// Do executes the "logging.projects.logs.sinks.get" call.
2230// Any non-2xx status code is an error. Response headers are in either
2231// *LogSink.ServerResponse.Header or (if a response was returned at all) in
2232// error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
2233// whether the returned error was because http.StatusNotModified was returned.
2234func (c *ProjectsLogsSinksGetCall) Do(opts ...googleapi.CallOption) (*LogSink, error) {
2235 gensupport.SetOptions(c.urlParams_, opts...)
2236 res, err := c.doRequest("json")
2237 if res != nil && res.StatusCode == http.StatusNotModified {
2238 if res.Body != nil {
2239 res.Body.Close()
2240 }
2241 return nil, gensupport.WrapError(&googleapi.Error{
2242 Code: res.StatusCode,
2243 Header: res.Header,
2244 })
2245 }
2246 if err != nil {
2247 return nil, err
2248 }
2249 defer googleapi.CloseBody(res)
2250 if err := googleapi.CheckResponse(res); err != nil {
2251 return nil, gensupport.WrapError(err)
2252 }
2253 ret := &LogSink{
2254 ServerResponse: googleapi.ServerResponse{
2255 Header: res.Header,
2256 HTTPStatusCode: res.StatusCode,
2257 },
2258 }
2259 target := &ret
2260 if err := gensupport.DecodeResponse(target, res); err != nil {
2261 return nil, err
2262 }
2263 return ret, nil
2264}
2265
2266type ProjectsLogsSinksListCall struct {
2267 s *Service
2268 projectsId string
2269 logsId string
2270 urlParams_ gensupport.URLParams
2271 ifNoneMatch_ string
2272 ctx_ context.Context
2273 header_ http.Header
2274}
2275
2276// List: Lists log sinks associated with the specified log.
2277//
2278// - logsId: Part of `logName`. See documentation of `projectsId`.
2279// - projectsId: Part of `logName`. The log for which to list sinks.
2280func (r *ProjectsLogsSinksService) List(projectsId string, logsId string) *ProjectsLogsSinksListCall {
2281 c := &ProjectsLogsSinksListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2282 c.projectsId = projectsId
2283 c.logsId = logsId
2284 return c
2285}
2286
2287// Fields allows partial responses to be retrieved. See
2288// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
2289// details.
2290func (c *ProjectsLogsSinksListCall) Fields(s ...googleapi.Field) *ProjectsLogsSinksListCall {
2291 c.urlParams_.Set("fields", googleapi.CombineFields(s))
2292 return c
2293}
2294
2295// IfNoneMatch sets an optional parameter which makes the operation fail if the
2296// object's ETag matches the given value. This is useful for getting updates
2297// only after the object has changed since the last request.
2298func (c *ProjectsLogsSinksListCall) IfNoneMatch(entityTag string) *ProjectsLogsSinksListCall {
2299 c.ifNoneMatch_ = entityTag
2300 return c
2301}
2302
2303// Context sets the context to be used in this call's Do method.
2304func (c *ProjectsLogsSinksListCall) Context(ctx context.Context) *ProjectsLogsSinksListCall {
2305 c.ctx_ = ctx
2306 return c
2307}
2308
2309// Header returns a http.Header that can be modified by the caller to add
2310// headers to the request.
2311func (c *ProjectsLogsSinksListCall) Header() http.Header {
2312 if c.header_ == nil {
2313 c.header_ = make(http.Header)
2314 }
2315 return c.header_
2316}
2317
2318func (c *ProjectsLogsSinksListCall) doRequest(alt string) (*http.Response, error) {
2319 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_, "x-goog-api-version", "v1_20240501")
2320 if c.ifNoneMatch_ != "" {
2321 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
2322 }
2323 var body io.Reader = nil
2324 c.urlParams_.Set("alt", alt)
2325 c.urlParams_.Set("prettyPrint", "false")
2326 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta3/projects/{projectsId}/logs/{logsId}/sinks")
2327 urls += "?" + c.urlParams_.Encode()
2328 req, err := http.NewRequest("GET", urls, body)
2329 if err != nil {
2330 return nil, err
2331 }
2332 req.Header = reqHeaders
2333 googleapi.Expand(req.URL, map[string]string{
2334 "projectsId": c.projectsId,
2335 "logsId": c.logsId,
2336 })
2337 return gensupport.SendRequest(c.ctx_, c.s.client, req)
2338}
2339
2340// Do executes the "logging.projects.logs.sinks.list" call.
2341// Any non-2xx status code is an error. Response headers are in either
2342// *ListLogSinksResponse.ServerResponse.Header or (if a response was returned
2343// at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
2344// check whether the returned error was because http.StatusNotModified was
2345// returned.
2346func (c *ProjectsLogsSinksListCall) Do(opts ...googleapi.CallOption) (*ListLogSinksResponse, error) {
2347 gensupport.SetOptions(c.urlParams_, opts...)
2348 res, err := c.doRequest("json")
2349 if res != nil && res.StatusCode == http.StatusNotModified {
2350 if res.Body != nil {
2351 res.Body.Close()
2352 }
2353 return nil, gensupport.WrapError(&googleapi.Error{
2354 Code: res.StatusCode,
2355 Header: res.Header,
2356 })
2357 }
2358 if err != nil {
2359 return nil, err
2360 }
2361 defer googleapi.CloseBody(res)
2362 if err := googleapi.CheckResponse(res); err != nil {
2363 return nil, gensupport.WrapError(err)
2364 }
2365 ret := &ListLogSinksResponse{
2366 ServerResponse: googleapi.ServerResponse{
2367 Header: res.Header,
2368 HTTPStatusCode: res.StatusCode,
2369 },
2370 }
2371 target := &ret
2372 if err := gensupport.DecodeResponse(target, res); err != nil {
2373 return nil, err
2374 }
2375 return ret, nil
2376}
2377
2378type ProjectsLogsSinksUpdateCall struct {
2379 s *Service
2380 projectsId string
2381 logsId string
2382 sinksId string
2383 logsink *LogSink
2384 urlParams_ gensupport.URLParams
2385 ctx_ context.Context
2386 header_ http.Header
2387}
2388
2389// Update: Creates or updates the specified log sink resource.
2390//
2391// - logsId: Part of `sinkName`. See documentation of `projectsId`.
2392// - projectsId: Part of `sinkName`. The name of the sink to update.
2393// - sinksId: Part of `sinkName`. See documentation of `projectsId`.
2394func (r *ProjectsLogsSinksService) Update(projectsId string, logsId string, sinksId string, logsink *LogSink) *ProjectsLogsSinksUpdateCall {
2395 c := &ProjectsLogsSinksUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2396 c.projectsId = projectsId
2397 c.logsId = logsId
2398 c.sinksId = sinksId
2399 c.logsink = logsink
2400 return c
2401}
2402
2403// Fields allows partial responses to be retrieved. See
2404// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
2405// details.
2406func (c *ProjectsLogsSinksUpdateCall) Fields(s ...googleapi.Field) *ProjectsLogsSinksUpdateCall {
2407 c.urlParams_.Set("fields", googleapi.CombineFields(s))
2408 return c
2409}
2410
2411// Context sets the context to be used in this call's Do method.
2412func (c *ProjectsLogsSinksUpdateCall) Context(ctx context.Context) *ProjectsLogsSinksUpdateCall {
2413 c.ctx_ = ctx
2414 return c
2415}
2416
2417// Header returns a http.Header that can be modified by the caller to add
2418// headers to the request.
2419func (c *ProjectsLogsSinksUpdateCall) Header() http.Header {
2420 if c.header_ == nil {
2421 c.header_ = make(http.Header)
2422 }
2423 return c.header_
2424}
2425
2426func (c *ProjectsLogsSinksUpdateCall) doRequest(alt string) (*http.Response, error) {
2427 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_, "x-goog-api-version", "v1_20240501")
2428 var body io.Reader = nil
2429 body, err := googleapi.WithoutDataWrapper.JSONReader(c.logsink)
2430 if err != nil {
2431 return nil, err
2432 }
2433 c.urlParams_.Set("alt", alt)
2434 c.urlParams_.Set("prettyPrint", "false")
2435 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta3/projects/{projectsId}/logs/{logsId}/sinks/{sinksId}")
2436 urls += "?" + c.urlParams_.Encode()
2437 req, err := http.NewRequest("PUT", urls, body)
2438 if err != nil {
2439 return nil, err
2440 }
2441 req.Header = reqHeaders
2442 googleapi.Expand(req.URL, map[string]string{
2443 "projectsId": c.projectsId,
2444 "logsId": c.logsId,
2445 "sinksId": c.sinksId,
2446 })
2447 return gensupport.SendRequest(c.ctx_, c.s.client, req)
2448}
2449
2450// Do executes the "logging.projects.logs.sinks.update" call.
2451// Any non-2xx status code is an error. Response headers are in either
2452// *LogSink.ServerResponse.Header or (if a response was returned at all) in
2453// error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
2454// whether the returned error was because http.StatusNotModified was returned.
2455func (c *ProjectsLogsSinksUpdateCall) Do(opts ...googleapi.CallOption) (*LogSink, error) {
2456 gensupport.SetOptions(c.urlParams_, opts...)
2457 res, err := c.doRequest("json")
2458 if res != nil && res.StatusCode == http.StatusNotModified {
2459 if res.Body != nil {
2460 res.Body.Close()
2461 }
2462 return nil, gensupport.WrapError(&googleapi.Error{
2463 Code: res.StatusCode,
2464 Header: res.Header,
2465 })
2466 }
2467 if err != nil {
2468 return nil, err
2469 }
2470 defer googleapi.CloseBody(res)
2471 if err := googleapi.CheckResponse(res); err != nil {
2472 return nil, gensupport.WrapError(err)
2473 }
2474 ret := &LogSink{
2475 ServerResponse: googleapi.ServerResponse{
2476 Header: res.Header,
2477 HTTPStatusCode: res.StatusCode,
2478 },
2479 }
2480 target := &ret
2481 if err := gensupport.DecodeResponse(target, res); err != nil {
2482 return nil, err
2483 }
2484 return ret, nil
2485}
View as plain text