account.proto 1.27 KB
Newer Older
Wei Shoulin's avatar
Wei Shoulin committed
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
syntax = "proto3";


package dfs.common.account;
option go_package = "cnlab.net/csst/proto/common/account";

service Account {
	rpc Read(ReadRequest) returns (ReadResponse) {}
	rpc Create(CreateRequest) returns (CreateResponse) {}
	rpc Update(UpdateRequest) returns (UpdateResponse) {}
	rpc Delete(DeleteRequest) returns (DeleteResponse) {}
	rpc Search(SearchRequest) returns (SearchResponse) {}
}

message Record {
	// uuid
	string id = 1;
	// service or user
	string type = 2;
	// service name, username, etc
	string client_id = 3;
	// we leave this blank in responses
	// used for update and create
	string client_secret = 4;
	map<string,string> metadata = 5;
	// unix timestamp
	int64 created = 6;
	// unix timestamp
	int64 updated = 7;
}

message ReadRequest {
	string id = 1;
}

message ReadResponse {
	Record account = 1;
}

message CreateRequest {
	// If id is blank, one will be generated
	Record account = 1;
}

message CreateResponse {
}

message UpdateRequest {
	// Id and client_id cannot be changed
	Record account = 1;
}

message UpdateResponse {
}

message DeleteRequest {
	string id = 1;
}

message DeleteResponse {
}

message SearchRequest {
	string client_id = 1;
	string type = 2;
	int64 limit = 3;
	int64 offset = 4;
}

message SearchResponse {
	repeated Record accounts = 1;
}