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