1// Copyright 2019 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 cloudscheduler provides access to the Cloud Scheduler API. 8// 9// For product documentation, see: https://cloud.google.com/scheduler/ 10// 11// Creating a client 12// 13// Usage example: 14// 15// import "google.golang.org/api/cloudscheduler/v1beta1" 16// ... 17// ctx := context.Background() 18// cloudschedulerService, err := cloudscheduler.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// cloudschedulerService, err := cloudscheduler.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// cloudschedulerService, err := cloudscheduler.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token))) 36// 37// See https://godoc.org/google.golang.org/api/option/ for details on options. 38package cloudscheduler // import "google.golang.org/api/cloudscheduler/v1beta1" 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 htransport "google.golang.org/api/transport/http" 56) 57 58// Always reference these packages, just in case the auto-generated code 59// below doesn't. 60var _ = bytes.NewBuffer 61var _ = strconv.Itoa 62var _ = fmt.Sprintf 63var _ = json.NewDecoder 64var _ = io.Copy 65var _ = url.Parse 66var _ = gensupport.MarshalJSON 67var _ = googleapi.Version 68var _ = errors.New 69var _ = strings.Replace 70var _ = context.Canceled 71 72const apiId = "cloudscheduler:v1beta1" 73const apiName = "cloudscheduler" 74const apiVersion = "v1beta1" 75const basePath = "https://cloudscheduler.googleapis.com/" 76 77// OAuth2 scopes used by this API. 78const ( 79 // View and manage your data across Google Cloud Platform services 80 CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform" 81) 82 83// NewService creates a new Service. 84func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) { 85 scopesOption := option.WithScopes( 86 "https://www.googleapis.com/auth/cloud-platform", 87 ) 88 // NOTE: prepend, so we don't override user-specified scopes. 89 opts = append([]option.ClientOption{scopesOption}, opts...) 90 client, endpoint, err := htransport.NewClient(ctx, opts...) 91 if err != nil { 92 return nil, err 93 } 94 s, err := New(client) 95 if err != nil { 96 return nil, err 97 } 98 if endpoint != "" { 99 s.BasePath = endpoint 100 } 101 return s, nil 102} 103 104// New creates a new Service. It uses the provided http.Client for requests. 105// 106// Deprecated: please use NewService instead. 107// To provide a custom HTTP client, use option.WithHTTPClient. 108// If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead. 109func New(client *http.Client) (*Service, error) { 110 if client == nil { 111 return nil, errors.New("client is nil") 112 } 113 s := &Service{client: client, BasePath: basePath} 114 s.Projects = NewProjectsService(s) 115 return s, nil 116} 117 118type Service struct { 119 client *http.Client 120 BasePath string // API endpoint base URL 121 UserAgent string // optional additional User-Agent fragment 122 123 Projects *ProjectsService 124} 125 126func (s *Service) userAgent() string { 127 if s.UserAgent == "" { 128 return googleapi.UserAgent 129 } 130 return googleapi.UserAgent + " " + s.UserAgent 131} 132 133func NewProjectsService(s *Service) *ProjectsService { 134 rs := &ProjectsService{s: s} 135 rs.Locations = NewProjectsLocationsService(s) 136 return rs 137} 138 139type ProjectsService struct { 140 s *Service 141 142 Locations *ProjectsLocationsService 143} 144 145func NewProjectsLocationsService(s *Service) *ProjectsLocationsService { 146 rs := &ProjectsLocationsService{s: s} 147 rs.Jobs = NewProjectsLocationsJobsService(s) 148 return rs 149} 150 151type ProjectsLocationsService struct { 152 s *Service 153 154 Jobs *ProjectsLocationsJobsService 155} 156 157func NewProjectsLocationsJobsService(s *Service) *ProjectsLocationsJobsService { 158 rs := &ProjectsLocationsJobsService{s: s} 159 return rs 160} 161 162type ProjectsLocationsJobsService struct { 163 s *Service 164} 165 166// AppEngineHttpTarget: App Engine target. The job will be pushed to a 167// job handler by means 168// of an HTTP request via an http_method such 169// as HTTP POST, HTTP GET, etc. The job is acknowledged by means of 170// an 171// HTTP response code in the range [200 - 299]. Error 503 is 172// considered an App Engine system error instead of an 173// application 174// error. Requests returning error 503 will be retried regardless 175// of 176// retry configuration and not counted against retry counts. Any 177// other 178// response code, or a failure to receive a response before 179// the 180// deadline, constitutes a failed attempt. 181type AppEngineHttpTarget struct { 182 // AppEngineRouting: App Engine Routing setting for the job. 183 AppEngineRouting *AppEngineRouting `json:"appEngineRouting,omitempty"` 184 185 // Body: Body. 186 // 187 // HTTP request body. A request body is allowed only if the HTTP method 188 // is 189 // POST or PUT. It will result in invalid argument error to set a body 190 // on a 191 // job with an incompatible HttpMethod. 192 Body string `json:"body,omitempty"` 193 194 // Headers: HTTP request headers. 195 // 196 // This map contains the header field names and values. Headers can be 197 // set 198 // when the job is created. 199 // 200 // Cloud Scheduler sets some headers to default values: 201 // 202 // * `User-Agent`: By default, this header is 203 // "AppEngine-Google; (+http://code.google.com/appengine)". 204 // This header can be modified, but Cloud Scheduler will append 205 // "AppEngine-Google; (+http://code.google.com/appengine)" to the 206 // modified `User-Agent`. 207 // * `X-CloudScheduler`: This header will be set to true. 208 // 209 // If the job has an body, Cloud Scheduler sets 210 // the following headers: 211 // 212 // * `Content-Type`: By default, the `Content-Type` header is set to 213 // "application/octet-stream". The default can be overridden by 214 // explictly 215 // setting `Content-Type` to a particular media type when the job is 216 // created. 217 // For example, `Content-Type` can be set to "application/json". 218 // * `Content-Length`: This is computed by Cloud Scheduler. This value 219 // is 220 // output only. It cannot be changed. 221 // 222 // The headers below are output only. They cannot be set or 223 // overridden: 224 // 225 // * `X-Google-*`: For Google internal use only. 226 // * `X-AppEngine-*`: For Google internal use only. 227 // 228 // In addition, some App Engine headers, which contain 229 // job-specific information, are also be sent to the job handler. 230 Headers map[string]string `json:"headers,omitempty"` 231 232 // HttpMethod: The HTTP method to use for the request. PATCH and OPTIONS 233 // are not 234 // permitted. 235 // 236 // Possible values: 237 // "HTTP_METHOD_UNSPECIFIED" - HTTP method unspecified. Defaults to 238 // POST. 239 // "POST" - HTTP POST 240 // "GET" - HTTP GET 241 // "HEAD" - HTTP HEAD 242 // "PUT" - HTTP PUT 243 // "DELETE" - HTTP DELETE 244 // "PATCH" - HTTP PATCH 245 // "OPTIONS" - HTTP OPTIONS 246 HttpMethod string `json:"httpMethod,omitempty"` 247 248 // RelativeUri: The relative URI. 249 // 250 // The relative URL must begin with "/" and must be a valid HTTP 251 // relative URL. 252 // It can contain a path, query string arguments, and `#` fragments. 253 // If the relative URL is empty, then the root path "/" will be used. 254 // No spaces are allowed, and the maximum length allowed is 2083 255 // characters. 256 RelativeUri string `json:"relativeUri,omitempty"` 257 258 // ForceSendFields is a list of field names (e.g. "AppEngineRouting") to 259 // unconditionally include in API requests. By default, fields with 260 // empty values are omitted from API requests. However, any non-pointer, 261 // non-interface field appearing in ForceSendFields will be sent to the 262 // server regardless of whether the field is empty or not. This may be 263 // used to include empty fields in Patch requests. 264 ForceSendFields []string `json:"-"` 265 266 // NullFields is a list of field names (e.g. "AppEngineRouting") to 267 // include in API requests with the JSON null value. By default, fields 268 // with empty values are omitted from API requests. However, any field 269 // with an empty value appearing in NullFields will be sent to the 270 // server as null. It is an error if a field in this list has a 271 // non-empty value. This may be used to include null fields in Patch 272 // requests. 273 NullFields []string `json:"-"` 274} 275 276func (s *AppEngineHttpTarget) MarshalJSON() ([]byte, error) { 277 type NoMethod AppEngineHttpTarget 278 raw := NoMethod(*s) 279 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 280} 281 282// AppEngineRouting: App Engine Routing. 283// 284// For more information about services, versions, and instances see 285// [An Overview of 286// App 287// Engine](https://cloud.google.com/appengine/docs/python/an-overview 288// -of-app-engine), 289// [Microservices Architecture on Google 290// App 291// Engine](https://cloud.google.com/appengine/docs/python/microservic 292// es-on-app-engine), 293// [App Engine Standard 294// request 295// routing](https://cloud.google.com/appengine/docs/standard/pyth 296// on/how-requests-are-routed), 297// and [App Engine Flex 298// request 299// routing](https://cloud.google.com/appengine/docs/flexible/pyth 300// on/how-requests-are-routed). 301type AppEngineRouting struct { 302 // Host: Output only. The host that the job is sent to. 303 // 304 // For more information about how App Engine requests are routed, 305 // see 306 // [here](https://cloud.google.com/appengine/docs/standard/python/how 307 // -requests-are-routed). 308 // 309 // The host is constructed as: 310 // 311 // 312 // * `host = [application_domain_name]`</br> 313 // `| [service] + '.' + [application_domain_name]`</br> 314 // `| [version] + '.' + [application_domain_name]`</br> 315 // `| [version_dot_service]+ '.' + [application_domain_name]`</br> 316 // `| [instance] + '.' + [application_domain_name]`</br> 317 // `| [instance_dot_service] + '.' + [application_domain_name]`</br> 318 // `| [instance_dot_version] + '.' + [application_domain_name]`</br> 319 // `| [instance_dot_version_dot_service] + '.' + 320 // [application_domain_name]` 321 // 322 // * `application_domain_name` = The domain name of the app, for 323 // example <app-id>.appspot.com, which is associated with the 324 // job's project ID. 325 // 326 // * `service =` service 327 // 328 // * `version =` version 329 // 330 // * `version_dot_service =` 331 // version `+ '.' +` 332 // service 333 // 334 // * `instance =` instance 335 // 336 // * `instance_dot_service =` 337 // instance `+ '.' +` 338 // service 339 // 340 // * `instance_dot_version =` 341 // instance `+ '.' +` 342 // version 343 // 344 // * `instance_dot_version_dot_service =` 345 // instance `+ '.' +` 346 // version `+ '.' +` 347 // service 348 // 349 // 350 // If service is empty, then the job will be sent 351 // to the service which is the default service when the job is 352 // attempted. 353 // 354 // If version is empty, then the job will be sent 355 // to the version which is the default version when the job is 356 // attempted. 357 // 358 // If instance is empty, then the job will be 359 // sent to an instance which is available when the job is attempted. 360 // 361 // If service, 362 // version, or 363 // instance is invalid, then the job will be sent 364 // to the default version of the default service when the job is 365 // attempted. 366 Host string `json:"host,omitempty"` 367 368 // Instance: App instance. 369 // 370 // By default, the job is sent to an instance which is available 371 // when 372 // the job is attempted. 373 // 374 // Requests can only be sent to a specific instance if 375 // [manual scaling is used in App 376 // Engine 377 // Standard](https://cloud.google.com/appengine/docs/python/an-ove 378 // rview-of-app-engine?hl=en_US#scaling_types_and_instance_classes). 379 // App Engine Flex does not support instances. For more information, 380 // see 381 // [App Engine Standard 382 // request 383 // routing](https://cloud.google.com/appengine/docs/standard/pyth 384 // on/how-requests-are-routed) 385 // and [App Engine Flex 386 // request 387 // routing](https://cloud.google.com/appengine/docs/flexible/pyth 388 // on/how-requests-are-routed). 389 Instance string `json:"instance,omitempty"` 390 391 // Service: App service. 392 // 393 // By default, the job is sent to the service which is the 394 // default 395 // service when the job is attempted. 396 Service string `json:"service,omitempty"` 397 398 // Version: App version. 399 // 400 // By default, the job is sent to the version which is the 401 // default 402 // version when the job is attempted. 403 Version string `json:"version,omitempty"` 404 405 // ForceSendFields is a list of field names (e.g. "Host") to 406 // unconditionally include in API requests. By default, fields with 407 // empty values are omitted from API requests. However, any non-pointer, 408 // non-interface field appearing in ForceSendFields will be sent to the 409 // server regardless of whether the field is empty or not. This may be 410 // used to include empty fields in Patch requests. 411 ForceSendFields []string `json:"-"` 412 413 // NullFields is a list of field names (e.g. "Host") to include in API 414 // requests with the JSON null value. By default, fields with empty 415 // values are omitted from API requests. However, any field with an 416 // empty value appearing in NullFields will be sent to the server as 417 // null. It is an error if a field in this list has a non-empty value. 418 // This may be used to include null fields in Patch requests. 419 NullFields []string `json:"-"` 420} 421 422func (s *AppEngineRouting) MarshalJSON() ([]byte, error) { 423 type NoMethod AppEngineRouting 424 raw := NoMethod(*s) 425 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 426} 427 428// Empty: A generic empty message that you can re-use to avoid defining 429// duplicated 430// empty messages in your APIs. A typical example is to use it as the 431// request 432// or the response type of an API method. For instance: 433// 434// service Foo { 435// rpc Bar(google.protobuf.Empty) returns 436// (google.protobuf.Empty); 437// } 438// 439// The JSON representation for `Empty` is empty JSON object `{}`. 440type Empty struct { 441 // ServerResponse contains the HTTP response code and headers from the 442 // server. 443 googleapi.ServerResponse `json:"-"` 444} 445 446// HttpTarget: Http target. The job will be pushed to the job handler by 447// means of 448// an HTTP request via an http_method such as HTTP 449// POST, HTTP GET, etc. The job is acknowledged by means of an 450// HTTP 451// response code in the range [200 - 299]. A failure to receive a 452// response 453// constitutes a failed execution. For a redirected request, the 454// response 455// returned by the redirected request is considered. 456type HttpTarget struct { 457 // Body: HTTP request body. A request body is allowed only if the 458 // HTTP 459 // method is POST, PUT, or PATCH. It is an error to set body on a job 460 // with an 461 // incompatible HttpMethod. 462 Body string `json:"body,omitempty"` 463 464 // Headers: The user can specify HTTP request headers to send with the 465 // job's 466 // HTTP request. This map contains the header field names and 467 // values. Repeated headers are not supported, but a header value 468 // can 469 // contain commas. These headers represent a subset of the headers 470 // that will accompany the job's HTTP request. Some HTTP request 471 // headers will be ignored or replaced. A partial list of headers 472 // that 473 // will be ignored or replaced is below: 474 // - Host: This will be computed by Cloud Scheduler and derived 475 // from 476 // uri. 477 // * `Content-Length`: This will be computed by Cloud Scheduler. 478 // * `User-Agent`: This will be set to "Google-Cloud-Scheduler". 479 // * `X-Google-*`: Google internal use only. 480 // * `X-AppEngine-*`: Google internal use only. 481 // 482 // The total size of headers must be less than 80KB. 483 Headers map[string]string `json:"headers,omitempty"` 484 485 // HttpMethod: Which HTTP method to use for the request. 486 // 487 // Possible values: 488 // "HTTP_METHOD_UNSPECIFIED" - HTTP method unspecified. Defaults to 489 // POST. 490 // "POST" - HTTP POST 491 // "GET" - HTTP GET 492 // "HEAD" - HTTP HEAD 493 // "PUT" - HTTP PUT 494 // "DELETE" - HTTP DELETE 495 // "PATCH" - HTTP PATCH 496 // "OPTIONS" - HTTP OPTIONS 497 HttpMethod string `json:"httpMethod,omitempty"` 498 499 // OauthToken: If specified, an 500 // [OAuth 501 // token](https://developers.google.com/identity/protocols/OAuth2) 502 // will be generated and attached as an `Authorization` header in the 503 // HTTP 504 // request. 505 // 506 // This type of authorization should generally only be used when 507 // calling 508 // Google APIs hosted on *.googleapis.com. 509 OauthToken *OAuthToken `json:"oauthToken,omitempty"` 510 511 // OidcToken: If specified, 512 // an 513 // [OIDC](https://developers.google.com/identity/protocols/OpenIDConne 514 // ct) 515 // token will be generated and attached as an `Authorization` header in 516 // the 517 // HTTP request. 518 // 519 // This type of authorization can be used for many scenarios, 520 // including 521 // calling Cloud Run, or endpoints where you intend to validate the 522 // token 523 // yourself. 524 OidcToken *OidcToken `json:"oidcToken,omitempty"` 525 526 // Uri: Required. The full URI path that the request will be sent to. 527 // This string 528 // must begin with either "http://" or "https://". Some examples 529 // of 530 // valid values for uri are: 531 // `http://acme.com` and `https://acme.com/sales:8080`. Cloud Scheduler 532 // will 533 // encode some characters for safety and compatibility. The maximum 534 // allowed 535 // URL length is 2083 characters after encoding. 536 Uri string `json:"uri,omitempty"` 537 538 // ForceSendFields is a list of field names (e.g. "Body") to 539 // unconditionally include in API requests. By default, fields with 540 // empty values are omitted from API requests. However, any non-pointer, 541 // non-interface field appearing in ForceSendFields will be sent to the 542 // server regardless of whether the field is empty or not. This may be 543 // used to include empty fields in Patch requests. 544 ForceSendFields []string `json:"-"` 545 546 // NullFields is a list of field names (e.g. "Body") to include in API 547 // requests with the JSON null value. By default, fields with empty 548 // values are omitted from API requests. However, any field with an 549 // empty value appearing in NullFields will be sent to the server as 550 // null. It is an error if a field in this list has a non-empty value. 551 // This may be used to include null fields in Patch requests. 552 NullFields []string `json:"-"` 553} 554 555func (s *HttpTarget) MarshalJSON() ([]byte, error) { 556 type NoMethod HttpTarget 557 raw := NoMethod(*s) 558 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 559} 560 561// Job: Configuration for a job. 562// The maximum allowed size for a job is 100KB. 563type Job struct { 564 // AppEngineHttpTarget: App Engine HTTP target. 565 AppEngineHttpTarget *AppEngineHttpTarget `json:"appEngineHttpTarget,omitempty"` 566 567 // AttemptDeadline: The deadline for job attempts. If the request 568 // handler does not respond by 569 // this deadline then the request is cancelled and the attempt is marked 570 // as a 571 // `DEADLINE_EXCEEDED` failure. The failed attempt can be viewed 572 // in 573 // execution logs. Cloud Scheduler will retry the job according 574 // to the RetryConfig. 575 // 576 // The allowed duration for this deadline is: 577 // 578 // * For HTTP targets, between 15 seconds and 30 minutes. 579 // * For App Engine HTTP targets, between 15 580 // seconds and 24 hours. 581 // * For PubSub targets, this field is ignored. 582 AttemptDeadline string `json:"attemptDeadline,omitempty"` 583 584 // Description: Optionally caller-specified in CreateJob 585 // or 586 // UpdateJob. 587 // 588 // A human-readable description for the job. This string must not 589 // contain 590 // more than 500 characters. 591 Description string `json:"description,omitempty"` 592 593 // HttpTarget: HTTP target. 594 HttpTarget *HttpTarget `json:"httpTarget,omitempty"` 595 596 // LastAttemptTime: Output only. The time the last job attempt started. 597 LastAttemptTime string `json:"lastAttemptTime,omitempty"` 598 599 // Name: Optionally caller-specified in CreateJob, after 600 // which it becomes output only. 601 // 602 // The job name. For 603 // example: 604 // `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`. 605 // 606 // * `PROJECT_ID` can contain letters ([A-Za-z]), numbers ([0-9]), 607 // hyphens (-), colons (:), or periods (.). 608 // For more information, see 609 // [Identifying 610 // 611 // projects](https://cloud.google.com/resource-manager/docs/creating-mana 612 // ging-projects#identifying_projects) 613 // * `LOCATION_ID` is the canonical ID for the job's location. 614 // The list of available locations can be obtained by calling 615 // ListLocations. 616 // For more information, see 617 // https://cloud.google.com/about/locations/. 618 // * `JOB_ID` can contain only letters ([A-Za-z]), numbers ([0-9]), 619 // hyphens (-), or underscores (_). The maximum length is 500 620 // characters. 621 Name string `json:"name,omitempty"` 622 623 // PubsubTarget: Pub/Sub target. 624 PubsubTarget *PubsubTarget `json:"pubsubTarget,omitempty"` 625 626 // RetryConfig: Settings that determine the retry behavior. 627 RetryConfig *RetryConfig `json:"retryConfig,omitempty"` 628 629 // Schedule: Required, except when used with UpdateJob. 630 // 631 // Describes the schedule on which the job will be executed. 632 // 633 // The schedule can be either of the following types: 634 // 635 // * [Crontab](http://en.wikipedia.org/wiki/Cron#Overview) 636 // * 637 // English-like 638 // [schedule](https://cloud.google.com/scheduler/docs/config 639 // uring/cron-job-schedules) 640 // 641 // As a general rule, execution `n + 1` of a job will not begin 642 // until execution `n` has finished. Cloud Scheduler will never 643 // allow two simultaneously outstanding executions. For example, 644 // this implies that if the `n+1`th execution is scheduled to run 645 // at 646 // 16:00 but the `n`th execution takes until 16:15, the 647 // `n+1`th 648 // execution will not start until `16:15`. 649 // A scheduled start time will be delayed if the previous 650 // execution has not ended when its scheduled time occurs. 651 // 652 // If retry_count > 0 and a job attempt fails, 653 // the job will be tried a total of retry_count 654 // times, with exponential backoff, until the next scheduled start 655 // time. 656 Schedule string `json:"schedule,omitempty"` 657 658 // ScheduleTime: Output only. The next time the job is scheduled. Note 659 // that this may be a 660 // retry of a previously failed attempt or the next execution 661 // time 662 // according to the schedule. 663 ScheduleTime string `json:"scheduleTime,omitempty"` 664 665 // State: Output only. State of the job. 666 // 667 // Possible values: 668 // "STATE_UNSPECIFIED" - Unspecified state. 669 // "ENABLED" - The job is executing normally. 670 // "PAUSED" - The job is paused by the user. It will not execute. A 671 // user can 672 // intentionally pause the job using 673 // PauseJobRequest. 674 // "DISABLED" - The job is disabled by the system due to error. The 675 // user 676 // cannot directly set a job to be disabled. 677 // "UPDATE_FAILED" - The job state resulting from a failed 678 // CloudScheduler.UpdateJob 679 // operation. To recover a job from this state, 680 // retry 681 // CloudScheduler.UpdateJob until a successful response is received. 682 State string `json:"state,omitempty"` 683 684 // Status: Output only. The response from the target for the last 685 // attempted execution. 686 Status *Status `json:"status,omitempty"` 687 688 // TimeZone: Specifies the time zone to be used in 689 // interpreting 690 // schedule. The value of this field must be a time 691 // zone name from the [tz 692 // database](http://en.wikipedia.org/wiki/Tz_database). 693 // 694 // Note that some time zones include a provision for 695 // daylight savings time. The rules for daylight saving time 696 // are 697 // determined by the chosen tz. For UTC use the string "utc". If a 698 // time zone is not specified, the default will be in UTC (also known 699 // as GMT). 700 TimeZone string `json:"timeZone,omitempty"` 701 702 // UserUpdateTime: Output only. The creation time of the job. 703 UserUpdateTime string `json:"userUpdateTime,omitempty"` 704 705 // ServerResponse contains the HTTP response code and headers from the 706 // server. 707 googleapi.ServerResponse `json:"-"` 708 709 // ForceSendFields is a list of field names (e.g. "AppEngineHttpTarget") 710 // to unconditionally include in API requests. By default, fields with 711 // empty values are omitted from API requests. However, any non-pointer, 712 // non-interface field appearing in ForceSendFields will be sent to the 713 // server regardless of whether the field is empty or not. This may be 714 // used to include empty fields in Patch requests. 715 ForceSendFields []string `json:"-"` 716 717 // NullFields is a list of field names (e.g. "AppEngineHttpTarget") to 718 // include in API requests with the JSON null value. By default, fields 719 // with empty values are omitted from API requests. However, any field 720 // with an empty value appearing in NullFields will be sent to the 721 // server as null. It is an error if a field in this list has a 722 // non-empty value. This may be used to include null fields in Patch 723 // requests. 724 NullFields []string `json:"-"` 725} 726 727func (s *Job) MarshalJSON() ([]byte, error) { 728 type NoMethod Job 729 raw := NoMethod(*s) 730 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 731} 732 733// ListJobsResponse: Response message for listing jobs using ListJobs. 734type ListJobsResponse struct { 735 // Jobs: The list of jobs. 736 Jobs []*Job `json:"jobs,omitempty"` 737 738 // NextPageToken: A token to retrieve next page of results. Pass this 739 // value in the 740 // page_token field in the subsequent call to 741 // ListJobs to retrieve the next page of results. 742 // If this is empty it indicates that there are no more results 743 // through which to paginate. 744 // 745 // The page token is valid for only 2 hours. 746 NextPageToken string `json:"nextPageToken,omitempty"` 747 748 // ServerResponse contains the HTTP response code and headers from the 749 // server. 750 googleapi.ServerResponse `json:"-"` 751 752 // ForceSendFields is a list of field names (e.g. "Jobs") to 753 // unconditionally include in API requests. By default, fields with 754 // empty values are omitted from API requests. However, any non-pointer, 755 // non-interface field appearing in ForceSendFields will be sent to the 756 // server regardless of whether the field is empty or not. This may be 757 // used to include empty fields in Patch requests. 758 ForceSendFields []string `json:"-"` 759 760 // NullFields is a list of field names (e.g. "Jobs") to include in API 761 // requests with the JSON null value. By default, fields with empty 762 // values are omitted from API requests. However, any field with an 763 // empty value appearing in NullFields will be sent to the server as 764 // null. It is an error if a field in this list has a non-empty value. 765 // This may be used to include null fields in Patch requests. 766 NullFields []string `json:"-"` 767} 768 769func (s *ListJobsResponse) MarshalJSON() ([]byte, error) { 770 type NoMethod ListJobsResponse 771 raw := NoMethod(*s) 772 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 773} 774 775// ListLocationsResponse: The response message for 776// Locations.ListLocations. 777type ListLocationsResponse struct { 778 // Locations: A list of locations that matches the specified filter in 779 // the request. 780 Locations []*Location `json:"locations,omitempty"` 781 782 // NextPageToken: The standard List next-page token. 783 NextPageToken string `json:"nextPageToken,omitempty"` 784 785 // ServerResponse contains the HTTP response code and headers from the 786 // server. 787 googleapi.ServerResponse `json:"-"` 788 789 // ForceSendFields is a list of field names (e.g. "Locations") to 790 // unconditionally include in API requests. By default, fields with 791 // empty values are omitted from API requests. However, any non-pointer, 792 // non-interface field appearing in ForceSendFields will be sent to the 793 // server regardless of whether the field is empty or not. This may be 794 // used to include empty fields in Patch requests. 795 ForceSendFields []string `json:"-"` 796 797 // NullFields is a list of field names (e.g. "Locations") to include in 798 // API requests with the JSON null value. By default, fields with empty 799 // values are omitted from API requests. However, any field with an 800 // empty value appearing in NullFields will be sent to the server as 801 // null. It is an error if a field in this list has a non-empty value. 802 // This may be used to include null fields in Patch requests. 803 NullFields []string `json:"-"` 804} 805 806func (s *ListLocationsResponse) MarshalJSON() ([]byte, error) { 807 type NoMethod ListLocationsResponse 808 raw := NoMethod(*s) 809 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 810} 811 812// Location: A resource that represents Google Cloud Platform location. 813type Location struct { 814 // DisplayName: The friendly name for this location, typically a nearby 815 // city name. 816 // For example, "Tokyo". 817 DisplayName string `json:"displayName,omitempty"` 818 819 // Labels: Cross-service attributes for the location. For example 820 // 821 // {"cloud.googleapis.com/region": "us-east1"} 822 Labels map[string]string `json:"labels,omitempty"` 823 824 // LocationId: The canonical id for this location. For example: 825 // "us-east1". 826 LocationId string `json:"locationId,omitempty"` 827 828 // Metadata: Service-specific metadata. For example the available 829 // capacity at the given 830 // location. 831 Metadata googleapi.RawMessage `json:"metadata,omitempty"` 832 833 // Name: Resource name for the location, which may vary between 834 // implementations. 835 // For example: "projects/example-project/locations/us-east1" 836 Name string `json:"name,omitempty"` 837 838 // ServerResponse contains the HTTP response code and headers from the 839 // server. 840 googleapi.ServerResponse `json:"-"` 841 842 // ForceSendFields is a list of field names (e.g. "DisplayName") to 843 // unconditionally include in API requests. By default, fields with 844 // empty values are omitted from API requests. However, any non-pointer, 845 // non-interface field appearing in ForceSendFields will be sent to the 846 // server regardless of whether the field is empty or not. This may be 847 // used to include empty fields in Patch requests. 848 ForceSendFields []string `json:"-"` 849 850 // NullFields is a list of field names (e.g. "DisplayName") to include 851 // in API requests with the JSON null value. By default, fields with 852 // empty values are omitted from API requests. However, any field with 853 // an empty value appearing in NullFields will be sent to the server as 854 // null. It is an error if a field in this list has a non-empty value. 855 // This may be used to include null fields in Patch requests. 856 NullFields []string `json:"-"` 857} 858 859func (s *Location) MarshalJSON() ([]byte, error) { 860 type NoMethod Location 861 raw := NoMethod(*s) 862 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 863} 864 865// OAuthToken: Contains information needed for generating an 866// [OAuth 867// token](https://developers.google.com/identity/protocols/OAuth2). 868// This type of authorization should generally only be used when calling 869// Google 870// APIs hosted on *.googleapis.com. 871type OAuthToken struct { 872 // Scope: OAuth scope to be used for generating OAuth access token. 873 // If not specified, 874 // "https://www.googleapis.com/auth/cloud-platform" 875 // will be used. 876 Scope string `json:"scope,omitempty"` 877 878 // ServiceAccountEmail: [Service account 879 // email](https://cloud.google.com/iam/docs/service-accounts) 880 // to be used for generating OAuth token. 881 // The service account must be within the same project as the job. The 882 // caller 883 // must have iam.serviceAccounts.actAs permission for the service 884 // account. 885 ServiceAccountEmail string `json:"serviceAccountEmail,omitempty"` 886 887 // ForceSendFields is a list of field names (e.g. "Scope") to 888 // unconditionally include in API requests. By default, fields with 889 // empty values are omitted from API requests. However, any non-pointer, 890 // non-interface field appearing in ForceSendFields will be sent to the 891 // server regardless of whether the field is empty or not. This may be 892 // used to include empty fields in Patch requests. 893 ForceSendFields []string `json:"-"` 894 895 // NullFields is a list of field names (e.g. "Scope") to include in API 896 // requests with the JSON null value. By default, fields with empty 897 // values are omitted from API requests. However, any field with an 898 // empty value appearing in NullFields will be sent to the server as 899 // null. It is an error if a field in this list has a non-empty value. 900 // This may be used to include null fields in Patch requests. 901 NullFields []string `json:"-"` 902} 903 904func (s *OAuthToken) MarshalJSON() ([]byte, error) { 905 type NoMethod OAuthToken 906 raw := NoMethod(*s) 907 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 908} 909 910// OidcToken: Contains information needed for generating an 911// [OpenID 912// Connect 913// token](https://developers.google.com/identity/protocols/OpenID 914// Connect). 915// This type of authorization can be used for many scenarios, 916// including 917// calling Cloud Run, or endpoints where you intend to validate the 918// token 919// yourself. 920type OidcToken struct { 921 // Audience: Audience to be used when generating OIDC token. If not 922 // specified, the URI 923 // specified in target will be used. 924 Audience string `json:"audience,omitempty"` 925 926 // ServiceAccountEmail: [Service account 927 // email](https://cloud.google.com/iam/docs/service-accounts) 928 // to be used for generating OIDC token. 929 // The service account must be within the same project as the job. The 930 // caller 931 // must have iam.serviceAccounts.actAs permission for the service 932 // account. 933 ServiceAccountEmail string `json:"serviceAccountEmail,omitempty"` 934 935 // ForceSendFields is a list of field names (e.g. "Audience") to 936 // unconditionally include in API requests. By default, fields with 937 // empty values are omitted from API requests. However, any non-pointer, 938 // non-interface field appearing in ForceSendFields will be sent to the 939 // server regardless of whether the field is empty or not. This may be 940 // used to include empty fields in Patch requests. 941 ForceSendFields []string `json:"-"` 942 943 // NullFields is a list of field names (e.g. "Audience") to include in 944 // API requests with the JSON null value. By default, fields with empty 945 // values are omitted from API requests. However, any field with an 946 // empty value appearing in NullFields will be sent to the server as 947 // null. It is an error if a field in this list has a non-empty value. 948 // This may be used to include null fields in Patch requests. 949 NullFields []string `json:"-"` 950} 951 952func (s *OidcToken) MarshalJSON() ([]byte, error) { 953 type NoMethod OidcToken 954 raw := NoMethod(*s) 955 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 956} 957 958// PauseJobRequest: Request message for PauseJob. 959type PauseJobRequest struct { 960} 961 962// PubsubMessage: A message that is published by publishers and consumed 963// by subscribers. The 964// message must contain either a non-empty data field or at least one 965// attribute. 966// Note that client libraries represent this object 967// differently 968// depending on the language. See the corresponding 969// <a 970// href="https://cloud.google.com/pubsub/docs/reference/libraries">client 971// 972// library documentation</a> for more information. See 973// <a href="https://cloud.google.com/pubsub/quotas">Quotas and 974// limits</a> 975// for more information about message limits. 976type PubsubMessage struct { 977 // Attributes: Optional attributes for this message. 978 Attributes map[string]string `json:"attributes,omitempty"` 979 980 // Data: The message data field. If this field is empty, the message 981 // must contain 982 // at least one attribute. 983 Data string `json:"data,omitempty"` 984 985 // MessageId: ID of this message, assigned by the server when the 986 // message is published. 987 // Guaranteed to be unique within the topic. This value may be read by 988 // a 989 // subscriber that receives a `PubsubMessage` via a `Pull` call or a 990 // push 991 // delivery. It must not be populated by the publisher in a `Publish` 992 // call. 993 MessageId string `json:"messageId,omitempty"` 994 995 // PublishTime: The time at which the message was published, populated 996 // by the server when 997 // it receives the `Publish` call. It must not be populated by 998 // the 999 // publisher in a `Publish` call. 1000 PublishTime string `json:"publishTime,omitempty"` 1001 1002 // ForceSendFields is a list of field names (e.g. "Attributes") to 1003 // unconditionally include in API requests. By default, fields with 1004 // empty values are omitted from API requests. However, any non-pointer, 1005 // non-interface field appearing in ForceSendFields will be sent to the 1006 // server regardless of whether the field is empty or not. This may be 1007 // used to include empty fields in Patch requests. 1008 ForceSendFields []string `json:"-"` 1009 1010 // NullFields is a list of field names (e.g. "Attributes") to include in 1011 // API requests with the JSON null value. By default, fields with empty 1012 // values are omitted from API requests. However, any field with an 1013 // empty value appearing in NullFields will be sent to the server as 1014 // null. It is an error if a field in this list has a non-empty value. 1015 // This may be used to include null fields in Patch requests. 1016 NullFields []string `json:"-"` 1017} 1018 1019func (s *PubsubMessage) MarshalJSON() ([]byte, error) { 1020 type NoMethod PubsubMessage 1021 raw := NoMethod(*s) 1022 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1023} 1024 1025// PubsubTarget: Pub/Sub target. The job will be delivered by publishing 1026// a message to 1027// the given Pub/Sub topic. 1028type PubsubTarget struct { 1029 // Attributes: Attributes for PubsubMessage. 1030 // 1031 // Pubsub message must contain either non-empty data, or at least 1032 // one 1033 // attribute. 1034 Attributes map[string]string `json:"attributes,omitempty"` 1035 1036 // Data: The message payload for PubsubMessage. 1037 // 1038 // Pubsub message must contain either non-empty data, or at least 1039 // one 1040 // attribute. 1041 Data string `json:"data,omitempty"` 1042 1043 // TopicName: Required. The name of the Cloud Pub/Sub topic to which 1044 // messages will 1045 // be published when a job is delivered. The topic name must be in 1046 // the 1047 // same format as required by 1048 // PubSub's 1049 // [PublishRequest.name](https://cloud.google.com/pubsub/docs/re 1050 // ference/rpc/google.pubsub.v1#publishrequest), 1051 // for example `projects/PROJECT_ID/topics/TOPIC_ID`. 1052 // 1053 // The topic must be in the same project as the Cloud Scheduler job. 1054 TopicName string `json:"topicName,omitempty"` 1055 1056 // ForceSendFields is a list of field names (e.g. "Attributes") to 1057 // unconditionally include in API requests. By default, fields with 1058 // empty values are omitted from API requests. However, any non-pointer, 1059 // non-interface field appearing in ForceSendFields will be sent to the 1060 // server regardless of whether the field is empty or not. This may be 1061 // used to include empty fields in Patch requests. 1062 ForceSendFields []string `json:"-"` 1063 1064 // NullFields is a list of field names (e.g. "Attributes") to include in 1065 // API requests with the JSON null value. By default, fields with empty 1066 // values are omitted from API requests. However, any field with an 1067 // empty value appearing in NullFields will be sent to the server as 1068 // null. It is an error if a field in this list has a non-empty value. 1069 // This may be used to include null fields in Patch requests. 1070 NullFields []string `json:"-"` 1071} 1072 1073func (s *PubsubTarget) MarshalJSON() ([]byte, error) { 1074 type NoMethod PubsubTarget 1075 raw := NoMethod(*s) 1076 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1077} 1078 1079// ResumeJobRequest: Request message for ResumeJob. 1080type ResumeJobRequest struct { 1081} 1082 1083// RetryConfig: Settings that determine the retry behavior. 1084// 1085// By default, if a job does not complete successfully (meaning that 1086// an acknowledgement is not received from the handler, then it will be 1087// retried 1088// with exponential backoff according to the settings in RetryConfig. 1089type RetryConfig struct { 1090 // MaxBackoffDuration: The maximum amount of time to wait before 1091 // retrying a job after 1092 // it fails. 1093 // 1094 // The default value of this field is 1 hour. 1095 MaxBackoffDuration string `json:"maxBackoffDuration,omitempty"` 1096 1097 // MaxDoublings: The time between retries will double `max_doublings` 1098 // times. 1099 // 1100 // A job's retry interval starts at 1101 // min_backoff_duration, then doubles 1102 // `max_doublings` times, then increases linearly, and finally 1103 // retries retries at intervals of 1104 // max_backoff_duration up to 1105 // retry_count times. 1106 // 1107 // For example, if min_backoff_duration is 1108 // 10s, max_backoff_duration is 300s, and 1109 // `max_doublings` is 3, then the a job will first be retried in 10s. 1110 // The 1111 // retry interval will double three times, and then increase linearly 1112 // by 1113 // 2^3 * 10s. Finally, the job will retry at intervals 1114 // of 1115 // max_backoff_duration until the job has 1116 // been attempted retry_count times. Thus, the 1117 // requests will retry at 10s, 20s, 40s, 80s, 160s, 240s, 300s, 300s, 1118 // .... 1119 // 1120 // The default value of this field is 5. 1121 MaxDoublings int64 `json:"maxDoublings,omitempty"` 1122 1123 // MaxRetryDuration: The time limit for retrying a failed job, measured 1124 // from time when an 1125 // execution was first attempted. If specified with 1126 // retry_count, the job will be retried until both 1127 // limits are reached. 1128 // 1129 // The default value for max_retry_duration is zero, which means 1130 // retry 1131 // duration is unlimited. 1132 MaxRetryDuration string `json:"maxRetryDuration,omitempty"` 1133 1134 // MinBackoffDuration: The minimum amount of time to wait before 1135 // retrying a job after 1136 // it fails. 1137 // 1138 // The default value of this field is 5 seconds. 1139 MinBackoffDuration string `json:"minBackoffDuration,omitempty"` 1140 1141 // RetryCount: The number of attempts that the system will make to run a 1142 // job using the 1143 // exponential backoff procedure described by 1144 // max_doublings. 1145 // 1146 // The default value of retry_count is zero. 1147 // 1148 // If retry_count is zero, a job attempt will *not* be retried if 1149 // it fails. Instead the Cloud Scheduler system will wait for the 1150 // next scheduled execution time. 1151 // 1152 // If retry_count is set to a non-zero number then Cloud Scheduler 1153 // will retry failed attempts, using exponential backoff, 1154 // retry_count times, or until the next scheduled execution 1155 // time, 1156 // whichever comes first. 1157 // 1158 // Values greater than 5 and negative values are not allowed. 1159 RetryCount int64 `json:"retryCount,omitempty"` 1160 1161 // ForceSendFields is a list of field names (e.g. "MaxBackoffDuration") 1162 // to unconditionally include in API requests. By default, fields with 1163 // empty values are omitted from API requests. However, any non-pointer, 1164 // non-interface field appearing in ForceSendFields will be sent to the 1165 // server regardless of whether the field is empty or not. This may be 1166 // used to include empty fields in Patch requests. 1167 ForceSendFields []string `json:"-"` 1168 1169 // NullFields is a list of field names (e.g. "MaxBackoffDuration") to 1170 // include in API requests with the JSON null value. By default, fields 1171 // with empty values are omitted from API requests. However, any field 1172 // with an empty value appearing in NullFields will be sent to the 1173 // server as null. It is an error if a field in this list has a 1174 // non-empty value. This may be used to include null fields in Patch 1175 // requests. 1176 NullFields []string `json:"-"` 1177} 1178 1179func (s *RetryConfig) MarshalJSON() ([]byte, error) { 1180 type NoMethod RetryConfig 1181 raw := NoMethod(*s) 1182 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1183} 1184 1185// RunJobRequest: Request message for forcing a job to run now 1186// using 1187// RunJob. 1188type RunJobRequest struct { 1189} 1190 1191// Status: The `Status` type defines a logical error model that is 1192// suitable for 1193// different programming environments, including REST APIs and RPC APIs. 1194// It is 1195// used by [gRPC](https://github.com/grpc). Each `Status` message 1196// contains 1197// three pieces of data: error code, error message, and error 1198// details. 1199// 1200// You can find out more about this error model and how to work with it 1201// in the 1202// [API Design Guide](https://cloud.google.com/apis/design/errors). 1203type Status struct { 1204 // Code: The status code, which should be an enum value of 1205 // google.rpc.Code. 1206 Code int64 `json:"code,omitempty"` 1207 1208 // Details: A list of messages that carry the error details. There is a 1209 // common set of 1210 // message types for APIs to use. 1211 Details []googleapi.RawMessage `json:"details,omitempty"` 1212 1213 // Message: A developer-facing error message, which should be in 1214 // English. Any 1215 // user-facing error message should be localized and sent in 1216 // the 1217 // google.rpc.Status.details field, or localized by the client. 1218 Message string `json:"message,omitempty"` 1219 1220 // ForceSendFields is a list of field names (e.g. "Code") to 1221 // unconditionally include in API requests. By default, fields with 1222 // empty values are omitted from API requests. However, any non-pointer, 1223 // non-interface field appearing in ForceSendFields will be sent to the 1224 // server regardless of whether the field is empty or not. This may be 1225 // used to include empty fields in Patch requests. 1226 ForceSendFields []string `json:"-"` 1227 1228 // NullFields is a list of field names (e.g. "Code") to include in API 1229 // requests with the JSON null value. By default, fields with empty 1230 // values are omitted from API requests. However, any field with an 1231 // empty value appearing in NullFields will be sent to the server as 1232 // null. It is an error if a field in this list has a non-empty value. 1233 // This may be used to include null fields in Patch requests. 1234 NullFields []string `json:"-"` 1235} 1236 1237func (s *Status) MarshalJSON() ([]byte, error) { 1238 type NoMethod Status 1239 raw := NoMethod(*s) 1240 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1241} 1242 1243// method id "cloudscheduler.projects.locations.get": 1244 1245type ProjectsLocationsGetCall struct { 1246 s *Service 1247 name string 1248 urlParams_ gensupport.URLParams 1249 ifNoneMatch_ string 1250 ctx_ context.Context 1251 header_ http.Header 1252} 1253 1254// Get: Gets information about a location. 1255func (r *ProjectsLocationsService) Get(name string) *ProjectsLocationsGetCall { 1256 c := &ProjectsLocationsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1257 c.name = name 1258 return c 1259} 1260 1261// Fields allows partial responses to be retrieved. See 1262// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1263// for more information. 1264func (c *ProjectsLocationsGetCall) Fields(s ...googleapi.Field) *ProjectsLocationsGetCall { 1265 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1266 return c 1267} 1268 1269// IfNoneMatch sets the optional parameter which makes the operation 1270// fail if the object's ETag matches the given value. This is useful for 1271// getting updates only after the object has changed since the last 1272// request. Use googleapi.IsNotModified to check whether the response 1273// error from Do is the result of In-None-Match. 1274func (c *ProjectsLocationsGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsGetCall { 1275 c.ifNoneMatch_ = entityTag 1276 return c 1277} 1278 1279// Context sets the context to be used in this call's Do method. Any 1280// pending HTTP request will be aborted if the provided context is 1281// canceled. 1282func (c *ProjectsLocationsGetCall) Context(ctx context.Context) *ProjectsLocationsGetCall { 1283 c.ctx_ = ctx 1284 return c 1285} 1286 1287// Header returns an http.Header that can be modified by the caller to 1288// add HTTP headers to the request. 1289func (c *ProjectsLocationsGetCall) Header() http.Header { 1290 if c.header_ == nil { 1291 c.header_ = make(http.Header) 1292 } 1293 return c.header_ 1294} 1295 1296func (c *ProjectsLocationsGetCall) doRequest(alt string) (*http.Response, error) { 1297 reqHeaders := make(http.Header) 1298 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.4 gdcl/20191114") 1299 for k, v := range c.header_ { 1300 reqHeaders[k] = v 1301 } 1302 reqHeaders.Set("User-Agent", c.s.userAgent()) 1303 if c.ifNoneMatch_ != "" { 1304 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 1305 } 1306 var body io.Reader = nil 1307 c.urlParams_.Set("alt", alt) 1308 c.urlParams_.Set("prettyPrint", "false") 1309 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+name}") 1310 urls += "?" + c.urlParams_.Encode() 1311 req, err := http.NewRequest("GET", urls, body) 1312 if err != nil { 1313 return nil, err 1314 } 1315 req.Header = reqHeaders 1316 googleapi.Expand(req.URL, map[string]string{ 1317 "name": c.name, 1318 }) 1319 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1320} 1321 1322// Do executes the "cloudscheduler.projects.locations.get" call. 1323// Exactly one of *Location or error will be non-nil. Any non-2xx status 1324// code is an error. Response headers are in either 1325// *Location.ServerResponse.Header or (if a response was returned at 1326// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 1327// to check whether the returned error was because 1328// http.StatusNotModified was returned. 1329func (c *ProjectsLocationsGetCall) Do(opts ...googleapi.CallOption) (*Location, error) { 1330 gensupport.SetOptions(c.urlParams_, opts...) 1331 res, err := c.doRequest("json") 1332 if res != nil && res.StatusCode == http.StatusNotModified { 1333 if res.Body != nil { 1334 res.Body.Close() 1335 } 1336 return nil, &googleapi.Error{ 1337 Code: res.StatusCode, 1338 Header: res.Header, 1339 } 1340 } 1341 if err != nil { 1342 return nil, err 1343 } 1344 defer googleapi.CloseBody(res) 1345 if err := googleapi.CheckResponse(res); err != nil { 1346 return nil, err 1347 } 1348 ret := &Location{ 1349 ServerResponse: googleapi.ServerResponse{ 1350 Header: res.Header, 1351 HTTPStatusCode: res.StatusCode, 1352 }, 1353 } 1354 target := &ret 1355 if err := gensupport.DecodeResponse(target, res); err != nil { 1356 return nil, err 1357 } 1358 return ret, nil 1359 // { 1360 // "description": "Gets information about a location.", 1361 // "flatPath": "v1beta1/projects/{projectsId}/locations/{locationsId}", 1362 // "httpMethod": "GET", 1363 // "id": "cloudscheduler.projects.locations.get", 1364 // "parameterOrder": [ 1365 // "name" 1366 // ], 1367 // "parameters": { 1368 // "name": { 1369 // "description": "Resource name for the location.", 1370 // "location": "path", 1371 // "pattern": "^projects/[^/]+/locations/[^/]+$", 1372 // "required": true, 1373 // "type": "string" 1374 // } 1375 // }, 1376 // "path": "v1beta1/{+name}", 1377 // "response": { 1378 // "$ref": "Location" 1379 // }, 1380 // "scopes": [ 1381 // "https://www.googleapis.com/auth/cloud-platform" 1382 // ] 1383 // } 1384 1385} 1386 1387// method id "cloudscheduler.projects.locations.list": 1388 1389type ProjectsLocationsListCall struct { 1390 s *Service 1391 name string 1392 urlParams_ gensupport.URLParams 1393 ifNoneMatch_ string 1394 ctx_ context.Context 1395 header_ http.Header 1396} 1397 1398// List: Lists information about the supported locations for this 1399// service. 1400func (r *ProjectsLocationsService) List(name string) *ProjectsLocationsListCall { 1401 c := &ProjectsLocationsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1402 c.name = name 1403 return c 1404} 1405 1406// Filter sets the optional parameter "filter": The standard list 1407// filter. 1408func (c *ProjectsLocationsListCall) Filter(filter string) *ProjectsLocationsListCall { 1409 c.urlParams_.Set("filter", filter) 1410 return c 1411} 1412 1413// PageSize sets the optional parameter "pageSize": The standard list 1414// page size. 1415func (c *ProjectsLocationsListCall) PageSize(pageSize int64) *ProjectsLocationsListCall { 1416 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 1417 return c 1418} 1419 1420// PageToken sets the optional parameter "pageToken": The standard list 1421// page token. 1422func (c *ProjectsLocationsListCall) PageToken(pageToken string) *ProjectsLocationsListCall { 1423 c.urlParams_.Set("pageToken", pageToken) 1424 return c 1425} 1426 1427// Fields allows partial responses to be retrieved. See 1428// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1429// for more information. 1430func (c *ProjectsLocationsListCall) Fields(s ...googleapi.Field) *ProjectsLocationsListCall { 1431 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1432 return c 1433} 1434 1435// IfNoneMatch sets the optional parameter which makes the operation 1436// fail if the object's ETag matches the given value. This is useful for 1437// getting updates only after the object has changed since the last 1438// request. Use googleapi.IsNotModified to check whether the response 1439// error from Do is the result of In-None-Match. 1440func (c *ProjectsLocationsListCall) IfNoneMatch(entityTag string) *ProjectsLocationsListCall { 1441 c.ifNoneMatch_ = entityTag 1442 return c 1443} 1444 1445// Context sets the context to be used in this call's Do method. Any 1446// pending HTTP request will be aborted if the provided context is 1447// canceled. 1448func (c *ProjectsLocationsListCall) Context(ctx context.Context) *ProjectsLocationsListCall { 1449 c.ctx_ = ctx 1450 return c 1451} 1452 1453// Header returns an http.Header that can be modified by the caller to 1454// add HTTP headers to the request. 1455func (c *ProjectsLocationsListCall) Header() http.Header { 1456 if c.header_ == nil { 1457 c.header_ = make(http.Header) 1458 } 1459 return c.header_ 1460} 1461 1462func (c *ProjectsLocationsListCall) doRequest(alt string) (*http.Response, error) { 1463 reqHeaders := make(http.Header) 1464 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.4 gdcl/20191114") 1465 for k, v := range c.header_ { 1466 reqHeaders[k] = v 1467 } 1468 reqHeaders.Set("User-Agent", c.s.userAgent()) 1469 if c.ifNoneMatch_ != "" { 1470 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 1471 } 1472 var body io.Reader = nil 1473 c.urlParams_.Set("alt", alt) 1474 c.urlParams_.Set("prettyPrint", "false") 1475 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+name}/locations") 1476 urls += "?" + c.urlParams_.Encode() 1477 req, err := http.NewRequest("GET", urls, body) 1478 if err != nil { 1479 return nil, err 1480 } 1481 req.Header = reqHeaders 1482 googleapi.Expand(req.URL, map[string]string{ 1483 "name": c.name, 1484 }) 1485 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1486} 1487 1488// Do executes the "cloudscheduler.projects.locations.list" call. 1489// Exactly one of *ListLocationsResponse or error will be non-nil. Any 1490// non-2xx status code is an error. Response headers are in either 1491// *ListLocationsResponse.ServerResponse.Header or (if a response was 1492// returned at all) in error.(*googleapi.Error).Header. Use 1493// googleapi.IsNotModified to check whether the returned error was 1494// because http.StatusNotModified was returned. 1495func (c *ProjectsLocationsListCall) Do(opts ...googleapi.CallOption) (*ListLocationsResponse, error) { 1496 gensupport.SetOptions(c.urlParams_, opts...) 1497 res, err := c.doRequest("json") 1498 if res != nil && res.StatusCode == http.StatusNotModified { 1499 if res.Body != nil { 1500 res.Body.Close() 1501 } 1502 return nil, &googleapi.Error{ 1503 Code: res.StatusCode, 1504 Header: res.Header, 1505 } 1506 } 1507 if err != nil { 1508 return nil, err 1509 } 1510 defer googleapi.CloseBody(res) 1511 if err := googleapi.CheckResponse(res); err != nil { 1512 return nil, err 1513 } 1514 ret := &ListLocationsResponse{ 1515 ServerResponse: googleapi.ServerResponse{ 1516 Header: res.Header, 1517 HTTPStatusCode: res.StatusCode, 1518 }, 1519 } 1520 target := &ret 1521 if err := gensupport.DecodeResponse(target, res); err != nil { 1522 return nil, err 1523 } 1524 return ret, nil 1525 // { 1526 // "description": "Lists information about the supported locations for this service.", 1527 // "flatPath": "v1beta1/projects/{projectsId}/locations", 1528 // "httpMethod": "GET", 1529 // "id": "cloudscheduler.projects.locations.list", 1530 // "parameterOrder": [ 1531 // "name" 1532 // ], 1533 // "parameters": { 1534 // "filter": { 1535 // "description": "The standard list filter.", 1536 // "location": "query", 1537 // "type": "string" 1538 // }, 1539 // "name": { 1540 // "description": "The resource that owns the locations collection, if applicable.", 1541 // "location": "path", 1542 // "pattern": "^projects/[^/]+$", 1543 // "required": true, 1544 // "type": "string" 1545 // }, 1546 // "pageSize": { 1547 // "description": "The standard list page size.", 1548 // "format": "int32", 1549 // "location": "query", 1550 // "type": "integer" 1551 // }, 1552 // "pageToken": { 1553 // "description": "The standard list page token.", 1554 // "location": "query", 1555 // "type": "string" 1556 // } 1557 // }, 1558 // "path": "v1beta1/{+name}/locations", 1559 // "response": { 1560 // "$ref": "ListLocationsResponse" 1561 // }, 1562 // "scopes": [ 1563 // "https://www.googleapis.com/auth/cloud-platform" 1564 // ] 1565 // } 1566 1567} 1568 1569// Pages invokes f for each page of results. 1570// A non-nil error returned from f will halt the iteration. 1571// The provided context supersedes any context provided to the Context method. 1572func (c *ProjectsLocationsListCall) Pages(ctx context.Context, f func(*ListLocationsResponse) error) error { 1573 c.ctx_ = ctx 1574 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 1575 for { 1576 x, err := c.Do() 1577 if err != nil { 1578 return err 1579 } 1580 if err := f(x); err != nil { 1581 return err 1582 } 1583 if x.NextPageToken == "" { 1584 return nil 1585 } 1586 c.PageToken(x.NextPageToken) 1587 } 1588} 1589 1590// method id "cloudscheduler.projects.locations.jobs.create": 1591 1592type ProjectsLocationsJobsCreateCall struct { 1593 s *Service 1594 parent string 1595 job *Job 1596 urlParams_ gensupport.URLParams 1597 ctx_ context.Context 1598 header_ http.Header 1599} 1600 1601// Create: Creates a job. 1602func (r *ProjectsLocationsJobsService) Create(parent string, job *Job) *ProjectsLocationsJobsCreateCall { 1603 c := &ProjectsLocationsJobsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1604 c.parent = parent 1605 c.job = job 1606 return c 1607} 1608 1609// Fields allows partial responses to be retrieved. See 1610// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1611// for more information. 1612func (c *ProjectsLocationsJobsCreateCall) Fields(s ...googleapi.Field) *ProjectsLocationsJobsCreateCall { 1613 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1614 return c 1615} 1616 1617// Context sets the context to be used in this call's Do method. Any 1618// pending HTTP request will be aborted if the provided context is 1619// canceled. 1620func (c *ProjectsLocationsJobsCreateCall) Context(ctx context.Context) *ProjectsLocationsJobsCreateCall { 1621 c.ctx_ = ctx 1622 return c 1623} 1624 1625// Header returns an http.Header that can be modified by the caller to 1626// add HTTP headers to the request. 1627func (c *ProjectsLocationsJobsCreateCall) Header() http.Header { 1628 if c.header_ == nil { 1629 c.header_ = make(http.Header) 1630 } 1631 return c.header_ 1632} 1633 1634func (c *ProjectsLocationsJobsCreateCall) doRequest(alt string) (*http.Response, error) { 1635 reqHeaders := make(http.Header) 1636 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.4 gdcl/20191114") 1637 for k, v := range c.header_ { 1638 reqHeaders[k] = v 1639 } 1640 reqHeaders.Set("User-Agent", c.s.userAgent()) 1641 var body io.Reader = nil 1642 body, err := googleapi.WithoutDataWrapper.JSONReader(c.job) 1643 if err != nil { 1644 return nil, err 1645 } 1646 reqHeaders.Set("Content-Type", "application/json") 1647 c.urlParams_.Set("alt", alt) 1648 c.urlParams_.Set("prettyPrint", "false") 1649 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+parent}/jobs") 1650 urls += "?" + c.urlParams_.Encode() 1651 req, err := http.NewRequest("POST", urls, body) 1652 if err != nil { 1653 return nil, err 1654 } 1655 req.Header = reqHeaders 1656 googleapi.Expand(req.URL, map[string]string{ 1657 "parent": c.parent, 1658 }) 1659 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1660} 1661 1662// Do executes the "cloudscheduler.projects.locations.jobs.create" call. 1663// Exactly one of *Job or error will be non-nil. Any non-2xx status code 1664// is an error. Response headers are in either 1665// *Job.ServerResponse.Header or (if a response was returned at all) in 1666// error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check 1667// whether the returned error was because http.StatusNotModified was 1668// returned. 1669func (c *ProjectsLocationsJobsCreateCall) Do(opts ...googleapi.CallOption) (*Job, error) { 1670 gensupport.SetOptions(c.urlParams_, opts...) 1671 res, err := c.doRequest("json") 1672 if res != nil && res.StatusCode == http.StatusNotModified { 1673 if res.Body != nil { 1674 res.Body.Close() 1675 } 1676 return nil, &googleapi.Error{ 1677 Code: res.StatusCode, 1678 Header: res.Header, 1679 } 1680 } 1681 if err != nil { 1682 return nil, err 1683 } 1684 defer googleapi.CloseBody(res) 1685 if err := googleapi.CheckResponse(res); err != nil { 1686 return nil, err 1687 } 1688 ret := &Job{ 1689 ServerResponse: googleapi.ServerResponse{ 1690 Header: res.Header, 1691 HTTPStatusCode: res.StatusCode, 1692 }, 1693 } 1694 target := &ret 1695 if err := gensupport.DecodeResponse(target, res); err != nil { 1696 return nil, err 1697 } 1698 return ret, nil 1699 // { 1700 // "description": "Creates a job.", 1701 // "flatPath": "v1beta1/projects/{projectsId}/locations/{locationsId}/jobs", 1702 // "httpMethod": "POST", 1703 // "id": "cloudscheduler.projects.locations.jobs.create", 1704 // "parameterOrder": [ 1705 // "parent" 1706 // ], 1707 // "parameters": { 1708 // "parent": { 1709 // "description": "Required. The location name. For example:\n`projects/PROJECT_ID/locations/LOCATION_ID`.", 1710 // "location": "path", 1711 // "pattern": "^projects/[^/]+/locations/[^/]+$", 1712 // "required": true, 1713 // "type": "string" 1714 // } 1715 // }, 1716 // "path": "v1beta1/{+parent}/jobs", 1717 // "request": { 1718 // "$ref": "Job" 1719 // }, 1720 // "response": { 1721 // "$ref": "Job" 1722 // }, 1723 // "scopes": [ 1724 // "https://www.googleapis.com/auth/cloud-platform" 1725 // ] 1726 // } 1727 1728} 1729 1730// method id "cloudscheduler.projects.locations.jobs.delete": 1731 1732type ProjectsLocationsJobsDeleteCall struct { 1733 s *Service 1734 name string 1735 urlParams_ gensupport.URLParams 1736 ctx_ context.Context 1737 header_ http.Header 1738} 1739 1740// Delete: Deletes a job. 1741func (r *ProjectsLocationsJobsService) Delete(name string) *ProjectsLocationsJobsDeleteCall { 1742 c := &ProjectsLocationsJobsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1743 c.name = name 1744 return c 1745} 1746 1747// Fields allows partial responses to be retrieved. See 1748// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1749// for more information. 1750func (c *ProjectsLocationsJobsDeleteCall) Fields(s ...googleapi.Field) *ProjectsLocationsJobsDeleteCall { 1751 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1752 return c 1753} 1754 1755// Context sets the context to be used in this call's Do method. Any 1756// pending HTTP request will be aborted if the provided context is 1757// canceled. 1758func (c *ProjectsLocationsJobsDeleteCall) Context(ctx context.Context) *ProjectsLocationsJobsDeleteCall { 1759 c.ctx_ = ctx 1760 return c 1761} 1762 1763// Header returns an http.Header that can be modified by the caller to 1764// add HTTP headers to the request. 1765func (c *ProjectsLocationsJobsDeleteCall) Header() http.Header { 1766 if c.header_ == nil { 1767 c.header_ = make(http.Header) 1768 } 1769 return c.header_ 1770} 1771 1772func (c *ProjectsLocationsJobsDeleteCall) doRequest(alt string) (*http.Response, error) { 1773 reqHeaders := make(http.Header) 1774 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.4 gdcl/20191114") 1775 for k, v := range c.header_ { 1776 reqHeaders[k] = v 1777 } 1778 reqHeaders.Set("User-Agent", c.s.userAgent()) 1779 var body io.Reader = nil 1780 c.urlParams_.Set("alt", alt) 1781 c.urlParams_.Set("prettyPrint", "false") 1782 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+name}") 1783 urls += "?" + c.urlParams_.Encode() 1784 req, err := http.NewRequest("DELETE", urls, body) 1785 if err != nil { 1786 return nil, err 1787 } 1788 req.Header = reqHeaders 1789 googleapi.Expand(req.URL, map[string]string{ 1790 "name": c.name, 1791 }) 1792 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1793} 1794 1795// Do executes the "cloudscheduler.projects.locations.jobs.delete" call. 1796// Exactly one of *Empty or error will be non-nil. Any non-2xx status 1797// code is an error. Response headers are in either 1798// *Empty.ServerResponse.Header or (if a response was returned at all) 1799// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 1800// check whether the returned error was because http.StatusNotModified 1801// was returned. 1802func (c *ProjectsLocationsJobsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 1803 gensupport.SetOptions(c.urlParams_, opts...) 1804 res, err := c.doRequest("json") 1805 if res != nil && res.StatusCode == http.StatusNotModified { 1806 if res.Body != nil { 1807 res.Body.Close() 1808 } 1809 return nil, &googleapi.Error{ 1810 Code: res.StatusCode, 1811 Header: res.Header, 1812 } 1813 } 1814 if err != nil { 1815 return nil, err 1816 } 1817 defer googleapi.CloseBody(res) 1818 if err := googleapi.CheckResponse(res); err != nil { 1819 return nil, err 1820 } 1821 ret := &Empty{ 1822 ServerResponse: googleapi.ServerResponse{ 1823 Header: res.Header, 1824 HTTPStatusCode: res.StatusCode, 1825 }, 1826 } 1827 target := &ret 1828 if err := gensupport.DecodeResponse(target, res); err != nil { 1829 return nil, err 1830 } 1831 return ret, nil 1832 // { 1833 // "description": "Deletes a job.", 1834 // "flatPath": "v1beta1/projects/{projectsId}/locations/{locationsId}/jobs/{jobsId}", 1835 // "httpMethod": "DELETE", 1836 // "id": "cloudscheduler.projects.locations.jobs.delete", 1837 // "parameterOrder": [ 1838 // "name" 1839 // ], 1840 // "parameters": { 1841 // "name": { 1842 // "description": "Required. The job name. For example:\n`projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`.", 1843 // "location": "path", 1844 // "pattern": "^projects/[^/]+/locations/[^/]+/jobs/[^/]+$", 1845 // "required": true, 1846 // "type": "string" 1847 // } 1848 // }, 1849 // "path": "v1beta1/{+name}", 1850 // "response": { 1851 // "$ref": "Empty" 1852 // }, 1853 // "scopes": [ 1854 // "https://www.googleapis.com/auth/cloud-platform" 1855 // ] 1856 // } 1857 1858} 1859 1860// method id "cloudscheduler.projects.locations.jobs.get": 1861 1862type ProjectsLocationsJobsGetCall struct { 1863 s *Service 1864 name string 1865 urlParams_ gensupport.URLParams 1866 ifNoneMatch_ string 1867 ctx_ context.Context 1868 header_ http.Header 1869} 1870 1871// Get: Gets a job. 1872func (r *ProjectsLocationsJobsService) Get(name string) *ProjectsLocationsJobsGetCall { 1873 c := &ProjectsLocationsJobsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1874 c.name = name 1875 return c 1876} 1877 1878// Fields allows partial responses to be retrieved. See 1879// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1880// for more information. 1881func (c *ProjectsLocationsJobsGetCall) Fields(s ...googleapi.Field) *ProjectsLocationsJobsGetCall { 1882 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1883 return c 1884} 1885 1886// IfNoneMatch sets the optional parameter which makes the operation 1887// fail if the object's ETag matches the given value. This is useful for 1888// getting updates only after the object has changed since the last 1889// request. Use googleapi.IsNotModified to check whether the response 1890// error from Do is the result of In-None-Match. 1891func (c *ProjectsLocationsJobsGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsJobsGetCall { 1892 c.ifNoneMatch_ = entityTag 1893 return c 1894} 1895 1896// Context sets the context to be used in this call's Do method. Any 1897// pending HTTP request will be aborted if the provided context is 1898// canceled. 1899func (c *ProjectsLocationsJobsGetCall) Context(ctx context.Context) *ProjectsLocationsJobsGetCall { 1900 c.ctx_ = ctx 1901 return c 1902} 1903 1904// Header returns an http.Header that can be modified by the caller to 1905// add HTTP headers to the request. 1906func (c *ProjectsLocationsJobsGetCall) Header() http.Header { 1907 if c.header_ == nil { 1908 c.header_ = make(http.Header) 1909 } 1910 return c.header_ 1911} 1912 1913func (c *ProjectsLocationsJobsGetCall) doRequest(alt string) (*http.Response, error) { 1914 reqHeaders := make(http.Header) 1915 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.4 gdcl/20191114") 1916 for k, v := range c.header_ { 1917 reqHeaders[k] = v 1918 } 1919 reqHeaders.Set("User-Agent", c.s.userAgent()) 1920 if c.ifNoneMatch_ != "" { 1921 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 1922 } 1923 var body io.Reader = nil 1924 c.urlParams_.Set("alt", alt) 1925 c.urlParams_.Set("prettyPrint", "false") 1926 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+name}") 1927 urls += "?" + c.urlParams_.Encode() 1928 req, err := http.NewRequest("GET", urls, body) 1929 if err != nil { 1930 return nil, err 1931 } 1932 req.Header = reqHeaders 1933 googleapi.Expand(req.URL, map[string]string{ 1934 "name": c.name, 1935 }) 1936 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1937} 1938 1939// Do executes the "cloudscheduler.projects.locations.jobs.get" call. 1940// Exactly one of *Job or error will be non-nil. Any non-2xx status code 1941// is an error. Response headers are in either 1942// *Job.ServerResponse.Header or (if a response was returned at all) in 1943// error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check 1944// whether the returned error was because http.StatusNotModified was 1945// returned. 1946func (c *ProjectsLocationsJobsGetCall) Do(opts ...googleapi.CallOption) (*Job, error) { 1947 gensupport.SetOptions(c.urlParams_, opts...) 1948 res, err := c.doRequest("json") 1949 if res != nil && res.StatusCode == http.StatusNotModified { 1950 if res.Body != nil { 1951 res.Body.Close() 1952 } 1953 return nil, &googleapi.Error{ 1954 Code: res.StatusCode, 1955 Header: res.Header, 1956 } 1957 } 1958 if err != nil { 1959 return nil, err 1960 } 1961 defer googleapi.CloseBody(res) 1962 if err := googleapi.CheckResponse(res); err != nil { 1963 return nil, err 1964 } 1965 ret := &Job{ 1966 ServerResponse: googleapi.ServerResponse{ 1967 Header: res.Header, 1968 HTTPStatusCode: res.StatusCode, 1969 }, 1970 } 1971 target := &ret 1972 if err := gensupport.DecodeResponse(target, res); err != nil { 1973 return nil, err 1974 } 1975 return ret, nil 1976 // { 1977 // "description": "Gets a job.", 1978 // "flatPath": "v1beta1/projects/{projectsId}/locations/{locationsId}/jobs/{jobsId}", 1979 // "httpMethod": "GET", 1980 // "id": "cloudscheduler.projects.locations.jobs.get", 1981 // "parameterOrder": [ 1982 // "name" 1983 // ], 1984 // "parameters": { 1985 // "name": { 1986 // "description": "Required. The job name. For example:\n`projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`.", 1987 // "location": "path", 1988 // "pattern": "^projects/[^/]+/locations/[^/]+/jobs/[^/]+$", 1989 // "required": true, 1990 // "type": "string" 1991 // } 1992 // }, 1993 // "path": "v1beta1/{+name}", 1994 // "response": { 1995 // "$ref": "Job" 1996 // }, 1997 // "scopes": [ 1998 // "https://www.googleapis.com/auth/cloud-platform" 1999 // ] 2000 // } 2001 2002} 2003 2004// method id "cloudscheduler.projects.locations.jobs.list": 2005 2006type ProjectsLocationsJobsListCall struct { 2007 s *Service 2008 parent string 2009 urlParams_ gensupport.URLParams 2010 ifNoneMatch_ string 2011 ctx_ context.Context 2012 header_ http.Header 2013} 2014 2015// List: Lists jobs. 2016func (r *ProjectsLocationsJobsService) List(parent string) *ProjectsLocationsJobsListCall { 2017 c := &ProjectsLocationsJobsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2018 c.parent = parent 2019 return c 2020} 2021 2022// PageSize sets the optional parameter "pageSize": Requested page 2023// size. 2024// 2025// The maximum page size is 500. If unspecified, the page size will 2026// be the maximum. Fewer jobs than requested might be returned, 2027// even if more jobs exist; use next_page_token to determine if 2028// more 2029// jobs exist. 2030func (c *ProjectsLocationsJobsListCall) PageSize(pageSize int64) *ProjectsLocationsJobsListCall { 2031 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 2032 return c 2033} 2034 2035// PageToken sets the optional parameter "pageToken": A token 2036// identifying a page of results the server will return. To 2037// request the first page results, page_token must be empty. To 2038// request the next page of results, page_token must be the value 2039// of 2040// next_page_token returned from 2041// the previous call to ListJobs. It is an error to 2042// switch the value of filter or 2043// order_by while iterating through pages. 2044func (c *ProjectsLocationsJobsListCall) PageToken(pageToken string) *ProjectsLocationsJobsListCall { 2045 c.urlParams_.Set("pageToken", pageToken) 2046 return c 2047} 2048 2049// Fields allows partial responses to be retrieved. See 2050// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2051// for more information. 2052func (c *ProjectsLocationsJobsListCall) Fields(s ...googleapi.Field) *ProjectsLocationsJobsListCall { 2053 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2054 return c 2055} 2056 2057// IfNoneMatch sets the optional parameter which makes the operation 2058// fail if the object's ETag matches the given value. This is useful for 2059// getting updates only after the object has changed since the last 2060// request. Use googleapi.IsNotModified to check whether the response 2061// error from Do is the result of In-None-Match. 2062func (c *ProjectsLocationsJobsListCall) IfNoneMatch(entityTag string) *ProjectsLocationsJobsListCall { 2063 c.ifNoneMatch_ = entityTag 2064 return c 2065} 2066 2067// Context sets the context to be used in this call's Do method. Any 2068// pending HTTP request will be aborted if the provided context is 2069// canceled. 2070func (c *ProjectsLocationsJobsListCall) Context(ctx context.Context) *ProjectsLocationsJobsListCall { 2071 c.ctx_ = ctx 2072 return c 2073} 2074 2075// Header returns an http.Header that can be modified by the caller to 2076// add HTTP headers to the request. 2077func (c *ProjectsLocationsJobsListCall) Header() http.Header { 2078 if c.header_ == nil { 2079 c.header_ = make(http.Header) 2080 } 2081 return c.header_ 2082} 2083 2084func (c *ProjectsLocationsJobsListCall) doRequest(alt string) (*http.Response, error) { 2085 reqHeaders := make(http.Header) 2086 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.4 gdcl/20191114") 2087 for k, v := range c.header_ { 2088 reqHeaders[k] = v 2089 } 2090 reqHeaders.Set("User-Agent", c.s.userAgent()) 2091 if c.ifNoneMatch_ != "" { 2092 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 2093 } 2094 var body io.Reader = nil 2095 c.urlParams_.Set("alt", alt) 2096 c.urlParams_.Set("prettyPrint", "false") 2097 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+parent}/jobs") 2098 urls += "?" + c.urlParams_.Encode() 2099 req, err := http.NewRequest("GET", urls, body) 2100 if err != nil { 2101 return nil, err 2102 } 2103 req.Header = reqHeaders 2104 googleapi.Expand(req.URL, map[string]string{ 2105 "parent": c.parent, 2106 }) 2107 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2108} 2109 2110// Do executes the "cloudscheduler.projects.locations.jobs.list" call. 2111// Exactly one of *ListJobsResponse or error will be non-nil. Any 2112// non-2xx status code is an error. Response headers are in either 2113// *ListJobsResponse.ServerResponse.Header or (if a response was 2114// returned at all) in error.(*googleapi.Error).Header. Use 2115// googleapi.IsNotModified to check whether the returned error was 2116// because http.StatusNotModified was returned. 2117func (c *ProjectsLocationsJobsListCall) Do(opts ...googleapi.CallOption) (*ListJobsResponse, error) { 2118 gensupport.SetOptions(c.urlParams_, opts...) 2119 res, err := c.doRequest("json") 2120 if res != nil && res.StatusCode == http.StatusNotModified { 2121 if res.Body != nil { 2122 res.Body.Close() 2123 } 2124 return nil, &googleapi.Error{ 2125 Code: res.StatusCode, 2126 Header: res.Header, 2127 } 2128 } 2129 if err != nil { 2130 return nil, err 2131 } 2132 defer googleapi.CloseBody(res) 2133 if err := googleapi.CheckResponse(res); err != nil { 2134 return nil, err 2135 } 2136 ret := &ListJobsResponse{ 2137 ServerResponse: googleapi.ServerResponse{ 2138 Header: res.Header, 2139 HTTPStatusCode: res.StatusCode, 2140 }, 2141 } 2142 target := &ret 2143 if err := gensupport.DecodeResponse(target, res); err != nil { 2144 return nil, err 2145 } 2146 return ret, nil 2147 // { 2148 // "description": "Lists jobs.", 2149 // "flatPath": "v1beta1/projects/{projectsId}/locations/{locationsId}/jobs", 2150 // "httpMethod": "GET", 2151 // "id": "cloudscheduler.projects.locations.jobs.list", 2152 // "parameterOrder": [ 2153 // "parent" 2154 // ], 2155 // "parameters": { 2156 // "pageSize": { 2157 // "description": "Requested page size.\n\nThe maximum page size is 500. If unspecified, the page size will\nbe the maximum. Fewer jobs than requested might be returned,\neven if more jobs exist; use next_page_token to determine if more\njobs exist.", 2158 // "format": "int32", 2159 // "location": "query", 2160 // "type": "integer" 2161 // }, 2162 // "pageToken": { 2163 // "description": "A token identifying a page of results the server will return. To\nrequest the first page results, page_token must be empty. To\nrequest the next page of results, page_token must be the value of\nnext_page_token returned from\nthe previous call to ListJobs. It is an error to\nswitch the value of filter or\norder_by while iterating through pages.", 2164 // "location": "query", 2165 // "type": "string" 2166 // }, 2167 // "parent": { 2168 // "description": "Required. The location name. For example:\n`projects/PROJECT_ID/locations/LOCATION_ID`.", 2169 // "location": "path", 2170 // "pattern": "^projects/[^/]+/locations/[^/]+$", 2171 // "required": true, 2172 // "type": "string" 2173 // } 2174 // }, 2175 // "path": "v1beta1/{+parent}/jobs", 2176 // "response": { 2177 // "$ref": "ListJobsResponse" 2178 // }, 2179 // "scopes": [ 2180 // "https://www.googleapis.com/auth/cloud-platform" 2181 // ] 2182 // } 2183 2184} 2185 2186// Pages invokes f for each page of results. 2187// A non-nil error returned from f will halt the iteration. 2188// The provided context supersedes any context provided to the Context method. 2189func (c *ProjectsLocationsJobsListCall) Pages(ctx context.Context, f func(*ListJobsResponse) error) error { 2190 c.ctx_ = ctx 2191 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 2192 for { 2193 x, err := c.Do() 2194 if err != nil { 2195 return err 2196 } 2197 if err := f(x); err != nil { 2198 return err 2199 } 2200 if x.NextPageToken == "" { 2201 return nil 2202 } 2203 c.PageToken(x.NextPageToken) 2204 } 2205} 2206 2207// method id "cloudscheduler.projects.locations.jobs.patch": 2208 2209type ProjectsLocationsJobsPatchCall struct { 2210 s *Service 2211 name string 2212 job *Job 2213 urlParams_ gensupport.URLParams 2214 ctx_ context.Context 2215 header_ http.Header 2216} 2217 2218// Patch: Updates a job. 2219// 2220// If successful, the updated Job is returned. If the job does 2221// not exist, `NOT_FOUND` is returned. 2222// 2223// If UpdateJob does not successfully return, it is possible for the 2224// job to be in an Job.State.UPDATE_FAILED state. A job in this state 2225// may 2226// not be executed. If this happens, retry the UpdateJob request 2227// until a successful response is received. 2228func (r *ProjectsLocationsJobsService) Patch(name string, job *Job) *ProjectsLocationsJobsPatchCall { 2229 c := &ProjectsLocationsJobsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2230 c.name = name 2231 c.job = job 2232 return c 2233} 2234 2235// UpdateMask sets the optional parameter "updateMask": A mask used to 2236// specify which fields of the job are being updated. 2237func (c *ProjectsLocationsJobsPatchCall) UpdateMask(updateMask string) *ProjectsLocationsJobsPatchCall { 2238 c.urlParams_.Set("updateMask", updateMask) 2239 return c 2240} 2241 2242// Fields allows partial responses to be retrieved. See 2243// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2244// for more information. 2245func (c *ProjectsLocationsJobsPatchCall) Fields(s ...googleapi.Field) *ProjectsLocationsJobsPatchCall { 2246 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2247 return c 2248} 2249 2250// Context sets the context to be used in this call's Do method. Any 2251// pending HTTP request will be aborted if the provided context is 2252// canceled. 2253func (c *ProjectsLocationsJobsPatchCall) Context(ctx context.Context) *ProjectsLocationsJobsPatchCall { 2254 c.ctx_ = ctx 2255 return c 2256} 2257 2258// Header returns an http.Header that can be modified by the caller to 2259// add HTTP headers to the request. 2260func (c *ProjectsLocationsJobsPatchCall) Header() http.Header { 2261 if c.header_ == nil { 2262 c.header_ = make(http.Header) 2263 } 2264 return c.header_ 2265} 2266 2267func (c *ProjectsLocationsJobsPatchCall) doRequest(alt string) (*http.Response, error) { 2268 reqHeaders := make(http.Header) 2269 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.4 gdcl/20191114") 2270 for k, v := range c.header_ { 2271 reqHeaders[k] = v 2272 } 2273 reqHeaders.Set("User-Agent", c.s.userAgent()) 2274 var body io.Reader = nil 2275 body, err := googleapi.WithoutDataWrapper.JSONReader(c.job) 2276 if err != nil { 2277 return nil, err 2278 } 2279 reqHeaders.Set("Content-Type", "application/json") 2280 c.urlParams_.Set("alt", alt) 2281 c.urlParams_.Set("prettyPrint", "false") 2282 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+name}") 2283 urls += "?" + c.urlParams_.Encode() 2284 req, err := http.NewRequest("PATCH", urls, body) 2285 if err != nil { 2286 return nil, err 2287 } 2288 req.Header = reqHeaders 2289 googleapi.Expand(req.URL, map[string]string{ 2290 "name": c.name, 2291 }) 2292 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2293} 2294 2295// Do executes the "cloudscheduler.projects.locations.jobs.patch" call. 2296// Exactly one of *Job or error will be non-nil. Any non-2xx status code 2297// is an error. Response headers are in either 2298// *Job.ServerResponse.Header or (if a response was returned at all) in 2299// error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check 2300// whether the returned error was because http.StatusNotModified was 2301// returned. 2302func (c *ProjectsLocationsJobsPatchCall) Do(opts ...googleapi.CallOption) (*Job, error) { 2303 gensupport.SetOptions(c.urlParams_, opts...) 2304 res, err := c.doRequest("json") 2305 if res != nil && res.StatusCode == http.StatusNotModified { 2306 if res.Body != nil { 2307 res.Body.Close() 2308 } 2309 return nil, &googleapi.Error{ 2310 Code: res.StatusCode, 2311 Header: res.Header, 2312 } 2313 } 2314 if err != nil { 2315 return nil, err 2316 } 2317 defer googleapi.CloseBody(res) 2318 if err := googleapi.CheckResponse(res); err != nil { 2319 return nil, err 2320 } 2321 ret := &Job{ 2322 ServerResponse: googleapi.ServerResponse{ 2323 Header: res.Header, 2324 HTTPStatusCode: res.StatusCode, 2325 }, 2326 } 2327 target := &ret 2328 if err := gensupport.DecodeResponse(target, res); err != nil { 2329 return nil, err 2330 } 2331 return ret, nil 2332 // { 2333 // "description": "Updates a job.\n\nIf successful, the updated Job is returned. If the job does\nnot exist, `NOT_FOUND` is returned.\n\nIf UpdateJob does not successfully return, it is possible for the\njob to be in an Job.State.UPDATE_FAILED state. A job in this state may\nnot be executed. If this happens, retry the UpdateJob request\nuntil a successful response is received.", 2334 // "flatPath": "v1beta1/projects/{projectsId}/locations/{locationsId}/jobs/{jobsId}", 2335 // "httpMethod": "PATCH", 2336 // "id": "cloudscheduler.projects.locations.jobs.patch", 2337 // "parameterOrder": [ 2338 // "name" 2339 // ], 2340 // "parameters": { 2341 // "name": { 2342 // "description": "Optionally caller-specified in CreateJob, after\nwhich it becomes output only.\n\nThe job name. For example:\n`projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`.\n\n* `PROJECT_ID` can contain letters ([A-Za-z]), numbers ([0-9]),\n hyphens (-), colons (:), or periods (.).\n For more information, see\n [Identifying\n projects](https://cloud.google.com/resource-manager/docs/creating-managing-projects#identifying_projects)\n* `LOCATION_ID` is the canonical ID for the job's location.\n The list of available locations can be obtained by calling\n ListLocations.\n For more information, see https://cloud.google.com/about/locations/.\n* `JOB_ID` can contain only letters ([A-Za-z]), numbers ([0-9]),\n hyphens (-), or underscores (_). The maximum length is 500 characters.", 2343 // "location": "path", 2344 // "pattern": "^projects/[^/]+/locations/[^/]+/jobs/[^/]+$", 2345 // "required": true, 2346 // "type": "string" 2347 // }, 2348 // "updateMask": { 2349 // "description": "A mask used to specify which fields of the job are being updated.", 2350 // "format": "google-fieldmask", 2351 // "location": "query", 2352 // "type": "string" 2353 // } 2354 // }, 2355 // "path": "v1beta1/{+name}", 2356 // "request": { 2357 // "$ref": "Job" 2358 // }, 2359 // "response": { 2360 // "$ref": "Job" 2361 // }, 2362 // "scopes": [ 2363 // "https://www.googleapis.com/auth/cloud-platform" 2364 // ] 2365 // } 2366 2367} 2368 2369// method id "cloudscheduler.projects.locations.jobs.pause": 2370 2371type ProjectsLocationsJobsPauseCall struct { 2372 s *Service 2373 name string 2374 pausejobrequest *PauseJobRequest 2375 urlParams_ gensupport.URLParams 2376 ctx_ context.Context 2377 header_ http.Header 2378} 2379 2380// Pause: Pauses a job. 2381// 2382// If a job is paused then the system will stop executing the job 2383// until it is re-enabled via ResumeJob. The 2384// state of the job is stored in state; if paused it 2385// will be set to Job.State.PAUSED. A job must be in 2386// Job.State.ENABLED 2387// to be paused. 2388func (r *ProjectsLocationsJobsService) Pause(name string, pausejobrequest *PauseJobRequest) *ProjectsLocationsJobsPauseCall { 2389 c := &ProjectsLocationsJobsPauseCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2390 c.name = name 2391 c.pausejobrequest = pausejobrequest 2392 return c 2393} 2394 2395// Fields allows partial responses to be retrieved. See 2396// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2397// for more information. 2398func (c *ProjectsLocationsJobsPauseCall) Fields(s ...googleapi.Field) *ProjectsLocationsJobsPauseCall { 2399 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2400 return c 2401} 2402 2403// Context sets the context to be used in this call's Do method. Any 2404// pending HTTP request will be aborted if the provided context is 2405// canceled. 2406func (c *ProjectsLocationsJobsPauseCall) Context(ctx context.Context) *ProjectsLocationsJobsPauseCall { 2407 c.ctx_ = ctx 2408 return c 2409} 2410 2411// Header returns an http.Header that can be modified by the caller to 2412// add HTTP headers to the request. 2413func (c *ProjectsLocationsJobsPauseCall) Header() http.Header { 2414 if c.header_ == nil { 2415 c.header_ = make(http.Header) 2416 } 2417 return c.header_ 2418} 2419 2420func (c *ProjectsLocationsJobsPauseCall) doRequest(alt string) (*http.Response, error) { 2421 reqHeaders := make(http.Header) 2422 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.4 gdcl/20191114") 2423 for k, v := range c.header_ { 2424 reqHeaders[k] = v 2425 } 2426 reqHeaders.Set("User-Agent", c.s.userAgent()) 2427 var body io.Reader = nil 2428 body, err := googleapi.WithoutDataWrapper.JSONReader(c.pausejobrequest) 2429 if err != nil { 2430 return nil, err 2431 } 2432 reqHeaders.Set("Content-Type", "application/json") 2433 c.urlParams_.Set("alt", alt) 2434 c.urlParams_.Set("prettyPrint", "false") 2435 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+name}:pause") 2436 urls += "?" + c.urlParams_.Encode() 2437 req, err := http.NewRequest("POST", urls, body) 2438 if err != nil { 2439 return nil, err 2440 } 2441 req.Header = reqHeaders 2442 googleapi.Expand(req.URL, map[string]string{ 2443 "name": c.name, 2444 }) 2445 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2446} 2447 2448// Do executes the "cloudscheduler.projects.locations.jobs.pause" call. 2449// Exactly one of *Job or error will be non-nil. Any non-2xx status code 2450// is an error. Response headers are in either 2451// *Job.ServerResponse.Header or (if a response was returned at all) in 2452// error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check 2453// whether the returned error was because http.StatusNotModified was 2454// returned. 2455func (c *ProjectsLocationsJobsPauseCall) Do(opts ...googleapi.CallOption) (*Job, 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 := &Job{ 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": "Pauses a job.\n\nIf a job is paused then the system will stop executing the job\nuntil it is re-enabled via ResumeJob. The\nstate of the job is stored in state; if paused it\nwill be set to Job.State.PAUSED. A job must be in Job.State.ENABLED\nto be paused.", 2487 // "flatPath": "v1beta1/projects/{projectsId}/locations/{locationsId}/jobs/{jobsId}:pause", 2488 // "httpMethod": "POST", 2489 // "id": "cloudscheduler.projects.locations.jobs.pause", 2490 // "parameterOrder": [ 2491 // "name" 2492 // ], 2493 // "parameters": { 2494 // "name": { 2495 // "description": "Required. The job name. For example:\n`projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`.", 2496 // "location": "path", 2497 // "pattern": "^projects/[^/]+/locations/[^/]+/jobs/[^/]+$", 2498 // "required": true, 2499 // "type": "string" 2500 // } 2501 // }, 2502 // "path": "v1beta1/{+name}:pause", 2503 // "request": { 2504 // "$ref": "PauseJobRequest" 2505 // }, 2506 // "response": { 2507 // "$ref": "Job" 2508 // }, 2509 // "scopes": [ 2510 // "https://www.googleapis.com/auth/cloud-platform" 2511 // ] 2512 // } 2513 2514} 2515 2516// method id "cloudscheduler.projects.locations.jobs.resume": 2517 2518type ProjectsLocationsJobsResumeCall struct { 2519 s *Service 2520 name string 2521 resumejobrequest *ResumeJobRequest 2522 urlParams_ gensupport.URLParams 2523 ctx_ context.Context 2524 header_ http.Header 2525} 2526 2527// Resume: Resume a job. 2528// 2529// This method reenables a job after it has been Job.State.PAUSED. 2530// The 2531// state of a job is stored in Job.state; after calling this method 2532// it 2533// will be set to Job.State.ENABLED. A job must be in 2534// Job.State.PAUSED to be resumed. 2535func (r *ProjectsLocationsJobsService) Resume(name string, resumejobrequest *ResumeJobRequest) *ProjectsLocationsJobsResumeCall { 2536 c := &ProjectsLocationsJobsResumeCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2537 c.name = name 2538 c.resumejobrequest = resumejobrequest 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 *ProjectsLocationsJobsResumeCall) Fields(s ...googleapi.Field) *ProjectsLocationsJobsResumeCall { 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 *ProjectsLocationsJobsResumeCall) Context(ctx context.Context) *ProjectsLocationsJobsResumeCall { 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 *ProjectsLocationsJobsResumeCall) Header() http.Header { 2561 if c.header_ == nil { 2562 c.header_ = make(http.Header) 2563 } 2564 return c.header_ 2565} 2566 2567func (c *ProjectsLocationsJobsResumeCall) doRequest(alt string) (*http.Response, error) { 2568 reqHeaders := make(http.Header) 2569 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.4 gdcl/20191114") 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.resumejobrequest) 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, "v1beta1/{+name}:resume") 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 "name": c.name, 2591 }) 2592 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2593} 2594 2595// Do executes the "cloudscheduler.projects.locations.jobs.resume" call. 2596// Exactly one of *Job or error will be non-nil. Any non-2xx status code 2597// is an error. Response headers are in either 2598// *Job.ServerResponse.Header or (if a response was returned at all) in 2599// error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check 2600// whether the returned error was because http.StatusNotModified was 2601// returned. 2602func (c *ProjectsLocationsJobsResumeCall) Do(opts ...googleapi.CallOption) (*Job, error) { 2603 gensupport.SetOptions(c.urlParams_, opts...) 2604 res, err := c.doRequest("json") 2605 if res != nil && res.StatusCode == http.StatusNotModified { 2606 if res.Body != nil { 2607 res.Body.Close() 2608 } 2609 return nil, &googleapi.Error{ 2610 Code: res.StatusCode, 2611 Header: res.Header, 2612 } 2613 } 2614 if err != nil { 2615 return nil, err 2616 } 2617 defer googleapi.CloseBody(res) 2618 if err := googleapi.CheckResponse(res); err != nil { 2619 return nil, err 2620 } 2621 ret := &Job{ 2622 ServerResponse: googleapi.ServerResponse{ 2623 Header: res.Header, 2624 HTTPStatusCode: res.StatusCode, 2625 }, 2626 } 2627 target := &ret 2628 if err := gensupport.DecodeResponse(target, res); err != nil { 2629 return nil, err 2630 } 2631 return ret, nil 2632 // { 2633 // "description": "Resume a job.\n\nThis method reenables a job after it has been Job.State.PAUSED. The\nstate of a job is stored in Job.state; after calling this method it\nwill be set to Job.State.ENABLED. A job must be in\nJob.State.PAUSED to be resumed.", 2634 // "flatPath": "v1beta1/projects/{projectsId}/locations/{locationsId}/jobs/{jobsId}:resume", 2635 // "httpMethod": "POST", 2636 // "id": "cloudscheduler.projects.locations.jobs.resume", 2637 // "parameterOrder": [ 2638 // "name" 2639 // ], 2640 // "parameters": { 2641 // "name": { 2642 // "description": "Required. The job name. For example:\n`projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`.", 2643 // "location": "path", 2644 // "pattern": "^projects/[^/]+/locations/[^/]+/jobs/[^/]+$", 2645 // "required": true, 2646 // "type": "string" 2647 // } 2648 // }, 2649 // "path": "v1beta1/{+name}:resume", 2650 // "request": { 2651 // "$ref": "ResumeJobRequest" 2652 // }, 2653 // "response": { 2654 // "$ref": "Job" 2655 // }, 2656 // "scopes": [ 2657 // "https://www.googleapis.com/auth/cloud-platform" 2658 // ] 2659 // } 2660 2661} 2662 2663// method id "cloudscheduler.projects.locations.jobs.run": 2664 2665type ProjectsLocationsJobsRunCall struct { 2666 s *Service 2667 name string 2668 runjobrequest *RunJobRequest 2669 urlParams_ gensupport.URLParams 2670 ctx_ context.Context 2671 header_ http.Header 2672} 2673 2674// Run: Forces a job to run now. 2675// 2676// When this method is called, Cloud Scheduler will dispatch the job, 2677// even 2678// if the job is already running. 2679func (r *ProjectsLocationsJobsService) Run(name string, runjobrequest *RunJobRequest) *ProjectsLocationsJobsRunCall { 2680 c := &ProjectsLocationsJobsRunCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2681 c.name = name 2682 c.runjobrequest = runjobrequest 2683 return c 2684} 2685 2686// Fields allows partial responses to be retrieved. See 2687// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2688// for more information. 2689func (c *ProjectsLocationsJobsRunCall) Fields(s ...googleapi.Field) *ProjectsLocationsJobsRunCall { 2690 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2691 return c 2692} 2693 2694// Context sets the context to be used in this call's Do method. Any 2695// pending HTTP request will be aborted if the provided context is 2696// canceled. 2697func (c *ProjectsLocationsJobsRunCall) Context(ctx context.Context) *ProjectsLocationsJobsRunCall { 2698 c.ctx_ = ctx 2699 return c 2700} 2701 2702// Header returns an http.Header that can be modified by the caller to 2703// add HTTP headers to the request. 2704func (c *ProjectsLocationsJobsRunCall) Header() http.Header { 2705 if c.header_ == nil { 2706 c.header_ = make(http.Header) 2707 } 2708 return c.header_ 2709} 2710 2711func (c *ProjectsLocationsJobsRunCall) doRequest(alt string) (*http.Response, error) { 2712 reqHeaders := make(http.Header) 2713 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.4 gdcl/20191114") 2714 for k, v := range c.header_ { 2715 reqHeaders[k] = v 2716 } 2717 reqHeaders.Set("User-Agent", c.s.userAgent()) 2718 var body io.Reader = nil 2719 body, err := googleapi.WithoutDataWrapper.JSONReader(c.runjobrequest) 2720 if err != nil { 2721 return nil, err 2722 } 2723 reqHeaders.Set("Content-Type", "application/json") 2724 c.urlParams_.Set("alt", alt) 2725 c.urlParams_.Set("prettyPrint", "false") 2726 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+name}:run") 2727 urls += "?" + c.urlParams_.Encode() 2728 req, err := http.NewRequest("POST", urls, body) 2729 if err != nil { 2730 return nil, err 2731 } 2732 req.Header = reqHeaders 2733 googleapi.Expand(req.URL, map[string]string{ 2734 "name": c.name, 2735 }) 2736 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2737} 2738 2739// Do executes the "cloudscheduler.projects.locations.jobs.run" call. 2740// Exactly one of *Job or error will be non-nil. Any non-2xx status code 2741// is an error. Response headers are in either 2742// *Job.ServerResponse.Header or (if a response was returned at all) in 2743// error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check 2744// whether the returned error was because http.StatusNotModified was 2745// returned. 2746func (c *ProjectsLocationsJobsRunCall) Do(opts ...googleapi.CallOption) (*Job, error) { 2747 gensupport.SetOptions(c.urlParams_, opts...) 2748 res, err := c.doRequest("json") 2749 if res != nil && res.StatusCode == http.StatusNotModified { 2750 if res.Body != nil { 2751 res.Body.Close() 2752 } 2753 return nil, &googleapi.Error{ 2754 Code: res.StatusCode, 2755 Header: res.Header, 2756 } 2757 } 2758 if err != nil { 2759 return nil, err 2760 } 2761 defer googleapi.CloseBody(res) 2762 if err := googleapi.CheckResponse(res); err != nil { 2763 return nil, err 2764 } 2765 ret := &Job{ 2766 ServerResponse: googleapi.ServerResponse{ 2767 Header: res.Header, 2768 HTTPStatusCode: res.StatusCode, 2769 }, 2770 } 2771 target := &ret 2772 if err := gensupport.DecodeResponse(target, res); err != nil { 2773 return nil, err 2774 } 2775 return ret, nil 2776 // { 2777 // "description": "Forces a job to run now.\n\nWhen this method is called, Cloud Scheduler will dispatch the job, even\nif the job is already running.", 2778 // "flatPath": "v1beta1/projects/{projectsId}/locations/{locationsId}/jobs/{jobsId}:run", 2779 // "httpMethod": "POST", 2780 // "id": "cloudscheduler.projects.locations.jobs.run", 2781 // "parameterOrder": [ 2782 // "name" 2783 // ], 2784 // "parameters": { 2785 // "name": { 2786 // "description": "Required. The job name. For example:\n`projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`.", 2787 // "location": "path", 2788 // "pattern": "^projects/[^/]+/locations/[^/]+/jobs/[^/]+$", 2789 // "required": true, 2790 // "type": "string" 2791 // } 2792 // }, 2793 // "path": "v1beta1/{+name}:run", 2794 // "request": { 2795 // "$ref": "RunJobRequest" 2796 // }, 2797 // "response": { 2798 // "$ref": "Job" 2799 // }, 2800 // "scopes": [ 2801 // "https://www.googleapis.com/auth/cloud-platform" 2802 // ] 2803 // } 2804 2805} 2806