Skip to content

Commit 214e6a0

Browse files
authored
Merge pull request #21 from Project-MONAI/whoisj/server-api
server-api: Initial MONAID Server API
2 parents eb25e18 + e748ecb commit 214e6a0

7 files changed

Lines changed: 1727 additions & 0 deletions

File tree

server-api/grpc/common.proto

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
syntax = "proto3";
2+
3+
package monai.deploy.platform;
4+
5+
option csharp_namespace = "Monai.Deploy.Platform.Grpc";
6+
option go_package = "monaid.grpc";
7+
option java_package = "com.monai.depoly.platform.grpc";
8+
9+
import public "error-code.proto";
10+
11+
// 128-bit unique identifier (UUID).
12+
message Identifier {
13+
// Expected to be an array of 16 bytes.
14+
bytes data = 1;
15+
}
16+
17+
message HistoricalEvent {
18+
// Timestamp of when the event occurred.
19+
Timestamp timestamp = 1;
20+
21+
// Unique identifier of the user who caused the event.
22+
// No value is provided when the event was the result of a non-user action.
23+
Identifier user_id = 2;
24+
25+
// Description of the event.
26+
// Maximum allowed size for an event description is 4096 bytes (4 KiB).
27+
string description = 3;
28+
}
29+
30+
// Version information structure.
31+
message Version {
32+
// Version for incompatible API changes.
33+
int32 major = 1;
34+
35+
// Version for added functionality in a backwards compatible manner.
36+
int32 minor = 2;
37+
38+
// Version for backwards compatible bug fixes.
39+
int32 patch = 3;
40+
41+
// Additional labels for pre-release and build metadata are available as extensions to the MAJOR.MINOR.PATCH format.
42+
// Maximum allowed size of a version label is 128 bytes.
43+
string label = 4;
44+
}
45+
46+
// Standard header expected to be attached to all requests.
47+
message RequestHeader {
48+
// Version of the API expected to handle the request.
49+
Version api_version = 1;
50+
51+
// Name of the agent interacting with the server.
52+
// Maxium allowed size for a user-agent is 512 bytes.
53+
string user_agent = 2;
54+
55+
// Authentication header for the request.
56+
// Maximum allowed size is 14360576 bytes (1 MiB).
57+
string authentication = 3;
58+
}
59+
60+
// Return value of most API calls, specifies success or failure.
61+
message ResponseHeader {
62+
// Version of the API which handled the request.
63+
Version api_version = 1;
64+
65+
// The name / identifier of the server.
66+
// Maximum allowed size of the server identier is 512 bytes.
67+
string server = 2;
68+
69+
// The response or "error" code of the request.
70+
// Zero (0) indicates the request was successful.
71+
ErrorCode code = 3;
72+
73+
// When returned, URI the client can use to authenticate itself.
74+
string authenticateUri = 4;
75+
76+
// When returned, URI the client can use to get more information.
77+
string redirectUri = 5;
78+
79+
// Optional message(s) returned with the result.
80+
// Maximum allowed size is 262144 bytes (256 KiB) per message, and 2097152 bytes (2 MiB) total.
81+
repeated string messages = 6;
82+
}
83+
84+
// Timestamp type
85+
message Timestamp {
86+
// The number of milliseconds before or after 0001-01-01 00:00:00.000Z.
87+
sint64 value = 1;
88+
}

server-api/grpc/error-code.proto

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
syntax = "proto3";
2+
3+
package monai.deploy.platform;
4+
5+
option csharp_namespace = "Monai.Deploy.Platform.Grpc";
6+
option go_package = "monaid.grpc";
7+
option java_package = "com.monai.deploy.platform.grpc";
8+
9+
enum ErrorCode {
10+
// Request was successful.
11+
ERROR_SUCCESS = 0;
12+
13+
// Request was malformed, or otherwise invalid.
14+
ERROR_BAD_REQUEST = 1;
15+
// Request authoriztion was malformed.
16+
ERROR_AUTHORIZATION_INVALID = 2;
17+
// Request user-agent was malformed.
18+
ERROR_USER_AGENT_INVALID = 3;
19+
// Request api-version was malformed.
20+
ERROR_VERSION_INVALID = 4;
21+
// Request api-version is unsupported.
22+
ERROR_VERSION_UNSUPPORTED = 5;
23+
24+
// General authentication error occurred.
25+
ERROR_AUTHENTICATION = 1001;
26+
// Request is unauthorized.
27+
ERROR_UNAUTHORIZED = 1002;
28+
// User lacks sufficient privileges.
29+
ERROR_UNPRIVILEGED = 1003;
30+
31+
// Authority is unavaialble.
32+
ERROR_AUTHORITY_UNAVAILABLE = 2001;
33+
// Kubernetes is unvailable.
34+
ERROR_CLUSTER_UNAVAILABLE = 2002;
35+
// Database is unavailble.
36+
ERROR_DATABASE_UNAVAILABLE = 2003;
37+
// Network is unavailable.
38+
ERROR_NETWORK_UNAVAILABLE = 2004;
39+
// Storage is unavailable or exhausted.
40+
ERROR_STORAGE_UNAVAILABLE = 2005;
41+
// Request timed out.
42+
ERROR_REQUEST_TIMED_OUT = 2006;
43+
// General internal error occurred.
44+
ERROR_UNHANDLED = 2007;
45+
46+
// Generic job error occured.
47+
ERROR_JOB = 4001;
48+
// Job has been cancelled.
49+
// Cannot cancel a job more than once.
50+
// Cannot download from a cancelled job.
51+
ERROR_JOB_CANCELED = 4002;
52+
// Requested job has been deleted.
53+
ERROR_JOB_DELETED = 4003;
54+
// Provided job identifier is invalid.
55+
ERROR_JOB_ID_INVALID = 4004;
56+
// Provided job identifier is not associated with any known job.
57+
ERROR_JOB_ID_UNKNOWN = 4005;
58+
// Request job logs are currently unavailable.
59+
ERROR_JOB_LOGS_UNAVAILBLE = 4006;
60+
// Provided job-priority is invalid.
61+
ERROR_JOB_PRIORITY_INVALID = 4007;
62+
// Provided job-state is invalid.
63+
ERROR_JOB_STATE_INVALID = 4008;
64+
// Requested job has already stopped and cannot be cancelled.
65+
ERROR_JOB_STOPPED = 4009;
66+
// Unable to create job due to insufficient available resources.
67+
ERROR_JOB_UNSCHEDULABLE = 4010;
68+
// Requested job is unavailable.
69+
ERROR_JOB_UNAVAILABLE = 4011;
70+
71+
// Generic MAP error occurred.
72+
ERROR_MAP = 5001;
73+
// Requested MAP has been deleted.
74+
ERROR_MAP_DELETED = 5002;
75+
// Provided MAP identifier is invalid.
76+
ERROR_MAP_ID_INVALID = 5003;
77+
// Provided MAP identifier is not assocaiated with any known MAP.
78+
ERROR_MAP_ID_UNKNOWN = 5004;
79+
// Provided MAP reference name already exists.
80+
// If the intent is to move the reference name to the new MAP, set take_reference_name = true.
81+
ERROR_MAP_NAME_DUPLICATE = 5005;
82+
// Provided MAP reference name is invalid.
83+
ERROR_MAP_NAME_INVALID = 5006;
84+
// Provided MAP reference name is not associated with any known MAP.
85+
ERROR_MAP_NAME_UNKNOWN = 5007;
86+
// Provided MAP state is invalid.
87+
ERROR_MAP_STATE_INVALID = 5008;
88+
// Provided MAP URN is already associated with a known MAP.
89+
ERROR_MAP_URN_DUPLICATE = 5009;
90+
// Provided MAP URN is invalid.
91+
ERROR_MAP_URN_INVALID = 5010;
92+
// Requested MAP is unavailable.
93+
ERROR_MAP_UNAVAILABLE = 5011;
94+
95+
ERROR_PAYLOAD = 6001;
96+
// Requested payload has been deleted.
97+
ERROR_PAYLOAD_DELETED = 6002;
98+
// Payloads associated with pending or running jobs, or which have reference names cannot be deleted.
99+
ERROR_PAYLOAD_IN_USE = 6003;
100+
// Provided blob path is invalid.
101+
ERROR_PAYLOAD_BLOB_PATH_INVALID = 6004;
102+
// Provided blob path is not associated with any known payload blob.
103+
ERROR_PAYLOAD_BLOB_PATH_UNKNOWN = 6005;
104+
// Provided blob mode is invalid.
105+
ERROR_PAYLOAD_BLOB_MODE_INVALID = 6006;
106+
// Creation of empty payload blobs is not supported.
107+
ERROR_PAYLOAB_BLOB_EMPTY = 6007;
108+
// Provided payload identifier is invalid.
109+
ERROR_PAYLOAD_ID_INVALID = 6008;
110+
// Provided payload identifier is not assocaiated with any known payload.
111+
ERROR_PAYLOAD_ID_UNKNOWN = 6009;
112+
// Payloads associated with pending, running, or completed jobs cannot be modified.
113+
// Blobs cannot be added or removed from the payload.
114+
ERROR_PAYLOAD_IMMUTABLE = 6010;
115+
// Provided payload reference name already exists.
116+
// If the intent is to move the reference name to the new MAP, set take_reference_name = true.
117+
ERROR_PAYLOAD_NAME_DUPLICATE = 6011;
118+
// Provided payload reference name is invalid.
119+
ERROR_PAYLOAD_NAME_INVALID = 6012;
120+
// Provided payload reference name is not associated with any known payload.
121+
ERROR_PAYLOAD_NAME_UNKNOWN = 6013;
122+
// Requested payload is unavailable.
123+
ERROR_PAYLOAD_UNAVAILBLE = 6014;
124+
125+
// Generic user error occurred.
126+
ERROR_USER = 7001;
127+
// Provided user identifier is invalid.
128+
ERROR_USER_ID_INVALID = 7002;
129+
// Provided user identifer not associated with any known user.
130+
ERROR_USER_ID_UNKNOWN = 7003;
131+
}

0 commit comments

Comments
 (0)