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