github.com/timstclair/heapster@v0.20.0-alpha1/Godeps/_workspace/src/google.golang.org/api/logging/v2beta1/logging-gen.go (about) 1 // Package logging provides access to the Google Cloud Logging API. 2 // 3 // See https://cloud.google.com/logging/docs/ 4 // 5 // Usage example: 6 // 7 // import "google.golang.org/api/logging/v2beta1" 8 // ... 9 // loggingService, err := logging.New(oauthHttpClient) 10 package logging 11 12 import ( 13 "bytes" 14 "encoding/json" 15 "errors" 16 "fmt" 17 context "golang.org/x/net/context" 18 ctxhttp "golang.org/x/net/context/ctxhttp" 19 gensupport "google.golang.org/api/gensupport" 20 googleapi "google.golang.org/api/googleapi" 21 "io" 22 "net/http" 23 "net/url" 24 "strconv" 25 "strings" 26 ) 27 28 // Always reference these packages, just in case the auto-generated code 29 // below doesn't. 30 var _ = bytes.NewBuffer 31 var _ = strconv.Itoa 32 var _ = fmt.Sprintf 33 var _ = json.NewDecoder 34 var _ = io.Copy 35 var _ = url.Parse 36 var _ = gensupport.MarshalJSON 37 var _ = googleapi.Version 38 var _ = errors.New 39 var _ = strings.Replace 40 var _ = context.Canceled 41 var _ = ctxhttp.Do 42 43 const apiId = "logging:v2beta1" 44 const apiName = "logging" 45 const apiVersion = "v2beta1" 46 const basePath = "https://logging.googleapis.com/" 47 48 // OAuth2 scopes used by this API. 49 const ( 50 // View and manage your data across Google Cloud Platform services 51 CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform" 52 53 // View your data across Google Cloud Platform services 54 CloudPlatformReadOnlyScope = "https://www.googleapis.com/auth/cloud-platform.read-only" 55 56 // Administrate log data for your projects 57 LoggingAdminScope = "https://www.googleapis.com/auth/logging.admin" 58 59 // View log data for your projects 60 LoggingReadScope = "https://www.googleapis.com/auth/logging.read" 61 62 // Submit log data for your projects 63 LoggingWriteScope = "https://www.googleapis.com/auth/logging.write" 64 ) 65 66 func New(client *http.Client) (*Service, error) { 67 if client == nil { 68 return nil, errors.New("client is nil") 69 } 70 s := &Service{client: client, BasePath: basePath} 71 s.Entries = NewEntriesService(s) 72 s.MonitoredResourceDescriptors = NewMonitoredResourceDescriptorsService(s) 73 s.Projects = NewProjectsService(s) 74 return s, nil 75 } 76 77 type Service struct { 78 client *http.Client 79 BasePath string // API endpoint base URL 80 UserAgent string // optional additional User-Agent fragment 81 82 Entries *EntriesService 83 84 MonitoredResourceDescriptors *MonitoredResourceDescriptorsService 85 86 Projects *ProjectsService 87 } 88 89 func (s *Service) userAgent() string { 90 if s.UserAgent == "" { 91 return googleapi.UserAgent 92 } 93 return googleapi.UserAgent + " " + s.UserAgent 94 } 95 96 func NewEntriesService(s *Service) *EntriesService { 97 rs := &EntriesService{s: s} 98 return rs 99 } 100 101 type EntriesService struct { 102 s *Service 103 } 104 105 func NewMonitoredResourceDescriptorsService(s *Service) *MonitoredResourceDescriptorsService { 106 rs := &MonitoredResourceDescriptorsService{s: s} 107 return rs 108 } 109 110 type MonitoredResourceDescriptorsService struct { 111 s *Service 112 } 113 114 func NewProjectsService(s *Service) *ProjectsService { 115 rs := &ProjectsService{s: s} 116 rs.Logs = NewProjectsLogsService(s) 117 rs.Metrics = NewProjectsMetricsService(s) 118 rs.Sinks = NewProjectsSinksService(s) 119 return rs 120 } 121 122 type ProjectsService struct { 123 s *Service 124 125 Logs *ProjectsLogsService 126 127 Metrics *ProjectsMetricsService 128 129 Sinks *ProjectsSinksService 130 } 131 132 func NewProjectsLogsService(s *Service) *ProjectsLogsService { 133 rs := &ProjectsLogsService{s: s} 134 return rs 135 } 136 137 type ProjectsLogsService struct { 138 s *Service 139 } 140 141 func NewProjectsMetricsService(s *Service) *ProjectsMetricsService { 142 rs := &ProjectsMetricsService{s: s} 143 return rs 144 } 145 146 type ProjectsMetricsService struct { 147 s *Service 148 } 149 150 func NewProjectsSinksService(s *Service) *ProjectsSinksService { 151 rs := &ProjectsSinksService{s: s} 152 return rs 153 } 154 155 type ProjectsSinksService struct { 156 s *Service 157 } 158 159 // Empty: A generic empty message that you can re-use to avoid defining 160 // duplicated empty messages in your APIs. A typical example is to use 161 // it as the request or the response type of an API method. For 162 // instance: service Foo { rpc Bar(google.protobuf.Empty) returns 163 // (google.protobuf.Empty); } The JSON representation for `Empty` is 164 // empty JSON object `{}`. 165 type Empty struct { 166 // ServerResponse contains the HTTP response code and headers from the 167 // server. 168 googleapi.ServerResponse `json:"-"` 169 } 170 171 // HttpRequest: A common proto for logging HTTP requests. 172 type HttpRequest struct { 173 // CacheHit: Whether or not an entity was served from cache (with or 174 // without validation). 175 CacheHit bool `json:"cacheHit,omitempty"` 176 177 // Referer: The referer(sic) URL of the request, as defined in [HTTP/1.1 178 // Header Field 179 // Definitions](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html). 180 Referer string `json:"referer,omitempty"` 181 182 // RemoteIp: The IP address (IPv4 or IPv6) of the client that issued the 183 // HTTP request. Examples: "192.168.1.1", 184 // "FE80::0202:B3FF:FE1E:8329". 185 RemoteIp string `json:"remoteIp,omitempty"` 186 187 // RequestMethod: The request method. Examples: "GET", "HEAD", 188 // "PUT", "POST". 189 RequestMethod string `json:"requestMethod,omitempty"` 190 191 // RequestSize: The size of the HTTP request message in bytes, including 192 // the request headers and the request body. 193 RequestSize int64 `json:"requestSize,omitempty,string"` 194 195 // RequestUrl: The scheme (http, https), the host name, the path and the 196 // query portion of the URL that was requested. Example: 197 // "http://example.com/some/info?color=red". 198 RequestUrl string `json:"requestUrl,omitempty"` 199 200 // ResponseSize: The size of the HTTP response message sent back to the 201 // client, in bytes, including the response headers and the response 202 // body. 203 ResponseSize int64 `json:"responseSize,omitempty,string"` 204 205 // Status: The response code indicating the status of response. 206 // Examples: 200, 404. 207 Status int64 `json:"status,omitempty"` 208 209 // UserAgent: The user agent sent by the client. Example: "Mozilla/4.0 210 // (compatible; MSIE 6.0; Windows 98; Q312461; .NET CLR 1.0.3705)". 211 UserAgent string `json:"userAgent,omitempty"` 212 213 // ValidatedWithOriginServer: Whether or not the response was validated 214 // with the origin server before being served from cache. This field is 215 // only meaningful if cache_hit is True. 216 ValidatedWithOriginServer bool `json:"validatedWithOriginServer,omitempty"` 217 218 // ForceSendFields is a list of field names (e.g. "CacheHit") to 219 // unconditionally include in API requests. By default, fields with 220 // empty values are omitted from API requests. However, any non-pointer, 221 // non-interface field appearing in ForceSendFields will be sent to the 222 // server regardless of whether the field is empty or not. This may be 223 // used to include empty fields in Patch requests. 224 ForceSendFields []string `json:"-"` 225 } 226 227 func (s *HttpRequest) MarshalJSON() ([]byte, error) { 228 type noMethod HttpRequest 229 raw := noMethod(*s) 230 return gensupport.MarshalJSON(raw, s.ForceSendFields) 231 } 232 233 // LabelDescriptor: A description of a label. 234 type LabelDescriptor struct { 235 // Description: A human-readable description for the label. 236 Description string `json:"description,omitempty"` 237 238 // Key: The label key. 239 Key string `json:"key,omitempty"` 240 241 // ValueType: The type of data that can be assigned to the label. 242 // 243 // Possible values: 244 // "STRING" 245 // "BOOL" 246 // "INT64" 247 ValueType string `json:"valueType,omitempty"` 248 249 // ForceSendFields is a list of field names (e.g. "Description") to 250 // unconditionally include in API requests. By default, fields with 251 // empty values are omitted from API requests. However, any non-pointer, 252 // non-interface field appearing in ForceSendFields will be sent to the 253 // server regardless of whether the field is empty or not. This may be 254 // used to include empty fields in Patch requests. 255 ForceSendFields []string `json:"-"` 256 } 257 258 func (s *LabelDescriptor) MarshalJSON() ([]byte, error) { 259 type noMethod LabelDescriptor 260 raw := noMethod(*s) 261 return gensupport.MarshalJSON(raw, s.ForceSendFields) 262 } 263 264 // ListLogEntriesRequest: The parameters to `ListLogEntries`. 265 type ListLogEntriesRequest struct { 266 // Filter: Optional. An [advanced logs 267 // filter](/logging/docs/view/advanced_filters). The filter is compared 268 // against all log entries in the projects specified by `projectIds`. 269 // Only entries that match the filter are retrieved. An empty filter 270 // matches all log entries. 271 Filter string `json:"filter,omitempty"` 272 273 // OrderBy: Optional. How the results should be sorted. Presently, the 274 // only permitted values are "timestamp" (default) and "timestamp 275 // desc". The first option returns entries in order of increasing 276 // values of `LogEntry.timestamp` (oldest first), and the second option 277 // returns entries in order of decreasing timestamps (newest first). 278 // Entries with equal timestamps are returned in order of 279 // `LogEntry.insertId`. 280 OrderBy string `json:"orderBy,omitempty"` 281 282 // PageSize: Optional. The maximum number of results to return from this 283 // request. Fewer results might be returned. You must check for the 284 // 'nextPageToken` result to determine if additional results are 285 // available, which you can retrieve by passing the `nextPageToken` 286 // value in the `pageToken` parameter to the next request. 287 PageSize int64 `json:"pageSize,omitempty"` 288 289 // PageToken: Optional. If the `pageToken` request parameter is 290 // supplied, then the next page of results in the set are retrieved. The 291 // `pageToken` parameter must be set with the value of the 292 // `nextPageToken` result parameter from the previous request. The 293 // values of `projectIds`, `filter`, and `orderBy` must be the same as 294 // in the previous request. 295 PageToken string `json:"pageToken,omitempty"` 296 297 // ProjectIds: Required. One or more project IDs or project numbers from 298 // which to retrieve log entries. Examples of a project ID: 299 // "my-project-1A", "1234567890". 300 ProjectIds []string `json:"projectIds,omitempty"` 301 302 // ForceSendFields is a list of field names (e.g. "Filter") to 303 // unconditionally include in API requests. By default, fields with 304 // empty values are omitted from API requests. However, any non-pointer, 305 // non-interface field appearing in ForceSendFields will be sent to the 306 // server regardless of whether the field is empty or not. This may be 307 // used to include empty fields in Patch requests. 308 ForceSendFields []string `json:"-"` 309 } 310 311 func (s *ListLogEntriesRequest) MarshalJSON() ([]byte, error) { 312 type noMethod ListLogEntriesRequest 313 raw := noMethod(*s) 314 return gensupport.MarshalJSON(raw, s.ForceSendFields) 315 } 316 317 // ListLogEntriesResponse: Result returned from `ListLogEntries`. 318 type ListLogEntriesResponse struct { 319 // Entries: A list of log entries. 320 Entries []*LogEntry `json:"entries,omitempty"` 321 322 // NextPageToken: If there are more results than were returned, then 323 // `nextPageToken` is given a value in the response. To get the next 324 // batch of results, call this method again using the value of 325 // `nextPageToken` as `pageToken`. 326 NextPageToken string `json:"nextPageToken,omitempty"` 327 328 // ServerResponse contains the HTTP response code and headers from the 329 // server. 330 googleapi.ServerResponse `json:"-"` 331 332 // ForceSendFields is a list of field names (e.g. "Entries") to 333 // unconditionally include in API requests. By default, fields with 334 // empty values are omitted from API requests. However, any non-pointer, 335 // non-interface field appearing in ForceSendFields will be sent to the 336 // server regardless of whether the field is empty or not. This may be 337 // used to include empty fields in Patch requests. 338 ForceSendFields []string `json:"-"` 339 } 340 341 func (s *ListLogEntriesResponse) MarshalJSON() ([]byte, error) { 342 type noMethod ListLogEntriesResponse 343 raw := noMethod(*s) 344 return gensupport.MarshalJSON(raw, s.ForceSendFields) 345 } 346 347 // ListLogMetricsResponse: Result returned from ListLogMetrics. 348 type ListLogMetricsResponse struct { 349 // Metrics: A list of logs-based metrics. 350 Metrics []*LogMetric `json:"metrics,omitempty"` 351 352 // NextPageToken: If there are more results than were returned, then 353 // `nextPageToken` is given a value in the response. To get the next 354 // batch of results, call this method again using the value of 355 // `nextPageToken` as `pageToken`. 356 NextPageToken string `json:"nextPageToken,omitempty"` 357 358 // ServerResponse contains the HTTP response code and headers from the 359 // server. 360 googleapi.ServerResponse `json:"-"` 361 362 // ForceSendFields is a list of field names (e.g. "Metrics") to 363 // unconditionally include in API requests. By default, fields with 364 // empty values are omitted from API requests. However, any non-pointer, 365 // non-interface field appearing in ForceSendFields will be sent to the 366 // server regardless of whether the field is empty or not. This may be 367 // used to include empty fields in Patch requests. 368 ForceSendFields []string `json:"-"` 369 } 370 371 func (s *ListLogMetricsResponse) MarshalJSON() ([]byte, error) { 372 type noMethod ListLogMetricsResponse 373 raw := noMethod(*s) 374 return gensupport.MarshalJSON(raw, s.ForceSendFields) 375 } 376 377 // ListMonitoredResourceDescriptorsResponse: Result returned from 378 // ListMonitoredResourceDescriptors. 379 type ListMonitoredResourceDescriptorsResponse struct { 380 // NextPageToken: If there are more results than were returned, then 381 // `nextPageToken` is returned in the response. To get the next batch of 382 // results, call this method again using the value of `nextPageToken` as 383 // `pageToken`. 384 NextPageToken string `json:"nextPageToken,omitempty"` 385 386 // ResourceDescriptors: A list of resource descriptors. 387 ResourceDescriptors []*MonitoredResourceDescriptor `json:"resourceDescriptors,omitempty"` 388 389 // ServerResponse contains the HTTP response code and headers from the 390 // server. 391 googleapi.ServerResponse `json:"-"` 392 393 // ForceSendFields is a list of field names (e.g. "NextPageToken") to 394 // unconditionally include in API requests. By default, fields with 395 // empty values are omitted from API requests. However, any non-pointer, 396 // non-interface field appearing in ForceSendFields will be sent to the 397 // server regardless of whether the field is empty or not. This may be 398 // used to include empty fields in Patch requests. 399 ForceSendFields []string `json:"-"` 400 } 401 402 func (s *ListMonitoredResourceDescriptorsResponse) MarshalJSON() ([]byte, error) { 403 type noMethod ListMonitoredResourceDescriptorsResponse 404 raw := noMethod(*s) 405 return gensupport.MarshalJSON(raw, s.ForceSendFields) 406 } 407 408 // ListSinksResponse: Result returned from `ListSinks`. 409 type ListSinksResponse struct { 410 // NextPageToken: If there are more results than were returned, then 411 // `nextPageToken` is given a value in the response. To get the next 412 // batch of results, call this method again using the value of 413 // `nextPageToken` as `pageToken`. 414 NextPageToken string `json:"nextPageToken,omitempty"` 415 416 // Sinks: A list of sinks. 417 Sinks []*LogSink `json:"sinks,omitempty"` 418 419 // ServerResponse contains the HTTP response code and headers from the 420 // server. 421 googleapi.ServerResponse `json:"-"` 422 423 // ForceSendFields is a list of field names (e.g. "NextPageToken") to 424 // unconditionally include in API requests. By default, fields with 425 // empty values are omitted from API requests. However, any non-pointer, 426 // non-interface field appearing in ForceSendFields will be sent to the 427 // server regardless of whether the field is empty or not. This may be 428 // used to include empty fields in Patch requests. 429 ForceSendFields []string `json:"-"` 430 } 431 432 func (s *ListSinksResponse) MarshalJSON() ([]byte, error) { 433 type noMethod ListSinksResponse 434 raw := noMethod(*s) 435 return gensupport.MarshalJSON(raw, s.ForceSendFields) 436 } 437 438 // LogEntry: An individual entry in a log. 439 type LogEntry struct { 440 // HttpRequest: Optional. Information about the HTTP request associated 441 // with this log entry, if applicable. 442 HttpRequest *HttpRequest `json:"httpRequest,omitempty"` 443 444 // InsertId: Optional. A unique ID for the log entry. If you provide 445 // this field, the logging service considers other log entries in the 446 // same log with the same ID as duplicates which can be removed. If 447 // omitted, Cloud Logging will generate a unique ID for this log entry. 448 InsertId string `json:"insertId,omitempty"` 449 450 // JsonPayload: The log entry payload, represented as a structure that 451 // is expressed as a JSON object. 452 JsonPayload LogEntryJsonPayload `json:"jsonPayload,omitempty"` 453 454 // Labels: Optional. A set of user-defined (key, value) data that 455 // provides additional information about the log entry. 456 Labels map[string]string `json:"labels,omitempty"` 457 458 // LogName: Required. The resource name of the log to which this log 459 // entry belongs. The format of the name is 460 // `projects/<project-id>/logs/<log-id%gt;`. Examples: 461 // "projects/my-projectid/logs/syslog", 462 // "projects/1234567890/logs/library.googleapis.com%2Fbook_log". The 463 // log ID part of resource name must be less than 512 characters long 464 // and can only include the following characters: upper and lower case 465 // alphanumeric characters: [A-Za-z0-9]; and punctuation characters: 466 // forward-slash, underscore, hyphen, and period. Forward-slash (`/`) 467 // characters in the log ID must be URL-encoded. 468 LogName string `json:"logName,omitempty"` 469 470 // Operation: Optional. Information about an operation associated with 471 // the log entry, if applicable. 472 Operation *LogEntryOperation `json:"operation,omitempty"` 473 474 // ProtoPayload: The log entry payload, represented as a protocol 475 // buffer. You can only use `protoPayload` values that belong to a set 476 // of approved types. 477 ProtoPayload LogEntryProtoPayload `json:"protoPayload,omitempty"` 478 479 // Resource: Required. The monitored resource associated with this log 480 // entry. Example: a log entry that reports a database error would be 481 // associated with the monitored resource designating the particular 482 // database that reported the error. 483 Resource *MonitoredResource `json:"resource,omitempty"` 484 485 // Severity: Optional. The severity of the log entry. The default value 486 // is `LogSeverity.DEFAULT`. 487 // 488 // Possible values: 489 // "DEFAULT" 490 // "DEBUG" 491 // "INFO" 492 // "NOTICE" 493 // "WARNING" 494 // "ERROR" 495 // "CRITICAL" 496 // "ALERT" 497 // "EMERGENCY" 498 Severity string `json:"severity,omitempty"` 499 500 // TextPayload: The log entry payload, represented as a Unicode string 501 // (UTF-8). 502 TextPayload string `json:"textPayload,omitempty"` 503 504 // Timestamp: Optional. The time the event described by the log entry 505 // occurred. If omitted, Cloud Logging will use the time the log entry 506 // is written. 507 Timestamp string `json:"timestamp,omitempty"` 508 509 // ForceSendFields is a list of field names (e.g. "HttpRequest") to 510 // unconditionally include in API requests. By default, fields with 511 // empty values are omitted from API requests. However, any non-pointer, 512 // non-interface field appearing in ForceSendFields will be sent to the 513 // server regardless of whether the field is empty or not. This may be 514 // used to include empty fields in Patch requests. 515 ForceSendFields []string `json:"-"` 516 } 517 518 func (s *LogEntry) MarshalJSON() ([]byte, error) { 519 type noMethod LogEntry 520 raw := noMethod(*s) 521 return gensupport.MarshalJSON(raw, s.ForceSendFields) 522 } 523 524 type LogEntryJsonPayload interface{} 525 526 type LogEntryProtoPayload interface{} 527 528 // LogEntryOperation: Additional information about a potentially 529 // long-running operation with which a log entry is associated. 530 type LogEntryOperation struct { 531 // First: Optional. Set this to True if this is the first log entry in 532 // the operation. 533 First bool `json:"first,omitempty"` 534 535 // Id: Required. An arbitrary operation identifier. Log entries with the 536 // same identifier are assumed to be part of the same operation. 537 Id string `json:"id,omitempty"` 538 539 // Last: Optional. Set this to True if this is the last log entry in the 540 // operation. 541 Last bool `json:"last,omitempty"` 542 543 // Producer: Required. A arbitrary producer identifier. The combination 544 // of `id` and `producer` must be globally unique. Examples for 545 // `producer`: "MyDivision.MyBigCompany.com", 546 // "github.com/MyProject/MyApplication". 547 Producer string `json:"producer,omitempty"` 548 549 // ForceSendFields is a list of field names (e.g. "First") to 550 // unconditionally include in API requests. By default, fields with 551 // empty values are omitted from API requests. However, any non-pointer, 552 // non-interface field appearing in ForceSendFields will be sent to the 553 // server regardless of whether the field is empty or not. This may be 554 // used to include empty fields in Patch requests. 555 ForceSendFields []string `json:"-"` 556 } 557 558 func (s *LogEntryOperation) MarshalJSON() ([]byte, error) { 559 type noMethod LogEntryOperation 560 raw := noMethod(*s) 561 return gensupport.MarshalJSON(raw, s.ForceSendFields) 562 } 563 564 // LogLine: Application log line emitted while processing a request. 565 type LogLine struct { 566 // LogMessage: App provided log message. 567 LogMessage string `json:"logMessage,omitempty"` 568 569 // Severity: Severity of log. 570 // 571 // Possible values: 572 // "DEFAULT" 573 // "DEBUG" 574 // "INFO" 575 // "NOTICE" 576 // "WARNING" 577 // "ERROR" 578 // "CRITICAL" 579 // "ALERT" 580 // "EMERGENCY" 581 Severity string `json:"severity,omitempty"` 582 583 // SourceLocation: Line of code that generated this log message. 584 SourceLocation *SourceLocation `json:"sourceLocation,omitempty"` 585 586 // Time: Time when log entry was made. May be inaccurate. 587 Time string `json:"time,omitempty"` 588 589 // ForceSendFields is a list of field names (e.g. "LogMessage") to 590 // unconditionally include in API requests. By default, fields with 591 // empty values are omitted from API requests. However, any non-pointer, 592 // non-interface field appearing in ForceSendFields will be sent to the 593 // server regardless of whether the field is empty or not. This may be 594 // used to include empty fields in Patch requests. 595 ForceSendFields []string `json:"-"` 596 } 597 598 func (s *LogLine) MarshalJSON() ([]byte, error) { 599 type noMethod LogLine 600 raw := noMethod(*s) 601 return gensupport.MarshalJSON(raw, s.ForceSendFields) 602 } 603 604 // LogMetric: Describes a logs-based metric. The value of the metric is 605 // the number of log entries that match a logs filter. 606 type LogMetric struct { 607 // Description: A description of this metric, which is used in 608 // documentation. 609 Description string `json:"description,omitempty"` 610 611 // Filter: An [advanced logs 612 // filter](/logging/docs/view/advanced_filters). Example: 613 // "logName:syslog AND severity>=ERROR". 614 Filter string `json:"filter,omitempty"` 615 616 // Name: Required. The client-assigned metric identifier. Example: 617 // "severe_errors". Metric identifiers are limited to 1000 characters 618 // and can include only the following characters: `A-Z`, `a-z`, `0-9`, 619 // and the special characters `_-.,+!*',()%/\`. The forward-slash 620 // character (`/`) denotes a hierarchy of name pieces, and it cannot be 621 // the first character of the name. 622 Name string `json:"name,omitempty"` 623 624 // ServerResponse contains the HTTP response code and headers from the 625 // server. 626 googleapi.ServerResponse `json:"-"` 627 628 // ForceSendFields is a list of field names (e.g. "Description") to 629 // unconditionally include in API requests. By default, fields with 630 // empty values are omitted from API requests. However, any non-pointer, 631 // non-interface field appearing in ForceSendFields will be sent to the 632 // server regardless of whether the field is empty or not. This may be 633 // used to include empty fields in Patch requests. 634 ForceSendFields []string `json:"-"` 635 } 636 637 func (s *LogMetric) MarshalJSON() ([]byte, error) { 638 type noMethod LogMetric 639 raw := noMethod(*s) 640 return gensupport.MarshalJSON(raw, s.ForceSendFields) 641 } 642 643 // LogSink: Describes a sink used to export log entries outside Cloud 644 // Logging. 645 type LogSink struct { 646 // Destination: The export destination. See [Exporting Logs With 647 // Sinks](/logging/docs/api/tasks/exporting-logs). Examples: 648 // "storage.googleapis.com/a-bucket", 649 // "bigquery.googleapis.com/projects/a-project-id/datasets/a-dataset". 650 Destination string `json:"destination,omitempty"` 651 652 // Filter: An [advanced logs 653 // filter](/logging/docs/view/advanced_filters) that defines the log 654 // entries to be exported. The filter must be consistent with the log 655 // entry format designed by the `outputVersionFormat` parameter, 656 // regardless of the format of the log entry that was originally written 657 // to Cloud Logging. Example: "logName:syslog AND severity>=ERROR". 658 Filter string `json:"filter,omitempty"` 659 660 // Name: Required. The client-assigned sink identifier. Example: 661 // "my-severe-errors-to-pubsub". Sink identifiers are limited to 1000 662 // characters and can include only the following characters: `A-Z`, 663 // `a-z`, `0-9`, and the special characters `_-.`. 664 Name string `json:"name,omitempty"` 665 666 // OutputVersionFormat: The log entry version used when exporting log 667 // entries from this sink. This version does not have to correspond to 668 // the version of the log entry when it was written to Cloud Logging. 669 // 670 // Possible values: 671 // "VERSION_FORMAT_UNSPECIFIED" 672 // "V2" 673 // "V1" 674 OutputVersionFormat string `json:"outputVersionFormat,omitempty"` 675 676 // ServerResponse contains the HTTP response code and headers from the 677 // server. 678 googleapi.ServerResponse `json:"-"` 679 680 // ForceSendFields is a list of field names (e.g. "Destination") to 681 // unconditionally include in API requests. By default, fields with 682 // empty values are omitted from API requests. However, any non-pointer, 683 // non-interface field appearing in ForceSendFields will be sent to the 684 // server regardless of whether the field is empty or not. This may be 685 // used to include empty fields in Patch requests. 686 ForceSendFields []string `json:"-"` 687 } 688 689 func (s *LogSink) MarshalJSON() ([]byte, error) { 690 type noMethod LogSink 691 raw := noMethod(*s) 692 return gensupport.MarshalJSON(raw, s.ForceSendFields) 693 } 694 695 // MonitoredResource: A specific monitored resource or a group of 696 // monitored resources. 697 type MonitoredResource struct { 698 // Labels: Values for some or all of the labels listed in the associated 699 // monitored resource descriptor. For example, specify a specific Cloud 700 // SQL database by supplying values for both the "database_id" and 701 // "zone" labels. Specify the set of all Cloud SQL databases in a 702 // particular location by supplying a value for only the "zone" label. 703 Labels map[string]string `json:"labels,omitempty"` 704 705 // Type: The type of monitored resource. This field must match the value 706 // of the `type` field in a MonitoredResourceDescriptor object. For 707 // example, "cloudsql_database" represents Cloud SQL databases. 708 Type string `json:"type,omitempty"` 709 710 // ForceSendFields is a list of field names (e.g. "Labels") to 711 // unconditionally include in API requests. By default, fields with 712 // empty values are omitted from API requests. However, any non-pointer, 713 // non-interface field appearing in ForceSendFields will be sent to the 714 // server regardless of whether the field is empty or not. This may be 715 // used to include empty fields in Patch requests. 716 ForceSendFields []string `json:"-"` 717 } 718 719 func (s *MonitoredResource) MarshalJSON() ([]byte, error) { 720 type noMethod MonitoredResource 721 raw := noMethod(*s) 722 return gensupport.MarshalJSON(raw, s.ForceSendFields) 723 } 724 725 // MonitoredResourceDescriptor: A description of a type of monitored 726 // resource. 727 type MonitoredResourceDescriptor struct { 728 // Description: A detailed description of the monitored resource type, 729 // which is used in documentation. 730 Description string `json:"description,omitempty"` 731 732 // DisplayName: A concise name for the monitored resource type, which is 733 // displayed in user interfaces. For example, "Cloud SQL Database". 734 DisplayName string `json:"displayName,omitempty"` 735 736 // Labels: A set of labels that can be used to describe instances of 737 // this monitored resource type. For example, Cloud SQL databases can be 738 // labeled with their "database_id" and their "zone". 739 Labels []*LabelDescriptor `json:"labels,omitempty"` 740 741 // Type: The monitored resource type. For example, the type 742 // "cloudsql_database" represents databases in Google Cloud SQL. 743 Type string `json:"type,omitempty"` 744 745 // ForceSendFields is a list of field names (e.g. "Description") to 746 // unconditionally include in API requests. By default, fields with 747 // empty values are omitted from API requests. However, any non-pointer, 748 // non-interface field appearing in ForceSendFields will be sent to the 749 // server regardless of whether the field is empty or not. This may be 750 // used to include empty fields in Patch requests. 751 ForceSendFields []string `json:"-"` 752 } 753 754 func (s *MonitoredResourceDescriptor) MarshalJSON() ([]byte, error) { 755 type noMethod MonitoredResourceDescriptor 756 raw := noMethod(*s) 757 return gensupport.MarshalJSON(raw, s.ForceSendFields) 758 } 759 760 // RequestLog: Complete log information about a single request to an 761 // application. 762 type RequestLog struct { 763 // AppEngineRelease: App Engine release version string. 764 AppEngineRelease string `json:"appEngineRelease,omitempty"` 765 766 // AppId: Identifies the application that handled this request. 767 AppId string `json:"appId,omitempty"` 768 769 // Cost: An indication of the relative cost of serving this request. 770 Cost float64 `json:"cost,omitempty"` 771 772 // EndTime: Time at which request was known to end processing. 773 EndTime string `json:"endTime,omitempty"` 774 775 // Finished: If true, represents a finished request. Otherwise, the 776 // request is active. 777 Finished bool `json:"finished,omitempty"` 778 779 // Host: The Internet host and port number of the resource being 780 // requested. 781 Host string `json:"host,omitempty"` 782 783 // HttpVersion: HTTP version of request. 784 HttpVersion string `json:"httpVersion,omitempty"` 785 786 // InstanceId: An opaque identifier for the instance that handled the 787 // request. 788 InstanceId string `json:"instanceId,omitempty"` 789 790 // InstanceIndex: If the instance that processed this request was 791 // individually addressable (i.e. belongs to a manually scaled module), 792 // this is the 0 based index of the instance, otherwise this value is 793 // -1. 794 InstanceIndex int64 `json:"instanceIndex,omitempty"` 795 796 // Ip: Origin IP address. 797 Ip string `json:"ip,omitempty"` 798 799 // Latency: Latency of the request. 800 Latency string `json:"latency,omitempty"` 801 802 // Line: List of log lines emitted by the application while serving this 803 // request, if requested. 804 Line []*LogLine `json:"line,omitempty"` 805 806 // MegaCycles: Number of CPU megacycles used to process request. 807 MegaCycles int64 `json:"megaCycles,omitempty,string"` 808 809 // Method: Request method, such as `GET`, `HEAD`, `PUT`, `POST`, or 810 // `DELETE`. 811 Method string `json:"method,omitempty"` 812 813 // ModuleId: Identifies the module of the application that handled this 814 // request. 815 ModuleId string `json:"moduleId,omitempty"` 816 817 // Nickname: A string that identifies a logged-in user who made this 818 // request, or empty if the user is not logged in. Most likely, this is 819 // the part of the user's email before the '@' sign. The field value is 820 // the same for different requests from the same user, but different 821 // users may have a similar name. This information is also available to 822 // the application via Users API. This field will be populated starting 823 // with App Engine 1.9.21. 824 Nickname string `json:"nickname,omitempty"` 825 826 // PendingTime: Time this request spent in the pending request queue, if 827 // it was pending at all. 828 PendingTime string `json:"pendingTime,omitempty"` 829 830 // Referrer: Referrer URL of request. 831 Referrer string `json:"referrer,omitempty"` 832 833 // RequestId: Globally unique identifier for a request, based on request 834 // start time. Request IDs for requests which started later will compare 835 // greater as strings than those for requests which started earlier. 836 RequestId string `json:"requestId,omitempty"` 837 838 // Resource: Contains the path and query portion of the URL that was 839 // requested. For example, if the URL was 840 // "http://example.com/app?name=val", the resource would be 841 // "/app?name=val". Any trailing fragment (separated by a '#' character) 842 // will not be included. 843 Resource string `json:"resource,omitempty"` 844 845 // ResponseSize: Size in bytes sent back to client by request. 846 ResponseSize int64 `json:"responseSize,omitempty,string"` 847 848 // SourceReference: Source code for the application that handled this 849 // request. There can be more than one source reference per deployed 850 // application if source code is distributed among multiple 851 // repositories. 852 SourceReference []*SourceReference `json:"sourceReference,omitempty"` 853 854 // StartTime: Time at which request was known to have begun processing. 855 StartTime string `json:"startTime,omitempty"` 856 857 // Status: Response status of request. 858 Status int64 `json:"status,omitempty"` 859 860 // TaskName: Task name of the request (for an offline request). 861 TaskName string `json:"taskName,omitempty"` 862 863 // TaskQueueName: Queue name of the request (for an offline request). 864 TaskQueueName string `json:"taskQueueName,omitempty"` 865 866 // TraceId: Cloud Trace identifier of the trace for this request. 867 TraceId string `json:"traceId,omitempty"` 868 869 // UrlMapEntry: File or class within URL mapping used for request. 870 // Useful for tracking down the source code which was responsible for 871 // managing request. Especially for multiply mapped handlers. 872 UrlMapEntry string `json:"urlMapEntry,omitempty"` 873 874 // UserAgent: User agent used for making request. 875 UserAgent string `json:"userAgent,omitempty"` 876 877 // VersionId: Version of the application that handled this request. 878 VersionId string `json:"versionId,omitempty"` 879 880 // WasLoadingRequest: Was this request a loading request for this 881 // instance? 882 WasLoadingRequest bool `json:"wasLoadingRequest,omitempty"` 883 884 // ForceSendFields is a list of field names (e.g. "AppEngineRelease") to 885 // unconditionally include in API requests. By default, fields with 886 // empty values are omitted from API requests. However, any non-pointer, 887 // non-interface field appearing in ForceSendFields will be sent to the 888 // server regardless of whether the field is empty or not. This may be 889 // used to include empty fields in Patch requests. 890 ForceSendFields []string `json:"-"` 891 } 892 893 func (s *RequestLog) MarshalJSON() ([]byte, error) { 894 type noMethod RequestLog 895 raw := noMethod(*s) 896 return gensupport.MarshalJSON(raw, s.ForceSendFields) 897 } 898 899 // SourceLocation: Specifies a location in a source file. 900 type SourceLocation struct { 901 // File: Source file name. May or may not be a fully qualified name, 902 // depending on the runtime environment. 903 File string `json:"file,omitempty"` 904 905 // FunctionName: Human-readable name of the function or method being 906 // invoked, with optional context such as the class or package name, for 907 // use in contexts such as the logs viewer where file:line number is 908 // less meaningful. This may vary by language, for example: in Java: 909 // qual.if.ied.Class.method in Go: dir/package.func in Python: function 910 // ... 911 FunctionName string `json:"functionName,omitempty"` 912 913 // Line: Line within the source file. 914 Line int64 `json:"line,omitempty,string"` 915 916 // ForceSendFields is a list of field names (e.g. "File") to 917 // unconditionally include in API requests. By default, fields with 918 // empty values are omitted from API requests. However, any non-pointer, 919 // non-interface field appearing in ForceSendFields will be sent to the 920 // server regardless of whether the field is empty or not. This may be 921 // used to include empty fields in Patch requests. 922 ForceSendFields []string `json:"-"` 923 } 924 925 func (s *SourceLocation) MarshalJSON() ([]byte, error) { 926 type noMethod SourceLocation 927 raw := noMethod(*s) 928 return gensupport.MarshalJSON(raw, s.ForceSendFields) 929 } 930 931 // SourceReference: A reference to a particular snapshot of the source 932 // tree used to build and deploy an application. 933 type SourceReference struct { 934 // Repository: Optional. A URI string identifying the repository. 935 // Example: "https://github.com/GoogleCloudPlatform/kubernetes.git" 936 Repository string `json:"repository,omitempty"` 937 938 // RevisionId: The canonical (and persistent) identifier of the deployed 939 // revision. Example (git): "0035781c50ec7aa23385dc841529ce8a4b70db1b" 940 RevisionId string `json:"revisionId,omitempty"` 941 942 // ForceSendFields is a list of field names (e.g. "Repository") to 943 // unconditionally include in API requests. By default, fields with 944 // empty values are omitted from API requests. However, any non-pointer, 945 // non-interface field appearing in ForceSendFields will be sent to the 946 // server regardless of whether the field is empty or not. This may be 947 // used to include empty fields in Patch requests. 948 ForceSendFields []string `json:"-"` 949 } 950 951 func (s *SourceReference) MarshalJSON() ([]byte, error) { 952 type noMethod SourceReference 953 raw := noMethod(*s) 954 return gensupport.MarshalJSON(raw, s.ForceSendFields) 955 } 956 957 // WriteLogEntriesRequest: The parameters to WriteLogEntries. 958 type WriteLogEntriesRequest struct { 959 // Entries: Required. The log entries to write. The log entries must 960 // have values for all required fields. 961 Entries []*LogEntry `json:"entries,omitempty"` 962 963 // Labels: Optional. User-defined `key:value` items that are added to 964 // the `labels` field of each log entry in `entries`, except when a log 965 // entry specifies its own 'key:value' item with the same key. Example: 966 // `{ "size": "large", "color":"red" }` 967 Labels map[string]string `json:"labels,omitempty"` 968 969 // LogName: Optional. A default log resource name for those log entries 970 // in `entries` that do not specify their own `logName`. Example: 971 // "projects/my-project/logs/syslog". See LogEntry. 972 LogName string `json:"logName,omitempty"` 973 974 // Resource: Optional. A default monitored resource for those log 975 // entries in `entries` that do not specify their own `resource`. 976 Resource *MonitoredResource `json:"resource,omitempty"` 977 978 // ForceSendFields is a list of field names (e.g. "Entries") to 979 // unconditionally include in API requests. By default, fields with 980 // empty values are omitted from API requests. However, any non-pointer, 981 // non-interface field appearing in ForceSendFields will be sent to the 982 // server regardless of whether the field is empty or not. This may be 983 // used to include empty fields in Patch requests. 984 ForceSendFields []string `json:"-"` 985 } 986 987 func (s *WriteLogEntriesRequest) MarshalJSON() ([]byte, error) { 988 type noMethod WriteLogEntriesRequest 989 raw := noMethod(*s) 990 return gensupport.MarshalJSON(raw, s.ForceSendFields) 991 } 992 993 // WriteLogEntriesResponse: Result returned from WriteLogEntries. empty 994 type WriteLogEntriesResponse struct { 995 // ServerResponse contains the HTTP response code and headers from the 996 // server. 997 googleapi.ServerResponse `json:"-"` 998 } 999 1000 // method id "logging.entries.list": 1001 1002 type EntriesListCall struct { 1003 s *Service 1004 listlogentriesrequest *ListLogEntriesRequest 1005 urlParams_ gensupport.URLParams 1006 ctx_ context.Context 1007 } 1008 1009 // List: Lists log entries. Use this method to examine log entries from 1010 // Cloud Logging. See [Exporting Logs](/logging/docs/export) for other 1011 // ways to copy log entries out of Cloud Logging. 1012 func (r *EntriesService) List(listlogentriesrequest *ListLogEntriesRequest) *EntriesListCall { 1013 c := &EntriesListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1014 c.listlogentriesrequest = listlogentriesrequest 1015 return c 1016 } 1017 1018 // QuotaUser sets the optional parameter "quotaUser": Available to use 1019 // for quota purposes for server-side applications. Can be any arbitrary 1020 // string assigned to a user, but should not exceed 40 characters. 1021 func (c *EntriesListCall) QuotaUser(quotaUser string) *EntriesListCall { 1022 c.urlParams_.Set("quotaUser", quotaUser) 1023 return c 1024 } 1025 1026 // Fields allows partial responses to be retrieved. See 1027 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1028 // for more information. 1029 func (c *EntriesListCall) Fields(s ...googleapi.Field) *EntriesListCall { 1030 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1031 return c 1032 } 1033 1034 // Context sets the context to be used in this call's Do method. Any 1035 // pending HTTP request will be aborted if the provided context is 1036 // canceled. 1037 func (c *EntriesListCall) Context(ctx context.Context) *EntriesListCall { 1038 c.ctx_ = ctx 1039 return c 1040 } 1041 1042 func (c *EntriesListCall) doRequest(alt string) (*http.Response, error) { 1043 var body io.Reader = nil 1044 body, err := googleapi.WithoutDataWrapper.JSONReader(c.listlogentriesrequest) 1045 if err != nil { 1046 return nil, err 1047 } 1048 ctype := "application/json" 1049 c.urlParams_.Set("alt", alt) 1050 urls := googleapi.ResolveRelative(c.s.BasePath, "v2beta1/entries:list") 1051 urls += "?" + c.urlParams_.Encode() 1052 req, _ := http.NewRequest("POST", urls, body) 1053 googleapi.SetOpaque(req.URL) 1054 req.Header.Set("Content-Type", ctype) 1055 req.Header.Set("User-Agent", c.s.userAgent()) 1056 if c.ctx_ != nil { 1057 return ctxhttp.Do(c.ctx_, c.s.client, req) 1058 } 1059 return c.s.client.Do(req) 1060 } 1061 1062 // Do executes the "logging.entries.list" call. 1063 // Exactly one of *ListLogEntriesResponse or error will be non-nil. Any 1064 // non-2xx status code is an error. Response headers are in either 1065 // *ListLogEntriesResponse.ServerResponse.Header or (if a response was 1066 // returned at all) in error.(*googleapi.Error).Header. Use 1067 // googleapi.IsNotModified to check whether the returned error was 1068 // because http.StatusNotModified was returned. 1069 func (c *EntriesListCall) Do() (*ListLogEntriesResponse, error) { 1070 res, err := c.doRequest("json") 1071 if res != nil && res.StatusCode == http.StatusNotModified { 1072 if res.Body != nil { 1073 res.Body.Close() 1074 } 1075 return nil, &googleapi.Error{ 1076 Code: res.StatusCode, 1077 Header: res.Header, 1078 } 1079 } 1080 if err != nil { 1081 return nil, err 1082 } 1083 defer googleapi.CloseBody(res) 1084 if err := googleapi.CheckResponse(res); err != nil { 1085 return nil, err 1086 } 1087 ret := &ListLogEntriesResponse{ 1088 ServerResponse: googleapi.ServerResponse{ 1089 Header: res.Header, 1090 HTTPStatusCode: res.StatusCode, 1091 }, 1092 } 1093 if err := json.NewDecoder(res.Body).Decode(&ret); err != nil { 1094 return nil, err 1095 } 1096 return ret, nil 1097 // { 1098 // "description": "Lists log entries. Use this method to examine log entries from Cloud Logging. See [Exporting Logs](/logging/docs/export) for other ways to copy log entries out of Cloud Logging.", 1099 // "httpMethod": "POST", 1100 // "id": "logging.entries.list", 1101 // "path": "v2beta1/entries:list", 1102 // "request": { 1103 // "$ref": "ListLogEntriesRequest" 1104 // }, 1105 // "response": { 1106 // "$ref": "ListLogEntriesResponse" 1107 // }, 1108 // "scopes": [ 1109 // "https://www.googleapis.com/auth/cloud-platform", 1110 // "https://www.googleapis.com/auth/cloud-platform.read-only", 1111 // "https://www.googleapis.com/auth/logging.admin", 1112 // "https://www.googleapis.com/auth/logging.read" 1113 // ] 1114 // } 1115 1116 } 1117 1118 // method id "logging.entries.write": 1119 1120 type EntriesWriteCall struct { 1121 s *Service 1122 writelogentriesrequest *WriteLogEntriesRequest 1123 urlParams_ gensupport.URLParams 1124 ctx_ context.Context 1125 } 1126 1127 // Write: Writes log entries to Cloud Logging. All log entries in Cloud 1128 // Logging are written by this method. 1129 func (r *EntriesService) Write(writelogentriesrequest *WriteLogEntriesRequest) *EntriesWriteCall { 1130 c := &EntriesWriteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1131 c.writelogentriesrequest = writelogentriesrequest 1132 return c 1133 } 1134 1135 // QuotaUser sets the optional parameter "quotaUser": Available to use 1136 // for quota purposes for server-side applications. Can be any arbitrary 1137 // string assigned to a user, but should not exceed 40 characters. 1138 func (c *EntriesWriteCall) QuotaUser(quotaUser string) *EntriesWriteCall { 1139 c.urlParams_.Set("quotaUser", quotaUser) 1140 return c 1141 } 1142 1143 // Fields allows partial responses to be retrieved. See 1144 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1145 // for more information. 1146 func (c *EntriesWriteCall) Fields(s ...googleapi.Field) *EntriesWriteCall { 1147 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1148 return c 1149 } 1150 1151 // Context sets the context to be used in this call's Do method. Any 1152 // pending HTTP request will be aborted if the provided context is 1153 // canceled. 1154 func (c *EntriesWriteCall) Context(ctx context.Context) *EntriesWriteCall { 1155 c.ctx_ = ctx 1156 return c 1157 } 1158 1159 func (c *EntriesWriteCall) doRequest(alt string) (*http.Response, error) { 1160 var body io.Reader = nil 1161 body, err := googleapi.WithoutDataWrapper.JSONReader(c.writelogentriesrequest) 1162 if err != nil { 1163 return nil, err 1164 } 1165 ctype := "application/json" 1166 c.urlParams_.Set("alt", alt) 1167 urls := googleapi.ResolveRelative(c.s.BasePath, "v2beta1/entries:write") 1168 urls += "?" + c.urlParams_.Encode() 1169 req, _ := http.NewRequest("POST", urls, body) 1170 googleapi.SetOpaque(req.URL) 1171 req.Header.Set("Content-Type", ctype) 1172 req.Header.Set("User-Agent", c.s.userAgent()) 1173 if c.ctx_ != nil { 1174 return ctxhttp.Do(c.ctx_, c.s.client, req) 1175 } 1176 return c.s.client.Do(req) 1177 } 1178 1179 // Do executes the "logging.entries.write" call. 1180 // Exactly one of *WriteLogEntriesResponse or error will be non-nil. Any 1181 // non-2xx status code is an error. Response headers are in either 1182 // *WriteLogEntriesResponse.ServerResponse.Header or (if a response was 1183 // returned at all) in error.(*googleapi.Error).Header. Use 1184 // googleapi.IsNotModified to check whether the returned error was 1185 // because http.StatusNotModified was returned. 1186 func (c *EntriesWriteCall) Do() (*WriteLogEntriesResponse, error) { 1187 res, err := c.doRequest("json") 1188 if res != nil && res.StatusCode == http.StatusNotModified { 1189 if res.Body != nil { 1190 res.Body.Close() 1191 } 1192 return nil, &googleapi.Error{ 1193 Code: res.StatusCode, 1194 Header: res.Header, 1195 } 1196 } 1197 if err != nil { 1198 return nil, err 1199 } 1200 defer googleapi.CloseBody(res) 1201 if err := googleapi.CheckResponse(res); err != nil { 1202 return nil, err 1203 } 1204 ret := &WriteLogEntriesResponse{ 1205 ServerResponse: googleapi.ServerResponse{ 1206 Header: res.Header, 1207 HTTPStatusCode: res.StatusCode, 1208 }, 1209 } 1210 if err := json.NewDecoder(res.Body).Decode(&ret); err != nil { 1211 return nil, err 1212 } 1213 return ret, nil 1214 // { 1215 // "description": "Writes log entries to Cloud Logging. All log entries in Cloud Logging are written by this method.", 1216 // "httpMethod": "POST", 1217 // "id": "logging.entries.write", 1218 // "path": "v2beta1/entries:write", 1219 // "request": { 1220 // "$ref": "WriteLogEntriesRequest" 1221 // }, 1222 // "response": { 1223 // "$ref": "WriteLogEntriesResponse" 1224 // }, 1225 // "scopes": [ 1226 // "https://www.googleapis.com/auth/cloud-platform", 1227 // "https://www.googleapis.com/auth/logging.admin", 1228 // "https://www.googleapis.com/auth/logging.write" 1229 // ] 1230 // } 1231 1232 } 1233 1234 // method id "logging.monitoredResourceDescriptors.list": 1235 1236 type MonitoredResourceDescriptorsListCall struct { 1237 s *Service 1238 urlParams_ gensupport.URLParams 1239 ifNoneMatch_ string 1240 ctx_ context.Context 1241 } 1242 1243 // List: Lists monitored resource descriptors that are used by Cloud 1244 // Logging. 1245 func (r *MonitoredResourceDescriptorsService) List() *MonitoredResourceDescriptorsListCall { 1246 c := &MonitoredResourceDescriptorsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1247 return c 1248 } 1249 1250 // PageSize sets the optional parameter "pageSize": The maximum number 1251 // of results to return from this request. Fewer results might be 1252 // returned. You must check for the 'nextPageToken` result to determine 1253 // if additional results are available, which you can retrieve by 1254 // passing the `nextPageToken` value in the `pageToken` parameter to the 1255 // next request. 1256 func (c *MonitoredResourceDescriptorsListCall) PageSize(pageSize int64) *MonitoredResourceDescriptorsListCall { 1257 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 1258 return c 1259 } 1260 1261 // PageToken sets the optional parameter "pageToken": If the `pageToken` 1262 // request parameter is supplied, then the next page of results in the 1263 // set are retrieved. The `pageToken` parameter must be set with the 1264 // value of the `nextPageToken` result parameter from the previous 1265 // request. 1266 func (c *MonitoredResourceDescriptorsListCall) PageToken(pageToken string) *MonitoredResourceDescriptorsListCall { 1267 c.urlParams_.Set("pageToken", pageToken) 1268 return c 1269 } 1270 1271 // QuotaUser sets the optional parameter "quotaUser": Available to use 1272 // for quota purposes for server-side applications. Can be any arbitrary 1273 // string assigned to a user, but should not exceed 40 characters. 1274 func (c *MonitoredResourceDescriptorsListCall) QuotaUser(quotaUser string) *MonitoredResourceDescriptorsListCall { 1275 c.urlParams_.Set("quotaUser", quotaUser) 1276 return c 1277 } 1278 1279 // Fields allows partial responses to be retrieved. See 1280 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1281 // for more information. 1282 func (c *MonitoredResourceDescriptorsListCall) Fields(s ...googleapi.Field) *MonitoredResourceDescriptorsListCall { 1283 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1284 return c 1285 } 1286 1287 // IfNoneMatch sets the optional parameter which makes the operation 1288 // fail if the object's ETag matches the given value. This is useful for 1289 // getting updates only after the object has changed since the last 1290 // request. Use googleapi.IsNotModified to check whether the response 1291 // error from Do is the result of In-None-Match. 1292 func (c *MonitoredResourceDescriptorsListCall) IfNoneMatch(entityTag string) *MonitoredResourceDescriptorsListCall { 1293 c.ifNoneMatch_ = entityTag 1294 return c 1295 } 1296 1297 // Context sets the context to be used in this call's Do method. Any 1298 // pending HTTP request will be aborted if the provided context is 1299 // canceled. 1300 func (c *MonitoredResourceDescriptorsListCall) Context(ctx context.Context) *MonitoredResourceDescriptorsListCall { 1301 c.ctx_ = ctx 1302 return c 1303 } 1304 1305 func (c *MonitoredResourceDescriptorsListCall) doRequest(alt string) (*http.Response, error) { 1306 var body io.Reader = nil 1307 c.urlParams_.Set("alt", alt) 1308 urls := googleapi.ResolveRelative(c.s.BasePath, "v2beta1/monitoredResourceDescriptors") 1309 urls += "?" + c.urlParams_.Encode() 1310 req, _ := http.NewRequest("GET", urls, body) 1311 googleapi.SetOpaque(req.URL) 1312 req.Header.Set("User-Agent", c.s.userAgent()) 1313 if c.ifNoneMatch_ != "" { 1314 req.Header.Set("If-None-Match", c.ifNoneMatch_) 1315 } 1316 if c.ctx_ != nil { 1317 return ctxhttp.Do(c.ctx_, c.s.client, req) 1318 } 1319 return c.s.client.Do(req) 1320 } 1321 1322 // Do executes the "logging.monitoredResourceDescriptors.list" call. 1323 // Exactly one of *ListMonitoredResourceDescriptorsResponse or error 1324 // will be non-nil. Any non-2xx status code is an error. Response 1325 // headers are in either 1326 // *ListMonitoredResourceDescriptorsResponse.ServerResponse.Header or 1327 // (if a response was returned at all) in 1328 // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check 1329 // whether the returned error was because http.StatusNotModified was 1330 // returned. 1331 func (c *MonitoredResourceDescriptorsListCall) Do() (*ListMonitoredResourceDescriptorsResponse, error) { 1332 res, err := c.doRequest("json") 1333 if res != nil && res.StatusCode == http.StatusNotModified { 1334 if res.Body != nil { 1335 res.Body.Close() 1336 } 1337 return nil, &googleapi.Error{ 1338 Code: res.StatusCode, 1339 Header: res.Header, 1340 } 1341 } 1342 if err != nil { 1343 return nil, err 1344 } 1345 defer googleapi.CloseBody(res) 1346 if err := googleapi.CheckResponse(res); err != nil { 1347 return nil, err 1348 } 1349 ret := &ListMonitoredResourceDescriptorsResponse{ 1350 ServerResponse: googleapi.ServerResponse{ 1351 Header: res.Header, 1352 HTTPStatusCode: res.StatusCode, 1353 }, 1354 } 1355 if err := json.NewDecoder(res.Body).Decode(&ret); err != nil { 1356 return nil, err 1357 } 1358 return ret, nil 1359 // { 1360 // "description": "Lists monitored resource descriptors that are used by Cloud Logging.", 1361 // "httpMethod": "GET", 1362 // "id": "logging.monitoredResourceDescriptors.list", 1363 // "parameters": { 1364 // "pageSize": { 1365 // "description": "Optional. The maximum number of results to return from this request. Fewer results might be returned. You must check for the 'nextPageToken` result to determine if additional results are available, which you can retrieve by passing the `nextPageToken` value in the `pageToken` parameter to the next request.", 1366 // "format": "int32", 1367 // "location": "query", 1368 // "type": "integer" 1369 // }, 1370 // "pageToken": { 1371 // "description": "Optional. If the `pageToken` request parameter is supplied, then the next page of results in the set are retrieved. The `pageToken` parameter must be set with the value of the `nextPageToken` result parameter from the previous request.", 1372 // "location": "query", 1373 // "type": "string" 1374 // } 1375 // }, 1376 // "path": "v2beta1/monitoredResourceDescriptors", 1377 // "response": { 1378 // "$ref": "ListMonitoredResourceDescriptorsResponse" 1379 // }, 1380 // "scopes": [ 1381 // "https://www.googleapis.com/auth/cloud-platform", 1382 // "https://www.googleapis.com/auth/cloud-platform.read-only", 1383 // "https://www.googleapis.com/auth/logging.admin", 1384 // "https://www.googleapis.com/auth/logging.read" 1385 // ] 1386 // } 1387 1388 } 1389 1390 // method id "logging.projects.logs.delete": 1391 1392 type ProjectsLogsDeleteCall struct { 1393 s *Service 1394 logName string 1395 urlParams_ gensupport.URLParams 1396 ctx_ context.Context 1397 } 1398 1399 // Delete: Deletes a log and all its log entries. The log will reappear 1400 // if it receives new entries. 1401 func (r *ProjectsLogsService) Delete(logName string) *ProjectsLogsDeleteCall { 1402 c := &ProjectsLogsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1403 c.logName = logName 1404 return c 1405 } 1406 1407 // QuotaUser sets the optional parameter "quotaUser": Available to use 1408 // for quota purposes for server-side applications. Can be any arbitrary 1409 // string assigned to a user, but should not exceed 40 characters. 1410 func (c *ProjectsLogsDeleteCall) QuotaUser(quotaUser string) *ProjectsLogsDeleteCall { 1411 c.urlParams_.Set("quotaUser", quotaUser) 1412 return c 1413 } 1414 1415 // Fields allows partial responses to be retrieved. See 1416 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1417 // for more information. 1418 func (c *ProjectsLogsDeleteCall) Fields(s ...googleapi.Field) *ProjectsLogsDeleteCall { 1419 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1420 return c 1421 } 1422 1423 // Context sets the context to be used in this call's Do method. Any 1424 // pending HTTP request will be aborted if the provided context is 1425 // canceled. 1426 func (c *ProjectsLogsDeleteCall) Context(ctx context.Context) *ProjectsLogsDeleteCall { 1427 c.ctx_ = ctx 1428 return c 1429 } 1430 1431 func (c *ProjectsLogsDeleteCall) doRequest(alt string) (*http.Response, error) { 1432 var body io.Reader = nil 1433 c.urlParams_.Set("alt", alt) 1434 urls := googleapi.ResolveRelative(c.s.BasePath, "v2beta1/{+logName}") 1435 urls += "?" + c.urlParams_.Encode() 1436 req, _ := http.NewRequest("DELETE", urls, body) 1437 googleapi.Expand(req.URL, map[string]string{ 1438 "logName": c.logName, 1439 }) 1440 req.Header.Set("User-Agent", c.s.userAgent()) 1441 if c.ctx_ != nil { 1442 return ctxhttp.Do(c.ctx_, c.s.client, req) 1443 } 1444 return c.s.client.Do(req) 1445 } 1446 1447 // Do executes the "logging.projects.logs.delete" call. 1448 // Exactly one of *Empty or error will be non-nil. Any non-2xx status 1449 // code is an error. Response headers are in either 1450 // *Empty.ServerResponse.Header or (if a response was returned at all) 1451 // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 1452 // check whether the returned error was because http.StatusNotModified 1453 // was returned. 1454 func (c *ProjectsLogsDeleteCall) Do() (*Empty, error) { 1455 res, err := c.doRequest("json") 1456 if res != nil && res.StatusCode == http.StatusNotModified { 1457 if res.Body != nil { 1458 res.Body.Close() 1459 } 1460 return nil, &googleapi.Error{ 1461 Code: res.StatusCode, 1462 Header: res.Header, 1463 } 1464 } 1465 if err != nil { 1466 return nil, err 1467 } 1468 defer googleapi.CloseBody(res) 1469 if err := googleapi.CheckResponse(res); err != nil { 1470 return nil, err 1471 } 1472 ret := &Empty{ 1473 ServerResponse: googleapi.ServerResponse{ 1474 Header: res.Header, 1475 HTTPStatusCode: res.StatusCode, 1476 }, 1477 } 1478 if err := json.NewDecoder(res.Body).Decode(&ret); err != nil { 1479 return nil, err 1480 } 1481 return ret, nil 1482 // { 1483 // "description": "Deletes a log and all its log entries. The log will reappear if it receives new entries.", 1484 // "httpMethod": "DELETE", 1485 // "id": "logging.projects.logs.delete", 1486 // "parameterOrder": [ 1487 // "logName" 1488 // ], 1489 // "parameters": { 1490 // "logName": { 1491 // "description": "Required. The resource name of the log to delete. Example: `\"projects/my-project/logs/syslog\"`.", 1492 // "location": "path", 1493 // "pattern": "^projects/[^/]*/logs/[^/]*$", 1494 // "required": true, 1495 // "type": "string" 1496 // } 1497 // }, 1498 // "path": "v2beta1/{+logName}", 1499 // "response": { 1500 // "$ref": "Empty" 1501 // }, 1502 // "scopes": [ 1503 // "https://www.googleapis.com/auth/cloud-platform", 1504 // "https://www.googleapis.com/auth/logging.admin" 1505 // ] 1506 // } 1507 1508 } 1509 1510 // method id "logging.projects.metrics.create": 1511 1512 type ProjectsMetricsCreateCall struct { 1513 s *Service 1514 projectName string 1515 logmetric *LogMetric 1516 urlParams_ gensupport.URLParams 1517 ctx_ context.Context 1518 } 1519 1520 // Create: Creates a logs-based metric. 1521 func (r *ProjectsMetricsService) Create(projectName string, logmetric *LogMetric) *ProjectsMetricsCreateCall { 1522 c := &ProjectsMetricsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1523 c.projectName = projectName 1524 c.logmetric = logmetric 1525 return c 1526 } 1527 1528 // QuotaUser sets the optional parameter "quotaUser": Available to use 1529 // for quota purposes for server-side applications. Can be any arbitrary 1530 // string assigned to a user, but should not exceed 40 characters. 1531 func (c *ProjectsMetricsCreateCall) QuotaUser(quotaUser string) *ProjectsMetricsCreateCall { 1532 c.urlParams_.Set("quotaUser", quotaUser) 1533 return c 1534 } 1535 1536 // Fields allows partial responses to be retrieved. See 1537 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1538 // for more information. 1539 func (c *ProjectsMetricsCreateCall) Fields(s ...googleapi.Field) *ProjectsMetricsCreateCall { 1540 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1541 return c 1542 } 1543 1544 // Context sets the context to be used in this call's Do method. Any 1545 // pending HTTP request will be aborted if the provided context is 1546 // canceled. 1547 func (c *ProjectsMetricsCreateCall) Context(ctx context.Context) *ProjectsMetricsCreateCall { 1548 c.ctx_ = ctx 1549 return c 1550 } 1551 1552 func (c *ProjectsMetricsCreateCall) doRequest(alt string) (*http.Response, error) { 1553 var body io.Reader = nil 1554 body, err := googleapi.WithoutDataWrapper.JSONReader(c.logmetric) 1555 if err != nil { 1556 return nil, err 1557 } 1558 ctype := "application/json" 1559 c.urlParams_.Set("alt", alt) 1560 urls := googleapi.ResolveRelative(c.s.BasePath, "v2beta1/{+projectName}/metrics") 1561 urls += "?" + c.urlParams_.Encode() 1562 req, _ := http.NewRequest("POST", urls, body) 1563 googleapi.Expand(req.URL, map[string]string{ 1564 "projectName": c.projectName, 1565 }) 1566 req.Header.Set("Content-Type", ctype) 1567 req.Header.Set("User-Agent", c.s.userAgent()) 1568 if c.ctx_ != nil { 1569 return ctxhttp.Do(c.ctx_, c.s.client, req) 1570 } 1571 return c.s.client.Do(req) 1572 } 1573 1574 // Do executes the "logging.projects.metrics.create" call. 1575 // Exactly one of *LogMetric or error will be non-nil. Any non-2xx 1576 // status code is an error. Response headers are in either 1577 // *LogMetric.ServerResponse.Header or (if a response was returned at 1578 // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 1579 // to check whether the returned error was because 1580 // http.StatusNotModified was returned. 1581 func (c *ProjectsMetricsCreateCall) Do() (*LogMetric, error) { 1582 res, err := c.doRequest("json") 1583 if res != nil && res.StatusCode == http.StatusNotModified { 1584 if res.Body != nil { 1585 res.Body.Close() 1586 } 1587 return nil, &googleapi.Error{ 1588 Code: res.StatusCode, 1589 Header: res.Header, 1590 } 1591 } 1592 if err != nil { 1593 return nil, err 1594 } 1595 defer googleapi.CloseBody(res) 1596 if err := googleapi.CheckResponse(res); err != nil { 1597 return nil, err 1598 } 1599 ret := &LogMetric{ 1600 ServerResponse: googleapi.ServerResponse{ 1601 Header: res.Header, 1602 HTTPStatusCode: res.StatusCode, 1603 }, 1604 } 1605 if err := json.NewDecoder(res.Body).Decode(&ret); err != nil { 1606 return nil, err 1607 } 1608 return ret, nil 1609 // { 1610 // "description": "Creates a logs-based metric.", 1611 // "httpMethod": "POST", 1612 // "id": "logging.projects.metrics.create", 1613 // "parameterOrder": [ 1614 // "projectName" 1615 // ], 1616 // "parameters": { 1617 // "projectName": { 1618 // "description": "The resource name of the project in which to create the metric. Example: `\"projects/my-project-id\"`. The new metric must be provided in the request.", 1619 // "location": "path", 1620 // "pattern": "^projects/[^/]*$", 1621 // "required": true, 1622 // "type": "string" 1623 // } 1624 // }, 1625 // "path": "v2beta1/{+projectName}/metrics", 1626 // "request": { 1627 // "$ref": "LogMetric" 1628 // }, 1629 // "response": { 1630 // "$ref": "LogMetric" 1631 // }, 1632 // "scopes": [ 1633 // "https://www.googleapis.com/auth/cloud-platform", 1634 // "https://www.googleapis.com/auth/logging.admin", 1635 // "https://www.googleapis.com/auth/logging.write" 1636 // ] 1637 // } 1638 1639 } 1640 1641 // method id "logging.projects.metrics.delete": 1642 1643 type ProjectsMetricsDeleteCall struct { 1644 s *Service 1645 metricName string 1646 urlParams_ gensupport.URLParams 1647 ctx_ context.Context 1648 } 1649 1650 // Delete: Deletes a logs-based metric. 1651 func (r *ProjectsMetricsService) Delete(metricName string) *ProjectsMetricsDeleteCall { 1652 c := &ProjectsMetricsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1653 c.metricName = metricName 1654 return c 1655 } 1656 1657 // QuotaUser sets the optional parameter "quotaUser": Available to use 1658 // for quota purposes for server-side applications. Can be any arbitrary 1659 // string assigned to a user, but should not exceed 40 characters. 1660 func (c *ProjectsMetricsDeleteCall) QuotaUser(quotaUser string) *ProjectsMetricsDeleteCall { 1661 c.urlParams_.Set("quotaUser", quotaUser) 1662 return c 1663 } 1664 1665 // Fields allows partial responses to be retrieved. See 1666 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1667 // for more information. 1668 func (c *ProjectsMetricsDeleteCall) Fields(s ...googleapi.Field) *ProjectsMetricsDeleteCall { 1669 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1670 return c 1671 } 1672 1673 // Context sets the context to be used in this call's Do method. Any 1674 // pending HTTP request will be aborted if the provided context is 1675 // canceled. 1676 func (c *ProjectsMetricsDeleteCall) Context(ctx context.Context) *ProjectsMetricsDeleteCall { 1677 c.ctx_ = ctx 1678 return c 1679 } 1680 1681 func (c *ProjectsMetricsDeleteCall) doRequest(alt string) (*http.Response, error) { 1682 var body io.Reader = nil 1683 c.urlParams_.Set("alt", alt) 1684 urls := googleapi.ResolveRelative(c.s.BasePath, "v2beta1/{+metricName}") 1685 urls += "?" + c.urlParams_.Encode() 1686 req, _ := http.NewRequest("DELETE", urls, body) 1687 googleapi.Expand(req.URL, map[string]string{ 1688 "metricName": c.metricName, 1689 }) 1690 req.Header.Set("User-Agent", c.s.userAgent()) 1691 if c.ctx_ != nil { 1692 return ctxhttp.Do(c.ctx_, c.s.client, req) 1693 } 1694 return c.s.client.Do(req) 1695 } 1696 1697 // Do executes the "logging.projects.metrics.delete" call. 1698 // Exactly one of *Empty or error will be non-nil. Any non-2xx status 1699 // code is an error. Response headers are in either 1700 // *Empty.ServerResponse.Header or (if a response was returned at all) 1701 // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 1702 // check whether the returned error was because http.StatusNotModified 1703 // was returned. 1704 func (c *ProjectsMetricsDeleteCall) Do() (*Empty, error) { 1705 res, err := c.doRequest("json") 1706 if res != nil && res.StatusCode == http.StatusNotModified { 1707 if res.Body != nil { 1708 res.Body.Close() 1709 } 1710 return nil, &googleapi.Error{ 1711 Code: res.StatusCode, 1712 Header: res.Header, 1713 } 1714 } 1715 if err != nil { 1716 return nil, err 1717 } 1718 defer googleapi.CloseBody(res) 1719 if err := googleapi.CheckResponse(res); err != nil { 1720 return nil, err 1721 } 1722 ret := &Empty{ 1723 ServerResponse: googleapi.ServerResponse{ 1724 Header: res.Header, 1725 HTTPStatusCode: res.StatusCode, 1726 }, 1727 } 1728 if err := json.NewDecoder(res.Body).Decode(&ret); err != nil { 1729 return nil, err 1730 } 1731 return ret, nil 1732 // { 1733 // "description": "Deletes a logs-based metric.", 1734 // "httpMethod": "DELETE", 1735 // "id": "logging.projects.metrics.delete", 1736 // "parameterOrder": [ 1737 // "metricName" 1738 // ], 1739 // "parameters": { 1740 // "metricName": { 1741 // "description": "The resource name of the metric to delete. Example: `\"projects/my-project-id/metrics/my-metric-id\"`.", 1742 // "location": "path", 1743 // "pattern": "^projects/[^/]*/metrics/[^/]*$", 1744 // "required": true, 1745 // "type": "string" 1746 // } 1747 // }, 1748 // "path": "v2beta1/{+metricName}", 1749 // "response": { 1750 // "$ref": "Empty" 1751 // }, 1752 // "scopes": [ 1753 // "https://www.googleapis.com/auth/cloud-platform", 1754 // "https://www.googleapis.com/auth/logging.admin", 1755 // "https://www.googleapis.com/auth/logging.write" 1756 // ] 1757 // } 1758 1759 } 1760 1761 // method id "logging.projects.metrics.get": 1762 1763 type ProjectsMetricsGetCall struct { 1764 s *Service 1765 metricName string 1766 urlParams_ gensupport.URLParams 1767 ifNoneMatch_ string 1768 ctx_ context.Context 1769 } 1770 1771 // Get: Gets a logs-based metric. 1772 func (r *ProjectsMetricsService) Get(metricName string) *ProjectsMetricsGetCall { 1773 c := &ProjectsMetricsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1774 c.metricName = metricName 1775 return c 1776 } 1777 1778 // QuotaUser sets the optional parameter "quotaUser": Available to use 1779 // for quota purposes for server-side applications. Can be any arbitrary 1780 // string assigned to a user, but should not exceed 40 characters. 1781 func (c *ProjectsMetricsGetCall) QuotaUser(quotaUser string) *ProjectsMetricsGetCall { 1782 c.urlParams_.Set("quotaUser", quotaUser) 1783 return c 1784 } 1785 1786 // Fields allows partial responses to be retrieved. See 1787 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1788 // for more information. 1789 func (c *ProjectsMetricsGetCall) Fields(s ...googleapi.Field) *ProjectsMetricsGetCall { 1790 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1791 return c 1792 } 1793 1794 // IfNoneMatch sets the optional parameter which makes the operation 1795 // fail if the object's ETag matches the given value. This is useful for 1796 // getting updates only after the object has changed since the last 1797 // request. Use googleapi.IsNotModified to check whether the response 1798 // error from Do is the result of In-None-Match. 1799 func (c *ProjectsMetricsGetCall) IfNoneMatch(entityTag string) *ProjectsMetricsGetCall { 1800 c.ifNoneMatch_ = entityTag 1801 return c 1802 } 1803 1804 // Context sets the context to be used in this call's Do method. Any 1805 // pending HTTP request will be aborted if the provided context is 1806 // canceled. 1807 func (c *ProjectsMetricsGetCall) Context(ctx context.Context) *ProjectsMetricsGetCall { 1808 c.ctx_ = ctx 1809 return c 1810 } 1811 1812 func (c *ProjectsMetricsGetCall) doRequest(alt string) (*http.Response, error) { 1813 var body io.Reader = nil 1814 c.urlParams_.Set("alt", alt) 1815 urls := googleapi.ResolveRelative(c.s.BasePath, "v2beta1/{+metricName}") 1816 urls += "?" + c.urlParams_.Encode() 1817 req, _ := http.NewRequest("GET", urls, body) 1818 googleapi.Expand(req.URL, map[string]string{ 1819 "metricName": c.metricName, 1820 }) 1821 req.Header.Set("User-Agent", c.s.userAgent()) 1822 if c.ifNoneMatch_ != "" { 1823 req.Header.Set("If-None-Match", c.ifNoneMatch_) 1824 } 1825 if c.ctx_ != nil { 1826 return ctxhttp.Do(c.ctx_, c.s.client, req) 1827 } 1828 return c.s.client.Do(req) 1829 } 1830 1831 // Do executes the "logging.projects.metrics.get" call. 1832 // Exactly one of *LogMetric or error will be non-nil. Any non-2xx 1833 // status code is an error. Response headers are in either 1834 // *LogMetric.ServerResponse.Header or (if a response was returned at 1835 // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 1836 // to check whether the returned error was because 1837 // http.StatusNotModified was returned. 1838 func (c *ProjectsMetricsGetCall) Do() (*LogMetric, error) { 1839 res, err := c.doRequest("json") 1840 if res != nil && res.StatusCode == http.StatusNotModified { 1841 if res.Body != nil { 1842 res.Body.Close() 1843 } 1844 return nil, &googleapi.Error{ 1845 Code: res.StatusCode, 1846 Header: res.Header, 1847 } 1848 } 1849 if err != nil { 1850 return nil, err 1851 } 1852 defer googleapi.CloseBody(res) 1853 if err := googleapi.CheckResponse(res); err != nil { 1854 return nil, err 1855 } 1856 ret := &LogMetric{ 1857 ServerResponse: googleapi.ServerResponse{ 1858 Header: res.Header, 1859 HTTPStatusCode: res.StatusCode, 1860 }, 1861 } 1862 if err := json.NewDecoder(res.Body).Decode(&ret); err != nil { 1863 return nil, err 1864 } 1865 return ret, nil 1866 // { 1867 // "description": "Gets a logs-based metric.", 1868 // "httpMethod": "GET", 1869 // "id": "logging.projects.metrics.get", 1870 // "parameterOrder": [ 1871 // "metricName" 1872 // ], 1873 // "parameters": { 1874 // "metricName": { 1875 // "description": "The resource name of the desired metric. Example: `\"projects/my-project-id/metrics/my-metric-id\"`.", 1876 // "location": "path", 1877 // "pattern": "^projects/[^/]*/metrics/[^/]*$", 1878 // "required": true, 1879 // "type": "string" 1880 // } 1881 // }, 1882 // "path": "v2beta1/{+metricName}", 1883 // "response": { 1884 // "$ref": "LogMetric" 1885 // }, 1886 // "scopes": [ 1887 // "https://www.googleapis.com/auth/cloud-platform", 1888 // "https://www.googleapis.com/auth/cloud-platform.read-only", 1889 // "https://www.googleapis.com/auth/logging.admin", 1890 // "https://www.googleapis.com/auth/logging.read" 1891 // ] 1892 // } 1893 1894 } 1895 1896 // method id "logging.projects.metrics.list": 1897 1898 type ProjectsMetricsListCall struct { 1899 s *Service 1900 projectName string 1901 urlParams_ gensupport.URLParams 1902 ifNoneMatch_ string 1903 ctx_ context.Context 1904 } 1905 1906 // List: Lists logs-based metrics. 1907 func (r *ProjectsMetricsService) List(projectName string) *ProjectsMetricsListCall { 1908 c := &ProjectsMetricsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1909 c.projectName = projectName 1910 return c 1911 } 1912 1913 // PageSize sets the optional parameter "pageSize": The maximum number 1914 // of results to return from this request. Fewer results might be 1915 // returned. You must check for the 'nextPageToken` result to determine 1916 // if additional results are available, which you can retrieve by 1917 // passing the `nextPageToken` value in the `pageToken` parameter to the 1918 // next request. 1919 func (c *ProjectsMetricsListCall) PageSize(pageSize int64) *ProjectsMetricsListCall { 1920 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 1921 return c 1922 } 1923 1924 // PageToken sets the optional parameter "pageToken": If the `pageToken` 1925 // request parameter is supplied, then the next page of results in the 1926 // set are retrieved. The `pageToken` parameter must be set with the 1927 // value of the `nextPageToken` result parameter from the previous 1928 // request. The value of `projectName` must be the same as in the 1929 // previous request. 1930 func (c *ProjectsMetricsListCall) PageToken(pageToken string) *ProjectsMetricsListCall { 1931 c.urlParams_.Set("pageToken", pageToken) 1932 return c 1933 } 1934 1935 // QuotaUser sets the optional parameter "quotaUser": Available to use 1936 // for quota purposes for server-side applications. Can be any arbitrary 1937 // string assigned to a user, but should not exceed 40 characters. 1938 func (c *ProjectsMetricsListCall) QuotaUser(quotaUser string) *ProjectsMetricsListCall { 1939 c.urlParams_.Set("quotaUser", quotaUser) 1940 return c 1941 } 1942 1943 // Fields allows partial responses to be retrieved. See 1944 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1945 // for more information. 1946 func (c *ProjectsMetricsListCall) Fields(s ...googleapi.Field) *ProjectsMetricsListCall { 1947 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1948 return c 1949 } 1950 1951 // IfNoneMatch sets the optional parameter which makes the operation 1952 // fail if the object's ETag matches the given value. This is useful for 1953 // getting updates only after the object has changed since the last 1954 // request. Use googleapi.IsNotModified to check whether the response 1955 // error from Do is the result of In-None-Match. 1956 func (c *ProjectsMetricsListCall) IfNoneMatch(entityTag string) *ProjectsMetricsListCall { 1957 c.ifNoneMatch_ = entityTag 1958 return c 1959 } 1960 1961 // Context sets the context to be used in this call's Do method. Any 1962 // pending HTTP request will be aborted if the provided context is 1963 // canceled. 1964 func (c *ProjectsMetricsListCall) Context(ctx context.Context) *ProjectsMetricsListCall { 1965 c.ctx_ = ctx 1966 return c 1967 } 1968 1969 func (c *ProjectsMetricsListCall) doRequest(alt string) (*http.Response, error) { 1970 var body io.Reader = nil 1971 c.urlParams_.Set("alt", alt) 1972 urls := googleapi.ResolveRelative(c.s.BasePath, "v2beta1/{+projectName}/metrics") 1973 urls += "?" + c.urlParams_.Encode() 1974 req, _ := http.NewRequest("GET", urls, body) 1975 googleapi.Expand(req.URL, map[string]string{ 1976 "projectName": c.projectName, 1977 }) 1978 req.Header.Set("User-Agent", c.s.userAgent()) 1979 if c.ifNoneMatch_ != "" { 1980 req.Header.Set("If-None-Match", c.ifNoneMatch_) 1981 } 1982 if c.ctx_ != nil { 1983 return ctxhttp.Do(c.ctx_, c.s.client, req) 1984 } 1985 return c.s.client.Do(req) 1986 } 1987 1988 // Do executes the "logging.projects.metrics.list" call. 1989 // Exactly one of *ListLogMetricsResponse or error will be non-nil. Any 1990 // non-2xx status code is an error. Response headers are in either 1991 // *ListLogMetricsResponse.ServerResponse.Header or (if a response was 1992 // returned at all) in error.(*googleapi.Error).Header. Use 1993 // googleapi.IsNotModified to check whether the returned error was 1994 // because http.StatusNotModified was returned. 1995 func (c *ProjectsMetricsListCall) Do() (*ListLogMetricsResponse, error) { 1996 res, err := c.doRequest("json") 1997 if res != nil && res.StatusCode == http.StatusNotModified { 1998 if res.Body != nil { 1999 res.Body.Close() 2000 } 2001 return nil, &googleapi.Error{ 2002 Code: res.StatusCode, 2003 Header: res.Header, 2004 } 2005 } 2006 if err != nil { 2007 return nil, err 2008 } 2009 defer googleapi.CloseBody(res) 2010 if err := googleapi.CheckResponse(res); err != nil { 2011 return nil, err 2012 } 2013 ret := &ListLogMetricsResponse{ 2014 ServerResponse: googleapi.ServerResponse{ 2015 Header: res.Header, 2016 HTTPStatusCode: res.StatusCode, 2017 }, 2018 } 2019 if err := json.NewDecoder(res.Body).Decode(&ret); err != nil { 2020 return nil, err 2021 } 2022 return ret, nil 2023 // { 2024 // "description": "Lists logs-based metrics.", 2025 // "httpMethod": "GET", 2026 // "id": "logging.projects.metrics.list", 2027 // "parameterOrder": [ 2028 // "projectName" 2029 // ], 2030 // "parameters": { 2031 // "pageSize": { 2032 // "description": "Optional. The maximum number of results to return from this request. Fewer results might be returned. You must check for the 'nextPageToken` result to determine if additional results are available, which you can retrieve by passing the `nextPageToken` value in the `pageToken` parameter to the next request.", 2033 // "format": "int32", 2034 // "location": "query", 2035 // "type": "integer" 2036 // }, 2037 // "pageToken": { 2038 // "description": "Optional. If the `pageToken` request parameter is supplied, then the next page of results in the set are retrieved. The `pageToken` parameter must be set with the value of the `nextPageToken` result parameter from the previous request. The value of `projectName` must be the same as in the previous request.", 2039 // "location": "query", 2040 // "type": "string" 2041 // }, 2042 // "projectName": { 2043 // "description": "Required. The resource name for the project whose metrics are wanted. Example: `\"projects/my-project-id\"`.", 2044 // "location": "path", 2045 // "pattern": "^projects/[^/]*$", 2046 // "required": true, 2047 // "type": "string" 2048 // } 2049 // }, 2050 // "path": "v2beta1/{+projectName}/metrics", 2051 // "response": { 2052 // "$ref": "ListLogMetricsResponse" 2053 // }, 2054 // "scopes": [ 2055 // "https://www.googleapis.com/auth/cloud-platform", 2056 // "https://www.googleapis.com/auth/cloud-platform.read-only", 2057 // "https://www.googleapis.com/auth/logging.admin", 2058 // "https://www.googleapis.com/auth/logging.read" 2059 // ] 2060 // } 2061 2062 } 2063 2064 // method id "logging.projects.metrics.update": 2065 2066 type ProjectsMetricsUpdateCall struct { 2067 s *Service 2068 metricNameid string 2069 logmetric *LogMetric 2070 urlParams_ gensupport.URLParams 2071 ctx_ context.Context 2072 } 2073 2074 // Update: Creates or updates a logs-based metric. 2075 func (r *ProjectsMetricsService) Update(metricNameid string, logmetric *LogMetric) *ProjectsMetricsUpdateCall { 2076 c := &ProjectsMetricsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2077 c.metricNameid = metricNameid 2078 c.logmetric = logmetric 2079 return c 2080 } 2081 2082 // QuotaUser sets the optional parameter "quotaUser": Available to use 2083 // for quota purposes for server-side applications. Can be any arbitrary 2084 // string assigned to a user, but should not exceed 40 characters. 2085 func (c *ProjectsMetricsUpdateCall) QuotaUser(quotaUser string) *ProjectsMetricsUpdateCall { 2086 c.urlParams_.Set("quotaUser", quotaUser) 2087 return c 2088 } 2089 2090 // Fields allows partial responses to be retrieved. See 2091 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2092 // for more information. 2093 func (c *ProjectsMetricsUpdateCall) Fields(s ...googleapi.Field) *ProjectsMetricsUpdateCall { 2094 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2095 return c 2096 } 2097 2098 // Context sets the context to be used in this call's Do method. Any 2099 // pending HTTP request will be aborted if the provided context is 2100 // canceled. 2101 func (c *ProjectsMetricsUpdateCall) Context(ctx context.Context) *ProjectsMetricsUpdateCall { 2102 c.ctx_ = ctx 2103 return c 2104 } 2105 2106 func (c *ProjectsMetricsUpdateCall) doRequest(alt string) (*http.Response, error) { 2107 var body io.Reader = nil 2108 body, err := googleapi.WithoutDataWrapper.JSONReader(c.logmetric) 2109 if err != nil { 2110 return nil, err 2111 } 2112 ctype := "application/json" 2113 c.urlParams_.Set("alt", alt) 2114 urls := googleapi.ResolveRelative(c.s.BasePath, "v2beta1/{+metricName}") 2115 urls += "?" + c.urlParams_.Encode() 2116 req, _ := http.NewRequest("PUT", urls, body) 2117 googleapi.Expand(req.URL, map[string]string{ 2118 "metricName": c.metricNameid, 2119 }) 2120 req.Header.Set("Content-Type", ctype) 2121 req.Header.Set("User-Agent", c.s.userAgent()) 2122 if c.ctx_ != nil { 2123 return ctxhttp.Do(c.ctx_, c.s.client, req) 2124 } 2125 return c.s.client.Do(req) 2126 } 2127 2128 // Do executes the "logging.projects.metrics.update" call. 2129 // Exactly one of *LogMetric or error will be non-nil. Any non-2xx 2130 // status code is an error. Response headers are in either 2131 // *LogMetric.ServerResponse.Header or (if a response was returned at 2132 // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 2133 // to check whether the returned error was because 2134 // http.StatusNotModified was returned. 2135 func (c *ProjectsMetricsUpdateCall) Do() (*LogMetric, error) { 2136 res, err := c.doRequest("json") 2137 if res != nil && res.StatusCode == http.StatusNotModified { 2138 if res.Body != nil { 2139 res.Body.Close() 2140 } 2141 return nil, &googleapi.Error{ 2142 Code: res.StatusCode, 2143 Header: res.Header, 2144 } 2145 } 2146 if err != nil { 2147 return nil, err 2148 } 2149 defer googleapi.CloseBody(res) 2150 if err := googleapi.CheckResponse(res); err != nil { 2151 return nil, err 2152 } 2153 ret := &LogMetric{ 2154 ServerResponse: googleapi.ServerResponse{ 2155 Header: res.Header, 2156 HTTPStatusCode: res.StatusCode, 2157 }, 2158 } 2159 if err := json.NewDecoder(res.Body).Decode(&ret); err != nil { 2160 return nil, err 2161 } 2162 return ret, nil 2163 // { 2164 // "description": "Creates or updates a logs-based metric.", 2165 // "httpMethod": "PUT", 2166 // "id": "logging.projects.metrics.update", 2167 // "parameterOrder": [ 2168 // "metricName" 2169 // ], 2170 // "parameters": { 2171 // "metricName": { 2172 // "description": "The resource name of the metric to update. Example: `\"projects/my-project-id/metrics/my-metric-id\"`. The updated metric must be provided in the request and have the same identifier that is specified in `metricName`. If the metric does not exist, it is created.", 2173 // "location": "path", 2174 // "pattern": "^projects/[^/]*/metrics/[^/]*$", 2175 // "required": true, 2176 // "type": "string" 2177 // } 2178 // }, 2179 // "path": "v2beta1/{+metricName}", 2180 // "request": { 2181 // "$ref": "LogMetric" 2182 // }, 2183 // "response": { 2184 // "$ref": "LogMetric" 2185 // }, 2186 // "scopes": [ 2187 // "https://www.googleapis.com/auth/cloud-platform", 2188 // "https://www.googleapis.com/auth/logging.admin", 2189 // "https://www.googleapis.com/auth/logging.write" 2190 // ] 2191 // } 2192 2193 } 2194 2195 // method id "logging.projects.sinks.create": 2196 2197 type ProjectsSinksCreateCall struct { 2198 s *Service 2199 projectName string 2200 logsink *LogSink 2201 urlParams_ gensupport.URLParams 2202 ctx_ context.Context 2203 } 2204 2205 // Create: Creates a sink. 2206 func (r *ProjectsSinksService) Create(projectName string, logsink *LogSink) *ProjectsSinksCreateCall { 2207 c := &ProjectsSinksCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2208 c.projectName = projectName 2209 c.logsink = logsink 2210 return c 2211 } 2212 2213 // QuotaUser sets the optional parameter "quotaUser": Available to use 2214 // for quota purposes for server-side applications. Can be any arbitrary 2215 // string assigned to a user, but should not exceed 40 characters. 2216 func (c *ProjectsSinksCreateCall) QuotaUser(quotaUser string) *ProjectsSinksCreateCall { 2217 c.urlParams_.Set("quotaUser", quotaUser) 2218 return c 2219 } 2220 2221 // Fields allows partial responses to be retrieved. See 2222 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2223 // for more information. 2224 func (c *ProjectsSinksCreateCall) Fields(s ...googleapi.Field) *ProjectsSinksCreateCall { 2225 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2226 return c 2227 } 2228 2229 // Context sets the context to be used in this call's Do method. Any 2230 // pending HTTP request will be aborted if the provided context is 2231 // canceled. 2232 func (c *ProjectsSinksCreateCall) Context(ctx context.Context) *ProjectsSinksCreateCall { 2233 c.ctx_ = ctx 2234 return c 2235 } 2236 2237 func (c *ProjectsSinksCreateCall) doRequest(alt string) (*http.Response, error) { 2238 var body io.Reader = nil 2239 body, err := googleapi.WithoutDataWrapper.JSONReader(c.logsink) 2240 if err != nil { 2241 return nil, err 2242 } 2243 ctype := "application/json" 2244 c.urlParams_.Set("alt", alt) 2245 urls := googleapi.ResolveRelative(c.s.BasePath, "v2beta1/{+projectName}/sinks") 2246 urls += "?" + c.urlParams_.Encode() 2247 req, _ := http.NewRequest("POST", urls, body) 2248 googleapi.Expand(req.URL, map[string]string{ 2249 "projectName": c.projectName, 2250 }) 2251 req.Header.Set("Content-Type", ctype) 2252 req.Header.Set("User-Agent", c.s.userAgent()) 2253 if c.ctx_ != nil { 2254 return ctxhttp.Do(c.ctx_, c.s.client, req) 2255 } 2256 return c.s.client.Do(req) 2257 } 2258 2259 // Do executes the "logging.projects.sinks.create" call. 2260 // Exactly one of *LogSink or error will be non-nil. Any non-2xx status 2261 // code is an error. Response headers are in either 2262 // *LogSink.ServerResponse.Header or (if a response was returned at all) 2263 // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 2264 // check whether the returned error was because http.StatusNotModified 2265 // was returned. 2266 func (c *ProjectsSinksCreateCall) Do() (*LogSink, error) { 2267 res, err := c.doRequest("json") 2268 if res != nil && res.StatusCode == http.StatusNotModified { 2269 if res.Body != nil { 2270 res.Body.Close() 2271 } 2272 return nil, &googleapi.Error{ 2273 Code: res.StatusCode, 2274 Header: res.Header, 2275 } 2276 } 2277 if err != nil { 2278 return nil, err 2279 } 2280 defer googleapi.CloseBody(res) 2281 if err := googleapi.CheckResponse(res); err != nil { 2282 return nil, err 2283 } 2284 ret := &LogSink{ 2285 ServerResponse: googleapi.ServerResponse{ 2286 Header: res.Header, 2287 HTTPStatusCode: res.StatusCode, 2288 }, 2289 } 2290 if err := json.NewDecoder(res.Body).Decode(&ret); err != nil { 2291 return nil, err 2292 } 2293 return ret, nil 2294 // { 2295 // "description": "Creates a sink.", 2296 // "httpMethod": "POST", 2297 // "id": "logging.projects.sinks.create", 2298 // "parameterOrder": [ 2299 // "projectName" 2300 // ], 2301 // "parameters": { 2302 // "projectName": { 2303 // "description": "The resource name of the project in which to create the sink. Example: `\"projects/my-project-id\"`. The new sink must be provided in the request.", 2304 // "location": "path", 2305 // "pattern": "^projects/[^/]*$", 2306 // "required": true, 2307 // "type": "string" 2308 // } 2309 // }, 2310 // "path": "v2beta1/{+projectName}/sinks", 2311 // "request": { 2312 // "$ref": "LogSink" 2313 // }, 2314 // "response": { 2315 // "$ref": "LogSink" 2316 // }, 2317 // "scopes": [ 2318 // "https://www.googleapis.com/auth/cloud-platform", 2319 // "https://www.googleapis.com/auth/logging.admin" 2320 // ] 2321 // } 2322 2323 } 2324 2325 // method id "logging.projects.sinks.delete": 2326 2327 type ProjectsSinksDeleteCall struct { 2328 s *Service 2329 sinkName string 2330 urlParams_ gensupport.URLParams 2331 ctx_ context.Context 2332 } 2333 2334 // Delete: Deletes a sink. 2335 func (r *ProjectsSinksService) Delete(sinkName string) *ProjectsSinksDeleteCall { 2336 c := &ProjectsSinksDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2337 c.sinkName = sinkName 2338 return c 2339 } 2340 2341 // QuotaUser sets the optional parameter "quotaUser": Available to use 2342 // for quota purposes for server-side applications. Can be any arbitrary 2343 // string assigned to a user, but should not exceed 40 characters. 2344 func (c *ProjectsSinksDeleteCall) QuotaUser(quotaUser string) *ProjectsSinksDeleteCall { 2345 c.urlParams_.Set("quotaUser", quotaUser) 2346 return c 2347 } 2348 2349 // Fields allows partial responses to be retrieved. See 2350 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2351 // for more information. 2352 func (c *ProjectsSinksDeleteCall) Fields(s ...googleapi.Field) *ProjectsSinksDeleteCall { 2353 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2354 return c 2355 } 2356 2357 // Context sets the context to be used in this call's Do method. Any 2358 // pending HTTP request will be aborted if the provided context is 2359 // canceled. 2360 func (c *ProjectsSinksDeleteCall) Context(ctx context.Context) *ProjectsSinksDeleteCall { 2361 c.ctx_ = ctx 2362 return c 2363 } 2364 2365 func (c *ProjectsSinksDeleteCall) doRequest(alt string) (*http.Response, error) { 2366 var body io.Reader = nil 2367 c.urlParams_.Set("alt", alt) 2368 urls := googleapi.ResolveRelative(c.s.BasePath, "v2beta1/{+sinkName}") 2369 urls += "?" + c.urlParams_.Encode() 2370 req, _ := http.NewRequest("DELETE", urls, body) 2371 googleapi.Expand(req.URL, map[string]string{ 2372 "sinkName": c.sinkName, 2373 }) 2374 req.Header.Set("User-Agent", c.s.userAgent()) 2375 if c.ctx_ != nil { 2376 return ctxhttp.Do(c.ctx_, c.s.client, req) 2377 } 2378 return c.s.client.Do(req) 2379 } 2380 2381 // Do executes the "logging.projects.sinks.delete" call. 2382 // Exactly one of *Empty or error will be non-nil. Any non-2xx status 2383 // code is an error. Response headers are in either 2384 // *Empty.ServerResponse.Header or (if a response was returned at all) 2385 // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 2386 // check whether the returned error was because http.StatusNotModified 2387 // was returned. 2388 func (c *ProjectsSinksDeleteCall) Do() (*Empty, error) { 2389 res, err := c.doRequest("json") 2390 if res != nil && res.StatusCode == http.StatusNotModified { 2391 if res.Body != nil { 2392 res.Body.Close() 2393 } 2394 return nil, &googleapi.Error{ 2395 Code: res.StatusCode, 2396 Header: res.Header, 2397 } 2398 } 2399 if err != nil { 2400 return nil, err 2401 } 2402 defer googleapi.CloseBody(res) 2403 if err := googleapi.CheckResponse(res); err != nil { 2404 return nil, err 2405 } 2406 ret := &Empty{ 2407 ServerResponse: googleapi.ServerResponse{ 2408 Header: res.Header, 2409 HTTPStatusCode: res.StatusCode, 2410 }, 2411 } 2412 if err := json.NewDecoder(res.Body).Decode(&ret); err != nil { 2413 return nil, err 2414 } 2415 return ret, nil 2416 // { 2417 // "description": "Deletes a sink.", 2418 // "httpMethod": "DELETE", 2419 // "id": "logging.projects.sinks.delete", 2420 // "parameterOrder": [ 2421 // "sinkName" 2422 // ], 2423 // "parameters": { 2424 // "sinkName": { 2425 // "description": "The resource name of the sink to delete. Example: `\"projects/my-project-id/sinks/my-sink-id\"`.", 2426 // "location": "path", 2427 // "pattern": "^projects/[^/]*/sinks/[^/]*$", 2428 // "required": true, 2429 // "type": "string" 2430 // } 2431 // }, 2432 // "path": "v2beta1/{+sinkName}", 2433 // "response": { 2434 // "$ref": "Empty" 2435 // }, 2436 // "scopes": [ 2437 // "https://www.googleapis.com/auth/cloud-platform", 2438 // "https://www.googleapis.com/auth/logging.admin" 2439 // ] 2440 // } 2441 2442 } 2443 2444 // method id "logging.projects.sinks.get": 2445 2446 type ProjectsSinksGetCall struct { 2447 s *Service 2448 sinkName string 2449 urlParams_ gensupport.URLParams 2450 ifNoneMatch_ string 2451 ctx_ context.Context 2452 } 2453 2454 // Get: Gets a sink. 2455 func (r *ProjectsSinksService) Get(sinkName string) *ProjectsSinksGetCall { 2456 c := &ProjectsSinksGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2457 c.sinkName = sinkName 2458 return c 2459 } 2460 2461 // QuotaUser sets the optional parameter "quotaUser": Available to use 2462 // for quota purposes for server-side applications. Can be any arbitrary 2463 // string assigned to a user, but should not exceed 40 characters. 2464 func (c *ProjectsSinksGetCall) QuotaUser(quotaUser string) *ProjectsSinksGetCall { 2465 c.urlParams_.Set("quotaUser", quotaUser) 2466 return c 2467 } 2468 2469 // Fields allows partial responses to be retrieved. See 2470 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2471 // for more information. 2472 func (c *ProjectsSinksGetCall) Fields(s ...googleapi.Field) *ProjectsSinksGetCall { 2473 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2474 return c 2475 } 2476 2477 // IfNoneMatch sets the optional parameter which makes the operation 2478 // fail if the object's ETag matches the given value. This is useful for 2479 // getting updates only after the object has changed since the last 2480 // request. Use googleapi.IsNotModified to check whether the response 2481 // error from Do is the result of In-None-Match. 2482 func (c *ProjectsSinksGetCall) IfNoneMatch(entityTag string) *ProjectsSinksGetCall { 2483 c.ifNoneMatch_ = entityTag 2484 return c 2485 } 2486 2487 // Context sets the context to be used in this call's Do method. Any 2488 // pending HTTP request will be aborted if the provided context is 2489 // canceled. 2490 func (c *ProjectsSinksGetCall) Context(ctx context.Context) *ProjectsSinksGetCall { 2491 c.ctx_ = ctx 2492 return c 2493 } 2494 2495 func (c *ProjectsSinksGetCall) doRequest(alt string) (*http.Response, error) { 2496 var body io.Reader = nil 2497 c.urlParams_.Set("alt", alt) 2498 urls := googleapi.ResolveRelative(c.s.BasePath, "v2beta1/{+sinkName}") 2499 urls += "?" + c.urlParams_.Encode() 2500 req, _ := http.NewRequest("GET", urls, body) 2501 googleapi.Expand(req.URL, map[string]string{ 2502 "sinkName": c.sinkName, 2503 }) 2504 req.Header.Set("User-Agent", c.s.userAgent()) 2505 if c.ifNoneMatch_ != "" { 2506 req.Header.Set("If-None-Match", c.ifNoneMatch_) 2507 } 2508 if c.ctx_ != nil { 2509 return ctxhttp.Do(c.ctx_, c.s.client, req) 2510 } 2511 return c.s.client.Do(req) 2512 } 2513 2514 // Do executes the "logging.projects.sinks.get" call. 2515 // Exactly one of *LogSink or error will be non-nil. Any non-2xx status 2516 // code is an error. Response headers are in either 2517 // *LogSink.ServerResponse.Header or (if a response was returned at all) 2518 // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 2519 // check whether the returned error was because http.StatusNotModified 2520 // was returned. 2521 func (c *ProjectsSinksGetCall) Do() (*LogSink, error) { 2522 res, err := c.doRequest("json") 2523 if res != nil && res.StatusCode == http.StatusNotModified { 2524 if res.Body != nil { 2525 res.Body.Close() 2526 } 2527 return nil, &googleapi.Error{ 2528 Code: res.StatusCode, 2529 Header: res.Header, 2530 } 2531 } 2532 if err != nil { 2533 return nil, err 2534 } 2535 defer googleapi.CloseBody(res) 2536 if err := googleapi.CheckResponse(res); err != nil { 2537 return nil, err 2538 } 2539 ret := &LogSink{ 2540 ServerResponse: googleapi.ServerResponse{ 2541 Header: res.Header, 2542 HTTPStatusCode: res.StatusCode, 2543 }, 2544 } 2545 if err := json.NewDecoder(res.Body).Decode(&ret); err != nil { 2546 return nil, err 2547 } 2548 return ret, nil 2549 // { 2550 // "description": "Gets a sink.", 2551 // "httpMethod": "GET", 2552 // "id": "logging.projects.sinks.get", 2553 // "parameterOrder": [ 2554 // "sinkName" 2555 // ], 2556 // "parameters": { 2557 // "sinkName": { 2558 // "description": "The resource name of the sink to return. Example: `\"projects/my-project-id/sinks/my-sink-id\"`.", 2559 // "location": "path", 2560 // "pattern": "^projects/[^/]*/sinks/[^/]*$", 2561 // "required": true, 2562 // "type": "string" 2563 // } 2564 // }, 2565 // "path": "v2beta1/{+sinkName}", 2566 // "response": { 2567 // "$ref": "LogSink" 2568 // }, 2569 // "scopes": [ 2570 // "https://www.googleapis.com/auth/cloud-platform", 2571 // "https://www.googleapis.com/auth/cloud-platform.read-only", 2572 // "https://www.googleapis.com/auth/logging.admin", 2573 // "https://www.googleapis.com/auth/logging.read" 2574 // ] 2575 // } 2576 2577 } 2578 2579 // method id "logging.projects.sinks.list": 2580 2581 type ProjectsSinksListCall struct { 2582 s *Service 2583 projectName string 2584 urlParams_ gensupport.URLParams 2585 ifNoneMatch_ string 2586 ctx_ context.Context 2587 } 2588 2589 // List: Lists sinks. 2590 func (r *ProjectsSinksService) List(projectName string) *ProjectsSinksListCall { 2591 c := &ProjectsSinksListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2592 c.projectName = projectName 2593 return c 2594 } 2595 2596 // PageSize sets the optional parameter "pageSize": The maximum number 2597 // of results to return from this request. Fewer results might be 2598 // returned. You must check for the 'nextPageToken` result to determine 2599 // if additional results are available, which you can retrieve by 2600 // passing the `nextPageToken` value in the `pageToken` parameter to the 2601 // next request. 2602 func (c *ProjectsSinksListCall) PageSize(pageSize int64) *ProjectsSinksListCall { 2603 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 2604 return c 2605 } 2606 2607 // PageToken sets the optional parameter "pageToken": If the `pageToken` 2608 // request parameter is supplied, then the next page of results in the 2609 // set are retrieved. The `pageToken` parameter must be set with the 2610 // value of the `nextPageToken` result parameter from the previous 2611 // request. The value of `projectName` must be the same as in the 2612 // previous request. 2613 func (c *ProjectsSinksListCall) PageToken(pageToken string) *ProjectsSinksListCall { 2614 c.urlParams_.Set("pageToken", pageToken) 2615 return c 2616 } 2617 2618 // QuotaUser sets the optional parameter "quotaUser": Available to use 2619 // for quota purposes for server-side applications. Can be any arbitrary 2620 // string assigned to a user, but should not exceed 40 characters. 2621 func (c *ProjectsSinksListCall) QuotaUser(quotaUser string) *ProjectsSinksListCall { 2622 c.urlParams_.Set("quotaUser", quotaUser) 2623 return c 2624 } 2625 2626 // Fields allows partial responses to be retrieved. See 2627 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2628 // for more information. 2629 func (c *ProjectsSinksListCall) Fields(s ...googleapi.Field) *ProjectsSinksListCall { 2630 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2631 return c 2632 } 2633 2634 // IfNoneMatch sets the optional parameter which makes the operation 2635 // fail if the object's ETag matches the given value. This is useful for 2636 // getting updates only after the object has changed since the last 2637 // request. Use googleapi.IsNotModified to check whether the response 2638 // error from Do is the result of In-None-Match. 2639 func (c *ProjectsSinksListCall) IfNoneMatch(entityTag string) *ProjectsSinksListCall { 2640 c.ifNoneMatch_ = entityTag 2641 return c 2642 } 2643 2644 // Context sets the context to be used in this call's Do method. Any 2645 // pending HTTP request will be aborted if the provided context is 2646 // canceled. 2647 func (c *ProjectsSinksListCall) Context(ctx context.Context) *ProjectsSinksListCall { 2648 c.ctx_ = ctx 2649 return c 2650 } 2651 2652 func (c *ProjectsSinksListCall) doRequest(alt string) (*http.Response, error) { 2653 var body io.Reader = nil 2654 c.urlParams_.Set("alt", alt) 2655 urls := googleapi.ResolveRelative(c.s.BasePath, "v2beta1/{+projectName}/sinks") 2656 urls += "?" + c.urlParams_.Encode() 2657 req, _ := http.NewRequest("GET", urls, body) 2658 googleapi.Expand(req.URL, map[string]string{ 2659 "projectName": c.projectName, 2660 }) 2661 req.Header.Set("User-Agent", c.s.userAgent()) 2662 if c.ifNoneMatch_ != "" { 2663 req.Header.Set("If-None-Match", c.ifNoneMatch_) 2664 } 2665 if c.ctx_ != nil { 2666 return ctxhttp.Do(c.ctx_, c.s.client, req) 2667 } 2668 return c.s.client.Do(req) 2669 } 2670 2671 // Do executes the "logging.projects.sinks.list" call. 2672 // Exactly one of *ListSinksResponse or error will be non-nil. Any 2673 // non-2xx status code is an error. Response headers are in either 2674 // *ListSinksResponse.ServerResponse.Header or (if a response was 2675 // returned at all) in error.(*googleapi.Error).Header. Use 2676 // googleapi.IsNotModified to check whether the returned error was 2677 // because http.StatusNotModified was returned. 2678 func (c *ProjectsSinksListCall) Do() (*ListSinksResponse, error) { 2679 res, err := c.doRequest("json") 2680 if res != nil && res.StatusCode == http.StatusNotModified { 2681 if res.Body != nil { 2682 res.Body.Close() 2683 } 2684 return nil, &googleapi.Error{ 2685 Code: res.StatusCode, 2686 Header: res.Header, 2687 } 2688 } 2689 if err != nil { 2690 return nil, err 2691 } 2692 defer googleapi.CloseBody(res) 2693 if err := googleapi.CheckResponse(res); err != nil { 2694 return nil, err 2695 } 2696 ret := &ListSinksResponse{ 2697 ServerResponse: googleapi.ServerResponse{ 2698 Header: res.Header, 2699 HTTPStatusCode: res.StatusCode, 2700 }, 2701 } 2702 if err := json.NewDecoder(res.Body).Decode(&ret); err != nil { 2703 return nil, err 2704 } 2705 return ret, nil 2706 // { 2707 // "description": "Lists sinks.", 2708 // "httpMethod": "GET", 2709 // "id": "logging.projects.sinks.list", 2710 // "parameterOrder": [ 2711 // "projectName" 2712 // ], 2713 // "parameters": { 2714 // "pageSize": { 2715 // "description": "Optional. The maximum number of results to return from this request. Fewer results might be returned. You must check for the 'nextPageToken` result to determine if additional results are available, which you can retrieve by passing the `nextPageToken` value in the `pageToken` parameter to the next request.", 2716 // "format": "int32", 2717 // "location": "query", 2718 // "type": "integer" 2719 // }, 2720 // "pageToken": { 2721 // "description": "Optional. If the `pageToken` request parameter is supplied, then the next page of results in the set are retrieved. The `pageToken` parameter must be set with the value of the `nextPageToken` result parameter from the previous request. The value of `projectName` must be the same as in the previous request.", 2722 // "location": "query", 2723 // "type": "string" 2724 // }, 2725 // "projectName": { 2726 // "description": "Required. The resource name of the project owning the sinks. Example: `\"projects/my-logging-project\"`, `\"projects/01234567890\"`.", 2727 // "location": "path", 2728 // "pattern": "^projects/[^/]*$", 2729 // "required": true, 2730 // "type": "string" 2731 // } 2732 // }, 2733 // "path": "v2beta1/{+projectName}/sinks", 2734 // "response": { 2735 // "$ref": "ListSinksResponse" 2736 // }, 2737 // "scopes": [ 2738 // "https://www.googleapis.com/auth/cloud-platform", 2739 // "https://www.googleapis.com/auth/cloud-platform.read-only", 2740 // "https://www.googleapis.com/auth/logging.admin", 2741 // "https://www.googleapis.com/auth/logging.read" 2742 // ] 2743 // } 2744 2745 } 2746 2747 // method id "logging.projects.sinks.update": 2748 2749 type ProjectsSinksUpdateCall struct { 2750 s *Service 2751 sinkName string 2752 logsink *LogSink 2753 urlParams_ gensupport.URLParams 2754 ctx_ context.Context 2755 } 2756 2757 // Update: Creates or updates a sink. 2758 func (r *ProjectsSinksService) Update(sinkName string, logsink *LogSink) *ProjectsSinksUpdateCall { 2759 c := &ProjectsSinksUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2760 c.sinkName = sinkName 2761 c.logsink = logsink 2762 return c 2763 } 2764 2765 // QuotaUser sets the optional parameter "quotaUser": Available to use 2766 // for quota purposes for server-side applications. Can be any arbitrary 2767 // string assigned to a user, but should not exceed 40 characters. 2768 func (c *ProjectsSinksUpdateCall) QuotaUser(quotaUser string) *ProjectsSinksUpdateCall { 2769 c.urlParams_.Set("quotaUser", quotaUser) 2770 return c 2771 } 2772 2773 // Fields allows partial responses to be retrieved. See 2774 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2775 // for more information. 2776 func (c *ProjectsSinksUpdateCall) Fields(s ...googleapi.Field) *ProjectsSinksUpdateCall { 2777 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2778 return c 2779 } 2780 2781 // Context sets the context to be used in this call's Do method. Any 2782 // pending HTTP request will be aborted if the provided context is 2783 // canceled. 2784 func (c *ProjectsSinksUpdateCall) Context(ctx context.Context) *ProjectsSinksUpdateCall { 2785 c.ctx_ = ctx 2786 return c 2787 } 2788 2789 func (c *ProjectsSinksUpdateCall) doRequest(alt string) (*http.Response, error) { 2790 var body io.Reader = nil 2791 body, err := googleapi.WithoutDataWrapper.JSONReader(c.logsink) 2792 if err != nil { 2793 return nil, err 2794 } 2795 ctype := "application/json" 2796 c.urlParams_.Set("alt", alt) 2797 urls := googleapi.ResolveRelative(c.s.BasePath, "v2beta1/{+sinkName}") 2798 urls += "?" + c.urlParams_.Encode() 2799 req, _ := http.NewRequest("PUT", urls, body) 2800 googleapi.Expand(req.URL, map[string]string{ 2801 "sinkName": c.sinkName, 2802 }) 2803 req.Header.Set("Content-Type", ctype) 2804 req.Header.Set("User-Agent", c.s.userAgent()) 2805 if c.ctx_ != nil { 2806 return ctxhttp.Do(c.ctx_, c.s.client, req) 2807 } 2808 return c.s.client.Do(req) 2809 } 2810 2811 // Do executes the "logging.projects.sinks.update" call. 2812 // Exactly one of *LogSink or error will be non-nil. Any non-2xx status 2813 // code is an error. Response headers are in either 2814 // *LogSink.ServerResponse.Header or (if a response was returned at all) 2815 // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 2816 // check whether the returned error was because http.StatusNotModified 2817 // was returned. 2818 func (c *ProjectsSinksUpdateCall) Do() (*LogSink, error) { 2819 res, err := c.doRequest("json") 2820 if res != nil && res.StatusCode == http.StatusNotModified { 2821 if res.Body != nil { 2822 res.Body.Close() 2823 } 2824 return nil, &googleapi.Error{ 2825 Code: res.StatusCode, 2826 Header: res.Header, 2827 } 2828 } 2829 if err != nil { 2830 return nil, err 2831 } 2832 defer googleapi.CloseBody(res) 2833 if err := googleapi.CheckResponse(res); err != nil { 2834 return nil, err 2835 } 2836 ret := &LogSink{ 2837 ServerResponse: googleapi.ServerResponse{ 2838 Header: res.Header, 2839 HTTPStatusCode: res.StatusCode, 2840 }, 2841 } 2842 if err := json.NewDecoder(res.Body).Decode(&ret); err != nil { 2843 return nil, err 2844 } 2845 return ret, nil 2846 // { 2847 // "description": "Creates or updates a sink.", 2848 // "httpMethod": "PUT", 2849 // "id": "logging.projects.sinks.update", 2850 // "parameterOrder": [ 2851 // "sinkName" 2852 // ], 2853 // "parameters": { 2854 // "sinkName": { 2855 // "description": "The resource name of the sink to update. Example: `\"projects/my-project-id/sinks/my-sink-id\"`. The updated sink must be provided in the request and have the same name that is specified in `sinkName`. If the sink does not exist, it is created.", 2856 // "location": "path", 2857 // "pattern": "^projects/[^/]*/sinks/[^/]*$", 2858 // "required": true, 2859 // "type": "string" 2860 // } 2861 // }, 2862 // "path": "v2beta1/{+sinkName}", 2863 // "request": { 2864 // "$ref": "LogSink" 2865 // }, 2866 // "response": { 2867 // "$ref": "LogSink" 2868 // }, 2869 // "scopes": [ 2870 // "https://www.googleapis.com/auth/cloud-platform", 2871 // "https://www.googleapis.com/auth/logging.admin" 2872 // ] 2873 // } 2874 2875 }