-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.proto
148 lines (138 loc) · 5.38 KB
/
app.proto
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
syntax = "proto3";
package begonia.org.sdk;
option go_package = "github.com/begonia-org/go-sdk/api/v1";
import "google/protobuf/descriptor.proto";
import "google/protobuf/timestamp.proto";
import "google/protobuf/field_mask.proto";
import "google/api/annotations.proto";
import "begonia/api/v1/options.proto";
enum APPStatus{
APP_ENABLED = 0;
APP_DISABLED = 1;
}
enum APPPremission{
APP_READ = 0;
APP_WRITE = 1;
APP_DELETE = 2;
APP_ALL = 3;
}
enum APPSvrCode{
APP_UNKNOWN = 0;
APP_CREATE_ERR=5101[(.begonia.api.v1.msg) = "create app error"];
APP_DUPLICATE_ERR=5102[(.begonia.api.v1.msg) = "duplicate app name"];
APP_SIGNATURE_ERR=5103[(.begonia.api.v1.msg) = "app signature error"];
APP_REQUEST_EXPIRED_ERR=5104[(.begonia.api.v1.msg) = "request expired"];
APP_ACCESS_KEY_MISSING_ERR=5105[(.begonia.api.v1.msg) = "missing access key"];
APP_AUTH_MISSING_ERR=5106[(.begonia.api.v1.msg) = "missing auth"];
APP_XDATE_MISSING_ERR=5107[(.begonia.api.v1.msg) = "missing x-date"];
APP_NOT_FOUND_ERR=5108[(.begonia.api.v1.msg) = "app not found"];
}
message Apps{
// @gotags: doc:"历史ID" gorm:"primaryKey;autoIncrement;comment:自增id"
int64 id = 1;
// @gotags: json:"name" ondeleted:"rename" gorm:"column:name;type:varchar(128);not null;unique;comment:app服务名称"
string name = 2;
// @gotags: json:"description" gorm:"column:description;type:varchar(256);comment:app描述服务"
string description = 3;
// @gotags: json:"status" gorm:"column:status;type:tinyint;comment:app服务状态"
APPStatus status = 4;
// @gotags: json:"appid" primary:"appid" gorm:"column:appid;type:varchar(64);not null;unique;comment:app服务id"
string appid = 5;
// @gotags: json:"access_key" gorm:"column:access_key;type:varchar(64);not null;unique;comment:app服务key"
string access_key = 6 [json_name="access_key"];
// @gotags json:"secret" gorm:"column:secret;type:varchar(64);unique;not null;comment:app服务secret"
string secret = 7;
// @gotags: json:"-" owner:"owner" gorm:"column:owner;not null;type:varchar(64);comment:app服务拥有者"
string owner = 8;
// @gotags: json:"permission" gorm:"column:permission;type:int;comment:app服务权限"
int32 permission = 11;
// @gotags: json:"is_deleted" gorm:"column:is_deleted;type:tinyint;comment:proto服务是否删除"
bool is_deleted=9 [json_name="is_deleted"];
// @gotags: json:"tags" gorm:"column:tags;type:json;serializer:json;comment:app服务标签"
repeated string tags = 10;
// @gotags: doc:"完成时间" gorm:"column:created_at;type:datetime;serializer:timepb;comment:定时任务的最近一次完成时间"
google.protobuf.Timestamp created_at = 12[json_name="created_at"];
// @gotags: doc:"更新时间" gorm:"column:updated_at;type:datetime;serializer:timepb;comment:定时任务的更新时间"
google.protobuf.Timestamp updated_at = 13[json_name="updated_at"];
// @gotags: gorm:"-" json:"-"
google.protobuf.FieldMask update_mask = 18[json_name="update_mask"];
}
message CreateAppRequest{
// @gotags: json:"name" gorm:"column:name;type:varchar(128);unique;comment:app名称"
string name = 1;
// @gotags: json:"description" gorm:"column:description;type:varchar(256);comment:app描述"
string description = 2;
// @gotags: json:"tags" gorm:"column:tags;type:json;comment:app服务标签"
repeated string tags = 8;
}
message AddAppResponse{
string appid = 1[json_name="appid"];
string access_key = 2[json_name="access_key"];
string secret = 3;
}
message DeleteAppRequest{
string appid = 1;
}
message DeleteAppResponse{
}
message AppsRequest {
string appid = 6 [json_name="appid",(.begonia.api.v1.un_updatable)=true];
// @gotags: json:"name" gorm:"column:name;type:varchar(128);unique;comment:app服务名称"
string name = 2;
// @gotags: json:"description" gorm:"column:description;type:varchar(256);comment:app描述服务"
string description = 3;
repeated string tags = 8;
google.protobuf.FieldMask update_mask = 18;
}
message GetAPPRequest{
// @gotags: json:"appid" gorm:"column:appid;type:varchar(64);unique;comment:app服务id"
string appid = 1;
}
message AppsListRequest{
// @gotags: json:"page" gorm:"column:page;type:int;comment:页码"
int32 page = 1;
// @gotags: json:"page_size" gorm:"column:page_size;type:int;comment:每页数量"
int32 page_size = 2;
repeated string tags = 3;
// // @gotags: json:"status" gorm:"column:status;type:tinyint;comment:app服务状态"
repeated APPStatus status = 8;
}
message AppsListResponse{
// @gotags: json:"apps"
repeated Apps apps = 1;
// @gotags: json:"total" gorm:"column:total;type:int;comment:总数"
int32 total = 2;
}
service AppsService {
option (.begonia.api.v1.auth_reqiured)=true;
option (.begonia.api.v1.http_response)="begonia.api.v1.HttpResponse";
// @gotags: doc:"添加app服务"
rpc Post(AppsRequest) returns (AddAppResponse){
option (google.api.http) = {
post: "/api/v1/apps"
body: "*"
};
};
rpc Update(AppsRequest) returns (Apps){
option (google.api.http) = {
put: "/api/v1/apps"
body: "*"
};
};
// @gotags: doc:"获取app服务"
rpc Get(GetAPPRequest) returns (Apps){
option (google.api.http) = {
get: "/api/v1/apps/{appid}"
};
};
rpc Delete(DeleteAppRequest) returns (DeleteAppResponse){
option (google.api.http) = {
delete: "/api/v1/apps/{appid}"
};
};
rpc List(AppsListRequest) returns (AppsListResponse){
option (google.api.http) = {
get: "/api/v1/apps"
};
};
}