1 // Copyright 2024 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 // # Library status 12 // 13 // These client libraries are officially supported by Google. However, this 14 // library is considered complete and is in maintenance mode. This means 15 // that we will address critical bugs and security issues but will not add 16 // any new features. 17 // 18 // When possible, we recommend using our newer 19 // [Cloud Client Libraries for Go](https://pkg.go.dev/cloud.google.com/go) 20 // that are still actively being worked and iterated on. 21 // 22 // # Creating a client 23 // 24 // Usage example: 25 // 26 // import "google.golang.org/api/cloudscheduler/v1" 27 // ... 28 // ctx := context.Background() 29 // cloudschedulerService, err := cloudscheduler.NewService(ctx) 30 // 31 // In this example, Google Application Default Credentials are used for 32 // authentication. For information on how to create and obtain Application 33 // Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials. 34 // 35 // # Other authentication options 36 // 37 // To use an API key for authentication (note: some APIs do not support API 38 // keys), use [google.golang.org/api/option.WithAPIKey]: 39 // 40 // cloudschedulerService, err := cloudscheduler.NewService(ctx, option.WithAPIKey("AIza...")) 41 // 42 // To use an OAuth token (e.g., a user token obtained via a three-legged OAuth 43 // flow, use [google.golang.org/api/option.WithTokenSource]: 44 // 45 // config := &oauth2.Config{...} 46 // // ... 47 // token, err := config.Exchange(ctx, ...) 48 // cloudschedulerService, err := cloudscheduler.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token))) 49 // 50 // See [google.golang.org/api/option.ClientOption] for details on options. 51 package cloudscheduler // import "google.golang.org/api/cloudscheduler/v1" 52 53 import ( 54 "bytes" 55 "context" 56 "encoding/json" 57 "errors" 58 "fmt" 59 "io" 60 "net/http" 61 "net/url" 62 "strconv" 63 "strings" 64 65 googleapi "google.golang.org/api/googleapi" 66 internal "google.golang.org/api/internal" 67 gensupport "google.golang.org/api/internal/gensupport" 68 option "google.golang.org/api/option" 69 internaloption "google.golang.org/api/option/internaloption" 70 htransport "google.golang.org/api/transport/http" 71 ) 72 73 // Always reference these packages, just in case the auto-generated code 74 // below doesn't. 75 var _ = bytes.NewBuffer 76 var _ = strconv.Itoa 77 var _ = fmt.Sprintf 78 var _ = json.NewDecoder 79 var _ = io.Copy 80 var _ = url.Parse 81 var _ = gensupport.MarshalJSON 82 var _ = googleapi.Version 83 var _ = errors.New 84 var _ = strings.Replace 85 var _ = context.Canceled 86 var _ = internaloption.WithDefaultEndpoint 87 var _ = internal.Version 88 89 const apiId = "cloudscheduler:v1" 90 const apiName = "cloudscheduler" 91 const apiVersion = "v1" 92 const basePath = "https://cloudscheduler.googleapis.com/" 93 const basePathTemplate = "https://cloudscheduler.UNIVERSE_DOMAIN/" 94 const mtlsBasePath = "https://cloudscheduler.mtls.googleapis.com/" 95 96 // OAuth2 scopes used by this API. 97 const ( 98 // See, edit, configure, and delete your Google Cloud data and see the email 99 // address for your Google Account. 100 CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform" 101 ) 102 103 // NewService creates a new Service. 104 func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) { 105 scopesOption := internaloption.WithDefaultScopes( 106 "https://www.googleapis.com/auth/cloud-platform", 107 ) 108 // NOTE: prepend, so we don't override user-specified scopes. 109 opts = append([]option.ClientOption{scopesOption}, opts...) 110 opts = append(opts, internaloption.WithDefaultEndpoint(basePath)) 111 opts = append(opts, internaloption.WithDefaultEndpointTemplate(basePathTemplate)) 112 opts = append(opts, internaloption.WithDefaultMTLSEndpoint(mtlsBasePath)) 113 opts = append(opts, internaloption.EnableNewAuthLibrary()) 114 client, endpoint, err := htransport.NewClient(ctx, opts...) 115 if err != nil { 116 return nil, err 117 } 118 s, err := New(client) 119 if err != nil { 120 return nil, err 121 } 122 if endpoint != "" { 123 s.BasePath = endpoint 124 } 125 return s, nil 126 } 127 128 // New creates a new Service. It uses the provided http.Client for requests. 129 // 130 // Deprecated: please use NewService instead. 131 // To provide a custom HTTP client, use option.WithHTTPClient. 132 // If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead. 133 func New(client *http.Client) (*Service, error) { 134 if client == nil { 135 return nil, errors.New("client is nil") 136 } 137 s := &Service{client: client, BasePath: basePath} 138 s.Projects = NewProjectsService(s) 139 return s, nil 140 } 141 142 type Service struct { 143 client *http.Client 144 BasePath string // API endpoint base URL 145 UserAgent string // optional additional User-Agent fragment 146 147 Projects *ProjectsService 148 } 149 150 func (s *Service) userAgent() string { 151 if s.UserAgent == "" { 152 return googleapi.UserAgent 153 } 154 return googleapi.UserAgent + " " + s.UserAgent 155 } 156 157 func NewProjectsService(s *Service) *ProjectsService { 158 rs := &ProjectsService{s: s} 159 rs.Locations = NewProjectsLocationsService(s) 160 return rs 161 } 162 163 type ProjectsService struct { 164 s *Service 165 166 Locations *ProjectsLocationsService 167 } 168 169 func NewProjectsLocationsService(s *Service) *ProjectsLocationsService { 170 rs := &ProjectsLocationsService{s: s} 171 rs.Jobs = NewProjectsLocationsJobsService(s) 172 return rs 173 } 174 175 type ProjectsLocationsService struct { 176 s *Service 177 178 Jobs *ProjectsLocationsJobsService 179 } 180 181 func NewProjectsLocationsJobsService(s *Service) *ProjectsLocationsJobsService { 182 rs := &ProjectsLocationsJobsService{s: s} 183 return rs 184 } 185 186 type ProjectsLocationsJobsService struct { 187 s *Service 188 } 189 190 // AppEngineHttpTarget: App Engine target. The job will be pushed to a job 191 // handler by means of an HTTP request via an http_method such as HTTP POST, 192 // HTTP GET, etc. The job is acknowledged by means of an HTTP response code in 193 // the range [200 - 299]. Error 503 is considered an App Engine system error 194 // instead of an application error. Requests returning error 503 will be 195 // retried regardless of retry configuration and not counted against retry 196 // counts. Any other response code, or a failure to receive a response before 197 // the deadline, constitutes a failed attempt. 198 type AppEngineHttpTarget struct { 199 // AppEngineRouting: App Engine Routing setting for the job. 200 AppEngineRouting *AppEngineRouting `json:"appEngineRouting,omitempty"` 201 // Body: Body. HTTP request body. A request body is allowed only if the HTTP 202 // method is POST or PUT. It will result in invalid argument error to set a 203 // body on a job with an incompatible HttpMethod. 204 Body string `json:"body,omitempty"` 205 // Headers: HTTP request headers. This map contains the header field names and 206 // values. Headers can be set when the job is created. Cloud Scheduler sets 207 // some headers to default values: * `User-Agent`: By default, this header is 208 // "AppEngine-Google; (+http://code.google.com/appengine)". This header can 209 // be modified, but Cloud Scheduler will append "AppEngine-Google; 210 // (+http://code.google.com/appengine)" to the modified `User-Agent`. * 211 // `X-CloudScheduler`: This header will be set to true. * 212 // `X-CloudScheduler-JobName`: This header will contain the job name. * 213 // `X-CloudScheduler-ScheduleTime`: For Cloud Scheduler jobs specified in the 214 // unix-cron format, this header will contain the job schedule as an offset of 215 // UTC parsed according to RFC3339. If the job has a body and the following 216 // headers are not set by the user, Cloud Scheduler sets default values: * 217 // `Content-Type`: This will be set to "application/octet-stream". You can 218 // override this default by explicitly setting `Content-Type` to a particular 219 // media type when creating the job. For example, you can set `Content-Type` to 220 // "application/json". The headers below are output only. They cannot be set 221 // or overridden: * `Content-Length`: This is computed by Cloud Scheduler. * 222 // `X-Google-*`: For Google internal use only. * `X-AppEngine-*`: For Google 223 // internal use only. In addition, some App Engine headers, which contain 224 // job-specific information, are also be sent to the job handler. 225 Headers map[string]string `json:"headers,omitempty"` 226 // HttpMethod: The HTTP method to use for the request. PATCH and OPTIONS are 227 // not permitted. 228 // 229 // Possible values: 230 // "HTTP_METHOD_UNSPECIFIED" - HTTP method unspecified. Defaults to POST. 231 // "POST" - HTTP POST 232 // "GET" - HTTP GET 233 // "HEAD" - HTTP HEAD 234 // "PUT" - HTTP PUT 235 // "DELETE" - HTTP DELETE 236 // "PATCH" - HTTP PATCH 237 // "OPTIONS" - HTTP OPTIONS 238 HttpMethod string `json:"httpMethod,omitempty"` 239 // RelativeUri: The relative URI. The relative URL must begin with "/" and must 240 // be a valid HTTP relative URL. It can contain a path, query string arguments, 241 // and `#` fragments. If the relative URL is empty, then the root path "/" will 242 // be used. No spaces are allowed, and the maximum length allowed is 2083 243 // characters. 244 RelativeUri string `json:"relativeUri,omitempty"` 245 // ForceSendFields is a list of field names (e.g. "AppEngineRouting") to 246 // unconditionally include in API requests. By default, fields with empty or 247 // default values are omitted from API requests. See 248 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 249 // details. 250 ForceSendFields []string `json:"-"` 251 // NullFields is a list of field names (e.g. "AppEngineRouting") to include in 252 // API requests with the JSON null value. By default, fields with empty values 253 // are omitted from API requests. See 254 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 255 NullFields []string `json:"-"` 256 } 257 258 func (s *AppEngineHttpTarget) MarshalJSON() ([]byte, error) { 259 type NoMethod AppEngineHttpTarget 260 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 261 } 262 263 // AppEngineRouting: App Engine Routing. For more information about services, 264 // versions, and instances see An Overview of App Engine 265 // (https://cloud.google.com/appengine/docs/python/an-overview-of-app-engine), 266 // Microservices Architecture on Google App Engine 267 // (https://cloud.google.com/appengine/docs/python/microservices-on-app-engine), 268 // App Engine Standard request routing 269 // (https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed), 270 // and App Engine Flex request routing 271 // (https://cloud.google.com/appengine/docs/flexible/python/how-requests-are-routed). 272 type AppEngineRouting struct { 273 // Host: Output only. The host that the job is sent to. For more information 274 // about how App Engine requests are routed, see here 275 // (https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed). 276 // The host is constructed as: * `host = [application_domain_name]` `| 277 // [service] + '.' + [application_domain_name]` `| [version] + '.' + 278 // [application_domain_name]` `| [version_dot_service]+ '.' + 279 // [application_domain_name]` `| [instance] + '.' + [application_domain_name]` 280 // `| [instance_dot_service] + '.' + [application_domain_name]` `| 281 // [instance_dot_version] + '.' + [application_domain_name]` `| 282 // [instance_dot_version_dot_service] + '.' + [application_domain_name]` * 283 // `application_domain_name` = The domain name of the app, for example 284 // .appspot.com, which is associated with the job's project ID. * `service =` 285 // service * `version =` version * `version_dot_service =` version `+ '.' +` 286 // service * `instance =` instance * `instance_dot_service =` instance `+ '.' 287 // +` service * `instance_dot_version =` instance `+ '.' +` version * 288 // `instance_dot_version_dot_service =` instance `+ '.' +` version `+ '.' +` 289 // service If service is empty, then the job will be sent to the service which 290 // is the default service when the job is attempted. If version is empty, then 291 // the job will be sent to the version which is the default version when the 292 // job is attempted. If instance is empty, then the job will be sent to an 293 // instance which is available when the job is attempted. If service, version, 294 // or instance is invalid, then the job will be sent to the default version of 295 // the default service when the job is attempted. 296 Host string `json:"host,omitempty"` 297 // Instance: App instance. By default, the job is sent to an instance which is 298 // available when the job is attempted. Requests can only be sent to a specific 299 // instance if manual scaling is used in App Engine Standard 300 // (https://cloud.google.com/appengine/docs/python/an-overview-of-app-engine?#scaling_types_and_instance_classes). 301 // App Engine Flex does not support instances. For more information, see App 302 // Engine Standard request routing 303 // (https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed) 304 // and App Engine Flex request routing 305 // (https://cloud.google.com/appengine/docs/flexible/python/how-requests-are-routed). 306 Instance string `json:"instance,omitempty"` 307 // Service: App service. By default, the job is sent to the service which is 308 // the default service when the job is attempted. 309 Service string `json:"service,omitempty"` 310 // Version: App version. By default, the job is sent to the version which is 311 // the default version when the job is attempted. 312 Version string `json:"version,omitempty"` 313 // ForceSendFields is a list of field names (e.g. "Host") to unconditionally 314 // include in API requests. By default, fields with empty or default values are 315 // omitted from API requests. See 316 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 317 // details. 318 ForceSendFields []string `json:"-"` 319 // NullFields is a list of field names (e.g. "Host") to include in API requests 320 // with the JSON null value. By default, fields with empty values are omitted 321 // from API requests. See 322 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 323 NullFields []string `json:"-"` 324 } 325 326 func (s *AppEngineRouting) MarshalJSON() ([]byte, error) { 327 type NoMethod AppEngineRouting 328 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 329 } 330 331 // Empty: A generic empty message that you can re-use to avoid defining 332 // duplicated empty messages in your APIs. A typical example is to use it as 333 // the request or the response type of an API method. For instance: service Foo 334 // { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); } 335 type Empty struct { 336 // ServerResponse contains the HTTP response code and headers from the server. 337 googleapi.ServerResponse `json:"-"` 338 } 339 340 // HttpTarget: Http target. The job will be pushed to the job handler by means 341 // of an HTTP request via an http_method such as HTTP POST, HTTP GET, etc. The 342 // job is acknowledged by means of an HTTP response code in the range [200 - 343 // 299]. A failure to receive a response constitutes a failed execution. For a 344 // redirected request, the response returned by the redirected request is 345 // considered. 346 type HttpTarget struct { 347 // Body: HTTP request body. A request body is allowed only if the HTTP method 348 // is POST, PUT, or PATCH. It is an error to set body on a job with an 349 // incompatible HttpMethod. 350 Body string `json:"body,omitempty"` 351 // Headers: HTTP request headers. This map contains the header field names and 352 // values. The user can specify HTTP request headers to send with the job's 353 // HTTP request. Repeated headers are not supported, but a header value can 354 // contain commas. The following headers represent a subset of the headers that 355 // accompany the job's HTTP request. Some HTTP request headers are ignored or 356 // replaced. A partial list of headers that are ignored or replaced is below: * 357 // Host: This will be computed by Cloud Scheduler and derived from uri. * 358 // `Content-Length`: This will be computed by Cloud Scheduler. * `User-Agent`: 359 // This will be set to "Google-Cloud-Scheduler". * `X-Google-*`: Google 360 // internal use only. * `X-AppEngine-*`: Google internal use only. * 361 // `X-CloudScheduler`: This header will be set to true. * 362 // `X-CloudScheduler-JobName`: This header will contain the job name. * 363 // `X-CloudScheduler-ScheduleTime`: For Cloud Scheduler jobs specified in the 364 // unix-cron format, this header will contain the job schedule as an offset of 365 // UTC parsed according to RFC3339. If the job has a body and the following 366 // headers are not set by the user, Cloud Scheduler sets default values: * 367 // `Content-Type`: This will be set to "application/octet-stream". You can 368 // override this default by explicitly setting `Content-Type` to a particular 369 // media type when creating the job. For example, you can set `Content-Type` to 370 // "application/json". The total size of headers must be less than 80KB. 371 Headers map[string]string `json:"headers,omitempty"` 372 // HttpMethod: Which HTTP method to use for the request. 373 // 374 // Possible values: 375 // "HTTP_METHOD_UNSPECIFIED" - HTTP method unspecified. Defaults to POST. 376 // "POST" - HTTP POST 377 // "GET" - HTTP GET 378 // "HEAD" - HTTP HEAD 379 // "PUT" - HTTP PUT 380 // "DELETE" - HTTP DELETE 381 // "PATCH" - HTTP PATCH 382 // "OPTIONS" - HTTP OPTIONS 383 HttpMethod string `json:"httpMethod,omitempty"` 384 // OauthToken: If specified, an OAuth token 385 // (https://developers.google.com/identity/protocols/OAuth2) will be generated 386 // and attached as an `Authorization` header in the HTTP request. This type of 387 // authorization should generally only be used when calling Google APIs hosted 388 // on *.googleapis.com. 389 OauthToken *OAuthToken `json:"oauthToken,omitempty"` 390 // OidcToken: If specified, an OIDC 391 // (https://developers.google.com/identity/protocols/OpenIDConnect) token will 392 // be generated and attached as an `Authorization` header in the HTTP request. 393 // This type of authorization can be used for many scenarios, including calling 394 // Cloud Run, or endpoints where you intend to validate the token yourself. 395 OidcToken *OidcToken `json:"oidcToken,omitempty"` 396 // Uri: Required. The full URI path that the request will be sent to. This 397 // string must begin with either "http://" or "https://". Some examples of 398 // valid values for uri are: `http://acme.com` and 399 // `https://acme.com/sales:8080`. Cloud Scheduler will encode some characters 400 // for safety and compatibility. The maximum allowed URL length is 2083 401 // characters after encoding. 402 Uri string `json:"uri,omitempty"` 403 // ForceSendFields is a list of field names (e.g. "Body") to unconditionally 404 // include in API requests. By default, fields with empty or default values are 405 // omitted from API requests. See 406 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 407 // details. 408 ForceSendFields []string `json:"-"` 409 // NullFields is a list of field names (e.g. "Body") to include in API requests 410 // with the JSON null value. By default, fields with empty values are omitted 411 // from API requests. See 412 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 413 NullFields []string `json:"-"` 414 } 415 416 func (s *HttpTarget) MarshalJSON() ([]byte, error) { 417 type NoMethod HttpTarget 418 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 419 } 420 421 // Job: Configuration for a job. The maximum allowed size for a job is 1MB. 422 type Job struct { 423 // AppEngineHttpTarget: App Engine HTTP target. 424 AppEngineHttpTarget *AppEngineHttpTarget `json:"appEngineHttpTarget,omitempty"` 425 // AttemptDeadline: The deadline for job attempts. If the request handler does 426 // not respond by this deadline then the request is cancelled and the attempt 427 // is marked as a `DEADLINE_EXCEEDED` failure. The failed attempt can be viewed 428 // in execution logs. Cloud Scheduler will retry the job according to the 429 // RetryConfig. The default and the allowed values depend on the type of 430 // target: * For HTTP targets, the default is 3 minutes. The deadline must be 431 // in the interval [15 seconds, 30 minutes]. * For App Engine HTTP targets, 0 432 // indicates that the request has the default deadline. The default deadline 433 // depends on the scaling type of the service: 10 minutes for standard apps 434 // with automatic scaling, 24 hours for standard apps with manual and basic 435 // scaling, and 60 minutes for flex apps. If the request deadline is set, it 436 // must be in the interval [15 seconds, 24 hours 15 seconds]. * For Pub/Sub 437 // targets, this field is ignored. 438 AttemptDeadline string `json:"attemptDeadline,omitempty"` 439 // Description: Optionally caller-specified in CreateJob or UpdateJob. A 440 // human-readable description for the job. This string must not contain more 441 // than 500 characters. 442 Description string `json:"description,omitempty"` 443 // HttpTarget: HTTP target. 444 HttpTarget *HttpTarget `json:"httpTarget,omitempty"` 445 // LastAttemptTime: Output only. The time the last job attempt started. 446 LastAttemptTime string `json:"lastAttemptTime,omitempty"` 447 // Name: Optionally caller-specified in CreateJob, after which it becomes 448 // output only. The job name. For example: 449 // `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`. * `PROJECT_ID` can 450 // contain letters ([A-Za-z]), numbers ([0-9]), hyphens (-), colons (:), or 451 // periods (.). For more information, see Identifying projects 452 // (https://cloud.google.com/resource-manager/docs/creating-managing-projects#identifying_projects) 453 // * `LOCATION_ID` is the canonical ID for the job's location. The list of 454 // available locations can be obtained by calling ListLocations. For more 455 // information, see https://cloud.google.com/about/locations/. * `JOB_ID` can 456 // contain only letters ([A-Za-z]), numbers ([0-9]), hyphens (-), or 457 // underscores (_). The maximum length is 500 characters. 458 Name string `json:"name,omitempty"` 459 // PubsubTarget: Pub/Sub target. 460 PubsubTarget *PubsubTarget `json:"pubsubTarget,omitempty"` 461 // RetryConfig: Settings that determine the retry behavior. 462 RetryConfig *RetryConfig `json:"retryConfig,omitempty"` 463 // Schedule: Required, except when used with UpdateJob. Describes the schedule 464 // on which the job will be executed. The schedule can be either of the 465 // following types: * Crontab (https://en.wikipedia.org/wiki/Cron#Overview) * 466 // English-like schedule 467 // (https://cloud.google.com/scheduler/docs/configuring/cron-job-schedules) As 468 // a general rule, execution `n + 1` of a job will not begin until execution 469 // `n` has finished. Cloud Scheduler will never allow two simultaneously 470 // outstanding executions. For example, this implies that if the `n+1`th 471 // execution is scheduled to run at 16:00 but the `n`th execution takes until 472 // 16:15, the `n+1`th execution will not start until `16:15`. A scheduled start 473 // time will be delayed if the previous execution has not ended when its 474 // scheduled time occurs. If retry_count > 0 and a job attempt fails, the job 475 // will be tried a total of retry_count times, with exponential backoff, until 476 // the next scheduled start time. If retry_count is 0, a job attempt will not 477 // be retried if it fails. Instead the Cloud Scheduler system will wait for the 478 // next scheduled execution time. Setting retry_count to 0 does not prevent 479 // failed jobs from running according to schedule after the failure. 480 Schedule string `json:"schedule,omitempty"` 481 // ScheduleTime: Output only. The next time the job is scheduled. Note that 482 // this may be a retry of a previously failed attempt or the next execution 483 // time according to the schedule. 484 ScheduleTime string `json:"scheduleTime,omitempty"` 485 // State: Output only. State of the job. 486 // 487 // Possible values: 488 // "STATE_UNSPECIFIED" - Unspecified state. 489 // "ENABLED" - The job is executing normally. 490 // "PAUSED" - The job is paused by the user. It will not execute. A user can 491 // intentionally pause the job using PauseJobRequest. 492 // "DISABLED" - The job is disabled by the system due to error. The user 493 // cannot directly set a job to be disabled. 494 // "UPDATE_FAILED" - The job state resulting from a failed 495 // CloudScheduler.UpdateJob operation. To recover a job from this state, retry 496 // CloudScheduler.UpdateJob until a successful response is received. 497 State string `json:"state,omitempty"` 498 // Status: Output only. The response from the target for the last attempted 499 // execution. 500 Status *Status `json:"status,omitempty"` 501 // TimeZone: Specifies the time zone to be used in interpreting schedule. The 502 // value of this field must be a time zone name from the tz database 503 // (http://en.wikipedia.org/wiki/Tz_database). Note that some time zones 504 // include a provision for daylight savings time. The rules for daylight saving 505 // time are determined by the chosen tz. For UTC use the string "utc". If a 506 // time zone is not specified, the default will be in UTC (also known as GMT). 507 TimeZone string `json:"timeZone,omitempty"` 508 // UserUpdateTime: Output only. The creation time of the job. 509 UserUpdateTime string `json:"userUpdateTime,omitempty"` 510 511 // ServerResponse contains the HTTP response code and headers from the server. 512 googleapi.ServerResponse `json:"-"` 513 // ForceSendFields is a list of field names (e.g. "AppEngineHttpTarget") to 514 // unconditionally include in API requests. By default, fields with empty or 515 // default values are omitted from API requests. See 516 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 517 // details. 518 ForceSendFields []string `json:"-"` 519 // NullFields is a list of field names (e.g. "AppEngineHttpTarget") to include 520 // in API requests with the JSON null value. By default, fields with empty 521 // values are omitted from API requests. See 522 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 523 NullFields []string `json:"-"` 524 } 525 526 func (s *Job) MarshalJSON() ([]byte, error) { 527 type NoMethod Job 528 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 529 } 530 531 // ListJobsResponse: Response message for listing jobs using ListJobs. 532 type ListJobsResponse struct { 533 // Jobs: The list of jobs. 534 Jobs []*Job `json:"jobs,omitempty"` 535 // NextPageToken: A token to retrieve next page of results. Pass this value in 536 // the page_token field in the subsequent call to ListJobs to retrieve the next 537 // page of results. If this is empty it indicates that there are no more 538 // results through which to paginate. The page token is valid for only 2 hours. 539 NextPageToken string `json:"nextPageToken,omitempty"` 540 541 // ServerResponse contains the HTTP response code and headers from the server. 542 googleapi.ServerResponse `json:"-"` 543 // ForceSendFields is a list of field names (e.g. "Jobs") to unconditionally 544 // include in API requests. By default, fields with empty or default values are 545 // omitted from API requests. See 546 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 547 // details. 548 ForceSendFields []string `json:"-"` 549 // NullFields is a list of field names (e.g. "Jobs") to include in API requests 550 // with the JSON null value. By default, fields with empty values are omitted 551 // from API requests. See 552 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 553 NullFields []string `json:"-"` 554 } 555 556 func (s *ListJobsResponse) MarshalJSON() ([]byte, error) { 557 type NoMethod ListJobsResponse 558 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 559 } 560 561 // ListLocationsResponse: The response message for Locations.ListLocations. 562 type ListLocationsResponse struct { 563 // Locations: A list of locations that matches the specified filter in the 564 // request. 565 Locations []*Location `json:"locations,omitempty"` 566 // NextPageToken: The standard List next-page token. 567 NextPageToken string `json:"nextPageToken,omitempty"` 568 569 // ServerResponse contains the HTTP response code and headers from the server. 570 googleapi.ServerResponse `json:"-"` 571 // ForceSendFields is a list of field names (e.g. "Locations") to 572 // unconditionally include in API requests. By default, fields with empty or 573 // default values are omitted from API requests. See 574 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 575 // details. 576 ForceSendFields []string `json:"-"` 577 // NullFields is a list of field names (e.g. "Locations") to include in API 578 // requests with the JSON null value. By default, fields with empty values are 579 // omitted from API requests. See 580 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 581 NullFields []string `json:"-"` 582 } 583 584 func (s *ListLocationsResponse) MarshalJSON() ([]byte, error) { 585 type NoMethod ListLocationsResponse 586 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 587 } 588 589 // Location: A resource that represents a Google Cloud location. 590 type Location struct { 591 // DisplayName: The friendly name for this location, typically a nearby city 592 // name. For example, "Tokyo". 593 DisplayName string `json:"displayName,omitempty"` 594 // Labels: Cross-service attributes for the location. For example 595 // {"cloud.googleapis.com/region": "us-east1"} 596 Labels map[string]string `json:"labels,omitempty"` 597 // LocationId: The canonical id for this location. For example: "us-east1". 598 LocationId string `json:"locationId,omitempty"` 599 // Metadata: Service-specific metadata. For example the available capacity at 600 // the given location. 601 Metadata googleapi.RawMessage `json:"metadata,omitempty"` 602 // Name: Resource name for the location, which may vary between 603 // implementations. For example: 604 // "projects/example-project/locations/us-east1" 605 Name string `json:"name,omitempty"` 606 607 // ServerResponse contains the HTTP response code and headers from the server. 608 googleapi.ServerResponse `json:"-"` 609 // ForceSendFields is a list of field names (e.g. "DisplayName") to 610 // unconditionally include in API requests. By default, fields with empty or 611 // default values are omitted from API requests. See 612 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 613 // details. 614 ForceSendFields []string `json:"-"` 615 // NullFields is a list of field names (e.g. "DisplayName") to include in API 616 // requests with the JSON null value. By default, fields with empty values are 617 // omitted from API requests. See 618 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 619 NullFields []string `json:"-"` 620 } 621 622 func (s *Location) MarshalJSON() ([]byte, error) { 623 type NoMethod Location 624 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 625 } 626 627 // OAuthToken: Contains information needed for generating an OAuth token 628 // (https://developers.google.com/identity/protocols/OAuth2). This type of 629 // authorization should generally only be used when calling Google APIs hosted 630 // on *.googleapis.com. 631 type OAuthToken struct { 632 // Scope: OAuth scope to be used for generating OAuth access token. If not 633 // specified, "https://www.googleapis.com/auth/cloud-platform" will be used. 634 Scope string `json:"scope,omitempty"` 635 // ServiceAccountEmail: Service account email 636 // (https://cloud.google.com/iam/docs/service-accounts) to be used for 637 // generating OAuth token. The service account must be within the same project 638 // as the job. The caller must have iam.serviceAccounts.actAs permission for 639 // the service account. 640 ServiceAccountEmail string `json:"serviceAccountEmail,omitempty"` 641 // ForceSendFields is a list of field names (e.g. "Scope") to unconditionally 642 // include in API requests. By default, fields with empty or default values are 643 // omitted from API requests. See 644 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 645 // details. 646 ForceSendFields []string `json:"-"` 647 // NullFields is a list of field names (e.g. "Scope") to include in API 648 // requests with the JSON null value. By default, fields with empty values are 649 // omitted from API requests. See 650 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 651 NullFields []string `json:"-"` 652 } 653 654 func (s *OAuthToken) MarshalJSON() ([]byte, error) { 655 type NoMethod OAuthToken 656 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 657 } 658 659 // OidcToken: Contains information needed for generating an OpenID Connect 660 // token (https://developers.google.com/identity/protocols/OpenIDConnect). This 661 // type of authorization can be used for many scenarios, including calling 662 // Cloud Run, or endpoints where you intend to validate the token yourself. 663 type OidcToken struct { 664 // Audience: Audience to be used when generating OIDC token. If not specified, 665 // the URI specified in target will be used. 666 Audience string `json:"audience,omitempty"` 667 // ServiceAccountEmail: Service account email 668 // (https://cloud.google.com/iam/docs/service-accounts) to be used for 669 // generating OIDC token. The service account must be within the same project 670 // as the job. The caller must have iam.serviceAccounts.actAs permission for 671 // the service account. 672 ServiceAccountEmail string `json:"serviceAccountEmail,omitempty"` 673 // ForceSendFields is a list of field names (e.g. "Audience") to 674 // unconditionally include in API requests. By default, fields with empty or 675 // default values are omitted from API requests. See 676 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 677 // details. 678 ForceSendFields []string `json:"-"` 679 // NullFields is a list of field names (e.g. "Audience") to include in API 680 // requests with the JSON null value. By default, fields with empty values are 681 // omitted from API requests. See 682 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 683 NullFields []string `json:"-"` 684 } 685 686 func (s *OidcToken) MarshalJSON() ([]byte, error) { 687 type NoMethod OidcToken 688 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 689 } 690 691 // PauseJobRequest: Request message for PauseJob. 692 type PauseJobRequest struct { 693 } 694 695 // PubsubMessage: A message that is published by publishers and consumed by 696 // subscribers. The message must contain either a non-empty data field or at 697 // least one attribute. Note that client libraries represent this object 698 // differently depending on the language. See the corresponding client library 699 // documentation (https://cloud.google.com/pubsub/docs/reference/libraries) for 700 // more information. See [quotas and limits] 701 // (https://cloud.google.com/pubsub/quotas) for more information about message 702 // limits. 703 type PubsubMessage struct { 704 // Attributes: Optional. Attributes for this message. If this field is empty, 705 // the message must contain non-empty data. This can be used to filter messages 706 // on the subscription. 707 Attributes map[string]string `json:"attributes,omitempty"` 708 // Data: Optional. The message data field. If this field is empty, the message 709 // must contain at least one attribute. 710 Data string `json:"data,omitempty"` 711 // MessageId: ID of this message, assigned by the server when the message is 712 // published. Guaranteed to be unique within the topic. This value may be read 713 // by a subscriber that receives a `PubsubMessage` via a `Pull` call or a push 714 // delivery. It must not be populated by the publisher in a `Publish` call. 715 MessageId string `json:"messageId,omitempty"` 716 // OrderingKey: Optional. If non-empty, identifies related messages for which 717 // publish order should be respected. If a `Subscription` has 718 // `enable_message_ordering` set to `true`, messages published with the same 719 // non-empty `ordering_key` value will be delivered to subscribers in the order 720 // in which they are received by the Pub/Sub system. All `PubsubMessage`s 721 // published in a given `PublishRequest` must specify the same `ordering_key` 722 // value. For more information, see ordering messages 723 // (https://cloud.google.com/pubsub/docs/ordering). 724 OrderingKey string `json:"orderingKey,omitempty"` 725 // PublishTime: The time at which the message was published, populated by the 726 // server when it receives the `Publish` call. It must not be populated by the 727 // publisher in a `Publish` call. 728 PublishTime string `json:"publishTime,omitempty"` 729 // ForceSendFields is a list of field names (e.g. "Attributes") to 730 // unconditionally include in API requests. By default, fields with empty or 731 // default values are omitted from API requests. See 732 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 733 // details. 734 ForceSendFields []string `json:"-"` 735 // NullFields is a list of field names (e.g. "Attributes") to include in API 736 // requests with the JSON null value. By default, fields with empty values are 737 // omitted from API requests. See 738 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 739 NullFields []string `json:"-"` 740 } 741 742 func (s *PubsubMessage) MarshalJSON() ([]byte, error) { 743 type NoMethod PubsubMessage 744 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 745 } 746 747 // PubsubTarget: Pub/Sub target. The job will be delivered by publishing a 748 // message to the given Pub/Sub topic. 749 type PubsubTarget struct { 750 // Attributes: Attributes for PubsubMessage. Pubsub message must contain either 751 // non-empty data, or at least one attribute. 752 Attributes map[string]string `json:"attributes,omitempty"` 753 // Data: The message payload for PubsubMessage. Pubsub message must contain 754 // either non-empty data, or at least one attribute. 755 Data string `json:"data,omitempty"` 756 // TopicName: Required. The name of the Cloud Pub/Sub topic to which messages 757 // will be published when a job is delivered. The topic name must be in the 758 // same format as required by Pub/Sub's PublishRequest.name 759 // (https://cloud.google.com/pubsub/docs/reference/rpc/google.pubsub.v1#publishrequest), 760 // for example `projects/PROJECT_ID/topics/TOPIC_ID`. The topic must be in the 761 // same project as the Cloud Scheduler job. 762 TopicName string `json:"topicName,omitempty"` 763 // ForceSendFields is a list of field names (e.g. "Attributes") to 764 // unconditionally include in API requests. By default, fields with empty or 765 // default values are omitted from API requests. See 766 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 767 // details. 768 ForceSendFields []string `json:"-"` 769 // NullFields is a list of field names (e.g. "Attributes") to include in API 770 // requests with the JSON null value. By default, fields with empty values are 771 // omitted from API requests. See 772 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 773 NullFields []string `json:"-"` 774 } 775 776 func (s *PubsubTarget) MarshalJSON() ([]byte, error) { 777 type NoMethod PubsubTarget 778 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 779 } 780 781 // ResumeJobRequest: Request message for ResumeJob. 782 type ResumeJobRequest struct { 783 } 784 785 // RetryConfig: Settings that determine the retry behavior. By default, if a 786 // job does not complete successfully (meaning that an acknowledgement is not 787 // received from the handler, then it will be retried with exponential backoff 788 // according to the settings in RetryConfig. 789 type RetryConfig struct { 790 // MaxBackoffDuration: The maximum amount of time to wait before retrying a job 791 // after it fails. The default value of this field is 1 hour. 792 MaxBackoffDuration string `json:"maxBackoffDuration,omitempty"` 793 // MaxDoublings: The time between retries will double `max_doublings` times. A 794 // job's retry interval starts at min_backoff_duration, then doubles 795 // `max_doublings` times, then increases linearly, and finally retries at 796 // intervals of max_backoff_duration up to retry_count times. For example, if 797 // min_backoff_duration is 10s, max_backoff_duration is 300s, and 798 // `max_doublings` is 3, then the job will first be retried in 10s. The retry 799 // interval will double three times, and then increase linearly by 2^3 * 10s. 800 // Finally, the job will retry at intervals of max_backoff_duration until the 801 // job has been attempted retry_count times. Thus, the requests will retry at 802 // 10s, 20s, 40s, 80s, 160s, 240s, 300s, 300s, .... The default value of this 803 // field is 5. 804 MaxDoublings int64 `json:"maxDoublings,omitempty"` 805 // MaxRetryDuration: The time limit for retrying a failed job, measured from 806 // time when an execution was first attempted. If specified with retry_count, 807 // the job will be retried until both limits are reached. The default value for 808 // max_retry_duration is zero, which means retry duration is unlimited. 809 MaxRetryDuration string `json:"maxRetryDuration,omitempty"` 810 // MinBackoffDuration: The minimum amount of time to wait before retrying a job 811 // after it fails. The default value of this field is 5 seconds. 812 MinBackoffDuration string `json:"minBackoffDuration,omitempty"` 813 // RetryCount: The number of attempts that the system will make to run a job 814 // using the exponential backoff procedure described by max_doublings. The 815 // default value of retry_count is zero. If retry_count is 0, a job attempt 816 // will not be retried if it fails. Instead the Cloud Scheduler system will 817 // wait for the next scheduled execution time. Setting retry_count to 0 does 818 // not prevent failed jobs from running according to schedule after the 819 // failure. If retry_count is set to a non-zero number then Cloud Scheduler 820 // will retry failed attempts, using exponential backoff, retry_count times, or 821 // until the next scheduled execution time, whichever comes first. Values 822 // greater than 5 and negative values are not allowed. 823 RetryCount int64 `json:"retryCount,omitempty"` 824 // ForceSendFields is a list of field names (e.g. "MaxBackoffDuration") to 825 // unconditionally include in API requests. By default, fields with empty or 826 // default values are omitted from API requests. See 827 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 828 // details. 829 ForceSendFields []string `json:"-"` 830 // NullFields is a list of field names (e.g. "MaxBackoffDuration") to include 831 // in API requests with the JSON null value. By default, fields with empty 832 // values are omitted from API requests. See 833 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 834 NullFields []string `json:"-"` 835 } 836 837 func (s *RetryConfig) MarshalJSON() ([]byte, error) { 838 type NoMethod RetryConfig 839 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 840 } 841 842 // RunJobRequest: Request message for forcing a job to run now using RunJob. 843 type RunJobRequest struct { 844 } 845 846 // Status: The `Status` type defines a logical error model that is suitable for 847 // different programming environments, including REST APIs and RPC APIs. It is 848 // used by gRPC (https://github.com/grpc). Each `Status` message contains three 849 // pieces of data: error code, error message, and error details. You can find 850 // out more about this error model and how to work with it in the API Design 851 // Guide (https://cloud.google.com/apis/design/errors). 852 type Status struct { 853 // Code: The status code, which should be an enum value of google.rpc.Code. 854 Code int64 `json:"code,omitempty"` 855 // Details: A list of messages that carry the error details. There is a common 856 // set of message types for APIs to use. 857 Details []googleapi.RawMessage `json:"details,omitempty"` 858 // Message: A developer-facing error message, which should be in English. Any 859 // user-facing error message should be localized and sent in the 860 // google.rpc.Status.details field, or localized by the client. 861 Message string `json:"message,omitempty"` 862 // ForceSendFields is a list of field names (e.g. "Code") to unconditionally 863 // include in API requests. By default, fields with empty or default values are 864 // omitted from API requests. See 865 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 866 // details. 867 ForceSendFields []string `json:"-"` 868 // NullFields is a list of field names (e.g. "Code") to include in API requests 869 // with the JSON null value. By default, fields with empty values are omitted 870 // from API requests. See 871 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 872 NullFields []string `json:"-"` 873 } 874 875 func (s *Status) MarshalJSON() ([]byte, error) { 876 type NoMethod Status 877 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 878 } 879 880 type ProjectsLocationsGetCall struct { 881 s *Service 882 name string 883 urlParams_ gensupport.URLParams 884 ifNoneMatch_ string 885 ctx_ context.Context 886 header_ http.Header 887 } 888 889 // Get: Gets information about a location. 890 // 891 // - name: Resource name for the location. 892 func (r *ProjectsLocationsService) Get(name string) *ProjectsLocationsGetCall { 893 c := &ProjectsLocationsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 894 c.name = name 895 return c 896 } 897 898 // Fields allows partial responses to be retrieved. See 899 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more 900 // details. 901 func (c *ProjectsLocationsGetCall) Fields(s ...googleapi.Field) *ProjectsLocationsGetCall { 902 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 903 return c 904 } 905 906 // IfNoneMatch sets an optional parameter which makes the operation fail if the 907 // object's ETag matches the given value. This is useful for getting updates 908 // only after the object has changed since the last request. 909 func (c *ProjectsLocationsGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsGetCall { 910 c.ifNoneMatch_ = entityTag 911 return c 912 } 913 914 // Context sets the context to be used in this call's Do method. 915 func (c *ProjectsLocationsGetCall) Context(ctx context.Context) *ProjectsLocationsGetCall { 916 c.ctx_ = ctx 917 return c 918 } 919 920 // Header returns a http.Header that can be modified by the caller to add 921 // headers to the request. 922 func (c *ProjectsLocationsGetCall) Header() http.Header { 923 if c.header_ == nil { 924 c.header_ = make(http.Header) 925 } 926 return c.header_ 927 } 928 929 func (c *ProjectsLocationsGetCall) doRequest(alt string) (*http.Response, error) { 930 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_) 931 if c.ifNoneMatch_ != "" { 932 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 933 } 934 var body io.Reader = nil 935 c.urlParams_.Set("alt", alt) 936 c.urlParams_.Set("prettyPrint", "false") 937 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}") 938 urls += "?" + c.urlParams_.Encode() 939 req, err := http.NewRequest("GET", urls, body) 940 if err != nil { 941 return nil, err 942 } 943 req.Header = reqHeaders 944 googleapi.Expand(req.URL, map[string]string{ 945 "name": c.name, 946 }) 947 return gensupport.SendRequest(c.ctx_, c.s.client, req) 948 } 949 950 // Do executes the "cloudscheduler.projects.locations.get" call. 951 // Any non-2xx status code is an error. Response headers are in either 952 // *Location.ServerResponse.Header or (if a response was returned at all) in 953 // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check 954 // whether the returned error was because http.StatusNotModified was returned. 955 func (c *ProjectsLocationsGetCall) Do(opts ...googleapi.CallOption) (*Location, error) { 956 gensupport.SetOptions(c.urlParams_, opts...) 957 res, err := c.doRequest("json") 958 if res != nil && res.StatusCode == http.StatusNotModified { 959 if res.Body != nil { 960 res.Body.Close() 961 } 962 return nil, gensupport.WrapError(&googleapi.Error{ 963 Code: res.StatusCode, 964 Header: res.Header, 965 }) 966 } 967 if err != nil { 968 return nil, err 969 } 970 defer googleapi.CloseBody(res) 971 if err := googleapi.CheckResponse(res); err != nil { 972 return nil, gensupport.WrapError(err) 973 } 974 ret := &Location{ 975 ServerResponse: googleapi.ServerResponse{ 976 Header: res.Header, 977 HTTPStatusCode: res.StatusCode, 978 }, 979 } 980 target := &ret 981 if err := gensupport.DecodeResponse(target, res); err != nil { 982 return nil, err 983 } 984 return ret, nil 985 } 986 987 type ProjectsLocationsListCall struct { 988 s *Service 989 name string 990 urlParams_ gensupport.URLParams 991 ifNoneMatch_ string 992 ctx_ context.Context 993 header_ http.Header 994 } 995 996 // List: Lists information about the supported locations for this service. 997 // 998 // - name: The resource that owns the locations collection, if applicable. 999 func (r *ProjectsLocationsService) List(name string) *ProjectsLocationsListCall { 1000 c := &ProjectsLocationsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1001 c.name = name 1002 return c 1003 } 1004 1005 // Filter sets the optional parameter "filter": A filter to narrow down results 1006 // to a preferred subset. The filtering language accepts strings like 1007 // "displayName=tokyo", and is documented in more detail in AIP-160 1008 // (https://google.aip.dev/160). 1009 func (c *ProjectsLocationsListCall) Filter(filter string) *ProjectsLocationsListCall { 1010 c.urlParams_.Set("filter", filter) 1011 return c 1012 } 1013 1014 // PageSize sets the optional parameter "pageSize": The maximum number of 1015 // results to return. If not set, the service selects a default. 1016 func (c *ProjectsLocationsListCall) PageSize(pageSize int64) *ProjectsLocationsListCall { 1017 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 1018 return c 1019 } 1020 1021 // PageToken sets the optional parameter "pageToken": A page token received 1022 // from the `next_page_token` field in the response. Send that page token to 1023 // receive the subsequent page. 1024 func (c *ProjectsLocationsListCall) PageToken(pageToken string) *ProjectsLocationsListCall { 1025 c.urlParams_.Set("pageToken", pageToken) 1026 return c 1027 } 1028 1029 // Fields allows partial responses to be retrieved. See 1030 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more 1031 // details. 1032 func (c *ProjectsLocationsListCall) Fields(s ...googleapi.Field) *ProjectsLocationsListCall { 1033 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1034 return c 1035 } 1036 1037 // IfNoneMatch sets an optional parameter which makes the operation fail if the 1038 // object's ETag matches the given value. This is useful for getting updates 1039 // only after the object has changed since the last request. 1040 func (c *ProjectsLocationsListCall) IfNoneMatch(entityTag string) *ProjectsLocationsListCall { 1041 c.ifNoneMatch_ = entityTag 1042 return c 1043 } 1044 1045 // Context sets the context to be used in this call's Do method. 1046 func (c *ProjectsLocationsListCall) Context(ctx context.Context) *ProjectsLocationsListCall { 1047 c.ctx_ = ctx 1048 return c 1049 } 1050 1051 // Header returns a http.Header that can be modified by the caller to add 1052 // headers to the request. 1053 func (c *ProjectsLocationsListCall) Header() http.Header { 1054 if c.header_ == nil { 1055 c.header_ = make(http.Header) 1056 } 1057 return c.header_ 1058 } 1059 1060 func (c *ProjectsLocationsListCall) doRequest(alt string) (*http.Response, error) { 1061 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_) 1062 if c.ifNoneMatch_ != "" { 1063 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 1064 } 1065 var body io.Reader = nil 1066 c.urlParams_.Set("alt", alt) 1067 c.urlParams_.Set("prettyPrint", "false") 1068 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}/locations") 1069 urls += "?" + c.urlParams_.Encode() 1070 req, err := http.NewRequest("GET", urls, body) 1071 if err != nil { 1072 return nil, err 1073 } 1074 req.Header = reqHeaders 1075 googleapi.Expand(req.URL, map[string]string{ 1076 "name": c.name, 1077 }) 1078 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1079 } 1080 1081 // Do executes the "cloudscheduler.projects.locations.list" call. 1082 // Any non-2xx status code is an error. Response headers are in either 1083 // *ListLocationsResponse.ServerResponse.Header or (if a response was returned 1084 // at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 1085 // check whether the returned error was because http.StatusNotModified was 1086 // returned. 1087 func (c *ProjectsLocationsListCall) Do(opts ...googleapi.CallOption) (*ListLocationsResponse, error) { 1088 gensupport.SetOptions(c.urlParams_, opts...) 1089 res, err := c.doRequest("json") 1090 if res != nil && res.StatusCode == http.StatusNotModified { 1091 if res.Body != nil { 1092 res.Body.Close() 1093 } 1094 return nil, gensupport.WrapError(&googleapi.Error{ 1095 Code: res.StatusCode, 1096 Header: res.Header, 1097 }) 1098 } 1099 if err != nil { 1100 return nil, err 1101 } 1102 defer googleapi.CloseBody(res) 1103 if err := googleapi.CheckResponse(res); err != nil { 1104 return nil, gensupport.WrapError(err) 1105 } 1106 ret := &ListLocationsResponse{ 1107 ServerResponse: googleapi.ServerResponse{ 1108 Header: res.Header, 1109 HTTPStatusCode: res.StatusCode, 1110 }, 1111 } 1112 target := &ret 1113 if err := gensupport.DecodeResponse(target, res); err != nil { 1114 return nil, err 1115 } 1116 return ret, nil 1117 } 1118 1119 // Pages invokes f for each page of results. 1120 // A non-nil error returned from f will halt the iteration. 1121 // The provided context supersedes any context provided to the Context method. 1122 func (c *ProjectsLocationsListCall) Pages(ctx context.Context, f func(*ListLocationsResponse) error) error { 1123 c.ctx_ = ctx 1124 defer c.PageToken(c.urlParams_.Get("pageToken")) 1125 for { 1126 x, err := c.Do() 1127 if err != nil { 1128 return err 1129 } 1130 if err := f(x); err != nil { 1131 return err 1132 } 1133 if x.NextPageToken == "" { 1134 return nil 1135 } 1136 c.PageToken(x.NextPageToken) 1137 } 1138 } 1139 1140 type ProjectsLocationsJobsCreateCall struct { 1141 s *Service 1142 parent string 1143 job *Job 1144 urlParams_ gensupport.URLParams 1145 ctx_ context.Context 1146 header_ http.Header 1147 } 1148 1149 // Create: Creates a job. 1150 // 1151 // - parent: The location name. For example: 1152 // `projects/PROJECT_ID/locations/LOCATION_ID`. 1153 func (r *ProjectsLocationsJobsService) Create(parent string, job *Job) *ProjectsLocationsJobsCreateCall { 1154 c := &ProjectsLocationsJobsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1155 c.parent = parent 1156 c.job = job 1157 return c 1158 } 1159 1160 // Fields allows partial responses to be retrieved. See 1161 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more 1162 // details. 1163 func (c *ProjectsLocationsJobsCreateCall) Fields(s ...googleapi.Field) *ProjectsLocationsJobsCreateCall { 1164 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1165 return c 1166 } 1167 1168 // Context sets the context to be used in this call's Do method. 1169 func (c *ProjectsLocationsJobsCreateCall) Context(ctx context.Context) *ProjectsLocationsJobsCreateCall { 1170 c.ctx_ = ctx 1171 return c 1172 } 1173 1174 // Header returns a http.Header that can be modified by the caller to add 1175 // headers to the request. 1176 func (c *ProjectsLocationsJobsCreateCall) Header() http.Header { 1177 if c.header_ == nil { 1178 c.header_ = make(http.Header) 1179 } 1180 return c.header_ 1181 } 1182 1183 func (c *ProjectsLocationsJobsCreateCall) doRequest(alt string) (*http.Response, error) { 1184 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_) 1185 var body io.Reader = nil 1186 body, err := googleapi.WithoutDataWrapper.JSONReader(c.job) 1187 if err != nil { 1188 return nil, err 1189 } 1190 c.urlParams_.Set("alt", alt) 1191 c.urlParams_.Set("prettyPrint", "false") 1192 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/jobs") 1193 urls += "?" + c.urlParams_.Encode() 1194 req, err := http.NewRequest("POST", urls, body) 1195 if err != nil { 1196 return nil, err 1197 } 1198 req.Header = reqHeaders 1199 googleapi.Expand(req.URL, map[string]string{ 1200 "parent": c.parent, 1201 }) 1202 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1203 } 1204 1205 // Do executes the "cloudscheduler.projects.locations.jobs.create" call. 1206 // Any non-2xx status code is an error. Response headers are in either 1207 // *Job.ServerResponse.Header or (if a response was returned at all) in 1208 // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check 1209 // whether the returned error was because http.StatusNotModified was returned. 1210 func (c *ProjectsLocationsJobsCreateCall) Do(opts ...googleapi.CallOption) (*Job, error) { 1211 gensupport.SetOptions(c.urlParams_, opts...) 1212 res, err := c.doRequest("json") 1213 if res != nil && res.StatusCode == http.StatusNotModified { 1214 if res.Body != nil { 1215 res.Body.Close() 1216 } 1217 return nil, gensupport.WrapError(&googleapi.Error{ 1218 Code: res.StatusCode, 1219 Header: res.Header, 1220 }) 1221 } 1222 if err != nil { 1223 return nil, err 1224 } 1225 defer googleapi.CloseBody(res) 1226 if err := googleapi.CheckResponse(res); err != nil { 1227 return nil, gensupport.WrapError(err) 1228 } 1229 ret := &Job{ 1230 ServerResponse: googleapi.ServerResponse{ 1231 Header: res.Header, 1232 HTTPStatusCode: res.StatusCode, 1233 }, 1234 } 1235 target := &ret 1236 if err := gensupport.DecodeResponse(target, res); err != nil { 1237 return nil, err 1238 } 1239 return ret, nil 1240 } 1241 1242 type ProjectsLocationsJobsDeleteCall struct { 1243 s *Service 1244 name string 1245 urlParams_ gensupport.URLParams 1246 ctx_ context.Context 1247 header_ http.Header 1248 } 1249 1250 // Delete: Deletes a job. 1251 // 1252 // - name: The job name. For example: 1253 // `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`. 1254 func (r *ProjectsLocationsJobsService) Delete(name string) *ProjectsLocationsJobsDeleteCall { 1255 c := &ProjectsLocationsJobsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1256 c.name = name 1257 return c 1258 } 1259 1260 // Fields allows partial responses to be retrieved. See 1261 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more 1262 // details. 1263 func (c *ProjectsLocationsJobsDeleteCall) Fields(s ...googleapi.Field) *ProjectsLocationsJobsDeleteCall { 1264 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1265 return c 1266 } 1267 1268 // Context sets the context to be used in this call's Do method. 1269 func (c *ProjectsLocationsJobsDeleteCall) Context(ctx context.Context) *ProjectsLocationsJobsDeleteCall { 1270 c.ctx_ = ctx 1271 return c 1272 } 1273 1274 // Header returns a http.Header that can be modified by the caller to add 1275 // headers to the request. 1276 func (c *ProjectsLocationsJobsDeleteCall) Header() http.Header { 1277 if c.header_ == nil { 1278 c.header_ = make(http.Header) 1279 } 1280 return c.header_ 1281 } 1282 1283 func (c *ProjectsLocationsJobsDeleteCall) doRequest(alt string) (*http.Response, error) { 1284 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_) 1285 var body io.Reader = nil 1286 c.urlParams_.Set("alt", alt) 1287 c.urlParams_.Set("prettyPrint", "false") 1288 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}") 1289 urls += "?" + c.urlParams_.Encode() 1290 req, err := http.NewRequest("DELETE", urls, body) 1291 if err != nil { 1292 return nil, err 1293 } 1294 req.Header = reqHeaders 1295 googleapi.Expand(req.URL, map[string]string{ 1296 "name": c.name, 1297 }) 1298 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1299 } 1300 1301 // Do executes the "cloudscheduler.projects.locations.jobs.delete" call. 1302 // Any non-2xx status code is an error. Response headers are in either 1303 // *Empty.ServerResponse.Header or (if a response was returned at all) in 1304 // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check 1305 // whether the returned error was because http.StatusNotModified was returned. 1306 func (c *ProjectsLocationsJobsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 1307 gensupport.SetOptions(c.urlParams_, opts...) 1308 res, err := c.doRequest("json") 1309 if res != nil && res.StatusCode == http.StatusNotModified { 1310 if res.Body != nil { 1311 res.Body.Close() 1312 } 1313 return nil, gensupport.WrapError(&googleapi.Error{ 1314 Code: res.StatusCode, 1315 Header: res.Header, 1316 }) 1317 } 1318 if err != nil { 1319 return nil, err 1320 } 1321 defer googleapi.CloseBody(res) 1322 if err := googleapi.CheckResponse(res); err != nil { 1323 return nil, gensupport.WrapError(err) 1324 } 1325 ret := &Empty{ 1326 ServerResponse: googleapi.ServerResponse{ 1327 Header: res.Header, 1328 HTTPStatusCode: res.StatusCode, 1329 }, 1330 } 1331 target := &ret 1332 if err := gensupport.DecodeResponse(target, res); err != nil { 1333 return nil, err 1334 } 1335 return ret, nil 1336 } 1337 1338 type ProjectsLocationsJobsGetCall struct { 1339 s *Service 1340 name string 1341 urlParams_ gensupport.URLParams 1342 ifNoneMatch_ string 1343 ctx_ context.Context 1344 header_ http.Header 1345 } 1346 1347 // Get: Gets a job. 1348 // 1349 // - name: The job name. For example: 1350 // `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`. 1351 func (r *ProjectsLocationsJobsService) Get(name string) *ProjectsLocationsJobsGetCall { 1352 c := &ProjectsLocationsJobsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1353 c.name = name 1354 return c 1355 } 1356 1357 // Fields allows partial responses to be retrieved. See 1358 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more 1359 // details. 1360 func (c *ProjectsLocationsJobsGetCall) Fields(s ...googleapi.Field) *ProjectsLocationsJobsGetCall { 1361 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1362 return c 1363 } 1364 1365 // IfNoneMatch sets an optional parameter which makes the operation fail if the 1366 // object's ETag matches the given value. This is useful for getting updates 1367 // only after the object has changed since the last request. 1368 func (c *ProjectsLocationsJobsGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsJobsGetCall { 1369 c.ifNoneMatch_ = entityTag 1370 return c 1371 } 1372 1373 // Context sets the context to be used in this call's Do method. 1374 func (c *ProjectsLocationsJobsGetCall) Context(ctx context.Context) *ProjectsLocationsJobsGetCall { 1375 c.ctx_ = ctx 1376 return c 1377 } 1378 1379 // Header returns a http.Header that can be modified by the caller to add 1380 // headers to the request. 1381 func (c *ProjectsLocationsJobsGetCall) Header() http.Header { 1382 if c.header_ == nil { 1383 c.header_ = make(http.Header) 1384 } 1385 return c.header_ 1386 } 1387 1388 func (c *ProjectsLocationsJobsGetCall) doRequest(alt string) (*http.Response, error) { 1389 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_) 1390 if c.ifNoneMatch_ != "" { 1391 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 1392 } 1393 var body io.Reader = nil 1394 c.urlParams_.Set("alt", alt) 1395 c.urlParams_.Set("prettyPrint", "false") 1396 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}") 1397 urls += "?" + c.urlParams_.Encode() 1398 req, err := http.NewRequest("GET", urls, body) 1399 if err != nil { 1400 return nil, err 1401 } 1402 req.Header = reqHeaders 1403 googleapi.Expand(req.URL, map[string]string{ 1404 "name": c.name, 1405 }) 1406 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1407 } 1408 1409 // Do executes the "cloudscheduler.projects.locations.jobs.get" call. 1410 // Any non-2xx status code is an error. Response headers are in either 1411 // *Job.ServerResponse.Header or (if a response was returned at all) in 1412 // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check 1413 // whether the returned error was because http.StatusNotModified was returned. 1414 func (c *ProjectsLocationsJobsGetCall) Do(opts ...googleapi.CallOption) (*Job, error) { 1415 gensupport.SetOptions(c.urlParams_, opts...) 1416 res, err := c.doRequest("json") 1417 if res != nil && res.StatusCode == http.StatusNotModified { 1418 if res.Body != nil { 1419 res.Body.Close() 1420 } 1421 return nil, gensupport.WrapError(&googleapi.Error{ 1422 Code: res.StatusCode, 1423 Header: res.Header, 1424 }) 1425 } 1426 if err != nil { 1427 return nil, err 1428 } 1429 defer googleapi.CloseBody(res) 1430 if err := googleapi.CheckResponse(res); err != nil { 1431 return nil, gensupport.WrapError(err) 1432 } 1433 ret := &Job{ 1434 ServerResponse: googleapi.ServerResponse{ 1435 Header: res.Header, 1436 HTTPStatusCode: res.StatusCode, 1437 }, 1438 } 1439 target := &ret 1440 if err := gensupport.DecodeResponse(target, res); err != nil { 1441 return nil, err 1442 } 1443 return ret, nil 1444 } 1445 1446 type ProjectsLocationsJobsListCall struct { 1447 s *Service 1448 parent string 1449 urlParams_ gensupport.URLParams 1450 ifNoneMatch_ string 1451 ctx_ context.Context 1452 header_ http.Header 1453 } 1454 1455 // List: Lists jobs. 1456 // 1457 // - parent: The location name. For example: 1458 // `projects/PROJECT_ID/locations/LOCATION_ID`. 1459 func (r *ProjectsLocationsJobsService) List(parent string) *ProjectsLocationsJobsListCall { 1460 c := &ProjectsLocationsJobsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1461 c.parent = parent 1462 return c 1463 } 1464 1465 // PageSize sets the optional parameter "pageSize": Requested page size. The 1466 // maximum page size is 500. If unspecified, the page size will be the maximum. 1467 // Fewer jobs than requested might be returned, even if more jobs exist; use 1468 // next_page_token to determine if more jobs exist. 1469 func (c *ProjectsLocationsJobsListCall) PageSize(pageSize int64) *ProjectsLocationsJobsListCall { 1470 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 1471 return c 1472 } 1473 1474 // PageToken sets the optional parameter "pageToken": A token identifying a 1475 // page of results the server will return. To request the first page results, 1476 // page_token must be empty. To request the next page of results, page_token 1477 // must be the value of next_page_token returned from the previous call to 1478 // ListJobs. It is an error to switch the value of filter or order_by while 1479 // iterating through pages. 1480 func (c *ProjectsLocationsJobsListCall) PageToken(pageToken string) *ProjectsLocationsJobsListCall { 1481 c.urlParams_.Set("pageToken", pageToken) 1482 return c 1483 } 1484 1485 // Fields allows partial responses to be retrieved. See 1486 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more 1487 // details. 1488 func (c *ProjectsLocationsJobsListCall) Fields(s ...googleapi.Field) *ProjectsLocationsJobsListCall { 1489 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1490 return c 1491 } 1492 1493 // IfNoneMatch sets an optional parameter which makes the operation fail if the 1494 // object's ETag matches the given value. This is useful for getting updates 1495 // only after the object has changed since the last request. 1496 func (c *ProjectsLocationsJobsListCall) IfNoneMatch(entityTag string) *ProjectsLocationsJobsListCall { 1497 c.ifNoneMatch_ = entityTag 1498 return c 1499 } 1500 1501 // Context sets the context to be used in this call's Do method. 1502 func (c *ProjectsLocationsJobsListCall) Context(ctx context.Context) *ProjectsLocationsJobsListCall { 1503 c.ctx_ = ctx 1504 return c 1505 } 1506 1507 // Header returns a http.Header that can be modified by the caller to add 1508 // headers to the request. 1509 func (c *ProjectsLocationsJobsListCall) Header() http.Header { 1510 if c.header_ == nil { 1511 c.header_ = make(http.Header) 1512 } 1513 return c.header_ 1514 } 1515 1516 func (c *ProjectsLocationsJobsListCall) doRequest(alt string) (*http.Response, error) { 1517 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_) 1518 if c.ifNoneMatch_ != "" { 1519 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 1520 } 1521 var body io.Reader = nil 1522 c.urlParams_.Set("alt", alt) 1523 c.urlParams_.Set("prettyPrint", "false") 1524 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/jobs") 1525 urls += "?" + c.urlParams_.Encode() 1526 req, err := http.NewRequest("GET", urls, body) 1527 if err != nil { 1528 return nil, err 1529 } 1530 req.Header = reqHeaders 1531 googleapi.Expand(req.URL, map[string]string{ 1532 "parent": c.parent, 1533 }) 1534 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1535 } 1536 1537 // Do executes the "cloudscheduler.projects.locations.jobs.list" call. 1538 // Any non-2xx status code is an error. Response headers are in either 1539 // *ListJobsResponse.ServerResponse.Header or (if a response was returned at 1540 // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 1541 // check whether the returned error was because http.StatusNotModified was 1542 // returned. 1543 func (c *ProjectsLocationsJobsListCall) Do(opts ...googleapi.CallOption) (*ListJobsResponse, error) { 1544 gensupport.SetOptions(c.urlParams_, opts...) 1545 res, err := c.doRequest("json") 1546 if res != nil && res.StatusCode == http.StatusNotModified { 1547 if res.Body != nil { 1548 res.Body.Close() 1549 } 1550 return nil, gensupport.WrapError(&googleapi.Error{ 1551 Code: res.StatusCode, 1552 Header: res.Header, 1553 }) 1554 } 1555 if err != nil { 1556 return nil, err 1557 } 1558 defer googleapi.CloseBody(res) 1559 if err := googleapi.CheckResponse(res); err != nil { 1560 return nil, gensupport.WrapError(err) 1561 } 1562 ret := &ListJobsResponse{ 1563 ServerResponse: googleapi.ServerResponse{ 1564 Header: res.Header, 1565 HTTPStatusCode: res.StatusCode, 1566 }, 1567 } 1568 target := &ret 1569 if err := gensupport.DecodeResponse(target, res); err != nil { 1570 return nil, err 1571 } 1572 return ret, nil 1573 } 1574 1575 // Pages invokes f for each page of results. 1576 // A non-nil error returned from f will halt the iteration. 1577 // The provided context supersedes any context provided to the Context method. 1578 func (c *ProjectsLocationsJobsListCall) Pages(ctx context.Context, f func(*ListJobsResponse) error) error { 1579 c.ctx_ = ctx 1580 defer c.PageToken(c.urlParams_.Get("pageToken")) 1581 for { 1582 x, err := c.Do() 1583 if err != nil { 1584 return err 1585 } 1586 if err := f(x); err != nil { 1587 return err 1588 } 1589 if x.NextPageToken == "" { 1590 return nil 1591 } 1592 c.PageToken(x.NextPageToken) 1593 } 1594 } 1595 1596 type ProjectsLocationsJobsPatchCall struct { 1597 s *Service 1598 name string 1599 job *Job 1600 urlParams_ gensupport.URLParams 1601 ctx_ context.Context 1602 header_ http.Header 1603 } 1604 1605 // Patch: Updates a job. If successful, the updated Job is returned. If the job 1606 // does not exist, `NOT_FOUND` is returned. If UpdateJob does not successfully 1607 // return, it is possible for the job to be in an Job.State.UPDATE_FAILED 1608 // state. A job in this state may not be executed. If this happens, retry the 1609 // UpdateJob request until a successful response is received. 1610 // 1611 // - name: Optionally caller-specified in CreateJob, after which it becomes 1612 // output only. The job name. For example: 1613 // `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`. * `PROJECT_ID` 1614 // can contain letters ([A-Za-z]), numbers ([0-9]), hyphens (-), colons (:), 1615 // or periods (.). For more information, see Identifying projects 1616 // (https://cloud.google.com/resource-manager/docs/creating-managing-projects#identifying_projects) 1617 // - `LOCATION_ID` is the canonical ID for the job's location. The list of 1618 // available locations can be obtained by calling ListLocations. For more 1619 // information, see https://cloud.google.com/about/locations/. * `JOB_ID` can 1620 // contain only letters ([A-Za-z]), numbers ([0-9]), hyphens (-), or 1621 // underscores (_). The maximum length is 500 characters. 1622 func (r *ProjectsLocationsJobsService) Patch(name string, job *Job) *ProjectsLocationsJobsPatchCall { 1623 c := &ProjectsLocationsJobsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1624 c.name = name 1625 c.job = job 1626 return c 1627 } 1628 1629 // UpdateMask sets the optional parameter "updateMask": A mask used to specify 1630 // which fields of the job are being updated. 1631 func (c *ProjectsLocationsJobsPatchCall) UpdateMask(updateMask string) *ProjectsLocationsJobsPatchCall { 1632 c.urlParams_.Set("updateMask", updateMask) 1633 return c 1634 } 1635 1636 // Fields allows partial responses to be retrieved. See 1637 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more 1638 // details. 1639 func (c *ProjectsLocationsJobsPatchCall) Fields(s ...googleapi.Field) *ProjectsLocationsJobsPatchCall { 1640 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1641 return c 1642 } 1643 1644 // Context sets the context to be used in this call's Do method. 1645 func (c *ProjectsLocationsJobsPatchCall) Context(ctx context.Context) *ProjectsLocationsJobsPatchCall { 1646 c.ctx_ = ctx 1647 return c 1648 } 1649 1650 // Header returns a http.Header that can be modified by the caller to add 1651 // headers to the request. 1652 func (c *ProjectsLocationsJobsPatchCall) Header() http.Header { 1653 if c.header_ == nil { 1654 c.header_ = make(http.Header) 1655 } 1656 return c.header_ 1657 } 1658 1659 func (c *ProjectsLocationsJobsPatchCall) doRequest(alt string) (*http.Response, error) { 1660 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_) 1661 var body io.Reader = nil 1662 body, err := googleapi.WithoutDataWrapper.JSONReader(c.job) 1663 if err != nil { 1664 return nil, err 1665 } 1666 c.urlParams_.Set("alt", alt) 1667 c.urlParams_.Set("prettyPrint", "false") 1668 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}") 1669 urls += "?" + c.urlParams_.Encode() 1670 req, err := http.NewRequest("PATCH", urls, body) 1671 if err != nil { 1672 return nil, err 1673 } 1674 req.Header = reqHeaders 1675 googleapi.Expand(req.URL, map[string]string{ 1676 "name": c.name, 1677 }) 1678 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1679 } 1680 1681 // Do executes the "cloudscheduler.projects.locations.jobs.patch" call. 1682 // Any non-2xx status code is an error. Response headers are in either 1683 // *Job.ServerResponse.Header or (if a response was returned at all) in 1684 // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check 1685 // whether the returned error was because http.StatusNotModified was returned. 1686 func (c *ProjectsLocationsJobsPatchCall) Do(opts ...googleapi.CallOption) (*Job, error) { 1687 gensupport.SetOptions(c.urlParams_, opts...) 1688 res, err := c.doRequest("json") 1689 if res != nil && res.StatusCode == http.StatusNotModified { 1690 if res.Body != nil { 1691 res.Body.Close() 1692 } 1693 return nil, gensupport.WrapError(&googleapi.Error{ 1694 Code: res.StatusCode, 1695 Header: res.Header, 1696 }) 1697 } 1698 if err != nil { 1699 return nil, err 1700 } 1701 defer googleapi.CloseBody(res) 1702 if err := googleapi.CheckResponse(res); err != nil { 1703 return nil, gensupport.WrapError(err) 1704 } 1705 ret := &Job{ 1706 ServerResponse: googleapi.ServerResponse{ 1707 Header: res.Header, 1708 HTTPStatusCode: res.StatusCode, 1709 }, 1710 } 1711 target := &ret 1712 if err := gensupport.DecodeResponse(target, res); err != nil { 1713 return nil, err 1714 } 1715 return ret, nil 1716 } 1717 1718 type ProjectsLocationsJobsPauseCall struct { 1719 s *Service 1720 name string 1721 pausejobrequest *PauseJobRequest 1722 urlParams_ gensupport.URLParams 1723 ctx_ context.Context 1724 header_ http.Header 1725 } 1726 1727 // Pause: Pauses a job. If a job is paused then the system will stop executing 1728 // the job until it is re-enabled via ResumeJob. The state of the job is stored 1729 // in state; if paused it will be set to Job.State.PAUSED. A job must be in 1730 // Job.State.ENABLED to be paused. 1731 // 1732 // - name: The job name. For example: 1733 // `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`. 1734 func (r *ProjectsLocationsJobsService) Pause(name string, pausejobrequest *PauseJobRequest) *ProjectsLocationsJobsPauseCall { 1735 c := &ProjectsLocationsJobsPauseCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1736 c.name = name 1737 c.pausejobrequest = pausejobrequest 1738 return c 1739 } 1740 1741 // Fields allows partial responses to be retrieved. See 1742 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more 1743 // details. 1744 func (c *ProjectsLocationsJobsPauseCall) Fields(s ...googleapi.Field) *ProjectsLocationsJobsPauseCall { 1745 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1746 return c 1747 } 1748 1749 // Context sets the context to be used in this call's Do method. 1750 func (c *ProjectsLocationsJobsPauseCall) Context(ctx context.Context) *ProjectsLocationsJobsPauseCall { 1751 c.ctx_ = ctx 1752 return c 1753 } 1754 1755 // Header returns a http.Header that can be modified by the caller to add 1756 // headers to the request. 1757 func (c *ProjectsLocationsJobsPauseCall) Header() http.Header { 1758 if c.header_ == nil { 1759 c.header_ = make(http.Header) 1760 } 1761 return c.header_ 1762 } 1763 1764 func (c *ProjectsLocationsJobsPauseCall) doRequest(alt string) (*http.Response, error) { 1765 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_) 1766 var body io.Reader = nil 1767 body, err := googleapi.WithoutDataWrapper.JSONReader(c.pausejobrequest) 1768 if err != nil { 1769 return nil, err 1770 } 1771 c.urlParams_.Set("alt", alt) 1772 c.urlParams_.Set("prettyPrint", "false") 1773 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:pause") 1774 urls += "?" + c.urlParams_.Encode() 1775 req, err := http.NewRequest("POST", urls, body) 1776 if err != nil { 1777 return nil, err 1778 } 1779 req.Header = reqHeaders 1780 googleapi.Expand(req.URL, map[string]string{ 1781 "name": c.name, 1782 }) 1783 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1784 } 1785 1786 // Do executes the "cloudscheduler.projects.locations.jobs.pause" call. 1787 // Any non-2xx status code is an error. Response headers are in either 1788 // *Job.ServerResponse.Header or (if a response was returned at all) in 1789 // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check 1790 // whether the returned error was because http.StatusNotModified was returned. 1791 func (c *ProjectsLocationsJobsPauseCall) Do(opts ...googleapi.CallOption) (*Job, error) { 1792 gensupport.SetOptions(c.urlParams_, opts...) 1793 res, err := c.doRequest("json") 1794 if res != nil && res.StatusCode == http.StatusNotModified { 1795 if res.Body != nil { 1796 res.Body.Close() 1797 } 1798 return nil, gensupport.WrapError(&googleapi.Error{ 1799 Code: res.StatusCode, 1800 Header: res.Header, 1801 }) 1802 } 1803 if err != nil { 1804 return nil, err 1805 } 1806 defer googleapi.CloseBody(res) 1807 if err := googleapi.CheckResponse(res); err != nil { 1808 return nil, gensupport.WrapError(err) 1809 } 1810 ret := &Job{ 1811 ServerResponse: googleapi.ServerResponse{ 1812 Header: res.Header, 1813 HTTPStatusCode: res.StatusCode, 1814 }, 1815 } 1816 target := &ret 1817 if err := gensupport.DecodeResponse(target, res); err != nil { 1818 return nil, err 1819 } 1820 return ret, nil 1821 } 1822 1823 type ProjectsLocationsJobsResumeCall struct { 1824 s *Service 1825 name string 1826 resumejobrequest *ResumeJobRequest 1827 urlParams_ gensupport.URLParams 1828 ctx_ context.Context 1829 header_ http.Header 1830 } 1831 1832 // Resume: Resume a job. This method reenables a job after it has been 1833 // Job.State.PAUSED. The state of a job is stored in Job.state; after calling 1834 // this method it will be set to Job.State.ENABLED. A job must be in 1835 // Job.State.PAUSED to be resumed. 1836 // 1837 // - name: The job name. For example: 1838 // `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`. 1839 func (r *ProjectsLocationsJobsService) Resume(name string, resumejobrequest *ResumeJobRequest) *ProjectsLocationsJobsResumeCall { 1840 c := &ProjectsLocationsJobsResumeCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1841 c.name = name 1842 c.resumejobrequest = resumejobrequest 1843 return c 1844 } 1845 1846 // Fields allows partial responses to be retrieved. See 1847 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more 1848 // details. 1849 func (c *ProjectsLocationsJobsResumeCall) Fields(s ...googleapi.Field) *ProjectsLocationsJobsResumeCall { 1850 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1851 return c 1852 } 1853 1854 // Context sets the context to be used in this call's Do method. 1855 func (c *ProjectsLocationsJobsResumeCall) Context(ctx context.Context) *ProjectsLocationsJobsResumeCall { 1856 c.ctx_ = ctx 1857 return c 1858 } 1859 1860 // Header returns a http.Header that can be modified by the caller to add 1861 // headers to the request. 1862 func (c *ProjectsLocationsJobsResumeCall) Header() http.Header { 1863 if c.header_ == nil { 1864 c.header_ = make(http.Header) 1865 } 1866 return c.header_ 1867 } 1868 1869 func (c *ProjectsLocationsJobsResumeCall) doRequest(alt string) (*http.Response, error) { 1870 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_) 1871 var body io.Reader = nil 1872 body, err := googleapi.WithoutDataWrapper.JSONReader(c.resumejobrequest) 1873 if err != nil { 1874 return nil, err 1875 } 1876 c.urlParams_.Set("alt", alt) 1877 c.urlParams_.Set("prettyPrint", "false") 1878 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:resume") 1879 urls += "?" + c.urlParams_.Encode() 1880 req, err := http.NewRequest("POST", urls, body) 1881 if err != nil { 1882 return nil, err 1883 } 1884 req.Header = reqHeaders 1885 googleapi.Expand(req.URL, map[string]string{ 1886 "name": c.name, 1887 }) 1888 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1889 } 1890 1891 // Do executes the "cloudscheduler.projects.locations.jobs.resume" call. 1892 // Any non-2xx status code is an error. Response headers are in either 1893 // *Job.ServerResponse.Header or (if a response was returned at all) in 1894 // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check 1895 // whether the returned error was because http.StatusNotModified was returned. 1896 func (c *ProjectsLocationsJobsResumeCall) Do(opts ...googleapi.CallOption) (*Job, error) { 1897 gensupport.SetOptions(c.urlParams_, opts...) 1898 res, err := c.doRequest("json") 1899 if res != nil && res.StatusCode == http.StatusNotModified { 1900 if res.Body != nil { 1901 res.Body.Close() 1902 } 1903 return nil, gensupport.WrapError(&googleapi.Error{ 1904 Code: res.StatusCode, 1905 Header: res.Header, 1906 }) 1907 } 1908 if err != nil { 1909 return nil, err 1910 } 1911 defer googleapi.CloseBody(res) 1912 if err := googleapi.CheckResponse(res); err != nil { 1913 return nil, gensupport.WrapError(err) 1914 } 1915 ret := &Job{ 1916 ServerResponse: googleapi.ServerResponse{ 1917 Header: res.Header, 1918 HTTPStatusCode: res.StatusCode, 1919 }, 1920 } 1921 target := &ret 1922 if err := gensupport.DecodeResponse(target, res); err != nil { 1923 return nil, err 1924 } 1925 return ret, nil 1926 } 1927 1928 type ProjectsLocationsJobsRunCall struct { 1929 s *Service 1930 name string 1931 runjobrequest *RunJobRequest 1932 urlParams_ gensupport.URLParams 1933 ctx_ context.Context 1934 header_ http.Header 1935 } 1936 1937 // Run: Forces a job to run now. When this method is called, Cloud Scheduler 1938 // will dispatch the job, even if the job is already running. 1939 // 1940 // - name: The job name. For example: 1941 // `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`. 1942 func (r *ProjectsLocationsJobsService) Run(name string, runjobrequest *RunJobRequest) *ProjectsLocationsJobsRunCall { 1943 c := &ProjectsLocationsJobsRunCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1944 c.name = name 1945 c.runjobrequest = runjobrequest 1946 return c 1947 } 1948 1949 // Fields allows partial responses to be retrieved. See 1950 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more 1951 // details. 1952 func (c *ProjectsLocationsJobsRunCall) Fields(s ...googleapi.Field) *ProjectsLocationsJobsRunCall { 1953 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1954 return c 1955 } 1956 1957 // Context sets the context to be used in this call's Do method. 1958 func (c *ProjectsLocationsJobsRunCall) Context(ctx context.Context) *ProjectsLocationsJobsRunCall { 1959 c.ctx_ = ctx 1960 return c 1961 } 1962 1963 // Header returns a http.Header that can be modified by the caller to add 1964 // headers to the request. 1965 func (c *ProjectsLocationsJobsRunCall) Header() http.Header { 1966 if c.header_ == nil { 1967 c.header_ = make(http.Header) 1968 } 1969 return c.header_ 1970 } 1971 1972 func (c *ProjectsLocationsJobsRunCall) doRequest(alt string) (*http.Response, error) { 1973 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_) 1974 var body io.Reader = nil 1975 body, err := googleapi.WithoutDataWrapper.JSONReader(c.runjobrequest) 1976 if err != nil { 1977 return nil, err 1978 } 1979 c.urlParams_.Set("alt", alt) 1980 c.urlParams_.Set("prettyPrint", "false") 1981 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:run") 1982 urls += "?" + c.urlParams_.Encode() 1983 req, err := http.NewRequest("POST", urls, body) 1984 if err != nil { 1985 return nil, err 1986 } 1987 req.Header = reqHeaders 1988 googleapi.Expand(req.URL, map[string]string{ 1989 "name": c.name, 1990 }) 1991 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1992 } 1993 1994 // Do executes the "cloudscheduler.projects.locations.jobs.run" call. 1995 // Any non-2xx status code is an error. Response headers are in either 1996 // *Job.ServerResponse.Header or (if a response was returned at all) in 1997 // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check 1998 // whether the returned error was because http.StatusNotModified was returned. 1999 func (c *ProjectsLocationsJobsRunCall) Do(opts ...googleapi.CallOption) (*Job, error) { 2000 gensupport.SetOptions(c.urlParams_, opts...) 2001 res, err := c.doRequest("json") 2002 if res != nil && res.StatusCode == http.StatusNotModified { 2003 if res.Body != nil { 2004 res.Body.Close() 2005 } 2006 return nil, gensupport.WrapError(&googleapi.Error{ 2007 Code: res.StatusCode, 2008 Header: res.Header, 2009 }) 2010 } 2011 if err != nil { 2012 return nil, err 2013 } 2014 defer googleapi.CloseBody(res) 2015 if err := googleapi.CheckResponse(res); err != nil { 2016 return nil, gensupport.WrapError(err) 2017 } 2018 ret := &Job{ 2019 ServerResponse: googleapi.ServerResponse{ 2020 Header: res.Header, 2021 HTTPStatusCode: res.StatusCode, 2022 }, 2023 } 2024 target := &ret 2025 if err := gensupport.DecodeResponse(target, res); err != nil { 2026 return nil, err 2027 } 2028 return ret, nil 2029 } 2030