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/v1beta1" 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/v1beta1" 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:v1beta1" 90 const apiName = "cloudscheduler" 91 const apiVersion = "v1beta1" 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 // LegacyAppEngineCron: Immutable. This field is used to manage the legacy App 448 // Engine Cron jobs using the Cloud Scheduler API. If the field is set to true, 449 // the job will be considered a legacy job. Note that App Engine Cron jobs have 450 // fewer features than Cloud Scheduler jobs, e.g., are only limited to App 451 // Engine targets. 452 LegacyAppEngineCron bool `json:"legacyAppEngineCron,omitempty"` 453 // Name: Optionally caller-specified in CreateJob, after which it becomes 454 // output only. The job name. For example: 455 // `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`. * `PROJECT_ID` can 456 // contain letters ([A-Za-z]), numbers ([0-9]), hyphens (-), colons (:), or 457 // periods (.). For more information, see Identifying projects 458 // (https://cloud.google.com/resource-manager/docs/creating-managing-projects#identifying_projects) 459 // * `LOCATION_ID` is the canonical ID for the job's location. The list of 460 // available locations can be obtained by calling ListLocations. For more 461 // information, see https://cloud.google.com/about/locations/. * `JOB_ID` can 462 // contain only letters ([A-Za-z]), numbers ([0-9]), hyphens (-), or 463 // underscores (_). The maximum length is 500 characters. 464 Name string `json:"name,omitempty"` 465 // PubsubTarget: Pub/Sub target. 466 PubsubTarget *PubsubTarget `json:"pubsubTarget,omitempty"` 467 // RetryConfig: Settings that determine the retry behavior. 468 RetryConfig *RetryConfig `json:"retryConfig,omitempty"` 469 // Schedule: Required, except when used with UpdateJob. Describes the schedule 470 // on which the job will be executed. The schedule can be either of the 471 // following types: * Crontab (https://en.wikipedia.org/wiki/Cron#Overview) * 472 // English-like schedule 473 // (https://cloud.google.com/scheduler/docs/configuring/cron-job-schedules) As 474 // a general rule, execution `n + 1` of a job will not begin until execution 475 // `n` has finished. Cloud Scheduler will never allow two simultaneously 476 // outstanding executions. For example, this implies that if the `n+1`th 477 // execution is scheduled to run at 16:00 but the `n`th execution takes until 478 // 16:15, the `n+1`th execution will not start until `16:15`. A scheduled start 479 // time will be delayed if the previous execution has not ended when its 480 // scheduled time occurs. If retry_count > 0 and a job attempt fails, the job 481 // will be tried a total of retry_count times, with exponential backoff, until 482 // the next scheduled start time. If retry_count is 0, a job attempt will not 483 // be retried if it fails. Instead the Cloud Scheduler system will wait for the 484 // next scheduled execution time. Setting retry_count to 0 does not prevent 485 // failed jobs from running according to schedule after the failure. 486 Schedule string `json:"schedule,omitempty"` 487 // ScheduleTime: Output only. The next time the job is scheduled. Note that 488 // this may be a retry of a previously failed attempt or the next execution 489 // time according to the schedule. 490 ScheduleTime string `json:"scheduleTime,omitempty"` 491 // State: Output only. State of the job. 492 // 493 // Possible values: 494 // "STATE_UNSPECIFIED" - Unspecified state. 495 // "ENABLED" - The job is executing normally. 496 // "PAUSED" - The job is paused by the user. It will not execute. A user can 497 // intentionally pause the job using PauseJobRequest. 498 // "DISABLED" - The job is disabled by the system due to error. The user 499 // cannot directly set a job to be disabled. 500 // "UPDATE_FAILED" - The job state resulting from a failed 501 // CloudScheduler.UpdateJob operation. To recover a job from this state, retry 502 // CloudScheduler.UpdateJob until a successful response is received. 503 State string `json:"state,omitempty"` 504 // Status: Output only. The response from the target for the last attempted 505 // execution. 506 Status *Status `json:"status,omitempty"` 507 // TimeZone: Specifies the time zone to be used in interpreting schedule. The 508 // value of this field must be a time zone name from the tz database 509 // (http://en.wikipedia.org/wiki/Tz_database). Note that some time zones 510 // include a provision for daylight savings time. The rules for daylight saving 511 // time are determined by the chosen tz. For UTC use the string "utc". If a 512 // time zone is not specified, the default will be in UTC (also known as GMT). 513 TimeZone string `json:"timeZone,omitempty"` 514 // UserUpdateTime: Output only. The creation time of the job. 515 UserUpdateTime string `json:"userUpdateTime,omitempty"` 516 517 // ServerResponse contains the HTTP response code and headers from the server. 518 googleapi.ServerResponse `json:"-"` 519 // ForceSendFields is a list of field names (e.g. "AppEngineHttpTarget") to 520 // unconditionally include in API requests. By default, fields with empty or 521 // default values are omitted from API requests. See 522 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 523 // details. 524 ForceSendFields []string `json:"-"` 525 // NullFields is a list of field names (e.g. "AppEngineHttpTarget") to include 526 // in API requests with the JSON null value. By default, fields with empty 527 // values are omitted from API requests. See 528 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 529 NullFields []string `json:"-"` 530 } 531 532 func (s *Job) MarshalJSON() ([]byte, error) { 533 type NoMethod Job 534 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 535 } 536 537 // ListJobsResponse: Response message for listing jobs using ListJobs. 538 type ListJobsResponse struct { 539 // Jobs: The list of jobs. 540 Jobs []*Job `json:"jobs,omitempty"` 541 // NextPageToken: A token to retrieve next page of results. Pass this value in 542 // the page_token field in the subsequent call to ListJobs to retrieve the next 543 // page of results. If this is empty it indicates that there are no more 544 // results through which to paginate. The page token is valid for only 2 hours. 545 NextPageToken string `json:"nextPageToken,omitempty"` 546 547 // ServerResponse contains the HTTP response code and headers from the server. 548 googleapi.ServerResponse `json:"-"` 549 // ForceSendFields is a list of field names (e.g. "Jobs") to unconditionally 550 // include in API requests. By default, fields with empty or default values are 551 // omitted from API requests. See 552 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 553 // details. 554 ForceSendFields []string `json:"-"` 555 // NullFields is a list of field names (e.g. "Jobs") to include in API requests 556 // with the JSON null value. By default, fields with empty values are omitted 557 // from API requests. See 558 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 559 NullFields []string `json:"-"` 560 } 561 562 func (s *ListJobsResponse) MarshalJSON() ([]byte, error) { 563 type NoMethod ListJobsResponse 564 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 565 } 566 567 // ListLocationsResponse: The response message for Locations.ListLocations. 568 type ListLocationsResponse struct { 569 // Locations: A list of locations that matches the specified filter in the 570 // request. 571 Locations []*Location `json:"locations,omitempty"` 572 // NextPageToken: The standard List next-page token. 573 NextPageToken string `json:"nextPageToken,omitempty"` 574 575 // ServerResponse contains the HTTP response code and headers from the server. 576 googleapi.ServerResponse `json:"-"` 577 // ForceSendFields is a list of field names (e.g. "Locations") to 578 // unconditionally include in API requests. By default, fields with empty or 579 // default values are omitted from API requests. See 580 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 581 // details. 582 ForceSendFields []string `json:"-"` 583 // NullFields is a list of field names (e.g. "Locations") to include in API 584 // requests with the JSON null value. By default, fields with empty values are 585 // omitted from API requests. See 586 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 587 NullFields []string `json:"-"` 588 } 589 590 func (s *ListLocationsResponse) MarshalJSON() ([]byte, error) { 591 type NoMethod ListLocationsResponse 592 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 593 } 594 595 // Location: A resource that represents a Google Cloud location. 596 type Location struct { 597 // DisplayName: The friendly name for this location, typically a nearby city 598 // name. For example, "Tokyo". 599 DisplayName string `json:"displayName,omitempty"` 600 // Labels: Cross-service attributes for the location. For example 601 // {"cloud.googleapis.com/region": "us-east1"} 602 Labels map[string]string `json:"labels,omitempty"` 603 // LocationId: The canonical id for this location. For example: "us-east1". 604 LocationId string `json:"locationId,omitempty"` 605 // Metadata: Service-specific metadata. For example the available capacity at 606 // the given location. 607 Metadata googleapi.RawMessage `json:"metadata,omitempty"` 608 // Name: Resource name for the location, which may vary between 609 // implementations. For example: 610 // "projects/example-project/locations/us-east1" 611 Name string `json:"name,omitempty"` 612 613 // ServerResponse contains the HTTP response code and headers from the server. 614 googleapi.ServerResponse `json:"-"` 615 // ForceSendFields is a list of field names (e.g. "DisplayName") to 616 // unconditionally include in API requests. By default, fields with empty or 617 // default values are omitted from API requests. See 618 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 619 // details. 620 ForceSendFields []string `json:"-"` 621 // NullFields is a list of field names (e.g. "DisplayName") to include in API 622 // requests with the JSON null value. By default, fields with empty values are 623 // omitted from API requests. See 624 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 625 NullFields []string `json:"-"` 626 } 627 628 func (s *Location) MarshalJSON() ([]byte, error) { 629 type NoMethod Location 630 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 631 } 632 633 // OAuthToken: Contains information needed for generating an OAuth token 634 // (https://developers.google.com/identity/protocols/OAuth2). This type of 635 // authorization should generally only be used when calling Google APIs hosted 636 // on *.googleapis.com. 637 type OAuthToken struct { 638 // Scope: OAuth scope to be used for generating OAuth access token. If not 639 // specified, "https://www.googleapis.com/auth/cloud-platform" will be used. 640 Scope string `json:"scope,omitempty"` 641 // ServiceAccountEmail: Service account email 642 // (https://cloud.google.com/iam/docs/service-accounts) to be used for 643 // generating OAuth token. The service account must be within the same project 644 // as the job. The caller must have iam.serviceAccounts.actAs permission for 645 // the service account. 646 ServiceAccountEmail string `json:"serviceAccountEmail,omitempty"` 647 // ForceSendFields is a list of field names (e.g. "Scope") to unconditionally 648 // include in API requests. By default, fields with empty or default values are 649 // omitted from API requests. See 650 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 651 // details. 652 ForceSendFields []string `json:"-"` 653 // NullFields is a list of field names (e.g. "Scope") to include in API 654 // requests with the JSON null value. By default, fields with empty values are 655 // omitted from API requests. See 656 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 657 NullFields []string `json:"-"` 658 } 659 660 func (s *OAuthToken) MarshalJSON() ([]byte, error) { 661 type NoMethod OAuthToken 662 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 663 } 664 665 // OidcToken: Contains information needed for generating an OpenID Connect 666 // token (https://developers.google.com/identity/protocols/OpenIDConnect). This 667 // type of authorization can be used for many scenarios, including calling 668 // Cloud Run, or endpoints where you intend to validate the token yourself. 669 type OidcToken struct { 670 // Audience: Audience to be used when generating OIDC token. If not specified, 671 // the URI specified in target will be used. 672 Audience string `json:"audience,omitempty"` 673 // ServiceAccountEmail: Service account email 674 // (https://cloud.google.com/iam/docs/service-accounts) to be used for 675 // generating OIDC token. The service account must be within the same project 676 // as the job. The caller must have iam.serviceAccounts.actAs permission for 677 // the service account. 678 ServiceAccountEmail string `json:"serviceAccountEmail,omitempty"` 679 // ForceSendFields is a list of field names (e.g. "Audience") to 680 // unconditionally include in API requests. By default, fields with empty or 681 // default values are omitted from API requests. See 682 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 683 // details. 684 ForceSendFields []string `json:"-"` 685 // NullFields is a list of field names (e.g. "Audience") to include in API 686 // requests with the JSON null value. By default, fields with empty values are 687 // omitted from API requests. See 688 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 689 NullFields []string `json:"-"` 690 } 691 692 func (s *OidcToken) MarshalJSON() ([]byte, error) { 693 type NoMethod OidcToken 694 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 695 } 696 697 // PauseJobRequest: Request message for PauseJob. 698 type PauseJobRequest struct { 699 } 700 701 // PubsubMessage: A message that is published by publishers and consumed by 702 // subscribers. The message must contain either a non-empty data field or at 703 // least one attribute. Note that client libraries represent this object 704 // differently depending on the language. See the corresponding client library 705 // documentation (https://cloud.google.com/pubsub/docs/reference/libraries) for 706 // more information. See [quotas and limits] 707 // (https://cloud.google.com/pubsub/quotas) for more information about message 708 // limits. 709 type PubsubMessage struct { 710 // Attributes: Optional. Attributes for this message. If this field is empty, 711 // the message must contain non-empty data. This can be used to filter messages 712 // on the subscription. 713 Attributes map[string]string `json:"attributes,omitempty"` 714 // Data: Optional. The message data field. If this field is empty, the message 715 // must contain at least one attribute. 716 Data string `json:"data,omitempty"` 717 // MessageId: ID of this message, assigned by the server when the message is 718 // published. Guaranteed to be unique within the topic. This value may be read 719 // by a subscriber that receives a `PubsubMessage` via a `Pull` call or a push 720 // delivery. It must not be populated by the publisher in a `Publish` call. 721 MessageId string `json:"messageId,omitempty"` 722 // OrderingKey: Optional. If non-empty, identifies related messages for which 723 // publish order should be respected. If a `Subscription` has 724 // `enable_message_ordering` set to `true`, messages published with the same 725 // non-empty `ordering_key` value will be delivered to subscribers in the order 726 // in which they are received by the Pub/Sub system. All `PubsubMessage`s 727 // published in a given `PublishRequest` must specify the same `ordering_key` 728 // value. For more information, see ordering messages 729 // (https://cloud.google.com/pubsub/docs/ordering). 730 OrderingKey string `json:"orderingKey,omitempty"` 731 // PublishTime: The time at which the message was published, populated by the 732 // server when it receives the `Publish` call. It must not be populated by the 733 // publisher in a `Publish` call. 734 PublishTime string `json:"publishTime,omitempty"` 735 // ForceSendFields is a list of field names (e.g. "Attributes") to 736 // unconditionally include in API requests. By default, fields with empty or 737 // default values are omitted from API requests. See 738 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 739 // details. 740 ForceSendFields []string `json:"-"` 741 // NullFields is a list of field names (e.g. "Attributes") to include in API 742 // requests with the JSON null value. By default, fields with empty values are 743 // omitted from API requests. See 744 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 745 NullFields []string `json:"-"` 746 } 747 748 func (s *PubsubMessage) MarshalJSON() ([]byte, error) { 749 type NoMethod PubsubMessage 750 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 751 } 752 753 // PubsubTarget: Pub/Sub target. The job will be delivered by publishing a 754 // message to the given Pub/Sub topic. 755 type PubsubTarget struct { 756 // Attributes: Attributes for PubsubMessage. Pubsub message must contain either 757 // non-empty data, or at least one attribute. 758 Attributes map[string]string `json:"attributes,omitempty"` 759 // Data: The message payload for PubsubMessage. Pubsub message must contain 760 // either non-empty data, or at least one attribute. 761 Data string `json:"data,omitempty"` 762 // TopicName: Required. The name of the Cloud Pub/Sub topic to which messages 763 // will be published when a job is delivered. The topic name must be in the 764 // same format as required by Pub/Sub's PublishRequest.name 765 // (https://cloud.google.com/pubsub/docs/reference/rpc/google.pubsub.v1#publishrequest), 766 // for example `projects/PROJECT_ID/topics/TOPIC_ID`. The topic must be in the 767 // same project as the Cloud Scheduler job. 768 TopicName string `json:"topicName,omitempty"` 769 // ForceSendFields is a list of field names (e.g. "Attributes") to 770 // unconditionally include in API requests. By default, fields with empty or 771 // default values are omitted from API requests. See 772 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 773 // details. 774 ForceSendFields []string `json:"-"` 775 // NullFields is a list of field names (e.g. "Attributes") to include in API 776 // requests with the JSON null value. By default, fields with empty values are 777 // omitted from API requests. See 778 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 779 NullFields []string `json:"-"` 780 } 781 782 func (s *PubsubTarget) MarshalJSON() ([]byte, error) { 783 type NoMethod PubsubTarget 784 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 785 } 786 787 // ResumeJobRequest: Request message for ResumeJob. 788 type ResumeJobRequest struct { 789 } 790 791 // RetryConfig: Settings that determine the retry behavior. By default, if a 792 // job does not complete successfully (meaning that an acknowledgement is not 793 // received from the handler, then it will be retried with exponential backoff 794 // according to the settings in RetryConfig. 795 type RetryConfig struct { 796 // MaxBackoffDuration: The maximum amount of time to wait before retrying a job 797 // after it fails. The default value of this field is 1 hour. 798 MaxBackoffDuration string `json:"maxBackoffDuration,omitempty"` 799 // MaxDoublings: The time between retries will double `max_doublings` times. A 800 // job's retry interval starts at min_backoff_duration, then doubles 801 // `max_doublings` times, then increases linearly, and finally retries at 802 // intervals of max_backoff_duration up to retry_count times. For example, if 803 // min_backoff_duration is 10s, max_backoff_duration is 300s, and 804 // `max_doublings` is 3, then the job will first be retried in 10s. The retry 805 // interval will double three times, and then increase linearly by 2^3 * 10s. 806 // Finally, the job will retry at intervals of max_backoff_duration until the 807 // job has been attempted retry_count times. Thus, the requests will retry at 808 // 10s, 20s, 40s, 80s, 160s, 240s, 300s, 300s, .... The default value of this 809 // field is 5. 810 MaxDoublings int64 `json:"maxDoublings,omitempty"` 811 // MaxRetryDuration: The time limit for retrying a failed job, measured from 812 // time when an execution was first attempted. If specified with retry_count, 813 // the job will be retried until both limits are reached. The default value for 814 // max_retry_duration is zero, which means retry duration is unlimited. 815 MaxRetryDuration string `json:"maxRetryDuration,omitempty"` 816 // MinBackoffDuration: The minimum amount of time to wait before retrying a job 817 // after it fails. The default value of this field is 5 seconds. 818 MinBackoffDuration string `json:"minBackoffDuration,omitempty"` 819 // RetryCount: The number of attempts that the system will make to run a job 820 // using the exponential backoff procedure described by max_doublings. The 821 // default value of retry_count is zero. If retry_count is 0, a job attempt 822 // will not be retried if it fails. Instead the Cloud Scheduler system will 823 // wait for the next scheduled execution time. Setting retry_count to 0 does 824 // not prevent failed jobs from running according to schedule after the 825 // failure. If retry_count is set to a non-zero number then Cloud Scheduler 826 // will retry failed attempts, using exponential backoff, retry_count times, or 827 // until the next scheduled execution time, whichever comes first. Values 828 // greater than 5 and negative values are not allowed. 829 RetryCount int64 `json:"retryCount,omitempty"` 830 // ForceSendFields is a list of field names (e.g. "MaxBackoffDuration") to 831 // unconditionally include in API requests. By default, fields with empty or 832 // default values are omitted from API requests. See 833 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 834 // details. 835 ForceSendFields []string `json:"-"` 836 // NullFields is a list of field names (e.g. "MaxBackoffDuration") to include 837 // in API requests with the JSON null value. By default, fields with empty 838 // values are omitted from API requests. See 839 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 840 NullFields []string `json:"-"` 841 } 842 843 func (s *RetryConfig) MarshalJSON() ([]byte, error) { 844 type NoMethod RetryConfig 845 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 846 } 847 848 // RunJobRequest: Request message for forcing a job to run now using RunJob. 849 type RunJobRequest struct { 850 // LegacyAppEngineCron: This field is used to manage the legacy App Engine Cron 851 // jobs using the Cloud Scheduler API. If the field is set to true, the job in 852 // the __cron queue with the corresponding name will be forced to run instead. 853 LegacyAppEngineCron bool `json:"legacyAppEngineCron,omitempty"` 854 // ForceSendFields is a list of field names (e.g. "LegacyAppEngineCron") to 855 // unconditionally include in API requests. By default, fields with empty or 856 // default values are omitted from API requests. See 857 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 858 // details. 859 ForceSendFields []string `json:"-"` 860 // NullFields is a list of field names (e.g. "LegacyAppEngineCron") to include 861 // in API requests with the JSON null value. By default, fields with empty 862 // values are omitted from API requests. See 863 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 864 NullFields []string `json:"-"` 865 } 866 867 func (s *RunJobRequest) MarshalJSON() ([]byte, error) { 868 type NoMethod RunJobRequest 869 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 870 } 871 872 // Status: The `Status` type defines a logical error model that is suitable for 873 // different programming environments, including REST APIs and RPC APIs. It is 874 // used by gRPC (https://github.com/grpc). Each `Status` message contains three 875 // pieces of data: error code, error message, and error details. You can find 876 // out more about this error model and how to work with it in the API Design 877 // Guide (https://cloud.google.com/apis/design/errors). 878 type Status struct { 879 // Code: The status code, which should be an enum value of google.rpc.Code. 880 Code int64 `json:"code,omitempty"` 881 // Details: A list of messages that carry the error details. There is a common 882 // set of message types for APIs to use. 883 Details []googleapi.RawMessage `json:"details,omitempty"` 884 // Message: A developer-facing error message, which should be in English. Any 885 // user-facing error message should be localized and sent in the 886 // google.rpc.Status.details field, or localized by the client. 887 Message string `json:"message,omitempty"` 888 // ForceSendFields is a list of field names (e.g. "Code") to unconditionally 889 // include in API requests. By default, fields with empty or default values are 890 // omitted from API requests. See 891 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 892 // details. 893 ForceSendFields []string `json:"-"` 894 // NullFields is a list of field names (e.g. "Code") to include in API requests 895 // with the JSON null value. By default, fields with empty values are omitted 896 // from API requests. See 897 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 898 NullFields []string `json:"-"` 899 } 900 901 func (s *Status) MarshalJSON() ([]byte, error) { 902 type NoMethod Status 903 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 904 } 905 906 type ProjectsLocationsGetCall struct { 907 s *Service 908 name string 909 urlParams_ gensupport.URLParams 910 ifNoneMatch_ string 911 ctx_ context.Context 912 header_ http.Header 913 } 914 915 // Get: Gets information about a location. 916 // 917 // - name: Resource name for the location. 918 func (r *ProjectsLocationsService) Get(name string) *ProjectsLocationsGetCall { 919 c := &ProjectsLocationsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 920 c.name = name 921 return c 922 } 923 924 // Fields allows partial responses to be retrieved. See 925 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more 926 // details. 927 func (c *ProjectsLocationsGetCall) Fields(s ...googleapi.Field) *ProjectsLocationsGetCall { 928 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 929 return c 930 } 931 932 // IfNoneMatch sets an optional parameter which makes the operation fail if the 933 // object's ETag matches the given value. This is useful for getting updates 934 // only after the object has changed since the last request. 935 func (c *ProjectsLocationsGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsGetCall { 936 c.ifNoneMatch_ = entityTag 937 return c 938 } 939 940 // Context sets the context to be used in this call's Do method. 941 func (c *ProjectsLocationsGetCall) Context(ctx context.Context) *ProjectsLocationsGetCall { 942 c.ctx_ = ctx 943 return c 944 } 945 946 // Header returns a http.Header that can be modified by the caller to add 947 // headers to the request. 948 func (c *ProjectsLocationsGetCall) Header() http.Header { 949 if c.header_ == nil { 950 c.header_ = make(http.Header) 951 } 952 return c.header_ 953 } 954 955 func (c *ProjectsLocationsGetCall) doRequest(alt string) (*http.Response, error) { 956 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_) 957 if c.ifNoneMatch_ != "" { 958 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 959 } 960 var body io.Reader = nil 961 c.urlParams_.Set("alt", alt) 962 c.urlParams_.Set("prettyPrint", "false") 963 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+name}") 964 urls += "?" + c.urlParams_.Encode() 965 req, err := http.NewRequest("GET", urls, body) 966 if err != nil { 967 return nil, err 968 } 969 req.Header = reqHeaders 970 googleapi.Expand(req.URL, map[string]string{ 971 "name": c.name, 972 }) 973 return gensupport.SendRequest(c.ctx_, c.s.client, req) 974 } 975 976 // Do executes the "cloudscheduler.projects.locations.get" call. 977 // Any non-2xx status code is an error. Response headers are in either 978 // *Location.ServerResponse.Header or (if a response was returned at all) in 979 // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check 980 // whether the returned error was because http.StatusNotModified was returned. 981 func (c *ProjectsLocationsGetCall) Do(opts ...googleapi.CallOption) (*Location, error) { 982 gensupport.SetOptions(c.urlParams_, opts...) 983 res, err := c.doRequest("json") 984 if res != nil && res.StatusCode == http.StatusNotModified { 985 if res.Body != nil { 986 res.Body.Close() 987 } 988 return nil, gensupport.WrapError(&googleapi.Error{ 989 Code: res.StatusCode, 990 Header: res.Header, 991 }) 992 } 993 if err != nil { 994 return nil, err 995 } 996 defer googleapi.CloseBody(res) 997 if err := googleapi.CheckResponse(res); err != nil { 998 return nil, gensupport.WrapError(err) 999 } 1000 ret := &Location{ 1001 ServerResponse: googleapi.ServerResponse{ 1002 Header: res.Header, 1003 HTTPStatusCode: res.StatusCode, 1004 }, 1005 } 1006 target := &ret 1007 if err := gensupport.DecodeResponse(target, res); err != nil { 1008 return nil, err 1009 } 1010 return ret, nil 1011 } 1012 1013 type ProjectsLocationsListCall struct { 1014 s *Service 1015 name string 1016 urlParams_ gensupport.URLParams 1017 ifNoneMatch_ string 1018 ctx_ context.Context 1019 header_ http.Header 1020 } 1021 1022 // List: Lists information about the supported locations for this service. 1023 // 1024 // - name: The resource that owns the locations collection, if applicable. 1025 func (r *ProjectsLocationsService) List(name string) *ProjectsLocationsListCall { 1026 c := &ProjectsLocationsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1027 c.name = name 1028 return c 1029 } 1030 1031 // Filter sets the optional parameter "filter": A filter to narrow down results 1032 // to a preferred subset. The filtering language accepts strings like 1033 // "displayName=tokyo", and is documented in more detail in AIP-160 1034 // (https://google.aip.dev/160). 1035 func (c *ProjectsLocationsListCall) Filter(filter string) *ProjectsLocationsListCall { 1036 c.urlParams_.Set("filter", filter) 1037 return c 1038 } 1039 1040 // PageSize sets the optional parameter "pageSize": The maximum number of 1041 // results to return. If not set, the service selects a default. 1042 func (c *ProjectsLocationsListCall) PageSize(pageSize int64) *ProjectsLocationsListCall { 1043 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 1044 return c 1045 } 1046 1047 // PageToken sets the optional parameter "pageToken": A page token received 1048 // from the `next_page_token` field in the response. Send that page token to 1049 // receive the subsequent page. 1050 func (c *ProjectsLocationsListCall) PageToken(pageToken string) *ProjectsLocationsListCall { 1051 c.urlParams_.Set("pageToken", pageToken) 1052 return c 1053 } 1054 1055 // Fields allows partial responses to be retrieved. See 1056 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more 1057 // details. 1058 func (c *ProjectsLocationsListCall) Fields(s ...googleapi.Field) *ProjectsLocationsListCall { 1059 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1060 return c 1061 } 1062 1063 // IfNoneMatch sets an optional parameter which makes the operation fail if the 1064 // object's ETag matches the given value. This is useful for getting updates 1065 // only after the object has changed since the last request. 1066 func (c *ProjectsLocationsListCall) IfNoneMatch(entityTag string) *ProjectsLocationsListCall { 1067 c.ifNoneMatch_ = entityTag 1068 return c 1069 } 1070 1071 // Context sets the context to be used in this call's Do method. 1072 func (c *ProjectsLocationsListCall) Context(ctx context.Context) *ProjectsLocationsListCall { 1073 c.ctx_ = ctx 1074 return c 1075 } 1076 1077 // Header returns a http.Header that can be modified by the caller to add 1078 // headers to the request. 1079 func (c *ProjectsLocationsListCall) Header() http.Header { 1080 if c.header_ == nil { 1081 c.header_ = make(http.Header) 1082 } 1083 return c.header_ 1084 } 1085 1086 func (c *ProjectsLocationsListCall) doRequest(alt string) (*http.Response, error) { 1087 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_) 1088 if c.ifNoneMatch_ != "" { 1089 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 1090 } 1091 var body io.Reader = nil 1092 c.urlParams_.Set("alt", alt) 1093 c.urlParams_.Set("prettyPrint", "false") 1094 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+name}/locations") 1095 urls += "?" + c.urlParams_.Encode() 1096 req, err := http.NewRequest("GET", urls, body) 1097 if err != nil { 1098 return nil, err 1099 } 1100 req.Header = reqHeaders 1101 googleapi.Expand(req.URL, map[string]string{ 1102 "name": c.name, 1103 }) 1104 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1105 } 1106 1107 // Do executes the "cloudscheduler.projects.locations.list" call. 1108 // Any non-2xx status code is an error. Response headers are in either 1109 // *ListLocationsResponse.ServerResponse.Header or (if a response was returned 1110 // at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 1111 // check whether the returned error was because http.StatusNotModified was 1112 // returned. 1113 func (c *ProjectsLocationsListCall) Do(opts ...googleapi.CallOption) (*ListLocationsResponse, error) { 1114 gensupport.SetOptions(c.urlParams_, opts...) 1115 res, err := c.doRequest("json") 1116 if res != nil && res.StatusCode == http.StatusNotModified { 1117 if res.Body != nil { 1118 res.Body.Close() 1119 } 1120 return nil, gensupport.WrapError(&googleapi.Error{ 1121 Code: res.StatusCode, 1122 Header: res.Header, 1123 }) 1124 } 1125 if err != nil { 1126 return nil, err 1127 } 1128 defer googleapi.CloseBody(res) 1129 if err := googleapi.CheckResponse(res); err != nil { 1130 return nil, gensupport.WrapError(err) 1131 } 1132 ret := &ListLocationsResponse{ 1133 ServerResponse: googleapi.ServerResponse{ 1134 Header: res.Header, 1135 HTTPStatusCode: res.StatusCode, 1136 }, 1137 } 1138 target := &ret 1139 if err := gensupport.DecodeResponse(target, res); err != nil { 1140 return nil, err 1141 } 1142 return ret, nil 1143 } 1144 1145 // Pages invokes f for each page of results. 1146 // A non-nil error returned from f will halt the iteration. 1147 // The provided context supersedes any context provided to the Context method. 1148 func (c *ProjectsLocationsListCall) Pages(ctx context.Context, f func(*ListLocationsResponse) error) error { 1149 c.ctx_ = ctx 1150 defer c.PageToken(c.urlParams_.Get("pageToken")) 1151 for { 1152 x, err := c.Do() 1153 if err != nil { 1154 return err 1155 } 1156 if err := f(x); err != nil { 1157 return err 1158 } 1159 if x.NextPageToken == "" { 1160 return nil 1161 } 1162 c.PageToken(x.NextPageToken) 1163 } 1164 } 1165 1166 type ProjectsLocationsJobsCreateCall struct { 1167 s *Service 1168 parent string 1169 job *Job 1170 urlParams_ gensupport.URLParams 1171 ctx_ context.Context 1172 header_ http.Header 1173 } 1174 1175 // Create: Creates a job. 1176 // 1177 // - parent: The location name. For example: 1178 // `projects/PROJECT_ID/locations/LOCATION_ID`. 1179 func (r *ProjectsLocationsJobsService) Create(parent string, job *Job) *ProjectsLocationsJobsCreateCall { 1180 c := &ProjectsLocationsJobsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1181 c.parent = parent 1182 c.job = job 1183 return c 1184 } 1185 1186 // Fields allows partial responses to be retrieved. See 1187 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more 1188 // details. 1189 func (c *ProjectsLocationsJobsCreateCall) Fields(s ...googleapi.Field) *ProjectsLocationsJobsCreateCall { 1190 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1191 return c 1192 } 1193 1194 // Context sets the context to be used in this call's Do method. 1195 func (c *ProjectsLocationsJobsCreateCall) Context(ctx context.Context) *ProjectsLocationsJobsCreateCall { 1196 c.ctx_ = ctx 1197 return c 1198 } 1199 1200 // Header returns a http.Header that can be modified by the caller to add 1201 // headers to the request. 1202 func (c *ProjectsLocationsJobsCreateCall) Header() http.Header { 1203 if c.header_ == nil { 1204 c.header_ = make(http.Header) 1205 } 1206 return c.header_ 1207 } 1208 1209 func (c *ProjectsLocationsJobsCreateCall) doRequest(alt string) (*http.Response, error) { 1210 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_) 1211 var body io.Reader = nil 1212 body, err := googleapi.WithoutDataWrapper.JSONReader(c.job) 1213 if err != nil { 1214 return nil, err 1215 } 1216 c.urlParams_.Set("alt", alt) 1217 c.urlParams_.Set("prettyPrint", "false") 1218 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+parent}/jobs") 1219 urls += "?" + c.urlParams_.Encode() 1220 req, err := http.NewRequest("POST", urls, body) 1221 if err != nil { 1222 return nil, err 1223 } 1224 req.Header = reqHeaders 1225 googleapi.Expand(req.URL, map[string]string{ 1226 "parent": c.parent, 1227 }) 1228 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1229 } 1230 1231 // Do executes the "cloudscheduler.projects.locations.jobs.create" call. 1232 // Any non-2xx status code is an error. Response headers are in either 1233 // *Job.ServerResponse.Header or (if a response was returned at all) in 1234 // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check 1235 // whether the returned error was because http.StatusNotModified was returned. 1236 func (c *ProjectsLocationsJobsCreateCall) Do(opts ...googleapi.CallOption) (*Job, error) { 1237 gensupport.SetOptions(c.urlParams_, opts...) 1238 res, err := c.doRequest("json") 1239 if res != nil && res.StatusCode == http.StatusNotModified { 1240 if res.Body != nil { 1241 res.Body.Close() 1242 } 1243 return nil, gensupport.WrapError(&googleapi.Error{ 1244 Code: res.StatusCode, 1245 Header: res.Header, 1246 }) 1247 } 1248 if err != nil { 1249 return nil, err 1250 } 1251 defer googleapi.CloseBody(res) 1252 if err := googleapi.CheckResponse(res); err != nil { 1253 return nil, gensupport.WrapError(err) 1254 } 1255 ret := &Job{ 1256 ServerResponse: googleapi.ServerResponse{ 1257 Header: res.Header, 1258 HTTPStatusCode: res.StatusCode, 1259 }, 1260 } 1261 target := &ret 1262 if err := gensupport.DecodeResponse(target, res); err != nil { 1263 return nil, err 1264 } 1265 return ret, nil 1266 } 1267 1268 type ProjectsLocationsJobsDeleteCall struct { 1269 s *Service 1270 name string 1271 urlParams_ gensupport.URLParams 1272 ctx_ context.Context 1273 header_ http.Header 1274 } 1275 1276 // Delete: Deletes a job. 1277 // 1278 // - name: The job name. For example: 1279 // `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`. 1280 func (r *ProjectsLocationsJobsService) Delete(name string) *ProjectsLocationsJobsDeleteCall { 1281 c := &ProjectsLocationsJobsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1282 c.name = name 1283 return c 1284 } 1285 1286 // LegacyAppEngineCron sets the optional parameter "legacyAppEngineCron": This 1287 // field is used to manage the legacy App Engine Cron jobs using the Cloud 1288 // Scheduler API. If the field is set to true, the job in the __cron queue with 1289 // the corresponding name will be deleted instead. 1290 func (c *ProjectsLocationsJobsDeleteCall) LegacyAppEngineCron(legacyAppEngineCron bool) *ProjectsLocationsJobsDeleteCall { 1291 c.urlParams_.Set("legacyAppEngineCron", fmt.Sprint(legacyAppEngineCron)) 1292 return c 1293 } 1294 1295 // Fields allows partial responses to be retrieved. See 1296 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more 1297 // details. 1298 func (c *ProjectsLocationsJobsDeleteCall) Fields(s ...googleapi.Field) *ProjectsLocationsJobsDeleteCall { 1299 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1300 return c 1301 } 1302 1303 // Context sets the context to be used in this call's Do method. 1304 func (c *ProjectsLocationsJobsDeleteCall) Context(ctx context.Context) *ProjectsLocationsJobsDeleteCall { 1305 c.ctx_ = ctx 1306 return c 1307 } 1308 1309 // Header returns a http.Header that can be modified by the caller to add 1310 // headers to the request. 1311 func (c *ProjectsLocationsJobsDeleteCall) Header() http.Header { 1312 if c.header_ == nil { 1313 c.header_ = make(http.Header) 1314 } 1315 return c.header_ 1316 } 1317 1318 func (c *ProjectsLocationsJobsDeleteCall) doRequest(alt string) (*http.Response, error) { 1319 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_) 1320 var body io.Reader = nil 1321 c.urlParams_.Set("alt", alt) 1322 c.urlParams_.Set("prettyPrint", "false") 1323 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+name}") 1324 urls += "?" + c.urlParams_.Encode() 1325 req, err := http.NewRequest("DELETE", urls, body) 1326 if err != nil { 1327 return nil, err 1328 } 1329 req.Header = reqHeaders 1330 googleapi.Expand(req.URL, map[string]string{ 1331 "name": c.name, 1332 }) 1333 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1334 } 1335 1336 // Do executes the "cloudscheduler.projects.locations.jobs.delete" call. 1337 // Any non-2xx status code is an error. Response headers are in either 1338 // *Empty.ServerResponse.Header or (if a response was returned at all) in 1339 // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check 1340 // whether the returned error was because http.StatusNotModified was returned. 1341 func (c *ProjectsLocationsJobsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 1342 gensupport.SetOptions(c.urlParams_, opts...) 1343 res, err := c.doRequest("json") 1344 if res != nil && res.StatusCode == http.StatusNotModified { 1345 if res.Body != nil { 1346 res.Body.Close() 1347 } 1348 return nil, gensupport.WrapError(&googleapi.Error{ 1349 Code: res.StatusCode, 1350 Header: res.Header, 1351 }) 1352 } 1353 if err != nil { 1354 return nil, err 1355 } 1356 defer googleapi.CloseBody(res) 1357 if err := googleapi.CheckResponse(res); err != nil { 1358 return nil, gensupport.WrapError(err) 1359 } 1360 ret := &Empty{ 1361 ServerResponse: googleapi.ServerResponse{ 1362 Header: res.Header, 1363 HTTPStatusCode: res.StatusCode, 1364 }, 1365 } 1366 target := &ret 1367 if err := gensupport.DecodeResponse(target, res); err != nil { 1368 return nil, err 1369 } 1370 return ret, nil 1371 } 1372 1373 type ProjectsLocationsJobsGetCall struct { 1374 s *Service 1375 name string 1376 urlParams_ gensupport.URLParams 1377 ifNoneMatch_ string 1378 ctx_ context.Context 1379 header_ http.Header 1380 } 1381 1382 // Get: Gets a job. 1383 // 1384 // - name: The job name. For example: 1385 // `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`. 1386 func (r *ProjectsLocationsJobsService) Get(name string) *ProjectsLocationsJobsGetCall { 1387 c := &ProjectsLocationsJobsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1388 c.name = name 1389 return c 1390 } 1391 1392 // Fields allows partial responses to be retrieved. See 1393 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more 1394 // details. 1395 func (c *ProjectsLocationsJobsGetCall) Fields(s ...googleapi.Field) *ProjectsLocationsJobsGetCall { 1396 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1397 return c 1398 } 1399 1400 // IfNoneMatch sets an optional parameter which makes the operation fail if the 1401 // object's ETag matches the given value. This is useful for getting updates 1402 // only after the object has changed since the last request. 1403 func (c *ProjectsLocationsJobsGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsJobsGetCall { 1404 c.ifNoneMatch_ = entityTag 1405 return c 1406 } 1407 1408 // Context sets the context to be used in this call's Do method. 1409 func (c *ProjectsLocationsJobsGetCall) Context(ctx context.Context) *ProjectsLocationsJobsGetCall { 1410 c.ctx_ = ctx 1411 return c 1412 } 1413 1414 // Header returns a http.Header that can be modified by the caller to add 1415 // headers to the request. 1416 func (c *ProjectsLocationsJobsGetCall) Header() http.Header { 1417 if c.header_ == nil { 1418 c.header_ = make(http.Header) 1419 } 1420 return c.header_ 1421 } 1422 1423 func (c *ProjectsLocationsJobsGetCall) doRequest(alt string) (*http.Response, error) { 1424 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_) 1425 if c.ifNoneMatch_ != "" { 1426 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 1427 } 1428 var body io.Reader = nil 1429 c.urlParams_.Set("alt", alt) 1430 c.urlParams_.Set("prettyPrint", "false") 1431 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+name}") 1432 urls += "?" + c.urlParams_.Encode() 1433 req, err := http.NewRequest("GET", urls, body) 1434 if err != nil { 1435 return nil, err 1436 } 1437 req.Header = reqHeaders 1438 googleapi.Expand(req.URL, map[string]string{ 1439 "name": c.name, 1440 }) 1441 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1442 } 1443 1444 // Do executes the "cloudscheduler.projects.locations.jobs.get" call. 1445 // Any non-2xx status code is an error. Response headers are in either 1446 // *Job.ServerResponse.Header or (if a response was returned at all) in 1447 // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check 1448 // whether the returned error was because http.StatusNotModified was returned. 1449 func (c *ProjectsLocationsJobsGetCall) Do(opts ...googleapi.CallOption) (*Job, error) { 1450 gensupport.SetOptions(c.urlParams_, opts...) 1451 res, err := c.doRequest("json") 1452 if res != nil && res.StatusCode == http.StatusNotModified { 1453 if res.Body != nil { 1454 res.Body.Close() 1455 } 1456 return nil, gensupport.WrapError(&googleapi.Error{ 1457 Code: res.StatusCode, 1458 Header: res.Header, 1459 }) 1460 } 1461 if err != nil { 1462 return nil, err 1463 } 1464 defer googleapi.CloseBody(res) 1465 if err := googleapi.CheckResponse(res); err != nil { 1466 return nil, gensupport.WrapError(err) 1467 } 1468 ret := &Job{ 1469 ServerResponse: googleapi.ServerResponse{ 1470 Header: res.Header, 1471 HTTPStatusCode: res.StatusCode, 1472 }, 1473 } 1474 target := &ret 1475 if err := gensupport.DecodeResponse(target, res); err != nil { 1476 return nil, err 1477 } 1478 return ret, nil 1479 } 1480 1481 type ProjectsLocationsJobsListCall struct { 1482 s *Service 1483 parent string 1484 urlParams_ gensupport.URLParams 1485 ifNoneMatch_ string 1486 ctx_ context.Context 1487 header_ http.Header 1488 } 1489 1490 // List: Lists jobs. 1491 // 1492 // - parent: The location name. For example: 1493 // `projects/PROJECT_ID/locations/LOCATION_ID`. 1494 func (r *ProjectsLocationsJobsService) List(parent string) *ProjectsLocationsJobsListCall { 1495 c := &ProjectsLocationsJobsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1496 c.parent = parent 1497 return c 1498 } 1499 1500 // Filter sets the optional parameter "filter": `filter` can be used to specify 1501 // a subset of jobs. If `filter` equals `target_config="HttpConfig", then the 1502 // http target jobs are retrieved. If `filter` equals 1503 // `target_config="PubSubConfig", then the Pub/Sub target jobs are retrieved. 1504 // If `filter` equals `labels.foo=value1 labels.foo=value2` then only jobs 1505 // which are labeled with foo=value1 AND foo=value2 will be returned. 1506 func (c *ProjectsLocationsJobsListCall) Filter(filter string) *ProjectsLocationsJobsListCall { 1507 c.urlParams_.Set("filter", filter) 1508 return c 1509 } 1510 1511 // LegacyAppEngineCron sets the optional parameter "legacyAppEngineCron": This 1512 // field is used to manage the legacy App Engine Cron jobs using the Cloud 1513 // Scheduler API. If the field is set to true, the jobs in the __cron queue 1514 // will be listed instead. 1515 func (c *ProjectsLocationsJobsListCall) LegacyAppEngineCron(legacyAppEngineCron bool) *ProjectsLocationsJobsListCall { 1516 c.urlParams_.Set("legacyAppEngineCron", fmt.Sprint(legacyAppEngineCron)) 1517 return c 1518 } 1519 1520 // PageSize sets the optional parameter "pageSize": Requested page size. The 1521 // maximum page size is 500. If unspecified, the page size will be the maximum. 1522 // Fewer jobs than requested might be returned, even if more jobs exist; use 1523 // next_page_token to determine if more jobs exist. 1524 func (c *ProjectsLocationsJobsListCall) PageSize(pageSize int64) *ProjectsLocationsJobsListCall { 1525 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 1526 return c 1527 } 1528 1529 // PageToken sets the optional parameter "pageToken": A token identifying a 1530 // page of results the server will return. To request the first page results, 1531 // page_token must be empty. To request the next page of results, page_token 1532 // must be the value of next_page_token returned from the previous call to 1533 // ListJobs. It is an error to switch the value of filter or order_by while 1534 // iterating through pages. 1535 func (c *ProjectsLocationsJobsListCall) PageToken(pageToken string) *ProjectsLocationsJobsListCall { 1536 c.urlParams_.Set("pageToken", pageToken) 1537 return c 1538 } 1539 1540 // Fields allows partial responses to be retrieved. See 1541 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more 1542 // details. 1543 func (c *ProjectsLocationsJobsListCall) Fields(s ...googleapi.Field) *ProjectsLocationsJobsListCall { 1544 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1545 return c 1546 } 1547 1548 // IfNoneMatch sets an optional parameter which makes the operation fail if the 1549 // object's ETag matches the given value. This is useful for getting updates 1550 // only after the object has changed since the last request. 1551 func (c *ProjectsLocationsJobsListCall) IfNoneMatch(entityTag string) *ProjectsLocationsJobsListCall { 1552 c.ifNoneMatch_ = entityTag 1553 return c 1554 } 1555 1556 // Context sets the context to be used in this call's Do method. 1557 func (c *ProjectsLocationsJobsListCall) Context(ctx context.Context) *ProjectsLocationsJobsListCall { 1558 c.ctx_ = ctx 1559 return c 1560 } 1561 1562 // Header returns a http.Header that can be modified by the caller to add 1563 // headers to the request. 1564 func (c *ProjectsLocationsJobsListCall) Header() http.Header { 1565 if c.header_ == nil { 1566 c.header_ = make(http.Header) 1567 } 1568 return c.header_ 1569 } 1570 1571 func (c *ProjectsLocationsJobsListCall) doRequest(alt string) (*http.Response, error) { 1572 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_) 1573 if c.ifNoneMatch_ != "" { 1574 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 1575 } 1576 var body io.Reader = nil 1577 c.urlParams_.Set("alt", alt) 1578 c.urlParams_.Set("prettyPrint", "false") 1579 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+parent}/jobs") 1580 urls += "?" + c.urlParams_.Encode() 1581 req, err := http.NewRequest("GET", urls, body) 1582 if err != nil { 1583 return nil, err 1584 } 1585 req.Header = reqHeaders 1586 googleapi.Expand(req.URL, map[string]string{ 1587 "parent": c.parent, 1588 }) 1589 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1590 } 1591 1592 // Do executes the "cloudscheduler.projects.locations.jobs.list" call. 1593 // Any non-2xx status code is an error. Response headers are in either 1594 // *ListJobsResponse.ServerResponse.Header or (if a response was returned at 1595 // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 1596 // check whether the returned error was because http.StatusNotModified was 1597 // returned. 1598 func (c *ProjectsLocationsJobsListCall) Do(opts ...googleapi.CallOption) (*ListJobsResponse, error) { 1599 gensupport.SetOptions(c.urlParams_, opts...) 1600 res, err := c.doRequest("json") 1601 if res != nil && res.StatusCode == http.StatusNotModified { 1602 if res.Body != nil { 1603 res.Body.Close() 1604 } 1605 return nil, gensupport.WrapError(&googleapi.Error{ 1606 Code: res.StatusCode, 1607 Header: res.Header, 1608 }) 1609 } 1610 if err != nil { 1611 return nil, err 1612 } 1613 defer googleapi.CloseBody(res) 1614 if err := googleapi.CheckResponse(res); err != nil { 1615 return nil, gensupport.WrapError(err) 1616 } 1617 ret := &ListJobsResponse{ 1618 ServerResponse: googleapi.ServerResponse{ 1619 Header: res.Header, 1620 HTTPStatusCode: res.StatusCode, 1621 }, 1622 } 1623 target := &ret 1624 if err := gensupport.DecodeResponse(target, res); err != nil { 1625 return nil, err 1626 } 1627 return ret, nil 1628 } 1629 1630 // Pages invokes f for each page of results. 1631 // A non-nil error returned from f will halt the iteration. 1632 // The provided context supersedes any context provided to the Context method. 1633 func (c *ProjectsLocationsJobsListCall) Pages(ctx context.Context, f func(*ListJobsResponse) error) error { 1634 c.ctx_ = ctx 1635 defer c.PageToken(c.urlParams_.Get("pageToken")) 1636 for { 1637 x, err := c.Do() 1638 if err != nil { 1639 return err 1640 } 1641 if err := f(x); err != nil { 1642 return err 1643 } 1644 if x.NextPageToken == "" { 1645 return nil 1646 } 1647 c.PageToken(x.NextPageToken) 1648 } 1649 } 1650 1651 type ProjectsLocationsJobsPatchCall struct { 1652 s *Service 1653 name string 1654 job *Job 1655 urlParams_ gensupport.URLParams 1656 ctx_ context.Context 1657 header_ http.Header 1658 } 1659 1660 // Patch: Updates a job. If successful, the updated Job is returned. If the job 1661 // does not exist, `NOT_FOUND` is returned. If UpdateJob does not successfully 1662 // return, it is possible for the job to be in an Job.State.UPDATE_FAILED 1663 // state. A job in this state may not be executed. If this happens, retry the 1664 // UpdateJob request until a successful response is received. 1665 // 1666 // - name: Optionally caller-specified in CreateJob, after which it becomes 1667 // output only. The job name. For example: 1668 // `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`. * `PROJECT_ID` 1669 // can contain letters ([A-Za-z]), numbers ([0-9]), hyphens (-), colons (:), 1670 // or periods (.). For more information, see Identifying projects 1671 // (https://cloud.google.com/resource-manager/docs/creating-managing-projects#identifying_projects) 1672 // - `LOCATION_ID` is the canonical ID for the job's location. The list of 1673 // available locations can be obtained by calling ListLocations. For more 1674 // information, see https://cloud.google.com/about/locations/. * `JOB_ID` can 1675 // contain only letters ([A-Za-z]), numbers ([0-9]), hyphens (-), or 1676 // underscores (_). The maximum length is 500 characters. 1677 func (r *ProjectsLocationsJobsService) Patch(name string, job *Job) *ProjectsLocationsJobsPatchCall { 1678 c := &ProjectsLocationsJobsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1679 c.name = name 1680 c.job = job 1681 return c 1682 } 1683 1684 // UpdateMask sets the optional parameter "updateMask": A mask used to specify 1685 // which fields of the job are being updated. 1686 func (c *ProjectsLocationsJobsPatchCall) UpdateMask(updateMask string) *ProjectsLocationsJobsPatchCall { 1687 c.urlParams_.Set("updateMask", updateMask) 1688 return c 1689 } 1690 1691 // Fields allows partial responses to be retrieved. See 1692 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more 1693 // details. 1694 func (c *ProjectsLocationsJobsPatchCall) Fields(s ...googleapi.Field) *ProjectsLocationsJobsPatchCall { 1695 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1696 return c 1697 } 1698 1699 // Context sets the context to be used in this call's Do method. 1700 func (c *ProjectsLocationsJobsPatchCall) Context(ctx context.Context) *ProjectsLocationsJobsPatchCall { 1701 c.ctx_ = ctx 1702 return c 1703 } 1704 1705 // Header returns a http.Header that can be modified by the caller to add 1706 // headers to the request. 1707 func (c *ProjectsLocationsJobsPatchCall) Header() http.Header { 1708 if c.header_ == nil { 1709 c.header_ = make(http.Header) 1710 } 1711 return c.header_ 1712 } 1713 1714 func (c *ProjectsLocationsJobsPatchCall) doRequest(alt string) (*http.Response, error) { 1715 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_) 1716 var body io.Reader = nil 1717 body, err := googleapi.WithoutDataWrapper.JSONReader(c.job) 1718 if err != nil { 1719 return nil, err 1720 } 1721 c.urlParams_.Set("alt", alt) 1722 c.urlParams_.Set("prettyPrint", "false") 1723 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+name}") 1724 urls += "?" + c.urlParams_.Encode() 1725 req, err := http.NewRequest("PATCH", urls, body) 1726 if err != nil { 1727 return nil, err 1728 } 1729 req.Header = reqHeaders 1730 googleapi.Expand(req.URL, map[string]string{ 1731 "name": c.name, 1732 }) 1733 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1734 } 1735 1736 // Do executes the "cloudscheduler.projects.locations.jobs.patch" call. 1737 // Any non-2xx status code is an error. Response headers are in either 1738 // *Job.ServerResponse.Header or (if a response was returned at all) in 1739 // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check 1740 // whether the returned error was because http.StatusNotModified was returned. 1741 func (c *ProjectsLocationsJobsPatchCall) Do(opts ...googleapi.CallOption) (*Job, error) { 1742 gensupport.SetOptions(c.urlParams_, opts...) 1743 res, err := c.doRequest("json") 1744 if res != nil && res.StatusCode == http.StatusNotModified { 1745 if res.Body != nil { 1746 res.Body.Close() 1747 } 1748 return nil, gensupport.WrapError(&googleapi.Error{ 1749 Code: res.StatusCode, 1750 Header: res.Header, 1751 }) 1752 } 1753 if err != nil { 1754 return nil, err 1755 } 1756 defer googleapi.CloseBody(res) 1757 if err := googleapi.CheckResponse(res); err != nil { 1758 return nil, gensupport.WrapError(err) 1759 } 1760 ret := &Job{ 1761 ServerResponse: googleapi.ServerResponse{ 1762 Header: res.Header, 1763 HTTPStatusCode: res.StatusCode, 1764 }, 1765 } 1766 target := &ret 1767 if err := gensupport.DecodeResponse(target, res); err != nil { 1768 return nil, err 1769 } 1770 return ret, nil 1771 } 1772 1773 type ProjectsLocationsJobsPauseCall struct { 1774 s *Service 1775 name string 1776 pausejobrequest *PauseJobRequest 1777 urlParams_ gensupport.URLParams 1778 ctx_ context.Context 1779 header_ http.Header 1780 } 1781 1782 // Pause: Pauses a job. If a job is paused then the system will stop executing 1783 // the job until it is re-enabled via ResumeJob. The state of the job is stored 1784 // in state; if paused it will be set to Job.State.PAUSED. A job must be in 1785 // Job.State.ENABLED to be paused. 1786 // 1787 // - name: The job name. For example: 1788 // `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`. 1789 func (r *ProjectsLocationsJobsService) Pause(name string, pausejobrequest *PauseJobRequest) *ProjectsLocationsJobsPauseCall { 1790 c := &ProjectsLocationsJobsPauseCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1791 c.name = name 1792 c.pausejobrequest = pausejobrequest 1793 return c 1794 } 1795 1796 // Fields allows partial responses to be retrieved. See 1797 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more 1798 // details. 1799 func (c *ProjectsLocationsJobsPauseCall) Fields(s ...googleapi.Field) *ProjectsLocationsJobsPauseCall { 1800 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1801 return c 1802 } 1803 1804 // Context sets the context to be used in this call's Do method. 1805 func (c *ProjectsLocationsJobsPauseCall) Context(ctx context.Context) *ProjectsLocationsJobsPauseCall { 1806 c.ctx_ = ctx 1807 return c 1808 } 1809 1810 // Header returns a http.Header that can be modified by the caller to add 1811 // headers to the request. 1812 func (c *ProjectsLocationsJobsPauseCall) Header() http.Header { 1813 if c.header_ == nil { 1814 c.header_ = make(http.Header) 1815 } 1816 return c.header_ 1817 } 1818 1819 func (c *ProjectsLocationsJobsPauseCall) doRequest(alt string) (*http.Response, error) { 1820 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_) 1821 var body io.Reader = nil 1822 body, err := googleapi.WithoutDataWrapper.JSONReader(c.pausejobrequest) 1823 if err != nil { 1824 return nil, err 1825 } 1826 c.urlParams_.Set("alt", alt) 1827 c.urlParams_.Set("prettyPrint", "false") 1828 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+name}:pause") 1829 urls += "?" + c.urlParams_.Encode() 1830 req, err := http.NewRequest("POST", urls, body) 1831 if err != nil { 1832 return nil, err 1833 } 1834 req.Header = reqHeaders 1835 googleapi.Expand(req.URL, map[string]string{ 1836 "name": c.name, 1837 }) 1838 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1839 } 1840 1841 // Do executes the "cloudscheduler.projects.locations.jobs.pause" call. 1842 // Any non-2xx status code is an error. Response headers are in either 1843 // *Job.ServerResponse.Header or (if a response was returned at all) in 1844 // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check 1845 // whether the returned error was because http.StatusNotModified was returned. 1846 func (c *ProjectsLocationsJobsPauseCall) Do(opts ...googleapi.CallOption) (*Job, error) { 1847 gensupport.SetOptions(c.urlParams_, opts...) 1848 res, err := c.doRequest("json") 1849 if res != nil && res.StatusCode == http.StatusNotModified { 1850 if res.Body != nil { 1851 res.Body.Close() 1852 } 1853 return nil, gensupport.WrapError(&googleapi.Error{ 1854 Code: res.StatusCode, 1855 Header: res.Header, 1856 }) 1857 } 1858 if err != nil { 1859 return nil, err 1860 } 1861 defer googleapi.CloseBody(res) 1862 if err := googleapi.CheckResponse(res); err != nil { 1863 return nil, gensupport.WrapError(err) 1864 } 1865 ret := &Job{ 1866 ServerResponse: googleapi.ServerResponse{ 1867 Header: res.Header, 1868 HTTPStatusCode: res.StatusCode, 1869 }, 1870 } 1871 target := &ret 1872 if err := gensupport.DecodeResponse(target, res); err != nil { 1873 return nil, err 1874 } 1875 return ret, nil 1876 } 1877 1878 type ProjectsLocationsJobsResumeCall struct { 1879 s *Service 1880 name string 1881 resumejobrequest *ResumeJobRequest 1882 urlParams_ gensupport.URLParams 1883 ctx_ context.Context 1884 header_ http.Header 1885 } 1886 1887 // Resume: Resume a job. This method reenables a job after it has been 1888 // Job.State.PAUSED. The state of a job is stored in Job.state; after calling 1889 // this method it will be set to Job.State.ENABLED. A job must be in 1890 // Job.State.PAUSED to be resumed. 1891 // 1892 // - name: The job name. For example: 1893 // `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`. 1894 func (r *ProjectsLocationsJobsService) Resume(name string, resumejobrequest *ResumeJobRequest) *ProjectsLocationsJobsResumeCall { 1895 c := &ProjectsLocationsJobsResumeCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1896 c.name = name 1897 c.resumejobrequest = resumejobrequest 1898 return c 1899 } 1900 1901 // Fields allows partial responses to be retrieved. See 1902 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more 1903 // details. 1904 func (c *ProjectsLocationsJobsResumeCall) Fields(s ...googleapi.Field) *ProjectsLocationsJobsResumeCall { 1905 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1906 return c 1907 } 1908 1909 // Context sets the context to be used in this call's Do method. 1910 func (c *ProjectsLocationsJobsResumeCall) Context(ctx context.Context) *ProjectsLocationsJobsResumeCall { 1911 c.ctx_ = ctx 1912 return c 1913 } 1914 1915 // Header returns a http.Header that can be modified by the caller to add 1916 // headers to the request. 1917 func (c *ProjectsLocationsJobsResumeCall) Header() http.Header { 1918 if c.header_ == nil { 1919 c.header_ = make(http.Header) 1920 } 1921 return c.header_ 1922 } 1923 1924 func (c *ProjectsLocationsJobsResumeCall) doRequest(alt string) (*http.Response, error) { 1925 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_) 1926 var body io.Reader = nil 1927 body, err := googleapi.WithoutDataWrapper.JSONReader(c.resumejobrequest) 1928 if err != nil { 1929 return nil, err 1930 } 1931 c.urlParams_.Set("alt", alt) 1932 c.urlParams_.Set("prettyPrint", "false") 1933 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+name}:resume") 1934 urls += "?" + c.urlParams_.Encode() 1935 req, err := http.NewRequest("POST", urls, body) 1936 if err != nil { 1937 return nil, err 1938 } 1939 req.Header = reqHeaders 1940 googleapi.Expand(req.URL, map[string]string{ 1941 "name": c.name, 1942 }) 1943 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1944 } 1945 1946 // Do executes the "cloudscheduler.projects.locations.jobs.resume" call. 1947 // Any non-2xx status code is an error. Response headers are in either 1948 // *Job.ServerResponse.Header or (if a response was returned at all) in 1949 // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check 1950 // whether the returned error was because http.StatusNotModified was returned. 1951 func (c *ProjectsLocationsJobsResumeCall) Do(opts ...googleapi.CallOption) (*Job, error) { 1952 gensupport.SetOptions(c.urlParams_, opts...) 1953 res, err := c.doRequest("json") 1954 if res != nil && res.StatusCode == http.StatusNotModified { 1955 if res.Body != nil { 1956 res.Body.Close() 1957 } 1958 return nil, gensupport.WrapError(&googleapi.Error{ 1959 Code: res.StatusCode, 1960 Header: res.Header, 1961 }) 1962 } 1963 if err != nil { 1964 return nil, err 1965 } 1966 defer googleapi.CloseBody(res) 1967 if err := googleapi.CheckResponse(res); err != nil { 1968 return nil, gensupport.WrapError(err) 1969 } 1970 ret := &Job{ 1971 ServerResponse: googleapi.ServerResponse{ 1972 Header: res.Header, 1973 HTTPStatusCode: res.StatusCode, 1974 }, 1975 } 1976 target := &ret 1977 if err := gensupport.DecodeResponse(target, res); err != nil { 1978 return nil, err 1979 } 1980 return ret, nil 1981 } 1982 1983 type ProjectsLocationsJobsRunCall struct { 1984 s *Service 1985 name string 1986 runjobrequest *RunJobRequest 1987 urlParams_ gensupport.URLParams 1988 ctx_ context.Context 1989 header_ http.Header 1990 } 1991 1992 // Run: Forces a job to run now. When this method is called, Cloud Scheduler 1993 // will dispatch the job, even if the job is already running. 1994 // 1995 // - name: The job name. For example: 1996 // `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`. 1997 func (r *ProjectsLocationsJobsService) Run(name string, runjobrequest *RunJobRequest) *ProjectsLocationsJobsRunCall { 1998 c := &ProjectsLocationsJobsRunCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1999 c.name = name 2000 c.runjobrequest = runjobrequest 2001 return c 2002 } 2003 2004 // Fields allows partial responses to be retrieved. See 2005 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more 2006 // details. 2007 func (c *ProjectsLocationsJobsRunCall) Fields(s ...googleapi.Field) *ProjectsLocationsJobsRunCall { 2008 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2009 return c 2010 } 2011 2012 // Context sets the context to be used in this call's Do method. 2013 func (c *ProjectsLocationsJobsRunCall) Context(ctx context.Context) *ProjectsLocationsJobsRunCall { 2014 c.ctx_ = ctx 2015 return c 2016 } 2017 2018 // Header returns a http.Header that can be modified by the caller to add 2019 // headers to the request. 2020 func (c *ProjectsLocationsJobsRunCall) Header() http.Header { 2021 if c.header_ == nil { 2022 c.header_ = make(http.Header) 2023 } 2024 return c.header_ 2025 } 2026 2027 func (c *ProjectsLocationsJobsRunCall) doRequest(alt string) (*http.Response, error) { 2028 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_) 2029 var body io.Reader = nil 2030 body, err := googleapi.WithoutDataWrapper.JSONReader(c.runjobrequest) 2031 if err != nil { 2032 return nil, err 2033 } 2034 c.urlParams_.Set("alt", alt) 2035 c.urlParams_.Set("prettyPrint", "false") 2036 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+name}:run") 2037 urls += "?" + c.urlParams_.Encode() 2038 req, err := http.NewRequest("POST", urls, body) 2039 if err != nil { 2040 return nil, err 2041 } 2042 req.Header = reqHeaders 2043 googleapi.Expand(req.URL, map[string]string{ 2044 "name": c.name, 2045 }) 2046 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2047 } 2048 2049 // Do executes the "cloudscheduler.projects.locations.jobs.run" call. 2050 // Any non-2xx status code is an error. Response headers are in either 2051 // *Job.ServerResponse.Header or (if a response was returned at all) in 2052 // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check 2053 // whether the returned error was because http.StatusNotModified was returned. 2054 func (c *ProjectsLocationsJobsRunCall) Do(opts ...googleapi.CallOption) (*Job, error) { 2055 gensupport.SetOptions(c.urlParams_, opts...) 2056 res, err := c.doRequest("json") 2057 if res != nil && res.StatusCode == http.StatusNotModified { 2058 if res.Body != nil { 2059 res.Body.Close() 2060 } 2061 return nil, gensupport.WrapError(&googleapi.Error{ 2062 Code: res.StatusCode, 2063 Header: res.Header, 2064 }) 2065 } 2066 if err != nil { 2067 return nil, err 2068 } 2069 defer googleapi.CloseBody(res) 2070 if err := googleapi.CheckResponse(res); err != nil { 2071 return nil, gensupport.WrapError(err) 2072 } 2073 ret := &Job{ 2074 ServerResponse: googleapi.ServerResponse{ 2075 Header: res.Header, 2076 HTTPStatusCode: res.StatusCode, 2077 }, 2078 } 2079 target := &ret 2080 if err := gensupport.DecodeResponse(target, res); err != nil { 2081 return nil, err 2082 } 2083 return ret, nil 2084 } 2085