@routr/common 2.0.8-alpha.2 → 2.0.8-alpha.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (83) hide show
  1. package/dist/auth.d.ts +43 -4
  2. package/dist/auth.js +63 -1
  3. package/dist/connect/api/client.d.ts +3 -0
  4. package/dist/connect/api/client.js +158 -0
  5. package/dist/connect/api/index.d.ts +2 -0
  6. package/dist/connect/api/index.js +36 -0
  7. package/dist/connect/api/types.d.ts +51 -0
  8. package/dist/connect/api/types.js +2 -0
  9. package/dist/connect/assertions.d.ts +36 -0
  10. package/dist/connect/assertions.js +105 -0
  11. package/dist/connect/client.d.ts +8 -0
  12. package/dist/connect/{grpc_client.js → client.js} +44 -6
  13. package/dist/connect/config.d.ts +113 -0
  14. package/dist/connect/config.js +2 -0
  15. package/dist/connect/connect_error.d.ts +21 -0
  16. package/dist/connect/connect_error.js +44 -0
  17. package/dist/connect/index.d.ts +6 -2
  18. package/dist/connect/index.js +6 -2
  19. package/dist/connect/mappers/acl.d.ts +3 -0
  20. package/dist/connect/mappers/acl.js +19 -0
  21. package/dist/connect/mappers/agent.d.ts +3 -0
  22. package/dist/connect/mappers/agent.js +42 -0
  23. package/dist/connect/mappers/assertions.d.ts +3 -0
  24. package/dist/connect/mappers/assertions.js +43 -0
  25. package/dist/connect/mappers/credentials.d.ts +3 -0
  26. package/dist/connect/mappers/credentials.js +18 -0
  27. package/dist/connect/mappers/domain.d.ts +3 -0
  28. package/dist/connect/mappers/domain.js +19 -0
  29. package/dist/connect/mappers/index.d.ts +7 -0
  30. package/dist/connect/mappers/index.js +41 -0
  31. package/dist/connect/mappers/number.d.ts +3 -0
  32. package/dist/connect/mappers/number.js +26 -0
  33. package/dist/connect/mappers/peer.d.ts +3 -0
  34. package/dist/connect/mappers/peer.js +26 -0
  35. package/dist/connect/mappers/trunk.d.ts +3 -0
  36. package/dist/connect/mappers/trunk.js +34 -0
  37. package/dist/connect/protos/acl.proto +112 -0
  38. package/dist/connect/protos/agents.proto +153 -0
  39. package/dist/connect/protos/credentials.proto +114 -0
  40. package/dist/connect/protos/domains.proto +146 -0
  41. package/dist/connect/protos/numbers.proto +166 -0
  42. package/dist/connect/protos/peers.proto +174 -0
  43. package/dist/connect/protos/trunks.proto +178 -0
  44. package/dist/connect/schemas/acl.d.ts +66 -0
  45. package/dist/connect/schemas/acl.js +85 -0
  46. package/dist/connect/schemas/agent.d.ts +61 -0
  47. package/dist/connect/schemas/agent.js +80 -0
  48. package/dist/connect/schemas/crendentials.d.ts +59 -0
  49. package/dist/connect/schemas/crendentials.js +78 -0
  50. package/dist/connect/schemas/domain.d.ts +72 -0
  51. package/dist/connect/schemas/domain.js +91 -0
  52. package/dist/connect/schemas/index.d.ts +1 -0
  53. package/dist/connect/schemas/index.js +35 -0
  54. package/dist/connect/schemas/number.d.ts +81 -0
  55. package/dist/connect/schemas/number.js +100 -0
  56. package/dist/connect/schemas/peer.d.ts +84 -0
  57. package/dist/connect/schemas/peer.js +103 -0
  58. package/dist/connect/schemas/trunk.d.ts +125 -0
  59. package/dist/connect/schemas/trunk.js +157 -0
  60. package/dist/connect/schemas/validators.d.ts +2 -0
  61. package/dist/connect/schemas/validators.js +43 -0
  62. package/dist/connect/types.d.ts +91 -23
  63. package/dist/connect/types.js +17 -37
  64. package/dist/connect/validations.d.ts +42 -0
  65. package/dist/connect/validations.js +261 -0
  66. package/dist/errors.d.ts +35 -1
  67. package/dist/errors.js +51 -5
  68. package/dist/helper.d.ts +17 -4
  69. package/dist/helper.js +81 -7
  70. package/dist/index.d.ts +5 -4
  71. package/dist/index.js +5 -7
  72. package/dist/protos/common.proto +0 -2
  73. package/dist/protos/location.proto +22 -7
  74. package/dist/protos/sipmessage.proto +2 -0
  75. package/dist/service.d.ts +2 -2
  76. package/dist/service.js +1 -1
  77. package/dist/types.d.ts +53 -30
  78. package/dist/types.js +19 -11
  79. package/package.json +12 -5
  80. package/dist/connect/data_api.d.ts +0 -11
  81. package/dist/connect/data_api.js +0 -91
  82. package/dist/connect/grpc_client.d.ts +0 -1
  83. package/dist/protos/resources.proto +0 -108
package/dist/service.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { ObjectProto, ServiceInfo } from "./types";
2
- import { ServiceDefinitionNotFound } from "./errors";
2
+ import { ServiceDefinitionNotFoundError } from "./errors";
3
3
  export declare const PROCESSOR_OBJECT_PROTO: unknown;
4
4
  export declare const LOCATION_OBJECT_PROTO: unknown;
5
5
  /**
@@ -8,7 +8,7 @@ export declare const LOCATION_OBJECT_PROTO: unknown;
8
8
  * @param {ObjectProt} objectProto - The object proto to load.
9
9
  * @return {A} The proto definition.
10
10
  */
11
- export declare function getObjectProto<A>(objectProto: ObjectProto): A | ServiceDefinitionNotFound;
11
+ export declare function getObjectProto<A>(objectProto: ObjectProto): A | ServiceDefinitionNotFoundError;
12
12
  /**
13
13
  * Creates a new service using the given service definition.
14
14
  *
package/dist/service.js CHANGED
@@ -62,7 +62,7 @@ function getObjectProto(objectProto) {
62
62
  const objProto = (_b = (_a = grpc.loadPackageDefinition(definitions)) === null || _a === void 0 ? void 0 : _a.fonoster) === null || _b === void 0 ? void 0 : _b.routr[objectProto.name];
63
63
  return (objProto === null || objProto === void 0 ? void 0 : objProto[objectProto.version])
64
64
  ? objProto[objectProto.version]
65
- : new errors_1.ServiceDefinitionNotFound(objectProto.name, objectProto.version);
65
+ : new errors_1.ServiceDefinitionNotFoundError(objectProto.name, objectProto.version);
66
66
  }
67
67
  exports.getObjectProto = getObjectProto;
68
68
  /**
package/dist/types.d.ts CHANGED
@@ -1,4 +1,7 @@
1
+ import * as grpc from "@grpc/grpc-js";
1
2
  import { ServiceDefinition } from "@grpc/proto-loader";
3
+ import { JsonArray, JsonValue, Struct } from "pb-util/build";
4
+ export type JsonData = Record<string, string | number | boolean | JsonValue | JsonArray | Struct>;
2
5
  export declare enum Method {
3
6
  UNKNOWN = "UNKNOWN",
4
7
  REGISTER = "REGISTER",
@@ -13,23 +16,33 @@ export declare enum Method {
13
16
  OPTIONS = "OPTIONS"
14
17
  }
15
18
  export declare enum Transport {
16
- TCP = "tcp",
17
- UDP = "udp",
18
- TLS = "tls",
19
- SCTP = "sctp",
20
- WS = "ws",
21
- WSS = "wss"
19
+ TCP = "TCP",
20
+ UDP = "UDP",
21
+ TLS = "TLS",
22
+ SCTP = "SCTP",
23
+ WS = "WS",
24
+ WSS = "WSS"
25
+ }
26
+ export declare enum LoadBalancingAlgorithm {
27
+ UNSPECIFIED = "UNSPECIFIED",
28
+ ROUND_ROBIN = "ROUND_ROBIN",
29
+ LEAST_SESSIONS = "LEAST_SESSIONS"
22
30
  }
23
31
  export declare enum ExtraHeader {
24
32
  REQUEST_URI = "X-Request-Uri",
25
33
  GATEWAY_AUTH = "X-Gateway-Auth",
26
34
  EDGEPORT_REF = "X-Edgeport-Ref",
27
- SESSION_COUNT = "X-Session-Count"
35
+ SESSION_COUNT = "X-Session-Count",
36
+ DOD_NUMBER = "X-DOD-Number",
37
+ DOD_PRIVACY = "X-DOD-Privacy"
28
38
  }
29
39
  export declare enum Privacy {
30
- NONE = "none",
31
- PRIVATE = "id"
40
+ NONE = "NONE",
41
+ PRIVATE = "ID"
32
42
  }
43
+ export type AuthorizationAlgorithm = "MD5";
44
+ export type AuthorizationScheme = "Digest";
45
+ export type Qop = "auth" | "auth-int" | "";
33
46
  export interface NetInterface {
34
47
  host: string;
35
48
  port: number;
@@ -72,32 +85,32 @@ export interface ObjectProto {
72
85
  export interface AuthChallengeRequest {
73
86
  realm: string;
74
87
  domain: string;
75
- scheme: string;
76
- nonce: string;
77
- algorithm: string;
78
- qop: string;
79
88
  opaque: string;
80
89
  stale: boolean;
90
+ nonce: string;
91
+ scheme: AuthorizationScheme;
92
+ algorithm: AuthorizationAlgorithm;
93
+ qop: Qop;
81
94
  }
82
95
  export interface AuthChallengeResponse {
83
96
  realm: string;
84
97
  domain: string;
85
- scheme: string;
86
98
  cNonce: string;
99
+ nonce: string;
87
100
  nonceCount: number;
88
101
  response: string;
89
102
  username: string;
90
- nonce: string;
91
- algorithm: string;
92
- qop: string;
93
103
  opaque: string;
94
104
  stale: boolean;
95
105
  uri: string;
96
- method: string;
106
+ method: Method;
107
+ scheme: AuthorizationScheme;
108
+ algorithm: AuthorizationAlgorithm;
109
+ qop: Qop;
97
110
  }
98
111
  export declare enum HeaderModifierAction {
99
- ADD = "add",
100
- REMOVE = "remove"
112
+ ADD = 0,
113
+ REMOVE = 1
101
114
  }
102
115
  export interface HeaderModifier {
103
116
  name: string;
@@ -110,10 +123,19 @@ export interface Route {
110
123
  port: number;
111
124
  transport: Transport;
112
125
  registeredOn?: number;
126
+ /**
127
+ * Number of active sessions. This is used to determine if a route is
128
+ * overloaded and for load balancing.
129
+ *
130
+ * This value is reported by the endpoint during the REGISTER request,
131
+ * using the X-Session-Count header.
132
+ */
113
133
  sessionCount?: number;
114
134
  expires?: number;
115
135
  edgePortRef: string;
116
- egressListeningPoint: NetInterface;
136
+ listeningPoints: NetInterface[];
137
+ localnets: string[];
138
+ externalAddrs: string[];
117
139
  labels?: Map<string, string>;
118
140
  headers?: HeaderModifier[];
119
141
  }
@@ -189,17 +211,17 @@ export interface WWWAuthenticate {
189
211
  }
190
212
  export interface Authorization {
191
213
  realm: string;
192
- scheme: string;
214
+ scheme: AuthorizationScheme;
193
215
  nonce: string;
194
216
  cNonce: string;
195
217
  nonceCount: number;
196
218
  response: string;
197
219
  username: string;
198
220
  uri: string;
199
- algorithm: string;
200
- qop: string;
221
+ algorithm: AuthorizationAlgorithm;
222
+ qop: Qop;
201
223
  opaque: string;
202
- method?: string;
224
+ method?: Method;
203
225
  }
204
226
  export interface CallID {
205
227
  callId: string;
@@ -221,7 +243,7 @@ export interface SipURI {
221
243
  user?: string;
222
244
  host: string;
223
245
  port?: number;
224
- transportParam: string;
246
+ transportParam: Transport;
225
247
  mAddrParam?: string;
226
248
  userParam?: string;
227
249
  ttlParam?: number;
@@ -281,10 +303,10 @@ export interface SIPMessage {
281
303
  wwwAuthenticate?: WWWAuthenticate;
282
304
  maxForwards: MaxForwards;
283
305
  authorization?: Authorization;
284
- extensions?: Extension[];
285
- via?: Via[];
286
- route?: RouteHeader[];
287
- recordRoute?: RecordRoute[];
306
+ extensions: Extension[];
307
+ via: Via[];
308
+ route: RouteHeader[];
309
+ recordRoute: RecordRoute[];
288
310
  }
289
311
  export interface GrpcCallback {
290
312
  (error: Error | {
@@ -293,4 +315,5 @@ export interface GrpcCallback {
293
315
  }
294
316
  export interface GrpcCall {
295
317
  request: Record<string, any>;
318
+ metadata?: grpc.Metadata;
296
319
  }
package/dist/types.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MessageType = exports.ResponseType = exports.HeaderModifierAction = exports.Privacy = exports.ExtraHeader = exports.Transport = exports.Method = void 0;
3
+ exports.MessageType = exports.ResponseType = exports.HeaderModifierAction = exports.Privacy = exports.ExtraHeader = exports.LoadBalancingAlgorithm = exports.Transport = exports.Method = void 0;
4
4
  var Method;
5
5
  (function (Method) {
6
6
  Method["UNKNOWN"] = "UNKNOWN";
@@ -17,29 +17,37 @@ var Method;
17
17
  })(Method = exports.Method || (exports.Method = {}));
18
18
  var Transport;
19
19
  (function (Transport) {
20
- Transport["TCP"] = "tcp";
21
- Transport["UDP"] = "udp";
22
- Transport["TLS"] = "tls";
23
- Transport["SCTP"] = "sctp";
24
- Transport["WS"] = "ws";
25
- Transport["WSS"] = "wss";
20
+ Transport["TCP"] = "TCP";
21
+ Transport["UDP"] = "UDP";
22
+ Transport["TLS"] = "TLS";
23
+ Transport["SCTP"] = "SCTP";
24
+ Transport["WS"] = "WS";
25
+ Transport["WSS"] = "WSS";
26
26
  })(Transport = exports.Transport || (exports.Transport = {}));
27
+ var LoadBalancingAlgorithm;
28
+ (function (LoadBalancingAlgorithm) {
29
+ LoadBalancingAlgorithm["UNSPECIFIED"] = "UNSPECIFIED";
30
+ LoadBalancingAlgorithm["ROUND_ROBIN"] = "ROUND_ROBIN";
31
+ LoadBalancingAlgorithm["LEAST_SESSIONS"] = "LEAST_SESSIONS";
32
+ })(LoadBalancingAlgorithm = exports.LoadBalancingAlgorithm || (exports.LoadBalancingAlgorithm = {}));
27
33
  var ExtraHeader;
28
34
  (function (ExtraHeader) {
29
35
  ExtraHeader["REQUEST_URI"] = "X-Request-Uri";
30
36
  ExtraHeader["GATEWAY_AUTH"] = "X-Gateway-Auth";
31
37
  ExtraHeader["EDGEPORT_REF"] = "X-Edgeport-Ref";
32
38
  ExtraHeader["SESSION_COUNT"] = "X-Session-Count";
39
+ ExtraHeader["DOD_NUMBER"] = "X-DOD-Number";
40
+ ExtraHeader["DOD_PRIVACY"] = "X-DOD-Privacy";
33
41
  })(ExtraHeader = exports.ExtraHeader || (exports.ExtraHeader = {}));
34
42
  var Privacy;
35
43
  (function (Privacy) {
36
- Privacy["NONE"] = "none";
37
- Privacy["PRIVATE"] = "id";
44
+ Privacy["NONE"] = "NONE";
45
+ Privacy["PRIVATE"] = "ID";
38
46
  })(Privacy = exports.Privacy || (exports.Privacy = {}));
39
47
  var HeaderModifierAction;
40
48
  (function (HeaderModifierAction) {
41
- HeaderModifierAction["ADD"] = "add";
42
- HeaderModifierAction["REMOVE"] = "remove";
49
+ HeaderModifierAction[HeaderModifierAction["ADD"] = 0] = "ADD";
50
+ HeaderModifierAction[HeaderModifierAction["REMOVE"] = 1] = "REMOVE";
43
51
  })(HeaderModifierAction = exports.HeaderModifierAction || (exports.HeaderModifierAction = {}));
44
52
  var ResponseType;
45
53
  (function (ResponseType) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@routr/common",
3
- "version": "2.0.8-alpha.2",
3
+ "version": "2.0.8-alpha.21",
4
4
  "description": "Common package",
5
5
  "author": "Pedro Sanders <psanders@fonoster.com>",
6
6
  "homepage": "https://github.com/fonoster/routr#readme",
@@ -10,11 +10,11 @@
10
10
  "scripts": {
11
11
  "prebuild": "rimraf ./dist tsconfig.tsbuildinfo",
12
12
  "build": "tsc -b tsconfig.json",
13
- "postbuild": "mkdir -p dist/protos && cp src/protos/* dist/protos"
13
+ "postbuild": "cp -a src/protos dist/protos && cp -a src/connect/protos dist/connect/protos"
14
14
  },
15
15
  "dependencies": {
16
16
  "@fonoster/logger": "0.3.18",
17
- "@grpc/grpc-js": "^1.5.9",
17
+ "@grpc/grpc-js": "^1.8.4",
18
18
  "@grpc/proto-loader": "^0.6.9",
19
19
  "@opentelemetry/api": "^1.0.4",
20
20
  "@opentelemetry/exporter-jaeger": "^1.0.4",
@@ -24,9 +24,13 @@
24
24
  "@opentelemetry/sdk-trace-base": "^1.0.4",
25
25
  "@opentelemetry/sdk-trace-node": "^1.0.4",
26
26
  "@opentelemetry/semantic-conventions": "^1.0.4",
27
+ "ajv": "^6.12.6",
27
28
  "fp-ts": "^2.11.8",
28
29
  "ip-utils": "^2.4.0",
29
- "pb-util": "^1.0.3"
30
+ "js-yaml": "^4.1.0",
31
+ "pb-util": "^1.0.3",
32
+ "toml": "^3.0.0",
33
+ "validator": "^13.7.0"
30
34
  },
31
35
  "directories": {
32
36
  "src": "src",
@@ -45,5 +49,8 @@
45
49
  "bugs": {
46
50
  "url": "https://github.com/fonoster/routr/issues"
47
51
  },
48
- "gitHead": "28ab976b0ef8b5cd34e278ea6fda13c518d7d052"
52
+ "devDependencies": {
53
+ "@types/js-yaml": "^4.0.5"
54
+ },
55
+ "gitHead": "1841d2d8d51bebfdc3af7e81435064e81b176449"
49
56
  }
@@ -1,11 +0,0 @@
1
- import { FindParameters, Resource } from "./types";
2
- /**
3
- * Data API for the Connect module.
4
- *
5
- * @param {string} apiAddr - The address of the API server
6
- * @return {Promise<Resource[]>}
7
- */
8
- export declare function dataAPI(apiAddr: string): {
9
- get: (ref: string) => Promise<Resource>;
10
- findBy: (request: FindParameters) => Promise<Resource[]>;
11
- };
@@ -1,91 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.dataAPI = void 0;
27
- /*
28
- * Copyright (C) 2022 by Fonoster Inc (https://fonoster.com)
29
- * http://github.com/fonoster/routr
30
- *
31
- * This file is part of Routr
32
- *
33
- * Licensed under the MIT License (the "License");
34
- * you may not use this file except in compliance with
35
- * the License. You may obtain a copy of the License at
36
- *
37
- * https://opensource.org/licenses/MIT
38
- *
39
- * Unless required by applicable law or agreed to in writing, software
40
- * distributed under the License is distributed on an "AS IS" BASIS,
41
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
42
- * See the License for the specific language governing permissions and
43
- * limitations under the License.
44
- */
45
- const grpc = __importStar(require("@grpc/grpc-js"));
46
- const protobufUtil = __importStar(require("pb-util"));
47
- const errors_1 = require("../errors");
48
- const grpc_client_1 = require("./grpc_client");
49
- const jsonToStruct = protobufUtil.struct.encode;
50
- const jsonFromStruct = protobufUtil.struct.decode;
51
- /**
52
- * Data API for the Connect module.
53
- *
54
- * @param {string} apiAddr - The address of the API server
55
- * @return {Promise<Resource[]>}
56
- */
57
- function dataAPI(apiAddr) {
58
- const client = new grpc_client_1.RESOURCES_PROTO.v2draft1.Resources(apiAddr, grpc.credentials.createInsecure());
59
- return {
60
- get: (ref) => new Promise((resolve, reject) => {
61
- client.get({ ref }, (err, response) => {
62
- if (err) {
63
- return (err === null || err === void 0 ? void 0 : err.code) === grpc.status.UNAVAILABLE
64
- ? reject(new errors_1.ServiceUnavailableError(`api server at ${apiAddr} is unavailable`))
65
- : reject(err);
66
- }
67
- // Convert back to Json
68
- response.spec = jsonFromStruct(response.spec);
69
- resolve(response);
70
- });
71
- }),
72
- findBy: (request) => new Promise((resolve, reject) => {
73
- request.parameters = jsonToStruct(request.parameters);
74
- client.findBy(request, (err, response) => {
75
- var _a;
76
- if (err) {
77
- return (err === null || err === void 0 ? void 0 : err.code) === grpc.status.UNAVAILABLE
78
- ? reject(new errors_1.ServiceUnavailableError(`api server at ${apiAddr} is unavailable`))
79
- : reject(err);
80
- }
81
- const res = (_a = response === null || response === void 0 ? void 0 : response.resources) === null || _a === void 0 ? void 0 : _a.map((resource) => {
82
- // Convert back to Json
83
- resource.spec = jsonFromStruct(resource.spec);
84
- return resource;
85
- });
86
- resolve(res);
87
- });
88
- })
89
- };
90
- }
91
- exports.dataAPI = dataAPI;
@@ -1 +0,0 @@
1
- export declare const RESOURCES_PROTO: any;
@@ -1,108 +0,0 @@
1
- // TODO: Show a link to were this proto was downloaded from
2
- syntax = "proto3";
3
-
4
- package fonoster.routr.resources.v2draft1;
5
-
6
- import "google/protobuf/struct.proto";
7
-
8
- // Resources service
9
- service Resources {
10
- rpc Create (CreateRequest) returns (Resource) {}
11
- rpc Update (UpdateRequest) returns (Resource) {}
12
- rpc Get (GetRequest) returns (Resource) {}
13
- rpc Delete (DeleteRequest) returns (Empty) {}
14
- rpc List (ListRequest) returns (ListResponse) {}
15
- rpc FindBy (FindByRequest) returns (FindByResponse) {}
16
- }
17
-
18
- message Metadata {
19
- // The resource's name
20
- string name = 1;
21
- // Created at
22
- int32 create_time = 2;
23
- // Updated at
24
- int32 update_time = 3;
25
- }
26
-
27
- message Resource {
28
- // The resource's api version
29
- string apiVersion = 1;
30
- // The resource's kind
31
- string kind = 2;
32
- // The resource's unique identifier
33
- string ref = 3;
34
- // The resource's metadata
35
- Metadata metadata = 4;
36
- // The resource's data
37
- .google.protobuf.Struct spec = 5;
38
- }
39
-
40
- message CreateRequest {
41
- Metadata metadata = 1;
42
- .google.protobuf.Struct spec = 2;
43
- }
44
-
45
- message UpdateRequest {
46
- Metadata metadata = 1;
47
- .google.protobuf.Struct spec = 2;
48
- }
49
-
50
- message DeleteRequest {
51
- string ref = 1;
52
- }
53
-
54
- message GetRequest {
55
- string ref = 1;
56
- }
57
-
58
- message ListRequest {
59
- // The maximum number of items in the list
60
- int32 page_size = 1;
61
-
62
- // The next_page_token value returned from the previous request, if any
63
- string page_token = 2;
64
-
65
- // The filter to apply to the list
66
- string filter = 3;
67
-
68
- // The type of resource to list
69
- string kind = 4;
70
-
71
- // Level of detail of the individual entities (reserved)
72
- View view = 5;
73
- }
74
-
75
- message ListResponse {
76
- // List of Resources
77
- repeated Resource resources = 1;
78
-
79
- // Token to retrieve the next page of results, or empty if there are no more results in the list
80
- string next_page_token = 2;
81
- }
82
-
83
- message FindByRequest {
84
- // The type of resource to find
85
- string kind = 1;
86
-
87
- // Search criteria for the request
88
- string criteria = 2;
89
-
90
- // Parameters to apply in combination with the search criteria
91
- .google.protobuf.Struct parameters = 3;
92
-
93
- // Level of detail of the individual entities (reserved)
94
- View view = 4;
95
- }
96
-
97
- message FindByResponse {
98
- // List of Resources
99
- repeated Resource resources = 1;
100
- }
101
-
102
- enum View {
103
- BASIC = 0;
104
- STANDARD = 1;
105
- FULL = 2;
106
- }
107
-
108
- message Empty {}