You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

2728 lines
91 KiB

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