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.
 
 
 

5023 lines
174 KiB

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