1/*
2	Copyright The containerd Authors.
3
4	Licensed under the Apache License, Version 2.0 (the "License");
5	you may not use this file except in compliance with the License.
6	You may obtain a copy of the License at
7
8		http://www.apache.org/licenses/LICENSE-2.0
9
10	Unless required by applicable law or agreed to in writing, software
11	distributed under the License is distributed on an "AS IS" BASIS,
12	WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13	See the License for the specific language governing permissions and
14	limitations under the License.
15*/
16
17syntax = "proto3";
18
19package containerd.services.tasks.v1;
20
21import "google/protobuf/empty.proto";
22import "google/protobuf/any.proto";
23import weak "gogoproto/gogo.proto";
24import "github.com/containerd/containerd/api/types/mount.proto";
25import "github.com/containerd/containerd/api/types/metrics.proto";
26import "github.com/containerd/containerd/api/types/descriptor.proto";
27import "github.com/containerd/containerd/api/types/task/task.proto";
28import "google/protobuf/timestamp.proto";
29
30option go_package = "github.com/containerd/containerd/api/services/tasks/v1;tasks";
31
32service Tasks {
33	// Create a task.
34	rpc Create(CreateTaskRequest) returns (CreateTaskResponse);
35
36	// Start a process.
37	rpc Start(StartRequest) returns (StartResponse);
38
39	// Delete a task and on disk state.
40	rpc Delete(DeleteTaskRequest) returns (DeleteResponse);
41
42	rpc DeleteProcess(DeleteProcessRequest) returns (DeleteResponse);
43
44	rpc Get(GetRequest) returns (GetResponse);
45
46	rpc List(ListTasksRequest) returns (ListTasksResponse);
47
48	// Kill a task or process.
49	rpc Kill(KillRequest) returns (google.protobuf.Empty);
50
51	rpc Exec(ExecProcessRequest) returns (google.protobuf.Empty);
52
53	rpc ResizePty(ResizePtyRequest) returns (google.protobuf.Empty);
54
55	rpc CloseIO(CloseIORequest) returns (google.protobuf.Empty);
56
57	rpc Pause(PauseTaskRequest) returns (google.protobuf.Empty);
58
59	rpc Resume(ResumeTaskRequest) returns (google.protobuf.Empty);
60
61	rpc ListPids(ListPidsRequest) returns (ListPidsResponse);
62
63	rpc Checkpoint(CheckpointTaskRequest) returns (CheckpointTaskResponse);
64
65	rpc Update(UpdateTaskRequest) returns (google.protobuf.Empty);
66
67	rpc Metrics(MetricsRequest) returns (MetricsResponse);
68
69	rpc Wait(WaitRequest) returns (WaitResponse);
70}
71
72message CreateTaskRequest {
73	string container_id = 1;
74
75	// RootFS provides the pre-chroot mounts to perform in the shim before
76	// executing the container task.
77	//
78	// These are for mounts that cannot be performed in the user namespace.
79	// Typically, these mounts should be resolved from snapshots specified on
80	// the container object.
81	repeated containerd.types.Mount rootfs = 3;
82
83	string stdin = 4;
84	string stdout = 5;
85	string stderr = 6;
86	bool terminal = 7;
87
88	containerd.types.Descriptor checkpoint = 8;
89
90	google.protobuf.Any options = 9;
91}
92
93message CreateTaskResponse {
94	string container_id = 1;
95	uint32 pid = 2;
96}
97
98message StartRequest {
99	string container_id = 1;
100	string exec_id = 2;
101}
102
103message StartResponse {
104	uint32 pid = 1;
105}
106
107message DeleteTaskRequest {
108	string container_id = 1;
109}
110
111message DeleteResponse {
112	string id = 1;
113	uint32 pid = 2;
114	uint32 exit_status = 3;
115	google.protobuf.Timestamp exited_at = 4 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false];
116}
117
118message DeleteProcessRequest {
119	string container_id = 1;
120	string exec_id = 2;
121}
122
123message GetRequest {
124	string container_id = 1;
125	string exec_id = 2;
126}
127
128message GetResponse {
129	containerd.v1.types.Process process = 1;
130}
131
132message ListTasksRequest {
133	string filter = 1;
134}
135
136message ListTasksResponse {
137	repeated containerd.v1.types.Process tasks = 1;
138}
139
140message KillRequest {
141	string container_id = 1;
142	string exec_id = 2;
143	uint32 signal = 3;
144	bool all = 4;
145}
146
147message ExecProcessRequest {
148	string container_id = 1;
149	string stdin = 2;
150	string stdout = 3;
151	string stderr = 4;
152	bool terminal = 5;
153	// Spec for starting a process in the target container.
154	//
155	// For runc, this is a process spec, for example.
156	google.protobuf.Any spec = 6;
157	// id of the exec process
158	string exec_id = 7;
159}
160
161message ExecProcessResponse {
162}
163
164message ResizePtyRequest {
165	string container_id = 1;
166	string exec_id = 2;
167	uint32 width = 3;
168	uint32 height = 4;
169}
170
171message CloseIORequest {
172	string container_id = 1;
173	string exec_id = 2;
174	bool stdin = 3;
175}
176
177message PauseTaskRequest {
178	string container_id = 1;
179}
180
181message ResumeTaskRequest {
182	string container_id = 1;
183}
184
185message ListPidsRequest {
186	string container_id = 1;
187}
188
189message ListPidsResponse {
190	// Processes includes the process ID and additional process information
191	repeated containerd.v1.types.ProcessInfo processes = 1;
192}
193
194message CheckpointTaskRequest {
195	string container_id = 1;
196	string parent_checkpoint = 2 [(gogoproto.customtype) = "github.com/opencontainers/go-digest.Digest", (gogoproto.nullable) = false];
197	google.protobuf.Any options = 3;
198}
199
200message CheckpointTaskResponse {
201	repeated containerd.types.Descriptor descriptors = 1;
202}
203
204message UpdateTaskRequest {
205	string container_id = 1;
206	google.protobuf.Any resources = 2;
207	map<string, string> annotations = 3;
208}
209
210message MetricsRequest {
211	repeated string filters = 1;
212}
213
214message MetricsResponse {
215	repeated types.Metric metrics = 1;
216}
217
218message WaitRequest {
219	string container_id = 1;
220	string exec_id = 2;
221}
222
223message WaitResponse {
224	uint32 exit_status = 1;
225	google.protobuf.Timestamp exited_at = 2 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false];
226}
227