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