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