No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
 
 
 

6101 líneas
212 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 cloudtasks provides access to the Cloud Tasks API.
  6. //
  7. // This package is DEPRECATED. Use package cloud.google.com/go/cloudtasks/apiv2beta2 instead.
  8. //
  9. // For product documentation, see: https://cloud.google.com/tasks/
  10. //
  11. // Creating a client
  12. //
  13. // Usage example:
  14. //
  15. // import "google.golang.org/api/cloudtasks/v2beta2"
  16. // ...
  17. // ctx := context.Background()
  18. // cloudtasksService, err := cloudtasks.NewService(ctx)
  19. //
  20. // In this example, Google Application Default Credentials are used for authentication.
  21. //
  22. // For information on how to create and obtain Application Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials.
  23. //
  24. // Other authentication options
  25. //
  26. // To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey:
  27. //
  28. // cloudtasksService, err := cloudtasks.NewService(ctx, option.WithAPIKey("AIza..."))
  29. //
  30. // To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource:
  31. //
  32. // config := &oauth2.Config{...}
  33. // // ...
  34. // token, err := config.Exchange(ctx, ...)
  35. // cloudtasksService, err := cloudtasks.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
  36. //
  37. // See https://godoc.org/google.golang.org/api/option/ for details on options.
  38. package cloudtasks // import "google.golang.org/api/cloudtasks/v2beta2"
  39. import (
  40. "bytes"
  41. "context"
  42. "encoding/json"
  43. "errors"
  44. "fmt"
  45. "io"
  46. "net/http"
  47. "net/url"
  48. "strconv"
  49. "strings"
  50. gensupport "google.golang.org/api/gensupport"
  51. googleapi "google.golang.org/api/googleapi"
  52. option "google.golang.org/api/option"
  53. htransport "google.golang.org/api/transport/http"
  54. )
  55. // Always reference these packages, just in case the auto-generated code
  56. // below doesn't.
  57. var _ = bytes.NewBuffer
  58. var _ = strconv.Itoa
  59. var _ = fmt.Sprintf
  60. var _ = json.NewDecoder
  61. var _ = io.Copy
  62. var _ = url.Parse
  63. var _ = gensupport.MarshalJSON
  64. var _ = googleapi.Version
  65. var _ = errors.New
  66. var _ = strings.Replace
  67. var _ = context.Canceled
  68. const apiId = "cloudtasks:v2beta2"
  69. const apiName = "cloudtasks"
  70. const apiVersion = "v2beta2"
  71. const basePath = "https://cloudtasks.googleapis.com/"
  72. // OAuth2 scopes used by this API.
  73. const (
  74. // View and manage your data across Google Cloud Platform services
  75. CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform"
  76. )
  77. // NewService creates a new Service.
  78. func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
  79. scopesOption := option.WithScopes(
  80. "https://www.googleapis.com/auth/cloud-platform",
  81. )
  82. // NOTE: prepend, so we don't override user-specified scopes.
  83. opts = append([]option.ClientOption{scopesOption}, opts...)
  84. client, endpoint, err := htransport.NewClient(ctx, opts...)
  85. if err != nil {
  86. return nil, err
  87. }
  88. s, err := New(client)
  89. if err != nil {
  90. return nil, err
  91. }
  92. if endpoint != "" {
  93. s.BasePath = endpoint
  94. }
  95. return s, nil
  96. }
  97. // New creates a new Service. It uses the provided http.Client for requests.
  98. //
  99. // Deprecated: please use NewService instead.
  100. // To provide a custom HTTP client, use option.WithHTTPClient.
  101. // If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
  102. func New(client *http.Client) (*Service, error) {
  103. if client == nil {
  104. return nil, errors.New("client is nil")
  105. }
  106. s := &Service{client: client, BasePath: basePath}
  107. s.Projects = NewProjectsService(s)
  108. return s, nil
  109. }
  110. type Service struct {
  111. client *http.Client
  112. BasePath string // API endpoint base URL
  113. UserAgent string // optional additional User-Agent fragment
  114. Projects *ProjectsService
  115. }
  116. func (s *Service) userAgent() string {
  117. if s.UserAgent == "" {
  118. return googleapi.UserAgent
  119. }
  120. return googleapi.UserAgent + " " + s.UserAgent
  121. }
  122. func NewProjectsService(s *Service) *ProjectsService {
  123. rs := &ProjectsService{s: s}
  124. rs.Locations = NewProjectsLocationsService(s)
  125. return rs
  126. }
  127. type ProjectsService struct {
  128. s *Service
  129. Locations *ProjectsLocationsService
  130. }
  131. func NewProjectsLocationsService(s *Service) *ProjectsLocationsService {
  132. rs := &ProjectsLocationsService{s: s}
  133. rs.Queues = NewProjectsLocationsQueuesService(s)
  134. return rs
  135. }
  136. type ProjectsLocationsService struct {
  137. s *Service
  138. Queues *ProjectsLocationsQueuesService
  139. }
  140. func NewProjectsLocationsQueuesService(s *Service) *ProjectsLocationsQueuesService {
  141. rs := &ProjectsLocationsQueuesService{s: s}
  142. rs.Tasks = NewProjectsLocationsQueuesTasksService(s)
  143. return rs
  144. }
  145. type ProjectsLocationsQueuesService struct {
  146. s *Service
  147. Tasks *ProjectsLocationsQueuesTasksService
  148. }
  149. func NewProjectsLocationsQueuesTasksService(s *Service) *ProjectsLocationsQueuesTasksService {
  150. rs := &ProjectsLocationsQueuesTasksService{s: s}
  151. return rs
  152. }
  153. type ProjectsLocationsQueuesTasksService struct {
  154. s *Service
  155. }
  156. // AcknowledgeTaskRequest: Request message for acknowledging a task
  157. // using
  158. // AcknowledgeTask.
  159. type AcknowledgeTaskRequest struct {
  160. // ScheduleTime: Required.
  161. //
  162. // The task's current schedule time, available in the
  163. // schedule_time returned by
  164. // LeaseTasks response or
  165. // RenewLease response. This restriction is
  166. // to ensure that your worker currently holds the lease.
  167. ScheduleTime string `json:"scheduleTime,omitempty"`
  168. // ForceSendFields is a list of field names (e.g. "ScheduleTime") to
  169. // unconditionally include in API requests. By default, fields with
  170. // empty values are omitted from API requests. However, any non-pointer,
  171. // non-interface field appearing in ForceSendFields will be sent to the
  172. // server regardless of whether the field is empty or not. This may be
  173. // used to include empty fields in Patch requests.
  174. ForceSendFields []string `json:"-"`
  175. // NullFields is a list of field names (e.g. "ScheduleTime") to include
  176. // in API requests with the JSON null value. By default, fields with
  177. // empty values are omitted from API requests. However, any field with
  178. // an empty value appearing in NullFields will be sent to the server as
  179. // null. It is an error if a field in this list has a non-empty value.
  180. // This may be used to include null fields in Patch requests.
  181. NullFields []string `json:"-"`
  182. }
  183. func (s *AcknowledgeTaskRequest) MarshalJSON() ([]byte, error) {
  184. type NoMethod AcknowledgeTaskRequest
  185. raw := NoMethod(*s)
  186. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  187. }
  188. // AppEngineHttpRequest: App Engine HTTP request.
  189. //
  190. // The message defines the HTTP request that is sent to an App Engine
  191. // app when
  192. // the task is dispatched.
  193. //
  194. // This proto can only be used for tasks in a queue which
  195. // has
  196. // app_engine_http_target set.
  197. //
  198. // Using AppEngineHttpRequest
  199. // requires
  200. // [`appengine.applications.get`](https://cloud.google.com/appen
  201. // gine/docs/admin-api/access-control)
  202. // Google IAM permission for the project
  203. // and the following
  204. // scope:
  205. //
  206. // `https://www.googleapis.com/auth/cloud-platform`
  207. //
  208. // The task will be delivered to the App Engine app which belongs to the
  209. // same
  210. // project as the queue. For more information, see
  211. // [How Requests are
  212. // Routed](https://cloud.google.com/appengine/docs/standard/python/how-re
  213. // quests-are-routed)
  214. // and how routing is affected by
  215. // [dispatch
  216. // files](https://cloud.google.com/appengine/docs/python/config/dispatchr
  217. // ef).
  218. // Traffic is encrypted during transport and never leaves Google
  219. // datacenters.
  220. // Because this traffic is carried over a communication mechanism
  221. // internal to
  222. // Google, you cannot explicitly set the protocol (for example, HTTP or
  223. // HTTPS).
  224. // The request to the handler, however, will appear to have used the
  225. // HTTP
  226. // protocol.
  227. //
  228. // The AppEngineRouting used to construct the URL that the task
  229. // is
  230. // delivered to can be set at the queue-level or task-level:
  231. //
  232. // * If set,
  233. // app_engine_routing_override
  234. // is used for all tasks in the queue, no matter what the setting
  235. // is for the
  236. // task-level app_engine_routing.
  237. //
  238. //
  239. // The `url` that the task will be sent to is:
  240. //
  241. // * `url =` host `+`
  242. // relative_url
  243. //
  244. // Tasks can be dispatched to secure app handlers, unsecure app
  245. // handlers, and
  246. // URIs restricted with
  247. // [`login:
  248. // admin`](https://cloud.google.com/appengine/docs/standard/python/config
  249. // /appref).
  250. // Because tasks are not run as any user, they cannot be dispatched to
  251. // URIs
  252. // restricted with
  253. // [`login:
  254. // required`](https://cloud.google.com/appengine/docs/standard/python/con
  255. // fig/appref)
  256. // Task dispatches also do not follow redirects.
  257. //
  258. // The task attempt has succeeded if the app's request handler
  259. // returns
  260. // an HTTP response code in the range [`200` - `299`]. `503`
  261. // is
  262. // considered an App Engine system error instead of an
  263. // application
  264. // error. Requests returning error `503` will be retried regardless
  265. // of
  266. // retry configuration and not counted against retry counts.
  267. // Any other response code or a failure to receive a response before
  268. // the
  269. // deadline is a failed attempt.
  270. type AppEngineHttpRequest struct {
  271. // AppEngineRouting: Task-level setting for App Engine routing.
  272. //
  273. // If set,
  274. // app_engine_routing_override
  275. // is used for all tasks in the queue, no matter what the setting is for
  276. // the
  277. // task-level app_engine_routing.
  278. AppEngineRouting *AppEngineRouting `json:"appEngineRouting,omitempty"`
  279. // Headers: HTTP request headers.
  280. //
  281. // This map contains the header field names and values.
  282. // Headers can be set when the
  283. // task is created.
  284. // Repeated headers are not supported but a header value can contain
  285. // commas.
  286. //
  287. // Cloud Tasks sets some headers to default values:
  288. //
  289. // * `User-Agent`: By default, this header is
  290. // "AppEngine-Google; (+http://code.google.com/appengine)".
  291. // This header can be modified, but Cloud Tasks will append
  292. // "AppEngine-Google; (+http://code.google.com/appengine)" to the
  293. // modified `User-Agent`.
  294. //
  295. // If the task has a payload, Cloud
  296. // Tasks sets the following headers:
  297. //
  298. // * `Content-Type`: By default, the `Content-Type` header is set to
  299. // "application/octet-stream". The default can be overridden by
  300. // explicitly
  301. // setting `Content-Type` to a particular media type when the
  302. // task is created.
  303. // For example, `Content-Type` can be set to "application/json".
  304. // * `Content-Length`: This is computed by Cloud Tasks. This value is
  305. // output only. It cannot be changed.
  306. //
  307. // The headers below cannot be set or overridden:
  308. //
  309. // * `Host`
  310. // * `X-Google-*`
  311. // * `X-AppEngine-*`
  312. //
  313. // In addition, Cloud Tasks sets some headers when the task is
  314. // dispatched,
  315. // such as headers containing information about the task; see
  316. // [request
  317. // headers](https://cloud.google.com/appengine/docs/python/taskqueue/push
  318. // /creating-handlers#reading_request_headers).
  319. // These headers are set only when the task is dispatched, so they are
  320. // not
  321. // visible when the task is returned in a Cloud Tasks
  322. // response.
  323. //
  324. // Although there is no specific limit for the maximum number of headers
  325. // or
  326. // the size, there is a limit on the maximum size of the Task. For
  327. // more
  328. // information, see the CreateTask documentation.
  329. Headers map[string]string `json:"headers,omitempty"`
  330. // HttpMethod: The HTTP method to use for the request. The default is
  331. // POST.
  332. //
  333. // The app's request handler for the task's target URL must be able to
  334. // handle
  335. // HTTP requests with this http_method, otherwise the task attempt will
  336. // fail
  337. // with error code 405 (Method Not Allowed). See
  338. // [Writing a push task request
  339. // handler](https://cloud.google.com/appengine/docs/java/taskqueue/push/c
  340. // reating-handlers#writing_a_push_task_request_handler)
  341. // and the documentation for the request handlers in the language your
  342. // app is
  343. // written in e.g.
  344. // [Python Request
  345. // Handler](https://cloud.google.com/appengine/docs/python/tools/webapp/r
  346. // equesthandlerclass).
  347. //
  348. // Possible values:
  349. // "HTTP_METHOD_UNSPECIFIED" - HTTP method unspecified
  350. // "POST" - HTTP POST
  351. // "GET" - HTTP GET
  352. // "HEAD" - HTTP HEAD
  353. // "PUT" - HTTP PUT
  354. // "DELETE" - HTTP DELETE
  355. HttpMethod string `json:"httpMethod,omitempty"`
  356. // Payload: Payload.
  357. //
  358. // The payload will be sent as the HTTP message body. A message
  359. // body, and thus a payload, is allowed only if the HTTP method is
  360. // POST or PUT. It is an error to set a data payload on a task with
  361. // an incompatible HttpMethod.
  362. Payload string `json:"payload,omitempty"`
  363. // RelativeUrl: The relative URL.
  364. //
  365. // The relative URL must begin with "/" and must be a valid HTTP
  366. // relative URL.
  367. // It can contain a path and query string arguments.
  368. // If the relative URL is empty, then the root path "/" will be used.
  369. // No spaces are allowed, and the maximum length allowed is 2083
  370. // characters.
  371. RelativeUrl string `json:"relativeUrl,omitempty"`
  372. // ForceSendFields is a list of field names (e.g. "AppEngineRouting") 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. "AppEngineRouting") to
  380. // include in API requests with the JSON null value. By default, fields
  381. // with empty values are omitted from API requests. However, any field
  382. // with an empty value appearing in NullFields will be sent to the
  383. // server as null. It is an error if a field in this list has a
  384. // non-empty value. This may be used to include null fields in Patch
  385. // requests.
  386. NullFields []string `json:"-"`
  387. }
  388. func (s *AppEngineHttpRequest) MarshalJSON() ([]byte, error) {
  389. type NoMethod AppEngineHttpRequest
  390. raw := NoMethod(*s)
  391. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  392. }
  393. // AppEngineHttpTarget: App Engine HTTP target.
  394. //
  395. // The task will be delivered to the App Engine application
  396. // hostname
  397. // specified by its AppEngineHttpTarget and AppEngineHttpRequest.
  398. // The documentation for AppEngineHttpRequest explains how the
  399. // task's host URL is constructed.
  400. //
  401. // Using AppEngineHttpTarget
  402. // requires
  403. // [`appengine.applications.get`](https://cloud.google.com/appen
  404. // gine/docs/admin-api/access-control)
  405. // Google IAM permission for the project
  406. // and the following
  407. // scope:
  408. //
  409. // `https://www.googleapis.com/auth/cloud-platform`
  410. type AppEngineHttpTarget struct {
  411. // AppEngineRoutingOverride: Overrides for the
  412. // task-level app_engine_routing.
  413. //
  414. // If set, `app_engine_routing_override` is used for all tasks in
  415. // the queue, no matter what the setting is for the
  416. // task-level app_engine_routing.
  417. AppEngineRoutingOverride *AppEngineRouting `json:"appEngineRoutingOverride,omitempty"`
  418. // ForceSendFields is a list of field names (e.g.
  419. // "AppEngineRoutingOverride") to unconditionally include in API
  420. // requests. By default, fields with empty values are omitted from API
  421. // requests. However, any non-pointer, non-interface field appearing in
  422. // ForceSendFields will be sent to the server regardless of whether the
  423. // field is empty or not. This may be used to include empty fields in
  424. // Patch requests.
  425. ForceSendFields []string `json:"-"`
  426. // NullFields is a list of field names (e.g. "AppEngineRoutingOverride")
  427. // to include in API requests with the JSON null value. By default,
  428. // fields with empty values are omitted from API requests. However, any
  429. // field with an empty value appearing in NullFields will be sent to the
  430. // server as null. It is an error if a field in this list has a
  431. // non-empty value. This may be used to include null fields in Patch
  432. // requests.
  433. NullFields []string `json:"-"`
  434. }
  435. func (s *AppEngineHttpTarget) MarshalJSON() ([]byte, error) {
  436. type NoMethod AppEngineHttpTarget
  437. raw := NoMethod(*s)
  438. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  439. }
  440. // AppEngineRouting: App Engine Routing.
  441. //
  442. // Defines routing characteristics specific to App Engine - service,
  443. // version,
  444. // and instance.
  445. //
  446. // For more information about services, versions, and instances see
  447. // [An Overview of App
  448. // Engine](https://cloud.google.com/appengine/docs/python/an-overview-of-
  449. // app-engine),
  450. // [Microservices Architecture on Google App
  451. // Engine](https://cloud.google.com/appengine/docs/python/microservices-o
  452. // n-app-engine),
  453. // [App Engine Standard request
  454. // routing](https://cloud.google.com/appengine/docs/standard/python/how-r
  455. // equests-are-routed),
  456. // and [App Engine Flex request
  457. // routing](https://cloud.google.com/appengine/docs/flexible/python/how-r
  458. // equests-are-routed).
  459. type AppEngineRouting struct {
  460. // Host: Output only. The host that the task is sent to.
  461. //
  462. // For more information, see
  463. // [How Requests are
  464. // Routed](https://cloud.google.com/appengine/docs/standard/python/how-re
  465. // quests-are-routed).
  466. //
  467. // The host is constructed as:
  468. //
  469. //
  470. // * `host = [application_domain_name]`</br>
  471. // `| [service] + '.' + [application_domain_name]`</br>
  472. // `| [version] + '.' + [application_domain_name]`</br>
  473. // `| [version_dot_service]+ '.' + [application_domain_name]`</br>
  474. // `| [instance] + '.' + [application_domain_name]`</br>
  475. // `| [instance_dot_service] + '.' + [application_domain_name]`</br>
  476. // `| [instance_dot_version] + '.' + [application_domain_name]`</br>
  477. // `| [instance_dot_version_dot_service] + '.' +
  478. // [application_domain_name]`
  479. //
  480. // * `application_domain_name` = The domain name of the app, for
  481. // example <app-id>.appspot.com, which is associated with the
  482. // queue's project ID. Some tasks which were created using the App
  483. // Engine
  484. // SDK use a custom domain name.
  485. //
  486. // * `service =` service
  487. //
  488. // * `version =` version
  489. //
  490. // * `version_dot_service =`
  491. // version `+ '.' +`
  492. // service
  493. //
  494. // * `instance =` instance
  495. //
  496. // * `instance_dot_service =`
  497. // instance `+ '.' +`
  498. // service
  499. //
  500. // * `instance_dot_version =`
  501. // instance `+ '.' +`
  502. // version
  503. //
  504. // * `instance_dot_version_dot_service =`
  505. // instance `+ '.' +`
  506. // version `+ '.' +`
  507. // service
  508. //
  509. // If service is empty, then the task will be sent
  510. // to the service which is the default service when the task is
  511. // attempted.
  512. //
  513. // If version is empty, then the task will be sent
  514. // to the version which is the default version when the task is
  515. // attempted.
  516. //
  517. // If instance is empty, then the task
  518. // will be sent to an instance which is available when the task
  519. // is
  520. // attempted.
  521. //
  522. // If service,
  523. // version, or
  524. // instance is invalid, then the task
  525. // will be sent to the default version of the default service when
  526. // the task is attempted.
  527. Host string `json:"host,omitempty"`
  528. // Instance: App instance.
  529. //
  530. // By default, the task is sent to an instance which is available
  531. // when
  532. // the task is attempted.
  533. //
  534. // Requests can only be sent to a specific instance if
  535. // [manual scaling is used in App Engine
  536. // Standard](https://cloud.google.com/appengine/docs/python/an-overview-o
  537. // f-app-engine?hl=en_US#scaling_types_and_instance_classes).
  538. // App Engine Flex does not support instances. For more information,
  539. // see
  540. // [App Engine Standard request
  541. // routing](https://cloud.google.com/appengine/docs/standard/python/how-r
  542. // equests-are-routed)
  543. // and [App Engine Flex request
  544. // routing](https://cloud.google.com/appengine/docs/flexible/python/how-r
  545. // equests-are-routed).
  546. Instance string `json:"instance,omitempty"`
  547. // Service: App service.
  548. //
  549. // By default, the task is sent to the service which is the
  550. // default
  551. // service when the task is attempted.
  552. //
  553. // For some queues or tasks which were created using the App Engine
  554. // Task Queue API, host is not parsable
  555. // into service,
  556. // version, and
  557. // instance. For example, some tasks
  558. // which were created using the App Engine SDK use a custom domain
  559. // name; custom domains are not parsed by Cloud Tasks. If
  560. // host is not parsable, then
  561. // service,
  562. // version, and
  563. // instance are the empty string.
  564. Service string `json:"service,omitempty"`
  565. // Version: App version.
  566. //
  567. // By default, the task is sent to the version which is the
  568. // default
  569. // version when the task is attempted.
  570. //
  571. // For some queues or tasks which were created using the App Engine
  572. // Task Queue API, host is not parsable
  573. // into service,
  574. // version, and
  575. // instance. For example, some tasks
  576. // which were created using the App Engine SDK use a custom domain
  577. // name; custom domains are not parsed by Cloud Tasks. If
  578. // host is not parsable, then
  579. // service,
  580. // version, and
  581. // instance are the empty string.
  582. Version string `json:"version,omitempty"`
  583. // ForceSendFields is a list of field names (e.g. "Host") to
  584. // unconditionally include in API requests. By default, fields with
  585. // empty values are omitted from API requests. However, any non-pointer,
  586. // non-interface field appearing in ForceSendFields will be sent to the
  587. // server regardless of whether the field is empty or not. This may be
  588. // used to include empty fields in Patch requests.
  589. ForceSendFields []string `json:"-"`
  590. // NullFields is a list of field names (e.g. "Host") to include in API
  591. // requests with the JSON null value. By default, fields with empty
  592. // values are omitted from API requests. However, any field with an
  593. // empty value appearing in NullFields will be sent to the server as
  594. // null. It is an error if a field in this list has a non-empty value.
  595. // This may be used to include null fields in Patch requests.
  596. NullFields []string `json:"-"`
  597. }
  598. func (s *AppEngineRouting) MarshalJSON() ([]byte, error) {
  599. type NoMethod AppEngineRouting
  600. raw := NoMethod(*s)
  601. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  602. }
  603. // AttemptStatus: The status of a task attempt.
  604. type AttemptStatus struct {
  605. // DispatchTime: Output only. The time that this attempt was
  606. // dispatched.
  607. //
  608. // `dispatch_time` will be truncated to the nearest microsecond.
  609. DispatchTime string `json:"dispatchTime,omitempty"`
  610. // ResponseStatus: Output only. The response from the target for this
  611. // attempt.
  612. //
  613. // If the task has not been attempted or the task is currently
  614. // running
  615. // then the response status is unset.
  616. ResponseStatus *Status `json:"responseStatus,omitempty"`
  617. // ResponseTime: Output only. The time that this attempt response was
  618. // received.
  619. //
  620. // `response_time` will be truncated to the nearest microsecond.
  621. ResponseTime string `json:"responseTime,omitempty"`
  622. // ScheduleTime: Output only. The time that this attempt was
  623. // scheduled.
  624. //
  625. // `schedule_time` will be truncated to the nearest microsecond.
  626. ScheduleTime string `json:"scheduleTime,omitempty"`
  627. // ForceSendFields is a list of field names (e.g. "DispatchTime") to
  628. // unconditionally include in API requests. By default, fields with
  629. // empty values are omitted from API requests. However, any non-pointer,
  630. // non-interface field appearing in ForceSendFields will be sent to the
  631. // server regardless of whether the field is empty or not. This may be
  632. // used to include empty fields in Patch requests.
  633. ForceSendFields []string `json:"-"`
  634. // NullFields is a list of field names (e.g. "DispatchTime") to include
  635. // in API requests with the JSON null value. By default, fields with
  636. // empty values are omitted from API requests. However, any field with
  637. // an empty value appearing in NullFields will be sent to the server as
  638. // null. It is an error if a field in this list has a non-empty value.
  639. // This may be used to include null fields in Patch requests.
  640. NullFields []string `json:"-"`
  641. }
  642. func (s *AttemptStatus) MarshalJSON() ([]byte, error) {
  643. type NoMethod AttemptStatus
  644. raw := NoMethod(*s)
  645. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  646. }
  647. // Binding: Associates `members` with a `role`.
  648. type Binding struct {
  649. // Condition: Unimplemented. The condition that is associated with this
  650. // binding.
  651. // NOTE: an unsatisfied condition will not allow user access via
  652. // current
  653. // binding. Different bindings, including their conditions, are
  654. // examined
  655. // independently.
  656. Condition *Expr `json:"condition,omitempty"`
  657. // Members: Specifies the identities requesting access for a Cloud
  658. // Platform resource.
  659. // `members` can have the following values:
  660. //
  661. // * `allUsers`: A special identifier that represents anyone who is
  662. // on the internet; with or without a Google account.
  663. //
  664. // * `allAuthenticatedUsers`: A special identifier that represents
  665. // anyone
  666. // who is authenticated with a Google account or a service
  667. // account.
  668. //
  669. // * `user:{emailid}`: An email address that represents a specific
  670. // Google
  671. // account. For example, `alice@gmail.com` .
  672. //
  673. //
  674. // * `serviceAccount:{emailid}`: An email address that represents a
  675. // service
  676. // account. For example,
  677. // `my-other-app@appspot.gserviceaccount.com`.
  678. //
  679. // * `group:{emailid}`: An email address that represents a Google
  680. // group.
  681. // For example, `admins@example.com`.
  682. //
  683. //
  684. // * `domain:{domain}`: The G Suite domain (primary) that represents all
  685. // the
  686. // users of that domain. For example, `google.com` or
  687. // `example.com`.
  688. //
  689. //
  690. Members []string `json:"members,omitempty"`
  691. // Role: Role that is assigned to `members`.
  692. // For example, `roles/viewer`, `roles/editor`, or `roles/owner`.
  693. Role string `json:"role,omitempty"`
  694. // ForceSendFields is a list of field names (e.g. "Condition") to
  695. // unconditionally include in API requests. By default, fields with
  696. // empty values are omitted from API requests. However, any non-pointer,
  697. // non-interface field appearing in ForceSendFields will be sent to the
  698. // server regardless of whether the field is empty or not. This may be
  699. // used to include empty fields in Patch requests.
  700. ForceSendFields []string `json:"-"`
  701. // NullFields is a list of field names (e.g. "Condition") to include in
  702. // API requests with the JSON null value. By default, fields with empty
  703. // values are omitted from API requests. However, any field with an
  704. // empty value appearing in NullFields will be sent to the server as
  705. // null. It is an error if a field in this list has a non-empty value.
  706. // This may be used to include null fields in Patch requests.
  707. NullFields []string `json:"-"`
  708. }
  709. func (s *Binding) MarshalJSON() ([]byte, error) {
  710. type NoMethod Binding
  711. raw := NoMethod(*s)
  712. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  713. }
  714. // CancelLeaseRequest: Request message for canceling a lease
  715. // using
  716. // CancelLease.
  717. type CancelLeaseRequest struct {
  718. // ResponseView: The response_view specifies which subset of the Task
  719. // will be
  720. // returned.
  721. //
  722. // By default response_view is BASIC; not all
  723. // information is retrieved by default because some data, such
  724. // as
  725. // payloads, might be desirable to return only when needed because
  726. // of its large size or because of the sensitivity of data that
  727. // it
  728. // contains.
  729. //
  730. // Authorization for FULL requires
  731. // `cloudtasks.tasks.fullView` [Google
  732. // IAM](https://cloud.google.com/iam/)
  733. // permission on the Task resource.
  734. //
  735. // Possible values:
  736. // "VIEW_UNSPECIFIED" - Unspecified. Defaults to BASIC.
  737. // "BASIC" - The basic view omits fields which can be large or can
  738. // contain
  739. // sensitive data.
  740. //
  741. // This view does not include the
  742. // (payload in AppEngineHttpRequest and
  743. // payload in PullMessage). These payloads are
  744. // desirable to return only when needed, because they can be large
  745. // and because of the sensitivity of the data that you choose to
  746. // store in it.
  747. // "FULL" - All information is returned.
  748. //
  749. // Authorization for FULL requires
  750. // `cloudtasks.tasks.fullView` [Google
  751. // IAM](https://cloud.google.com/iam/)
  752. // permission on the Queue resource.
  753. ResponseView string `json:"responseView,omitempty"`
  754. // ScheduleTime: Required.
  755. //
  756. // The task's current schedule time, available in the
  757. // schedule_time returned by
  758. // LeaseTasks response or
  759. // RenewLease response. This restriction is
  760. // to ensure that your worker currently holds the lease.
  761. ScheduleTime string `json:"scheduleTime,omitempty"`
  762. // ForceSendFields is a list of field names (e.g. "ResponseView") to
  763. // unconditionally include in API requests. By default, fields with
  764. // empty values are omitted from API requests. However, any non-pointer,
  765. // non-interface field appearing in ForceSendFields will be sent to the
  766. // server regardless of whether the field is empty or not. This may be
  767. // used to include empty fields in Patch requests.
  768. ForceSendFields []string `json:"-"`
  769. // NullFields is a list of field names (e.g. "ResponseView") to include
  770. // in API requests with the JSON null value. By default, fields with
  771. // empty values are omitted from API requests. However, any field with
  772. // an empty value appearing in NullFields will be sent to the server as
  773. // null. It is an error if a field in this list has a non-empty value.
  774. // This may be used to include null fields in Patch requests.
  775. NullFields []string `json:"-"`
  776. }
  777. func (s *CancelLeaseRequest) MarshalJSON() ([]byte, error) {
  778. type NoMethod CancelLeaseRequest
  779. raw := NoMethod(*s)
  780. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  781. }
  782. // CreateTaskRequest: Request message for CreateTask.
  783. type CreateTaskRequest struct {
  784. // ResponseView: The response_view specifies which subset of the Task
  785. // will be
  786. // returned.
  787. //
  788. // By default response_view is BASIC; not all
  789. // information is retrieved by default because some data, such
  790. // as
  791. // payloads, might be desirable to return only when needed because
  792. // of its large size or because of the sensitivity of data that
  793. // it
  794. // contains.
  795. //
  796. // Authorization for FULL requires
  797. // `cloudtasks.tasks.fullView` [Google
  798. // IAM](https://cloud.google.com/iam/)
  799. // permission on the Task resource.
  800. //
  801. // Possible values:
  802. // "VIEW_UNSPECIFIED" - Unspecified. Defaults to BASIC.
  803. // "BASIC" - The basic view omits fields which can be large or can
  804. // contain
  805. // sensitive data.
  806. //
  807. // This view does not include the
  808. // (payload in AppEngineHttpRequest and
  809. // payload in PullMessage). These payloads are
  810. // desirable to return only when needed, because they can be large
  811. // and because of the sensitivity of the data that you choose to
  812. // store in it.
  813. // "FULL" - All information is returned.
  814. //
  815. // Authorization for FULL requires
  816. // `cloudtasks.tasks.fullView` [Google
  817. // IAM](https://cloud.google.com/iam/)
  818. // permission on the Queue resource.
  819. ResponseView string `json:"responseView,omitempty"`
  820. // Task: Required.
  821. //
  822. // The task to add.
  823. //
  824. // Task names have the following
  825. // format:
  826. // `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tas
  827. // ks/TASK_ID`.
  828. // The user can optionally specify a task name. If a
  829. // name is not specified then the system will generate a random
  830. // unique task id, which will be set in the task returned in
  831. // the
  832. // response.
  833. //
  834. // If schedule_time is not set or is in the
  835. // past then Cloud Tasks will set it to the current time.
  836. //
  837. // Task De-duplication:
  838. //
  839. // Explicitly specifying a task ID enables task de-duplication. If
  840. // a task's ID is identical to that of an existing task or a task
  841. // that was deleted or completed recently then the call will fail
  842. // with ALREADY_EXISTS.
  843. // If the task's queue was created using Cloud Tasks, then another task
  844. // with
  845. // the same name can't be created for ~1hour after the original task
  846. // was
  847. // deleted or completed. If the task's queue was created using
  848. // queue.yaml or
  849. // queue.xml, then another task with the same name can't be created
  850. // for ~9days after the original task was deleted or completed.
  851. //
  852. // Because there is an extra lookup cost to identify duplicate
  853. // task
  854. // names, these CreateTask calls have significantly
  855. // increased latency. Using hashed strings for the task id or for
  856. // the prefix of the task id is recommended. Choosing task ids that
  857. // are sequential or have sequential prefixes, for example using
  858. // a
  859. // timestamp, causes an increase in latency and error rates in all
  860. // task commands. The infrastructure relies on an approximately
  861. // uniform distribution of task ids to store and serve
  862. // tasks
  863. // efficiently.
  864. Task *Task `json:"task,omitempty"`
  865. // ForceSendFields is a list of field names (e.g. "ResponseView") to
  866. // unconditionally include in API requests. By default, fields with
  867. // empty values are omitted from API requests. However, any non-pointer,
  868. // non-interface field appearing in ForceSendFields will be sent to the
  869. // server regardless of whether the field is empty or not. This may be
  870. // used to include empty fields in Patch requests.
  871. ForceSendFields []string `json:"-"`
  872. // NullFields is a list of field names (e.g. "ResponseView") to include
  873. // in API requests with the JSON null value. By default, fields with
  874. // empty values are omitted from API requests. However, any field with
  875. // an empty value appearing in NullFields will be sent to the server as
  876. // null. It is an error if a field in this list has a non-empty value.
  877. // This may be used to include null fields in Patch requests.
  878. NullFields []string `json:"-"`
  879. }
  880. func (s *CreateTaskRequest) MarshalJSON() ([]byte, error) {
  881. type NoMethod CreateTaskRequest
  882. raw := NoMethod(*s)
  883. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  884. }
  885. // Empty: A generic empty message that you can re-use to avoid defining
  886. // duplicated
  887. // empty messages in your APIs. A typical example is to use it as the
  888. // request
  889. // or the response type of an API method. For instance:
  890. //
  891. // service Foo {
  892. // rpc Bar(google.protobuf.Empty) returns
  893. // (google.protobuf.Empty);
  894. // }
  895. //
  896. // The JSON representation for `Empty` is empty JSON object `{}`.
  897. type Empty struct {
  898. // ServerResponse contains the HTTP response code and headers from the
  899. // server.
  900. googleapi.ServerResponse `json:"-"`
  901. }
  902. // Expr: Represents an expression text. Example:
  903. //
  904. // title: "User account presence"
  905. // description: "Determines whether the request has a user account"
  906. // expression: "size(request.user) > 0"
  907. type Expr struct {
  908. // Description: An optional description of the expression. This is a
  909. // longer text which
  910. // describes the expression, e.g. when hovered over it in a UI.
  911. Description string `json:"description,omitempty"`
  912. // Expression: Textual representation of an expression in
  913. // Common Expression Language syntax.
  914. //
  915. // The application context of the containing message determines
  916. // which
  917. // well-known feature set of CEL is supported.
  918. Expression string `json:"expression,omitempty"`
  919. // Location: An optional string indicating the location of the
  920. // expression for error
  921. // reporting, e.g. a file name and a position in the file.
  922. Location string `json:"location,omitempty"`
  923. // Title: An optional title for the expression, i.e. a short string
  924. // describing
  925. // its purpose. This can be used e.g. in UIs which allow to enter
  926. // the
  927. // expression.
  928. Title string `json:"title,omitempty"`
  929. // ForceSendFields is a list of field names (e.g. "Description") to
  930. // unconditionally include in API requests. By default, fields with
  931. // empty values are omitted from API requests. However, any non-pointer,
  932. // non-interface field appearing in ForceSendFields will be sent to the
  933. // server regardless of whether the field is empty or not. This may be
  934. // used to include empty fields in Patch requests.
  935. ForceSendFields []string `json:"-"`
  936. // NullFields is a list of field names (e.g. "Description") to include
  937. // in API requests with the JSON null value. By default, fields with
  938. // empty values are omitted from API requests. However, any field with
  939. // an empty value appearing in NullFields will be sent to the server as
  940. // null. It is an error if a field in this list has a non-empty value.
  941. // This may be used to include null fields in Patch requests.
  942. NullFields []string `json:"-"`
  943. }
  944. func (s *Expr) MarshalJSON() ([]byte, error) {
  945. type NoMethod Expr
  946. raw := NoMethod(*s)
  947. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  948. }
  949. // GetIamPolicyRequest: Request message for `GetIamPolicy` method.
  950. type GetIamPolicyRequest struct {
  951. }
  952. // LeaseTasksRequest: Request message for leasing tasks using
  953. // LeaseTasks.
  954. type LeaseTasksRequest struct {
  955. // Filter: `filter` can be used to specify a subset of tasks to
  956. // lease.
  957. //
  958. // When `filter` is set to `tag=<my-tag>` then the
  959. // response will contain only tasks whose
  960. // tag is equal to `<my-tag>`. `<my-tag>` must be
  961. // less than 500 characters.
  962. //
  963. // When `filter` is set to `tag_function=oldest_tag()`, only tasks which
  964. // have
  965. // the same tag as the task with the oldest
  966. // schedule_time will be returned.
  967. //
  968. // Grammar Syntax:
  969. //
  970. // * `filter = "tag=" tag | "tag_function=" function`
  971. //
  972. // * `tag = string`
  973. //
  974. // * `function = "oldest_tag()"
  975. //
  976. // The `oldest_tag()` function returns tasks which have the same tag as
  977. // the
  978. // oldest task (ordered by schedule time).
  979. //
  980. // SDK compatibility: Although the SDK allows tags to be either
  981. // string
  982. // or
  983. // [bytes](https://cloud.google.com/appengine/docs/standard/java/javad
  984. // oc/com/google/appengine/api/taskqueue/TaskOptions.html#tag-byte:A-),
  985. // o
  986. // nly UTF-8 encoded tags can be used in Cloud Tasks. Tag which
  987. // aren't UTF-8 encoded can't be used in the
  988. // filter and the task's
  989. // tag will be displayed as empty in Cloud Tasks.
  990. Filter string `json:"filter,omitempty"`
  991. // LeaseDuration:
  992. // After the worker has successfully finished the work associated
  993. // with the task, the worker must call via
  994. // AcknowledgeTask before the
  995. // schedule_time. Otherwise the task will be
  996. // returned to a later LeaseTasks call so
  997. // that another worker can retry it.
  998. //
  999. // The maximum lease duration is 1 week.
  1000. // `lease_duration` will be truncated to the nearest second.
  1001. LeaseDuration string `json:"leaseDuration,omitempty"`
  1002. // MaxTasks: The maximum number of tasks to lease.
  1003. //
  1004. // The system will make a best effort to return as close to
  1005. // as
  1006. // `max_tasks` as possible.
  1007. //
  1008. // The largest that `max_tasks` can be is 1000.
  1009. //
  1010. // The maximum total size of a lease tasks response is
  1011. // 32 MB. If the sum of all task sizes requested reaches this
  1012. // limit,
  1013. // fewer tasks than requested are returned.
  1014. MaxTasks int64 `json:"maxTasks,omitempty"`
  1015. // ResponseView: The response_view specifies which subset of the Task
  1016. // will be
  1017. // returned.
  1018. //
  1019. // By default response_view is BASIC; not all
  1020. // information is retrieved by default because some data, such
  1021. // as
  1022. // payloads, might be desirable to return only when needed because
  1023. // of its large size or because of the sensitivity of data that
  1024. // it
  1025. // contains.
  1026. //
  1027. // Authorization for FULL requires
  1028. // `cloudtasks.tasks.fullView` [Google
  1029. // IAM](https://cloud.google.com/iam/)
  1030. // permission on the Task resource.
  1031. //
  1032. // Possible values:
  1033. // "VIEW_UNSPECIFIED" - Unspecified. Defaults to BASIC.
  1034. // "BASIC" - The basic view omits fields which can be large or can
  1035. // contain
  1036. // sensitive data.
  1037. //
  1038. // This view does not include the
  1039. // (payload in AppEngineHttpRequest and
  1040. // payload in PullMessage). These payloads are
  1041. // desirable to return only when needed, because they can be large
  1042. // and because of the sensitivity of the data that you choose to
  1043. // store in it.
  1044. // "FULL" - All information is returned.
  1045. //
  1046. // Authorization for FULL requires
  1047. // `cloudtasks.tasks.fullView` [Google
  1048. // IAM](https://cloud.google.com/iam/)
  1049. // permission on the Queue resource.
  1050. ResponseView string `json:"responseView,omitempty"`
  1051. // ForceSendFields is a list of field names (e.g. "Filter") to
  1052. // unconditionally include in API requests. By default, fields with
  1053. // empty values are omitted from API requests. However, any non-pointer,
  1054. // non-interface field appearing in ForceSendFields will be sent to the
  1055. // server regardless of whether the field is empty or not. This may be
  1056. // used to include empty fields in Patch requests.
  1057. ForceSendFields []string `json:"-"`
  1058. // NullFields is a list of field names (e.g. "Filter") to include in API
  1059. // requests with the JSON null value. By default, fields with empty
  1060. // values are omitted from API requests. However, any field with an
  1061. // empty value appearing in NullFields will be sent to the server as
  1062. // null. It is an error if a field in this list has a non-empty value.
  1063. // This may be used to include null fields in Patch requests.
  1064. NullFields []string `json:"-"`
  1065. }
  1066. func (s *LeaseTasksRequest) MarshalJSON() ([]byte, error) {
  1067. type NoMethod LeaseTasksRequest
  1068. raw := NoMethod(*s)
  1069. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1070. }
  1071. // LeaseTasksResponse: Response message for leasing tasks using
  1072. // LeaseTasks.
  1073. type LeaseTasksResponse struct {
  1074. // Tasks: The leased tasks.
  1075. Tasks []*Task `json:"tasks,omitempty"`
  1076. // ServerResponse contains the HTTP response code and headers from the
  1077. // server.
  1078. googleapi.ServerResponse `json:"-"`
  1079. // ForceSendFields is a list of field names (e.g. "Tasks") to
  1080. // unconditionally include in API requests. By default, fields with
  1081. // empty values are omitted from API requests. However, any non-pointer,
  1082. // non-interface field appearing in ForceSendFields will be sent to the
  1083. // server regardless of whether the field is empty or not. This may be
  1084. // used to include empty fields in Patch requests.
  1085. ForceSendFields []string `json:"-"`
  1086. // NullFields is a list of field names (e.g. "Tasks") to include in API
  1087. // requests with the JSON null value. By default, fields with empty
  1088. // values are omitted from API requests. However, any field with an
  1089. // empty value appearing in NullFields will be sent to the server as
  1090. // null. It is an error if a field in this list has a non-empty value.
  1091. // This may be used to include null fields in Patch requests.
  1092. NullFields []string `json:"-"`
  1093. }
  1094. func (s *LeaseTasksResponse) MarshalJSON() ([]byte, error) {
  1095. type NoMethod LeaseTasksResponse
  1096. raw := NoMethod(*s)
  1097. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1098. }
  1099. // ListLocationsResponse: The response message for
  1100. // Locations.ListLocations.
  1101. type ListLocationsResponse struct {
  1102. // Locations: A list of locations that matches the specified filter in
  1103. // the request.
  1104. Locations []*Location `json:"locations,omitempty"`
  1105. // NextPageToken: The standard List next-page token.
  1106. NextPageToken string `json:"nextPageToken,omitempty"`
  1107. // ServerResponse contains the HTTP response code and headers from the
  1108. // server.
  1109. googleapi.ServerResponse `json:"-"`
  1110. // ForceSendFields is a list of field names (e.g. "Locations") to
  1111. // unconditionally include in API requests. By default, fields with
  1112. // empty values are omitted from API requests. However, any non-pointer,
  1113. // non-interface field appearing in ForceSendFields will be sent to the
  1114. // server regardless of whether the field is empty or not. This may be
  1115. // used to include empty fields in Patch requests.
  1116. ForceSendFields []string `json:"-"`
  1117. // NullFields is a list of field names (e.g. "Locations") to include in
  1118. // API requests with the JSON null value. By default, fields with empty
  1119. // values are omitted from API requests. However, any field with an
  1120. // empty value appearing in NullFields will be sent to the server as
  1121. // null. It is an error if a field in this list has a non-empty value.
  1122. // This may be used to include null fields in Patch requests.
  1123. NullFields []string `json:"-"`
  1124. }
  1125. func (s *ListLocationsResponse) MarshalJSON() ([]byte, error) {
  1126. type NoMethod ListLocationsResponse
  1127. raw := NoMethod(*s)
  1128. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1129. }
  1130. // ListQueuesResponse: Response message for ListQueues.
  1131. type ListQueuesResponse struct {
  1132. // NextPageToken: A token to retrieve next page of results.
  1133. //
  1134. // To return the next page of results, call
  1135. // ListQueues with this value as the
  1136. // page_token.
  1137. //
  1138. // If the next_page_token is empty, there are no more results.
  1139. //
  1140. // The page token is valid for only 2 hours.
  1141. NextPageToken string `json:"nextPageToken,omitempty"`
  1142. // Queues: The list of queues.
  1143. Queues []*Queue `json:"queues,omitempty"`
  1144. // ServerResponse contains the HTTP response code and headers from the
  1145. // server.
  1146. googleapi.ServerResponse `json:"-"`
  1147. // ForceSendFields is a list of field names (e.g. "NextPageToken") to
  1148. // unconditionally include in API requests. By default, fields with
  1149. // empty values are omitted from API requests. However, any non-pointer,
  1150. // non-interface field appearing in ForceSendFields will be sent to the
  1151. // server regardless of whether the field is empty or not. This may be
  1152. // used to include empty fields in Patch requests.
  1153. ForceSendFields []string `json:"-"`
  1154. // NullFields is a list of field names (e.g. "NextPageToken") to include
  1155. // in API requests with the JSON null value. By default, fields with
  1156. // empty values are omitted from API requests. However, any field with
  1157. // an empty value appearing in NullFields will be sent to the server as
  1158. // null. It is an error if a field in this list has a non-empty value.
  1159. // This may be used to include null fields in Patch requests.
  1160. NullFields []string `json:"-"`
  1161. }
  1162. func (s *ListQueuesResponse) MarshalJSON() ([]byte, error) {
  1163. type NoMethod ListQueuesResponse
  1164. raw := NoMethod(*s)
  1165. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1166. }
  1167. // ListTasksResponse: Response message for listing tasks using
  1168. // ListTasks.
  1169. type ListTasksResponse struct {
  1170. // NextPageToken: A token to retrieve next page of results.
  1171. //
  1172. // To return the next page of results, call
  1173. // ListTasks with this value as the
  1174. // page_token.
  1175. //
  1176. // If the next_page_token is empty, there are no more results.
  1177. NextPageToken string `json:"nextPageToken,omitempty"`
  1178. // Tasks: The list of tasks.
  1179. Tasks []*Task `json:"tasks,omitempty"`
  1180. // ServerResponse contains the HTTP response code and headers from the
  1181. // server.
  1182. googleapi.ServerResponse `json:"-"`
  1183. // ForceSendFields is a list of field names (e.g. "NextPageToken") to
  1184. // unconditionally include in API requests. By default, fields with
  1185. // empty values are omitted from API requests. However, any non-pointer,
  1186. // non-interface field appearing in ForceSendFields will be sent to the
  1187. // server regardless of whether the field is empty or not. This may be
  1188. // used to include empty fields in Patch requests.
  1189. ForceSendFields []string `json:"-"`
  1190. // NullFields is a list of field names (e.g. "NextPageToken") to include
  1191. // in API requests with the JSON null value. By default, fields with
  1192. // empty values are omitted from API requests. However, any field with
  1193. // an empty value appearing in NullFields will be sent to the server as
  1194. // null. It is an error if a field in this list has a non-empty value.
  1195. // This may be used to include null fields in Patch requests.
  1196. NullFields []string `json:"-"`
  1197. }
  1198. func (s *ListTasksResponse) MarshalJSON() ([]byte, error) {
  1199. type NoMethod ListTasksResponse
  1200. raw := NoMethod(*s)
  1201. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1202. }
  1203. // Location: A resource that represents Google Cloud Platform location.
  1204. type Location struct {
  1205. // DisplayName: The friendly name for this location, typically a nearby
  1206. // city name.
  1207. // For example, "Tokyo".
  1208. DisplayName string `json:"displayName,omitempty"`
  1209. // Labels: Cross-service attributes for the location. For example
  1210. //
  1211. // {"cloud.googleapis.com/region": "us-east1"}
  1212. Labels map[string]string `json:"labels,omitempty"`
  1213. // LocationId: The canonical id for this location. For example:
  1214. // "us-east1".
  1215. LocationId string `json:"locationId,omitempty"`
  1216. // Metadata: Service-specific metadata. For example the available
  1217. // capacity at the given
  1218. // location.
  1219. Metadata googleapi.RawMessage `json:"metadata,omitempty"`
  1220. // Name: Resource name for the location, which may vary between
  1221. // implementations.
  1222. // For example: "projects/example-project/locations/us-east1"
  1223. Name string `json:"name,omitempty"`
  1224. // ServerResponse contains the HTTP response code and headers from the
  1225. // server.
  1226. googleapi.ServerResponse `json:"-"`
  1227. // ForceSendFields is a list of field names (e.g. "DisplayName") to
  1228. // unconditionally include in API requests. By default, fields with
  1229. // empty values are omitted from API requests. However, any non-pointer,
  1230. // non-interface field appearing in ForceSendFields will be sent to the
  1231. // server regardless of whether the field is empty or not. This may be
  1232. // used to include empty fields in Patch requests.
  1233. ForceSendFields []string `json:"-"`
  1234. // NullFields is a list of field names (e.g. "DisplayName") to include
  1235. // in API requests with the JSON null value. By default, fields with
  1236. // empty values are omitted from API requests. However, any field with
  1237. // an empty value appearing in NullFields will be sent to the server as
  1238. // null. It is an error if a field in this list has a non-empty value.
  1239. // This may be used to include null fields in Patch requests.
  1240. NullFields []string `json:"-"`
  1241. }
  1242. func (s *Location) MarshalJSON() ([]byte, error) {
  1243. type NoMethod Location
  1244. raw := NoMethod(*s)
  1245. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1246. }
  1247. // PauseQueueRequest: Request message for PauseQueue.
  1248. type PauseQueueRequest struct {
  1249. }
  1250. // Policy: Defines an Identity and Access Management (IAM) policy. It is
  1251. // used to
  1252. // specify access control policies for Cloud Platform resources.
  1253. //
  1254. //
  1255. // A `Policy` consists of a list of `bindings`. A `binding` binds a list
  1256. // of
  1257. // `members` to a `role`, where the members can be user accounts, Google
  1258. // groups,
  1259. // Google domains, and service accounts. A `role` is a named list of
  1260. // permissions
  1261. // defined by IAM.
  1262. //
  1263. // **JSON Example**
  1264. //
  1265. // {
  1266. // "bindings": [
  1267. // {
  1268. // "role": "roles/owner",
  1269. // "members": [
  1270. // "user:mike@example.com",
  1271. // "group:admins@example.com",
  1272. // "domain:google.com",
  1273. //
  1274. // "serviceAccount:my-other-app@appspot.gserviceaccount.com"
  1275. // ]
  1276. // },
  1277. // {
  1278. // "role": "roles/viewer",
  1279. // "members": ["user:sean@example.com"]
  1280. // }
  1281. // ]
  1282. // }
  1283. //
  1284. // **YAML Example**
  1285. //
  1286. // bindings:
  1287. // - members:
  1288. // - user:mike@example.com
  1289. // - group:admins@example.com
  1290. // - domain:google.com
  1291. // - serviceAccount:my-other-app@appspot.gserviceaccount.com
  1292. // role: roles/owner
  1293. // - members:
  1294. // - user:sean@example.com
  1295. // role: roles/viewer
  1296. //
  1297. //
  1298. // For a description of IAM and its features, see the
  1299. // [IAM developer's guide](https://cloud.google.com/iam/docs).
  1300. type Policy struct {
  1301. // Bindings: Associates a list of `members` to a `role`.
  1302. // `bindings` with no members will result in an error.
  1303. Bindings []*Binding `json:"bindings,omitempty"`
  1304. // Etag: `etag` is used for optimistic concurrency control as a way to
  1305. // help
  1306. // prevent simultaneous updates of a policy from overwriting each
  1307. // other.
  1308. // It is strongly suggested that systems make use of the `etag` in
  1309. // the
  1310. // read-modify-write cycle to perform policy updates in order to avoid
  1311. // race
  1312. // conditions: An `etag` is returned in the response to `getIamPolicy`,
  1313. // and
  1314. // systems are expected to put that etag in the request to
  1315. // `setIamPolicy` to
  1316. // ensure that their change will be applied to the same version of the
  1317. // policy.
  1318. //
  1319. // If no `etag` is provided in the call to `setIamPolicy`, then the
  1320. // existing
  1321. // policy is overwritten blindly.
  1322. Etag string `json:"etag,omitempty"`
  1323. // Version: Deprecated.
  1324. Version int64 `json:"version,omitempty"`
  1325. // ServerResponse contains the HTTP response code and headers from the
  1326. // server.
  1327. googleapi.ServerResponse `json:"-"`
  1328. // ForceSendFields is a list of field names (e.g. "Bindings") to
  1329. // unconditionally include in API requests. By default, fields with
  1330. // empty values are omitted from API requests. However, any non-pointer,
  1331. // non-interface field appearing in ForceSendFields will be sent to the
  1332. // server regardless of whether the field is empty or not. This may be
  1333. // used to include empty fields in Patch requests.
  1334. ForceSendFields []string `json:"-"`
  1335. // NullFields is a list of field names (e.g. "Bindings") to include in
  1336. // API requests with the JSON null value. By default, fields with empty
  1337. // values are omitted from API requests. However, any field with an
  1338. // empty value appearing in NullFields will be sent to the server as
  1339. // null. It is an error if a field in this list has a non-empty value.
  1340. // This may be used to include null fields in Patch requests.
  1341. NullFields []string `json:"-"`
  1342. }
  1343. func (s *Policy) MarshalJSON() ([]byte, error) {
  1344. type NoMethod Policy
  1345. raw := NoMethod(*s)
  1346. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1347. }
  1348. // PullMessage: The pull message contains data that can be used by the
  1349. // caller of
  1350. // LeaseTasks to process the task.
  1351. //
  1352. // This proto can only be used for tasks in a queue which
  1353. // has
  1354. // pull_target set.
  1355. type PullMessage struct {
  1356. // Payload: A data payload consumed by the worker to execute the task.
  1357. Payload string `json:"payload,omitempty"`
  1358. // Tag: The task's tag.
  1359. //
  1360. // Tags allow similar tasks to be processed in a batch. If you
  1361. // label
  1362. // tasks with a tag, your worker can
  1363. // lease tasks with the same tag using
  1364. // filter. For example, if you want to
  1365. // aggregate the events associated with a specific user once a day,
  1366. // you could tag tasks with the user ID.
  1367. //
  1368. // The task's tag can only be set when the
  1369. // task is created.
  1370. //
  1371. // The tag must be less than 500 characters.
  1372. //
  1373. // SDK compatibility: Although the SDK allows tags to be either
  1374. // string or
  1375. // [bytes](https://cloud.google.com/appengine/docs/standard/java/javadoc/
  1376. // com/google/appengine/api/taskqueue/TaskOptions.html#tag-byte:A-),
  1377. // only
  1378. // UTF-8 encoded tags can be used in Cloud Tasks. If a tag isn't
  1379. // UTF-8
  1380. // encoded, the tag will be empty when the task is returned by Cloud
  1381. // Tasks.
  1382. Tag string `json:"tag,omitempty"`
  1383. // ForceSendFields is a list of field names (e.g. "Payload") to
  1384. // unconditionally include in API requests. By default, fields with
  1385. // empty values are omitted from API requests. However, any non-pointer,
  1386. // non-interface field appearing in ForceSendFields will be sent to the
  1387. // server regardless of whether the field is empty or not. This may be
  1388. // used to include empty fields in Patch requests.
  1389. ForceSendFields []string `json:"-"`
  1390. // NullFields is a list of field names (e.g. "Payload") to include in
  1391. // API requests with the JSON null value. By default, fields with empty
  1392. // values are omitted from API requests. However, any field with an
  1393. // empty value appearing in NullFields will be sent to the server as
  1394. // null. It is an error if a field in this list has a non-empty value.
  1395. // This may be used to include null fields in Patch requests.
  1396. NullFields []string `json:"-"`
  1397. }
  1398. func (s *PullMessage) MarshalJSON() ([]byte, error) {
  1399. type NoMethod PullMessage
  1400. raw := NoMethod(*s)
  1401. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1402. }
  1403. // PullTarget: Pull target.
  1404. type PullTarget struct {
  1405. }
  1406. // PurgeQueueRequest: Request message for PurgeQueue.
  1407. type PurgeQueueRequest struct {
  1408. }
  1409. // Queue: A queue is a container of related tasks. Queues are configured
  1410. // to manage
  1411. // how those tasks are dispatched. Configurable properties include rate
  1412. // limits,
  1413. // retry options, target types, and others.
  1414. type Queue struct {
  1415. // AppEngineHttpTarget: App Engine HTTP target.
  1416. //
  1417. // An App Engine queue is a queue that has an AppEngineHttpTarget.
  1418. AppEngineHttpTarget *AppEngineHttpTarget `json:"appEngineHttpTarget,omitempty"`
  1419. // Name: Caller-specified and required in CreateQueue,
  1420. // after which it becomes output only.
  1421. //
  1422. // The queue name.
  1423. //
  1424. // The queue name must have the following
  1425. // format:
  1426. // `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID`
  1427. //
  1428. // *
  1429. // `PROJECT_ID` can contain letters ([A-Za-z]), numbers ([0-9]),
  1430. // hyphens (-), colons (:), or periods (.).
  1431. // For more information, see
  1432. // [Identifying
  1433. // projects](https://cloud.google.com/resource-manager/docs/creating-mana
  1434. // ging-projects#identifying_projects)
  1435. // * `LOCATION_ID` is the canonical ID for the queue's location.
  1436. // The list of available locations can be obtained by calling
  1437. // ListLocations.
  1438. // For more information, see
  1439. // https://cloud.google.com/about/locations/.
  1440. // * `QUEUE_ID` can contain letters ([A-Za-z]), numbers ([0-9]), or
  1441. // hyphens (-). The maximum length is 100 characters.
  1442. Name string `json:"name,omitempty"`
  1443. // PullTarget: Pull target.
  1444. //
  1445. // A pull queue is a queue that has a PullTarget.
  1446. PullTarget *PullTarget `json:"pullTarget,omitempty"`
  1447. // PurgeTime: Output only. The last time this queue was purged.
  1448. //
  1449. // All tasks that were created before this time
  1450. // were purged.
  1451. //
  1452. // A queue can be purged using PurgeQueue, the
  1453. // [App Engine Task Queue SDK, or the Cloud
  1454. // Console](https://cloud.google.com/appengine/docs/standard/python/taskq
  1455. // ueue/push/deleting-tasks-and-queues#purging_all_tasks_from_a_queue).
  1456. //
  1457. //
  1458. // Purge time will be truncated to the nearest microsecond. Purge
  1459. // time will be unset if the queue has never been purged.
  1460. PurgeTime string `json:"purgeTime,omitempty"`
  1461. // RateLimits: Rate limits for task dispatches.
  1462. //
  1463. // rate_limits and
  1464. // retry_config are related because they both
  1465. // control task attempts however they control how tasks are
  1466. // attempted in different ways:
  1467. //
  1468. // * rate_limits controls the total rate of
  1469. // dispatches from a queue (i.e. all traffic dispatched from the
  1470. // queue, regardless of whether the dispatch is from a first
  1471. // attempt or a retry).
  1472. // * retry_config controls what happens to
  1473. // particular a task after its first attempt fails. That is,
  1474. // retry_config controls task retries (the
  1475. // second attempt, third attempt, etc).
  1476. RateLimits *RateLimits `json:"rateLimits,omitempty"`
  1477. // RetryConfig: Settings that determine the retry behavior.
  1478. //
  1479. // * For tasks created using Cloud Tasks: the queue-level retry
  1480. // settings
  1481. // apply to all tasks in the queue that were created using Cloud
  1482. // Tasks.
  1483. // Retry settings cannot be set on individual tasks.
  1484. // * For tasks created using the App Engine SDK: the queue-level retry
  1485. // settings apply to all tasks in the queue which do not have retry
  1486. // settings
  1487. // explicitly set on the task and were created by the App Engine SDK.
  1488. // See
  1489. // [App Engine
  1490. // documentation](https://cloud.google.com/appengine/docs/standard/python
  1491. // /taskqueue/push/retrying-tasks).
  1492. RetryConfig *RetryConfig `json:"retryConfig,omitempty"`
  1493. // State: Output only. The state of the queue.
  1494. //
  1495. // `state` can only be changed by called
  1496. // PauseQueue,
  1497. // ResumeQueue, or
  1498. // uploading
  1499. // [queue.yaml/xml](https://cloud.google.com/appengine/docs/pyt
  1500. // hon/config/queueref).
  1501. // UpdateQueue cannot be used to change `state`.
  1502. //
  1503. // Possible values:
  1504. // "STATE_UNSPECIFIED" - Unspecified state.
  1505. // "RUNNING" - The queue is running. Tasks can be dispatched.
  1506. //
  1507. // If the queue was created using Cloud Tasks and the queue has
  1508. // had no activity (method calls or task dispatches) for 30 days,
  1509. // the queue may take a few minutes to re-activate. Some method
  1510. // calls may return NOT_FOUND and
  1511. // tasks may not be dispatched for a few minutes until the queue
  1512. // has been re-activated.
  1513. // "PAUSED" - Tasks are paused by the user. If the queue is paused
  1514. // then Cloud
  1515. // Tasks will stop delivering tasks from it, but more tasks can
  1516. // still be added to it by the user. When a pull queue is paused,
  1517. // all LeaseTasks calls will return a
  1518. // FAILED_PRECONDITION.
  1519. // "DISABLED" - The queue is disabled.
  1520. //
  1521. // A queue becomes `DISABLED`
  1522. // when
  1523. // [queue.yaml](https://cloud.google.com/appengine/docs/python/confi
  1524. // g/queueref)
  1525. // or
  1526. // [queue.xml](https://cloud.google.com/appengine/docs/standard/java/c
  1527. // onfig/queueref) is uploaded
  1528. // which does not contain the queue. You cannot directly disable a
  1529. // queue.
  1530. //
  1531. // When a queue is disabled, tasks can still be added to a queue
  1532. // but the tasks are not dispatched and
  1533. // LeaseTasks calls return a
  1534. // `FAILED_PRECONDITION` error.
  1535. //
  1536. // To permanently delete this queue and all of its tasks,
  1537. // call
  1538. // DeleteQueue.
  1539. State string `json:"state,omitempty"`
  1540. // ServerResponse contains the HTTP response code and headers from the
  1541. // server.
  1542. googleapi.ServerResponse `json:"-"`
  1543. // ForceSendFields is a list of field names (e.g. "AppEngineHttpTarget")
  1544. // to unconditionally include in API requests. By default, fields with
  1545. // empty values are omitted from API requests. However, any non-pointer,
  1546. // non-interface field appearing in ForceSendFields will be sent to the
  1547. // server regardless of whether the field is empty or not. This may be
  1548. // used to include empty fields in Patch requests.
  1549. ForceSendFields []string `json:"-"`
  1550. // NullFields is a list of field names (e.g. "AppEngineHttpTarget") to
  1551. // include in API requests with the JSON null value. By default, fields
  1552. // with empty values are omitted from API requests. However, any field
  1553. // with an empty value appearing in NullFields will be sent to the
  1554. // server as null. It is an error if a field in this list has a
  1555. // non-empty value. This may be used to include null fields in Patch
  1556. // requests.
  1557. NullFields []string `json:"-"`
  1558. }
  1559. func (s *Queue) MarshalJSON() ([]byte, error) {
  1560. type NoMethod Queue
  1561. raw := NoMethod(*s)
  1562. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1563. }
  1564. // RateLimits: Rate limits.
  1565. //
  1566. // This message determines the maximum rate that tasks can be dispatched
  1567. // by a
  1568. // queue, regardless of whether the dispatch is a first task attempt or
  1569. // a retry.
  1570. //
  1571. // Note: The debugging command, RunTask, will run a task
  1572. // even if the queue has reached its RateLimits.
  1573. type RateLimits struct {
  1574. // MaxBurstSize: Output only. The max burst size.
  1575. //
  1576. // Max burst size limits how fast tasks in queue are processed when
  1577. // many tasks are in the queue and the rate is high. This field
  1578. // allows the queue to have a high rate so processing starts
  1579. // shortly
  1580. // after a task is enqueued, but still limits resource usage when
  1581. // many tasks are enqueued in a short period of time.
  1582. //
  1583. // The [token bucket](https://wikipedia.org/wiki/Token_Bucket)
  1584. // algorithm is used to control the rate of task dispatches. Each
  1585. // queue has a token bucket that holds tokens, up to the
  1586. // maximum
  1587. // specified by `max_burst_size`. Each time a task is dispatched,
  1588. // a
  1589. // token is removed from the bucket. Tasks will be dispatched until
  1590. // the queue's bucket runs out of tokens. The bucket will
  1591. // be
  1592. // continuously refilled with new tokens based
  1593. // on
  1594. // max_tasks_dispatched_per_second.
  1595. //
  1596. // Cloud Tasks will pick the value of `max_burst_size` based on
  1597. // the
  1598. // value of
  1599. // max_tasks_dispatched_per_second.
  1600. //
  1601. // For App Engine queues that were created or updated
  1602. // using
  1603. // `queue.yaml/xml`, `max_burst_size` is equal
  1604. // to
  1605. // [bucket_size](https://cloud.google.com/appengine/docs/standard/pyth
  1606. // on/config/queueref#bucket_size).
  1607. // Since `max_burst_size` is output only, if
  1608. // UpdateQueue is called on a queue
  1609. // created by `queue.yaml/xml`, `max_burst_size` will be reset based
  1610. // on the value of
  1611. // max_tasks_dispatched_per_second,
  1612. // regardless of whether
  1613. // max_tasks_dispatched_per_second
  1614. // is updated.
  1615. //
  1616. MaxBurstSize int64 `json:"maxBurstSize,omitempty"`
  1617. // MaxConcurrentTasks: The maximum number of concurrent tasks that Cloud
  1618. // Tasks allows
  1619. // to be dispatched for this queue. After this threshold has
  1620. // been
  1621. // reached, Cloud Tasks stops dispatching tasks until the number
  1622. // of
  1623. // concurrent requests decreases.
  1624. //
  1625. // If unspecified when the queue is created, Cloud Tasks will pick
  1626. // the
  1627. // default.
  1628. //
  1629. //
  1630. // The maximum allowed value is 5,000.
  1631. //
  1632. // This field is output only for
  1633. // pull queues and always -1, which indicates no limit. No other
  1634. // queue types can have `max_concurrent_tasks` set to -1.
  1635. //
  1636. //
  1637. // This field has the same meaning as
  1638. // [max_concurrent_requests in
  1639. // queue.yaml/xml](https://cloud.google.com/appengine/docs/standard/pytho
  1640. // n/config/queueref#max_concurrent_requests).
  1641. MaxConcurrentTasks int64 `json:"maxConcurrentTasks,omitempty"`
  1642. // MaxTasksDispatchedPerSecond: The maximum rate at which tasks are
  1643. // dispatched from this queue.
  1644. //
  1645. // If unspecified when the queue is created, Cloud Tasks will pick
  1646. // the
  1647. // default.
  1648. //
  1649. // * For App Engine queues, the maximum allowed value
  1650. // is 500.
  1651. // * This field is output only for pull queues. In addition to the
  1652. // `max_tasks_dispatched_per_second` limit, a maximum of 10 QPS of
  1653. // LeaseTasks requests are allowed per pull queue.
  1654. //
  1655. //
  1656. // This field has the same meaning as
  1657. // [rate in
  1658. // queue.yaml/xml](https://cloud.google.com/appengine/docs/standard/pytho
  1659. // n/config/queueref#rate).
  1660. MaxTasksDispatchedPerSecond float64 `json:"maxTasksDispatchedPerSecond,omitempty"`
  1661. // ForceSendFields is a list of field names (e.g. "MaxBurstSize") to
  1662. // unconditionally include in API requests. By default, fields with
  1663. // empty values are omitted from API requests. However, any non-pointer,
  1664. // non-interface field appearing in ForceSendFields will be sent to the
  1665. // server regardless of whether the field is empty or not. This may be
  1666. // used to include empty fields in Patch requests.
  1667. ForceSendFields []string `json:"-"`
  1668. // NullFields is a list of field names (e.g. "MaxBurstSize") to include
  1669. // in API requests with the JSON null value. By default, fields with
  1670. // empty values are omitted from API requests. However, any field with
  1671. // an empty value appearing in NullFields will be sent to the server as
  1672. // null. It is an error if a field in this list has a non-empty value.
  1673. // This may be used to include null fields in Patch requests.
  1674. NullFields []string `json:"-"`
  1675. }
  1676. func (s *RateLimits) MarshalJSON() ([]byte, error) {
  1677. type NoMethod RateLimits
  1678. raw := NoMethod(*s)
  1679. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1680. }
  1681. func (s *RateLimits) UnmarshalJSON(data []byte) error {
  1682. type NoMethod RateLimits
  1683. var s1 struct {
  1684. MaxTasksDispatchedPerSecond gensupport.JSONFloat64 `json:"maxTasksDispatchedPerSecond"`
  1685. *NoMethod
  1686. }
  1687. s1.NoMethod = (*NoMethod)(s)
  1688. if err := json.Unmarshal(data, &s1); err != nil {
  1689. return err
  1690. }
  1691. s.MaxTasksDispatchedPerSecond = float64(s1.MaxTasksDispatchedPerSecond)
  1692. return nil
  1693. }
  1694. // RenewLeaseRequest: Request message for renewing a lease
  1695. // using
  1696. // RenewLease.
  1697. type RenewLeaseRequest struct {
  1698. // LeaseDuration: Required.
  1699. //
  1700. // The desired new lease duration, starting from now.
  1701. //
  1702. //
  1703. // The maximum lease duration is 1 week.
  1704. // `lease_duration` will be truncated to the nearest second.
  1705. LeaseDuration string `json:"leaseDuration,omitempty"`
  1706. // ResponseView: The response_view specifies which subset of the Task
  1707. // will be
  1708. // returned.
  1709. //
  1710. // By default response_view is BASIC; not all
  1711. // information is retrieved by default because some data, such
  1712. // as
  1713. // payloads, might be desirable to return only when needed because
  1714. // of its large size or because of the sensitivity of data that
  1715. // it
  1716. // contains.
  1717. //
  1718. // Authorization for FULL requires
  1719. // `cloudtasks.tasks.fullView` [Google
  1720. // IAM](https://cloud.google.com/iam/)
  1721. // permission on the Task resource.
  1722. //
  1723. // Possible values:
  1724. // "VIEW_UNSPECIFIED" - Unspecified. Defaults to BASIC.
  1725. // "BASIC" - The basic view omits fields which can be large or can
  1726. // contain
  1727. // sensitive data.
  1728. //
  1729. // This view does not include the
  1730. // (payload in AppEngineHttpRequest and
  1731. // payload in PullMessage). These payloads are
  1732. // desirable to return only when needed, because they can be large
  1733. // and because of the sensitivity of the data that you choose to
  1734. // store in it.
  1735. // "FULL" - All information is returned.
  1736. //
  1737. // Authorization for FULL requires
  1738. // `cloudtasks.tasks.fullView` [Google
  1739. // IAM](https://cloud.google.com/iam/)
  1740. // permission on the Queue resource.
  1741. ResponseView string `json:"responseView,omitempty"`
  1742. // ScheduleTime: Required.
  1743. //
  1744. // The task's current schedule time, available in the
  1745. // schedule_time returned by
  1746. // LeaseTasks response or
  1747. // RenewLease response. This restriction is
  1748. // to ensure that your worker currently holds the lease.
  1749. ScheduleTime string `json:"scheduleTime,omitempty"`
  1750. // ForceSendFields is a list of field names (e.g. "LeaseDuration") to
  1751. // unconditionally include in API requests. By default, fields with
  1752. // empty values are omitted from API requests. However, any non-pointer,
  1753. // non-interface field appearing in ForceSendFields will be sent to the
  1754. // server regardless of whether the field is empty or not. This may be
  1755. // used to include empty fields in Patch requests.
  1756. ForceSendFields []string `json:"-"`
  1757. // NullFields is a list of field names (e.g. "LeaseDuration") to include
  1758. // in API requests with the JSON null value. By default, fields with
  1759. // empty values are omitted from API requests. However, any field with
  1760. // an empty value appearing in NullFields will be sent to the server as
  1761. // null. It is an error if a field in this list has a non-empty value.
  1762. // This may be used to include null fields in Patch requests.
  1763. NullFields []string `json:"-"`
  1764. }
  1765. func (s *RenewLeaseRequest) MarshalJSON() ([]byte, error) {
  1766. type NoMethod RenewLeaseRequest
  1767. raw := NoMethod(*s)
  1768. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1769. }
  1770. // ResumeQueueRequest: Request message for ResumeQueue.
  1771. type ResumeQueueRequest struct {
  1772. }
  1773. // RetryConfig: Retry config.
  1774. //
  1775. // These settings determine how a failed task attempt is retried.
  1776. type RetryConfig struct {
  1777. // MaxAttempts: The maximum number of attempts for a task.
  1778. //
  1779. // Cloud Tasks will attempt the task `max_attempts` times (that
  1780. // is, if the first attempt fails, then there will be
  1781. // `max_attempts - 1` retries). Must be > 0.
  1782. MaxAttempts int64 `json:"maxAttempts,omitempty"`
  1783. // MaxBackoff: A task will be scheduled for retry between
  1784. // min_backoff and
  1785. // max_backoff duration after it fails,
  1786. // if the queue's RetryConfig specifies that the task should
  1787. // be
  1788. // retried.
  1789. //
  1790. // If unspecified when the queue is created, Cloud Tasks will pick
  1791. // the
  1792. // default.
  1793. //
  1794. // This field is output only for pull queues.
  1795. //
  1796. //
  1797. // `max_backoff` will be truncated to the nearest second.
  1798. //
  1799. // This field has the same meaning as
  1800. // [max_backoff_seconds in
  1801. // queue.yaml/xml](https://cloud.google.com/appengine/docs/standard/pytho
  1802. // n/config/queueref#retry_parameters).
  1803. MaxBackoff string `json:"maxBackoff,omitempty"`
  1804. // MaxDoublings: The time between retries will double `max_doublings`
  1805. // times.
  1806. //
  1807. // A task's retry interval starts at
  1808. // min_backoff, then doubles
  1809. // `max_doublings` times, then increases linearly, and finally
  1810. // retries retries at intervals of
  1811. // max_backoff up to
  1812. // max_attempts times.
  1813. //
  1814. // For example, if min_backoff is 10s,
  1815. // max_backoff is 300s, and
  1816. // `max_doublings` is 3, then the a task will first be retried in
  1817. // 10s. The retry interval will double three times, and then
  1818. // increase linearly by 2^3 * 10s. Finally, the task will retry
  1819. // at
  1820. // intervals of max_backoff until the
  1821. // task has been attempted max_attempts
  1822. // times. Thus, the requests will retry at 10s, 20s, 40s, 80s,
  1823. // 160s,
  1824. // 240s, 300s, 300s, ....
  1825. //
  1826. // If unspecified when the queue is created, Cloud Tasks will pick
  1827. // the
  1828. // default.
  1829. //
  1830. // This field is output only for pull queues.
  1831. //
  1832. //
  1833. // This field has the same meaning as
  1834. // [max_doublings in
  1835. // queue.yaml/xml](https://cloud.google.com/appengine/docs/standard/pytho
  1836. // n/config/queueref#retry_parameters).
  1837. MaxDoublings int64 `json:"maxDoublings,omitempty"`
  1838. // MaxRetryDuration: If positive, `max_retry_duration` specifies the
  1839. // time limit for
  1840. // retrying a failed task, measured from when the task was
  1841. // first
  1842. // attempted. Once `max_retry_duration` time has passed *and* the
  1843. // task has been attempted max_attempts
  1844. // times, no further attempts will be made and the task will
  1845. // be
  1846. // deleted.
  1847. //
  1848. // If zero, then the task age is unlimited.
  1849. //
  1850. // If unspecified when the queue is created, Cloud Tasks will pick
  1851. // the
  1852. // default.
  1853. //
  1854. // This field is output only for pull queues.
  1855. //
  1856. //
  1857. // `max_retry_duration` will be truncated to the nearest second.
  1858. //
  1859. // This field has the same meaning as
  1860. // [task_age_limit in
  1861. // queue.yaml/xml](https://cloud.google.com/appengine/docs/standard/pytho
  1862. // n/config/queueref#retry_parameters).
  1863. MaxRetryDuration string `json:"maxRetryDuration,omitempty"`
  1864. // MinBackoff: A task will be scheduled for retry between
  1865. // min_backoff and
  1866. // max_backoff duration after it fails,
  1867. // if the queue's RetryConfig specifies that the task should
  1868. // be
  1869. // retried.
  1870. //
  1871. // If unspecified when the queue is created, Cloud Tasks will pick
  1872. // the
  1873. // default.
  1874. //
  1875. // This field is output only for pull queues.
  1876. //
  1877. //
  1878. // `min_backoff` will be truncated to the nearest second.
  1879. //
  1880. // This field has the same meaning as
  1881. // [min_backoff_seconds in
  1882. // queue.yaml/xml](https://cloud.google.com/appengine/docs/standard/pytho
  1883. // n/config/queueref#retry_parameters).
  1884. MinBackoff string `json:"minBackoff,omitempty"`
  1885. // UnlimitedAttempts: If true, then the number of attempts is unlimited.
  1886. UnlimitedAttempts bool `json:"unlimitedAttempts,omitempty"`
  1887. // ForceSendFields is a list of field names (e.g. "MaxAttempts") to
  1888. // unconditionally include in API requests. By default, fields with
  1889. // empty values are omitted from API requests. However, any non-pointer,
  1890. // non-interface field appearing in ForceSendFields will be sent to the
  1891. // server regardless of whether the field is empty or not. This may be
  1892. // used to include empty fields in Patch requests.
  1893. ForceSendFields []string `json:"-"`
  1894. // NullFields is a list of field names (e.g. "MaxAttempts") to include
  1895. // in API requests with the JSON null value. By default, fields with
  1896. // empty values are omitted from API requests. However, any field with
  1897. // an empty value appearing in NullFields will be sent to the server as
  1898. // null. It is an error if a field in this list has a non-empty value.
  1899. // This may be used to include null fields in Patch requests.
  1900. NullFields []string `json:"-"`
  1901. }
  1902. func (s *RetryConfig) MarshalJSON() ([]byte, error) {
  1903. type NoMethod RetryConfig
  1904. raw := NoMethod(*s)
  1905. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1906. }
  1907. // RunTaskRequest: Request message for forcing a task to run now
  1908. // using
  1909. // RunTask.
  1910. type RunTaskRequest struct {
  1911. // ResponseView: The response_view specifies which subset of the Task
  1912. // will be
  1913. // returned.
  1914. //
  1915. // By default response_view is BASIC; not all
  1916. // information is retrieved by default because some data, such
  1917. // as
  1918. // payloads, might be desirable to return only when needed because
  1919. // of its large size or because of the sensitivity of data that
  1920. // it
  1921. // contains.
  1922. //
  1923. // Authorization for FULL requires
  1924. // `cloudtasks.tasks.fullView` [Google
  1925. // IAM](https://cloud.google.com/iam/)
  1926. // permission on the Task resource.
  1927. //
  1928. // Possible values:
  1929. // "VIEW_UNSPECIFIED" - Unspecified. Defaults to BASIC.
  1930. // "BASIC" - The basic view omits fields which can be large or can
  1931. // contain
  1932. // sensitive data.
  1933. //
  1934. // This view does not include the
  1935. // (payload in AppEngineHttpRequest and
  1936. // payload in PullMessage). These payloads are
  1937. // desirable to return only when needed, because they can be large
  1938. // and because of the sensitivity of the data that you choose to
  1939. // store in it.
  1940. // "FULL" - All information is returned.
  1941. //
  1942. // Authorization for FULL requires
  1943. // `cloudtasks.tasks.fullView` [Google
  1944. // IAM](https://cloud.google.com/iam/)
  1945. // permission on the Queue resource.
  1946. ResponseView string `json:"responseView,omitempty"`
  1947. // ForceSendFields is a list of field names (e.g. "ResponseView") to
  1948. // unconditionally include in API requests. By default, fields with
  1949. // empty values are omitted from API requests. However, any non-pointer,
  1950. // non-interface field appearing in ForceSendFields will be sent to the
  1951. // server regardless of whether the field is empty or not. This may be
  1952. // used to include empty fields in Patch requests.
  1953. ForceSendFields []string `json:"-"`
  1954. // NullFields is a list of field names (e.g. "ResponseView") to include
  1955. // in API requests with the JSON null value. By default, fields with
  1956. // empty values are omitted from API requests. However, any field with
  1957. // an empty value appearing in NullFields will be sent to the server as
  1958. // null. It is an error if a field in this list has a non-empty value.
  1959. // This may be used to include null fields in Patch requests.
  1960. NullFields []string `json:"-"`
  1961. }
  1962. func (s *RunTaskRequest) MarshalJSON() ([]byte, error) {
  1963. type NoMethod RunTaskRequest
  1964. raw := NoMethod(*s)
  1965. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1966. }
  1967. // SetIamPolicyRequest: Request message for `SetIamPolicy` method.
  1968. type SetIamPolicyRequest struct {
  1969. // Policy: REQUIRED: The complete policy to be applied to the
  1970. // `resource`. The size of
  1971. // the policy is limited to a few 10s of KB. An empty policy is a
  1972. // valid policy but certain Cloud Platform services (such as
  1973. // Projects)
  1974. // might reject them.
  1975. Policy *Policy `json:"policy,omitempty"`
  1976. // ForceSendFields is a list of field names (e.g. "Policy") to
  1977. // unconditionally include in API requests. By default, fields with
  1978. // empty values are omitted from API requests. However, any non-pointer,
  1979. // non-interface field appearing in ForceSendFields will be sent to the
  1980. // server regardless of whether the field is empty or not. This may be
  1981. // used to include empty fields in Patch requests.
  1982. ForceSendFields []string `json:"-"`
  1983. // NullFields is a list of field names (e.g. "Policy") to include in API
  1984. // requests with the JSON null value. By default, fields with empty
  1985. // values are omitted from API requests. However, any field with an
  1986. // empty value appearing in NullFields will be sent to the server as
  1987. // null. It is an error if a field in this list has a non-empty value.
  1988. // This may be used to include null fields in Patch requests.
  1989. NullFields []string `json:"-"`
  1990. }
  1991. func (s *SetIamPolicyRequest) MarshalJSON() ([]byte, error) {
  1992. type NoMethod SetIamPolicyRequest
  1993. raw := NoMethod(*s)
  1994. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1995. }
  1996. // Status: The `Status` type defines a logical error model that is
  1997. // suitable for different
  1998. // programming environments, including REST APIs and RPC APIs. It is
  1999. // used by
  2000. // [gRPC](https://github.com/grpc). The error model is designed to
  2001. // be:
  2002. //
  2003. // - Simple to use and understand for most users
  2004. // - Flexible enough to meet unexpected needs
  2005. //
  2006. // # Overview
  2007. //
  2008. // The `Status` message contains three pieces of data: error code, error
  2009. // message,
  2010. // and error details. The error code should be an enum value
  2011. // of
  2012. // google.rpc.Code, but it may accept additional error codes if needed.
  2013. // The
  2014. // error message should be a developer-facing English message that
  2015. // helps
  2016. // developers *understand* and *resolve* the error. If a localized
  2017. // user-facing
  2018. // error message is needed, put the localized message in the error
  2019. // details or
  2020. // localize it in the client. The optional error details may contain
  2021. // arbitrary
  2022. // information about the error. There is a predefined set of error
  2023. // detail types
  2024. // in the package `google.rpc` that can be used for common error
  2025. // conditions.
  2026. //
  2027. // # Language mapping
  2028. //
  2029. // The `Status` message is the logical representation of the error
  2030. // model, but it
  2031. // is not necessarily the actual wire format. When the `Status` message
  2032. // is
  2033. // exposed in different client libraries and different wire protocols,
  2034. // it can be
  2035. // mapped differently. For example, it will likely be mapped to some
  2036. // exceptions
  2037. // in Java, but more likely mapped to some error codes in C.
  2038. //
  2039. // # Other uses
  2040. //
  2041. // The error model and the `Status` message can be used in a variety
  2042. // of
  2043. // environments, either with or without APIs, to provide a
  2044. // consistent developer experience across different
  2045. // environments.
  2046. //
  2047. // Example uses of this error model include:
  2048. //
  2049. // - Partial errors. If a service needs to return partial errors to the
  2050. // client,
  2051. // it may embed the `Status` in the normal response to indicate the
  2052. // partial
  2053. // errors.
  2054. //
  2055. // - Workflow errors. A typical workflow has multiple steps. Each step
  2056. // may
  2057. // have a `Status` message for error reporting.
  2058. //
  2059. // - Batch operations. If a client uses batch request and batch
  2060. // response, the
  2061. // `Status` message should be used directly inside batch response,
  2062. // one for
  2063. // each error sub-response.
  2064. //
  2065. // - Asynchronous operations. If an API call embeds asynchronous
  2066. // operation
  2067. // results in its response, the status of those operations should
  2068. // be
  2069. // represented directly using the `Status` message.
  2070. //
  2071. // - Logging. If some API errors are stored in logs, the message
  2072. // `Status` could
  2073. // be used directly after any stripping needed for security/privacy
  2074. // reasons.
  2075. type Status struct {
  2076. // Code: The status code, which should be an enum value of
  2077. // google.rpc.Code.
  2078. Code int64 `json:"code,omitempty"`
  2079. // Details: A list of messages that carry the error details. There is a
  2080. // common set of
  2081. // message types for APIs to use.
  2082. Details []googleapi.RawMessage `json:"details,omitempty"`
  2083. // Message: A developer-facing error message, which should be in
  2084. // English. Any
  2085. // user-facing error message should be localized and sent in
  2086. // the
  2087. // google.rpc.Status.details field, or localized by the client.
  2088. Message string `json:"message,omitempty"`
  2089. // ForceSendFields is a list of field names (e.g. "Code") to
  2090. // unconditionally include in API requests. By default, fields with
  2091. // empty values are omitted from API requests. However, any non-pointer,
  2092. // non-interface field appearing in ForceSendFields will be sent to the
  2093. // server regardless of whether the field is empty or not. This may be
  2094. // used to include empty fields in Patch requests.
  2095. ForceSendFields []string `json:"-"`
  2096. // NullFields is a list of field names (e.g. "Code") to include in API
  2097. // requests with the JSON null value. By default, fields with empty
  2098. // values are omitted from API requests. However, any field with an
  2099. // empty value appearing in NullFields will be sent to the server as
  2100. // null. It is an error if a field in this list has a non-empty value.
  2101. // This may be used to include null fields in Patch requests.
  2102. NullFields []string `json:"-"`
  2103. }
  2104. func (s *Status) MarshalJSON() ([]byte, error) {
  2105. type NoMethod Status
  2106. raw := NoMethod(*s)
  2107. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2108. }
  2109. // Task: A unit of scheduled work.
  2110. type Task struct {
  2111. // AppEngineHttpRequest: App Engine HTTP request that is sent to the
  2112. // task's target. Can
  2113. // be set only if
  2114. // app_engine_http_target is set
  2115. // on the queue.
  2116. //
  2117. // An App Engine task is a task that has AppEngineHttpRequest set.
  2118. AppEngineHttpRequest *AppEngineHttpRequest `json:"appEngineHttpRequest,omitempty"`
  2119. // CreateTime: Output only. The time that the task was
  2120. // created.
  2121. //
  2122. // `create_time` will be truncated to the nearest second.
  2123. CreateTime string `json:"createTime,omitempty"`
  2124. // Name: Optionally caller-specified in CreateTask.
  2125. //
  2126. // The task name.
  2127. //
  2128. // The task name must have the following
  2129. // format:
  2130. // `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tas
  2131. // ks/TASK_ID`
  2132. //
  2133. // * `PROJECT_ID` can contain letters ([A-Za-z]), numbers ([0-9]),
  2134. // hyphens (-), colons (:), or periods (.).
  2135. // For more information, see
  2136. // [Identifying
  2137. // projects](https://cloud.google.com/resource-manager/docs/creating-mana
  2138. // ging-projects#identifying_projects)
  2139. // * `LOCATION_ID` is the canonical ID for the task's location.
  2140. // The list of available locations can be obtained by calling
  2141. // ListLocations.
  2142. // For more information, see
  2143. // https://cloud.google.com/about/locations/.
  2144. // * `QUEUE_ID` can contain letters ([A-Za-z]), numbers ([0-9]), or
  2145. // hyphens (-). The maximum length is 100 characters.
  2146. // * `TASK_ID` can contain only letters ([A-Za-z]), numbers ([0-9]),
  2147. // hyphens (-), or underscores (_). The maximum length is 500
  2148. // characters.
  2149. Name string `json:"name,omitempty"`
  2150. // PullMessage: LeaseTasks to process the task. Can be
  2151. // set only if pull_target is set on the queue.
  2152. //
  2153. // A pull task is a task that has PullMessage set.
  2154. PullMessage *PullMessage `json:"pullMessage,omitempty"`
  2155. // ScheduleTime: The time when the task is scheduled to be
  2156. // attempted.
  2157. //
  2158. // For App Engine queues, this is when the task will be attempted or
  2159. // retried.
  2160. //
  2161. // For pull queues, this is the time when the task is available to
  2162. // be leased; if a task is currently leased, this is the time when
  2163. // the current lease expires, that is, the time that the task was
  2164. // leased plus the lease_duration.
  2165. //
  2166. // `schedule_time` will be truncated to the nearest microsecond.
  2167. ScheduleTime string `json:"scheduleTime,omitempty"`
  2168. // Status: Output only. The task status.
  2169. Status *TaskStatus `json:"status,omitempty"`
  2170. // View: Output only. The view specifies which subset of the Task
  2171. // has
  2172. // been returned.
  2173. //
  2174. // Possible values:
  2175. // "VIEW_UNSPECIFIED" - Unspecified. Defaults to BASIC.
  2176. // "BASIC" - The basic view omits fields which can be large or can
  2177. // contain
  2178. // sensitive data.
  2179. //
  2180. // This view does not include the
  2181. // (payload in AppEngineHttpRequest and
  2182. // payload in PullMessage). These payloads are
  2183. // desirable to return only when needed, because they can be large
  2184. // and because of the sensitivity of the data that you choose to
  2185. // store in it.
  2186. // "FULL" - All information is returned.
  2187. //
  2188. // Authorization for FULL requires
  2189. // `cloudtasks.tasks.fullView` [Google
  2190. // IAM](https://cloud.google.com/iam/)
  2191. // permission on the Queue resource.
  2192. View string `json:"view,omitempty"`
  2193. // ServerResponse contains the HTTP response code and headers from the
  2194. // server.
  2195. googleapi.ServerResponse `json:"-"`
  2196. // ForceSendFields is a list of field names (e.g.
  2197. // "AppEngineHttpRequest") to unconditionally include in API requests.
  2198. // By default, fields with empty values are omitted from API requests.
  2199. // However, any non-pointer, non-interface field appearing in
  2200. // ForceSendFields will be sent to the server regardless of whether the
  2201. // field is empty or not. This may be used to include empty fields in
  2202. // Patch requests.
  2203. ForceSendFields []string `json:"-"`
  2204. // NullFields is a list of field names (e.g. "AppEngineHttpRequest") to
  2205. // include in API requests with the JSON null value. By default, fields
  2206. // with empty values are omitted from API requests. However, any field
  2207. // with an empty value appearing in NullFields will be sent to the
  2208. // server as null. It is an error if a field in this list has a
  2209. // non-empty value. This may be used to include null fields in Patch
  2210. // requests.
  2211. NullFields []string `json:"-"`
  2212. }
  2213. func (s *Task) MarshalJSON() ([]byte, error) {
  2214. type NoMethod Task
  2215. raw := NoMethod(*s)
  2216. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2217. }
  2218. // TaskStatus: Status of the task.
  2219. type TaskStatus struct {
  2220. // AttemptDispatchCount: Output only. The number of attempts
  2221. // dispatched.
  2222. //
  2223. // This count includes attempts which have been dispatched but
  2224. // haven't
  2225. // received a response.
  2226. AttemptDispatchCount int64 `json:"attemptDispatchCount,omitempty"`
  2227. // AttemptResponseCount: Output only. The number of attempts which have
  2228. // received a response.
  2229. //
  2230. // This field is not calculated for pull tasks.
  2231. AttemptResponseCount int64 `json:"attemptResponseCount,omitempty"`
  2232. // FirstAttemptStatus: Output only. The status of the task's first
  2233. // attempt.
  2234. //
  2235. // Only dispatch_time will be set.
  2236. // The other AttemptStatus information is not retained by Cloud
  2237. // Tasks.
  2238. //
  2239. // This field is not calculated for pull tasks.
  2240. FirstAttemptStatus *AttemptStatus `json:"firstAttemptStatus,omitempty"`
  2241. // LastAttemptStatus: Output only. The status of the task's last
  2242. // attempt.
  2243. //
  2244. // This field is not calculated for pull tasks.
  2245. LastAttemptStatus *AttemptStatus `json:"lastAttemptStatus,omitempty"`
  2246. // ForceSendFields is a list of field names (e.g.
  2247. // "AttemptDispatchCount") to unconditionally include in API requests.
  2248. // By default, fields with empty values are omitted from API requests.
  2249. // However, any non-pointer, non-interface field appearing in
  2250. // ForceSendFields will be sent to the server regardless of whether the
  2251. // field is empty or not. This may be used to include empty fields in
  2252. // Patch requests.
  2253. ForceSendFields []string `json:"-"`
  2254. // NullFields is a list of field names (e.g. "AttemptDispatchCount") to
  2255. // include in API requests with the JSON null value. By default, fields
  2256. // with empty values are omitted from API requests. However, any field
  2257. // with an empty value appearing in NullFields will be sent to the
  2258. // server as null. It is an error if a field in this list has a
  2259. // non-empty value. This may be used to include null fields in Patch
  2260. // requests.
  2261. NullFields []string `json:"-"`
  2262. }
  2263. func (s *TaskStatus) MarshalJSON() ([]byte, error) {
  2264. type NoMethod TaskStatus
  2265. raw := NoMethod(*s)
  2266. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2267. }
  2268. // TestIamPermissionsRequest: Request message for `TestIamPermissions`
  2269. // method.
  2270. type TestIamPermissionsRequest struct {
  2271. // Permissions: The set of permissions to check for the `resource`.
  2272. // Permissions with
  2273. // wildcards (such as '*' or 'storage.*') are not allowed. For
  2274. // more
  2275. // information see
  2276. // [IAM
  2277. // Overview](https://cloud.google.com/iam/docs/overview#permissions).
  2278. Permissions []string `json:"permissions,omitempty"`
  2279. // ForceSendFields is a list of field names (e.g. "Permissions") to
  2280. // unconditionally include in API requests. By default, fields with
  2281. // empty values are omitted from API requests. However, any non-pointer,
  2282. // non-interface field appearing in ForceSendFields will be sent to the
  2283. // server regardless of whether the field is empty or not. This may be
  2284. // used to include empty fields in Patch requests.
  2285. ForceSendFields []string `json:"-"`
  2286. // NullFields is a list of field names (e.g. "Permissions") to include
  2287. // in API requests with the JSON null value. By default, fields with
  2288. // empty values are omitted from API requests. However, any field with
  2289. // an empty value appearing in NullFields will be sent to the server as
  2290. // null. It is an error if a field in this list has a non-empty value.
  2291. // This may be used to include null fields in Patch requests.
  2292. NullFields []string `json:"-"`
  2293. }
  2294. func (s *TestIamPermissionsRequest) MarshalJSON() ([]byte, error) {
  2295. type NoMethod TestIamPermissionsRequest
  2296. raw := NoMethod(*s)
  2297. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2298. }
  2299. // TestIamPermissionsResponse: Response message for `TestIamPermissions`
  2300. // method.
  2301. type TestIamPermissionsResponse struct {
  2302. // Permissions: A subset of `TestPermissionsRequest.permissions` that
  2303. // the caller is
  2304. // allowed.
  2305. Permissions []string `json:"permissions,omitempty"`
  2306. // ServerResponse contains the HTTP response code and headers from the
  2307. // server.
  2308. googleapi.ServerResponse `json:"-"`
  2309. // ForceSendFields is a list of field names (e.g. "Permissions") to
  2310. // unconditionally include in API requests. By default, fields with
  2311. // empty values are omitted from API requests. However, any non-pointer,
  2312. // non-interface field appearing in ForceSendFields will be sent to the
  2313. // server regardless of whether the field is empty or not. This may be
  2314. // used to include empty fields in Patch requests.
  2315. ForceSendFields []string `json:"-"`
  2316. // NullFields is a list of field names (e.g. "Permissions") to include
  2317. // in API requests with the JSON null value. By default, fields with
  2318. // empty values are omitted from API requests. However, any field with
  2319. // an empty value appearing in NullFields will be sent to the server as
  2320. // null. It is an error if a field in this list has a non-empty value.
  2321. // This may be used to include null fields in Patch requests.
  2322. NullFields []string `json:"-"`
  2323. }
  2324. func (s *TestIamPermissionsResponse) MarshalJSON() ([]byte, error) {
  2325. type NoMethod TestIamPermissionsResponse
  2326. raw := NoMethod(*s)
  2327. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2328. }
  2329. // method id "cloudtasks.projects.locations.get":
  2330. type ProjectsLocationsGetCall struct {
  2331. s *Service
  2332. name string
  2333. urlParams_ gensupport.URLParams
  2334. ifNoneMatch_ string
  2335. ctx_ context.Context
  2336. header_ http.Header
  2337. }
  2338. // Get: Gets information about a location.
  2339. func (r *ProjectsLocationsService) Get(name string) *ProjectsLocationsGetCall {
  2340. c := &ProjectsLocationsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2341. c.name = name
  2342. return c
  2343. }
  2344. // Fields allows partial responses to be retrieved. See
  2345. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2346. // for more information.
  2347. func (c *ProjectsLocationsGetCall) Fields(s ...googleapi.Field) *ProjectsLocationsGetCall {
  2348. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2349. return c
  2350. }
  2351. // IfNoneMatch sets the optional parameter which makes the operation
  2352. // fail if the object's ETag matches the given value. This is useful for
  2353. // getting updates only after the object has changed since the last
  2354. // request. Use googleapi.IsNotModified to check whether the response
  2355. // error from Do is the result of In-None-Match.
  2356. func (c *ProjectsLocationsGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsGetCall {
  2357. c.ifNoneMatch_ = entityTag
  2358. return c
  2359. }
  2360. // Context sets the context to be used in this call's Do method. Any
  2361. // pending HTTP request will be aborted if the provided context is
  2362. // canceled.
  2363. func (c *ProjectsLocationsGetCall) Context(ctx context.Context) *ProjectsLocationsGetCall {
  2364. c.ctx_ = ctx
  2365. return c
  2366. }
  2367. // Header returns an http.Header that can be modified by the caller to
  2368. // add HTTP headers to the request.
  2369. func (c *ProjectsLocationsGetCall) Header() http.Header {
  2370. if c.header_ == nil {
  2371. c.header_ = make(http.Header)
  2372. }
  2373. return c.header_
  2374. }
  2375. func (c *ProjectsLocationsGetCall) doRequest(alt string) (*http.Response, error) {
  2376. reqHeaders := make(http.Header)
  2377. for k, v := range c.header_ {
  2378. reqHeaders[k] = v
  2379. }
  2380. reqHeaders.Set("User-Agent", c.s.userAgent())
  2381. if c.ifNoneMatch_ != "" {
  2382. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2383. }
  2384. var body io.Reader = nil
  2385. c.urlParams_.Set("alt", alt)
  2386. c.urlParams_.Set("prettyPrint", "false")
  2387. urls := googleapi.ResolveRelative(c.s.BasePath, "v2beta2/{+name}")
  2388. urls += "?" + c.urlParams_.Encode()
  2389. req, err := http.NewRequest("GET", urls, body)
  2390. if err != nil {
  2391. return nil, err
  2392. }
  2393. req.Header = reqHeaders
  2394. googleapi.Expand(req.URL, map[string]string{
  2395. "name": c.name,
  2396. })
  2397. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2398. }
  2399. // Do executes the "cloudtasks.projects.locations.get" call.
  2400. // Exactly one of *Location or error will be non-nil. Any non-2xx status
  2401. // code is an error. Response headers are in either
  2402. // *Location.ServerResponse.Header or (if a response was returned at
  2403. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  2404. // to check whether the returned error was because
  2405. // http.StatusNotModified was returned.
  2406. func (c *ProjectsLocationsGetCall) Do(opts ...googleapi.CallOption) (*Location, error) {
  2407. gensupport.SetOptions(c.urlParams_, opts...)
  2408. res, err := c.doRequest("json")
  2409. if res != nil && res.StatusCode == http.StatusNotModified {
  2410. if res.Body != nil {
  2411. res.Body.Close()
  2412. }
  2413. return nil, &googleapi.Error{
  2414. Code: res.StatusCode,
  2415. Header: res.Header,
  2416. }
  2417. }
  2418. if err != nil {
  2419. return nil, err
  2420. }
  2421. defer googleapi.CloseBody(res)
  2422. if err := googleapi.CheckResponse(res); err != nil {
  2423. return nil, err
  2424. }
  2425. ret := &Location{
  2426. ServerResponse: googleapi.ServerResponse{
  2427. Header: res.Header,
  2428. HTTPStatusCode: res.StatusCode,
  2429. },
  2430. }
  2431. target := &ret
  2432. if err := gensupport.DecodeResponse(target, res); err != nil {
  2433. return nil, err
  2434. }
  2435. return ret, nil
  2436. // {
  2437. // "description": "Gets information about a location.",
  2438. // "flatPath": "v2beta2/projects/{projectsId}/locations/{locationsId}",
  2439. // "httpMethod": "GET",
  2440. // "id": "cloudtasks.projects.locations.get",
  2441. // "parameterOrder": [
  2442. // "name"
  2443. // ],
  2444. // "parameters": {
  2445. // "name": {
  2446. // "description": "Resource name for the location.",
  2447. // "location": "path",
  2448. // "pattern": "^projects/[^/]+/locations/[^/]+$",
  2449. // "required": true,
  2450. // "type": "string"
  2451. // }
  2452. // },
  2453. // "path": "v2beta2/{+name}",
  2454. // "response": {
  2455. // "$ref": "Location"
  2456. // },
  2457. // "scopes": [
  2458. // "https://www.googleapis.com/auth/cloud-platform"
  2459. // ]
  2460. // }
  2461. }
  2462. // method id "cloudtasks.projects.locations.list":
  2463. type ProjectsLocationsListCall struct {
  2464. s *Service
  2465. name string
  2466. urlParams_ gensupport.URLParams
  2467. ifNoneMatch_ string
  2468. ctx_ context.Context
  2469. header_ http.Header
  2470. }
  2471. // List: Lists information about the supported locations for this
  2472. // service.
  2473. func (r *ProjectsLocationsService) List(name string) *ProjectsLocationsListCall {
  2474. c := &ProjectsLocationsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2475. c.name = name
  2476. return c
  2477. }
  2478. // Filter sets the optional parameter "filter": The standard list
  2479. // filter.
  2480. func (c *ProjectsLocationsListCall) Filter(filter string) *ProjectsLocationsListCall {
  2481. c.urlParams_.Set("filter", filter)
  2482. return c
  2483. }
  2484. // PageSize sets the optional parameter "pageSize": The standard list
  2485. // page size.
  2486. func (c *ProjectsLocationsListCall) PageSize(pageSize int64) *ProjectsLocationsListCall {
  2487. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  2488. return c
  2489. }
  2490. // PageToken sets the optional parameter "pageToken": The standard list
  2491. // page token.
  2492. func (c *ProjectsLocationsListCall) PageToken(pageToken string) *ProjectsLocationsListCall {
  2493. c.urlParams_.Set("pageToken", pageToken)
  2494. return c
  2495. }
  2496. // Fields allows partial responses to be retrieved. See
  2497. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2498. // for more information.
  2499. func (c *ProjectsLocationsListCall) Fields(s ...googleapi.Field) *ProjectsLocationsListCall {
  2500. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2501. return c
  2502. }
  2503. // IfNoneMatch sets the optional parameter which makes the operation
  2504. // fail if the object's ETag matches the given value. This is useful for
  2505. // getting updates only after the object has changed since the last
  2506. // request. Use googleapi.IsNotModified to check whether the response
  2507. // error from Do is the result of In-None-Match.
  2508. func (c *ProjectsLocationsListCall) IfNoneMatch(entityTag string) *ProjectsLocationsListCall {
  2509. c.ifNoneMatch_ = entityTag
  2510. return c
  2511. }
  2512. // Context sets the context to be used in this call's Do method. Any
  2513. // pending HTTP request will be aborted if the provided context is
  2514. // canceled.
  2515. func (c *ProjectsLocationsListCall) Context(ctx context.Context) *ProjectsLocationsListCall {
  2516. c.ctx_ = ctx
  2517. return c
  2518. }
  2519. // Header returns an http.Header that can be modified by the caller to
  2520. // add HTTP headers to the request.
  2521. func (c *ProjectsLocationsListCall) Header() http.Header {
  2522. if c.header_ == nil {
  2523. c.header_ = make(http.Header)
  2524. }
  2525. return c.header_
  2526. }
  2527. func (c *ProjectsLocationsListCall) doRequest(alt string) (*http.Response, error) {
  2528. reqHeaders := make(http.Header)
  2529. for k, v := range c.header_ {
  2530. reqHeaders[k] = v
  2531. }
  2532. reqHeaders.Set("User-Agent", c.s.userAgent())
  2533. if c.ifNoneMatch_ != "" {
  2534. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2535. }
  2536. var body io.Reader = nil
  2537. c.urlParams_.Set("alt", alt)
  2538. c.urlParams_.Set("prettyPrint", "false")
  2539. urls := googleapi.ResolveRelative(c.s.BasePath, "v2beta2/{+name}/locations")
  2540. urls += "?" + c.urlParams_.Encode()
  2541. req, err := http.NewRequest("GET", urls, body)
  2542. if err != nil {
  2543. return nil, err
  2544. }
  2545. req.Header = reqHeaders
  2546. googleapi.Expand(req.URL, map[string]string{
  2547. "name": c.name,
  2548. })
  2549. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2550. }
  2551. // Do executes the "cloudtasks.projects.locations.list" call.
  2552. // Exactly one of *ListLocationsResponse or error will be non-nil. Any
  2553. // non-2xx status code is an error. Response headers are in either
  2554. // *ListLocationsResponse.ServerResponse.Header or (if a response was
  2555. // returned at all) in error.(*googleapi.Error).Header. Use
  2556. // googleapi.IsNotModified to check whether the returned error was
  2557. // because http.StatusNotModified was returned.
  2558. func (c *ProjectsLocationsListCall) Do(opts ...googleapi.CallOption) (*ListLocationsResponse, error) {
  2559. gensupport.SetOptions(c.urlParams_, opts...)
  2560. res, err := c.doRequest("json")
  2561. if res != nil && res.StatusCode == http.StatusNotModified {
  2562. if res.Body != nil {
  2563. res.Body.Close()
  2564. }
  2565. return nil, &googleapi.Error{
  2566. Code: res.StatusCode,
  2567. Header: res.Header,
  2568. }
  2569. }
  2570. if err != nil {
  2571. return nil, err
  2572. }
  2573. defer googleapi.CloseBody(res)
  2574. if err := googleapi.CheckResponse(res); err != nil {
  2575. return nil, err
  2576. }
  2577. ret := &ListLocationsResponse{
  2578. ServerResponse: googleapi.ServerResponse{
  2579. Header: res.Header,
  2580. HTTPStatusCode: res.StatusCode,
  2581. },
  2582. }
  2583. target := &ret
  2584. if err := gensupport.DecodeResponse(target, res); err != nil {
  2585. return nil, err
  2586. }
  2587. return ret, nil
  2588. // {
  2589. // "description": "Lists information about the supported locations for this service.",
  2590. // "flatPath": "v2beta2/projects/{projectsId}/locations",
  2591. // "httpMethod": "GET",
  2592. // "id": "cloudtasks.projects.locations.list",
  2593. // "parameterOrder": [
  2594. // "name"
  2595. // ],
  2596. // "parameters": {
  2597. // "filter": {
  2598. // "description": "The standard list filter.",
  2599. // "location": "query",
  2600. // "type": "string"
  2601. // },
  2602. // "name": {
  2603. // "description": "The resource that owns the locations collection, if applicable.",
  2604. // "location": "path",
  2605. // "pattern": "^projects/[^/]+$",
  2606. // "required": true,
  2607. // "type": "string"
  2608. // },
  2609. // "pageSize": {
  2610. // "description": "The standard list page size.",
  2611. // "format": "int32",
  2612. // "location": "query",
  2613. // "type": "integer"
  2614. // },
  2615. // "pageToken": {
  2616. // "description": "The standard list page token.",
  2617. // "location": "query",
  2618. // "type": "string"
  2619. // }
  2620. // },
  2621. // "path": "v2beta2/{+name}/locations",
  2622. // "response": {
  2623. // "$ref": "ListLocationsResponse"
  2624. // },
  2625. // "scopes": [
  2626. // "https://www.googleapis.com/auth/cloud-platform"
  2627. // ]
  2628. // }
  2629. }
  2630. // Pages invokes f for each page of results.
  2631. // A non-nil error returned from f will halt the iteration.
  2632. // The provided context supersedes any context provided to the Context method.
  2633. func (c *ProjectsLocationsListCall) Pages(ctx context.Context, f func(*ListLocationsResponse) error) error {
  2634. c.ctx_ = ctx
  2635. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  2636. for {
  2637. x, err := c.Do()
  2638. if err != nil {
  2639. return err
  2640. }
  2641. if err := f(x); err != nil {
  2642. return err
  2643. }
  2644. if x.NextPageToken == "" {
  2645. return nil
  2646. }
  2647. c.PageToken(x.NextPageToken)
  2648. }
  2649. }
  2650. // method id "cloudtasks.projects.locations.queues.create":
  2651. type ProjectsLocationsQueuesCreateCall struct {
  2652. s *Service
  2653. parent string
  2654. queue *Queue
  2655. urlParams_ gensupport.URLParams
  2656. ctx_ context.Context
  2657. header_ http.Header
  2658. }
  2659. // Create: Creates a queue.
  2660. //
  2661. // Queues created with this method allow tasks to live for a maximum of
  2662. // 31
  2663. // days. After a task is 31 days old, the task will be deleted
  2664. // regardless of whether
  2665. // it was dispatched or not.
  2666. //
  2667. // WARNING: Using this method may have unintended side effects if you
  2668. // are
  2669. // using an App Engine `queue.yaml` or `queue.xml` file to manage your
  2670. // queues.
  2671. // Read
  2672. // [Overview of Queue Management and
  2673. // queue.yaml](https://cloud.google.com/tasks/docs/queue-yaml)
  2674. // before using this method.
  2675. func (r *ProjectsLocationsQueuesService) Create(parent string, queue *Queue) *ProjectsLocationsQueuesCreateCall {
  2676. c := &ProjectsLocationsQueuesCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2677. c.parent = parent
  2678. c.queue = queue
  2679. return c
  2680. }
  2681. // Fields allows partial responses to be retrieved. See
  2682. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2683. // for more information.
  2684. func (c *ProjectsLocationsQueuesCreateCall) Fields(s ...googleapi.Field) *ProjectsLocationsQueuesCreateCall {
  2685. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2686. return c
  2687. }
  2688. // Context sets the context to be used in this call's Do method. Any
  2689. // pending HTTP request will be aborted if the provided context is
  2690. // canceled.
  2691. func (c *ProjectsLocationsQueuesCreateCall) Context(ctx context.Context) *ProjectsLocationsQueuesCreateCall {
  2692. c.ctx_ = ctx
  2693. return c
  2694. }
  2695. // Header returns an http.Header that can be modified by the caller to
  2696. // add HTTP headers to the request.
  2697. func (c *ProjectsLocationsQueuesCreateCall) Header() http.Header {
  2698. if c.header_ == nil {
  2699. c.header_ = make(http.Header)
  2700. }
  2701. return c.header_
  2702. }
  2703. func (c *ProjectsLocationsQueuesCreateCall) doRequest(alt string) (*http.Response, error) {
  2704. reqHeaders := make(http.Header)
  2705. for k, v := range c.header_ {
  2706. reqHeaders[k] = v
  2707. }
  2708. reqHeaders.Set("User-Agent", c.s.userAgent())
  2709. var body io.Reader = nil
  2710. body, err := googleapi.WithoutDataWrapper.JSONReader(c.queue)
  2711. if err != nil {
  2712. return nil, err
  2713. }
  2714. reqHeaders.Set("Content-Type", "application/json")
  2715. c.urlParams_.Set("alt", alt)
  2716. c.urlParams_.Set("prettyPrint", "false")
  2717. urls := googleapi.ResolveRelative(c.s.BasePath, "v2beta2/{+parent}/queues")
  2718. urls += "?" + c.urlParams_.Encode()
  2719. req, err := http.NewRequest("POST", urls, body)
  2720. if err != nil {
  2721. return nil, err
  2722. }
  2723. req.Header = reqHeaders
  2724. googleapi.Expand(req.URL, map[string]string{
  2725. "parent": c.parent,
  2726. })
  2727. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2728. }
  2729. // Do executes the "cloudtasks.projects.locations.queues.create" call.
  2730. // Exactly one of *Queue or error will be non-nil. Any non-2xx status
  2731. // code is an error. Response headers are in either
  2732. // *Queue.ServerResponse.Header or (if a response was returned at all)
  2733. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2734. // check whether the returned error was because http.StatusNotModified
  2735. // was returned.
  2736. func (c *ProjectsLocationsQueuesCreateCall) Do(opts ...googleapi.CallOption) (*Queue, error) {
  2737. gensupport.SetOptions(c.urlParams_, opts...)
  2738. res, err := c.doRequest("json")
  2739. if res != nil && res.StatusCode == http.StatusNotModified {
  2740. if res.Body != nil {
  2741. res.Body.Close()
  2742. }
  2743. return nil, &googleapi.Error{
  2744. Code: res.StatusCode,
  2745. Header: res.Header,
  2746. }
  2747. }
  2748. if err != nil {
  2749. return nil, err
  2750. }
  2751. defer googleapi.CloseBody(res)
  2752. if err := googleapi.CheckResponse(res); err != nil {
  2753. return nil, err
  2754. }
  2755. ret := &Queue{
  2756. ServerResponse: googleapi.ServerResponse{
  2757. Header: res.Header,
  2758. HTTPStatusCode: res.StatusCode,
  2759. },
  2760. }
  2761. target := &ret
  2762. if err := gensupport.DecodeResponse(target, res); err != nil {
  2763. return nil, err
  2764. }
  2765. return ret, nil
  2766. // {
  2767. // "description": "Creates a queue.\n\nQueues created with this method allow tasks to live for a maximum of 31\ndays. After a task is 31 days old, the task will be deleted regardless of whether\nit was dispatched or not.\n\nWARNING: Using this method may have unintended side effects if you are\nusing an App Engine `queue.yaml` or `queue.xml` file to manage your queues.\nRead\n[Overview of Queue Management and queue.yaml](https://cloud.google.com/tasks/docs/queue-yaml)\nbefore using this method.",
  2768. // "flatPath": "v2beta2/projects/{projectsId}/locations/{locationsId}/queues",
  2769. // "httpMethod": "POST",
  2770. // "id": "cloudtasks.projects.locations.queues.create",
  2771. // "parameterOrder": [
  2772. // "parent"
  2773. // ],
  2774. // "parameters": {
  2775. // "parent": {
  2776. // "description": "Required.\n\nThe location name in which the queue will be created.\nFor example: `projects/PROJECT_ID/locations/LOCATION_ID`\n\nThe list of allowed locations can be obtained by calling Cloud\nTasks' implementation of\nListLocations.",
  2777. // "location": "path",
  2778. // "pattern": "^projects/[^/]+/locations/[^/]+$",
  2779. // "required": true,
  2780. // "type": "string"
  2781. // }
  2782. // },
  2783. // "path": "v2beta2/{+parent}/queues",
  2784. // "request": {
  2785. // "$ref": "Queue"
  2786. // },
  2787. // "response": {
  2788. // "$ref": "Queue"
  2789. // },
  2790. // "scopes": [
  2791. // "https://www.googleapis.com/auth/cloud-platform"
  2792. // ]
  2793. // }
  2794. }
  2795. // method id "cloudtasks.projects.locations.queues.delete":
  2796. type ProjectsLocationsQueuesDeleteCall struct {
  2797. s *Service
  2798. name string
  2799. urlParams_ gensupport.URLParams
  2800. ctx_ context.Context
  2801. header_ http.Header
  2802. }
  2803. // Delete: Deletes a queue.
  2804. //
  2805. // This command will delete the queue even if it has tasks in it.
  2806. //
  2807. // Note: If you delete a queue, a queue with the same name can't be
  2808. // created
  2809. // for 7 days.
  2810. //
  2811. // WARNING: Using this method may have unintended side effects if you
  2812. // are
  2813. // using an App Engine `queue.yaml` or `queue.xml` file to manage your
  2814. // queues.
  2815. // Read
  2816. // [Overview of Queue Management and
  2817. // queue.yaml](https://cloud.google.com/tasks/docs/queue-yaml)
  2818. // before using this method.
  2819. func (r *ProjectsLocationsQueuesService) Delete(name string) *ProjectsLocationsQueuesDeleteCall {
  2820. c := &ProjectsLocationsQueuesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2821. c.name = name
  2822. return c
  2823. }
  2824. // Fields allows partial responses to be retrieved. See
  2825. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2826. // for more information.
  2827. func (c *ProjectsLocationsQueuesDeleteCall) Fields(s ...googleapi.Field) *ProjectsLocationsQueuesDeleteCall {
  2828. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2829. return c
  2830. }
  2831. // Context sets the context to be used in this call's Do method. Any
  2832. // pending HTTP request will be aborted if the provided context is
  2833. // canceled.
  2834. func (c *ProjectsLocationsQueuesDeleteCall) Context(ctx context.Context) *ProjectsLocationsQueuesDeleteCall {
  2835. c.ctx_ = ctx
  2836. return c
  2837. }
  2838. // Header returns an http.Header that can be modified by the caller to
  2839. // add HTTP headers to the request.
  2840. func (c *ProjectsLocationsQueuesDeleteCall) Header() http.Header {
  2841. if c.header_ == nil {
  2842. c.header_ = make(http.Header)
  2843. }
  2844. return c.header_
  2845. }
  2846. func (c *ProjectsLocationsQueuesDeleteCall) doRequest(alt string) (*http.Response, error) {
  2847. reqHeaders := make(http.Header)
  2848. for k, v := range c.header_ {
  2849. reqHeaders[k] = v
  2850. }
  2851. reqHeaders.Set("User-Agent", c.s.userAgent())
  2852. var body io.Reader = nil
  2853. c.urlParams_.Set("alt", alt)
  2854. c.urlParams_.Set("prettyPrint", "false")
  2855. urls := googleapi.ResolveRelative(c.s.BasePath, "v2beta2/{+name}")
  2856. urls += "?" + c.urlParams_.Encode()
  2857. req, err := http.NewRequest("DELETE", urls, body)
  2858. if err != nil {
  2859. return nil, err
  2860. }
  2861. req.Header = reqHeaders
  2862. googleapi.Expand(req.URL, map[string]string{
  2863. "name": c.name,
  2864. })
  2865. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2866. }
  2867. // Do executes the "cloudtasks.projects.locations.queues.delete" call.
  2868. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  2869. // code is an error. Response headers are in either
  2870. // *Empty.ServerResponse.Header or (if a response was returned at all)
  2871. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2872. // check whether the returned error was because http.StatusNotModified
  2873. // was returned.
  2874. func (c *ProjectsLocationsQueuesDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  2875. gensupport.SetOptions(c.urlParams_, opts...)
  2876. res, err := c.doRequest("json")
  2877. if res != nil && res.StatusCode == http.StatusNotModified {
  2878. if res.Body != nil {
  2879. res.Body.Close()
  2880. }
  2881. return nil, &googleapi.Error{
  2882. Code: res.StatusCode,
  2883. Header: res.Header,
  2884. }
  2885. }
  2886. if err != nil {
  2887. return nil, err
  2888. }
  2889. defer googleapi.CloseBody(res)
  2890. if err := googleapi.CheckResponse(res); err != nil {
  2891. return nil, err
  2892. }
  2893. ret := &Empty{
  2894. ServerResponse: googleapi.ServerResponse{
  2895. Header: res.Header,
  2896. HTTPStatusCode: res.StatusCode,
  2897. },
  2898. }
  2899. target := &ret
  2900. if err := gensupport.DecodeResponse(target, res); err != nil {
  2901. return nil, err
  2902. }
  2903. return ret, nil
  2904. // {
  2905. // "description": "Deletes a queue.\n\nThis command will delete the queue even if it has tasks in it.\n\nNote: If you delete a queue, a queue with the same name can't be created\nfor 7 days.\n\nWARNING: Using this method may have unintended side effects if you are\nusing an App Engine `queue.yaml` or `queue.xml` file to manage your queues.\nRead\n[Overview of Queue Management and queue.yaml](https://cloud.google.com/tasks/docs/queue-yaml)\nbefore using this method.",
  2906. // "flatPath": "v2beta2/projects/{projectsId}/locations/{locationsId}/queues/{queuesId}",
  2907. // "httpMethod": "DELETE",
  2908. // "id": "cloudtasks.projects.locations.queues.delete",
  2909. // "parameterOrder": [
  2910. // "name"
  2911. // ],
  2912. // "parameters": {
  2913. // "name": {
  2914. // "description": "Required.\n\nThe queue name. For example:\n`projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID`",
  2915. // "location": "path",
  2916. // "pattern": "^projects/[^/]+/locations/[^/]+/queues/[^/]+$",
  2917. // "required": true,
  2918. // "type": "string"
  2919. // }
  2920. // },
  2921. // "path": "v2beta2/{+name}",
  2922. // "response": {
  2923. // "$ref": "Empty"
  2924. // },
  2925. // "scopes": [
  2926. // "https://www.googleapis.com/auth/cloud-platform"
  2927. // ]
  2928. // }
  2929. }
  2930. // method id "cloudtasks.projects.locations.queues.get":
  2931. type ProjectsLocationsQueuesGetCall struct {
  2932. s *Service
  2933. name string
  2934. urlParams_ gensupport.URLParams
  2935. ifNoneMatch_ string
  2936. ctx_ context.Context
  2937. header_ http.Header
  2938. }
  2939. // Get: Gets a queue.
  2940. func (r *ProjectsLocationsQueuesService) Get(name string) *ProjectsLocationsQueuesGetCall {
  2941. c := &ProjectsLocationsQueuesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2942. c.name = name
  2943. return c
  2944. }
  2945. // Fields allows partial responses to be retrieved. See
  2946. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2947. // for more information.
  2948. func (c *ProjectsLocationsQueuesGetCall) Fields(s ...googleapi.Field) *ProjectsLocationsQueuesGetCall {
  2949. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2950. return c
  2951. }
  2952. // IfNoneMatch sets the optional parameter which makes the operation
  2953. // fail if the object's ETag matches the given value. This is useful for
  2954. // getting updates only after the object has changed since the last
  2955. // request. Use googleapi.IsNotModified to check whether the response
  2956. // error from Do is the result of In-None-Match.
  2957. func (c *ProjectsLocationsQueuesGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsQueuesGetCall {
  2958. c.ifNoneMatch_ = entityTag
  2959. return c
  2960. }
  2961. // Context sets the context to be used in this call's Do method. Any
  2962. // pending HTTP request will be aborted if the provided context is
  2963. // canceled.
  2964. func (c *ProjectsLocationsQueuesGetCall) Context(ctx context.Context) *ProjectsLocationsQueuesGetCall {
  2965. c.ctx_ = ctx
  2966. return c
  2967. }
  2968. // Header returns an http.Header that can be modified by the caller to
  2969. // add HTTP headers to the request.
  2970. func (c *ProjectsLocationsQueuesGetCall) Header() http.Header {
  2971. if c.header_ == nil {
  2972. c.header_ = make(http.Header)
  2973. }
  2974. return c.header_
  2975. }
  2976. func (c *ProjectsLocationsQueuesGetCall) doRequest(alt string) (*http.Response, error) {
  2977. reqHeaders := make(http.Header)
  2978. for k, v := range c.header_ {
  2979. reqHeaders[k] = v
  2980. }
  2981. reqHeaders.Set("User-Agent", c.s.userAgent())
  2982. if c.ifNoneMatch_ != "" {
  2983. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2984. }
  2985. var body io.Reader = nil
  2986. c.urlParams_.Set("alt", alt)
  2987. c.urlParams_.Set("prettyPrint", "false")
  2988. urls := googleapi.ResolveRelative(c.s.BasePath, "v2beta2/{+name}")
  2989. urls += "?" + c.urlParams_.Encode()
  2990. req, err := http.NewRequest("GET", urls, body)
  2991. if err != nil {
  2992. return nil, err
  2993. }
  2994. req.Header = reqHeaders
  2995. googleapi.Expand(req.URL, map[string]string{
  2996. "name": c.name,
  2997. })
  2998. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2999. }
  3000. // Do executes the "cloudtasks.projects.locations.queues.get" call.
  3001. // Exactly one of *Queue or error will be non-nil. Any non-2xx status
  3002. // code is an error. Response headers are in either
  3003. // *Queue.ServerResponse.Header or (if a response was returned at all)
  3004. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3005. // check whether the returned error was because http.StatusNotModified
  3006. // was returned.
  3007. func (c *ProjectsLocationsQueuesGetCall) Do(opts ...googleapi.CallOption) (*Queue, error) {
  3008. gensupport.SetOptions(c.urlParams_, opts...)
  3009. res, err := c.doRequest("json")
  3010. if res != nil && res.StatusCode == http.StatusNotModified {
  3011. if res.Body != nil {
  3012. res.Body.Close()
  3013. }
  3014. return nil, &googleapi.Error{
  3015. Code: res.StatusCode,
  3016. Header: res.Header,
  3017. }
  3018. }
  3019. if err != nil {
  3020. return nil, err
  3021. }
  3022. defer googleapi.CloseBody(res)
  3023. if err := googleapi.CheckResponse(res); err != nil {
  3024. return nil, err
  3025. }
  3026. ret := &Queue{
  3027. ServerResponse: googleapi.ServerResponse{
  3028. Header: res.Header,
  3029. HTTPStatusCode: res.StatusCode,
  3030. },
  3031. }
  3032. target := &ret
  3033. if err := gensupport.DecodeResponse(target, res); err != nil {
  3034. return nil, err
  3035. }
  3036. return ret, nil
  3037. // {
  3038. // "description": "Gets a queue.",
  3039. // "flatPath": "v2beta2/projects/{projectsId}/locations/{locationsId}/queues/{queuesId}",
  3040. // "httpMethod": "GET",
  3041. // "id": "cloudtasks.projects.locations.queues.get",
  3042. // "parameterOrder": [
  3043. // "name"
  3044. // ],
  3045. // "parameters": {
  3046. // "name": {
  3047. // "description": "Required.\n\nThe resource name of the queue. For example:\n`projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID`",
  3048. // "location": "path",
  3049. // "pattern": "^projects/[^/]+/locations/[^/]+/queues/[^/]+$",
  3050. // "required": true,
  3051. // "type": "string"
  3052. // }
  3053. // },
  3054. // "path": "v2beta2/{+name}",
  3055. // "response": {
  3056. // "$ref": "Queue"
  3057. // },
  3058. // "scopes": [
  3059. // "https://www.googleapis.com/auth/cloud-platform"
  3060. // ]
  3061. // }
  3062. }
  3063. // method id "cloudtasks.projects.locations.queues.getIamPolicy":
  3064. type ProjectsLocationsQueuesGetIamPolicyCall struct {
  3065. s *Service
  3066. resource string
  3067. getiampolicyrequest *GetIamPolicyRequest
  3068. urlParams_ gensupport.URLParams
  3069. ctx_ context.Context
  3070. header_ http.Header
  3071. }
  3072. // GetIamPolicy: Gets the access control policy for a Queue.
  3073. // Returns an empty policy if the resource exists and does not have a
  3074. // policy
  3075. // set.
  3076. //
  3077. // Authorization requires the following
  3078. // [Google IAM](https://cloud.google.com/iam) permission on the
  3079. // specified
  3080. // resource parent:
  3081. //
  3082. // * `cloudtasks.queues.getIamPolicy`
  3083. func (r *ProjectsLocationsQueuesService) GetIamPolicy(resource string, getiampolicyrequest *GetIamPolicyRequest) *ProjectsLocationsQueuesGetIamPolicyCall {
  3084. c := &ProjectsLocationsQueuesGetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3085. c.resource = resource
  3086. c.getiampolicyrequest = getiampolicyrequest
  3087. return c
  3088. }
  3089. // Fields allows partial responses to be retrieved. See
  3090. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3091. // for more information.
  3092. func (c *ProjectsLocationsQueuesGetIamPolicyCall) Fields(s ...googleapi.Field) *ProjectsLocationsQueuesGetIamPolicyCall {
  3093. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3094. return c
  3095. }
  3096. // Context sets the context to be used in this call's Do method. Any
  3097. // pending HTTP request will be aborted if the provided context is
  3098. // canceled.
  3099. func (c *ProjectsLocationsQueuesGetIamPolicyCall) Context(ctx context.Context) *ProjectsLocationsQueuesGetIamPolicyCall {
  3100. c.ctx_ = ctx
  3101. return c
  3102. }
  3103. // Header returns an http.Header that can be modified by the caller to
  3104. // add HTTP headers to the request.
  3105. func (c *ProjectsLocationsQueuesGetIamPolicyCall) Header() http.Header {
  3106. if c.header_ == nil {
  3107. c.header_ = make(http.Header)
  3108. }
  3109. return c.header_
  3110. }
  3111. func (c *ProjectsLocationsQueuesGetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
  3112. reqHeaders := make(http.Header)
  3113. for k, v := range c.header_ {
  3114. reqHeaders[k] = v
  3115. }
  3116. reqHeaders.Set("User-Agent", c.s.userAgent())
  3117. var body io.Reader = nil
  3118. body, err := googleapi.WithoutDataWrapper.JSONReader(c.getiampolicyrequest)
  3119. if err != nil {
  3120. return nil, err
  3121. }
  3122. reqHeaders.Set("Content-Type", "application/json")
  3123. c.urlParams_.Set("alt", alt)
  3124. c.urlParams_.Set("prettyPrint", "false")
  3125. urls := googleapi.ResolveRelative(c.s.BasePath, "v2beta2/{+resource}:getIamPolicy")
  3126. urls += "?" + c.urlParams_.Encode()
  3127. req, err := http.NewRequest("POST", urls, body)
  3128. if err != nil {
  3129. return nil, err
  3130. }
  3131. req.Header = reqHeaders
  3132. googleapi.Expand(req.URL, map[string]string{
  3133. "resource": c.resource,
  3134. })
  3135. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3136. }
  3137. // Do executes the "cloudtasks.projects.locations.queues.getIamPolicy" call.
  3138. // Exactly one of *Policy or error will be non-nil. Any non-2xx status
  3139. // code is an error. Response headers are in either
  3140. // *Policy.ServerResponse.Header or (if a response was returned at all)
  3141. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3142. // check whether the returned error was because http.StatusNotModified
  3143. // was returned.
  3144. func (c *ProjectsLocationsQueuesGetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) {
  3145. gensupport.SetOptions(c.urlParams_, opts...)
  3146. res, err := c.doRequest("json")
  3147. if res != nil && res.StatusCode == http.StatusNotModified {
  3148. if res.Body != nil {
  3149. res.Body.Close()
  3150. }
  3151. return nil, &googleapi.Error{
  3152. Code: res.StatusCode,
  3153. Header: res.Header,
  3154. }
  3155. }
  3156. if err != nil {
  3157. return nil, err
  3158. }
  3159. defer googleapi.CloseBody(res)
  3160. if err := googleapi.CheckResponse(res); err != nil {
  3161. return nil, err
  3162. }
  3163. ret := &Policy{
  3164. ServerResponse: googleapi.ServerResponse{
  3165. Header: res.Header,
  3166. HTTPStatusCode: res.StatusCode,
  3167. },
  3168. }
  3169. target := &ret
  3170. if err := gensupport.DecodeResponse(target, res); err != nil {
  3171. return nil, err
  3172. }
  3173. return ret, nil
  3174. // {
  3175. // "description": "Gets the access control policy for a Queue.\nReturns an empty policy if the resource exists and does not have a policy\nset.\n\nAuthorization requires the following\n[Google IAM](https://cloud.google.com/iam) permission on the specified\nresource parent:\n\n* `cloudtasks.queues.getIamPolicy`",
  3176. // "flatPath": "v2beta2/projects/{projectsId}/locations/{locationsId}/queues/{queuesId}:getIamPolicy",
  3177. // "httpMethod": "POST",
  3178. // "id": "cloudtasks.projects.locations.queues.getIamPolicy",
  3179. // "parameterOrder": [
  3180. // "resource"
  3181. // ],
  3182. // "parameters": {
  3183. // "resource": {
  3184. // "description": "REQUIRED: The resource for which the policy is being requested.\nSee the operation documentation for the appropriate value for this field.",
  3185. // "location": "path",
  3186. // "pattern": "^projects/[^/]+/locations/[^/]+/queues/[^/]+$",
  3187. // "required": true,
  3188. // "type": "string"
  3189. // }
  3190. // },
  3191. // "path": "v2beta2/{+resource}:getIamPolicy",
  3192. // "request": {
  3193. // "$ref": "GetIamPolicyRequest"
  3194. // },
  3195. // "response": {
  3196. // "$ref": "Policy"
  3197. // },
  3198. // "scopes": [
  3199. // "https://www.googleapis.com/auth/cloud-platform"
  3200. // ]
  3201. // }
  3202. }
  3203. // method id "cloudtasks.projects.locations.queues.list":
  3204. type ProjectsLocationsQueuesListCall struct {
  3205. s *Service
  3206. parent string
  3207. urlParams_ gensupport.URLParams
  3208. ifNoneMatch_ string
  3209. ctx_ context.Context
  3210. header_ http.Header
  3211. }
  3212. // List: Lists queues.
  3213. //
  3214. // Queues are returned in lexicographical order.
  3215. func (r *ProjectsLocationsQueuesService) List(parent string) *ProjectsLocationsQueuesListCall {
  3216. c := &ProjectsLocationsQueuesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3217. c.parent = parent
  3218. return c
  3219. }
  3220. // Filter sets the optional parameter "filter": `filter` can be used to
  3221. // specify a subset of queues. Any Queue
  3222. // field can be used as a filter and several operators as supported.
  3223. // For example: `<=, <, >=, >, !=, =, :`. The filter syntax is the same
  3224. // as
  3225. // described in
  3226. // [Stackdriver's Advanced Logs
  3227. // Filters](https://cloud.google.com/logging/docs/view/advanced_filters).
  3228. //
  3229. //
  3230. // Sample filter "app_engine_http_target: *".
  3231. //
  3232. // Note that using filters might cause fewer queues than
  3233. // the
  3234. // requested_page size to be returned.
  3235. func (c *ProjectsLocationsQueuesListCall) Filter(filter string) *ProjectsLocationsQueuesListCall {
  3236. c.urlParams_.Set("filter", filter)
  3237. return c
  3238. }
  3239. // PageSize sets the optional parameter "pageSize": Requested page
  3240. // size.
  3241. //
  3242. // The maximum page size is 9800. If unspecified, the page size will
  3243. // be the maximum. Fewer queues than requested might be returned,
  3244. // even if more queues exist; use the
  3245. // next_page_token in the
  3246. // response to determine if more queues exist.
  3247. func (c *ProjectsLocationsQueuesListCall) PageSize(pageSize int64) *ProjectsLocationsQueuesListCall {
  3248. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  3249. return c
  3250. }
  3251. // PageToken sets the optional parameter "pageToken": A token
  3252. // identifying the page of results to return.
  3253. //
  3254. // To request the first page results, page_token must be empty.
  3255. // To
  3256. // request the next page of results, page_token must be the value
  3257. // of
  3258. // next_page_token returned
  3259. // from the previous call to ListQueues
  3260. // method. It is an error to switch the value of the
  3261. // filter while iterating through pages.
  3262. func (c *ProjectsLocationsQueuesListCall) PageToken(pageToken string) *ProjectsLocationsQueuesListCall {
  3263. c.urlParams_.Set("pageToken", pageToken)
  3264. return c
  3265. }
  3266. // Fields allows partial responses to be retrieved. See
  3267. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3268. // for more information.
  3269. func (c *ProjectsLocationsQueuesListCall) Fields(s ...googleapi.Field) *ProjectsLocationsQueuesListCall {
  3270. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3271. return c
  3272. }
  3273. // IfNoneMatch sets the optional parameter which makes the operation
  3274. // fail if the object's ETag matches the given value. This is useful for
  3275. // getting updates only after the object has changed since the last
  3276. // request. Use googleapi.IsNotModified to check whether the response
  3277. // error from Do is the result of In-None-Match.
  3278. func (c *ProjectsLocationsQueuesListCall) IfNoneMatch(entityTag string) *ProjectsLocationsQueuesListCall {
  3279. c.ifNoneMatch_ = entityTag
  3280. return c
  3281. }
  3282. // Context sets the context to be used in this call's Do method. Any
  3283. // pending HTTP request will be aborted if the provided context is
  3284. // canceled.
  3285. func (c *ProjectsLocationsQueuesListCall) Context(ctx context.Context) *ProjectsLocationsQueuesListCall {
  3286. c.ctx_ = ctx
  3287. return c
  3288. }
  3289. // Header returns an http.Header that can be modified by the caller to
  3290. // add HTTP headers to the request.
  3291. func (c *ProjectsLocationsQueuesListCall) Header() http.Header {
  3292. if c.header_ == nil {
  3293. c.header_ = make(http.Header)
  3294. }
  3295. return c.header_
  3296. }
  3297. func (c *ProjectsLocationsQueuesListCall) doRequest(alt string) (*http.Response, error) {
  3298. reqHeaders := make(http.Header)
  3299. for k, v := range c.header_ {
  3300. reqHeaders[k] = v
  3301. }
  3302. reqHeaders.Set("User-Agent", c.s.userAgent())
  3303. if c.ifNoneMatch_ != "" {
  3304. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3305. }
  3306. var body io.Reader = nil
  3307. c.urlParams_.Set("alt", alt)
  3308. c.urlParams_.Set("prettyPrint", "false")
  3309. urls := googleapi.ResolveRelative(c.s.BasePath, "v2beta2/{+parent}/queues")
  3310. urls += "?" + c.urlParams_.Encode()
  3311. req, err := http.NewRequest("GET", urls, body)
  3312. if err != nil {
  3313. return nil, err
  3314. }
  3315. req.Header = reqHeaders
  3316. googleapi.Expand(req.URL, map[string]string{
  3317. "parent": c.parent,
  3318. })
  3319. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3320. }
  3321. // Do executes the "cloudtasks.projects.locations.queues.list" call.
  3322. // Exactly one of *ListQueuesResponse or error will be non-nil. Any
  3323. // non-2xx status code is an error. Response headers are in either
  3324. // *ListQueuesResponse.ServerResponse.Header or (if a response was
  3325. // returned at all) in error.(*googleapi.Error).Header. Use
  3326. // googleapi.IsNotModified to check whether the returned error was
  3327. // because http.StatusNotModified was returned.
  3328. func (c *ProjectsLocationsQueuesListCall) Do(opts ...googleapi.CallOption) (*ListQueuesResponse, error) {
  3329. gensupport.SetOptions(c.urlParams_, opts...)
  3330. res, err := c.doRequest("json")
  3331. if res != nil && res.StatusCode == http.StatusNotModified {
  3332. if res.Body != nil {
  3333. res.Body.Close()
  3334. }
  3335. return nil, &googleapi.Error{
  3336. Code: res.StatusCode,
  3337. Header: res.Header,
  3338. }
  3339. }
  3340. if err != nil {
  3341. return nil, err
  3342. }
  3343. defer googleapi.CloseBody(res)
  3344. if err := googleapi.CheckResponse(res); err != nil {
  3345. return nil, err
  3346. }
  3347. ret := &ListQueuesResponse{
  3348. ServerResponse: googleapi.ServerResponse{
  3349. Header: res.Header,
  3350. HTTPStatusCode: res.StatusCode,
  3351. },
  3352. }
  3353. target := &ret
  3354. if err := gensupport.DecodeResponse(target, res); err != nil {
  3355. return nil, err
  3356. }
  3357. return ret, nil
  3358. // {
  3359. // "description": "Lists queues.\n\nQueues are returned in lexicographical order.",
  3360. // "flatPath": "v2beta2/projects/{projectsId}/locations/{locationsId}/queues",
  3361. // "httpMethod": "GET",
  3362. // "id": "cloudtasks.projects.locations.queues.list",
  3363. // "parameterOrder": [
  3364. // "parent"
  3365. // ],
  3366. // "parameters": {
  3367. // "filter": {
  3368. // "description": "`filter` can be used to specify a subset of queues. Any Queue\nfield can be used as a filter and several operators as supported.\nFor example: `\u003c=, \u003c, \u003e=, \u003e, !=, =, :`. The filter syntax is the same as\ndescribed in\n[Stackdriver's Advanced Logs Filters](https://cloud.google.com/logging/docs/view/advanced_filters).\n\nSample filter \"app_engine_http_target: *\".\n\nNote that using filters might cause fewer queues than the\nrequested_page size to be returned.",
  3369. // "location": "query",
  3370. // "type": "string"
  3371. // },
  3372. // "pageSize": {
  3373. // "description": "Requested page size.\n\nThe maximum page size is 9800. If unspecified, the page size will\nbe the maximum. Fewer queues than requested might be returned,\neven if more queues exist; use the\nnext_page_token in the\nresponse to determine if more queues exist.",
  3374. // "format": "int32",
  3375. // "location": "query",
  3376. // "type": "integer"
  3377. // },
  3378. // "pageToken": {
  3379. // "description": "A token identifying the page of results to return.\n\nTo request 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\nfrom the previous call to ListQueues\nmethod. It is an error to switch the value of the\nfilter while iterating through pages.",
  3380. // "location": "query",
  3381. // "type": "string"
  3382. // },
  3383. // "parent": {
  3384. // "description": "Required.\n\nThe location name.\nFor example: `projects/PROJECT_ID/locations/LOCATION_ID`",
  3385. // "location": "path",
  3386. // "pattern": "^projects/[^/]+/locations/[^/]+$",
  3387. // "required": true,
  3388. // "type": "string"
  3389. // }
  3390. // },
  3391. // "path": "v2beta2/{+parent}/queues",
  3392. // "response": {
  3393. // "$ref": "ListQueuesResponse"
  3394. // },
  3395. // "scopes": [
  3396. // "https://www.googleapis.com/auth/cloud-platform"
  3397. // ]
  3398. // }
  3399. }
  3400. // Pages invokes f for each page of results.
  3401. // A non-nil error returned from f will halt the iteration.
  3402. // The provided context supersedes any context provided to the Context method.
  3403. func (c *ProjectsLocationsQueuesListCall) Pages(ctx context.Context, f func(*ListQueuesResponse) error) error {
  3404. c.ctx_ = ctx
  3405. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  3406. for {
  3407. x, err := c.Do()
  3408. if err != nil {
  3409. return err
  3410. }
  3411. if err := f(x); err != nil {
  3412. return err
  3413. }
  3414. if x.NextPageToken == "" {
  3415. return nil
  3416. }
  3417. c.PageToken(x.NextPageToken)
  3418. }
  3419. }
  3420. // method id "cloudtasks.projects.locations.queues.patch":
  3421. type ProjectsLocationsQueuesPatchCall struct {
  3422. s *Service
  3423. name string
  3424. queue *Queue
  3425. urlParams_ gensupport.URLParams
  3426. ctx_ context.Context
  3427. header_ http.Header
  3428. }
  3429. // Patch: Updates a queue.
  3430. //
  3431. // This method creates the queue if it does not exist and updates
  3432. // the queue if it does exist.
  3433. //
  3434. // Queues created with this method allow tasks to live for a maximum of
  3435. // 31
  3436. // days. After a task is 31 days old, the task will be deleted
  3437. // regardless of whether
  3438. // it was dispatched or not.
  3439. //
  3440. // WARNING: Using this method may have unintended side effects if you
  3441. // are
  3442. // using an App Engine `queue.yaml` or `queue.xml` file to manage your
  3443. // queues.
  3444. // Read
  3445. // [Overview of Queue Management and
  3446. // queue.yaml](https://cloud.google.com/tasks/docs/queue-yaml)
  3447. // before using this method.
  3448. func (r *ProjectsLocationsQueuesService) Patch(name string, queue *Queue) *ProjectsLocationsQueuesPatchCall {
  3449. c := &ProjectsLocationsQueuesPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3450. c.name = name
  3451. c.queue = queue
  3452. return c
  3453. }
  3454. // UpdateMask sets the optional parameter "updateMask": A mask used to
  3455. // specify which fields of the queue are being updated.
  3456. //
  3457. // If empty, then all fields will be updated.
  3458. func (c *ProjectsLocationsQueuesPatchCall) UpdateMask(updateMask string) *ProjectsLocationsQueuesPatchCall {
  3459. c.urlParams_.Set("updateMask", updateMask)
  3460. return c
  3461. }
  3462. // Fields allows partial responses to be retrieved. See
  3463. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3464. // for more information.
  3465. func (c *ProjectsLocationsQueuesPatchCall) Fields(s ...googleapi.Field) *ProjectsLocationsQueuesPatchCall {
  3466. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3467. return c
  3468. }
  3469. // Context sets the context to be used in this call's Do method. Any
  3470. // pending HTTP request will be aborted if the provided context is
  3471. // canceled.
  3472. func (c *ProjectsLocationsQueuesPatchCall) Context(ctx context.Context) *ProjectsLocationsQueuesPatchCall {
  3473. c.ctx_ = ctx
  3474. return c
  3475. }
  3476. // Header returns an http.Header that can be modified by the caller to
  3477. // add HTTP headers to the request.
  3478. func (c *ProjectsLocationsQueuesPatchCall) Header() http.Header {
  3479. if c.header_ == nil {
  3480. c.header_ = make(http.Header)
  3481. }
  3482. return c.header_
  3483. }
  3484. func (c *ProjectsLocationsQueuesPatchCall) doRequest(alt string) (*http.Response, error) {
  3485. reqHeaders := make(http.Header)
  3486. for k, v := range c.header_ {
  3487. reqHeaders[k] = v
  3488. }
  3489. reqHeaders.Set("User-Agent", c.s.userAgent())
  3490. var body io.Reader = nil
  3491. body, err := googleapi.WithoutDataWrapper.JSONReader(c.queue)
  3492. if err != nil {
  3493. return nil, err
  3494. }
  3495. reqHeaders.Set("Content-Type", "application/json")
  3496. c.urlParams_.Set("alt", alt)
  3497. c.urlParams_.Set("prettyPrint", "false")
  3498. urls := googleapi.ResolveRelative(c.s.BasePath, "v2beta2/{+name}")
  3499. urls += "?" + c.urlParams_.Encode()
  3500. req, err := http.NewRequest("PATCH", urls, body)
  3501. if err != nil {
  3502. return nil, err
  3503. }
  3504. req.Header = reqHeaders
  3505. googleapi.Expand(req.URL, map[string]string{
  3506. "name": c.name,
  3507. })
  3508. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3509. }
  3510. // Do executes the "cloudtasks.projects.locations.queues.patch" call.
  3511. // Exactly one of *Queue or error will be non-nil. Any non-2xx status
  3512. // code is an error. Response headers are in either
  3513. // *Queue.ServerResponse.Header or (if a response was returned at all)
  3514. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3515. // check whether the returned error was because http.StatusNotModified
  3516. // was returned.
  3517. func (c *ProjectsLocationsQueuesPatchCall) Do(opts ...googleapi.CallOption) (*Queue, error) {
  3518. gensupport.SetOptions(c.urlParams_, opts...)
  3519. res, err := c.doRequest("json")
  3520. if res != nil && res.StatusCode == http.StatusNotModified {
  3521. if res.Body != nil {
  3522. res.Body.Close()
  3523. }
  3524. return nil, &googleapi.Error{
  3525. Code: res.StatusCode,
  3526. Header: res.Header,
  3527. }
  3528. }
  3529. if err != nil {
  3530. return nil, err
  3531. }
  3532. defer googleapi.CloseBody(res)
  3533. if err := googleapi.CheckResponse(res); err != nil {
  3534. return nil, err
  3535. }
  3536. ret := &Queue{
  3537. ServerResponse: googleapi.ServerResponse{
  3538. Header: res.Header,
  3539. HTTPStatusCode: res.StatusCode,
  3540. },
  3541. }
  3542. target := &ret
  3543. if err := gensupport.DecodeResponse(target, res); err != nil {
  3544. return nil, err
  3545. }
  3546. return ret, nil
  3547. // {
  3548. // "description": "Updates a queue.\n\nThis method creates the queue if it does not exist and updates\nthe queue if it does exist.\n\nQueues created with this method allow tasks to live for a maximum of 31\ndays. After a task is 31 days old, the task will be deleted regardless of whether\nit was dispatched or not.\n\nWARNING: Using this method may have unintended side effects if you are\nusing an App Engine `queue.yaml` or `queue.xml` file to manage your queues.\nRead\n[Overview of Queue Management and queue.yaml](https://cloud.google.com/tasks/docs/queue-yaml)\nbefore using this method.",
  3549. // "flatPath": "v2beta2/projects/{projectsId}/locations/{locationsId}/queues/{queuesId}",
  3550. // "httpMethod": "PATCH",
  3551. // "id": "cloudtasks.projects.locations.queues.patch",
  3552. // "parameterOrder": [
  3553. // "name"
  3554. // ],
  3555. // "parameters": {
  3556. // "name": {
  3557. // "description": "Caller-specified and required in CreateQueue,\nafter which it becomes output only.\n\nThe queue name.\n\nThe queue name must have the following format:\n`projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_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 projects](https://cloud.google.com/resource-manager/docs/creating-managing-projects#identifying_projects)\n* `LOCATION_ID` is the canonical ID for the queue'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* `QUEUE_ID` can contain letters ([A-Za-z]), numbers ([0-9]), or\n hyphens (-). The maximum length is 100 characters.",
  3558. // "location": "path",
  3559. // "pattern": "^projects/[^/]+/locations/[^/]+/queues/[^/]+$",
  3560. // "required": true,
  3561. // "type": "string"
  3562. // },
  3563. // "updateMask": {
  3564. // "description": "A mask used to specify which fields of the queue are being updated.\n\nIf empty, then all fields will be updated.",
  3565. // "format": "google-fieldmask",
  3566. // "location": "query",
  3567. // "type": "string"
  3568. // }
  3569. // },
  3570. // "path": "v2beta2/{+name}",
  3571. // "request": {
  3572. // "$ref": "Queue"
  3573. // },
  3574. // "response": {
  3575. // "$ref": "Queue"
  3576. // },
  3577. // "scopes": [
  3578. // "https://www.googleapis.com/auth/cloud-platform"
  3579. // ]
  3580. // }
  3581. }
  3582. // method id "cloudtasks.projects.locations.queues.pause":
  3583. type ProjectsLocationsQueuesPauseCall struct {
  3584. s *Service
  3585. name string
  3586. pausequeuerequest *PauseQueueRequest
  3587. urlParams_ gensupport.URLParams
  3588. ctx_ context.Context
  3589. header_ http.Header
  3590. }
  3591. // Pause: Pauses the queue.
  3592. //
  3593. // If a queue is paused then the system will stop dispatching
  3594. // tasks
  3595. // until the queue is resumed via
  3596. // ResumeQueue. Tasks can still be added
  3597. // when the queue is paused. A queue is paused if its
  3598. // state is PAUSED.
  3599. func (r *ProjectsLocationsQueuesService) Pause(name string, pausequeuerequest *PauseQueueRequest) *ProjectsLocationsQueuesPauseCall {
  3600. c := &ProjectsLocationsQueuesPauseCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3601. c.name = name
  3602. c.pausequeuerequest = pausequeuerequest
  3603. return c
  3604. }
  3605. // Fields allows partial responses to be retrieved. See
  3606. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3607. // for more information.
  3608. func (c *ProjectsLocationsQueuesPauseCall) Fields(s ...googleapi.Field) *ProjectsLocationsQueuesPauseCall {
  3609. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3610. return c
  3611. }
  3612. // Context sets the context to be used in this call's Do method. Any
  3613. // pending HTTP request will be aborted if the provided context is
  3614. // canceled.
  3615. func (c *ProjectsLocationsQueuesPauseCall) Context(ctx context.Context) *ProjectsLocationsQueuesPauseCall {
  3616. c.ctx_ = ctx
  3617. return c
  3618. }
  3619. // Header returns an http.Header that can be modified by the caller to
  3620. // add HTTP headers to the request.
  3621. func (c *ProjectsLocationsQueuesPauseCall) Header() http.Header {
  3622. if c.header_ == nil {
  3623. c.header_ = make(http.Header)
  3624. }
  3625. return c.header_
  3626. }
  3627. func (c *ProjectsLocationsQueuesPauseCall) doRequest(alt string) (*http.Response, error) {
  3628. reqHeaders := make(http.Header)
  3629. for k, v := range c.header_ {
  3630. reqHeaders[k] = v
  3631. }
  3632. reqHeaders.Set("User-Agent", c.s.userAgent())
  3633. var body io.Reader = nil
  3634. body, err := googleapi.WithoutDataWrapper.JSONReader(c.pausequeuerequest)
  3635. if err != nil {
  3636. return nil, err
  3637. }
  3638. reqHeaders.Set("Content-Type", "application/json")
  3639. c.urlParams_.Set("alt", alt)
  3640. c.urlParams_.Set("prettyPrint", "false")
  3641. urls := googleapi.ResolveRelative(c.s.BasePath, "v2beta2/{+name}:pause")
  3642. urls += "?" + c.urlParams_.Encode()
  3643. req, err := http.NewRequest("POST", urls, body)
  3644. if err != nil {
  3645. return nil, err
  3646. }
  3647. req.Header = reqHeaders
  3648. googleapi.Expand(req.URL, map[string]string{
  3649. "name": c.name,
  3650. })
  3651. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3652. }
  3653. // Do executes the "cloudtasks.projects.locations.queues.pause" call.
  3654. // Exactly one of *Queue or error will be non-nil. Any non-2xx status
  3655. // code is an error. Response headers are in either
  3656. // *Queue.ServerResponse.Header or (if a response was returned at all)
  3657. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3658. // check whether the returned error was because http.StatusNotModified
  3659. // was returned.
  3660. func (c *ProjectsLocationsQueuesPauseCall) Do(opts ...googleapi.CallOption) (*Queue, error) {
  3661. gensupport.SetOptions(c.urlParams_, opts...)
  3662. res, err := c.doRequest("json")
  3663. if res != nil && res.StatusCode == http.StatusNotModified {
  3664. if res.Body != nil {
  3665. res.Body.Close()
  3666. }
  3667. return nil, &googleapi.Error{
  3668. Code: res.StatusCode,
  3669. Header: res.Header,
  3670. }
  3671. }
  3672. if err != nil {
  3673. return nil, err
  3674. }
  3675. defer googleapi.CloseBody(res)
  3676. if err := googleapi.CheckResponse(res); err != nil {
  3677. return nil, err
  3678. }
  3679. ret := &Queue{
  3680. ServerResponse: googleapi.ServerResponse{
  3681. Header: res.Header,
  3682. HTTPStatusCode: res.StatusCode,
  3683. },
  3684. }
  3685. target := &ret
  3686. if err := gensupport.DecodeResponse(target, res); err != nil {
  3687. return nil, err
  3688. }
  3689. return ret, nil
  3690. // {
  3691. // "description": "Pauses the queue.\n\nIf a queue is paused then the system will stop dispatching tasks\nuntil the queue is resumed via\nResumeQueue. Tasks can still be added\nwhen the queue is paused. A queue is paused if its\nstate is PAUSED.",
  3692. // "flatPath": "v2beta2/projects/{projectsId}/locations/{locationsId}/queues/{queuesId}:pause",
  3693. // "httpMethod": "POST",
  3694. // "id": "cloudtasks.projects.locations.queues.pause",
  3695. // "parameterOrder": [
  3696. // "name"
  3697. // ],
  3698. // "parameters": {
  3699. // "name": {
  3700. // "description": "Required.\n\nThe queue name. For example:\n`projects/PROJECT_ID/location/LOCATION_ID/queues/QUEUE_ID`",
  3701. // "location": "path",
  3702. // "pattern": "^projects/[^/]+/locations/[^/]+/queues/[^/]+$",
  3703. // "required": true,
  3704. // "type": "string"
  3705. // }
  3706. // },
  3707. // "path": "v2beta2/{+name}:pause",
  3708. // "request": {
  3709. // "$ref": "PauseQueueRequest"
  3710. // },
  3711. // "response": {
  3712. // "$ref": "Queue"
  3713. // },
  3714. // "scopes": [
  3715. // "https://www.googleapis.com/auth/cloud-platform"
  3716. // ]
  3717. // }
  3718. }
  3719. // method id "cloudtasks.projects.locations.queues.purge":
  3720. type ProjectsLocationsQueuesPurgeCall struct {
  3721. s *Service
  3722. name string
  3723. purgequeuerequest *PurgeQueueRequest
  3724. urlParams_ gensupport.URLParams
  3725. ctx_ context.Context
  3726. header_ http.Header
  3727. }
  3728. // Purge: Purges a queue by deleting all of its tasks.
  3729. //
  3730. // All tasks created before this method is called are permanently
  3731. // deleted.
  3732. //
  3733. // Purge operations can take up to one minute to take effect.
  3734. // Tasks
  3735. // might be dispatched before the purge takes effect. A purge is
  3736. // irreversible.
  3737. func (r *ProjectsLocationsQueuesService) Purge(name string, purgequeuerequest *PurgeQueueRequest) *ProjectsLocationsQueuesPurgeCall {
  3738. c := &ProjectsLocationsQueuesPurgeCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3739. c.name = name
  3740. c.purgequeuerequest = purgequeuerequest
  3741. return c
  3742. }
  3743. // Fields allows partial responses to be retrieved. See
  3744. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3745. // for more information.
  3746. func (c *ProjectsLocationsQueuesPurgeCall) Fields(s ...googleapi.Field) *ProjectsLocationsQueuesPurgeCall {
  3747. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3748. return c
  3749. }
  3750. // Context sets the context to be used in this call's Do method. Any
  3751. // pending HTTP request will be aborted if the provided context is
  3752. // canceled.
  3753. func (c *ProjectsLocationsQueuesPurgeCall) Context(ctx context.Context) *ProjectsLocationsQueuesPurgeCall {
  3754. c.ctx_ = ctx
  3755. return c
  3756. }
  3757. // Header returns an http.Header that can be modified by the caller to
  3758. // add HTTP headers to the request.
  3759. func (c *ProjectsLocationsQueuesPurgeCall) Header() http.Header {
  3760. if c.header_ == nil {
  3761. c.header_ = make(http.Header)
  3762. }
  3763. return c.header_
  3764. }
  3765. func (c *ProjectsLocationsQueuesPurgeCall) doRequest(alt string) (*http.Response, error) {
  3766. reqHeaders := make(http.Header)
  3767. for k, v := range c.header_ {
  3768. reqHeaders[k] = v
  3769. }
  3770. reqHeaders.Set("User-Agent", c.s.userAgent())
  3771. var body io.Reader = nil
  3772. body, err := googleapi.WithoutDataWrapper.JSONReader(c.purgequeuerequest)
  3773. if err != nil {
  3774. return nil, err
  3775. }
  3776. reqHeaders.Set("Content-Type", "application/json")
  3777. c.urlParams_.Set("alt", alt)
  3778. c.urlParams_.Set("prettyPrint", "false")
  3779. urls := googleapi.ResolveRelative(c.s.BasePath, "v2beta2/{+name}:purge")
  3780. urls += "?" + c.urlParams_.Encode()
  3781. req, err := http.NewRequest("POST", urls, body)
  3782. if err != nil {
  3783. return nil, err
  3784. }
  3785. req.Header = reqHeaders
  3786. googleapi.Expand(req.URL, map[string]string{
  3787. "name": c.name,
  3788. })
  3789. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3790. }
  3791. // Do executes the "cloudtasks.projects.locations.queues.purge" call.
  3792. // Exactly one of *Queue or error will be non-nil. Any non-2xx status
  3793. // code is an error. Response headers are in either
  3794. // *Queue.ServerResponse.Header or (if a response was returned at all)
  3795. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3796. // check whether the returned error was because http.StatusNotModified
  3797. // was returned.
  3798. func (c *ProjectsLocationsQueuesPurgeCall) Do(opts ...googleapi.CallOption) (*Queue, error) {
  3799. gensupport.SetOptions(c.urlParams_, opts...)
  3800. res, err := c.doRequest("json")
  3801. if res != nil && res.StatusCode == http.StatusNotModified {
  3802. if res.Body != nil {
  3803. res.Body.Close()
  3804. }
  3805. return nil, &googleapi.Error{
  3806. Code: res.StatusCode,
  3807. Header: res.Header,
  3808. }
  3809. }
  3810. if err != nil {
  3811. return nil, err
  3812. }
  3813. defer googleapi.CloseBody(res)
  3814. if err := googleapi.CheckResponse(res); err != nil {
  3815. return nil, err
  3816. }
  3817. ret := &Queue{
  3818. ServerResponse: googleapi.ServerResponse{
  3819. Header: res.Header,
  3820. HTTPStatusCode: res.StatusCode,
  3821. },
  3822. }
  3823. target := &ret
  3824. if err := gensupport.DecodeResponse(target, res); err != nil {
  3825. return nil, err
  3826. }
  3827. return ret, nil
  3828. // {
  3829. // "description": "Purges a queue by deleting all of its tasks.\n\nAll tasks created before this method is called are permanently deleted.\n\nPurge operations can take up to one minute to take effect. Tasks\nmight be dispatched before the purge takes effect. A purge is irreversible.",
  3830. // "flatPath": "v2beta2/projects/{projectsId}/locations/{locationsId}/queues/{queuesId}:purge",
  3831. // "httpMethod": "POST",
  3832. // "id": "cloudtasks.projects.locations.queues.purge",
  3833. // "parameterOrder": [
  3834. // "name"
  3835. // ],
  3836. // "parameters": {
  3837. // "name": {
  3838. // "description": "Required.\n\nThe queue name. For example:\n`projects/PROJECT_ID/location/LOCATION_ID/queues/QUEUE_ID`",
  3839. // "location": "path",
  3840. // "pattern": "^projects/[^/]+/locations/[^/]+/queues/[^/]+$",
  3841. // "required": true,
  3842. // "type": "string"
  3843. // }
  3844. // },
  3845. // "path": "v2beta2/{+name}:purge",
  3846. // "request": {
  3847. // "$ref": "PurgeQueueRequest"
  3848. // },
  3849. // "response": {
  3850. // "$ref": "Queue"
  3851. // },
  3852. // "scopes": [
  3853. // "https://www.googleapis.com/auth/cloud-platform"
  3854. // ]
  3855. // }
  3856. }
  3857. // method id "cloudtasks.projects.locations.queues.resume":
  3858. type ProjectsLocationsQueuesResumeCall struct {
  3859. s *Service
  3860. name string
  3861. resumequeuerequest *ResumeQueueRequest
  3862. urlParams_ gensupport.URLParams
  3863. ctx_ context.Context
  3864. header_ http.Header
  3865. }
  3866. // Resume: Resume a queue.
  3867. //
  3868. // This method resumes a queue after it has been
  3869. // PAUSED or
  3870. // DISABLED. The state of a queue is stored
  3871. // in the queue's state; after calling this method it
  3872. // will be set to RUNNING.
  3873. //
  3874. // WARNING: Resuming many high-QPS queues at the same time can
  3875. // lead to target overloading. If you are resuming high-QPS
  3876. // queues, follow the 500/50/5 pattern described in
  3877. // [Managing Cloud Tasks Scaling
  3878. // Risks](https://cloud.google.com/tasks/docs/manage-cloud-task-scaling).
  3879. func (r *ProjectsLocationsQueuesService) Resume(name string, resumequeuerequest *ResumeQueueRequest) *ProjectsLocationsQueuesResumeCall {
  3880. c := &ProjectsLocationsQueuesResumeCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3881. c.name = name
  3882. c.resumequeuerequest = resumequeuerequest
  3883. return c
  3884. }
  3885. // Fields allows partial responses to be retrieved. See
  3886. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3887. // for more information.
  3888. func (c *ProjectsLocationsQueuesResumeCall) Fields(s ...googleapi.Field) *ProjectsLocationsQueuesResumeCall {
  3889. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3890. return c
  3891. }
  3892. // Context sets the context to be used in this call's Do method. Any
  3893. // pending HTTP request will be aborted if the provided context is
  3894. // canceled.
  3895. func (c *ProjectsLocationsQueuesResumeCall) Context(ctx context.Context) *ProjectsLocationsQueuesResumeCall {
  3896. c.ctx_ = ctx
  3897. return c
  3898. }
  3899. // Header returns an http.Header that can be modified by the caller to
  3900. // add HTTP headers to the request.
  3901. func (c *ProjectsLocationsQueuesResumeCall) Header() http.Header {
  3902. if c.header_ == nil {
  3903. c.header_ = make(http.Header)
  3904. }
  3905. return c.header_
  3906. }
  3907. func (c *ProjectsLocationsQueuesResumeCall) doRequest(alt string) (*http.Response, error) {
  3908. reqHeaders := make(http.Header)
  3909. for k, v := range c.header_ {
  3910. reqHeaders[k] = v
  3911. }
  3912. reqHeaders.Set("User-Agent", c.s.userAgent())
  3913. var body io.Reader = nil
  3914. body, err := googleapi.WithoutDataWrapper.JSONReader(c.resumequeuerequest)
  3915. if err != nil {
  3916. return nil, err
  3917. }
  3918. reqHeaders.Set("Content-Type", "application/json")
  3919. c.urlParams_.Set("alt", alt)
  3920. c.urlParams_.Set("prettyPrint", "false")
  3921. urls := googleapi.ResolveRelative(c.s.BasePath, "v2beta2/{+name}:resume")
  3922. urls += "?" + c.urlParams_.Encode()
  3923. req, err := http.NewRequest("POST", urls, body)
  3924. if err != nil {
  3925. return nil, err
  3926. }
  3927. req.Header = reqHeaders
  3928. googleapi.Expand(req.URL, map[string]string{
  3929. "name": c.name,
  3930. })
  3931. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3932. }
  3933. // Do executes the "cloudtasks.projects.locations.queues.resume" call.
  3934. // Exactly one of *Queue or error will be non-nil. Any non-2xx status
  3935. // code is an error. Response headers are in either
  3936. // *Queue.ServerResponse.Header or (if a response was returned at all)
  3937. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3938. // check whether the returned error was because http.StatusNotModified
  3939. // was returned.
  3940. func (c *ProjectsLocationsQueuesResumeCall) Do(opts ...googleapi.CallOption) (*Queue, error) {
  3941. gensupport.SetOptions(c.urlParams_, opts...)
  3942. res, err := c.doRequest("json")
  3943. if res != nil && res.StatusCode == http.StatusNotModified {
  3944. if res.Body != nil {
  3945. res.Body.Close()
  3946. }
  3947. return nil, &googleapi.Error{
  3948. Code: res.StatusCode,
  3949. Header: res.Header,
  3950. }
  3951. }
  3952. if err != nil {
  3953. return nil, err
  3954. }
  3955. defer googleapi.CloseBody(res)
  3956. if err := googleapi.CheckResponse(res); err != nil {
  3957. return nil, err
  3958. }
  3959. ret := &Queue{
  3960. ServerResponse: googleapi.ServerResponse{
  3961. Header: res.Header,
  3962. HTTPStatusCode: res.StatusCode,
  3963. },
  3964. }
  3965. target := &ret
  3966. if err := gensupport.DecodeResponse(target, res); err != nil {
  3967. return nil, err
  3968. }
  3969. return ret, nil
  3970. // {
  3971. // "description": "Resume a queue.\n\nThis method resumes a queue after it has been\nPAUSED or\nDISABLED. The state of a queue is stored\nin the queue's state; after calling this method it\nwill be set to RUNNING.\n\nWARNING: Resuming many high-QPS queues at the same time can\nlead to target overloading. If you are resuming high-QPS\nqueues, follow the 500/50/5 pattern described in\n[Managing Cloud Tasks Scaling Risks](https://cloud.google.com/tasks/docs/manage-cloud-task-scaling).",
  3972. // "flatPath": "v2beta2/projects/{projectsId}/locations/{locationsId}/queues/{queuesId}:resume",
  3973. // "httpMethod": "POST",
  3974. // "id": "cloudtasks.projects.locations.queues.resume",
  3975. // "parameterOrder": [
  3976. // "name"
  3977. // ],
  3978. // "parameters": {
  3979. // "name": {
  3980. // "description": "Required.\n\nThe queue name. For example:\n`projects/PROJECT_ID/location/LOCATION_ID/queues/QUEUE_ID`",
  3981. // "location": "path",
  3982. // "pattern": "^projects/[^/]+/locations/[^/]+/queues/[^/]+$",
  3983. // "required": true,
  3984. // "type": "string"
  3985. // }
  3986. // },
  3987. // "path": "v2beta2/{+name}:resume",
  3988. // "request": {
  3989. // "$ref": "ResumeQueueRequest"
  3990. // },
  3991. // "response": {
  3992. // "$ref": "Queue"
  3993. // },
  3994. // "scopes": [
  3995. // "https://www.googleapis.com/auth/cloud-platform"
  3996. // ]
  3997. // }
  3998. }
  3999. // method id "cloudtasks.projects.locations.queues.setIamPolicy":
  4000. type ProjectsLocationsQueuesSetIamPolicyCall struct {
  4001. s *Service
  4002. resource string
  4003. setiampolicyrequest *SetIamPolicyRequest
  4004. urlParams_ gensupport.URLParams
  4005. ctx_ context.Context
  4006. header_ http.Header
  4007. }
  4008. // SetIamPolicy: Sets the access control policy for a Queue. Replaces
  4009. // any existing
  4010. // policy.
  4011. //
  4012. // Note: The Cloud Console does not check queue-level IAM permissions
  4013. // yet.
  4014. // Project-level permissions are required to use the Cloud
  4015. // Console.
  4016. //
  4017. // Authorization requires the following
  4018. // [Google IAM](https://cloud.google.com/iam) permission on the
  4019. // specified
  4020. // resource parent:
  4021. //
  4022. // * `cloudtasks.queues.setIamPolicy`
  4023. func (r *ProjectsLocationsQueuesService) SetIamPolicy(resource string, setiampolicyrequest *SetIamPolicyRequest) *ProjectsLocationsQueuesSetIamPolicyCall {
  4024. c := &ProjectsLocationsQueuesSetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4025. c.resource = resource
  4026. c.setiampolicyrequest = setiampolicyrequest
  4027. return c
  4028. }
  4029. // Fields allows partial responses to be retrieved. See
  4030. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4031. // for more information.
  4032. func (c *ProjectsLocationsQueuesSetIamPolicyCall) Fields(s ...googleapi.Field) *ProjectsLocationsQueuesSetIamPolicyCall {
  4033. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4034. return c
  4035. }
  4036. // Context sets the context to be used in this call's Do method. Any
  4037. // pending HTTP request will be aborted if the provided context is
  4038. // canceled.
  4039. func (c *ProjectsLocationsQueuesSetIamPolicyCall) Context(ctx context.Context) *ProjectsLocationsQueuesSetIamPolicyCall {
  4040. c.ctx_ = ctx
  4041. return c
  4042. }
  4043. // Header returns an http.Header that can be modified by the caller to
  4044. // add HTTP headers to the request.
  4045. func (c *ProjectsLocationsQueuesSetIamPolicyCall) Header() http.Header {
  4046. if c.header_ == nil {
  4047. c.header_ = make(http.Header)
  4048. }
  4049. return c.header_
  4050. }
  4051. func (c *ProjectsLocationsQueuesSetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
  4052. reqHeaders := make(http.Header)
  4053. for k, v := range c.header_ {
  4054. reqHeaders[k] = v
  4055. }
  4056. reqHeaders.Set("User-Agent", c.s.userAgent())
  4057. var body io.Reader = nil
  4058. body, err := googleapi.WithoutDataWrapper.JSONReader(c.setiampolicyrequest)
  4059. if err != nil {
  4060. return nil, err
  4061. }
  4062. reqHeaders.Set("Content-Type", "application/json")
  4063. c.urlParams_.Set("alt", alt)
  4064. c.urlParams_.Set("prettyPrint", "false")
  4065. urls := googleapi.ResolveRelative(c.s.BasePath, "v2beta2/{+resource}:setIamPolicy")
  4066. urls += "?" + c.urlParams_.Encode()
  4067. req, err := http.NewRequest("POST", urls, body)
  4068. if err != nil {
  4069. return nil, err
  4070. }
  4071. req.Header = reqHeaders
  4072. googleapi.Expand(req.URL, map[string]string{
  4073. "resource": c.resource,
  4074. })
  4075. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4076. }
  4077. // Do executes the "cloudtasks.projects.locations.queues.setIamPolicy" call.
  4078. // Exactly one of *Policy or error will be non-nil. Any non-2xx status
  4079. // code is an error. Response headers are in either
  4080. // *Policy.ServerResponse.Header or (if a response was returned at all)
  4081. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  4082. // check whether the returned error was because http.StatusNotModified
  4083. // was returned.
  4084. func (c *ProjectsLocationsQueuesSetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) {
  4085. gensupport.SetOptions(c.urlParams_, opts...)
  4086. res, err := c.doRequest("json")
  4087. if res != nil && res.StatusCode == http.StatusNotModified {
  4088. if res.Body != nil {
  4089. res.Body.Close()
  4090. }
  4091. return nil, &googleapi.Error{
  4092. Code: res.StatusCode,
  4093. Header: res.Header,
  4094. }
  4095. }
  4096. if err != nil {
  4097. return nil, err
  4098. }
  4099. defer googleapi.CloseBody(res)
  4100. if err := googleapi.CheckResponse(res); err != nil {
  4101. return nil, err
  4102. }
  4103. ret := &Policy{
  4104. ServerResponse: googleapi.ServerResponse{
  4105. Header: res.Header,
  4106. HTTPStatusCode: res.StatusCode,
  4107. },
  4108. }
  4109. target := &ret
  4110. if err := gensupport.DecodeResponse(target, res); err != nil {
  4111. return nil, err
  4112. }
  4113. return ret, nil
  4114. // {
  4115. // "description": "Sets the access control policy for a Queue. Replaces any existing\npolicy.\n\nNote: The Cloud Console does not check queue-level IAM permissions yet.\nProject-level permissions are required to use the Cloud Console.\n\nAuthorization requires the following\n[Google IAM](https://cloud.google.com/iam) permission on the specified\nresource parent:\n\n* `cloudtasks.queues.setIamPolicy`",
  4116. // "flatPath": "v2beta2/projects/{projectsId}/locations/{locationsId}/queues/{queuesId}:setIamPolicy",
  4117. // "httpMethod": "POST",
  4118. // "id": "cloudtasks.projects.locations.queues.setIamPolicy",
  4119. // "parameterOrder": [
  4120. // "resource"
  4121. // ],
  4122. // "parameters": {
  4123. // "resource": {
  4124. // "description": "REQUIRED: The resource for which the policy is being specified.\nSee the operation documentation for the appropriate value for this field.",
  4125. // "location": "path",
  4126. // "pattern": "^projects/[^/]+/locations/[^/]+/queues/[^/]+$",
  4127. // "required": true,
  4128. // "type": "string"
  4129. // }
  4130. // },
  4131. // "path": "v2beta2/{+resource}:setIamPolicy",
  4132. // "request": {
  4133. // "$ref": "SetIamPolicyRequest"
  4134. // },
  4135. // "response": {
  4136. // "$ref": "Policy"
  4137. // },
  4138. // "scopes": [
  4139. // "https://www.googleapis.com/auth/cloud-platform"
  4140. // ]
  4141. // }
  4142. }
  4143. // method id "cloudtasks.projects.locations.queues.testIamPermissions":
  4144. type ProjectsLocationsQueuesTestIamPermissionsCall struct {
  4145. s *Service
  4146. resource string
  4147. testiampermissionsrequest *TestIamPermissionsRequest
  4148. urlParams_ gensupport.URLParams
  4149. ctx_ context.Context
  4150. header_ http.Header
  4151. }
  4152. // TestIamPermissions: Returns permissions that a caller has on a
  4153. // Queue.
  4154. // If the resource does not exist, this will return an empty set
  4155. // of
  4156. // permissions, not a NOT_FOUND error.
  4157. //
  4158. // Note: This operation is designed to be used for building
  4159. // permission-aware
  4160. // UIs and command-line tools, not for authorization checking. This
  4161. // operation
  4162. // may "fail open" without warning.
  4163. func (r *ProjectsLocationsQueuesService) TestIamPermissions(resource string, testiampermissionsrequest *TestIamPermissionsRequest) *ProjectsLocationsQueuesTestIamPermissionsCall {
  4164. c := &ProjectsLocationsQueuesTestIamPermissionsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4165. c.resource = resource
  4166. c.testiampermissionsrequest = testiampermissionsrequest
  4167. return c
  4168. }
  4169. // Fields allows partial responses to be retrieved. See
  4170. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4171. // for more information.
  4172. func (c *ProjectsLocationsQueuesTestIamPermissionsCall) Fields(s ...googleapi.Field) *ProjectsLocationsQueuesTestIamPermissionsCall {
  4173. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4174. return c
  4175. }
  4176. // Context sets the context to be used in this call's Do method. Any
  4177. // pending HTTP request will be aborted if the provided context is
  4178. // canceled.
  4179. func (c *ProjectsLocationsQueuesTestIamPermissionsCall) Context(ctx context.Context) *ProjectsLocationsQueuesTestIamPermissionsCall {
  4180. c.ctx_ = ctx
  4181. return c
  4182. }
  4183. // Header returns an http.Header that can be modified by the caller to
  4184. // add HTTP headers to the request.
  4185. func (c *ProjectsLocationsQueuesTestIamPermissionsCall) Header() http.Header {
  4186. if c.header_ == nil {
  4187. c.header_ = make(http.Header)
  4188. }
  4189. return c.header_
  4190. }
  4191. func (c *ProjectsLocationsQueuesTestIamPermissionsCall) doRequest(alt string) (*http.Response, error) {
  4192. reqHeaders := make(http.Header)
  4193. for k, v := range c.header_ {
  4194. reqHeaders[k] = v
  4195. }
  4196. reqHeaders.Set("User-Agent", c.s.userAgent())
  4197. var body io.Reader = nil
  4198. body, err := googleapi.WithoutDataWrapper.JSONReader(c.testiampermissionsrequest)
  4199. if err != nil {
  4200. return nil, err
  4201. }
  4202. reqHeaders.Set("Content-Type", "application/json")
  4203. c.urlParams_.Set("alt", alt)
  4204. c.urlParams_.Set("prettyPrint", "false")
  4205. urls := googleapi.ResolveRelative(c.s.BasePath, "v2beta2/{+resource}:testIamPermissions")
  4206. urls += "?" + c.urlParams_.Encode()
  4207. req, err := http.NewRequest("POST", urls, body)
  4208. if err != nil {
  4209. return nil, err
  4210. }
  4211. req.Header = reqHeaders
  4212. googleapi.Expand(req.URL, map[string]string{
  4213. "resource": c.resource,
  4214. })
  4215. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4216. }
  4217. // Do executes the "cloudtasks.projects.locations.queues.testIamPermissions" call.
  4218. // Exactly one of *TestIamPermissionsResponse or error will be non-nil.
  4219. // Any non-2xx status code is an error. Response headers are in either
  4220. // *TestIamPermissionsResponse.ServerResponse.Header or (if a response
  4221. // was returned at all) in error.(*googleapi.Error).Header. Use
  4222. // googleapi.IsNotModified to check whether the returned error was
  4223. // because http.StatusNotModified was returned.
  4224. func (c *ProjectsLocationsQueuesTestIamPermissionsCall) Do(opts ...googleapi.CallOption) (*TestIamPermissionsResponse, error) {
  4225. gensupport.SetOptions(c.urlParams_, opts...)
  4226. res, err := c.doRequest("json")
  4227. if res != nil && res.StatusCode == http.StatusNotModified {
  4228. if res.Body != nil {
  4229. res.Body.Close()
  4230. }
  4231. return nil, &googleapi.Error{
  4232. Code: res.StatusCode,
  4233. Header: res.Header,
  4234. }
  4235. }
  4236. if err != nil {
  4237. return nil, err
  4238. }
  4239. defer googleapi.CloseBody(res)
  4240. if err := googleapi.CheckResponse(res); err != nil {
  4241. return nil, err
  4242. }
  4243. ret := &TestIamPermissionsResponse{
  4244. ServerResponse: googleapi.ServerResponse{
  4245. Header: res.Header,
  4246. HTTPStatusCode: res.StatusCode,
  4247. },
  4248. }
  4249. target := &ret
  4250. if err := gensupport.DecodeResponse(target, res); err != nil {
  4251. return nil, err
  4252. }
  4253. return ret, nil
  4254. // {
  4255. // "description": "Returns permissions that a caller has on a Queue.\nIf the resource does not exist, this will return an empty set of\npermissions, not a NOT_FOUND error.\n\nNote: This operation is designed to be used for building permission-aware\nUIs and command-line tools, not for authorization checking. This operation\nmay \"fail open\" without warning.",
  4256. // "flatPath": "v2beta2/projects/{projectsId}/locations/{locationsId}/queues/{queuesId}:testIamPermissions",
  4257. // "httpMethod": "POST",
  4258. // "id": "cloudtasks.projects.locations.queues.testIamPermissions",
  4259. // "parameterOrder": [
  4260. // "resource"
  4261. // ],
  4262. // "parameters": {
  4263. // "resource": {
  4264. // "description": "REQUIRED: The resource for which the policy detail is being requested.\nSee the operation documentation for the appropriate value for this field.",
  4265. // "location": "path",
  4266. // "pattern": "^projects/[^/]+/locations/[^/]+/queues/[^/]+$",
  4267. // "required": true,
  4268. // "type": "string"
  4269. // }
  4270. // },
  4271. // "path": "v2beta2/{+resource}:testIamPermissions",
  4272. // "request": {
  4273. // "$ref": "TestIamPermissionsRequest"
  4274. // },
  4275. // "response": {
  4276. // "$ref": "TestIamPermissionsResponse"
  4277. // },
  4278. // "scopes": [
  4279. // "https://www.googleapis.com/auth/cloud-platform"
  4280. // ]
  4281. // }
  4282. }
  4283. // method id "cloudtasks.projects.locations.queues.tasks.acknowledge":
  4284. type ProjectsLocationsQueuesTasksAcknowledgeCall struct {
  4285. s *Service
  4286. name string
  4287. acknowledgetaskrequest *AcknowledgeTaskRequest
  4288. urlParams_ gensupport.URLParams
  4289. ctx_ context.Context
  4290. header_ http.Header
  4291. }
  4292. // Acknowledge: Acknowledges a pull task.
  4293. //
  4294. // The worker, that is, the entity that
  4295. // leased this task must call this method
  4296. // to indicate that the work associated with the task has finished.
  4297. //
  4298. // The worker must acknowledge a task within the
  4299. // lease_duration or the lease
  4300. // will expire and the task will become available to be leased
  4301. // again. After the task is acknowledged, it will not be returned
  4302. // by a later LeaseTasks,
  4303. // GetTask, or
  4304. // ListTasks.
  4305. func (r *ProjectsLocationsQueuesTasksService) Acknowledge(name string, acknowledgetaskrequest *AcknowledgeTaskRequest) *ProjectsLocationsQueuesTasksAcknowledgeCall {
  4306. c := &ProjectsLocationsQueuesTasksAcknowledgeCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4307. c.name = name
  4308. c.acknowledgetaskrequest = acknowledgetaskrequest
  4309. return c
  4310. }
  4311. // Fields allows partial responses to be retrieved. See
  4312. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4313. // for more information.
  4314. func (c *ProjectsLocationsQueuesTasksAcknowledgeCall) Fields(s ...googleapi.Field) *ProjectsLocationsQueuesTasksAcknowledgeCall {
  4315. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4316. return c
  4317. }
  4318. // Context sets the context to be used in this call's Do method. Any
  4319. // pending HTTP request will be aborted if the provided context is
  4320. // canceled.
  4321. func (c *ProjectsLocationsQueuesTasksAcknowledgeCall) Context(ctx context.Context) *ProjectsLocationsQueuesTasksAcknowledgeCall {
  4322. c.ctx_ = ctx
  4323. return c
  4324. }
  4325. // Header returns an http.Header that can be modified by the caller to
  4326. // add HTTP headers to the request.
  4327. func (c *ProjectsLocationsQueuesTasksAcknowledgeCall) Header() http.Header {
  4328. if c.header_ == nil {
  4329. c.header_ = make(http.Header)
  4330. }
  4331. return c.header_
  4332. }
  4333. func (c *ProjectsLocationsQueuesTasksAcknowledgeCall) doRequest(alt string) (*http.Response, error) {
  4334. reqHeaders := make(http.Header)
  4335. for k, v := range c.header_ {
  4336. reqHeaders[k] = v
  4337. }
  4338. reqHeaders.Set("User-Agent", c.s.userAgent())
  4339. var body io.Reader = nil
  4340. body, err := googleapi.WithoutDataWrapper.JSONReader(c.acknowledgetaskrequest)
  4341. if err != nil {
  4342. return nil, err
  4343. }
  4344. reqHeaders.Set("Content-Type", "application/json")
  4345. c.urlParams_.Set("alt", alt)
  4346. c.urlParams_.Set("prettyPrint", "false")
  4347. urls := googleapi.ResolveRelative(c.s.BasePath, "v2beta2/{+name}:acknowledge")
  4348. urls += "?" + c.urlParams_.Encode()
  4349. req, err := http.NewRequest("POST", urls, body)
  4350. if err != nil {
  4351. return nil, err
  4352. }
  4353. req.Header = reqHeaders
  4354. googleapi.Expand(req.URL, map[string]string{
  4355. "name": c.name,
  4356. })
  4357. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4358. }
  4359. // Do executes the "cloudtasks.projects.locations.queues.tasks.acknowledge" call.
  4360. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  4361. // code is an error. Response headers are in either
  4362. // *Empty.ServerResponse.Header or (if a response was returned at all)
  4363. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  4364. // check whether the returned error was because http.StatusNotModified
  4365. // was returned.
  4366. func (c *ProjectsLocationsQueuesTasksAcknowledgeCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  4367. gensupport.SetOptions(c.urlParams_, opts...)
  4368. res, err := c.doRequest("json")
  4369. if res != nil && res.StatusCode == http.StatusNotModified {
  4370. if res.Body != nil {
  4371. res.Body.Close()
  4372. }
  4373. return nil, &googleapi.Error{
  4374. Code: res.StatusCode,
  4375. Header: res.Header,
  4376. }
  4377. }
  4378. if err != nil {
  4379. return nil, err
  4380. }
  4381. defer googleapi.CloseBody(res)
  4382. if err := googleapi.CheckResponse(res); err != nil {
  4383. return nil, err
  4384. }
  4385. ret := &Empty{
  4386. ServerResponse: googleapi.ServerResponse{
  4387. Header: res.Header,
  4388. HTTPStatusCode: res.StatusCode,
  4389. },
  4390. }
  4391. target := &ret
  4392. if err := gensupport.DecodeResponse(target, res); err != nil {
  4393. return nil, err
  4394. }
  4395. return ret, nil
  4396. // {
  4397. // "description": "Acknowledges a pull task.\n\nThe worker, that is, the entity that\nleased this task must call this method\nto indicate that the work associated with the task has finished.\n\nThe worker must acknowledge a task within the\nlease_duration or the lease\nwill expire and the task will become available to be leased\nagain. After the task is acknowledged, it will not be returned\nby a later LeaseTasks,\nGetTask, or\nListTasks.",
  4398. // "flatPath": "v2beta2/projects/{projectsId}/locations/{locationsId}/queues/{queuesId}/tasks/{tasksId}:acknowledge",
  4399. // "httpMethod": "POST",
  4400. // "id": "cloudtasks.projects.locations.queues.tasks.acknowledge",
  4401. // "parameterOrder": [
  4402. // "name"
  4403. // ],
  4404. // "parameters": {
  4405. // "name": {
  4406. // "description": "Required.\n\nThe task name. For example:\n`projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`",
  4407. // "location": "path",
  4408. // "pattern": "^projects/[^/]+/locations/[^/]+/queues/[^/]+/tasks/[^/]+$",
  4409. // "required": true,
  4410. // "type": "string"
  4411. // }
  4412. // },
  4413. // "path": "v2beta2/{+name}:acknowledge",
  4414. // "request": {
  4415. // "$ref": "AcknowledgeTaskRequest"
  4416. // },
  4417. // "response": {
  4418. // "$ref": "Empty"
  4419. // },
  4420. // "scopes": [
  4421. // "https://www.googleapis.com/auth/cloud-platform"
  4422. // ]
  4423. // }
  4424. }
  4425. // method id "cloudtasks.projects.locations.queues.tasks.cancelLease":
  4426. type ProjectsLocationsQueuesTasksCancelLeaseCall struct {
  4427. s *Service
  4428. name string
  4429. cancelleaserequest *CancelLeaseRequest
  4430. urlParams_ gensupport.URLParams
  4431. ctx_ context.Context
  4432. header_ http.Header
  4433. }
  4434. // CancelLease: Cancel a pull task's lease.
  4435. //
  4436. // The worker can use this method to cancel a task's lease by
  4437. // setting its schedule_time to now. This will
  4438. // make the task available to be leased to the next caller
  4439. // of
  4440. // LeaseTasks.
  4441. func (r *ProjectsLocationsQueuesTasksService) CancelLease(name string, cancelleaserequest *CancelLeaseRequest) *ProjectsLocationsQueuesTasksCancelLeaseCall {
  4442. c := &ProjectsLocationsQueuesTasksCancelLeaseCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4443. c.name = name
  4444. c.cancelleaserequest = cancelleaserequest
  4445. return c
  4446. }
  4447. // Fields allows partial responses to be retrieved. See
  4448. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4449. // for more information.
  4450. func (c *ProjectsLocationsQueuesTasksCancelLeaseCall) Fields(s ...googleapi.Field) *ProjectsLocationsQueuesTasksCancelLeaseCall {
  4451. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4452. return c
  4453. }
  4454. // Context sets the context to be used in this call's Do method. Any
  4455. // pending HTTP request will be aborted if the provided context is
  4456. // canceled.
  4457. func (c *ProjectsLocationsQueuesTasksCancelLeaseCall) Context(ctx context.Context) *ProjectsLocationsQueuesTasksCancelLeaseCall {
  4458. c.ctx_ = ctx
  4459. return c
  4460. }
  4461. // Header returns an http.Header that can be modified by the caller to
  4462. // add HTTP headers to the request.
  4463. func (c *ProjectsLocationsQueuesTasksCancelLeaseCall) Header() http.Header {
  4464. if c.header_ == nil {
  4465. c.header_ = make(http.Header)
  4466. }
  4467. return c.header_
  4468. }
  4469. func (c *ProjectsLocationsQueuesTasksCancelLeaseCall) doRequest(alt string) (*http.Response, error) {
  4470. reqHeaders := make(http.Header)
  4471. for k, v := range c.header_ {
  4472. reqHeaders[k] = v
  4473. }
  4474. reqHeaders.Set("User-Agent", c.s.userAgent())
  4475. var body io.Reader = nil
  4476. body, err := googleapi.WithoutDataWrapper.JSONReader(c.cancelleaserequest)
  4477. if err != nil {
  4478. return nil, err
  4479. }
  4480. reqHeaders.Set("Content-Type", "application/json")
  4481. c.urlParams_.Set("alt", alt)
  4482. c.urlParams_.Set("prettyPrint", "false")
  4483. urls := googleapi.ResolveRelative(c.s.BasePath, "v2beta2/{+name}:cancelLease")
  4484. urls += "?" + c.urlParams_.Encode()
  4485. req, err := http.NewRequest("POST", urls, body)
  4486. if err != nil {
  4487. return nil, err
  4488. }
  4489. req.Header = reqHeaders
  4490. googleapi.Expand(req.URL, map[string]string{
  4491. "name": c.name,
  4492. })
  4493. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4494. }
  4495. // Do executes the "cloudtasks.projects.locations.queues.tasks.cancelLease" call.
  4496. // Exactly one of *Task or error will be non-nil. Any non-2xx status
  4497. // code is an error. Response headers are in either
  4498. // *Task.ServerResponse.Header or (if a response was returned at all) in
  4499. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  4500. // whether the returned error was because http.StatusNotModified was
  4501. // returned.
  4502. func (c *ProjectsLocationsQueuesTasksCancelLeaseCall) Do(opts ...googleapi.CallOption) (*Task, error) {
  4503. gensupport.SetOptions(c.urlParams_, opts...)
  4504. res, err := c.doRequest("json")
  4505. if res != nil && res.StatusCode == http.StatusNotModified {
  4506. if res.Body != nil {
  4507. res.Body.Close()
  4508. }
  4509. return nil, &googleapi.Error{
  4510. Code: res.StatusCode,
  4511. Header: res.Header,
  4512. }
  4513. }
  4514. if err != nil {
  4515. return nil, err
  4516. }
  4517. defer googleapi.CloseBody(res)
  4518. if err := googleapi.CheckResponse(res); err != nil {
  4519. return nil, err
  4520. }
  4521. ret := &Task{
  4522. ServerResponse: googleapi.ServerResponse{
  4523. Header: res.Header,
  4524. HTTPStatusCode: res.StatusCode,
  4525. },
  4526. }
  4527. target := &ret
  4528. if err := gensupport.DecodeResponse(target, res); err != nil {
  4529. return nil, err
  4530. }
  4531. return ret, nil
  4532. // {
  4533. // "description": "Cancel a pull task's lease.\n\nThe worker can use this method to cancel a task's lease by\nsetting its schedule_time to now. This will\nmake the task available to be leased to the next caller of\nLeaseTasks.",
  4534. // "flatPath": "v2beta2/projects/{projectsId}/locations/{locationsId}/queues/{queuesId}/tasks/{tasksId}:cancelLease",
  4535. // "httpMethod": "POST",
  4536. // "id": "cloudtasks.projects.locations.queues.tasks.cancelLease",
  4537. // "parameterOrder": [
  4538. // "name"
  4539. // ],
  4540. // "parameters": {
  4541. // "name": {
  4542. // "description": "Required.\n\nThe task name. For example:\n`projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`",
  4543. // "location": "path",
  4544. // "pattern": "^projects/[^/]+/locations/[^/]+/queues/[^/]+/tasks/[^/]+$",
  4545. // "required": true,
  4546. // "type": "string"
  4547. // }
  4548. // },
  4549. // "path": "v2beta2/{+name}:cancelLease",
  4550. // "request": {
  4551. // "$ref": "CancelLeaseRequest"
  4552. // },
  4553. // "response": {
  4554. // "$ref": "Task"
  4555. // },
  4556. // "scopes": [
  4557. // "https://www.googleapis.com/auth/cloud-platform"
  4558. // ]
  4559. // }
  4560. }
  4561. // method id "cloudtasks.projects.locations.queues.tasks.create":
  4562. type ProjectsLocationsQueuesTasksCreateCall struct {
  4563. s *Service
  4564. parent string
  4565. createtaskrequest *CreateTaskRequest
  4566. urlParams_ gensupport.URLParams
  4567. ctx_ context.Context
  4568. header_ http.Header
  4569. }
  4570. // Create: Creates a task and adds it to a queue.
  4571. //
  4572. // Tasks cannot be updated after creation; there is no UpdateTask
  4573. // command.
  4574. //
  4575. // * For App Engine queues, the maximum task size is
  4576. // 100KB.
  4577. // * For pull queues, the maximum task size is 1MB.
  4578. func (r *ProjectsLocationsQueuesTasksService) Create(parent string, createtaskrequest *CreateTaskRequest) *ProjectsLocationsQueuesTasksCreateCall {
  4579. c := &ProjectsLocationsQueuesTasksCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4580. c.parent = parent
  4581. c.createtaskrequest = createtaskrequest
  4582. return c
  4583. }
  4584. // Fields allows partial responses to be retrieved. See
  4585. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4586. // for more information.
  4587. func (c *ProjectsLocationsQueuesTasksCreateCall) Fields(s ...googleapi.Field) *ProjectsLocationsQueuesTasksCreateCall {
  4588. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4589. return c
  4590. }
  4591. // Context sets the context to be used in this call's Do method. Any
  4592. // pending HTTP request will be aborted if the provided context is
  4593. // canceled.
  4594. func (c *ProjectsLocationsQueuesTasksCreateCall) Context(ctx context.Context) *ProjectsLocationsQueuesTasksCreateCall {
  4595. c.ctx_ = ctx
  4596. return c
  4597. }
  4598. // Header returns an http.Header that can be modified by the caller to
  4599. // add HTTP headers to the request.
  4600. func (c *ProjectsLocationsQueuesTasksCreateCall) Header() http.Header {
  4601. if c.header_ == nil {
  4602. c.header_ = make(http.Header)
  4603. }
  4604. return c.header_
  4605. }
  4606. func (c *ProjectsLocationsQueuesTasksCreateCall) doRequest(alt string) (*http.Response, error) {
  4607. reqHeaders := make(http.Header)
  4608. for k, v := range c.header_ {
  4609. reqHeaders[k] = v
  4610. }
  4611. reqHeaders.Set("User-Agent", c.s.userAgent())
  4612. var body io.Reader = nil
  4613. body, err := googleapi.WithoutDataWrapper.JSONReader(c.createtaskrequest)
  4614. if err != nil {
  4615. return nil, err
  4616. }
  4617. reqHeaders.Set("Content-Type", "application/json")
  4618. c.urlParams_.Set("alt", alt)
  4619. c.urlParams_.Set("prettyPrint", "false")
  4620. urls := googleapi.ResolveRelative(c.s.BasePath, "v2beta2/{+parent}/tasks")
  4621. urls += "?" + c.urlParams_.Encode()
  4622. req, err := http.NewRequest("POST", urls, body)
  4623. if err != nil {
  4624. return nil, err
  4625. }
  4626. req.Header = reqHeaders
  4627. googleapi.Expand(req.URL, map[string]string{
  4628. "parent": c.parent,
  4629. })
  4630. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4631. }
  4632. // Do executes the "cloudtasks.projects.locations.queues.tasks.create" call.
  4633. // Exactly one of *Task or error will be non-nil. Any non-2xx status
  4634. // code is an error. Response headers are in either
  4635. // *Task.ServerResponse.Header or (if a response was returned at all) in
  4636. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  4637. // whether the returned error was because http.StatusNotModified was
  4638. // returned.
  4639. func (c *ProjectsLocationsQueuesTasksCreateCall) Do(opts ...googleapi.CallOption) (*Task, error) {
  4640. gensupport.SetOptions(c.urlParams_, opts...)
  4641. res, err := c.doRequest("json")
  4642. if res != nil && res.StatusCode == http.StatusNotModified {
  4643. if res.Body != nil {
  4644. res.Body.Close()
  4645. }
  4646. return nil, &googleapi.Error{
  4647. Code: res.StatusCode,
  4648. Header: res.Header,
  4649. }
  4650. }
  4651. if err != nil {
  4652. return nil, err
  4653. }
  4654. defer googleapi.CloseBody(res)
  4655. if err := googleapi.CheckResponse(res); err != nil {
  4656. return nil, err
  4657. }
  4658. ret := &Task{
  4659. ServerResponse: googleapi.ServerResponse{
  4660. Header: res.Header,
  4661. HTTPStatusCode: res.StatusCode,
  4662. },
  4663. }
  4664. target := &ret
  4665. if err := gensupport.DecodeResponse(target, res); err != nil {
  4666. return nil, err
  4667. }
  4668. return ret, nil
  4669. // {
  4670. // "description": "Creates a task and adds it to a queue.\n\nTasks cannot be updated after creation; there is no UpdateTask command.\n\n* For App Engine queues, the maximum task size is\n 100KB.\n* For pull queues, the maximum task size is 1MB.",
  4671. // "flatPath": "v2beta2/projects/{projectsId}/locations/{locationsId}/queues/{queuesId}/tasks",
  4672. // "httpMethod": "POST",
  4673. // "id": "cloudtasks.projects.locations.queues.tasks.create",
  4674. // "parameterOrder": [
  4675. // "parent"
  4676. // ],
  4677. // "parameters": {
  4678. // "parent": {
  4679. // "description": "Required.\n\nThe queue name. For example:\n`projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID`\n\nThe queue must already exist.",
  4680. // "location": "path",
  4681. // "pattern": "^projects/[^/]+/locations/[^/]+/queues/[^/]+$",
  4682. // "required": true,
  4683. // "type": "string"
  4684. // }
  4685. // },
  4686. // "path": "v2beta2/{+parent}/tasks",
  4687. // "request": {
  4688. // "$ref": "CreateTaskRequest"
  4689. // },
  4690. // "response": {
  4691. // "$ref": "Task"
  4692. // },
  4693. // "scopes": [
  4694. // "https://www.googleapis.com/auth/cloud-platform"
  4695. // ]
  4696. // }
  4697. }
  4698. // method id "cloudtasks.projects.locations.queues.tasks.delete":
  4699. type ProjectsLocationsQueuesTasksDeleteCall struct {
  4700. s *Service
  4701. name string
  4702. urlParams_ gensupport.URLParams
  4703. ctx_ context.Context
  4704. header_ http.Header
  4705. }
  4706. // Delete: Deletes a task.
  4707. //
  4708. // A task can be deleted if it is scheduled or dispatched. A task
  4709. // cannot be deleted if it has completed successfully or
  4710. // permanently
  4711. // failed.
  4712. func (r *ProjectsLocationsQueuesTasksService) Delete(name string) *ProjectsLocationsQueuesTasksDeleteCall {
  4713. c := &ProjectsLocationsQueuesTasksDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4714. c.name = name
  4715. return c
  4716. }
  4717. // Fields allows partial responses to be retrieved. See
  4718. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4719. // for more information.
  4720. func (c *ProjectsLocationsQueuesTasksDeleteCall) Fields(s ...googleapi.Field) *ProjectsLocationsQueuesTasksDeleteCall {
  4721. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4722. return c
  4723. }
  4724. // Context sets the context to be used in this call's Do method. Any
  4725. // pending HTTP request will be aborted if the provided context is
  4726. // canceled.
  4727. func (c *ProjectsLocationsQueuesTasksDeleteCall) Context(ctx context.Context) *ProjectsLocationsQueuesTasksDeleteCall {
  4728. c.ctx_ = ctx
  4729. return c
  4730. }
  4731. // Header returns an http.Header that can be modified by the caller to
  4732. // add HTTP headers to the request.
  4733. func (c *ProjectsLocationsQueuesTasksDeleteCall) Header() http.Header {
  4734. if c.header_ == nil {
  4735. c.header_ = make(http.Header)
  4736. }
  4737. return c.header_
  4738. }
  4739. func (c *ProjectsLocationsQueuesTasksDeleteCall) doRequest(alt string) (*http.Response, error) {
  4740. reqHeaders := make(http.Header)
  4741. for k, v := range c.header_ {
  4742. reqHeaders[k] = v
  4743. }
  4744. reqHeaders.Set("User-Agent", c.s.userAgent())
  4745. var body io.Reader = nil
  4746. c.urlParams_.Set("alt", alt)
  4747. c.urlParams_.Set("prettyPrint", "false")
  4748. urls := googleapi.ResolveRelative(c.s.BasePath, "v2beta2/{+name}")
  4749. urls += "?" + c.urlParams_.Encode()
  4750. req, err := http.NewRequest("DELETE", urls, body)
  4751. if err != nil {
  4752. return nil, err
  4753. }
  4754. req.Header = reqHeaders
  4755. googleapi.Expand(req.URL, map[string]string{
  4756. "name": c.name,
  4757. })
  4758. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4759. }
  4760. // Do executes the "cloudtasks.projects.locations.queues.tasks.delete" call.
  4761. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  4762. // code is an error. Response headers are in either
  4763. // *Empty.ServerResponse.Header or (if a response was returned at all)
  4764. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  4765. // check whether the returned error was because http.StatusNotModified
  4766. // was returned.
  4767. func (c *ProjectsLocationsQueuesTasksDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  4768. gensupport.SetOptions(c.urlParams_, opts...)
  4769. res, err := c.doRequest("json")
  4770. if res != nil && res.StatusCode == http.StatusNotModified {
  4771. if res.Body != nil {
  4772. res.Body.Close()
  4773. }
  4774. return nil, &googleapi.Error{
  4775. Code: res.StatusCode,
  4776. Header: res.Header,
  4777. }
  4778. }
  4779. if err != nil {
  4780. return nil, err
  4781. }
  4782. defer googleapi.CloseBody(res)
  4783. if err := googleapi.CheckResponse(res); err != nil {
  4784. return nil, err
  4785. }
  4786. ret := &Empty{
  4787. ServerResponse: googleapi.ServerResponse{
  4788. Header: res.Header,
  4789. HTTPStatusCode: res.StatusCode,
  4790. },
  4791. }
  4792. target := &ret
  4793. if err := gensupport.DecodeResponse(target, res); err != nil {
  4794. return nil, err
  4795. }
  4796. return ret, nil
  4797. // {
  4798. // "description": "Deletes a task.\n\nA task can be deleted if it is scheduled or dispatched. A task\ncannot be deleted if it has completed successfully or permanently\nfailed.",
  4799. // "flatPath": "v2beta2/projects/{projectsId}/locations/{locationsId}/queues/{queuesId}/tasks/{tasksId}",
  4800. // "httpMethod": "DELETE",
  4801. // "id": "cloudtasks.projects.locations.queues.tasks.delete",
  4802. // "parameterOrder": [
  4803. // "name"
  4804. // ],
  4805. // "parameters": {
  4806. // "name": {
  4807. // "description": "Required.\n\nThe task name. For example:\n`projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`",
  4808. // "location": "path",
  4809. // "pattern": "^projects/[^/]+/locations/[^/]+/queues/[^/]+/tasks/[^/]+$",
  4810. // "required": true,
  4811. // "type": "string"
  4812. // }
  4813. // },
  4814. // "path": "v2beta2/{+name}",
  4815. // "response": {
  4816. // "$ref": "Empty"
  4817. // },
  4818. // "scopes": [
  4819. // "https://www.googleapis.com/auth/cloud-platform"
  4820. // ]
  4821. // }
  4822. }
  4823. // method id "cloudtasks.projects.locations.queues.tasks.get":
  4824. type ProjectsLocationsQueuesTasksGetCall struct {
  4825. s *Service
  4826. name string
  4827. urlParams_ gensupport.URLParams
  4828. ifNoneMatch_ string
  4829. ctx_ context.Context
  4830. header_ http.Header
  4831. }
  4832. // Get: Gets a task.
  4833. func (r *ProjectsLocationsQueuesTasksService) Get(name string) *ProjectsLocationsQueuesTasksGetCall {
  4834. c := &ProjectsLocationsQueuesTasksGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4835. c.name = name
  4836. return c
  4837. }
  4838. // ResponseView sets the optional parameter "responseView": The
  4839. // response_view specifies which subset of the Task will
  4840. // be
  4841. // returned.
  4842. //
  4843. // By default response_view is BASIC; not all
  4844. // information is retrieved by default because some data, such
  4845. // as
  4846. // payloads, might be desirable to return only when needed because
  4847. // of its large size or because of the sensitivity of data that
  4848. // it
  4849. // contains.
  4850. //
  4851. // Authorization for FULL requires
  4852. // `cloudtasks.tasks.fullView` [Google
  4853. // IAM](https://cloud.google.com/iam/)
  4854. // permission on the Task resource.
  4855. //
  4856. // Possible values:
  4857. // "VIEW_UNSPECIFIED"
  4858. // "BASIC"
  4859. // "FULL"
  4860. func (c *ProjectsLocationsQueuesTasksGetCall) ResponseView(responseView string) *ProjectsLocationsQueuesTasksGetCall {
  4861. c.urlParams_.Set("responseView", responseView)
  4862. return c
  4863. }
  4864. // Fields allows partial responses to be retrieved. See
  4865. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4866. // for more information.
  4867. func (c *ProjectsLocationsQueuesTasksGetCall) Fields(s ...googleapi.Field) *ProjectsLocationsQueuesTasksGetCall {
  4868. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4869. return c
  4870. }
  4871. // IfNoneMatch sets the optional parameter which makes the operation
  4872. // fail if the object's ETag matches the given value. This is useful for
  4873. // getting updates only after the object has changed since the last
  4874. // request. Use googleapi.IsNotModified to check whether the response
  4875. // error from Do is the result of In-None-Match.
  4876. func (c *ProjectsLocationsQueuesTasksGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsQueuesTasksGetCall {
  4877. c.ifNoneMatch_ = entityTag
  4878. return c
  4879. }
  4880. // Context sets the context to be used in this call's Do method. Any
  4881. // pending HTTP request will be aborted if the provided context is
  4882. // canceled.
  4883. func (c *ProjectsLocationsQueuesTasksGetCall) Context(ctx context.Context) *ProjectsLocationsQueuesTasksGetCall {
  4884. c.ctx_ = ctx
  4885. return c
  4886. }
  4887. // Header returns an http.Header that can be modified by the caller to
  4888. // add HTTP headers to the request.
  4889. func (c *ProjectsLocationsQueuesTasksGetCall) Header() http.Header {
  4890. if c.header_ == nil {
  4891. c.header_ = make(http.Header)
  4892. }
  4893. return c.header_
  4894. }
  4895. func (c *ProjectsLocationsQueuesTasksGetCall) doRequest(alt string) (*http.Response, error) {
  4896. reqHeaders := make(http.Header)
  4897. for k, v := range c.header_ {
  4898. reqHeaders[k] = v
  4899. }
  4900. reqHeaders.Set("User-Agent", c.s.userAgent())
  4901. if c.ifNoneMatch_ != "" {
  4902. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  4903. }
  4904. var body io.Reader = nil
  4905. c.urlParams_.Set("alt", alt)
  4906. c.urlParams_.Set("prettyPrint", "false")
  4907. urls := googleapi.ResolveRelative(c.s.BasePath, "v2beta2/{+name}")
  4908. urls += "?" + c.urlParams_.Encode()
  4909. req, err := http.NewRequest("GET", urls, body)
  4910. if err != nil {
  4911. return nil, err
  4912. }
  4913. req.Header = reqHeaders
  4914. googleapi.Expand(req.URL, map[string]string{
  4915. "name": c.name,
  4916. })
  4917. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4918. }
  4919. // Do executes the "cloudtasks.projects.locations.queues.tasks.get" call.
  4920. // Exactly one of *Task or error will be non-nil. Any non-2xx status
  4921. // code is an error. Response headers are in either
  4922. // *Task.ServerResponse.Header or (if a response was returned at all) in
  4923. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  4924. // whether the returned error was because http.StatusNotModified was
  4925. // returned.
  4926. func (c *ProjectsLocationsQueuesTasksGetCall) Do(opts ...googleapi.CallOption) (*Task, error) {
  4927. gensupport.SetOptions(c.urlParams_, opts...)
  4928. res, err := c.doRequest("json")
  4929. if res != nil && res.StatusCode == http.StatusNotModified {
  4930. if res.Body != nil {
  4931. res.Body.Close()
  4932. }
  4933. return nil, &googleapi.Error{
  4934. Code: res.StatusCode,
  4935. Header: res.Header,
  4936. }
  4937. }
  4938. if err != nil {
  4939. return nil, err
  4940. }
  4941. defer googleapi.CloseBody(res)
  4942. if err := googleapi.CheckResponse(res); err != nil {
  4943. return nil, err
  4944. }
  4945. ret := &Task{
  4946. ServerResponse: googleapi.ServerResponse{
  4947. Header: res.Header,
  4948. HTTPStatusCode: res.StatusCode,
  4949. },
  4950. }
  4951. target := &ret
  4952. if err := gensupport.DecodeResponse(target, res); err != nil {
  4953. return nil, err
  4954. }
  4955. return ret, nil
  4956. // {
  4957. // "description": "Gets a task.",
  4958. // "flatPath": "v2beta2/projects/{projectsId}/locations/{locationsId}/queues/{queuesId}/tasks/{tasksId}",
  4959. // "httpMethod": "GET",
  4960. // "id": "cloudtasks.projects.locations.queues.tasks.get",
  4961. // "parameterOrder": [
  4962. // "name"
  4963. // ],
  4964. // "parameters": {
  4965. // "name": {
  4966. // "description": "Required.\n\nThe task name. For example:\n`projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`",
  4967. // "location": "path",
  4968. // "pattern": "^projects/[^/]+/locations/[^/]+/queues/[^/]+/tasks/[^/]+$",
  4969. // "required": true,
  4970. // "type": "string"
  4971. // },
  4972. // "responseView": {
  4973. // "description": "The response_view specifies which subset of the Task will be\nreturned.\n\nBy default response_view is BASIC; not all\ninformation is retrieved by default because some data, such as\npayloads, might be desirable to return only when needed because\nof its large size or because of the sensitivity of data that it\ncontains.\n\nAuthorization for FULL requires\n`cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/)\npermission on the Task resource.",
  4974. // "enum": [
  4975. // "VIEW_UNSPECIFIED",
  4976. // "BASIC",
  4977. // "FULL"
  4978. // ],
  4979. // "location": "query",
  4980. // "type": "string"
  4981. // }
  4982. // },
  4983. // "path": "v2beta2/{+name}",
  4984. // "response": {
  4985. // "$ref": "Task"
  4986. // },
  4987. // "scopes": [
  4988. // "https://www.googleapis.com/auth/cloud-platform"
  4989. // ]
  4990. // }
  4991. }
  4992. // method id "cloudtasks.projects.locations.queues.tasks.lease":
  4993. type ProjectsLocationsQueuesTasksLeaseCall struct {
  4994. s *Service
  4995. parent string
  4996. leasetasksrequest *LeaseTasksRequest
  4997. urlParams_ gensupport.URLParams
  4998. ctx_ context.Context
  4999. header_ http.Header
  5000. }
  5001. // Lease: Leases tasks from a pull queue for
  5002. // lease_duration.
  5003. //
  5004. // This method is invoked by the worker to obtain a lease. The
  5005. // worker must acknowledge the task via
  5006. // AcknowledgeTask after they have
  5007. // performed the work associated with the task.
  5008. //
  5009. // The payload is intended to store data that
  5010. // the worker needs to perform the work associated with the task.
  5011. // To
  5012. // return the payloads in the response, set
  5013. // response_view to
  5014. // FULL.
  5015. //
  5016. // A maximum of 10 qps of LeaseTasks
  5017. // requests are allowed per
  5018. // queue. RESOURCE_EXHAUSTED
  5019. // is returned when this limit is
  5020. // exceeded. RESOURCE_EXHAUSTED
  5021. // is also returned when
  5022. // max_tasks_dispatched_per_second
  5023. // is exceeded.
  5024. func (r *ProjectsLocationsQueuesTasksService) Lease(parent string, leasetasksrequest *LeaseTasksRequest) *ProjectsLocationsQueuesTasksLeaseCall {
  5025. c := &ProjectsLocationsQueuesTasksLeaseCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5026. c.parent = parent
  5027. c.leasetasksrequest = leasetasksrequest
  5028. return c
  5029. }
  5030. // Fields allows partial responses to be retrieved. See
  5031. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5032. // for more information.
  5033. func (c *ProjectsLocationsQueuesTasksLeaseCall) Fields(s ...googleapi.Field) *ProjectsLocationsQueuesTasksLeaseCall {
  5034. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5035. return c
  5036. }
  5037. // Context sets the context to be used in this call's Do method. Any
  5038. // pending HTTP request will be aborted if the provided context is
  5039. // canceled.
  5040. func (c *ProjectsLocationsQueuesTasksLeaseCall) Context(ctx context.Context) *ProjectsLocationsQueuesTasksLeaseCall {
  5041. c.ctx_ = ctx
  5042. return c
  5043. }
  5044. // Header returns an http.Header that can be modified by the caller to
  5045. // add HTTP headers to the request.
  5046. func (c *ProjectsLocationsQueuesTasksLeaseCall) Header() http.Header {
  5047. if c.header_ == nil {
  5048. c.header_ = make(http.Header)
  5049. }
  5050. return c.header_
  5051. }
  5052. func (c *ProjectsLocationsQueuesTasksLeaseCall) doRequest(alt string) (*http.Response, error) {
  5053. reqHeaders := make(http.Header)
  5054. for k, v := range c.header_ {
  5055. reqHeaders[k] = v
  5056. }
  5057. reqHeaders.Set("User-Agent", c.s.userAgent())
  5058. var body io.Reader = nil
  5059. body, err := googleapi.WithoutDataWrapper.JSONReader(c.leasetasksrequest)
  5060. if err != nil {
  5061. return nil, err
  5062. }
  5063. reqHeaders.Set("Content-Type", "application/json")
  5064. c.urlParams_.Set("alt", alt)
  5065. c.urlParams_.Set("prettyPrint", "false")
  5066. urls := googleapi.ResolveRelative(c.s.BasePath, "v2beta2/{+parent}/tasks:lease")
  5067. urls += "?" + c.urlParams_.Encode()
  5068. req, err := http.NewRequest("POST", urls, body)
  5069. if err != nil {
  5070. return nil, err
  5071. }
  5072. req.Header = reqHeaders
  5073. googleapi.Expand(req.URL, map[string]string{
  5074. "parent": c.parent,
  5075. })
  5076. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5077. }
  5078. // Do executes the "cloudtasks.projects.locations.queues.tasks.lease" call.
  5079. // Exactly one of *LeaseTasksResponse or error will be non-nil. Any
  5080. // non-2xx status code is an error. Response headers are in either
  5081. // *LeaseTasksResponse.ServerResponse.Header or (if a response was
  5082. // returned at all) in error.(*googleapi.Error).Header. Use
  5083. // googleapi.IsNotModified to check whether the returned error was
  5084. // because http.StatusNotModified was returned.
  5085. func (c *ProjectsLocationsQueuesTasksLeaseCall) Do(opts ...googleapi.CallOption) (*LeaseTasksResponse, error) {
  5086. gensupport.SetOptions(c.urlParams_, opts...)
  5087. res, err := c.doRequest("json")
  5088. if res != nil && res.StatusCode == http.StatusNotModified {
  5089. if res.Body != nil {
  5090. res.Body.Close()
  5091. }
  5092. return nil, &googleapi.Error{
  5093. Code: res.StatusCode,
  5094. Header: res.Header,
  5095. }
  5096. }
  5097. if err != nil {
  5098. return nil, err
  5099. }
  5100. defer googleapi.CloseBody(res)
  5101. if err := googleapi.CheckResponse(res); err != nil {
  5102. return nil, err
  5103. }
  5104. ret := &LeaseTasksResponse{
  5105. ServerResponse: googleapi.ServerResponse{
  5106. Header: res.Header,
  5107. HTTPStatusCode: res.StatusCode,
  5108. },
  5109. }
  5110. target := &ret
  5111. if err := gensupport.DecodeResponse(target, res); err != nil {
  5112. return nil, err
  5113. }
  5114. return ret, nil
  5115. // {
  5116. // "description": "Leases tasks from a pull queue for\nlease_duration.\n\nThis method is invoked by the worker to obtain a lease. The\nworker must acknowledge the task via\nAcknowledgeTask after they have\nperformed the work associated with the task.\n\nThe payload is intended to store data that\nthe worker needs to perform the work associated with the task. To\nreturn the payloads in the response, set\nresponse_view to\nFULL.\n\nA maximum of 10 qps of LeaseTasks\nrequests are allowed per\nqueue. RESOURCE_EXHAUSTED\nis returned when this limit is\nexceeded. RESOURCE_EXHAUSTED\nis also returned when\nmax_tasks_dispatched_per_second\nis exceeded.",
  5117. // "flatPath": "v2beta2/projects/{projectsId}/locations/{locationsId}/queues/{queuesId}/tasks:lease",
  5118. // "httpMethod": "POST",
  5119. // "id": "cloudtasks.projects.locations.queues.tasks.lease",
  5120. // "parameterOrder": [
  5121. // "parent"
  5122. // ],
  5123. // "parameters": {
  5124. // "parent": {
  5125. // "description": "Required.\n\nThe queue name. For example:\n`projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID`",
  5126. // "location": "path",
  5127. // "pattern": "^projects/[^/]+/locations/[^/]+/queues/[^/]+$",
  5128. // "required": true,
  5129. // "type": "string"
  5130. // }
  5131. // },
  5132. // "path": "v2beta2/{+parent}/tasks:lease",
  5133. // "request": {
  5134. // "$ref": "LeaseTasksRequest"
  5135. // },
  5136. // "response": {
  5137. // "$ref": "LeaseTasksResponse"
  5138. // },
  5139. // "scopes": [
  5140. // "https://www.googleapis.com/auth/cloud-platform"
  5141. // ]
  5142. // }
  5143. }
  5144. // method id "cloudtasks.projects.locations.queues.tasks.list":
  5145. type ProjectsLocationsQueuesTasksListCall struct {
  5146. s *Service
  5147. parent string
  5148. urlParams_ gensupport.URLParams
  5149. ifNoneMatch_ string
  5150. ctx_ context.Context
  5151. header_ http.Header
  5152. }
  5153. // List: Lists the tasks in a queue.
  5154. //
  5155. // By default, only the BASIC view is retrieved
  5156. // due to performance considerations;
  5157. // response_view controls the
  5158. // subset of information which is returned.
  5159. //
  5160. // The tasks may be returned in any order. The ordering may change at
  5161. // any
  5162. // time.
  5163. func (r *ProjectsLocationsQueuesTasksService) List(parent string) *ProjectsLocationsQueuesTasksListCall {
  5164. c := &ProjectsLocationsQueuesTasksListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5165. c.parent = parent
  5166. return c
  5167. }
  5168. // PageSize sets the optional parameter "pageSize": Requested page size.
  5169. // Fewer tasks than requested might be returned.
  5170. //
  5171. // The maximum page size is 1000. If unspecified, the page size will
  5172. // be the maximum. Fewer tasks than requested might be returned,
  5173. // even if more tasks exist; use
  5174. // next_page_token in the
  5175. // response to determine if more tasks exist.
  5176. func (c *ProjectsLocationsQueuesTasksListCall) PageSize(pageSize int64) *ProjectsLocationsQueuesTasksListCall {
  5177. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  5178. return c
  5179. }
  5180. // PageToken sets the optional parameter "pageToken": A token
  5181. // identifying the page of results to return.
  5182. //
  5183. // To request the first page results, page_token must be empty.
  5184. // To
  5185. // request the next page of results, page_token must be the value
  5186. // of
  5187. // next_page_token returned
  5188. // from the previous call to ListTasks
  5189. // method.
  5190. //
  5191. // The page token is valid for only 2 hours.
  5192. func (c *ProjectsLocationsQueuesTasksListCall) PageToken(pageToken string) *ProjectsLocationsQueuesTasksListCall {
  5193. c.urlParams_.Set("pageToken", pageToken)
  5194. return c
  5195. }
  5196. // ResponseView sets the optional parameter "responseView": The
  5197. // response_view specifies which subset of the Task will
  5198. // be
  5199. // returned.
  5200. //
  5201. // By default response_view is BASIC; not all
  5202. // information is retrieved by default because some data, such
  5203. // as
  5204. // payloads, might be desirable to return only when needed because
  5205. // of its large size or because of the sensitivity of data that
  5206. // it
  5207. // contains.
  5208. //
  5209. // Authorization for FULL requires
  5210. // `cloudtasks.tasks.fullView` [Google
  5211. // IAM](https://cloud.google.com/iam/)
  5212. // permission on the Task resource.
  5213. //
  5214. // Possible values:
  5215. // "VIEW_UNSPECIFIED"
  5216. // "BASIC"
  5217. // "FULL"
  5218. func (c *ProjectsLocationsQueuesTasksListCall) ResponseView(responseView string) *ProjectsLocationsQueuesTasksListCall {
  5219. c.urlParams_.Set("responseView", responseView)
  5220. return c
  5221. }
  5222. // Fields allows partial responses to be retrieved. See
  5223. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5224. // for more information.
  5225. func (c *ProjectsLocationsQueuesTasksListCall) Fields(s ...googleapi.Field) *ProjectsLocationsQueuesTasksListCall {
  5226. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5227. return c
  5228. }
  5229. // IfNoneMatch sets the optional parameter which makes the operation
  5230. // fail if the object's ETag matches the given value. This is useful for
  5231. // getting updates only after the object has changed since the last
  5232. // request. Use googleapi.IsNotModified to check whether the response
  5233. // error from Do is the result of In-None-Match.
  5234. func (c *ProjectsLocationsQueuesTasksListCall) IfNoneMatch(entityTag string) *ProjectsLocationsQueuesTasksListCall {
  5235. c.ifNoneMatch_ = entityTag
  5236. return c
  5237. }
  5238. // Context sets the context to be used in this call's Do method. Any
  5239. // pending HTTP request will be aborted if the provided context is
  5240. // canceled.
  5241. func (c *ProjectsLocationsQueuesTasksListCall) Context(ctx context.Context) *ProjectsLocationsQueuesTasksListCall {
  5242. c.ctx_ = ctx
  5243. return c
  5244. }
  5245. // Header returns an http.Header that can be modified by the caller to
  5246. // add HTTP headers to the request.
  5247. func (c *ProjectsLocationsQueuesTasksListCall) Header() http.Header {
  5248. if c.header_ == nil {
  5249. c.header_ = make(http.Header)
  5250. }
  5251. return c.header_
  5252. }
  5253. func (c *ProjectsLocationsQueuesTasksListCall) doRequest(alt string) (*http.Response, error) {
  5254. reqHeaders := make(http.Header)
  5255. for k, v := range c.header_ {
  5256. reqHeaders[k] = v
  5257. }
  5258. reqHeaders.Set("User-Agent", c.s.userAgent())
  5259. if c.ifNoneMatch_ != "" {
  5260. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  5261. }
  5262. var body io.Reader = nil
  5263. c.urlParams_.Set("alt", alt)
  5264. c.urlParams_.Set("prettyPrint", "false")
  5265. urls := googleapi.ResolveRelative(c.s.BasePath, "v2beta2/{+parent}/tasks")
  5266. urls += "?" + c.urlParams_.Encode()
  5267. req, err := http.NewRequest("GET", urls, body)
  5268. if err != nil {
  5269. return nil, err
  5270. }
  5271. req.Header = reqHeaders
  5272. googleapi.Expand(req.URL, map[string]string{
  5273. "parent": c.parent,
  5274. })
  5275. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5276. }
  5277. // Do executes the "cloudtasks.projects.locations.queues.tasks.list" call.
  5278. // Exactly one of *ListTasksResponse or error will be non-nil. Any
  5279. // non-2xx status code is an error. Response headers are in either
  5280. // *ListTasksResponse.ServerResponse.Header or (if a response was
  5281. // returned at all) in error.(*googleapi.Error).Header. Use
  5282. // googleapi.IsNotModified to check whether the returned error was
  5283. // because http.StatusNotModified was returned.
  5284. func (c *ProjectsLocationsQueuesTasksListCall) Do(opts ...googleapi.CallOption) (*ListTasksResponse, error) {
  5285. gensupport.SetOptions(c.urlParams_, opts...)
  5286. res, err := c.doRequest("json")
  5287. if res != nil && res.StatusCode == http.StatusNotModified {
  5288. if res.Body != nil {
  5289. res.Body.Close()
  5290. }
  5291. return nil, &googleapi.Error{
  5292. Code: res.StatusCode,
  5293. Header: res.Header,
  5294. }
  5295. }
  5296. if err != nil {
  5297. return nil, err
  5298. }
  5299. defer googleapi.CloseBody(res)
  5300. if err := googleapi.CheckResponse(res); err != nil {
  5301. return nil, err
  5302. }
  5303. ret := &ListTasksResponse{
  5304. ServerResponse: googleapi.ServerResponse{
  5305. Header: res.Header,
  5306. HTTPStatusCode: res.StatusCode,
  5307. },
  5308. }
  5309. target := &ret
  5310. if err := gensupport.DecodeResponse(target, res); err != nil {
  5311. return nil, err
  5312. }
  5313. return ret, nil
  5314. // {
  5315. // "description": "Lists the tasks in a queue.\n\nBy default, only the BASIC view is retrieved\ndue to performance considerations;\nresponse_view controls the\nsubset of information which is returned.\n\nThe tasks may be returned in any order. The ordering may change at any\ntime.",
  5316. // "flatPath": "v2beta2/projects/{projectsId}/locations/{locationsId}/queues/{queuesId}/tasks",
  5317. // "httpMethod": "GET",
  5318. // "id": "cloudtasks.projects.locations.queues.tasks.list",
  5319. // "parameterOrder": [
  5320. // "parent"
  5321. // ],
  5322. // "parameters": {
  5323. // "pageSize": {
  5324. // "description": "Requested page size. Fewer tasks than requested might be returned.\n\nThe maximum page size is 1000. If unspecified, the page size will\nbe the maximum. Fewer tasks than requested might be returned,\neven if more tasks exist; use\nnext_page_token in the\nresponse to determine if more tasks exist.",
  5325. // "format": "int32",
  5326. // "location": "query",
  5327. // "type": "integer"
  5328. // },
  5329. // "pageToken": {
  5330. // "description": "A token identifying the page of results to return.\n\nTo request 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\nfrom the previous call to ListTasks\nmethod.\n\nThe page token is valid for only 2 hours.",
  5331. // "location": "query",
  5332. // "type": "string"
  5333. // },
  5334. // "parent": {
  5335. // "description": "Required.\n\nThe queue name. For example:\n`projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID`",
  5336. // "location": "path",
  5337. // "pattern": "^projects/[^/]+/locations/[^/]+/queues/[^/]+$",
  5338. // "required": true,
  5339. // "type": "string"
  5340. // },
  5341. // "responseView": {
  5342. // "description": "The response_view specifies which subset of the Task will be\nreturned.\n\nBy default response_view is BASIC; not all\ninformation is retrieved by default because some data, such as\npayloads, might be desirable to return only when needed because\nof its large size or because of the sensitivity of data that it\ncontains.\n\nAuthorization for FULL requires\n`cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/)\npermission on the Task resource.",
  5343. // "enum": [
  5344. // "VIEW_UNSPECIFIED",
  5345. // "BASIC",
  5346. // "FULL"
  5347. // ],
  5348. // "location": "query",
  5349. // "type": "string"
  5350. // }
  5351. // },
  5352. // "path": "v2beta2/{+parent}/tasks",
  5353. // "response": {
  5354. // "$ref": "ListTasksResponse"
  5355. // },
  5356. // "scopes": [
  5357. // "https://www.googleapis.com/auth/cloud-platform"
  5358. // ]
  5359. // }
  5360. }
  5361. // Pages invokes f for each page of results.
  5362. // A non-nil error returned from f will halt the iteration.
  5363. // The provided context supersedes any context provided to the Context method.
  5364. func (c *ProjectsLocationsQueuesTasksListCall) Pages(ctx context.Context, f func(*ListTasksResponse) error) error {
  5365. c.ctx_ = ctx
  5366. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  5367. for {
  5368. x, err := c.Do()
  5369. if err != nil {
  5370. return err
  5371. }
  5372. if err := f(x); err != nil {
  5373. return err
  5374. }
  5375. if x.NextPageToken == "" {
  5376. return nil
  5377. }
  5378. c.PageToken(x.NextPageToken)
  5379. }
  5380. }
  5381. // method id "cloudtasks.projects.locations.queues.tasks.renewLease":
  5382. type ProjectsLocationsQueuesTasksRenewLeaseCall struct {
  5383. s *Service
  5384. name string
  5385. renewleaserequest *RenewLeaseRequest
  5386. urlParams_ gensupport.URLParams
  5387. ctx_ context.Context
  5388. header_ http.Header
  5389. }
  5390. // RenewLease: Renew the current lease of a pull task.
  5391. //
  5392. // The worker can use this method to extend the lease by a new
  5393. // duration, starting from now. The new task lease will be
  5394. // returned in the task's schedule_time.
  5395. func (r *ProjectsLocationsQueuesTasksService) RenewLease(name string, renewleaserequest *RenewLeaseRequest) *ProjectsLocationsQueuesTasksRenewLeaseCall {
  5396. c := &ProjectsLocationsQueuesTasksRenewLeaseCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5397. c.name = name
  5398. c.renewleaserequest = renewleaserequest
  5399. return c
  5400. }
  5401. // Fields allows partial responses to be retrieved. See
  5402. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5403. // for more information.
  5404. func (c *ProjectsLocationsQueuesTasksRenewLeaseCall) Fields(s ...googleapi.Field) *ProjectsLocationsQueuesTasksRenewLeaseCall {
  5405. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5406. return c
  5407. }
  5408. // Context sets the context to be used in this call's Do method. Any
  5409. // pending HTTP request will be aborted if the provided context is
  5410. // canceled.
  5411. func (c *ProjectsLocationsQueuesTasksRenewLeaseCall) Context(ctx context.Context) *ProjectsLocationsQueuesTasksRenewLeaseCall {
  5412. c.ctx_ = ctx
  5413. return c
  5414. }
  5415. // Header returns an http.Header that can be modified by the caller to
  5416. // add HTTP headers to the request.
  5417. func (c *ProjectsLocationsQueuesTasksRenewLeaseCall) Header() http.Header {
  5418. if c.header_ == nil {
  5419. c.header_ = make(http.Header)
  5420. }
  5421. return c.header_
  5422. }
  5423. func (c *ProjectsLocationsQueuesTasksRenewLeaseCall) doRequest(alt string) (*http.Response, error) {
  5424. reqHeaders := make(http.Header)
  5425. for k, v := range c.header_ {
  5426. reqHeaders[k] = v
  5427. }
  5428. reqHeaders.Set("User-Agent", c.s.userAgent())
  5429. var body io.Reader = nil
  5430. body, err := googleapi.WithoutDataWrapper.JSONReader(c.renewleaserequest)
  5431. if err != nil {
  5432. return nil, err
  5433. }
  5434. reqHeaders.Set("Content-Type", "application/json")
  5435. c.urlParams_.Set("alt", alt)
  5436. c.urlParams_.Set("prettyPrint", "false")
  5437. urls := googleapi.ResolveRelative(c.s.BasePath, "v2beta2/{+name}:renewLease")
  5438. urls += "?" + c.urlParams_.Encode()
  5439. req, err := http.NewRequest("POST", urls, body)
  5440. if err != nil {
  5441. return nil, err
  5442. }
  5443. req.Header = reqHeaders
  5444. googleapi.Expand(req.URL, map[string]string{
  5445. "name": c.name,
  5446. })
  5447. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5448. }
  5449. // Do executes the "cloudtasks.projects.locations.queues.tasks.renewLease" call.
  5450. // Exactly one of *Task or error will be non-nil. Any non-2xx status
  5451. // code is an error. Response headers are in either
  5452. // *Task.ServerResponse.Header or (if a response was returned at all) in
  5453. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  5454. // whether the returned error was because http.StatusNotModified was
  5455. // returned.
  5456. func (c *ProjectsLocationsQueuesTasksRenewLeaseCall) Do(opts ...googleapi.CallOption) (*Task, error) {
  5457. gensupport.SetOptions(c.urlParams_, opts...)
  5458. res, err := c.doRequest("json")
  5459. if res != nil && res.StatusCode == http.StatusNotModified {
  5460. if res.Body != nil {
  5461. res.Body.Close()
  5462. }
  5463. return nil, &googleapi.Error{
  5464. Code: res.StatusCode,
  5465. Header: res.Header,
  5466. }
  5467. }
  5468. if err != nil {
  5469. return nil, err
  5470. }
  5471. defer googleapi.CloseBody(res)
  5472. if err := googleapi.CheckResponse(res); err != nil {
  5473. return nil, err
  5474. }
  5475. ret := &Task{
  5476. ServerResponse: googleapi.ServerResponse{
  5477. Header: res.Header,
  5478. HTTPStatusCode: res.StatusCode,
  5479. },
  5480. }
  5481. target := &ret
  5482. if err := gensupport.DecodeResponse(target, res); err != nil {
  5483. return nil, err
  5484. }
  5485. return ret, nil
  5486. // {
  5487. // "description": "Renew the current lease of a pull task.\n\nThe worker can use this method to extend the lease by a new\nduration, starting from now. The new task lease will be\nreturned in the task's schedule_time.",
  5488. // "flatPath": "v2beta2/projects/{projectsId}/locations/{locationsId}/queues/{queuesId}/tasks/{tasksId}:renewLease",
  5489. // "httpMethod": "POST",
  5490. // "id": "cloudtasks.projects.locations.queues.tasks.renewLease",
  5491. // "parameterOrder": [
  5492. // "name"
  5493. // ],
  5494. // "parameters": {
  5495. // "name": {
  5496. // "description": "Required.\n\nThe task name. For example:\n`projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`",
  5497. // "location": "path",
  5498. // "pattern": "^projects/[^/]+/locations/[^/]+/queues/[^/]+/tasks/[^/]+$",
  5499. // "required": true,
  5500. // "type": "string"
  5501. // }
  5502. // },
  5503. // "path": "v2beta2/{+name}:renewLease",
  5504. // "request": {
  5505. // "$ref": "RenewLeaseRequest"
  5506. // },
  5507. // "response": {
  5508. // "$ref": "Task"
  5509. // },
  5510. // "scopes": [
  5511. // "https://www.googleapis.com/auth/cloud-platform"
  5512. // ]
  5513. // }
  5514. }
  5515. // method id "cloudtasks.projects.locations.queues.tasks.run":
  5516. type ProjectsLocationsQueuesTasksRunCall struct {
  5517. s *Service
  5518. name string
  5519. runtaskrequest *RunTaskRequest
  5520. urlParams_ gensupport.URLParams
  5521. ctx_ context.Context
  5522. header_ http.Header
  5523. }
  5524. // Run: Forces a task to run now.
  5525. //
  5526. // When this method is called, Cloud Tasks will dispatch the task, even
  5527. // if
  5528. // the task is already running, the queue has reached its RateLimits
  5529. // or
  5530. // is PAUSED.
  5531. //
  5532. // This command is meant to be used for manual debugging. For
  5533. // example, RunTask can be used to retry a failed
  5534. // task after a fix has been made or to manually force a task to
  5535. // be
  5536. // dispatched now.
  5537. //
  5538. // The dispatched task is returned. That is, the task that is
  5539. // returned
  5540. // contains the status after the task is dispatched but
  5541. // before the task is received by its target.
  5542. //
  5543. // If Cloud Tasks receives a successful response from the task's
  5544. // target, then the task will be deleted; otherwise the
  5545. // task's
  5546. // schedule_time will be reset to the time that
  5547. // RunTask was called plus the retry delay specified
  5548. // in the queue's RetryConfig.
  5549. //
  5550. // RunTask returns
  5551. // NOT_FOUND when it is called on a
  5552. // task that has already succeeded or permanently failed.
  5553. //
  5554. // RunTask cannot be called on a
  5555. // pull task.
  5556. func (r *ProjectsLocationsQueuesTasksService) Run(name string, runtaskrequest *RunTaskRequest) *ProjectsLocationsQueuesTasksRunCall {
  5557. c := &ProjectsLocationsQueuesTasksRunCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5558. c.name = name
  5559. c.runtaskrequest = runtaskrequest
  5560. return c
  5561. }
  5562. // Fields allows partial responses to be retrieved. See
  5563. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5564. // for more information.
  5565. func (c *ProjectsLocationsQueuesTasksRunCall) Fields(s ...googleapi.Field) *ProjectsLocationsQueuesTasksRunCall {
  5566. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5567. return c
  5568. }
  5569. // Context sets the context to be used in this call's Do method. Any
  5570. // pending HTTP request will be aborted if the provided context is
  5571. // canceled.
  5572. func (c *ProjectsLocationsQueuesTasksRunCall) Context(ctx context.Context) *ProjectsLocationsQueuesTasksRunCall {
  5573. c.ctx_ = ctx
  5574. return c
  5575. }
  5576. // Header returns an http.Header that can be modified by the caller to
  5577. // add HTTP headers to the request.
  5578. func (c *ProjectsLocationsQueuesTasksRunCall) Header() http.Header {
  5579. if c.header_ == nil {
  5580. c.header_ = make(http.Header)
  5581. }
  5582. return c.header_
  5583. }
  5584. func (c *ProjectsLocationsQueuesTasksRunCall) doRequest(alt string) (*http.Response, error) {
  5585. reqHeaders := make(http.Header)
  5586. for k, v := range c.header_ {
  5587. reqHeaders[k] = v
  5588. }
  5589. reqHeaders.Set("User-Agent", c.s.userAgent())
  5590. var body io.Reader = nil
  5591. body, err := googleapi.WithoutDataWrapper.JSONReader(c.runtaskrequest)
  5592. if err != nil {
  5593. return nil, err
  5594. }
  5595. reqHeaders.Set("Content-Type", "application/json")
  5596. c.urlParams_.Set("alt", alt)
  5597. c.urlParams_.Set("prettyPrint", "false")
  5598. urls := googleapi.ResolveRelative(c.s.BasePath, "v2beta2/{+name}:run")
  5599. urls += "?" + c.urlParams_.Encode()
  5600. req, err := http.NewRequest("POST", urls, body)
  5601. if err != nil {
  5602. return nil, err
  5603. }
  5604. req.Header = reqHeaders
  5605. googleapi.Expand(req.URL, map[string]string{
  5606. "name": c.name,
  5607. })
  5608. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5609. }
  5610. // Do executes the "cloudtasks.projects.locations.queues.tasks.run" call.
  5611. // Exactly one of *Task or error will be non-nil. Any non-2xx status
  5612. // code is an error. Response headers are in either
  5613. // *Task.ServerResponse.Header or (if a response was returned at all) in
  5614. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  5615. // whether the returned error was because http.StatusNotModified was
  5616. // returned.
  5617. func (c *ProjectsLocationsQueuesTasksRunCall) Do(opts ...googleapi.CallOption) (*Task, error) {
  5618. gensupport.SetOptions(c.urlParams_, opts...)
  5619. res, err := c.doRequest("json")
  5620. if res != nil && res.StatusCode == http.StatusNotModified {
  5621. if res.Body != nil {
  5622. res.Body.Close()
  5623. }
  5624. return nil, &googleapi.Error{
  5625. Code: res.StatusCode,
  5626. Header: res.Header,
  5627. }
  5628. }
  5629. if err != nil {
  5630. return nil, err
  5631. }
  5632. defer googleapi.CloseBody(res)
  5633. if err := googleapi.CheckResponse(res); err != nil {
  5634. return nil, err
  5635. }
  5636. ret := &Task{
  5637. ServerResponse: googleapi.ServerResponse{
  5638. Header: res.Header,
  5639. HTTPStatusCode: res.StatusCode,
  5640. },
  5641. }
  5642. target := &ret
  5643. if err := gensupport.DecodeResponse(target, res); err != nil {
  5644. return nil, err
  5645. }
  5646. return ret, nil
  5647. // {
  5648. // "description": "Forces a task to run now.\n\nWhen this method is called, Cloud Tasks will dispatch the task, even if\nthe task is already running, the queue has reached its RateLimits or\nis PAUSED.\n\nThis command is meant to be used for manual debugging. For\nexample, RunTask can be used to retry a failed\ntask after a fix has been made or to manually force a task to be\ndispatched now.\n\nThe dispatched task is returned. That is, the task that is returned\ncontains the status after the task is dispatched but\nbefore the task is received by its target.\n\nIf Cloud Tasks receives a successful response from the task's\ntarget, then the task will be deleted; otherwise the task's\nschedule_time will be reset to the time that\nRunTask was called plus the retry delay specified\nin the queue's RetryConfig.\n\nRunTask returns\nNOT_FOUND when it is called on a\ntask that has already succeeded or permanently failed.\n\nRunTask cannot be called on a\npull task.",
  5649. // "flatPath": "v2beta2/projects/{projectsId}/locations/{locationsId}/queues/{queuesId}/tasks/{tasksId}:run",
  5650. // "httpMethod": "POST",
  5651. // "id": "cloudtasks.projects.locations.queues.tasks.run",
  5652. // "parameterOrder": [
  5653. // "name"
  5654. // ],
  5655. // "parameters": {
  5656. // "name": {
  5657. // "description": "Required.\n\nThe task name. For example:\n`projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`",
  5658. // "location": "path",
  5659. // "pattern": "^projects/[^/]+/locations/[^/]+/queues/[^/]+/tasks/[^/]+$",
  5660. // "required": true,
  5661. // "type": "string"
  5662. // }
  5663. // },
  5664. // "path": "v2beta2/{+name}:run",
  5665. // "request": {
  5666. // "$ref": "RunTaskRequest"
  5667. // },
  5668. // "response": {
  5669. // "$ref": "Task"
  5670. // },
  5671. // "scopes": [
  5672. // "https://www.googleapis.com/auth/cloud-platform"
  5673. // ]
  5674. // }
  5675. }