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