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

5883 lines
205 KiB

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