/
getTask.go
161 lines (135 loc) · 12.8 KB
/
getTask.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
// Code generated by the Pulumi SDK Generator DO NOT EDIT.
// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
package v2beta3
import (
"context"
"reflect"
"github.com/pulumi/pulumi-google-native/sdk/go/google/internal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Gets a task.
func LookupTask(ctx *pulumi.Context, args *LookupTaskArgs, opts ...pulumi.InvokeOption) (*LookupTaskResult, error) {
opts = internal.PkgInvokeDefaultOpts(opts)
var rv LookupTaskResult
err := ctx.Invoke("google-native:cloudtasks/v2beta3:getTask", args, &rv, opts...)
if err != nil {
return nil, err
}
return &rv, nil
}
type LookupTaskArgs struct {
Location string `pulumi:"location"`
Project *string `pulumi:"project"`
QueueId string `pulumi:"queueId"`
ResponseView *string `pulumi:"responseView"`
TaskId string `pulumi:"taskId"`
}
type LookupTaskResult struct {
// HTTP request that is sent to the App Engine app handler. An App Engine task is a task that has AppEngineHttpRequest set.
AppEngineHttpRequest AppEngineHttpRequestResponse `pulumi:"appEngineHttpRequest"`
// The time that the task was created. `create_time` will be truncated to the nearest second.
CreateTime string `pulumi:"createTime"`
// The number of attempts dispatched. This count includes attempts which have been dispatched but haven't received a response.
DispatchCount int `pulumi:"dispatchCount"`
// The deadline for requests sent to the worker. If the worker does not respond by this deadline then the request is cancelled and the attempt is marked as a `DEADLINE_EXCEEDED` failure. Cloud Tasks will retry the task according to the RetryConfig. Note that when the request is cancelled, Cloud Tasks will stop listening for the response, but whether the worker stops processing depends on the worker. For example, if the worker is stuck, it may not react to cancelled requests. The default and maximum values depend on the type of request: * For HTTP tasks, the default is 10 minutes. The deadline must be in the interval [15 seconds, 30 minutes]. * For App Engine tasks, 0 indicates that the request has the default deadline. The default deadline depends on the [scaling type](https://cloud.google.com/appengine/docs/standard/go/how-instances-are-managed#instance_scaling) of the service: 10 minutes for standard apps with automatic scaling, 24 hours for standard apps with manual and basic scaling, and 60 minutes for flex apps. If the request deadline is set, it must be in the interval [15 seconds, 24 hours 15 seconds]. Regardless of the task's `dispatch_deadline`, the app handler will not run for longer than than the service's timeout. We recommend setting the `dispatch_deadline` to at most a few seconds more than the app handler's timeout. For more information see [Timeouts](https://cloud.google.com/tasks/docs/creating-appengine-handlers#timeouts). The value must be given as a string that indicates the length of time (in seconds) followed by `s` (for "seconds"). For more information on the format, see the documentation for [Duration](https://protobuf.dev/reference/protobuf/google.protobuf/#duration). `dispatch_deadline` will be truncated to the nearest millisecond. The deadline is an approximate deadline.
DispatchDeadline string `pulumi:"dispatchDeadline"`
// The status of the task's first attempt. Only dispatch_time will be set. The other Attempt information is not retained by Cloud Tasks.
FirstAttempt AttemptResponse `pulumi:"firstAttempt"`
// HTTP request that is sent to the task's target. An HTTP task is a task that has HttpRequest set.
HttpRequest HttpRequestResponse `pulumi:"httpRequest"`
// The status of the task's last attempt.
LastAttempt AttemptResponse `pulumi:"lastAttempt"`
// Optionally caller-specified in CreateTask. The task name. The task name must have the following format: `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID` * `PROJECT_ID` can contain letters ([A-Za-z]), numbers ([0-9]), hyphens (-), colons (:), or periods (.). For more information, see [Identifying projects](https://cloud.google.com/resource-manager/docs/creating-managing-projects#identifying_projects) * `LOCATION_ID` is the canonical ID for the task's location. The list of available locations can be obtained by calling ListLocations. For more information, see https://cloud.google.com/about/locations/. * `QUEUE_ID` can contain letters ([A-Za-z]), numbers ([0-9]), or hyphens (-). The maximum length is 100 characters. * `TASK_ID` can contain only letters ([A-Za-z]), numbers ([0-9]), hyphens (-), or underscores (_). The maximum length is 500 characters.
Name string `pulumi:"name"`
// Pull Message contained in a task in a PULL queue type. This payload type cannot be explicitly set through Cloud Tasks API. Its purpose, currently is to provide backward compatibility with App Engine Task Queue [pull](https://cloud.google.com/appengine/docs/standard/java/taskqueue/pull/) queues to provide a way to inspect contents of pull tasks through the CloudTasks.GetTask.
PullMessage PullMessageResponse `pulumi:"pullMessage"`
// The number of attempts which have received a response.
ResponseCount int `pulumi:"responseCount"`
// The time when the task is scheduled to be attempted. For App Engine queues, this is when the task will be attempted or retried. `schedule_time` will be truncated to the nearest microsecond.
ScheduleTime string `pulumi:"scheduleTime"`
// The view specifies which subset of the Task has been returned.
View string `pulumi:"view"`
}
func LookupTaskOutput(ctx *pulumi.Context, args LookupTaskOutputArgs, opts ...pulumi.InvokeOption) LookupTaskResultOutput {
return pulumi.ToOutputWithContext(context.Background(), args).
ApplyT(func(v interface{}) (LookupTaskResult, error) {
args := v.(LookupTaskArgs)
r, err := LookupTask(ctx, &args, opts...)
var s LookupTaskResult
if r != nil {
s = *r
}
return s, err
}).(LookupTaskResultOutput)
}
type LookupTaskOutputArgs struct {
Location pulumi.StringInput `pulumi:"location"`
Project pulumi.StringPtrInput `pulumi:"project"`
QueueId pulumi.StringInput `pulumi:"queueId"`
ResponseView pulumi.StringPtrInput `pulumi:"responseView"`
TaskId pulumi.StringInput `pulumi:"taskId"`
}
func (LookupTaskOutputArgs) ElementType() reflect.Type {
return reflect.TypeOf((*LookupTaskArgs)(nil)).Elem()
}
type LookupTaskResultOutput struct{ *pulumi.OutputState }
func (LookupTaskResultOutput) ElementType() reflect.Type {
return reflect.TypeOf((*LookupTaskResult)(nil)).Elem()
}
func (o LookupTaskResultOutput) ToLookupTaskResultOutput() LookupTaskResultOutput {
return o
}
func (o LookupTaskResultOutput) ToLookupTaskResultOutputWithContext(ctx context.Context) LookupTaskResultOutput {
return o
}
// HTTP request that is sent to the App Engine app handler. An App Engine task is a task that has AppEngineHttpRequest set.
func (o LookupTaskResultOutput) AppEngineHttpRequest() AppEngineHttpRequestResponseOutput {
return o.ApplyT(func(v LookupTaskResult) AppEngineHttpRequestResponse { return v.AppEngineHttpRequest }).(AppEngineHttpRequestResponseOutput)
}
// The time that the task was created. `create_time` will be truncated to the nearest second.
func (o LookupTaskResultOutput) CreateTime() pulumi.StringOutput {
return o.ApplyT(func(v LookupTaskResult) string { return v.CreateTime }).(pulumi.StringOutput)
}
// The number of attempts dispatched. This count includes attempts which have been dispatched but haven't received a response.
func (o LookupTaskResultOutput) DispatchCount() pulumi.IntOutput {
return o.ApplyT(func(v LookupTaskResult) int { return v.DispatchCount }).(pulumi.IntOutput)
}
// The deadline for requests sent to the worker. If the worker does not respond by this deadline then the request is cancelled and the attempt is marked as a `DEADLINE_EXCEEDED` failure. Cloud Tasks will retry the task according to the RetryConfig. Note that when the request is cancelled, Cloud Tasks will stop listening for the response, but whether the worker stops processing depends on the worker. For example, if the worker is stuck, it may not react to cancelled requests. The default and maximum values depend on the type of request: * For HTTP tasks, the default is 10 minutes. The deadline must be in the interval [15 seconds, 30 minutes]. * For App Engine tasks, 0 indicates that the request has the default deadline. The default deadline depends on the [scaling type](https://cloud.google.com/appengine/docs/standard/go/how-instances-are-managed#instance_scaling) of the service: 10 minutes for standard apps with automatic scaling, 24 hours for standard apps with manual and basic scaling, and 60 minutes for flex apps. If the request deadline is set, it must be in the interval [15 seconds, 24 hours 15 seconds]. Regardless of the task's `dispatch_deadline`, the app handler will not run for longer than than the service's timeout. We recommend setting the `dispatch_deadline` to at most a few seconds more than the app handler's timeout. For more information see [Timeouts](https://cloud.google.com/tasks/docs/creating-appengine-handlers#timeouts). The value must be given as a string that indicates the length of time (in seconds) followed by `s` (for "seconds"). For more information on the format, see the documentation for [Duration](https://protobuf.dev/reference/protobuf/google.protobuf/#duration). `dispatch_deadline` will be truncated to the nearest millisecond. The deadline is an approximate deadline.
func (o LookupTaskResultOutput) DispatchDeadline() pulumi.StringOutput {
return o.ApplyT(func(v LookupTaskResult) string { return v.DispatchDeadline }).(pulumi.StringOutput)
}
// The status of the task's first attempt. Only dispatch_time will be set. The other Attempt information is not retained by Cloud Tasks.
func (o LookupTaskResultOutput) FirstAttempt() AttemptResponseOutput {
return o.ApplyT(func(v LookupTaskResult) AttemptResponse { return v.FirstAttempt }).(AttemptResponseOutput)
}
// HTTP request that is sent to the task's target. An HTTP task is a task that has HttpRequest set.
func (o LookupTaskResultOutput) HttpRequest() HttpRequestResponseOutput {
return o.ApplyT(func(v LookupTaskResult) HttpRequestResponse { return v.HttpRequest }).(HttpRequestResponseOutput)
}
// The status of the task's last attempt.
func (o LookupTaskResultOutput) LastAttempt() AttemptResponseOutput {
return o.ApplyT(func(v LookupTaskResult) AttemptResponse { return v.LastAttempt }).(AttemptResponseOutput)
}
// Optionally caller-specified in CreateTask. The task name. The task name must have the following format: `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID` * `PROJECT_ID` can contain letters ([A-Za-z]), numbers ([0-9]), hyphens (-), colons (:), or periods (.). For more information, see [Identifying projects](https://cloud.google.com/resource-manager/docs/creating-managing-projects#identifying_projects) * `LOCATION_ID` is the canonical ID for the task's location. The list of available locations can be obtained by calling ListLocations. For more information, see https://cloud.google.com/about/locations/. * `QUEUE_ID` can contain letters ([A-Za-z]), numbers ([0-9]), or hyphens (-). The maximum length is 100 characters. * `TASK_ID` can contain only letters ([A-Za-z]), numbers ([0-9]), hyphens (-), or underscores (_). The maximum length is 500 characters.
func (o LookupTaskResultOutput) Name() pulumi.StringOutput {
return o.ApplyT(func(v LookupTaskResult) string { return v.Name }).(pulumi.StringOutput)
}
// Pull Message contained in a task in a PULL queue type. This payload type cannot be explicitly set through Cloud Tasks API. Its purpose, currently is to provide backward compatibility with App Engine Task Queue [pull](https://cloud.google.com/appengine/docs/standard/java/taskqueue/pull/) queues to provide a way to inspect contents of pull tasks through the CloudTasks.GetTask.
func (o LookupTaskResultOutput) PullMessage() PullMessageResponseOutput {
return o.ApplyT(func(v LookupTaskResult) PullMessageResponse { return v.PullMessage }).(PullMessageResponseOutput)
}
// The number of attempts which have received a response.
func (o LookupTaskResultOutput) ResponseCount() pulumi.IntOutput {
return o.ApplyT(func(v LookupTaskResult) int { return v.ResponseCount }).(pulumi.IntOutput)
}
// The time when the task is scheduled to be attempted. For App Engine queues, this is when the task will be attempted or retried. `schedule_time` will be truncated to the nearest microsecond.
func (o LookupTaskResultOutput) ScheduleTime() pulumi.StringOutput {
return o.ApplyT(func(v LookupTaskResult) string { return v.ScheduleTime }).(pulumi.StringOutput)
}
// The view specifies which subset of the Task has been returned.
func (o LookupTaskResultOutput) View() pulumi.StringOutput {
return o.ApplyT(func(v LookupTaskResult) string { return v.View }).(pulumi.StringOutput)
}
func init() {
pulumi.RegisterOutputType(LookupTaskResultOutput{})
}