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