This repository has been archived by the owner on Jun 24, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathcontacts.proto
346 lines (286 loc) · 8.1 KB
/
contacts.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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
syntax = "proto3";
package api.contacts;
import "google/protobuf/field_mask.proto";
import "google/api/annotations.proto";
import "github.com/lyft/protoc-gen-validate/validate/validate.proto";
import "protoc-gen-swagger/options/annotations.proto";
import "github.com/infobloxopen/protoc-gen-gorm/options/gorm.proto";
import "github.com/infobloxopen/protoc-gen-gorm/types/types.proto";
import "github.com/infobloxopen/atlas-app-toolkit/query/collection_operators.proto";
import "github.com/infobloxopen/atlas-app-toolkit/rpc/resource/resource.proto";
option go_package = "github.com/infobloxopen/atlas-contacts-app/pkg/pb;pb";
message Profile {
option (gorm.opts) = {
ormable: true,
multi_account: true
};
atlas.rpc.Identifier id = 1 [(gorm.field).tag = {type: "serial" primary_key: true}];
string name = 2;
string notes = 3;
repeated Contact contacts = 4;
repeated Group groups = 5;
}
message CreateProfileRequest {
Profile payload = 1;
}
message CreateProfileResponse {
Profile result = 1;
}
message ReadProfileRequest {
atlas.rpc.Identifier id = 1;
}
message ReadProfileResponse {
Profile result = 1;
}
message UpdateProfileRequest {
Profile payload = 1;
}
message UpdateProfileResponse {
Profile result = 1;
}
message DeleteProfileRequest {
atlas.rpc.Identifier id = 1;
}
message DeleteProfileResponse{}
message ListProfileRequest {
infoblox.api.Filtering filter = 1;
infoblox.api.Sorting order_by = 2;
infoblox.api.FieldSelection fields = 3;
infoblox.api.Pagination paging = 4;
}
message ListProfilesResponse {
repeated Profile results = 1;
}
service Profiles {
option (gorm.server).autogen = true;
rpc Create (CreateProfileRequest) returns (CreateProfileResponse) {
option (google.api.http) = {
post: "/profiles"
body: "payload"
};
}
rpc Read (ReadProfileRequest) returns (ReadProfileResponse) {
option (google.api.http) = {
get: "/profiles/{id.resource_id}"
};
}
rpc Update (UpdateProfileRequest) returns (UpdateProfileResponse) {
option (google.api.http) = {
put: "/profiles/{payload.id.resource_id}"
body: "payload"
};
}
rpc Delete (DeleteProfileRequest) returns (DeleteProfileResponse) {
option (google.api.http) = {
delete: "/profiles/{id.resource_id}"
};
option (gorm.method).object_type = "Profile";
}
rpc List (ListProfileRequest) returns (ListProfilesResponse) {
option (google.api.http) = {
get: "/profiles"
};
}
}
message Group {
option (gorm.opts) = {
ormable: true,
multi_account: true
};
atlas.rpc.Identifier id = 1 [(gorm.field).tag = {type: "serial" primary_key: true}];
string name = 2;
string notes = 3;
atlas.rpc.Identifier profile_id = 4;
repeated Contact contacts = 5 [(gorm.field).many_to_many = {}];
}
message CreateGroupRequest {
Group payload = 1;
}
message CreateGroupResponse {
Group result = 1;
}
message ReadGroupRequest {
atlas.rpc.Identifier id = 1;
}
message ReadGroupResponse {
Group result = 1;
}
message UpdateGroupRequest {
Group payload = 1;
}
message UpdateGroupResponse {
Group result = 1;
}
message DeleteGroupRequest {
atlas.rpc.Identifier id = 1;
}
message DeleteGroupResponse {}
message ListGroupRequest {
infoblox.api.Filtering filter = 1;
infoblox.api.Sorting order_by = 2;
infoblox.api.FieldSelection fields = 3;
infoblox.api.Pagination paging = 4;
}
message ListGroupsResponse {
repeated Group results = 1;
}
service Groups {
option (gorm.server).autogen = true;
rpc Create (CreateGroupRequest) returns (CreateGroupResponse) {
option (google.api.http) = {
post: "/groups"
body: "payload"
};
}
rpc Read (ReadGroupRequest) returns (ReadGroupResponse) {
option (google.api.http) = {
get: "/groups/{id.resource_id}"
};
}
rpc Update (UpdateGroupRequest) returns (UpdateGroupResponse) {
option (google.api.http) = {
put: "/groups/{payload.id.resource_id}"
body: "payload"
};
}
rpc Delete (DeleteGroupRequest) returns (DeleteGroupResponse) {
option (google.api.http) = {
delete: "/groups/{id.resource_id}"
};
option (gorm.method).object_type = "Group";
}
rpc List (ListGroupRequest) returns (ListGroupsResponse) {
option (google.api.http) = {
get: "/groups"
};
}
}
message Contact {
option (gorm.opts) = {
ormable: true,
multi_account: true
};
atlas.rpc.Identifier id = 1 [(gorm.field).tag = {type: "serial" primary_key: true}];
string first_name = 2;
string middle_name = 3;
string last_name = 4;
string primary_email = 5 [(gorm.field).drop = true, (validate.rules).string.email = true];
string notes = 6;
repeated Email emails = 7;
Address home_address = 8;
Address work_address = 9;
atlas.rpc.Identifier profile_id = 10;
repeated Group groups = 11 [(gorm.field).many_to_many = {jointable: "group_contacts"}];
// nicknames is arbitrary json, but should be used for a list of strings
gorm.types.JSONValue nicknames = 12;
}
message Email {
option (gorm.opts) = {
ormable: true,
multi_account: true,
include: [
{type: "*bool", name: "is_primary"}]
};
uint64 id = 1;
string address = 2 [(gorm.field).tag.unique = true, (validate.rules).string.email = true];
}
message Address {
option (gorm.opts) = {
ormable: true,
multi_account: true
};
string address = 1;
string city = 2;
string state = 3;
string zip = 4;
string country = 5;
}
message CreateContactRequest {
Contact payload = 1;
}
message CreateContactResponse {
Contact result = 1;
}
message ReadContactRequest {
atlas.rpc.Identifier id = 1;
}
message ReadContactResponse {
Contact result = 1;
}
message UpdateContactRequest {
Contact payload = 1;
google.protobuf.FieldMask fields = 2;
}
message UpdateContactResponse {
Contact result = 1;
}
message DeleteContactRequest {
atlas.rpc.Identifier id = 1;
}
message DeleteContactResponse {}
message ListContactsResponse {
repeated Contact results = 1;
}
message SMSRequest {
uint64 id = 1;
string message = 2;
}
message SMSResponse {}
message ListContactRequest {
infoblox.api.Filtering filter = 1;
infoblox.api.Sorting order_by = 2;
infoblox.api.FieldSelection fields = 3;
infoblox.api.Pagination paging = 4;
}
service Contacts {
option (gorm.server).autogen = true;
rpc Create (CreateContactRequest) returns (CreateContactResponse) {
option (google.api.http) = {
post: "/contacts"
body: "payload"
};
}
rpc Read (ReadContactRequest) returns (ReadContactResponse) {
option (google.api.http) = {
get: "/contacts/{id.resource_id}"
};
}
rpc Update (UpdateContactRequest) returns (UpdateContactResponse) {
option (google.api.http) = {
put: "/contacts/{payload.id.resource_id}"
body: "payload"
};
}
rpc Delete (DeleteContactRequest) returns (DeleteContactResponse) {
option (google.api.http) = {
delete: "/contacts/{id.resource_id}"
};
option (gorm.method).object_type = "Contact";
}
rpc List (ListContactRequest) returns (ListContactsResponse) {
option (google.api.http) = {
get: "/contacts"
};
}
rpc SendSMS (SMSRequest) returns (SMSResponse) {
option (google.api.http) = {
post: "/contacts/{id}/sms"
body: "*"
};
}
}
option (grpc.gateway.protoc_gen_swagger.options.openapiv2_swagger) = {
info: {
title: "Contacts";
version: "1.0";
contact: {
name: "John Belamaric";
url: "https://github.com/infobloxopen/atlas-contacts-app";
email: "jbelamaric@infoblox.com";
};
};
schemes: HTTP;
schemes: HTTPS;
consumes: "application/json";
produces: "application/json";
};