control.proto 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442
  1. syntax = "proto3";
  2. package docker.swarmkit.v1;
  3. import "specs.proto";
  4. import "objects.proto";
  5. import "types.proto";
  6. import "gogoproto/gogo.proto";
  7. import "plugin/plugin.proto";
  8. // Control defines the RPC methods for controlling a cluster.
  9. service Control {
  10. rpc GetNode(GetNodeRequest) returns (GetNodeResponse) {
  11. option (docker.protobuf.plugin.tls_authorization) = { roles: "swarm-manager" };
  12. };
  13. rpc ListNodes(ListNodesRequest) returns (ListNodesResponse) {
  14. option (docker.protobuf.plugin.tls_authorization) = { roles: "swarm-manager" };
  15. };
  16. rpc UpdateNode(UpdateNodeRequest) returns (UpdateNodeResponse) {
  17. option (docker.protobuf.plugin.tls_authorization) = { roles: "swarm-manager" };
  18. };
  19. rpc RemoveNode(RemoveNodeRequest) returns (RemoveNodeResponse) {
  20. option (docker.protobuf.plugin.tls_authorization) = { roles: "swarm-manager" };
  21. };
  22. rpc GetTask(GetTaskRequest) returns (GetTaskResponse) {
  23. option (docker.protobuf.plugin.tls_authorization) = { roles: "swarm-manager" };
  24. };
  25. rpc ListTasks(ListTasksRequest) returns (ListTasksResponse) {
  26. option (docker.protobuf.plugin.tls_authorization) = { roles: "swarm-manager" };
  27. };
  28. rpc RemoveTask(RemoveTaskRequest) returns (RemoveTaskResponse) {
  29. option (docker.protobuf.plugin.tls_authorization) = { roles: "swarm-manager" };
  30. };
  31. rpc GetService(GetServiceRequest) returns (GetServiceResponse) {
  32. option (docker.protobuf.plugin.tls_authorization) = { roles: "swarm-manager" };
  33. };
  34. rpc ListServices(ListServicesRequest) returns (ListServicesResponse) {
  35. option (docker.protobuf.plugin.tls_authorization) = { roles: "swarm-manager" };
  36. };
  37. rpc CreateService(CreateServiceRequest) returns (CreateServiceResponse) {
  38. option (docker.protobuf.plugin.tls_authorization) = { roles: "swarm-manager" };
  39. };
  40. rpc UpdateService(UpdateServiceRequest) returns (UpdateServiceResponse) {
  41. option (docker.protobuf.plugin.tls_authorization) = { roles: "swarm-manager" };
  42. };
  43. rpc RemoveService(RemoveServiceRequest) returns (RemoveServiceResponse) {
  44. option (docker.protobuf.plugin.tls_authorization) = { roles: "swarm-manager" };
  45. };
  46. rpc GetNetwork(GetNetworkRequest) returns (GetNetworkResponse) {
  47. option (docker.protobuf.plugin.tls_authorization) = { roles: "swarm-manager" };
  48. };
  49. rpc ListNetworks(ListNetworksRequest) returns (ListNetworksResponse) {
  50. option (docker.protobuf.plugin.tls_authorization) = { roles: "swarm-manager" };
  51. };
  52. rpc CreateNetwork(CreateNetworkRequest) returns (CreateNetworkResponse) {
  53. option (docker.protobuf.plugin.tls_authorization) = { roles: "swarm-manager" };
  54. };
  55. rpc RemoveNetwork(RemoveNetworkRequest) returns (RemoveNetworkResponse) {
  56. option (docker.protobuf.plugin.tls_authorization) = { roles: "swarm-manager" };
  57. };
  58. rpc GetCluster(GetClusterRequest) returns (GetClusterResponse) {
  59. option (docker.protobuf.plugin.tls_authorization) = { roles: "swarm-manager" };
  60. };
  61. rpc ListClusters(ListClustersRequest) returns (ListClustersResponse) {
  62. option (docker.protobuf.plugin.tls_authorization) = { roles: "swarm-manager" };
  63. };
  64. rpc UpdateCluster(UpdateClusterRequest) returns (UpdateClusterResponse) {
  65. option (docker.protobuf.plugin.tls_authorization) = { roles: "swarm-manager" };
  66. };
  67. // --- secret APIs ---
  68. // GetSecret returns a `GetSecretResponse` with a `Secret` with the same
  69. // id as `GetSecretRequest.SecretID`
  70. // - Returns `NotFound` if the Secret with the given id is not found.
  71. // - Returns `InvalidArgument` if the `GetSecretRequest.SecretID` is empty.
  72. // - Returns an error if getting fails.
  73. rpc GetSecret(GetSecretRequest) returns (GetSecretResponse) {
  74. option (docker.protobuf.plugin.tls_authorization) = { roles: "swarm-manager" };
  75. }
  76. // UpdateSecret returns a `UpdateSecretResponse` with a `Secret` with the same
  77. // id as `GetSecretRequest.SecretID`
  78. // - Returns `NotFound` if the Secret with the given id is not found.
  79. // - Returns `InvalidArgument` if the `GetSecretRequest.SecretID` is empty.
  80. // - Returns an error if updating fails.
  81. rpc UpdateSecret(UpdateSecretRequest) returns (UpdateSecretResponse) {
  82. option (docker.protobuf.plugin.tls_authorization) = { roles: "swarm-manager" };
  83. };
  84. // ListSecrets returns a `ListSecretResponse` with a list all non-internal `Secret`s being
  85. // managed, or all secrets matching any name in `ListSecretsRequest.Names`, any
  86. // name prefix in `ListSecretsRequest.NamePrefixes`, any id in
  87. // `ListSecretsRequest.SecretIDs`, or any id prefix in `ListSecretsRequest.IDPrefixes`.
  88. // - Returns an error if listing fails.
  89. rpc ListSecrets(ListSecretsRequest) returns (ListSecretsResponse) {
  90. option (docker.protobuf.plugin.tls_authorization) = { roles: "swarm-manager" };
  91. }
  92. // CreateSecret creates and return a `CreateSecretResponse` with a `Secret` based
  93. // on the provided `CreateSecretRequest.SecretSpec`.
  94. // - Returns `InvalidArgument` if the `CreateSecretRequest.SecretSpec` is malformed,
  95. // or if the secret data is too long or contains invalid characters.
  96. // - Returns an error if the creation fails.
  97. rpc CreateSecret(CreateSecretRequest) returns (CreateSecretResponse) {
  98. option (docker.protobuf.plugin.tls_authorization) = { roles: "swarm-manager" };
  99. }
  100. // RemoveSecret removes the secret referenced by `RemoveSecretRequest.ID`.
  101. // - Returns `InvalidArgument` if `RemoveSecretRequest.ID` is empty.
  102. // - Returns `NotFound` if the a secret named `RemoveSecretRequest.ID` is not found.
  103. // - Returns an error if the deletion fails.
  104. rpc RemoveSecret(RemoveSecretRequest) returns (RemoveSecretResponse) {
  105. option (docker.protobuf.plugin.tls_authorization) = { roles: "swarm-manager" };
  106. }
  107. }
  108. message GetNodeRequest {
  109. string node_id = 1;
  110. }
  111. message GetNodeResponse {
  112. Node node = 1;
  113. }
  114. message ListNodesRequest {
  115. message Filters {
  116. repeated string names = 1;
  117. repeated string id_prefixes = 2;
  118. map<string, string> labels = 3;
  119. repeated NodeSpec.Membership memberships = 4;
  120. repeated NodeRole roles = 5;
  121. // NamePrefixes matches all objects with the given prefixes
  122. repeated string name_prefixes = 6;
  123. }
  124. Filters filters = 1;
  125. }
  126. message ListNodesResponse {
  127. repeated Node nodes = 1;
  128. }
  129. // UpdateNodeRequest requests an update to the specified node. This may be used
  130. // to request a new availability for a node, such as PAUSE. Invalid updates
  131. // will be denied and cause an error.
  132. message UpdateNodeRequest {
  133. string node_id = 1;
  134. Version node_version = 2;
  135. NodeSpec spec = 3;
  136. }
  137. message UpdateNodeResponse {
  138. Node node = 1;
  139. }
  140. // RemoveNodeRequest requests to delete the specified node from store.
  141. message RemoveNodeRequest {
  142. string node_id = 1;
  143. bool force = 2;
  144. }
  145. message RemoveNodeResponse {
  146. }
  147. message GetTaskRequest {
  148. string task_id = 1;
  149. }
  150. message GetTaskResponse {
  151. Task task = 1;
  152. }
  153. message RemoveTaskRequest {
  154. string task_id = 1;
  155. }
  156. message RemoveTaskResponse {
  157. }
  158. message ListTasksRequest {
  159. message Filters {
  160. repeated string names = 1;
  161. repeated string id_prefixes = 2;
  162. map<string, string> labels = 3;
  163. repeated string service_ids = 4;
  164. repeated string node_ids = 5;
  165. repeated docker.swarmkit.v1.TaskState desired_states = 6;
  166. // NamePrefixes matches all objects with the given prefixes
  167. repeated string name_prefixes = 7;
  168. repeated string runtimes = 9;
  169. // UpToDate matches tasks that are consistent with the current
  170. // service definition.
  171. // Note: this is intended for internal status reporting rather
  172. // than being exposed to users. It may be removed in the future.
  173. bool up_to_date = 8;
  174. }
  175. Filters filters = 1;
  176. }
  177. message ListTasksResponse {
  178. repeated Task tasks = 1;
  179. }
  180. message CreateServiceRequest {
  181. ServiceSpec spec = 1;
  182. }
  183. message CreateServiceResponse {
  184. Service service = 1;
  185. }
  186. message GetServiceRequest {
  187. string service_id = 1;
  188. bool insert_defaults = 2;
  189. }
  190. message GetServiceResponse {
  191. Service service = 1;
  192. }
  193. message UpdateServiceRequest {
  194. string service_id = 1;
  195. Version service_version = 2;
  196. ServiceSpec spec = 3;
  197. enum Rollback {
  198. // This is not a rollback. The spec field of the request will
  199. // be honored.
  200. NONE = 0;
  201. // Roll back the service - get spec from the service's
  202. // previous_spec.
  203. PREVIOUS = 1;
  204. }
  205. // Rollback may be set to PREVIOUS to request a rollback (the service's
  206. // spec will be set to the value of its previous_spec field). In this
  207. // case, the spec field of this request is ignored.
  208. Rollback rollback = 4;
  209. }
  210. message UpdateServiceResponse {
  211. Service service = 1;
  212. }
  213. message RemoveServiceRequest {
  214. string service_id = 1;
  215. }
  216. message RemoveServiceResponse {
  217. }
  218. message ListServicesRequest {
  219. message Filters {
  220. repeated string names = 1;
  221. repeated string id_prefixes = 2;
  222. map<string, string> labels = 3;
  223. // NamePrefixes matches all objects with the given prefixes
  224. repeated string name_prefixes = 4;
  225. repeated string runtimes = 5;
  226. }
  227. Filters filters = 1;
  228. }
  229. message ListServicesResponse {
  230. repeated Service services = 1;
  231. }
  232. message CreateNetworkRequest {
  233. NetworkSpec spec = 1;
  234. }
  235. message CreateNetworkResponse {
  236. Network network = 1;
  237. }
  238. message GetNetworkRequest {
  239. string name = 1;
  240. string network_id = 2;
  241. }
  242. message GetNetworkResponse {
  243. Network network = 1;
  244. }
  245. message RemoveNetworkRequest {
  246. string name = 1;
  247. string network_id = 2;
  248. }
  249. message RemoveNetworkResponse {}
  250. message ListNetworksRequest {
  251. message Filters {
  252. repeated string names = 1;
  253. repeated string id_prefixes = 2;
  254. map<string, string> labels = 3;
  255. // NamePrefixes matches all objects with the given prefixes
  256. repeated string name_prefixes = 4;
  257. }
  258. Filters filters = 1;
  259. }
  260. message ListNetworksResponse {
  261. repeated Network networks = 1;
  262. }
  263. message GetClusterRequest {
  264. string cluster_id = 1;
  265. }
  266. message GetClusterResponse {
  267. Cluster cluster = 1;
  268. }
  269. message ListClustersRequest {
  270. message Filters {
  271. repeated string names = 1;
  272. repeated string id_prefixes = 2;
  273. map<string, string> labels = 3;
  274. // NamePrefixes matches all objects with the given prefixes
  275. repeated string name_prefixes = 4;
  276. }
  277. Filters filters = 1;
  278. }
  279. message ListClustersResponse {
  280. repeated Cluster clusters = 1;
  281. }
  282. // KeyRotation tells UpdateCluster what items to rotate
  283. message KeyRotation {
  284. // WorkerJoinToken tells UpdateCluster to rotate the worker secret token.
  285. bool worker_join_token = 1;
  286. // ManagerJoinToken tells UpdateCluster to rotate the manager secret token.
  287. bool manager_join_token = 2;
  288. // ManagerUnlockKey tells UpdateCluster to rotate the manager unlock key
  289. bool manager_unlock_key = 3;
  290. }
  291. message UpdateClusterRequest {
  292. // ClusterID is the cluster ID to update.
  293. string cluster_id = 1;
  294. // ClusterVersion is the version of the cluster being updated.
  295. Version cluster_version = 2;
  296. // Spec is the new spec to apply to the cluster.
  297. ClusterSpec spec = 3;
  298. // Rotation contains flags for join token and unlock key rotation
  299. KeyRotation rotation = 4 [(gogoproto.nullable) = false];
  300. }
  301. message UpdateClusterResponse {
  302. Cluster cluster = 1;
  303. }
  304. // GetSecretRequest is the request to get a `Secret` object given a secret id.
  305. message GetSecretRequest {
  306. string secret_id = 1;
  307. }
  308. // GetSecretResponse contains the Secret corresponding to the id in
  309. // `GetSecretRequest`, but the `Secret.Spec.Data` field in each `Secret`
  310. // object should be nil instead of actually containing the secret bytes.
  311. message GetSecretResponse {
  312. Secret secret = 1;
  313. }
  314. message UpdateSecretRequest {
  315. // SecretID is the secret ID to update.
  316. string secret_id = 1;
  317. // SecretVersion is the version of the secret being updated.
  318. Version secret_version = 2;
  319. // Spec is the new spec to apply to the Secret
  320. // Only some fields are allowed to be updated.
  321. SecretSpec spec = 3;
  322. }
  323. message UpdateSecretResponse {
  324. Secret secret = 1;
  325. }
  326. // ListSecretRequest is the request to list all non-internal secrets in the secret store,
  327. // or all secrets filtered by (name or name prefix or id prefix) and labels.
  328. message ListSecretsRequest {
  329. message Filters {
  330. repeated string names = 1;
  331. repeated string id_prefixes = 2;
  332. map<string, string> labels = 3;
  333. repeated string name_prefixes = 4;
  334. }
  335. Filters filters = 1;
  336. }
  337. // ListSecretResponse contains a list of all the secrets that match the name or
  338. // name prefix filters provided in `ListSecretRequest`. The `Secret.Spec.Data`
  339. // field in each `Secret` object should be nil instead of actually containing
  340. // the secret bytes.
  341. message ListSecretsResponse {
  342. repeated Secret secrets = 1;
  343. }
  344. // CreateSecretRequest specifies a new secret (it will not update an existing
  345. // secret) to create.
  346. message CreateSecretRequest {
  347. SecretSpec spec = 1;
  348. }
  349. // CreateSecretResponse contains the newly created `Secret`` corresponding to the
  350. // name in `CreateSecretRequest`. The `Secret.Spec.Data` field should be nil instead
  351. // of actually containing the secret bytes.
  352. message CreateSecretResponse {
  353. Secret secret = 1;
  354. }
  355. // RemoveSecretRequest contains the ID of the secret that should be removed. This
  356. // removes all versions of the secret.
  357. message RemoveSecretRequest {
  358. string secret_id = 1;
  359. }
  360. // RemoveSecretResponse is an empty object indicating the successful removal of
  361. // a secret.
  362. message RemoveSecretResponse {}