-
Notifications
You must be signed in to change notification settings - Fork 0
/
system.proto
161 lines (153 loc) · 3.78 KB
/
system.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
149
150
151
152
153
154
155
156
157
158
159
160
161
syntax = "proto3";
package system.admin.v1;
import "google/api/annotations.proto";
import "google/api/field_behavior.proto";
import "google/protobuf/duration.proto";
import "google/protobuf/empty.proto";
import "google/protobuf/field_mask.proto";
import "google/protobuf/timestamp.proto";
import "google/protobuf/wrappers.proto";
import "google/rpc/status.proto";
import "protoc-gen-openapiv2/options/annotations.proto";
option go_package = "github.com/Joshua-FeatureFlag/proto/gen/go/system/admin/v1";
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = {
info: {
title: "FeatureFlag";
version: "1.0";
};
schemes: HTTP;
schemes: HTTPS;
consumes: "application/json";
produces: "application/json";
security_definitions: {
security: {
key: "BearerAuth";
value: {
type: TYPE_API_KEY;
name: "api_key";
in: IN_HEADER;
}
}
security: {
key: "OAuth2";
value: {
type: TYPE_OAUTH2;
flow: FLOW_ACCESS_CODE;
authorization_url: "https://example.com/oauth/authorize";
token_url: "https://example.com/oauth/token";
scopes: {
scope: {
key: "read";
value: "Grants read access";
}
scope: {
key: "write";
value: "Grants write access";
}
scope: {
key: "admin";
value: "Grants read and write access to administrative information";
}
}
}
}
}
security: {
security_requirement: {
key: "BearerAuth";
value: {};
}
}
security: {
security_requirement: {
key: "OAuth2";
value: {
scope: "read";
scope: "write";
}
}
security_requirement: {
key: "BearerAuth";
value: {};
}
}
responses: {
key: "403";
value: {description: "Returned when the user does not have permission to access the resource."}
}
responses: {
key: "404";
value: {
description: "Returned when the resource does not exist.";
schema: {
json_schema: {type: STRING}
}
}
}
};
message User {
int64 id = 1;
string name = 2;
int64 organization_id = 4;
}
message Organization {
int64 id = 1;
string name = 2;
repeated User users = 3;
}
service UserService {
rpc CreateUser (User) returns (User){
option (google.api.http) = {
post: "/v1/user/create"
body: "*"
};
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
security: {
security_requirement: {
key: "BearerAuth";
value: {}
}
}
};
};
rpc GetUser (User) returns (User){
option (google.api.http) = {
get: "/v1/user/{id}"
};
};
rpc UpdateUser (User) returns (User){
option (google.api.http) = {
put: "/v1/user/update"
body: "*"
};
};
rpc DeleteUser (User) returns (User){
option (google.api.http) = {
delete: "/v1/user/delete/{id}"
};
};
}
service OrganizationService {
rpc CreateOrganization (Organization) returns (Organization){
option (google.api.http) = {
post: "/v1/organization/create"
body: "*"
};
};
rpc GetOrganization (Organization) returns (Organization){
option (google.api.http) = {
get: "/v1/organization/get/{id}"
};
};
rpc UpdateOrganization (Organization) returns (Organization){
option (google.api.http) = {
put: "/v1/organization/update"
body: "*"
};
};
rpc DeleteOrganization (Organization) returns (Organization){
option (google.api.http) = {
delete: "/v1/organization/delete/{id}"
};
};
}