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