-
Notifications
You must be signed in to change notification settings - Fork 0
/
batch.pb.grpc.go
250 lines (198 loc) · 7.79 KB
/
batch.pb.grpc.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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
package batchv1
import (
"context"
"cloud.google.com/go/batch/apiv1/batchpb"
"cloud.google.com/go/longrunning/autogen/longrunningpb"
"github.com/googleapis/gax-go/v2"
"google.golang.org/api/iterator"
"google.golang.org/protobuf/types/known/timestamppb"
)
//go:generate counterfeiter -generate
//counterfeiter:generate -o batchv1fake . BatchServiceClient
// BatchServiceClient is the client API for BatchService service.
type BatchServiceClient interface {
CreateJob(context.Context, *CreateBatchJobRequest, ...gax.CallOption) (*BatchJob, error)
GetJob(context.Context, *GetBatchJobRequest, ...gax.CallOption) (*BatchJob, error)
DeleteJob(context.Context, *DeleteBatchJobRequest, ...gax.CallOption) (DeleteBatchJobOperation, error)
DeleteJobOperation(string) DeleteBatchJobOperation
ListJobs(context.Context, *ListBatchJobsRequest, ...gax.CallOption) BatchJobIterator
GetTask(context.Context, *GetBatchTaskRequest, ...gax.CallOption) (*BatchTask, error)
ListTasks(context.Context, *ListBatchTasksRequest, ...gax.CallOption) BatchTaskIterator
CancelOperation(context.Context, *CancelBatchOperationRequest, ...gax.CallOption) error
DeleteOperation(context.Context, *DeleteBatchOperationRequest, ...gax.CallOption) error
}
type (
BatchJob = batchpb.Job
BatchJobStatus = batchpb.JobStatus
BatchJobStatus_State = batchpb.JobStatus_State
)
var (
BatchJobStatus_STATE_UNSPECIFIED = batchpb.JobStatus_STATE_UNSPECIFIED
// Notify users that the job state has changed.
BatchJobNotification_JOB_STATE_CHANGED = batchpb.JobNotification_JOB_STATE_CHANGED
)
type (
BatchTask = batchpb.Task
BatchTaskStatus = batchpb.TaskStatus
BatchTaskStatus_State = batchpb.TaskStatus_State
)
var (
BatchTaskStatus_STATE_UNSPECIFIED = batchpb.TaskStatus_STATE_UNSPECIFIED
// Notify users that the task state has changed.
BatchJobNotification_TASK_STATE_CHANGED = batchpb.JobNotification_TASK_STATE_CHANGED
)
type (
CreateBatchJobRequest = batchpb.CreateJobRequest
GetBatchJobRequest = batchpb.GetJobRequest
DeleteBatchJobRequest = batchpb.DeleteJobRequest
ListBatchJobsRequest = batchpb.ListJobsRequest
GetBatchTaskRequest = batchpb.GetTaskRequest
ListBatchTasksRequest = batchpb.ListTasksRequest
)
type (
BatchOperation = longrunningpb.Operation
CancelBatchOperationRequest = longrunningpb.CancelOperationRequest
DeleteBatchOperationRequest = longrunningpb.DeleteOperationRequest
)
//counterfeiter:generate -o batchv1fake . DeleteBatchJobOperation
// DeleteJobOperation manages a long-running operation from DeleteJob.
type DeleteBatchJobOperation interface {
Name() string
Wait(ctx context.Context, opts ...gax.CallOption) error
Poll(ctx context.Context, opts ...gax.CallOption) error
Metadata() (*batchpb.OperationMetadata, error)
Done() bool
}
//counterfeiter:generate -o batchv1fake . BatchPageInfo
// PageInfo contains information about an iterator's paging state.
type BatchPageInfo interface {
Token() string
MaxSize() int
Remaining() int
}
//counterfeiter:generate -o batchv1fake . BatchJobIterator
type BatchJobIterator interface {
Next() (*batchpb.Job, error)
PageInfo() BatchPageInfo
}
//counterfeiter:generate -o batchv1fake . BatchTaskIterator
type BatchTaskIterator interface {
Next() (*batchpb.Task, error)
PageInfo() BatchPageInfo
}
//counterfeiter:generate -o batchv1fake . BatchOperationIterator
type BatchOperationIterator interface {
Next() (*BatchOperation, error)
PageInfo() BatchPageInfo
}
var _ BatchServiceClient = &NopBatchServiceClient{}
// NopBatchServiceClient is a no-op implementation of BatchServiceClient.
type NopBatchServiceClient struct{}
// CancelOperation implements BatchServiceClient.
func (*NopBatchServiceClient) CancelOperation(context.Context, *longrunningpb.CancelOperationRequest, ...gax.CallOption) error {
return nil
}
// CreateJob implements BatchServiceClient.
func (*NopBatchServiceClient) CreateJob(context.Context, *batchpb.CreateJobRequest, ...gax.CallOption) (*batchpb.Job, error) {
return &batchpb.Job{}, nil
}
// DeleteJob implements BatchServiceClient.
func (*NopBatchServiceClient) DeleteJob(context.Context, *batchpb.DeleteJobRequest, ...gax.CallOption) (DeleteBatchJobOperation, error) {
panic("unimplemented")
}
// DeleteJobOperation implements BatchServiceClient.
func (*NopBatchServiceClient) DeleteJobOperation(string) DeleteBatchJobOperation {
panic("unimplemented")
}
// DeleteOperation implements BatchServiceClient.
func (*NopBatchServiceClient) DeleteOperation(context.Context, *longrunningpb.DeleteOperationRequest, ...gax.CallOption) error {
return nil
}
// GetJob implements BatchServiceClient.
func (*NopBatchServiceClient) GetJob(context.Context, *batchpb.GetJobRequest, ...gax.CallOption) (*batchpb.Job, error) {
return &batchpb.Job{
Name: "",
Uid: "",
Priority: 0,
TaskGroups: []*batchpb.TaskGroup{},
AllocationPolicy: &batchpb.AllocationPolicy{},
Labels: map[string]string{},
Status: &batchpb.JobStatus{},
CreateTime: ×tamppb.Timestamp{},
UpdateTime: ×tamppb.Timestamp{},
LogsPolicy: &batchpb.LogsPolicy{},
Notifications: []*batchpb.JobNotification{},
}, nil
}
// GetTask implements BatchServiceClient.
func (*NopBatchServiceClient) GetTask(context.Context, *batchpb.GetTaskRequest, ...gax.CallOption) (*batchpb.Task, error) {
return &batchpb.Task{}, nil
}
// ListJobs implements BatchServiceClient.
func (*NopBatchServiceClient) ListJobs(context.Context, *batchpb.ListJobsRequest, ...gax.CallOption) BatchJobIterator {
return &NopBatchJobIterator{}
}
// ListTasks implements BatchServiceClient.
func (*NopBatchServiceClient) ListTasks(context.Context, *batchpb.ListTasksRequest, ...gax.CallOption) BatchTaskIterator {
return &NopBatchTaskIterator{}
}
var _ DeleteBatchJobOperation = &NopDeleteBatchJobOperation{}
// NopDeleteBatchJobOperation is a no-op implementation of DeleteBatchJobOperation.
type NopDeleteBatchJobOperation struct{}
// Done implements DeleteBatchJobOperation.
func (*NopDeleteBatchJobOperation) Done() bool {
return true
}
// Metadata implements DeleteBatchJobOperation.
func (*NopDeleteBatchJobOperation) Metadata() (*batchpb.OperationMetadata, error) {
return &batchpb.OperationMetadata{}, nil
}
// Name implements DeleteBatchJobOperation.
func (*NopDeleteBatchJobOperation) Name() string {
return ""
}
// Poll implements DeleteBatchJobOperation.
func (*NopDeleteBatchJobOperation) Poll(ctx context.Context, opts ...gax.CallOption) error {
return nil
}
// Wait implements DeleteBatchJobOperation.
func (*NopDeleteBatchJobOperation) Wait(ctx context.Context, opts ...gax.CallOption) error {
return nil
}
var _ BatchJobIterator = &NopBatchJobIterator{}
// NopBatchJobIterator is a no-op implementation of BatchJobIterator.
type NopBatchJobIterator struct{}
// Next implements BatchJobIterator.
func (*NopBatchJobIterator) Next() (*batchpb.Job, error) {
return nil, iterator.Done
}
// PageInfo implements BatchJobIterator.
func (*NopBatchJobIterator) PageInfo() BatchPageInfo {
return &NoBatchPageInfo{}
}
var _ BatchTaskIterator = &NopBatchTaskIterator{}
// NopBatchTaskIterator is a no-op implementation of BatchTaskIterator.
type NopBatchTaskIterator struct{}
// Next implements BatchTaskIterator.
func (*NopBatchTaskIterator) Next() (*batchpb.Task, error) {
return nil, iterator.Done
}
// PageInfo implements BatchTaskIterator.
func (*NopBatchTaskIterator) PageInfo() BatchPageInfo {
return &NoBatchPageInfo{}
}
var _ BatchPageInfo = &NoBatchPageInfo{}
// NoBatchPageInfo is a no-op implementation of BatchPageInfo.
type NoBatchPageInfo struct{}
// MaxSize implements BatchPageInfo.
func (*NoBatchPageInfo) MaxSize() int {
return 0
}
// Remaining implements BatchPageInfo.
func (*NoBatchPageInfo) Remaining() int {
return 0
}
// Token implements BatchPageInfo.
func (*NoBatchPageInfo) Token() string {
return ""
}