1// Copyright YEAR Google LLC. 2// Use of this source code is governed by a BSD-style 3// license that can be found in the LICENSE file. 4 5// Code generated file. DO NOT EDIT. 6 7// Package logging provides access to the Google Cloud Logging API. 8// 9// This package is DEPRECATED. Use package cloud.google.com/go/logging instead. 10// 11// Creating a client 12// 13// Usage example: 14// 15// import "google.golang.org/api/logging/v1beta3" 16// ... 17// ctx := context.Background() 18// loggingService, err := logging.NewService(ctx) 19// 20// In this example, Google Application Default Credentials are used for authentication. 21// 22// For information on how to create and obtain Application Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials. 23// 24// Other authentication options 25// 26// To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey: 27// 28// loggingService, err := logging.NewService(ctx, option.WithAPIKey("AIza...")) 29// 30// To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource: 31// 32// config := &oauth2.Config{...} 33// // ... 34// token, err := config.Exchange(ctx, ...) 35// loggingService, err := logging.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token))) 36// 37// See https://godoc.org/google.golang.org/api/option/ for details on options. 38package logging // import "google.golang.org/api/logging/v1beta3" 39 40import ( 41 "bytes" 42 "context" 43 "encoding/json" 44 "errors" 45 "fmt" 46 "io" 47 "net/http" 48 "net/url" 49 "strconv" 50 "strings" 51 52 googleapi "google.golang.org/api/googleapi" 53 gensupport "google.golang.org/api/internal/gensupport" 54 option "google.golang.org/api/option" 55 internaloption "google.golang.org/api/option/internaloption" 56 htransport "google.golang.org/api/transport/http" 57) 58 59// Always reference these packages, just in case the auto-generated code 60// below doesn't. 61var _ = bytes.NewBuffer 62var _ = strconv.Itoa 63var _ = fmt.Sprintf 64var _ = json.NewDecoder 65var _ = io.Copy 66var _ = url.Parse 67var _ = gensupport.MarshalJSON 68var _ = googleapi.Version 69var _ = errors.New 70var _ = strings.Replace 71var _ = context.Canceled 72var _ = internaloption.WithDefaultEndpoint 73 74const apiId = "logging:v1beta3" 75const apiName = "logging" 76const apiVersion = "v1beta3" 77const basePath = "https://logging.googleapis.com/" 78 79// OAuth2 scopes used by this API. 80const ( 81 // View and manage your data across Google Cloud Platform services 82 CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform" 83) 84 85// NewService creates a new Service. 86func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) { 87 scopesOption := option.WithScopes( 88 "https://www.googleapis.com/auth/cloud-platform", 89 ) 90 // NOTE: prepend, so we don't override user-specified scopes. 91 opts = append([]option.ClientOption{scopesOption}, opts...) 92 opts = append(opts, internaloption.WithDefaultEndpoint(basePath)) 93 client, endpoint, err := htransport.NewClient(ctx, opts...) 94 if err != nil { 95 return nil, err 96 } 97 s, err := New(client) 98 if err != nil { 99 return nil, err 100 } 101 if endpoint != "" { 102 s.BasePath = endpoint 103 } 104 return s, nil 105} 106 107// New creates a new Service. It uses the provided http.Client for requests. 108// 109// Deprecated: please use NewService instead. 110// To provide a custom HTTP client, use option.WithHTTPClient. 111// If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead. 112func New(client *http.Client) (*Service, error) { 113 if client == nil { 114 return nil, errors.New("client is nil") 115 } 116 s := &Service{client: client, BasePath: basePath} 117 s.Projects = NewProjectsService(s) 118 return s, nil 119} 120 121type Service struct { 122 client *http.Client 123 BasePath string // API endpoint base URL 124 UserAgent string // optional additional User-Agent fragment 125 126 Projects *ProjectsService 127} 128 129func (s *Service) userAgent() string { 130 if s.UserAgent == "" { 131 return googleapi.UserAgent 132 } 133 return googleapi.UserAgent + " " + s.UserAgent 134} 135 136func NewProjectsService(s *Service) *ProjectsService { 137 rs := &ProjectsService{s: s} 138 rs.LogServices = NewProjectsLogServicesService(s) 139 rs.Logs = NewProjectsLogsService(s) 140 return rs 141} 142 143type ProjectsService struct { 144 s *Service 145 146 LogServices *ProjectsLogServicesService 147 148 Logs *ProjectsLogsService 149} 150 151func NewProjectsLogServicesService(s *Service) *ProjectsLogServicesService { 152 rs := &ProjectsLogServicesService{s: s} 153 rs.Indexes = NewProjectsLogServicesIndexesService(s) 154 rs.Sinks = NewProjectsLogServicesSinksService(s) 155 return rs 156} 157 158type ProjectsLogServicesService struct { 159 s *Service 160 161 Indexes *ProjectsLogServicesIndexesService 162 163 Sinks *ProjectsLogServicesSinksService 164} 165 166func NewProjectsLogServicesIndexesService(s *Service) *ProjectsLogServicesIndexesService { 167 rs := &ProjectsLogServicesIndexesService{s: s} 168 return rs 169} 170 171type ProjectsLogServicesIndexesService struct { 172 s *Service 173} 174 175func NewProjectsLogServicesSinksService(s *Service) *ProjectsLogServicesSinksService { 176 rs := &ProjectsLogServicesSinksService{s: s} 177 return rs 178} 179 180type ProjectsLogServicesSinksService struct { 181 s *Service 182} 183 184func NewProjectsLogsService(s *Service) *ProjectsLogsService { 185 rs := &ProjectsLogsService{s: s} 186 rs.Entries = NewProjectsLogsEntriesService(s) 187 rs.Sinks = NewProjectsLogsSinksService(s) 188 return rs 189} 190 191type ProjectsLogsService struct { 192 s *Service 193 194 Entries *ProjectsLogsEntriesService 195 196 Sinks *ProjectsLogsSinksService 197} 198 199func NewProjectsLogsEntriesService(s *Service) *ProjectsLogsEntriesService { 200 rs := &ProjectsLogsEntriesService{s: s} 201 return rs 202} 203 204type ProjectsLogsEntriesService struct { 205 s *Service 206} 207 208func NewProjectsLogsSinksService(s *Service) *ProjectsLogsSinksService { 209 rs := &ProjectsLogsSinksService{s: s} 210 return rs 211} 212 213type ProjectsLogsSinksService struct { 214 s *Service 215} 216 217// Empty: A generic empty message that you can re-use to avoid defining 218// duplicated empty messages in your APIs. A typical example is to use 219// it as the request or the response type of an API method. For 220// instance: service Foo { rpc Bar(google.protobuf.Empty) returns 221// (google.protobuf.Empty); } 222type Empty struct { 223 // ServerResponse contains the HTTP response code and headers from the 224 // server. 225 googleapi.ServerResponse `json:"-"` 226} 227 228// ListLogServiceIndexesResponse: Result returned from 229// ListLogServiceIndexesRequest. 230type ListLogServiceIndexesResponse struct { 231 // NextPageToken: If there are more results, then `nextPageToken` is 232 // returned in the response. To get the next batch of indexes, use the 233 // value of `nextPageToken` as `pageToken` in the next call of 234 // `ListLogServiceIndexess`. If `nextPageToken` is empty, then there are 235 // no more results. 236 NextPageToken string `json:"nextPageToken,omitempty"` 237 238 // ServiceIndexPrefixes: A list of log service index prefixes. 239 ServiceIndexPrefixes []string `json:"serviceIndexPrefixes,omitempty"` 240 241 // ServerResponse contains the HTTP response code and headers from the 242 // server. 243 googleapi.ServerResponse `json:"-"` 244 245 // ForceSendFields is a list of field names (e.g. "NextPageToken") to 246 // unconditionally include in API requests. By default, fields with 247 // empty values are omitted from API requests. However, any non-pointer, 248 // non-interface field appearing in ForceSendFields will be sent to the 249 // server regardless of whether the field is empty or not. This may be 250 // used to include empty fields in Patch requests. 251 ForceSendFields []string `json:"-"` 252 253 // NullFields is a list of field names (e.g. "NextPageToken") to include 254 // in API requests with the JSON null value. By default, fields with 255 // empty values are omitted from API requests. However, any field with 256 // an empty value appearing in NullFields will be sent to the server as 257 // null. It is an error if a field in this list has a non-empty value. 258 // This may be used to include null fields in Patch requests. 259 NullFields []string `json:"-"` 260} 261 262func (s *ListLogServiceIndexesResponse) MarshalJSON() ([]byte, error) { 263 type NoMethod ListLogServiceIndexesResponse 264 raw := NoMethod(*s) 265 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 266} 267 268// ListLogServiceSinksResponse: Result returned from 269// `ListLogServiceSinks`. 270type ListLogServiceSinksResponse struct { 271 // Sinks: The requested log service sinks. If any of the returned 272 // `LogSink` objects have an empty `destination` field, then call 273 // `logServices.sinks.get` to retrieve the complete `LogSink` object. 274 Sinks []*LogSink `json:"sinks,omitempty"` 275 276 // ServerResponse contains the HTTP response code and headers from the 277 // server. 278 googleapi.ServerResponse `json:"-"` 279 280 // ForceSendFields is a list of field names (e.g. "Sinks") to 281 // unconditionally include in API requests. By default, fields with 282 // empty values are omitted from API requests. However, any non-pointer, 283 // non-interface field appearing in ForceSendFields will be sent to the 284 // server regardless of whether the field is empty or not. This may be 285 // used to include empty fields in Patch requests. 286 ForceSendFields []string `json:"-"` 287 288 // NullFields is a list of field names (e.g. "Sinks") to include in API 289 // requests with the JSON null value. By default, fields with empty 290 // values are omitted from API requests. However, any field with an 291 // empty value appearing in NullFields will be sent to the server as 292 // null. It is an error if a field in this list has a non-empty value. 293 // This may be used to include null fields in Patch requests. 294 NullFields []string `json:"-"` 295} 296 297func (s *ListLogServiceSinksResponse) MarshalJSON() ([]byte, error) { 298 type NoMethod ListLogServiceSinksResponse 299 raw := NoMethod(*s) 300 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 301} 302 303// ListLogServicesResponse: Result returned from 304// `ListLogServicesRequest`. 305type ListLogServicesResponse struct { 306 // LogServices: A list of log services. 307 LogServices []*LogService `json:"logServices,omitempty"` 308 309 // NextPageToken: If there are more results, then `nextPageToken` is 310 // returned in the response. To get the next batch of services, use the 311 // value of `nextPageToken` as `pageToken` in the next call of 312 // `ListLogServices`. If `nextPageToken` is empty, then there are no 313 // more results. 314 NextPageToken string `json:"nextPageToken,omitempty"` 315 316 // ServerResponse contains the HTTP response code and headers from the 317 // server. 318 googleapi.ServerResponse `json:"-"` 319 320 // ForceSendFields is a list of field names (e.g. "LogServices") to 321 // unconditionally include in API requests. By default, fields with 322 // empty values are omitted from API requests. However, any non-pointer, 323 // non-interface field appearing in ForceSendFields will be sent to the 324 // server regardless of whether the field is empty or not. This may be 325 // used to include empty fields in Patch requests. 326 ForceSendFields []string `json:"-"` 327 328 // NullFields is a list of field names (e.g. "LogServices") to include 329 // in API requests with the JSON null value. By default, fields with 330 // empty values are omitted from API requests. However, any field with 331 // an empty value appearing in NullFields will be sent to the server as 332 // null. It is an error if a field in this list has a non-empty value. 333 // This may be used to include null fields in Patch requests. 334 NullFields []string `json:"-"` 335} 336 337func (s *ListLogServicesResponse) MarshalJSON() ([]byte, error) { 338 type NoMethod ListLogServicesResponse 339 raw := NoMethod(*s) 340 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 341} 342 343// ListLogSinksResponse: Result returned from `ListLogSinks`. 344type ListLogSinksResponse struct { 345 // Sinks: The requested log sinks. If any of the returned `LogSink` 346 // objects have an empty `destination` field, then call 347 // `logServices.sinks.get` to retrieve the complete `LogSink` object. 348 Sinks []*LogSink `json:"sinks,omitempty"` 349 350 // ServerResponse contains the HTTP response code and headers from the 351 // server. 352 googleapi.ServerResponse `json:"-"` 353 354 // ForceSendFields is a list of field names (e.g. "Sinks") to 355 // unconditionally include in API requests. By default, fields with 356 // empty values are omitted from API requests. However, any non-pointer, 357 // non-interface field appearing in ForceSendFields will be sent to the 358 // server regardless of whether the field is empty or not. This may be 359 // used to include empty fields in Patch requests. 360 ForceSendFields []string `json:"-"` 361 362 // NullFields is a list of field names (e.g. "Sinks") to include in API 363 // requests with the JSON null value. By default, fields with empty 364 // values are omitted from API requests. However, any field with an 365 // empty value appearing in NullFields will be sent to the server as 366 // null. It is an error if a field in this list has a non-empty value. 367 // This may be used to include null fields in Patch requests. 368 NullFields []string `json:"-"` 369} 370 371func (s *ListLogSinksResponse) MarshalJSON() ([]byte, error) { 372 type NoMethod ListLogSinksResponse 373 raw := NoMethod(*s) 374 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 375} 376 377// ListLogsResponse: Result returned from ListLogs. 378type ListLogsResponse struct { 379 // Logs: A list of log resources. 380 Logs []*Log `json:"logs,omitempty"` 381 382 // NextPageToken: If there are more results, then `nextPageToken` is 383 // returned in the response. To get the next batch of logs, use the 384 // value of `nextPageToken` as `pageToken` in the next call of 385 // `ListLogs`. If `nextPageToken` is empty, then there are no more 386 // results. 387 NextPageToken string `json:"nextPageToken,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. "Logs") 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 // NullFields is a list of field names (e.g. "Logs") to include in API 402 // requests with the JSON null value. By default, fields with empty 403 // values are omitted from API requests. However, any field with an 404 // empty value appearing in NullFields will be sent to the server as 405 // null. It is an error if a field in this list has a non-empty value. 406 // This may be used to include null fields in Patch requests. 407 NullFields []string `json:"-"` 408} 409 410func (s *ListLogsResponse) MarshalJSON() ([]byte, error) { 411 type NoMethod ListLogsResponse 412 raw := NoMethod(*s) 413 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 414} 415 416// Log: A log object. 417type Log struct { 418 // DisplayName: Name used when displaying the log to the user (for 419 // example, in a UI). Example: "activity_log" 420 DisplayName string `json:"displayName,omitempty"` 421 422 // Name: REQUIRED: The log's name name. Example: 423 // "compute.googleapis.com/activity_log". 424 Name string `json:"name,omitempty"` 425 426 // PayloadType: Type URL describing the expected payload type for the 427 // log. 428 PayloadType string `json:"payloadType,omitempty"` 429 430 // ForceSendFields is a list of field names (e.g. "DisplayName") to 431 // unconditionally include in API requests. By default, fields with 432 // empty values are omitted from API requests. However, any non-pointer, 433 // non-interface field appearing in ForceSendFields will be sent to the 434 // server regardless of whether the field is empty or not. This may be 435 // used to include empty fields in Patch requests. 436 ForceSendFields []string `json:"-"` 437 438 // NullFields is a list of field names (e.g. "DisplayName") to include 439 // in API requests with the JSON null value. By default, fields with 440 // empty values are omitted from API requests. However, any field with 441 // an empty value appearing in NullFields will be sent to the server as 442 // null. It is an error if a field in this list has a non-empty value. 443 // This may be used to include null fields in Patch requests. 444 NullFields []string `json:"-"` 445} 446 447func (s *Log) MarshalJSON() ([]byte, error) { 448 type NoMethod Log 449 raw := NoMethod(*s) 450 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 451} 452 453// LogEntry: An individual entry in a log. 454type LogEntry struct { 455 // InsertId: A unique ID for the log entry. If you provide this field, 456 // the logging service considers other log entries in the same log with 457 // the same ID as duplicates which can be removed. 458 InsertId string `json:"insertId,omitempty"` 459 460 // Log: The log to which this entry belongs. When a log entry is 461 // ingested, the value of this field is set by the logging system. 462 Log string `json:"log,omitempty"` 463 464 // Metadata: Information about the log entry. 465 Metadata *LogEntryMetadata `json:"metadata,omitempty"` 466 467 // ProtoPayload: The log entry payload, represented as a protocol buffer 468 // that is expressed as a JSON object. You can only pass `protoPayload` 469 // values that belong to a set of approved types. 470 ProtoPayload googleapi.RawMessage `json:"protoPayload,omitempty"` 471 472 // StructPayload: The log entry payload, represented as a structure that 473 // is expressed as a JSON object. 474 StructPayload googleapi.RawMessage `json:"structPayload,omitempty"` 475 476 // TextPayload: The log entry payload, represented as a text string. 477 TextPayload string `json:"textPayload,omitempty"` 478 479 // ForceSendFields is a list of field names (e.g. "InsertId") to 480 // unconditionally include in API requests. By default, fields with 481 // empty values are omitted from API requests. However, any non-pointer, 482 // non-interface field appearing in ForceSendFields will be sent to the 483 // server regardless of whether the field is empty or not. This may be 484 // used to include empty fields in Patch requests. 485 ForceSendFields []string `json:"-"` 486 487 // NullFields is a list of field names (e.g. "InsertId") to include in 488 // API requests with the JSON null value. By default, fields with empty 489 // values are omitted from API requests. However, any field with an 490 // empty value appearing in NullFields will be sent to the server as 491 // null. It is an error if a field in this list has a non-empty value. 492 // This may be used to include null fields in Patch requests. 493 NullFields []string `json:"-"` 494} 495 496func (s *LogEntry) MarshalJSON() ([]byte, error) { 497 type NoMethod LogEntry 498 raw := NoMethod(*s) 499 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 500} 501 502// LogEntryMetadata: Additional data that is associated with a log 503// entry, set by the service creating the log entry. 504type LogEntryMetadata struct { 505 // Labels: A set of (key, value) data that provides additional 506 // information about the log entry. If the log entry is from one of the 507 // Google Cloud Platform sources listed below, the indicated (key, 508 // value) information must be provided: Google App Engine, service_name 509 // `appengine.googleapis.com`: "appengine.googleapis.com/module_id", 510 // "appengine.googleapis.com/version_id", and one of: 511 // "appengine.googleapis.com/replica_index", 512 // "appengine.googleapis.com/clone_id", or else provide the following 513 // Compute Engine labels: Google Compute Engine, service_name 514 // `compute.googleapis.com`: "compute.googleapis.com/resource_type", 515 // "instance" "compute.googleapis.com/resource_id", 516 Labels map[string]string `json:"labels,omitempty"` 517 518 // ProjectId: The project ID of the Google Cloud Platform service that 519 // created the log entry. 520 ProjectId string `json:"projectId,omitempty"` 521 522 // Region: The region name of the Google Cloud Platform service that 523 // created the log entry. For example, "us-central1". 524 Region string `json:"region,omitempty"` 525 526 // ServiceName: The API name of the Google Cloud Platform service that 527 // created the log entry. For example, "compute.googleapis.com". 528 ServiceName string `json:"serviceName,omitempty"` 529 530 // Severity: The severity of the log entry. 531 // 532 // Possible values: 533 // "DEFAULT" - This is the DEFAULT description 534 // "DEBUG" - This is the DEBUG description 535 // "INFO" - This is the INFO description 536 // "NOTICE" - This is the NOTICE description 537 // "WARNING" - This is the WARNING description 538 // "ERROR" - This is the ERROR description 539 // "CRITICAL" - This is the CRITICAL description 540 // "ALERT" - This is the ALERT description 541 // "EMERGENCY" (default) - This is the EMERGENCY description 542 Severity string `json:"severity,omitempty"` 543 544 // Timestamp: The time the event described by the log entry occurred. 545 // Timestamps must be later than January 1, 1970. 546 Timestamp string `json:"timestamp,omitempty"` 547 548 // UserId: The fully-qualified email address of the authenticated user 549 // that performed or requested the action represented by the log entry. 550 // If the log entry does not apply to an action taken by an 551 // authenticated user, then the field should be empty. 552 UserId string `json:"userId,omitempty"` 553 554 // Zone: The zone of the Google Cloud Platform service that created the 555 // log entry. For example, "us-central1-a". 556 Zone string `json:"zone,omitempty"` 557 558 // ForceSendFields is a list of field names (e.g. "Labels") to 559 // unconditionally include in API requests. By default, fields with 560 // empty values are omitted from API requests. However, any non-pointer, 561 // non-interface field appearing in ForceSendFields will be sent to the 562 // server regardless of whether the field is empty or not. This may be 563 // used to include empty fields in Patch requests. 564 ForceSendFields []string `json:"-"` 565 566 // NullFields is a list of field names (e.g. "Labels") to include in API 567 // requests with the JSON null value. By default, fields with empty 568 // values are omitted from API requests. However, any field with an 569 // empty value appearing in NullFields will be sent to the server as 570 // null. It is an error if a field in this list has a non-empty value. 571 // This may be used to include null fields in Patch requests. 572 NullFields []string `json:"-"` 573} 574 575func (s *LogEntryMetadata) MarshalJSON() ([]byte, error) { 576 type NoMethod LogEntryMetadata 577 raw := NoMethod(*s) 578 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 579} 580 581// LogError: A problem in a sink or the sink's configuration. 582type LogError struct { 583 // Resource: The resource associated with the error. It may be different 584 // from the sink destination. For example, the sink may point to a 585 // BigQuery dataset, but the error may refer to a table resource inside 586 // the dataset. 587 Resource string `json:"resource,omitempty"` 588 589 // Status: The description of the last error observed. 590 Status *Status `json:"status,omitempty"` 591 592 // TimeNanos: The last time the error was observed, in nanoseconds since 593 // the Unix epoch. 594 TimeNanos int64 `json:"timeNanos,omitempty,string"` 595 596 // ForceSendFields is a list of field names (e.g. "Resource") to 597 // unconditionally include in API requests. By default, fields with 598 // empty values are omitted from API requests. However, any non-pointer, 599 // non-interface field appearing in ForceSendFields will be sent to the 600 // server regardless of whether the field is empty or not. This may be 601 // used to include empty fields in Patch requests. 602 ForceSendFields []string `json:"-"` 603 604 // NullFields is a list of field names (e.g. "Resource") to include in 605 // API requests with the JSON null value. By default, fields with empty 606 // values are omitted from API requests. However, any field with an 607 // empty value appearing in NullFields will be sent to the server as 608 // null. It is an error if a field in this list has a non-empty value. 609 // This may be used to include null fields in Patch requests. 610 NullFields []string `json:"-"` 611} 612 613func (s *LogError) MarshalJSON() ([]byte, error) { 614 type NoMethod LogError 615 raw := NoMethod(*s) 616 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 617} 618 619// LogService: A log service object. 620type LogService struct { 621 // IndexKeys: Label keys used when labeling log entries for this 622 // service. The order of the keys is significant, with higher priority 623 // keys coming earlier in the list. 624 IndexKeys []string `json:"indexKeys,omitempty"` 625 626 // Name: The service's name. 627 Name string `json:"name,omitempty"` 628 629 // ForceSendFields is a list of field names (e.g. "IndexKeys") to 630 // unconditionally include in API requests. By default, fields with 631 // empty values are omitted from API requests. However, any non-pointer, 632 // non-interface field appearing in ForceSendFields will be sent to the 633 // server regardless of whether the field is empty or not. This may be 634 // used to include empty fields in Patch requests. 635 ForceSendFields []string `json:"-"` 636 637 // NullFields is a list of field names (e.g. "IndexKeys") to include in 638 // API requests with the JSON null value. By default, fields with empty 639 // values are omitted from API requests. However, any field with an 640 // empty value appearing in NullFields will be sent to the server as 641 // null. It is an error if a field in this list has a non-empty value. 642 // This may be used to include null fields in Patch requests. 643 NullFields []string `json:"-"` 644} 645 646func (s *LogService) MarshalJSON() ([]byte, error) { 647 type NoMethod LogService 648 raw := NoMethod(*s) 649 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 650} 651 652// LogSink: An object that describes where a log may be written. 653type LogSink struct { 654 // Destination: The resource to send log entries to. The supported sink 655 // resource types are: + Google Cloud Storage: 656 // `storage.googleapis.com/BUCKET` or `BUCKET.storage.googleapis.com/` + 657 // Google BigQuery: 658 // `bigquery.googleapis.com/projects/PROJECT/datasets/DATASET` Currently 659 // the Cloud Logging API supports at most one sink for each resource 660 // type per log or log service resource. 661 Destination string `json:"destination,omitempty"` 662 663 // Errors: _Output only._ All active errors found for this sink. 664 Errors []*LogError `json:"errors,omitempty"` 665 666 // Name: The name of this sink. This is a client-assigned identifier for 667 // the resource. This is ignored by UpdateLogSink and 668 // UpdateLogServicesSink. 669 Name string `json:"name,omitempty"` 670 671 // ServerResponse contains the HTTP response code and headers from the 672 // server. 673 googleapi.ServerResponse `json:"-"` 674 675 // ForceSendFields is a list of field names (e.g. "Destination") to 676 // unconditionally include in API requests. By default, fields with 677 // empty values are omitted from API requests. However, any non-pointer, 678 // non-interface field appearing in ForceSendFields will be sent to the 679 // server regardless of whether the field is empty or not. This may be 680 // used to include empty fields in Patch requests. 681 ForceSendFields []string `json:"-"` 682 683 // NullFields is a list of field names (e.g. "Destination") to include 684 // in API requests with the JSON null value. By default, fields with 685 // empty values are omitted from API requests. However, any field with 686 // an empty value appearing in NullFields will be sent to the server as 687 // null. It is an error if a field in this list has a non-empty value. 688 // This may be used to include null fields in Patch requests. 689 NullFields []string `json:"-"` 690} 691 692func (s *LogSink) MarshalJSON() ([]byte, error) { 693 type NoMethod LogSink 694 raw := NoMethod(*s) 695 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 696} 697 698// Status: Represents the RPC error status for Google APIs. See 699// http://go/errormodel for details. 700type Status struct { 701 // Code: The status code, which should be an enum value of 702 // [google.rpc.Code][]. 703 Code int64 `json:"code,omitempty"` 704 705 // Details: A list of messages that carry the error details. There will 706 // be a common set of message types for APIs to use. 707 Details []googleapi.RawMessage `json:"details,omitempty"` 708 709 // Message: A developer-facing error message, which should be in 710 // English. The user-facing error message should be localized and stored 711 // in the [google.rpc.Status.details][google.rpc.Status.details] field. 712 Message string `json:"message,omitempty"` 713 714 // ForceSendFields is a list of field names (e.g. "Code") to 715 // unconditionally include in API requests. By default, fields with 716 // empty values are omitted from API requests. However, any non-pointer, 717 // non-interface field appearing in ForceSendFields will be sent to the 718 // server regardless of whether the field is empty or not. This may be 719 // used to include empty fields in Patch requests. 720 ForceSendFields []string `json:"-"` 721 722 // NullFields is a list of field names (e.g. "Code") to include in API 723 // requests with the JSON null value. By default, fields with empty 724 // values are omitted from API requests. However, any field with an 725 // empty value appearing in NullFields will be sent to the server as 726 // null. It is an error if a field in this list has a non-empty value. 727 // This may be used to include null fields in Patch requests. 728 NullFields []string `json:"-"` 729} 730 731func (s *Status) MarshalJSON() ([]byte, error) { 732 type NoMethod Status 733 raw := NoMethod(*s) 734 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 735} 736 737// WriteLogEntriesRequest: The parameters to WriteLogEntries. 738type WriteLogEntriesRequest struct { 739 // CommonLabels: Metadata labels that apply to all entries in this 740 // request. If one of the log entries contains a (key, value) with the 741 // same key that is in `commonLabels`, then the entry's (key, value) 742 // overrides the one in `commonLabels`. 743 CommonLabels map[string]string `json:"commonLabels,omitempty"` 744 745 // Entries: Log entries to insert. 746 Entries []*LogEntry `json:"entries,omitempty"` 747 748 // ForceSendFields is a list of field names (e.g. "CommonLabels") to 749 // unconditionally include in API requests. By default, fields with 750 // empty values are omitted from API requests. However, any non-pointer, 751 // non-interface field appearing in ForceSendFields will be sent to the 752 // server regardless of whether the field is empty or not. This may be 753 // used to include empty fields in Patch requests. 754 ForceSendFields []string `json:"-"` 755 756 // NullFields is a list of field names (e.g. "CommonLabels") to include 757 // in API requests with the JSON null value. By default, fields with 758 // empty values are omitted from API requests. However, any field with 759 // an empty value appearing in NullFields will be sent to the server as 760 // null. It is an error if a field in this list has a non-empty value. 761 // This may be used to include null fields in Patch requests. 762 NullFields []string `json:"-"` 763} 764 765func (s *WriteLogEntriesRequest) MarshalJSON() ([]byte, error) { 766 type NoMethod WriteLogEntriesRequest 767 raw := NoMethod(*s) 768 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 769} 770 771// WriteLogEntriesResponse: Result returned from WriteLogEntries. empty 772type WriteLogEntriesResponse struct { 773 // ServerResponse contains the HTTP response code and headers from the 774 // server. 775 googleapi.ServerResponse `json:"-"` 776} 777 778// method id "logging.projects.logServices.list": 779 780type ProjectsLogServicesListCall struct { 781 s *Service 782 projectsId string 783 urlParams_ gensupport.URLParams 784 ifNoneMatch_ string 785 ctx_ context.Context 786 header_ http.Header 787} 788 789// List: Lists log services associated with log entries ingested for a 790// project. 791func (r *ProjectsLogServicesService) List(projectsId string) *ProjectsLogServicesListCall { 792 c := &ProjectsLogServicesListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 793 c.projectsId = projectsId 794 return c 795} 796 797// Log sets the optional parameter "log": The name of the log resource 798// whose services are to be listed. log for which to list services. When 799// empty, all services are listed. 800func (c *ProjectsLogServicesListCall) Log(log string) *ProjectsLogServicesListCall { 801 c.urlParams_.Set("log", log) 802 return c 803} 804 805// PageSize sets the optional parameter "pageSize": The maximum number 806// of `LogService` objects to return in one operation. 807func (c *ProjectsLogServicesListCall) PageSize(pageSize int64) *ProjectsLogServicesListCall { 808 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 809 return c 810} 811 812// PageToken sets the optional parameter "pageToken": An opaque token, 813// returned as `nextPageToken` by a prior `ListLogServices` operation. 814// If `pageToken` is supplied, then the other fields of this request are 815// ignored, and instead the previous `ListLogServices` operation is 816// continued. 817func (c *ProjectsLogServicesListCall) PageToken(pageToken string) *ProjectsLogServicesListCall { 818 c.urlParams_.Set("pageToken", pageToken) 819 return c 820} 821 822// Fields allows partial responses to be retrieved. See 823// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 824// for more information. 825func (c *ProjectsLogServicesListCall) Fields(s ...googleapi.Field) *ProjectsLogServicesListCall { 826 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 827 return c 828} 829 830// IfNoneMatch sets the optional parameter which makes the operation 831// fail if the object's ETag matches the given value. This is useful for 832// getting updates only after the object has changed since the last 833// request. Use googleapi.IsNotModified to check whether the response 834// error from Do is the result of In-None-Match. 835func (c *ProjectsLogServicesListCall) IfNoneMatch(entityTag string) *ProjectsLogServicesListCall { 836 c.ifNoneMatch_ = entityTag 837 return c 838} 839 840// Context sets the context to be used in this call's Do method. Any 841// pending HTTP request will be aborted if the provided context is 842// canceled. 843func (c *ProjectsLogServicesListCall) Context(ctx context.Context) *ProjectsLogServicesListCall { 844 c.ctx_ = ctx 845 return c 846} 847 848// Header returns an http.Header that can be modified by the caller to 849// add HTTP headers to the request. 850func (c *ProjectsLogServicesListCall) Header() http.Header { 851 if c.header_ == nil { 852 c.header_ = make(http.Header) 853 } 854 return c.header_ 855} 856 857func (c *ProjectsLogServicesListCall) doRequest(alt string) (*http.Response, error) { 858 reqHeaders := make(http.Header) 859 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/00000000") 860 for k, v := range c.header_ { 861 reqHeaders[k] = v 862 } 863 reqHeaders.Set("User-Agent", c.s.userAgent()) 864 if c.ifNoneMatch_ != "" { 865 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 866 } 867 var body io.Reader = nil 868 c.urlParams_.Set("alt", alt) 869 c.urlParams_.Set("prettyPrint", "false") 870 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta3/projects/{projectsId}/logServices") 871 urls += "?" + c.urlParams_.Encode() 872 req, err := http.NewRequest("GET", urls, body) 873 if err != nil { 874 return nil, err 875 } 876 req.Header = reqHeaders 877 googleapi.Expand(req.URL, map[string]string{ 878 "projectsId": c.projectsId, 879 }) 880 return gensupport.SendRequest(c.ctx_, c.s.client, req) 881} 882 883// Do executes the "logging.projects.logServices.list" call. 884// Exactly one of *ListLogServicesResponse or error will be non-nil. Any 885// non-2xx status code is an error. Response headers are in either 886// *ListLogServicesResponse.ServerResponse.Header or (if a response was 887// returned at all) in error.(*googleapi.Error).Header. Use 888// googleapi.IsNotModified to check whether the returned error was 889// because http.StatusNotModified was returned. 890func (c *ProjectsLogServicesListCall) Do(opts ...googleapi.CallOption) (*ListLogServicesResponse, error) { 891 gensupport.SetOptions(c.urlParams_, opts...) 892 res, err := c.doRequest("json") 893 if res != nil && res.StatusCode == http.StatusNotModified { 894 if res.Body != nil { 895 res.Body.Close() 896 } 897 return nil, &googleapi.Error{ 898 Code: res.StatusCode, 899 Header: res.Header, 900 } 901 } 902 if err != nil { 903 return nil, err 904 } 905 defer googleapi.CloseBody(res) 906 if err := googleapi.CheckResponse(res); err != nil { 907 return nil, err 908 } 909 ret := &ListLogServicesResponse{ 910 ServerResponse: googleapi.ServerResponse{ 911 Header: res.Header, 912 HTTPStatusCode: res.StatusCode, 913 }, 914 } 915 target := &ret 916 if err := gensupport.DecodeResponse(target, res); err != nil { 917 return nil, err 918 } 919 return ret, nil 920 // { 921 // "description": "Lists log services associated with log entries ingested for a project.", 922 // "httpMethod": "GET", 923 // "id": "logging.projects.logServices.list", 924 // "parameterOrder": [ 925 // "projectsId" 926 // ], 927 // "parameters": { 928 // "log": { 929 // "description": "The name of the log resource whose services are to be listed. log for which to list services. When empty, all services are listed.", 930 // "location": "query", 931 // "type": "string" 932 // }, 933 // "pageSize": { 934 // "description": "The maximum number of `LogService` objects to return in one operation.", 935 // "format": "int32", 936 // "location": "query", 937 // "type": "integer" 938 // }, 939 // "pageToken": { 940 // "description": "An opaque token, returned as `nextPageToken` by a prior `ListLogServices` operation. If `pageToken` is supplied, then the other fields of this request are ignored, and instead the previous `ListLogServices` operation is continued.", 941 // "location": "query", 942 // "type": "string" 943 // }, 944 // "projectsId": { 945 // "description": "Part of `projectName`. The project resource whose services are to be listed.", 946 // "location": "path", 947 // "required": true, 948 // "type": "string" 949 // } 950 // }, 951 // "path": "v1beta3/projects/{projectsId}/logServices", 952 // "response": { 953 // "$ref": "ListLogServicesResponse" 954 // }, 955 // "scopes": [ 956 // "https://www.googleapis.com/auth/cloud-platform" 957 // ] 958 // } 959 960} 961 962// Pages invokes f for each page of results. 963// A non-nil error returned from f will halt the iteration. 964// The provided context supersedes any context provided to the Context method. 965func (c *ProjectsLogServicesListCall) Pages(ctx context.Context, f func(*ListLogServicesResponse) error) error { 966 c.ctx_ = ctx 967 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 968 for { 969 x, err := c.Do() 970 if err != nil { 971 return err 972 } 973 if err := f(x); err != nil { 974 return err 975 } 976 if x.NextPageToken == "" { 977 return nil 978 } 979 c.PageToken(x.NextPageToken) 980 } 981} 982 983// method id "logging.projects.logServices.indexes.list": 984 985type ProjectsLogServicesIndexesListCall struct { 986 s *Service 987 projectsId string 988 logServicesId string 989 urlParams_ gensupport.URLParams 990 ifNoneMatch_ string 991 ctx_ context.Context 992 header_ http.Header 993} 994 995// List: Lists log service indexes associated with a log service. 996func (r *ProjectsLogServicesIndexesService) List(projectsId string, logServicesId string) *ProjectsLogServicesIndexesListCall { 997 c := &ProjectsLogServicesIndexesListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 998 c.projectsId = projectsId 999 c.logServicesId = logServicesId 1000 return c 1001} 1002 1003// Depth sets the optional parameter "depth": A limit to the number of 1004// levels of the index hierarchy that are expanded. If `depth` is 0, it 1005// defaults to the level specified by the prefix field (the number of 1006// slash separators). The default empty prefix implies a `depth` of 1. 1007// It is an error for `depth` to be any non-zero value less than the 1008// number of components in `indexPrefix`. 1009func (c *ProjectsLogServicesIndexesListCall) Depth(depth int64) *ProjectsLogServicesIndexesListCall { 1010 c.urlParams_.Set("depth", fmt.Sprint(depth)) 1011 return c 1012} 1013 1014// IndexPrefix sets the optional parameter "indexPrefix": Restricts the 1015// indexes returned to be those with a specified prefix. The prefix has 1016// the form "/label_value/label_value/...", in order corresponding to 1017// the [`LogService 1018// indexKeys`][google.logging.v1.LogService.index_keys]. Non-empty 1019// prefixes must begin with `/` . Example prefixes: + "/myModule/" 1020// retrieves App Engine versions associated with `myModule`. The 1021// trailing slash terminates the value. + "/myModule" retrieves App 1022// Engine modules with names beginning with `myModule`. + "" retrieves 1023// all indexes. 1024func (c *ProjectsLogServicesIndexesListCall) IndexPrefix(indexPrefix string) *ProjectsLogServicesIndexesListCall { 1025 c.urlParams_.Set("indexPrefix", indexPrefix) 1026 return c 1027} 1028 1029// Log sets the optional parameter "log": A log resource like 1030// `/projects/project_id/logs/log_name`, identifying the log for which 1031// to list service indexes. 1032func (c *ProjectsLogServicesIndexesListCall) Log(log string) *ProjectsLogServicesIndexesListCall { 1033 c.urlParams_.Set("log", log) 1034 return c 1035} 1036 1037// PageSize sets the optional parameter "pageSize": The maximum number 1038// of log service index resources to return in one operation. 1039func (c *ProjectsLogServicesIndexesListCall) PageSize(pageSize int64) *ProjectsLogServicesIndexesListCall { 1040 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 1041 return c 1042} 1043 1044// PageToken sets the optional parameter "pageToken": An opaque token, 1045// returned as `nextPageToken` by a prior `ListLogServiceIndexes` 1046// operation. If `pageToken` is supplied, then the other fields of this 1047// request are ignored, and instead the previous `ListLogServiceIndexes` 1048// operation is continued. 1049func (c *ProjectsLogServicesIndexesListCall) PageToken(pageToken string) *ProjectsLogServicesIndexesListCall { 1050 c.urlParams_.Set("pageToken", pageToken) 1051 return c 1052} 1053 1054// Fields allows partial responses to be retrieved. See 1055// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1056// for more information. 1057func (c *ProjectsLogServicesIndexesListCall) Fields(s ...googleapi.Field) *ProjectsLogServicesIndexesListCall { 1058 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1059 return c 1060} 1061 1062// IfNoneMatch sets the optional parameter which makes the operation 1063// fail if the object's ETag matches the given value. This is useful for 1064// getting updates only after the object has changed since the last 1065// request. Use googleapi.IsNotModified to check whether the response 1066// error from Do is the result of In-None-Match. 1067func (c *ProjectsLogServicesIndexesListCall) IfNoneMatch(entityTag string) *ProjectsLogServicesIndexesListCall { 1068 c.ifNoneMatch_ = entityTag 1069 return c 1070} 1071 1072// Context sets the context to be used in this call's Do method. Any 1073// pending HTTP request will be aborted if the provided context is 1074// canceled. 1075func (c *ProjectsLogServicesIndexesListCall) Context(ctx context.Context) *ProjectsLogServicesIndexesListCall { 1076 c.ctx_ = ctx 1077 return c 1078} 1079 1080// Header returns an http.Header that can be modified by the caller to 1081// add HTTP headers to the request. 1082func (c *ProjectsLogServicesIndexesListCall) Header() http.Header { 1083 if c.header_ == nil { 1084 c.header_ = make(http.Header) 1085 } 1086 return c.header_ 1087} 1088 1089func (c *ProjectsLogServicesIndexesListCall) doRequest(alt string) (*http.Response, error) { 1090 reqHeaders := make(http.Header) 1091 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/00000000") 1092 for k, v := range c.header_ { 1093 reqHeaders[k] = v 1094 } 1095 reqHeaders.Set("User-Agent", c.s.userAgent()) 1096 if c.ifNoneMatch_ != "" { 1097 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 1098 } 1099 var body io.Reader = nil 1100 c.urlParams_.Set("alt", alt) 1101 c.urlParams_.Set("prettyPrint", "false") 1102 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta3/projects/{projectsId}/logServices/{logServicesId}/indexes") 1103 urls += "?" + c.urlParams_.Encode() 1104 req, err := http.NewRequest("GET", urls, body) 1105 if err != nil { 1106 return nil, err 1107 } 1108 req.Header = reqHeaders 1109 googleapi.Expand(req.URL, map[string]string{ 1110 "projectsId": c.projectsId, 1111 "logServicesId": c.logServicesId, 1112 }) 1113 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1114} 1115 1116// Do executes the "logging.projects.logServices.indexes.list" call. 1117// Exactly one of *ListLogServiceIndexesResponse or error will be 1118// non-nil. Any non-2xx status code is an error. Response headers are in 1119// either *ListLogServiceIndexesResponse.ServerResponse.Header or (if a 1120// response was returned at all) in error.(*googleapi.Error).Header. Use 1121// googleapi.IsNotModified to check whether the returned error was 1122// because http.StatusNotModified was returned. 1123func (c *ProjectsLogServicesIndexesListCall) Do(opts ...googleapi.CallOption) (*ListLogServiceIndexesResponse, error) { 1124 gensupport.SetOptions(c.urlParams_, opts...) 1125 res, err := c.doRequest("json") 1126 if res != nil && res.StatusCode == http.StatusNotModified { 1127 if res.Body != nil { 1128 res.Body.Close() 1129 } 1130 return nil, &googleapi.Error{ 1131 Code: res.StatusCode, 1132 Header: res.Header, 1133 } 1134 } 1135 if err != nil { 1136 return nil, err 1137 } 1138 defer googleapi.CloseBody(res) 1139 if err := googleapi.CheckResponse(res); err != nil { 1140 return nil, err 1141 } 1142 ret := &ListLogServiceIndexesResponse{ 1143 ServerResponse: googleapi.ServerResponse{ 1144 Header: res.Header, 1145 HTTPStatusCode: res.StatusCode, 1146 }, 1147 } 1148 target := &ret 1149 if err := gensupport.DecodeResponse(target, res); err != nil { 1150 return nil, err 1151 } 1152 return ret, nil 1153 // { 1154 // "description": "Lists log service indexes associated with a log service.", 1155 // "httpMethod": "GET", 1156 // "id": "logging.projects.logServices.indexes.list", 1157 // "parameterOrder": [ 1158 // "projectsId", 1159 // "logServicesId" 1160 // ], 1161 // "parameters": { 1162 // "depth": { 1163 // "description": "A limit to the number of levels of the index hierarchy that are expanded. If `depth` is 0, it defaults to the level specified by the prefix field (the number of slash separators). The default empty prefix implies a `depth` of 1. It is an error for `depth` to be any non-zero value less than the number of components in `indexPrefix`.", 1164 // "format": "int32", 1165 // "location": "query", 1166 // "type": "integer" 1167 // }, 1168 // "indexPrefix": { 1169 // "description": "Restricts the indexes returned to be those with a specified prefix. The prefix has the form `\"/label_value/label_value/...\"`, in order corresponding to the [`LogService indexKeys`][google.logging.v1.LogService.index_keys]. Non-empty prefixes must begin with `/` . Example prefixes: + `\"/myModule/\"` retrieves App Engine versions associated with `myModule`. The trailing slash terminates the value. + `\"/myModule\"` retrieves App Engine modules with names beginning with `myModule`. + `\"\"` retrieves all indexes.", 1170 // "location": "query", 1171 // "type": "string" 1172 // }, 1173 // "log": { 1174 // "description": "A log resource like `/projects/project_id/logs/log_name`, identifying the log for which to list service indexes.", 1175 // "location": "query", 1176 // "type": "string" 1177 // }, 1178 // "logServicesId": { 1179 // "description": "Part of `serviceName`. See documentation of `projectsId`.", 1180 // "location": "path", 1181 // "required": true, 1182 // "type": "string" 1183 // }, 1184 // "pageSize": { 1185 // "description": "The maximum number of log service index resources to return in one operation.", 1186 // "format": "int32", 1187 // "location": "query", 1188 // "type": "integer" 1189 // }, 1190 // "pageToken": { 1191 // "description": "An opaque token, returned as `nextPageToken` by a prior `ListLogServiceIndexes` operation. If `pageToken` is supplied, then the other fields of this request are ignored, and instead the previous `ListLogServiceIndexes` operation is continued.", 1192 // "location": "query", 1193 // "type": "string" 1194 // }, 1195 // "projectsId": { 1196 // "description": "Part of `serviceName`. A log service resource of the form `/projects/*/logServices/*`. The service indexes of the log service are returned. Example: `\"/projects/myProj/logServices/appengine.googleapis.com\"`.", 1197 // "location": "path", 1198 // "required": true, 1199 // "type": "string" 1200 // } 1201 // }, 1202 // "path": "v1beta3/projects/{projectsId}/logServices/{logServicesId}/indexes", 1203 // "response": { 1204 // "$ref": "ListLogServiceIndexesResponse" 1205 // }, 1206 // "scopes": [ 1207 // "https://www.googleapis.com/auth/cloud-platform" 1208 // ] 1209 // } 1210 1211} 1212 1213// Pages invokes f for each page of results. 1214// A non-nil error returned from f will halt the iteration. 1215// The provided context supersedes any context provided to the Context method. 1216func (c *ProjectsLogServicesIndexesListCall) Pages(ctx context.Context, f func(*ListLogServiceIndexesResponse) error) error { 1217 c.ctx_ = ctx 1218 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 1219 for { 1220 x, err := c.Do() 1221 if err != nil { 1222 return err 1223 } 1224 if err := f(x); err != nil { 1225 return err 1226 } 1227 if x.NextPageToken == "" { 1228 return nil 1229 } 1230 c.PageToken(x.NextPageToken) 1231 } 1232} 1233 1234// method id "logging.projects.logServices.sinks.create": 1235 1236type ProjectsLogServicesSinksCreateCall struct { 1237 s *Service 1238 projectsId string 1239 logServicesId string 1240 logsink *LogSink 1241 urlParams_ gensupport.URLParams 1242 ctx_ context.Context 1243 header_ http.Header 1244} 1245 1246// Create: Creates the specified log service sink resource. 1247func (r *ProjectsLogServicesSinksService) Create(projectsId string, logServicesId string, logsink *LogSink) *ProjectsLogServicesSinksCreateCall { 1248 c := &ProjectsLogServicesSinksCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1249 c.projectsId = projectsId 1250 c.logServicesId = logServicesId 1251 c.logsink = logsink 1252 return c 1253} 1254 1255// Fields allows partial responses to be retrieved. See 1256// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1257// for more information. 1258func (c *ProjectsLogServicesSinksCreateCall) Fields(s ...googleapi.Field) *ProjectsLogServicesSinksCreateCall { 1259 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1260 return c 1261} 1262 1263// Context sets the context to be used in this call's Do method. Any 1264// pending HTTP request will be aborted if the provided context is 1265// canceled. 1266func (c *ProjectsLogServicesSinksCreateCall) Context(ctx context.Context) *ProjectsLogServicesSinksCreateCall { 1267 c.ctx_ = ctx 1268 return c 1269} 1270 1271// Header returns an http.Header that can be modified by the caller to 1272// add HTTP headers to the request. 1273func (c *ProjectsLogServicesSinksCreateCall) Header() http.Header { 1274 if c.header_ == nil { 1275 c.header_ = make(http.Header) 1276 } 1277 return c.header_ 1278} 1279 1280func (c *ProjectsLogServicesSinksCreateCall) doRequest(alt string) (*http.Response, error) { 1281 reqHeaders := make(http.Header) 1282 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/00000000") 1283 for k, v := range c.header_ { 1284 reqHeaders[k] = v 1285 } 1286 reqHeaders.Set("User-Agent", c.s.userAgent()) 1287 var body io.Reader = nil 1288 body, err := googleapi.WithoutDataWrapper.JSONReader(c.logsink) 1289 if err != nil { 1290 return nil, err 1291 } 1292 reqHeaders.Set("Content-Type", "application/json") 1293 c.urlParams_.Set("alt", alt) 1294 c.urlParams_.Set("prettyPrint", "false") 1295 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta3/projects/{projectsId}/logServices/{logServicesId}/sinks") 1296 urls += "?" + c.urlParams_.Encode() 1297 req, err := http.NewRequest("POST", urls, body) 1298 if err != nil { 1299 return nil, err 1300 } 1301 req.Header = reqHeaders 1302 googleapi.Expand(req.URL, map[string]string{ 1303 "projectsId": c.projectsId, 1304 "logServicesId": c.logServicesId, 1305 }) 1306 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1307} 1308 1309// Do executes the "logging.projects.logServices.sinks.create" call. 1310// Exactly one of *LogSink or error will be non-nil. Any non-2xx status 1311// code is an error. Response headers are in either 1312// *LogSink.ServerResponse.Header or (if a response was returned at all) 1313// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 1314// check whether the returned error was because http.StatusNotModified 1315// was returned. 1316func (c *ProjectsLogServicesSinksCreateCall) Do(opts ...googleapi.CallOption) (*LogSink, error) { 1317 gensupport.SetOptions(c.urlParams_, opts...) 1318 res, err := c.doRequest("json") 1319 if res != nil && res.StatusCode == http.StatusNotModified { 1320 if res.Body != nil { 1321 res.Body.Close() 1322 } 1323 return nil, &googleapi.Error{ 1324 Code: res.StatusCode, 1325 Header: res.Header, 1326 } 1327 } 1328 if err != nil { 1329 return nil, err 1330 } 1331 defer googleapi.CloseBody(res) 1332 if err := googleapi.CheckResponse(res); err != nil { 1333 return nil, err 1334 } 1335 ret := &LogSink{ 1336 ServerResponse: googleapi.ServerResponse{ 1337 Header: res.Header, 1338 HTTPStatusCode: res.StatusCode, 1339 }, 1340 } 1341 target := &ret 1342 if err := gensupport.DecodeResponse(target, res); err != nil { 1343 return nil, err 1344 } 1345 return ret, nil 1346 // { 1347 // "description": "Creates the specified log service sink resource.", 1348 // "httpMethod": "POST", 1349 // "id": "logging.projects.logServices.sinks.create", 1350 // "parameterOrder": [ 1351 // "projectsId", 1352 // "logServicesId" 1353 // ], 1354 // "parameters": { 1355 // "logServicesId": { 1356 // "description": "Part of `serviceName`. See documentation of `projectsId`.", 1357 // "location": "path", 1358 // "required": true, 1359 // "type": "string" 1360 // }, 1361 // "projectsId": { 1362 // "description": "Part of `serviceName`. The name of the service in which to create a sink.", 1363 // "location": "path", 1364 // "required": true, 1365 // "type": "string" 1366 // } 1367 // }, 1368 // "path": "v1beta3/projects/{projectsId}/logServices/{logServicesId}/sinks", 1369 // "request": { 1370 // "$ref": "LogSink" 1371 // }, 1372 // "response": { 1373 // "$ref": "LogSink" 1374 // }, 1375 // "scopes": [ 1376 // "https://www.googleapis.com/auth/cloud-platform" 1377 // ] 1378 // } 1379 1380} 1381 1382// method id "logging.projects.logServices.sinks.delete": 1383 1384type ProjectsLogServicesSinksDeleteCall struct { 1385 s *Service 1386 projectsId string 1387 logServicesId string 1388 sinksId string 1389 urlParams_ gensupport.URLParams 1390 ctx_ context.Context 1391 header_ http.Header 1392} 1393 1394// Delete: Deletes the specified log service sink. 1395func (r *ProjectsLogServicesSinksService) Delete(projectsId string, logServicesId string, sinksId string) *ProjectsLogServicesSinksDeleteCall { 1396 c := &ProjectsLogServicesSinksDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1397 c.projectsId = projectsId 1398 c.logServicesId = logServicesId 1399 c.sinksId = sinksId 1400 return c 1401} 1402 1403// Fields allows partial responses to be retrieved. See 1404// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1405// for more information. 1406func (c *ProjectsLogServicesSinksDeleteCall) Fields(s ...googleapi.Field) *ProjectsLogServicesSinksDeleteCall { 1407 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1408 return c 1409} 1410 1411// Context sets the context to be used in this call's Do method. Any 1412// pending HTTP request will be aborted if the provided context is 1413// canceled. 1414func (c *ProjectsLogServicesSinksDeleteCall) Context(ctx context.Context) *ProjectsLogServicesSinksDeleteCall { 1415 c.ctx_ = ctx 1416 return c 1417} 1418 1419// Header returns an http.Header that can be modified by the caller to 1420// add HTTP headers to the request. 1421func (c *ProjectsLogServicesSinksDeleteCall) Header() http.Header { 1422 if c.header_ == nil { 1423 c.header_ = make(http.Header) 1424 } 1425 return c.header_ 1426} 1427 1428func (c *ProjectsLogServicesSinksDeleteCall) doRequest(alt string) (*http.Response, error) { 1429 reqHeaders := make(http.Header) 1430 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/00000000") 1431 for k, v := range c.header_ { 1432 reqHeaders[k] = v 1433 } 1434 reqHeaders.Set("User-Agent", c.s.userAgent()) 1435 var body io.Reader = nil 1436 c.urlParams_.Set("alt", alt) 1437 c.urlParams_.Set("prettyPrint", "false") 1438 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta3/projects/{projectsId}/logServices/{logServicesId}/sinks/{sinksId}") 1439 urls += "?" + c.urlParams_.Encode() 1440 req, err := http.NewRequest("DELETE", urls, body) 1441 if err != nil { 1442 return nil, err 1443 } 1444 req.Header = reqHeaders 1445 googleapi.Expand(req.URL, map[string]string{ 1446 "projectsId": c.projectsId, 1447 "logServicesId": c.logServicesId, 1448 "sinksId": c.sinksId, 1449 }) 1450 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1451} 1452 1453// Do executes the "logging.projects.logServices.sinks.delete" call. 1454// Exactly one of *Empty or error will be non-nil. Any non-2xx status 1455// code is an error. Response headers are in either 1456// *Empty.ServerResponse.Header or (if a response was returned at all) 1457// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 1458// check whether the returned error was because http.StatusNotModified 1459// was returned. 1460func (c *ProjectsLogServicesSinksDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 1461 gensupport.SetOptions(c.urlParams_, opts...) 1462 res, err := c.doRequest("json") 1463 if res != nil && res.StatusCode == http.StatusNotModified { 1464 if res.Body != nil { 1465 res.Body.Close() 1466 } 1467 return nil, &googleapi.Error{ 1468 Code: res.StatusCode, 1469 Header: res.Header, 1470 } 1471 } 1472 if err != nil { 1473 return nil, err 1474 } 1475 defer googleapi.CloseBody(res) 1476 if err := googleapi.CheckResponse(res); err != nil { 1477 return nil, err 1478 } 1479 ret := &Empty{ 1480 ServerResponse: googleapi.ServerResponse{ 1481 Header: res.Header, 1482 HTTPStatusCode: res.StatusCode, 1483 }, 1484 } 1485 target := &ret 1486 if err := gensupport.DecodeResponse(target, res); err != nil { 1487 return nil, err 1488 } 1489 return ret, nil 1490 // { 1491 // "description": "Deletes the specified log service sink.", 1492 // "httpMethod": "DELETE", 1493 // "id": "logging.projects.logServices.sinks.delete", 1494 // "parameterOrder": [ 1495 // "projectsId", 1496 // "logServicesId", 1497 // "sinksId" 1498 // ], 1499 // "parameters": { 1500 // "logServicesId": { 1501 // "description": "Part of `sinkName`. See documentation of `projectsId`.", 1502 // "location": "path", 1503 // "required": true, 1504 // "type": "string" 1505 // }, 1506 // "projectsId": { 1507 // "description": "Part of `sinkName`. The name of the sink to delete.", 1508 // "location": "path", 1509 // "required": true, 1510 // "type": "string" 1511 // }, 1512 // "sinksId": { 1513 // "description": "Part of `sinkName`. See documentation of `projectsId`.", 1514 // "location": "path", 1515 // "required": true, 1516 // "type": "string" 1517 // } 1518 // }, 1519 // "path": "v1beta3/projects/{projectsId}/logServices/{logServicesId}/sinks/{sinksId}", 1520 // "response": { 1521 // "$ref": "Empty" 1522 // }, 1523 // "scopes": [ 1524 // "https://www.googleapis.com/auth/cloud-platform" 1525 // ] 1526 // } 1527 1528} 1529 1530// method id "logging.projects.logServices.sinks.get": 1531 1532type ProjectsLogServicesSinksGetCall struct { 1533 s *Service 1534 projectsId string 1535 logServicesId string 1536 sinksId string 1537 urlParams_ gensupport.URLParams 1538 ifNoneMatch_ string 1539 ctx_ context.Context 1540 header_ http.Header 1541} 1542 1543// Get: Gets the specified log service sink resource. 1544func (r *ProjectsLogServicesSinksService) Get(projectsId string, logServicesId string, sinksId string) *ProjectsLogServicesSinksGetCall { 1545 c := &ProjectsLogServicesSinksGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1546 c.projectsId = projectsId 1547 c.logServicesId = logServicesId 1548 c.sinksId = sinksId 1549 return c 1550} 1551 1552// Fields allows partial responses to be retrieved. See 1553// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1554// for more information. 1555func (c *ProjectsLogServicesSinksGetCall) Fields(s ...googleapi.Field) *ProjectsLogServicesSinksGetCall { 1556 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1557 return c 1558} 1559 1560// IfNoneMatch sets the optional parameter which makes the operation 1561// fail if the object's ETag matches the given value. This is useful for 1562// getting updates only after the object has changed since the last 1563// request. Use googleapi.IsNotModified to check whether the response 1564// error from Do is the result of In-None-Match. 1565func (c *ProjectsLogServicesSinksGetCall) IfNoneMatch(entityTag string) *ProjectsLogServicesSinksGetCall { 1566 c.ifNoneMatch_ = entityTag 1567 return c 1568} 1569 1570// Context sets the context to be used in this call's Do method. Any 1571// pending HTTP request will be aborted if the provided context is 1572// canceled. 1573func (c *ProjectsLogServicesSinksGetCall) Context(ctx context.Context) *ProjectsLogServicesSinksGetCall { 1574 c.ctx_ = ctx 1575 return c 1576} 1577 1578// Header returns an http.Header that can be modified by the caller to 1579// add HTTP headers to the request. 1580func (c *ProjectsLogServicesSinksGetCall) Header() http.Header { 1581 if c.header_ == nil { 1582 c.header_ = make(http.Header) 1583 } 1584 return c.header_ 1585} 1586 1587func (c *ProjectsLogServicesSinksGetCall) doRequest(alt string) (*http.Response, error) { 1588 reqHeaders := make(http.Header) 1589 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/00000000") 1590 for k, v := range c.header_ { 1591 reqHeaders[k] = v 1592 } 1593 reqHeaders.Set("User-Agent", c.s.userAgent()) 1594 if c.ifNoneMatch_ != "" { 1595 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 1596 } 1597 var body io.Reader = nil 1598 c.urlParams_.Set("alt", alt) 1599 c.urlParams_.Set("prettyPrint", "false") 1600 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta3/projects/{projectsId}/logServices/{logServicesId}/sinks/{sinksId}") 1601 urls += "?" + c.urlParams_.Encode() 1602 req, err := http.NewRequest("GET", urls, body) 1603 if err != nil { 1604 return nil, err 1605 } 1606 req.Header = reqHeaders 1607 googleapi.Expand(req.URL, map[string]string{ 1608 "projectsId": c.projectsId, 1609 "logServicesId": c.logServicesId, 1610 "sinksId": c.sinksId, 1611 }) 1612 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1613} 1614 1615// Do executes the "logging.projects.logServices.sinks.get" call. 1616// Exactly one of *LogSink or error will be non-nil. Any non-2xx status 1617// code is an error. Response headers are in either 1618// *LogSink.ServerResponse.Header or (if a response was returned at all) 1619// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 1620// check whether the returned error was because http.StatusNotModified 1621// was returned. 1622func (c *ProjectsLogServicesSinksGetCall) Do(opts ...googleapi.CallOption) (*LogSink, error) { 1623 gensupport.SetOptions(c.urlParams_, opts...) 1624 res, err := c.doRequest("json") 1625 if res != nil && res.StatusCode == http.StatusNotModified { 1626 if res.Body != nil { 1627 res.Body.Close() 1628 } 1629 return nil, &googleapi.Error{ 1630 Code: res.StatusCode, 1631 Header: res.Header, 1632 } 1633 } 1634 if err != nil { 1635 return nil, err 1636 } 1637 defer googleapi.CloseBody(res) 1638 if err := googleapi.CheckResponse(res); err != nil { 1639 return nil, err 1640 } 1641 ret := &LogSink{ 1642 ServerResponse: googleapi.ServerResponse{ 1643 Header: res.Header, 1644 HTTPStatusCode: res.StatusCode, 1645 }, 1646 } 1647 target := &ret 1648 if err := gensupport.DecodeResponse(target, res); err != nil { 1649 return nil, err 1650 } 1651 return ret, nil 1652 // { 1653 // "description": "Gets the specified log service sink resource.", 1654 // "httpMethod": "GET", 1655 // "id": "logging.projects.logServices.sinks.get", 1656 // "parameterOrder": [ 1657 // "projectsId", 1658 // "logServicesId", 1659 // "sinksId" 1660 // ], 1661 // "parameters": { 1662 // "logServicesId": { 1663 // "description": "Part of `sinkName`. See documentation of `projectsId`.", 1664 // "location": "path", 1665 // "required": true, 1666 // "type": "string" 1667 // }, 1668 // "projectsId": { 1669 // "description": "Part of `sinkName`. The name of the sink to return.", 1670 // "location": "path", 1671 // "required": true, 1672 // "type": "string" 1673 // }, 1674 // "sinksId": { 1675 // "description": "Part of `sinkName`. See documentation of `projectsId`.", 1676 // "location": "path", 1677 // "required": true, 1678 // "type": "string" 1679 // } 1680 // }, 1681 // "path": "v1beta3/projects/{projectsId}/logServices/{logServicesId}/sinks/{sinksId}", 1682 // "response": { 1683 // "$ref": "LogSink" 1684 // }, 1685 // "scopes": [ 1686 // "https://www.googleapis.com/auth/cloud-platform" 1687 // ] 1688 // } 1689 1690} 1691 1692// method id "logging.projects.logServices.sinks.list": 1693 1694type ProjectsLogServicesSinksListCall struct { 1695 s *Service 1696 projectsId string 1697 logServicesId string 1698 urlParams_ gensupport.URLParams 1699 ifNoneMatch_ string 1700 ctx_ context.Context 1701 header_ http.Header 1702} 1703 1704// List: Lists log service sinks associated with the specified service. 1705func (r *ProjectsLogServicesSinksService) List(projectsId string, logServicesId string) *ProjectsLogServicesSinksListCall { 1706 c := &ProjectsLogServicesSinksListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1707 c.projectsId = projectsId 1708 c.logServicesId = logServicesId 1709 return c 1710} 1711 1712// Fields allows partial responses to be retrieved. See 1713// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1714// for more information. 1715func (c *ProjectsLogServicesSinksListCall) Fields(s ...googleapi.Field) *ProjectsLogServicesSinksListCall { 1716 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1717 return c 1718} 1719 1720// IfNoneMatch sets the optional parameter which makes the operation 1721// fail if the object's ETag matches the given value. This is useful for 1722// getting updates only after the object has changed since the last 1723// request. Use googleapi.IsNotModified to check whether the response 1724// error from Do is the result of In-None-Match. 1725func (c *ProjectsLogServicesSinksListCall) IfNoneMatch(entityTag string) *ProjectsLogServicesSinksListCall { 1726 c.ifNoneMatch_ = entityTag 1727 return c 1728} 1729 1730// Context sets the context to be used in this call's Do method. Any 1731// pending HTTP request will be aborted if the provided context is 1732// canceled. 1733func (c *ProjectsLogServicesSinksListCall) Context(ctx context.Context) *ProjectsLogServicesSinksListCall { 1734 c.ctx_ = ctx 1735 return c 1736} 1737 1738// Header returns an http.Header that can be modified by the caller to 1739// add HTTP headers to the request. 1740func (c *ProjectsLogServicesSinksListCall) Header() http.Header { 1741 if c.header_ == nil { 1742 c.header_ = make(http.Header) 1743 } 1744 return c.header_ 1745} 1746 1747func (c *ProjectsLogServicesSinksListCall) doRequest(alt string) (*http.Response, error) { 1748 reqHeaders := make(http.Header) 1749 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/00000000") 1750 for k, v := range c.header_ { 1751 reqHeaders[k] = v 1752 } 1753 reqHeaders.Set("User-Agent", c.s.userAgent()) 1754 if c.ifNoneMatch_ != "" { 1755 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 1756 } 1757 var body io.Reader = nil 1758 c.urlParams_.Set("alt", alt) 1759 c.urlParams_.Set("prettyPrint", "false") 1760 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta3/projects/{projectsId}/logServices/{logServicesId}/sinks") 1761 urls += "?" + c.urlParams_.Encode() 1762 req, err := http.NewRequest("GET", urls, body) 1763 if err != nil { 1764 return nil, err 1765 } 1766 req.Header = reqHeaders 1767 googleapi.Expand(req.URL, map[string]string{ 1768 "projectsId": c.projectsId, 1769 "logServicesId": c.logServicesId, 1770 }) 1771 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1772} 1773 1774// Do executes the "logging.projects.logServices.sinks.list" call. 1775// Exactly one of *ListLogServiceSinksResponse or error will be non-nil. 1776// Any non-2xx status code is an error. Response headers are in either 1777// *ListLogServiceSinksResponse.ServerResponse.Header or (if a response 1778// was returned at all) in error.(*googleapi.Error).Header. Use 1779// googleapi.IsNotModified to check whether the returned error was 1780// because http.StatusNotModified was returned. 1781func (c *ProjectsLogServicesSinksListCall) Do(opts ...googleapi.CallOption) (*ListLogServiceSinksResponse, error) { 1782 gensupport.SetOptions(c.urlParams_, opts...) 1783 res, err := c.doRequest("json") 1784 if res != nil && res.StatusCode == http.StatusNotModified { 1785 if res.Body != nil { 1786 res.Body.Close() 1787 } 1788 return nil, &googleapi.Error{ 1789 Code: res.StatusCode, 1790 Header: res.Header, 1791 } 1792 } 1793 if err != nil { 1794 return nil, err 1795 } 1796 defer googleapi.CloseBody(res) 1797 if err := googleapi.CheckResponse(res); err != nil { 1798 return nil, err 1799 } 1800 ret := &ListLogServiceSinksResponse{ 1801 ServerResponse: googleapi.ServerResponse{ 1802 Header: res.Header, 1803 HTTPStatusCode: res.StatusCode, 1804 }, 1805 } 1806 target := &ret 1807 if err := gensupport.DecodeResponse(target, res); err != nil { 1808 return nil, err 1809 } 1810 return ret, nil 1811 // { 1812 // "description": "Lists log service sinks associated with the specified service.", 1813 // "httpMethod": "GET", 1814 // "id": "logging.projects.logServices.sinks.list", 1815 // "parameterOrder": [ 1816 // "projectsId", 1817 // "logServicesId" 1818 // ], 1819 // "parameters": { 1820 // "logServicesId": { 1821 // "description": "Part of `serviceName`. See documentation of `projectsId`.", 1822 // "location": "path", 1823 // "required": true, 1824 // "type": "string" 1825 // }, 1826 // "projectsId": { 1827 // "description": "Part of `serviceName`. The name of the service for which to list sinks.", 1828 // "location": "path", 1829 // "required": true, 1830 // "type": "string" 1831 // } 1832 // }, 1833 // "path": "v1beta3/projects/{projectsId}/logServices/{logServicesId}/sinks", 1834 // "response": { 1835 // "$ref": "ListLogServiceSinksResponse" 1836 // }, 1837 // "scopes": [ 1838 // "https://www.googleapis.com/auth/cloud-platform" 1839 // ] 1840 // } 1841 1842} 1843 1844// method id "logging.projects.logServices.sinks.update": 1845 1846type ProjectsLogServicesSinksUpdateCall struct { 1847 s *Service 1848 projectsId string 1849 logServicesId string 1850 sinksId string 1851 logsink *LogSink 1852 urlParams_ gensupport.URLParams 1853 ctx_ context.Context 1854 header_ http.Header 1855} 1856 1857// Update: Creates or update the specified log service sink resource. 1858func (r *ProjectsLogServicesSinksService) Update(projectsId string, logServicesId string, sinksId string, logsink *LogSink) *ProjectsLogServicesSinksUpdateCall { 1859 c := &ProjectsLogServicesSinksUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1860 c.projectsId = projectsId 1861 c.logServicesId = logServicesId 1862 c.sinksId = sinksId 1863 c.logsink = logsink 1864 return c 1865} 1866 1867// Fields allows partial responses to be retrieved. See 1868// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1869// for more information. 1870func (c *ProjectsLogServicesSinksUpdateCall) Fields(s ...googleapi.Field) *ProjectsLogServicesSinksUpdateCall { 1871 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1872 return c 1873} 1874 1875// Context sets the context to be used in this call's Do method. Any 1876// pending HTTP request will be aborted if the provided context is 1877// canceled. 1878func (c *ProjectsLogServicesSinksUpdateCall) Context(ctx context.Context) *ProjectsLogServicesSinksUpdateCall { 1879 c.ctx_ = ctx 1880 return c 1881} 1882 1883// Header returns an http.Header that can be modified by the caller to 1884// add HTTP headers to the request. 1885func (c *ProjectsLogServicesSinksUpdateCall) Header() http.Header { 1886 if c.header_ == nil { 1887 c.header_ = make(http.Header) 1888 } 1889 return c.header_ 1890} 1891 1892func (c *ProjectsLogServicesSinksUpdateCall) doRequest(alt string) (*http.Response, error) { 1893 reqHeaders := make(http.Header) 1894 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/00000000") 1895 for k, v := range c.header_ { 1896 reqHeaders[k] = v 1897 } 1898 reqHeaders.Set("User-Agent", c.s.userAgent()) 1899 var body io.Reader = nil 1900 body, err := googleapi.WithoutDataWrapper.JSONReader(c.logsink) 1901 if err != nil { 1902 return nil, err 1903 } 1904 reqHeaders.Set("Content-Type", "application/json") 1905 c.urlParams_.Set("alt", alt) 1906 c.urlParams_.Set("prettyPrint", "false") 1907 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta3/projects/{projectsId}/logServices/{logServicesId}/sinks/{sinksId}") 1908 urls += "?" + c.urlParams_.Encode() 1909 req, err := http.NewRequest("PUT", urls, body) 1910 if err != nil { 1911 return nil, err 1912 } 1913 req.Header = reqHeaders 1914 googleapi.Expand(req.URL, map[string]string{ 1915 "projectsId": c.projectsId, 1916 "logServicesId": c.logServicesId, 1917 "sinksId": c.sinksId, 1918 }) 1919 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1920} 1921 1922// Do executes the "logging.projects.logServices.sinks.update" call. 1923// Exactly one of *LogSink or error will be non-nil. Any non-2xx status 1924// code is an error. Response headers are in either 1925// *LogSink.ServerResponse.Header or (if a response was returned at all) 1926// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 1927// check whether the returned error was because http.StatusNotModified 1928// was returned. 1929func (c *ProjectsLogServicesSinksUpdateCall) Do(opts ...googleapi.CallOption) (*LogSink, error) { 1930 gensupport.SetOptions(c.urlParams_, opts...) 1931 res, err := c.doRequest("json") 1932 if res != nil && res.StatusCode == http.StatusNotModified { 1933 if res.Body != nil { 1934 res.Body.Close() 1935 } 1936 return nil, &googleapi.Error{ 1937 Code: res.StatusCode, 1938 Header: res.Header, 1939 } 1940 } 1941 if err != nil { 1942 return nil, err 1943 } 1944 defer googleapi.CloseBody(res) 1945 if err := googleapi.CheckResponse(res); err != nil { 1946 return nil, err 1947 } 1948 ret := &LogSink{ 1949 ServerResponse: googleapi.ServerResponse{ 1950 Header: res.Header, 1951 HTTPStatusCode: res.StatusCode, 1952 }, 1953 } 1954 target := &ret 1955 if err := gensupport.DecodeResponse(target, res); err != nil { 1956 return nil, err 1957 } 1958 return ret, nil 1959 // { 1960 // "description": "Creates or update the specified log service sink resource.", 1961 // "httpMethod": "PUT", 1962 // "id": "logging.projects.logServices.sinks.update", 1963 // "parameterOrder": [ 1964 // "projectsId", 1965 // "logServicesId", 1966 // "sinksId" 1967 // ], 1968 // "parameters": { 1969 // "logServicesId": { 1970 // "description": "Part of `sinkName`. See documentation of `projectsId`.", 1971 // "location": "path", 1972 // "required": true, 1973 // "type": "string" 1974 // }, 1975 // "projectsId": { 1976 // "description": "Part of `sinkName`. The name of the sink to update.", 1977 // "location": "path", 1978 // "required": true, 1979 // "type": "string" 1980 // }, 1981 // "sinksId": { 1982 // "description": "Part of `sinkName`. See documentation of `projectsId`.", 1983 // "location": "path", 1984 // "required": true, 1985 // "type": "string" 1986 // } 1987 // }, 1988 // "path": "v1beta3/projects/{projectsId}/logServices/{logServicesId}/sinks/{sinksId}", 1989 // "request": { 1990 // "$ref": "LogSink" 1991 // }, 1992 // "response": { 1993 // "$ref": "LogSink" 1994 // }, 1995 // "scopes": [ 1996 // "https://www.googleapis.com/auth/cloud-platform" 1997 // ] 1998 // } 1999 2000} 2001 2002// method id "logging.projects.logs.delete": 2003 2004type ProjectsLogsDeleteCall struct { 2005 s *Service 2006 projectsId string 2007 logsId string 2008 urlParams_ gensupport.URLParams 2009 ctx_ context.Context 2010 header_ http.Header 2011} 2012 2013// Delete: Deletes the specified log resource and all log entries 2014// contained in it. 2015func (r *ProjectsLogsService) Delete(projectsId string, logsId string) *ProjectsLogsDeleteCall { 2016 c := &ProjectsLogsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2017 c.projectsId = projectsId 2018 c.logsId = logsId 2019 return c 2020} 2021 2022// Fields allows partial responses to be retrieved. See 2023// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2024// for more information. 2025func (c *ProjectsLogsDeleteCall) Fields(s ...googleapi.Field) *ProjectsLogsDeleteCall { 2026 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2027 return c 2028} 2029 2030// Context sets the context to be used in this call's Do method. Any 2031// pending HTTP request will be aborted if the provided context is 2032// canceled. 2033func (c *ProjectsLogsDeleteCall) Context(ctx context.Context) *ProjectsLogsDeleteCall { 2034 c.ctx_ = ctx 2035 return c 2036} 2037 2038// Header returns an http.Header that can be modified by the caller to 2039// add HTTP headers to the request. 2040func (c *ProjectsLogsDeleteCall) Header() http.Header { 2041 if c.header_ == nil { 2042 c.header_ = make(http.Header) 2043 } 2044 return c.header_ 2045} 2046 2047func (c *ProjectsLogsDeleteCall) doRequest(alt string) (*http.Response, error) { 2048 reqHeaders := make(http.Header) 2049 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/00000000") 2050 for k, v := range c.header_ { 2051 reqHeaders[k] = v 2052 } 2053 reqHeaders.Set("User-Agent", c.s.userAgent()) 2054 var body io.Reader = nil 2055 c.urlParams_.Set("alt", alt) 2056 c.urlParams_.Set("prettyPrint", "false") 2057 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta3/projects/{projectsId}/logs/{logsId}") 2058 urls += "?" + c.urlParams_.Encode() 2059 req, err := http.NewRequest("DELETE", urls, body) 2060 if err != nil { 2061 return nil, err 2062 } 2063 req.Header = reqHeaders 2064 googleapi.Expand(req.URL, map[string]string{ 2065 "projectsId": c.projectsId, 2066 "logsId": c.logsId, 2067 }) 2068 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2069} 2070 2071// Do executes the "logging.projects.logs.delete" call. 2072// Exactly one of *Empty or error will be non-nil. Any non-2xx status 2073// code is an error. Response headers are in either 2074// *Empty.ServerResponse.Header or (if a response was returned at all) 2075// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 2076// check whether the returned error was because http.StatusNotModified 2077// was returned. 2078func (c *ProjectsLogsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 2079 gensupport.SetOptions(c.urlParams_, opts...) 2080 res, err := c.doRequest("json") 2081 if res != nil && res.StatusCode == http.StatusNotModified { 2082 if res.Body != nil { 2083 res.Body.Close() 2084 } 2085 return nil, &googleapi.Error{ 2086 Code: res.StatusCode, 2087 Header: res.Header, 2088 } 2089 } 2090 if err != nil { 2091 return nil, err 2092 } 2093 defer googleapi.CloseBody(res) 2094 if err := googleapi.CheckResponse(res); err != nil { 2095 return nil, err 2096 } 2097 ret := &Empty{ 2098 ServerResponse: googleapi.ServerResponse{ 2099 Header: res.Header, 2100 HTTPStatusCode: res.StatusCode, 2101 }, 2102 } 2103 target := &ret 2104 if err := gensupport.DecodeResponse(target, res); err != nil { 2105 return nil, err 2106 } 2107 return ret, nil 2108 // { 2109 // "description": "Deletes the specified log resource and all log entries contained in it.", 2110 // "httpMethod": "DELETE", 2111 // "id": "logging.projects.logs.delete", 2112 // "parameterOrder": [ 2113 // "projectsId", 2114 // "logsId" 2115 // ], 2116 // "parameters": { 2117 // "logsId": { 2118 // "description": "Part of `logName`. See documentation of `projectsId`.", 2119 // "location": "path", 2120 // "required": true, 2121 // "type": "string" 2122 // }, 2123 // "projectsId": { 2124 // "description": "Part of `logName`. The log resource to delete.", 2125 // "location": "path", 2126 // "required": true, 2127 // "type": "string" 2128 // } 2129 // }, 2130 // "path": "v1beta3/projects/{projectsId}/logs/{logsId}", 2131 // "response": { 2132 // "$ref": "Empty" 2133 // }, 2134 // "scopes": [ 2135 // "https://www.googleapis.com/auth/cloud-platform" 2136 // ] 2137 // } 2138 2139} 2140 2141// method id "logging.projects.logs.list": 2142 2143type ProjectsLogsListCall struct { 2144 s *Service 2145 projectsId string 2146 urlParams_ gensupport.URLParams 2147 ifNoneMatch_ string 2148 ctx_ context.Context 2149 header_ http.Header 2150} 2151 2152// List: Lists log resources belonging to the specified project. 2153func (r *ProjectsLogsService) List(projectsId string) *ProjectsLogsListCall { 2154 c := &ProjectsLogsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2155 c.projectsId = projectsId 2156 return c 2157} 2158 2159// PageSize sets the optional parameter "pageSize": The maximum number 2160// of results to return. 2161func (c *ProjectsLogsListCall) PageSize(pageSize int64) *ProjectsLogsListCall { 2162 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 2163 return c 2164} 2165 2166// PageToken sets the optional parameter "pageToken": An opaque token, 2167// returned as `nextPageToken` by a prior `ListLogs` operation. If 2168// `pageToken` is supplied, then the other fields of this request are 2169// ignored, and instead the previous `ListLogs` operation is continued. 2170func (c *ProjectsLogsListCall) PageToken(pageToken string) *ProjectsLogsListCall { 2171 c.urlParams_.Set("pageToken", pageToken) 2172 return c 2173} 2174 2175// ServiceIndexPrefix sets the optional parameter "serviceIndexPrefix": 2176// A log service index prefix for which to list logs. Only logs 2177// containing entries whose metadata that includes these label values 2178// (associated with index keys) are returned. The prefix is a slash 2179// separated list of values, and need not specify all index labels. An 2180// empty index (or a single slash) matches all log service indexes. 2181func (c *ProjectsLogsListCall) ServiceIndexPrefix(serviceIndexPrefix string) *ProjectsLogsListCall { 2182 c.urlParams_.Set("serviceIndexPrefix", serviceIndexPrefix) 2183 return c 2184} 2185 2186// ServiceName sets the optional parameter "serviceName": A service name 2187// for which to list logs. Only logs containing entries whose metadata 2188// includes this service name are returned. If `serviceName` and 2189// `serviceIndexPrefix` are both empty, then all log names are returned. 2190// To list all log names, regardless of service, leave both the 2191// `serviceName` and `serviceIndexPrefix` empty. To list log names 2192// containing entries with a particular service name (or explicitly 2193// empty service name) set `serviceName` to the desired value and 2194// `serviceIndexPrefix` to "/". 2195func (c *ProjectsLogsListCall) ServiceName(serviceName string) *ProjectsLogsListCall { 2196 c.urlParams_.Set("serviceName", serviceName) 2197 return c 2198} 2199 2200// Fields allows partial responses to be retrieved. See 2201// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2202// for more information. 2203func (c *ProjectsLogsListCall) Fields(s ...googleapi.Field) *ProjectsLogsListCall { 2204 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2205 return c 2206} 2207 2208// IfNoneMatch sets the optional parameter which makes the operation 2209// fail if the object's ETag matches the given value. This is useful for 2210// getting updates only after the object has changed since the last 2211// request. Use googleapi.IsNotModified to check whether the response 2212// error from Do is the result of In-None-Match. 2213func (c *ProjectsLogsListCall) IfNoneMatch(entityTag string) *ProjectsLogsListCall { 2214 c.ifNoneMatch_ = entityTag 2215 return c 2216} 2217 2218// Context sets the context to be used in this call's Do method. Any 2219// pending HTTP request will be aborted if the provided context is 2220// canceled. 2221func (c *ProjectsLogsListCall) Context(ctx context.Context) *ProjectsLogsListCall { 2222 c.ctx_ = ctx 2223 return c 2224} 2225 2226// Header returns an http.Header that can be modified by the caller to 2227// add HTTP headers to the request. 2228func (c *ProjectsLogsListCall) Header() http.Header { 2229 if c.header_ == nil { 2230 c.header_ = make(http.Header) 2231 } 2232 return c.header_ 2233} 2234 2235func (c *ProjectsLogsListCall) doRequest(alt string) (*http.Response, error) { 2236 reqHeaders := make(http.Header) 2237 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/00000000") 2238 for k, v := range c.header_ { 2239 reqHeaders[k] = v 2240 } 2241 reqHeaders.Set("User-Agent", c.s.userAgent()) 2242 if c.ifNoneMatch_ != "" { 2243 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 2244 } 2245 var body io.Reader = nil 2246 c.urlParams_.Set("alt", alt) 2247 c.urlParams_.Set("prettyPrint", "false") 2248 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta3/projects/{projectsId}/logs") 2249 urls += "?" + c.urlParams_.Encode() 2250 req, err := http.NewRequest("GET", urls, body) 2251 if err != nil { 2252 return nil, err 2253 } 2254 req.Header = reqHeaders 2255 googleapi.Expand(req.URL, map[string]string{ 2256 "projectsId": c.projectsId, 2257 }) 2258 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2259} 2260 2261// Do executes the "logging.projects.logs.list" call. 2262// Exactly one of *ListLogsResponse or error will be non-nil. Any 2263// non-2xx status code is an error. Response headers are in either 2264// *ListLogsResponse.ServerResponse.Header or (if a response was 2265// returned at all) in error.(*googleapi.Error).Header. Use 2266// googleapi.IsNotModified to check whether the returned error was 2267// because http.StatusNotModified was returned. 2268func (c *ProjectsLogsListCall) Do(opts ...googleapi.CallOption) (*ListLogsResponse, error) { 2269 gensupport.SetOptions(c.urlParams_, opts...) 2270 res, err := c.doRequest("json") 2271 if res != nil && res.StatusCode == http.StatusNotModified { 2272 if res.Body != nil { 2273 res.Body.Close() 2274 } 2275 return nil, &googleapi.Error{ 2276 Code: res.StatusCode, 2277 Header: res.Header, 2278 } 2279 } 2280 if err != nil { 2281 return nil, err 2282 } 2283 defer googleapi.CloseBody(res) 2284 if err := googleapi.CheckResponse(res); err != nil { 2285 return nil, err 2286 } 2287 ret := &ListLogsResponse{ 2288 ServerResponse: googleapi.ServerResponse{ 2289 Header: res.Header, 2290 HTTPStatusCode: res.StatusCode, 2291 }, 2292 } 2293 target := &ret 2294 if err := gensupport.DecodeResponse(target, res); err != nil { 2295 return nil, err 2296 } 2297 return ret, nil 2298 // { 2299 // "description": "Lists log resources belonging to the specified project.", 2300 // "httpMethod": "GET", 2301 // "id": "logging.projects.logs.list", 2302 // "parameterOrder": [ 2303 // "projectsId" 2304 // ], 2305 // "parameters": { 2306 // "pageSize": { 2307 // "description": "The maximum number of results to return.", 2308 // "format": "int32", 2309 // "location": "query", 2310 // "type": "integer" 2311 // }, 2312 // "pageToken": { 2313 // "description": "An opaque token, returned as `nextPageToken` by a prior `ListLogs` operation. If `pageToken` is supplied, then the other fields of this request are ignored, and instead the previous `ListLogs` operation is continued.", 2314 // "location": "query", 2315 // "type": "string" 2316 // }, 2317 // "projectsId": { 2318 // "description": "Part of `projectName`. The project name for which to list the log resources.", 2319 // "location": "path", 2320 // "required": true, 2321 // "type": "string" 2322 // }, 2323 // "serviceIndexPrefix": { 2324 // "description": "A log service index prefix for which to list logs. Only logs containing entries whose metadata that includes these label values (associated with index keys) are returned. The prefix is a slash separated list of values, and need not specify all index labels. An empty index (or a single slash) matches all log service indexes.", 2325 // "location": "query", 2326 // "type": "string" 2327 // }, 2328 // "serviceName": { 2329 // "description": "A service name for which to list logs. Only logs containing entries whose metadata includes this service name are returned. If `serviceName` and `serviceIndexPrefix` are both empty, then all log names are returned. To list all log names, regardless of service, leave both the `serviceName` and `serviceIndexPrefix` empty. To list log names containing entries with a particular service name (or explicitly empty service name) set `serviceName` to the desired value and `serviceIndexPrefix` to `\"/\"`.", 2330 // "location": "query", 2331 // "type": "string" 2332 // } 2333 // }, 2334 // "path": "v1beta3/projects/{projectsId}/logs", 2335 // "response": { 2336 // "$ref": "ListLogsResponse" 2337 // }, 2338 // "scopes": [ 2339 // "https://www.googleapis.com/auth/cloud-platform" 2340 // ] 2341 // } 2342 2343} 2344 2345// Pages invokes f for each page of results. 2346// A non-nil error returned from f will halt the iteration. 2347// The provided context supersedes any context provided to the Context method. 2348func (c *ProjectsLogsListCall) Pages(ctx context.Context, f func(*ListLogsResponse) error) error { 2349 c.ctx_ = ctx 2350 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 2351 for { 2352 x, err := c.Do() 2353 if err != nil { 2354 return err 2355 } 2356 if err := f(x); err != nil { 2357 return err 2358 } 2359 if x.NextPageToken == "" { 2360 return nil 2361 } 2362 c.PageToken(x.NextPageToken) 2363 } 2364} 2365 2366// method id "logging.projects.logs.entries.write": 2367 2368type ProjectsLogsEntriesWriteCall struct { 2369 s *Service 2370 projectsId string 2371 logsId string 2372 writelogentriesrequest *WriteLogEntriesRequest 2373 urlParams_ gensupport.URLParams 2374 ctx_ context.Context 2375 header_ http.Header 2376} 2377 2378// Write: Creates one or more log entries in a log. You must supply a 2379// list of `LogEntry` objects, named `entries`. Each `LogEntry` object 2380// must contain a payload object and a `LogEntryMetadata` object that 2381// describes the entry. You must fill in all the fields of the entry, 2382// metadata, and payload. You can also supply a map, `commonLabels`, 2383// that supplies default (key, value) data for the 2384// `entries[].metadata.labels` maps, saving you the trouble of creating 2385// identical copies for each entry. 2386func (r *ProjectsLogsEntriesService) Write(projectsId string, logsId string, writelogentriesrequest *WriteLogEntriesRequest) *ProjectsLogsEntriesWriteCall { 2387 c := &ProjectsLogsEntriesWriteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2388 c.projectsId = projectsId 2389 c.logsId = logsId 2390 c.writelogentriesrequest = writelogentriesrequest 2391 return c 2392} 2393 2394// Fields allows partial responses to be retrieved. See 2395// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2396// for more information. 2397func (c *ProjectsLogsEntriesWriteCall) Fields(s ...googleapi.Field) *ProjectsLogsEntriesWriteCall { 2398 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2399 return c 2400} 2401 2402// Context sets the context to be used in this call's Do method. Any 2403// pending HTTP request will be aborted if the provided context is 2404// canceled. 2405func (c *ProjectsLogsEntriesWriteCall) Context(ctx context.Context) *ProjectsLogsEntriesWriteCall { 2406 c.ctx_ = ctx 2407 return c 2408} 2409 2410// Header returns an http.Header that can be modified by the caller to 2411// add HTTP headers to the request. 2412func (c *ProjectsLogsEntriesWriteCall) Header() http.Header { 2413 if c.header_ == nil { 2414 c.header_ = make(http.Header) 2415 } 2416 return c.header_ 2417} 2418 2419func (c *ProjectsLogsEntriesWriteCall) doRequest(alt string) (*http.Response, error) { 2420 reqHeaders := make(http.Header) 2421 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/00000000") 2422 for k, v := range c.header_ { 2423 reqHeaders[k] = v 2424 } 2425 reqHeaders.Set("User-Agent", c.s.userAgent()) 2426 var body io.Reader = nil 2427 body, err := googleapi.WithoutDataWrapper.JSONReader(c.writelogentriesrequest) 2428 if err != nil { 2429 return nil, err 2430 } 2431 reqHeaders.Set("Content-Type", "application/json") 2432 c.urlParams_.Set("alt", alt) 2433 c.urlParams_.Set("prettyPrint", "false") 2434 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta3/projects/{projectsId}/logs/{logsId}/entries:write") 2435 urls += "?" + c.urlParams_.Encode() 2436 req, err := http.NewRequest("POST", urls, body) 2437 if err != nil { 2438 return nil, err 2439 } 2440 req.Header = reqHeaders 2441 googleapi.Expand(req.URL, map[string]string{ 2442 "projectsId": c.projectsId, 2443 "logsId": c.logsId, 2444 }) 2445 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2446} 2447 2448// Do executes the "logging.projects.logs.entries.write" call. 2449// Exactly one of *WriteLogEntriesResponse or error will be non-nil. Any 2450// non-2xx status code is an error. Response headers are in either 2451// *WriteLogEntriesResponse.ServerResponse.Header or (if a response was 2452// returned at all) in error.(*googleapi.Error).Header. Use 2453// googleapi.IsNotModified to check whether the returned error was 2454// because http.StatusNotModified was returned. 2455func (c *ProjectsLogsEntriesWriteCall) Do(opts ...googleapi.CallOption) (*WriteLogEntriesResponse, error) { 2456 gensupport.SetOptions(c.urlParams_, opts...) 2457 res, err := c.doRequest("json") 2458 if res != nil && res.StatusCode == http.StatusNotModified { 2459 if res.Body != nil { 2460 res.Body.Close() 2461 } 2462 return nil, &googleapi.Error{ 2463 Code: res.StatusCode, 2464 Header: res.Header, 2465 } 2466 } 2467 if err != nil { 2468 return nil, err 2469 } 2470 defer googleapi.CloseBody(res) 2471 if err := googleapi.CheckResponse(res); err != nil { 2472 return nil, err 2473 } 2474 ret := &WriteLogEntriesResponse{ 2475 ServerResponse: googleapi.ServerResponse{ 2476 Header: res.Header, 2477 HTTPStatusCode: res.StatusCode, 2478 }, 2479 } 2480 target := &ret 2481 if err := gensupport.DecodeResponse(target, res); err != nil { 2482 return nil, err 2483 } 2484 return ret, nil 2485 // { 2486 // "description": "Creates one or more log entries in a log. You must supply a list of `LogEntry` objects, named `entries`. Each `LogEntry` object must contain a payload object and a `LogEntryMetadata` object that describes the entry. You must fill in all the fields of the entry, metadata, and payload. You can also supply a map, `commonLabels`, that supplies default (key, value) data for the `entries[].metadata.labels` maps, saving you the trouble of creating identical copies for each entry.", 2487 // "httpMethod": "POST", 2488 // "id": "logging.projects.logs.entries.write", 2489 // "parameterOrder": [ 2490 // "projectsId", 2491 // "logsId" 2492 // ], 2493 // "parameters": { 2494 // "logsId": { 2495 // "description": "Part of `logName`. See documentation of `projectsId`.", 2496 // "location": "path", 2497 // "required": true, 2498 // "type": "string" 2499 // }, 2500 // "projectsId": { 2501 // "description": "Part of `logName`. The name of the log resource into which to insert the log entries.", 2502 // "location": "path", 2503 // "required": true, 2504 // "type": "string" 2505 // } 2506 // }, 2507 // "path": "v1beta3/projects/{projectsId}/logs/{logsId}/entries:write", 2508 // "request": { 2509 // "$ref": "WriteLogEntriesRequest" 2510 // }, 2511 // "response": { 2512 // "$ref": "WriteLogEntriesResponse" 2513 // }, 2514 // "scopes": [ 2515 // "https://www.googleapis.com/auth/cloud-platform" 2516 // ] 2517 // } 2518 2519} 2520 2521// method id "logging.projects.logs.sinks.create": 2522 2523type ProjectsLogsSinksCreateCall struct { 2524 s *Service 2525 projectsId string 2526 logsId string 2527 logsink *LogSink 2528 urlParams_ gensupport.URLParams 2529 ctx_ context.Context 2530 header_ http.Header 2531} 2532 2533// Create: Creates the specified log sink resource. 2534func (r *ProjectsLogsSinksService) Create(projectsId string, logsId string, logsink *LogSink) *ProjectsLogsSinksCreateCall { 2535 c := &ProjectsLogsSinksCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2536 c.projectsId = projectsId 2537 c.logsId = logsId 2538 c.logsink = logsink 2539 return c 2540} 2541 2542// Fields allows partial responses to be retrieved. See 2543// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2544// for more information. 2545func (c *ProjectsLogsSinksCreateCall) Fields(s ...googleapi.Field) *ProjectsLogsSinksCreateCall { 2546 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2547 return c 2548} 2549 2550// Context sets the context to be used in this call's Do method. Any 2551// pending HTTP request will be aborted if the provided context is 2552// canceled. 2553func (c *ProjectsLogsSinksCreateCall) Context(ctx context.Context) *ProjectsLogsSinksCreateCall { 2554 c.ctx_ = ctx 2555 return c 2556} 2557 2558// Header returns an http.Header that can be modified by the caller to 2559// add HTTP headers to the request. 2560func (c *ProjectsLogsSinksCreateCall) Header() http.Header { 2561 if c.header_ == nil { 2562 c.header_ = make(http.Header) 2563 } 2564 return c.header_ 2565} 2566 2567func (c *ProjectsLogsSinksCreateCall) doRequest(alt string) (*http.Response, error) { 2568 reqHeaders := make(http.Header) 2569 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/00000000") 2570 for k, v := range c.header_ { 2571 reqHeaders[k] = v 2572 } 2573 reqHeaders.Set("User-Agent", c.s.userAgent()) 2574 var body io.Reader = nil 2575 body, err := googleapi.WithoutDataWrapper.JSONReader(c.logsink) 2576 if err != nil { 2577 return nil, err 2578 } 2579 reqHeaders.Set("Content-Type", "application/json") 2580 c.urlParams_.Set("alt", alt) 2581 c.urlParams_.Set("prettyPrint", "false") 2582 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta3/projects/{projectsId}/logs/{logsId}/sinks") 2583 urls += "?" + c.urlParams_.Encode() 2584 req, err := http.NewRequest("POST", urls, body) 2585 if err != nil { 2586 return nil, err 2587 } 2588 req.Header = reqHeaders 2589 googleapi.Expand(req.URL, map[string]string{ 2590 "projectsId": c.projectsId, 2591 "logsId": c.logsId, 2592 }) 2593 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2594} 2595 2596// Do executes the "logging.projects.logs.sinks.create" call. 2597// Exactly one of *LogSink or error will be non-nil. Any non-2xx status 2598// code is an error. Response headers are in either 2599// *LogSink.ServerResponse.Header or (if a response was returned at all) 2600// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 2601// check whether the returned error was because http.StatusNotModified 2602// was returned. 2603func (c *ProjectsLogsSinksCreateCall) Do(opts ...googleapi.CallOption) (*LogSink, error) { 2604 gensupport.SetOptions(c.urlParams_, opts...) 2605 res, err := c.doRequest("json") 2606 if res != nil && res.StatusCode == http.StatusNotModified { 2607 if res.Body != nil { 2608 res.Body.Close() 2609 } 2610 return nil, &googleapi.Error{ 2611 Code: res.StatusCode, 2612 Header: res.Header, 2613 } 2614 } 2615 if err != nil { 2616 return nil, err 2617 } 2618 defer googleapi.CloseBody(res) 2619 if err := googleapi.CheckResponse(res); err != nil { 2620 return nil, err 2621 } 2622 ret := &LogSink{ 2623 ServerResponse: googleapi.ServerResponse{ 2624 Header: res.Header, 2625 HTTPStatusCode: res.StatusCode, 2626 }, 2627 } 2628 target := &ret 2629 if err := gensupport.DecodeResponse(target, res); err != nil { 2630 return nil, err 2631 } 2632 return ret, nil 2633 // { 2634 // "description": "Creates the specified log sink resource.", 2635 // "httpMethod": "POST", 2636 // "id": "logging.projects.logs.sinks.create", 2637 // "parameterOrder": [ 2638 // "projectsId", 2639 // "logsId" 2640 // ], 2641 // "parameters": { 2642 // "logsId": { 2643 // "description": "Part of `logName`. See documentation of `projectsId`.", 2644 // "location": "path", 2645 // "required": true, 2646 // "type": "string" 2647 // }, 2648 // "projectsId": { 2649 // "description": "Part of `logName`. The log in which to create a sink resource.", 2650 // "location": "path", 2651 // "required": true, 2652 // "type": "string" 2653 // } 2654 // }, 2655 // "path": "v1beta3/projects/{projectsId}/logs/{logsId}/sinks", 2656 // "request": { 2657 // "$ref": "LogSink" 2658 // }, 2659 // "response": { 2660 // "$ref": "LogSink" 2661 // }, 2662 // "scopes": [ 2663 // "https://www.googleapis.com/auth/cloud-platform" 2664 // ] 2665 // } 2666 2667} 2668 2669// method id "logging.projects.logs.sinks.delete": 2670 2671type ProjectsLogsSinksDeleteCall struct { 2672 s *Service 2673 projectsId string 2674 logsId string 2675 sinksId string 2676 urlParams_ gensupport.URLParams 2677 ctx_ context.Context 2678 header_ http.Header 2679} 2680 2681// Delete: Deletes the specified log sink resource. 2682func (r *ProjectsLogsSinksService) Delete(projectsId string, logsId string, sinksId string) *ProjectsLogsSinksDeleteCall { 2683 c := &ProjectsLogsSinksDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2684 c.projectsId = projectsId 2685 c.logsId = logsId 2686 c.sinksId = sinksId 2687 return c 2688} 2689 2690// Fields allows partial responses to be retrieved. See 2691// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2692// for more information. 2693func (c *ProjectsLogsSinksDeleteCall) Fields(s ...googleapi.Field) *ProjectsLogsSinksDeleteCall { 2694 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2695 return c 2696} 2697 2698// Context sets the context to be used in this call's Do method. Any 2699// pending HTTP request will be aborted if the provided context is 2700// canceled. 2701func (c *ProjectsLogsSinksDeleteCall) Context(ctx context.Context) *ProjectsLogsSinksDeleteCall { 2702 c.ctx_ = ctx 2703 return c 2704} 2705 2706// Header returns an http.Header that can be modified by the caller to 2707// add HTTP headers to the request. 2708func (c *ProjectsLogsSinksDeleteCall) Header() http.Header { 2709 if c.header_ == nil { 2710 c.header_ = make(http.Header) 2711 } 2712 return c.header_ 2713} 2714 2715func (c *ProjectsLogsSinksDeleteCall) doRequest(alt string) (*http.Response, error) { 2716 reqHeaders := make(http.Header) 2717 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/00000000") 2718 for k, v := range c.header_ { 2719 reqHeaders[k] = v 2720 } 2721 reqHeaders.Set("User-Agent", c.s.userAgent()) 2722 var body io.Reader = nil 2723 c.urlParams_.Set("alt", alt) 2724 c.urlParams_.Set("prettyPrint", "false") 2725 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta3/projects/{projectsId}/logs/{logsId}/sinks/{sinksId}") 2726 urls += "?" + c.urlParams_.Encode() 2727 req, err := http.NewRequest("DELETE", urls, body) 2728 if err != nil { 2729 return nil, err 2730 } 2731 req.Header = reqHeaders 2732 googleapi.Expand(req.URL, map[string]string{ 2733 "projectsId": c.projectsId, 2734 "logsId": c.logsId, 2735 "sinksId": c.sinksId, 2736 }) 2737 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2738} 2739 2740// Do executes the "logging.projects.logs.sinks.delete" call. 2741// Exactly one of *Empty or error will be non-nil. Any non-2xx status 2742// code is an error. Response headers are in either 2743// *Empty.ServerResponse.Header or (if a response was returned at all) 2744// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 2745// check whether the returned error was because http.StatusNotModified 2746// was returned. 2747func (c *ProjectsLogsSinksDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 2748 gensupport.SetOptions(c.urlParams_, opts...) 2749 res, err := c.doRequest("json") 2750 if res != nil && res.StatusCode == http.StatusNotModified { 2751 if res.Body != nil { 2752 res.Body.Close() 2753 } 2754 return nil, &googleapi.Error{ 2755 Code: res.StatusCode, 2756 Header: res.Header, 2757 } 2758 } 2759 if err != nil { 2760 return nil, err 2761 } 2762 defer googleapi.CloseBody(res) 2763 if err := googleapi.CheckResponse(res); err != nil { 2764 return nil, err 2765 } 2766 ret := &Empty{ 2767 ServerResponse: googleapi.ServerResponse{ 2768 Header: res.Header, 2769 HTTPStatusCode: res.StatusCode, 2770 }, 2771 } 2772 target := &ret 2773 if err := gensupport.DecodeResponse(target, res); err != nil { 2774 return nil, err 2775 } 2776 return ret, nil 2777 // { 2778 // "description": "Deletes the specified log sink resource.", 2779 // "httpMethod": "DELETE", 2780 // "id": "logging.projects.logs.sinks.delete", 2781 // "parameterOrder": [ 2782 // "projectsId", 2783 // "logsId", 2784 // "sinksId" 2785 // ], 2786 // "parameters": { 2787 // "logsId": { 2788 // "description": "Part of `sinkName`. See documentation of `projectsId`.", 2789 // "location": "path", 2790 // "required": true, 2791 // "type": "string" 2792 // }, 2793 // "projectsId": { 2794 // "description": "Part of `sinkName`. The name of the sink to delete.", 2795 // "location": "path", 2796 // "required": true, 2797 // "type": "string" 2798 // }, 2799 // "sinksId": { 2800 // "description": "Part of `sinkName`. See documentation of `projectsId`.", 2801 // "location": "path", 2802 // "required": true, 2803 // "type": "string" 2804 // } 2805 // }, 2806 // "path": "v1beta3/projects/{projectsId}/logs/{logsId}/sinks/{sinksId}", 2807 // "response": { 2808 // "$ref": "Empty" 2809 // }, 2810 // "scopes": [ 2811 // "https://www.googleapis.com/auth/cloud-platform" 2812 // ] 2813 // } 2814 2815} 2816 2817// method id "logging.projects.logs.sinks.get": 2818 2819type ProjectsLogsSinksGetCall struct { 2820 s *Service 2821 projectsId string 2822 logsId string 2823 sinksId string 2824 urlParams_ gensupport.URLParams 2825 ifNoneMatch_ string 2826 ctx_ context.Context 2827 header_ http.Header 2828} 2829 2830// Get: Gets the specified log sink resource. 2831func (r *ProjectsLogsSinksService) Get(projectsId string, logsId string, sinksId string) *ProjectsLogsSinksGetCall { 2832 c := &ProjectsLogsSinksGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2833 c.projectsId = projectsId 2834 c.logsId = logsId 2835 c.sinksId = sinksId 2836 return c 2837} 2838 2839// Fields allows partial responses to be retrieved. See 2840// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2841// for more information. 2842func (c *ProjectsLogsSinksGetCall) Fields(s ...googleapi.Field) *ProjectsLogsSinksGetCall { 2843 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2844 return c 2845} 2846 2847// IfNoneMatch sets the optional parameter which makes the operation 2848// fail if the object's ETag matches the given value. This is useful for 2849// getting updates only after the object has changed since the last 2850// request. Use googleapi.IsNotModified to check whether the response 2851// error from Do is the result of In-None-Match. 2852func (c *ProjectsLogsSinksGetCall) IfNoneMatch(entityTag string) *ProjectsLogsSinksGetCall { 2853 c.ifNoneMatch_ = entityTag 2854 return c 2855} 2856 2857// Context sets the context to be used in this call's Do method. Any 2858// pending HTTP request will be aborted if the provided context is 2859// canceled. 2860func (c *ProjectsLogsSinksGetCall) Context(ctx context.Context) *ProjectsLogsSinksGetCall { 2861 c.ctx_ = ctx 2862 return c 2863} 2864 2865// Header returns an http.Header that can be modified by the caller to 2866// add HTTP headers to the request. 2867func (c *ProjectsLogsSinksGetCall) Header() http.Header { 2868 if c.header_ == nil { 2869 c.header_ = make(http.Header) 2870 } 2871 return c.header_ 2872} 2873 2874func (c *ProjectsLogsSinksGetCall) doRequest(alt string) (*http.Response, error) { 2875 reqHeaders := make(http.Header) 2876 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/00000000") 2877 for k, v := range c.header_ { 2878 reqHeaders[k] = v 2879 } 2880 reqHeaders.Set("User-Agent", c.s.userAgent()) 2881 if c.ifNoneMatch_ != "" { 2882 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 2883 } 2884 var body io.Reader = nil 2885 c.urlParams_.Set("alt", alt) 2886 c.urlParams_.Set("prettyPrint", "false") 2887 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta3/projects/{projectsId}/logs/{logsId}/sinks/{sinksId}") 2888 urls += "?" + c.urlParams_.Encode() 2889 req, err := http.NewRequest("GET", urls, body) 2890 if err != nil { 2891 return nil, err 2892 } 2893 req.Header = reqHeaders 2894 googleapi.Expand(req.URL, map[string]string{ 2895 "projectsId": c.projectsId, 2896 "logsId": c.logsId, 2897 "sinksId": c.sinksId, 2898 }) 2899 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2900} 2901 2902// Do executes the "logging.projects.logs.sinks.get" call. 2903// Exactly one of *LogSink or error will be non-nil. Any non-2xx status 2904// code is an error. Response headers are in either 2905// *LogSink.ServerResponse.Header or (if a response was returned at all) 2906// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 2907// check whether the returned error was because http.StatusNotModified 2908// was returned. 2909func (c *ProjectsLogsSinksGetCall) Do(opts ...googleapi.CallOption) (*LogSink, error) { 2910 gensupport.SetOptions(c.urlParams_, opts...) 2911 res, err := c.doRequest("json") 2912 if res != nil && res.StatusCode == http.StatusNotModified { 2913 if res.Body != nil { 2914 res.Body.Close() 2915 } 2916 return nil, &googleapi.Error{ 2917 Code: res.StatusCode, 2918 Header: res.Header, 2919 } 2920 } 2921 if err != nil { 2922 return nil, err 2923 } 2924 defer googleapi.CloseBody(res) 2925 if err := googleapi.CheckResponse(res); err != nil { 2926 return nil, err 2927 } 2928 ret := &LogSink{ 2929 ServerResponse: googleapi.ServerResponse{ 2930 Header: res.Header, 2931 HTTPStatusCode: res.StatusCode, 2932 }, 2933 } 2934 target := &ret 2935 if err := gensupport.DecodeResponse(target, res); err != nil { 2936 return nil, err 2937 } 2938 return ret, nil 2939 // { 2940 // "description": "Gets the specified log sink resource.", 2941 // "httpMethod": "GET", 2942 // "id": "logging.projects.logs.sinks.get", 2943 // "parameterOrder": [ 2944 // "projectsId", 2945 // "logsId", 2946 // "sinksId" 2947 // ], 2948 // "parameters": { 2949 // "logsId": { 2950 // "description": "Part of `sinkName`. See documentation of `projectsId`.", 2951 // "location": "path", 2952 // "required": true, 2953 // "type": "string" 2954 // }, 2955 // "projectsId": { 2956 // "description": "Part of `sinkName`. The name of the sink resource to return.", 2957 // "location": "path", 2958 // "required": true, 2959 // "type": "string" 2960 // }, 2961 // "sinksId": { 2962 // "description": "Part of `sinkName`. See documentation of `projectsId`.", 2963 // "location": "path", 2964 // "required": true, 2965 // "type": "string" 2966 // } 2967 // }, 2968 // "path": "v1beta3/projects/{projectsId}/logs/{logsId}/sinks/{sinksId}", 2969 // "response": { 2970 // "$ref": "LogSink" 2971 // }, 2972 // "scopes": [ 2973 // "https://www.googleapis.com/auth/cloud-platform" 2974 // ] 2975 // } 2976 2977} 2978 2979// method id "logging.projects.logs.sinks.list": 2980 2981type ProjectsLogsSinksListCall struct { 2982 s *Service 2983 projectsId string 2984 logsId string 2985 urlParams_ gensupport.URLParams 2986 ifNoneMatch_ string 2987 ctx_ context.Context 2988 header_ http.Header 2989} 2990 2991// List: Lists log sinks associated with the specified log. 2992func (r *ProjectsLogsSinksService) List(projectsId string, logsId string) *ProjectsLogsSinksListCall { 2993 c := &ProjectsLogsSinksListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2994 c.projectsId = projectsId 2995 c.logsId = logsId 2996 return c 2997} 2998 2999// Fields allows partial responses to be retrieved. See 3000// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3001// for more information. 3002func (c *ProjectsLogsSinksListCall) Fields(s ...googleapi.Field) *ProjectsLogsSinksListCall { 3003 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3004 return c 3005} 3006 3007// IfNoneMatch sets the optional parameter which makes the operation 3008// fail if the object's ETag matches the given value. This is useful for 3009// getting updates only after the object has changed since the last 3010// request. Use googleapi.IsNotModified to check whether the response 3011// error from Do is the result of In-None-Match. 3012func (c *ProjectsLogsSinksListCall) IfNoneMatch(entityTag string) *ProjectsLogsSinksListCall { 3013 c.ifNoneMatch_ = entityTag 3014 return c 3015} 3016 3017// Context sets the context to be used in this call's Do method. Any 3018// pending HTTP request will be aborted if the provided context is 3019// canceled. 3020func (c *ProjectsLogsSinksListCall) Context(ctx context.Context) *ProjectsLogsSinksListCall { 3021 c.ctx_ = ctx 3022 return c 3023} 3024 3025// Header returns an http.Header that can be modified by the caller to 3026// add HTTP headers to the request. 3027func (c *ProjectsLogsSinksListCall) Header() http.Header { 3028 if c.header_ == nil { 3029 c.header_ = make(http.Header) 3030 } 3031 return c.header_ 3032} 3033 3034func (c *ProjectsLogsSinksListCall) doRequest(alt string) (*http.Response, error) { 3035 reqHeaders := make(http.Header) 3036 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/00000000") 3037 for k, v := range c.header_ { 3038 reqHeaders[k] = v 3039 } 3040 reqHeaders.Set("User-Agent", c.s.userAgent()) 3041 if c.ifNoneMatch_ != "" { 3042 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 3043 } 3044 var body io.Reader = nil 3045 c.urlParams_.Set("alt", alt) 3046 c.urlParams_.Set("prettyPrint", "false") 3047 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta3/projects/{projectsId}/logs/{logsId}/sinks") 3048 urls += "?" + c.urlParams_.Encode() 3049 req, err := http.NewRequest("GET", urls, body) 3050 if err != nil { 3051 return nil, err 3052 } 3053 req.Header = reqHeaders 3054 googleapi.Expand(req.URL, map[string]string{ 3055 "projectsId": c.projectsId, 3056 "logsId": c.logsId, 3057 }) 3058 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3059} 3060 3061// Do executes the "logging.projects.logs.sinks.list" call. 3062// Exactly one of *ListLogSinksResponse or error will be non-nil. Any 3063// non-2xx status code is an error. Response headers are in either 3064// *ListLogSinksResponse.ServerResponse.Header or (if a response was 3065// returned at all) in error.(*googleapi.Error).Header. Use 3066// googleapi.IsNotModified to check whether the returned error was 3067// because http.StatusNotModified was returned. 3068func (c *ProjectsLogsSinksListCall) Do(opts ...googleapi.CallOption) (*ListLogSinksResponse, error) { 3069 gensupport.SetOptions(c.urlParams_, opts...) 3070 res, err := c.doRequest("json") 3071 if res != nil && res.StatusCode == http.StatusNotModified { 3072 if res.Body != nil { 3073 res.Body.Close() 3074 } 3075 return nil, &googleapi.Error{ 3076 Code: res.StatusCode, 3077 Header: res.Header, 3078 } 3079 } 3080 if err != nil { 3081 return nil, err 3082 } 3083 defer googleapi.CloseBody(res) 3084 if err := googleapi.CheckResponse(res); err != nil { 3085 return nil, err 3086 } 3087 ret := &ListLogSinksResponse{ 3088 ServerResponse: googleapi.ServerResponse{ 3089 Header: res.Header, 3090 HTTPStatusCode: res.StatusCode, 3091 }, 3092 } 3093 target := &ret 3094 if err := gensupport.DecodeResponse(target, res); err != nil { 3095 return nil, err 3096 } 3097 return ret, nil 3098 // { 3099 // "description": "Lists log sinks associated with the specified log.", 3100 // "httpMethod": "GET", 3101 // "id": "logging.projects.logs.sinks.list", 3102 // "parameterOrder": [ 3103 // "projectsId", 3104 // "logsId" 3105 // ], 3106 // "parameters": { 3107 // "logsId": { 3108 // "description": "Part of `logName`. See documentation of `projectsId`.", 3109 // "location": "path", 3110 // "required": true, 3111 // "type": "string" 3112 // }, 3113 // "projectsId": { 3114 // "description": "Part of `logName`. The log for which to list sinks.", 3115 // "location": "path", 3116 // "required": true, 3117 // "type": "string" 3118 // } 3119 // }, 3120 // "path": "v1beta3/projects/{projectsId}/logs/{logsId}/sinks", 3121 // "response": { 3122 // "$ref": "ListLogSinksResponse" 3123 // }, 3124 // "scopes": [ 3125 // "https://www.googleapis.com/auth/cloud-platform" 3126 // ] 3127 // } 3128 3129} 3130 3131// method id "logging.projects.logs.sinks.update": 3132 3133type ProjectsLogsSinksUpdateCall struct { 3134 s *Service 3135 projectsId string 3136 logsId string 3137 sinksId string 3138 logsink *LogSink 3139 urlParams_ gensupport.URLParams 3140 ctx_ context.Context 3141 header_ http.Header 3142} 3143 3144// Update: Creates or updates the specified log sink resource. 3145func (r *ProjectsLogsSinksService) Update(projectsId string, logsId string, sinksId string, logsink *LogSink) *ProjectsLogsSinksUpdateCall { 3146 c := &ProjectsLogsSinksUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3147 c.projectsId = projectsId 3148 c.logsId = logsId 3149 c.sinksId = sinksId 3150 c.logsink = logsink 3151 return c 3152} 3153 3154// Fields allows partial responses to be retrieved. See 3155// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3156// for more information. 3157func (c *ProjectsLogsSinksUpdateCall) Fields(s ...googleapi.Field) *ProjectsLogsSinksUpdateCall { 3158 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3159 return c 3160} 3161 3162// Context sets the context to be used in this call's Do method. Any 3163// pending HTTP request will be aborted if the provided context is 3164// canceled. 3165func (c *ProjectsLogsSinksUpdateCall) Context(ctx context.Context) *ProjectsLogsSinksUpdateCall { 3166 c.ctx_ = ctx 3167 return c 3168} 3169 3170// Header returns an http.Header that can be modified by the caller to 3171// add HTTP headers to the request. 3172func (c *ProjectsLogsSinksUpdateCall) Header() http.Header { 3173 if c.header_ == nil { 3174 c.header_ = make(http.Header) 3175 } 3176 return c.header_ 3177} 3178 3179func (c *ProjectsLogsSinksUpdateCall) doRequest(alt string) (*http.Response, error) { 3180 reqHeaders := make(http.Header) 3181 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/00000000") 3182 for k, v := range c.header_ { 3183 reqHeaders[k] = v 3184 } 3185 reqHeaders.Set("User-Agent", c.s.userAgent()) 3186 var body io.Reader = nil 3187 body, err := googleapi.WithoutDataWrapper.JSONReader(c.logsink) 3188 if err != nil { 3189 return nil, err 3190 } 3191 reqHeaders.Set("Content-Type", "application/json") 3192 c.urlParams_.Set("alt", alt) 3193 c.urlParams_.Set("prettyPrint", "false") 3194 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta3/projects/{projectsId}/logs/{logsId}/sinks/{sinksId}") 3195 urls += "?" + c.urlParams_.Encode() 3196 req, err := http.NewRequest("PUT", urls, body) 3197 if err != nil { 3198 return nil, err 3199 } 3200 req.Header = reqHeaders 3201 googleapi.Expand(req.URL, map[string]string{ 3202 "projectsId": c.projectsId, 3203 "logsId": c.logsId, 3204 "sinksId": c.sinksId, 3205 }) 3206 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3207} 3208 3209// Do executes the "logging.projects.logs.sinks.update" call. 3210// Exactly one of *LogSink or error will be non-nil. Any non-2xx status 3211// code is an error. Response headers are in either 3212// *LogSink.ServerResponse.Header or (if a response was returned at all) 3213// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 3214// check whether the returned error was because http.StatusNotModified 3215// was returned. 3216func (c *ProjectsLogsSinksUpdateCall) Do(opts ...googleapi.CallOption) (*LogSink, error) { 3217 gensupport.SetOptions(c.urlParams_, opts...) 3218 res, err := c.doRequest("json") 3219 if res != nil && res.StatusCode == http.StatusNotModified { 3220 if res.Body != nil { 3221 res.Body.Close() 3222 } 3223 return nil, &googleapi.Error{ 3224 Code: res.StatusCode, 3225 Header: res.Header, 3226 } 3227 } 3228 if err != nil { 3229 return nil, err 3230 } 3231 defer googleapi.CloseBody(res) 3232 if err := googleapi.CheckResponse(res); err != nil { 3233 return nil, err 3234 } 3235 ret := &LogSink{ 3236 ServerResponse: googleapi.ServerResponse{ 3237 Header: res.Header, 3238 HTTPStatusCode: res.StatusCode, 3239 }, 3240 } 3241 target := &ret 3242 if err := gensupport.DecodeResponse(target, res); err != nil { 3243 return nil, err 3244 } 3245 return ret, nil 3246 // { 3247 // "description": "Creates or updates the specified log sink resource.", 3248 // "httpMethod": "PUT", 3249 // "id": "logging.projects.logs.sinks.update", 3250 // "parameterOrder": [ 3251 // "projectsId", 3252 // "logsId", 3253 // "sinksId" 3254 // ], 3255 // "parameters": { 3256 // "logsId": { 3257 // "description": "Part of `sinkName`. See documentation of `projectsId`.", 3258 // "location": "path", 3259 // "required": true, 3260 // "type": "string" 3261 // }, 3262 // "projectsId": { 3263 // "description": "Part of `sinkName`. The name of the sink to update.", 3264 // "location": "path", 3265 // "required": true, 3266 // "type": "string" 3267 // }, 3268 // "sinksId": { 3269 // "description": "Part of `sinkName`. See documentation of `projectsId`.", 3270 // "location": "path", 3271 // "required": true, 3272 // "type": "string" 3273 // } 3274 // }, 3275 // "path": "v1beta3/projects/{projectsId}/logs/{logsId}/sinks/{sinksId}", 3276 // "request": { 3277 // "$ref": "LogSink" 3278 // }, 3279 // "response": { 3280 // "$ref": "LogSink" 3281 // }, 3282 // "scopes": [ 3283 // "https://www.googleapis.com/auth/cloud-platform" 3284 // ] 3285 // } 3286 3287} 3288