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

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 (79) 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/client.d.ts +8 -0
  10. package/dist/connect/{grpc_client.js → client.js} +44 -6
  11. package/dist/connect/config.d.ts +113 -0
  12. package/dist/connect/config.js +2 -0
  13. package/dist/connect/connect_error.d.ts +21 -0
  14. package/dist/connect/connect_error.js +44 -0
  15. package/dist/connect/index.d.ts +4 -2
  16. package/dist/connect/index.js +4 -2
  17. package/dist/connect/mappers/acl.d.ts +3 -0
  18. package/dist/connect/mappers/acl.js +19 -0
  19. package/dist/connect/mappers/agent.d.ts +3 -0
  20. package/dist/connect/mappers/agent.js +42 -0
  21. package/dist/connect/mappers/assertions.d.ts +3 -0
  22. package/dist/connect/mappers/assertions.js +43 -0
  23. package/dist/connect/mappers/credentials.d.ts +3 -0
  24. package/dist/connect/mappers/credentials.js +18 -0
  25. package/dist/connect/mappers/domain.d.ts +3 -0
  26. package/dist/connect/mappers/domain.js +19 -0
  27. package/dist/connect/mappers/index.d.ts +7 -0
  28. package/dist/connect/mappers/index.js +41 -0
  29. package/dist/connect/mappers/number.d.ts +3 -0
  30. package/dist/connect/mappers/number.js +26 -0
  31. package/dist/connect/mappers/peer.d.ts +3 -0
  32. package/dist/connect/mappers/peer.js +25 -0
  33. package/dist/connect/mappers/trunk.d.ts +3 -0
  34. package/dist/connect/mappers/trunk.js +34 -0
  35. package/dist/connect/protos/acl.proto +112 -0
  36. package/dist/connect/protos/agents.proto +155 -0
  37. package/dist/connect/protos/credentials.proto +114 -0
  38. package/dist/connect/protos/domains.proto +148 -0
  39. package/dist/connect/protos/numbers.proto +174 -0
  40. package/dist/connect/protos/peers.proto +173 -0
  41. package/dist/connect/protos/trunks.proto +178 -0
  42. package/dist/connect/schemas/acl.d.ts +63 -0
  43. package/dist/connect/schemas/acl.js +82 -0
  44. package/dist/connect/schemas/agent.d.ts +62 -0
  45. package/dist/connect/schemas/agent.js +81 -0
  46. package/dist/connect/schemas/crendentials.d.ts +59 -0
  47. package/dist/connect/schemas/crendentials.js +78 -0
  48. package/dist/connect/schemas/domain.d.ts +75 -0
  49. package/dist/connect/schemas/domain.js +94 -0
  50. package/dist/connect/schemas/index.d.ts +1 -0
  51. package/dist/connect/schemas/index.js +35 -0
  52. package/dist/connect/schemas/number.d.ts +82 -0
  53. package/dist/connect/schemas/number.js +101 -0
  54. package/dist/connect/schemas/peer.d.ts +84 -0
  55. package/dist/connect/schemas/peer.js +103 -0
  56. package/dist/connect/schemas/trunk.d.ts +119 -0
  57. package/dist/connect/schemas/trunk.js +151 -0
  58. package/dist/connect/schemas/validators.d.ts +2 -0
  59. package/dist/connect/schemas/validators.js +43 -0
  60. package/dist/connect/types.d.ts +89 -23
  61. package/dist/connect/types.js +17 -37
  62. package/dist/errors.d.ts +35 -1
  63. package/dist/errors.js +51 -5
  64. package/dist/helper.d.ts +17 -4
  65. package/dist/helper.js +81 -7
  66. package/dist/index.d.ts +5 -4
  67. package/dist/index.js +5 -7
  68. package/dist/protos/common.proto +0 -2
  69. package/dist/protos/location.proto +22 -7
  70. package/dist/protos/sipmessage.proto +2 -0
  71. package/dist/service.d.ts +2 -2
  72. package/dist/service.js +1 -1
  73. package/dist/types.d.ts +52 -30
  74. package/dist/types.js +18 -11
  75. package/package.json +11 -5
  76. package/dist/connect/data_api.d.ts +0 -11
  77. package/dist/connect/data_api.js +0 -91
  78. package/dist/connect/grpc_client.d.ts +0 -1
  79. package/dist/protos/resources.proto +0 -108
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.mapToACL = void 0;
4
+ const schemas_1 = require("../schemas");
5
+ const types_1 = require("../types");
6
+ const assertions_1 = require("./assertions");
7
+ const valid = schemas_1.schemaValidators.get(types_1.Kind.ACL);
8
+ function mapToACL(config) {
9
+ var _a, _b, _c, _d;
10
+ (0, assertions_1.assertValidSchema)(config, valid);
11
+ return {
12
+ apiVersion: config.apiVersion,
13
+ ref: config.ref,
14
+ name: config.metadata.name,
15
+ allow: (_b = (_a = config.spec.accessControlList) === null || _a === void 0 ? void 0 : _a.allow) !== null && _b !== void 0 ? _b : [],
16
+ deny: (_d = (_c = config.spec.accessControlList) === null || _c === void 0 ? void 0 : _c.deny) !== null && _d !== void 0 ? _d : []
17
+ };
18
+ }
19
+ exports.mapToACL = mapToACL;
@@ -0,0 +1,3 @@
1
+ import { AgentConfig } from "../config";
2
+ import { Agent } from "../types";
3
+ export declare function mapToAgent(config: AgentConfig): Agent;
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.mapToAgent = void 0;
4
+ /*
5
+ * Copyright (C) 2023 by Fonoster Inc (https://fonoster.com)
6
+ * http://github.com/fonoster
7
+ *
8
+ * This file is part of Routr.
9
+ *
10
+ * Licensed under the MIT License (the "License");
11
+ * you may not use this file except in compliance with
12
+ * the License. You may obtain a copy of the License at
13
+ *
14
+ * https://opensource.org/licenses/MIT
15
+ *
16
+ * Unless required by applicable law or agreed to in writing, software
17
+ * distributed under the License is distributed on an "AS IS" BASIS,
18
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
+ * See the License for the specific language governing permissions and
20
+ * limitations under the License.
21
+ */
22
+ /* eslint-disable require-jsdoc */
23
+ const types_1 = require("../../types");
24
+ const schemas_1 = require("../schemas");
25
+ const types_2 = require("../types");
26
+ const assertions_1 = require("./assertions");
27
+ const valid = schemas_1.schemaValidators.get(types_2.Kind.AGENT);
28
+ function mapToAgent(config) {
29
+ var _a;
30
+ (0, assertions_1.assertValidSchema)(config, valid);
31
+ return {
32
+ apiVersion: config.apiVersion,
33
+ ref: config.ref,
34
+ name: config.metadata.name,
35
+ username: config.spec.username,
36
+ privacy: (_a = config.spec.privacy) !== null && _a !== void 0 ? _a : types_1.Privacy.NONE,
37
+ enabled: config.spec.enabled,
38
+ domainRef: config.spec.domainRef,
39
+ credentialsRef: config.spec.credentialsRef
40
+ };
41
+ }
42
+ exports.mapToAgent = mapToAgent;
@@ -0,0 +1,3 @@
1
+ import { UserConfig } from "../config";
2
+ export declare const assertValidSchema: (config: UserConfig, valid: (config: UserConfig) => boolean) => void;
3
+ export declare const assertValidAorSchema: (config: UserConfig) => void;
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.assertValidAorSchema = exports.assertValidSchema = void 0;
4
+ /*
5
+ * Copyright (C) 2023 by Fonoster Inc (https://fonoster.com)
6
+ * http://github.com/fonoster
7
+ *
8
+ * This file is part of Routr.
9
+ *
10
+ * Licensed under the MIT License (the "License");
11
+ * you may not use this file except in compliance with
12
+ * the License. You may obtain a copy of the License at
13
+ *
14
+ * https://opensource.org/licenses/MIT
15
+ *
16
+ * Unless required by applicable law or agreed to in writing, software
17
+ * distributed under the License is distributed on an "AS IS" BASIS,
18
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
+ * See the License for the specific language governing permissions and
20
+ * limitations under the License.
21
+ */
22
+ const logger_1 = require("@fonoster/logger");
23
+ const logger = (0, logger_1.getLogger)({ service: "common", filePath: __filename });
24
+ const assertValidSchema = (config, valid) => {
25
+ if (!valid(config)) {
26
+ const error = valid.errors[0];
27
+ logger.error("found a bad resource: " + error.message + " at `" + error.dataPath + "`");
28
+ process.exit(1);
29
+ }
30
+ };
31
+ exports.assertValidSchema = assertValidSchema;
32
+ const assertValidAorSchema = (config) => {
33
+ const spec = config.spec;
34
+ if (spec.aor.startsWith("backend:") && !spec.loadBalancing) {
35
+ logger.error("found a bad resource: balancing algorithm is required for `backend:` aors");
36
+ process.exit(1);
37
+ }
38
+ if (spec.aor.startsWith("sip:") && spec.loadBalancing) {
39
+ logger.error("found a bad resource: balancing algorithm is not allowed for `sip:` aors");
40
+ process.exit(1);
41
+ }
42
+ };
43
+ exports.assertValidAorSchema = assertValidAorSchema;
@@ -0,0 +1,3 @@
1
+ import { CredentialsConfig } from "../config";
2
+ import { Credentials } from "../types";
3
+ export declare function mapToCredentials(config: CredentialsConfig): Credentials;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.mapToCredentials = void 0;
4
+ const schemas_1 = require("../schemas");
5
+ const types_1 = require("../types");
6
+ const assertions_1 = require("./assertions");
7
+ const valid = schemas_1.schemaValidators.get(types_1.Kind.CREDENTIALS);
8
+ function mapToCredentials(config) {
9
+ (0, assertions_1.assertValidSchema)(config, valid);
10
+ return {
11
+ apiVersion: config.apiVersion,
12
+ ref: config.ref,
13
+ name: config.metadata.name,
14
+ username: config.spec.credentials.username,
15
+ password: config.spec.credentials.password
16
+ };
17
+ }
18
+ exports.mapToCredentials = mapToCredentials;
@@ -0,0 +1,3 @@
1
+ import { DomainConfig } from "../config";
2
+ import { Domain } from "../types";
3
+ export declare function mapToDomain(config: DomainConfig): Domain;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.mapToDomain = void 0;
4
+ const schemas_1 = require("../schemas");
5
+ const types_1 = require("../types");
6
+ const assertions_1 = require("./assertions");
7
+ const valid = schemas_1.schemaValidators.get(types_1.Kind.DOMAIN);
8
+ function mapToDomain(config) {
9
+ (0, assertions_1.assertValidSchema)(config, valid);
10
+ return {
11
+ apiVersion: config.apiVersion,
12
+ ref: config.ref,
13
+ name: config.metadata.name,
14
+ domainUri: config.spec.context.domainUri,
15
+ accessControlListRef: config.spec.accessControlListRef,
16
+ egressPolicies: config.spec.context.egressPolicies
17
+ };
18
+ }
19
+ exports.mapToDomain = mapToDomain;
@@ -0,0 +1,7 @@
1
+ export * from "./acl";
2
+ export * from "./agent";
3
+ export * from "./credentials";
4
+ export * from "./trunk";
5
+ export * from "./number";
6
+ export * from "./peer";
7
+ export * from "./domain";
@@ -0,0 +1,41 @@
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ /*
18
+ * Copyright (C) 2023 by Fonoster Inc (https://fonoster.com)
19
+ * http://github.com/fonoster
20
+ *
21
+ * This file is part of Routr.
22
+ *
23
+ * Licensed under the MIT License (the "License");
24
+ * you may not use this file except in compliance with
25
+ * the License. You may obtain a copy of the License at
26
+ *
27
+ * https://opensource.org/licenses/MIT
28
+ *
29
+ * Unless required by applicable law or agreed to in writing, software
30
+ * distributed under the License is distributed on an "AS IS" BASIS,
31
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
32
+ * See the License for the specific language governing permissions and
33
+ * limitations under the License.
34
+ */
35
+ __exportStar(require("./acl"), exports);
36
+ __exportStar(require("./agent"), exports);
37
+ __exportStar(require("./credentials"), exports);
38
+ __exportStar(require("./trunk"), exports);
39
+ __exportStar(require("./number"), exports);
40
+ __exportStar(require("./peer"), exports);
41
+ __exportStar(require("./domain"), exports);
@@ -0,0 +1,3 @@
1
+ import { NumberConfig } from "../config";
2
+ import { INumber } from "../types";
3
+ export declare function mapToNumber(config: NumberConfig): INumber;
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.mapToNumber = void 0;
4
+ const schemas_1 = require("../schemas");
5
+ const types_1 = require("../types");
6
+ const assertions_1 = require("./assertions");
7
+ const valid = schemas_1.schemaValidators.get(types_1.Kind.NUMBER);
8
+ function mapToNumber(config) {
9
+ (0, assertions_1.assertValidSchema)(config, valid);
10
+ const metadata = config.metadata;
11
+ const location = config.spec.location;
12
+ return {
13
+ apiVersion: config.apiVersion,
14
+ ref: config.ref,
15
+ name: metadata.name,
16
+ city: metadata.geoInfo.city,
17
+ country: metadata.geoInfo.country,
18
+ countryISOCode: metadata.geoInfo.countryISOCode,
19
+ telUrl: location.telUrl,
20
+ aorLink: location.aorLink,
21
+ sessionAffinityHeader: location.sessionAffinityHeader,
22
+ extraHeaders: location.extraHeaders,
23
+ trunkRef: config.spec.trunkRef
24
+ };
25
+ }
26
+ exports.mapToNumber = mapToNumber;
@@ -0,0 +1,3 @@
1
+ import { PeerConfig } from "../config";
2
+ import { Peer } from "../types";
3
+ export declare function mapToPeer(config: PeerConfig): Peer;
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.mapToPeer = void 0;
4
+ const schemas_1 = require("../schemas");
5
+ const types_1 = require("../types");
6
+ const assertions_1 = require("./assertions");
7
+ const valid = schemas_1.schemaValidators.get(types_1.Kind.PEER);
8
+ function mapToPeer(config) {
9
+ var _a, _b;
10
+ (0, assertions_1.assertValidSchema)(config, valid);
11
+ (0, assertions_1.assertValidAorSchema)(config);
12
+ return {
13
+ apiVersion: config.apiVersion,
14
+ ref: config.ref,
15
+ name: config.metadata.name,
16
+ username: config.spec.username,
17
+ aor: config.spec.aor,
18
+ contactAddr: config.spec.contactAddr,
19
+ enabled: config.spec.enabled,
20
+ credentialsRef: config.spec.credentialsRef,
21
+ balancingAlgorithm: (_a = config.spec.loadBalancing) === null || _a === void 0 ? void 0 : _a.algorithm.toUpperCase(),
22
+ withSessionAffinity: (_b = config.spec.loadBalancing) === null || _b === void 0 ? void 0 : _b.withSessionAffinity
23
+ };
24
+ }
25
+ exports.mapToPeer = mapToPeer;
@@ -0,0 +1,3 @@
1
+ import { TrunkConfig } from "../config";
2
+ import { Trunk } from "../types";
3
+ export declare function mapToTrunk(config: TrunkConfig): Trunk;
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.mapToTrunk = void 0;
4
+ const schemas_1 = require("../schemas");
5
+ const types_1 = require("../types");
6
+ const assertions_1 = require("./assertions");
7
+ const valid = schemas_1.schemaValidators.get(types_1.Kind.TRUNK);
8
+ function mapToTrunk(config) {
9
+ var _a, _b, _c, _d, _e, _f;
10
+ (0, assertions_1.assertValidSchema)(config, valid);
11
+ return {
12
+ apiVersion: config.apiVersion,
13
+ ref: config.ref,
14
+ name: config.metadata.name,
15
+ sendRegister: config.spec.outbound.sendRegister,
16
+ inboundUri: (_a = config.spec.inbound) === null || _a === void 0 ? void 0 : _a.uri,
17
+ inboundCredentialsRef: (_b = config.spec.inbound) === null || _b === void 0 ? void 0 : _b.credentialsRef,
18
+ outboundCredentialsRef: (_c = config.spec.outbound) === null || _c === void 0 ? void 0 : _c.credentialsRef,
19
+ accessControlListRef: (_d = config.spec.inbound) === null || _d === void 0 ? void 0 : _d.accessControlListRef,
20
+ uris: (_f = (_e = config.spec.outbound) === null || _e === void 0 ? void 0 : _e.uris) === null || _f === void 0 ? void 0 : _f.map((entry) => {
21
+ var _a;
22
+ return {
23
+ user: entry.uri.user,
24
+ host: entry.uri.host,
25
+ port: entry.uri.port,
26
+ transport: (_a = entry.uri.transport) === null || _a === void 0 ? void 0 : _a.toUpperCase(),
27
+ enabled: entry.enabled,
28
+ weight: entry.weight,
29
+ priority: entry.priority
30
+ };
31
+ })
32
+ };
33
+ }
34
+ exports.mapToTrunk = mapToTrunk;
@@ -0,0 +1,112 @@
1
+ /*
2
+ * Copyright (C) 2022 by Fonoster Inc (https://fonoster.com)
3
+ * http://github.com/fonoster/routr
4
+ *
5
+ * This file is part of Routr
6
+ *
7
+ * Licensed under the MIT License (the "License")
8
+ * you may not use this file except in compliance with
9
+ * the License. You may obtain a copy of the License at
10
+ *
11
+ * https://opensource.org/licenses/MIT
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, software
14
+ * distributed under the License is distributed on an "AS IS" BASIS,
15
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ * See the License for the specific language governing permissions and
17
+ * limitations under the License.
18
+ */
19
+ syntax = "proto3";
20
+
21
+ package fonoster.routr.connect.acl.v2draft1;
22
+
23
+ import "google/protobuf/struct.proto";
24
+ import "google/protobuf/empty.proto";
25
+
26
+ // AccessControlList(ACL) service definition
27
+ service ACLService {
28
+ // Create a new ACL
29
+ rpc Create (CreateACLRequest) returns (AccessControlList) {}
30
+ // Update an existing ACL
31
+ rpc Update (UpdateACLRequest) returns (AccessControlList) {}
32
+ // Get an existing ACL
33
+ rpc Get (GetACLRequest) returns (AccessControlList) {}
34
+ // Delete an existing ACL
35
+ rpc Delete (DeleteACLRequest) returns (.google.protobuf.Empty) {}
36
+ // Get a list of ACLs
37
+ rpc List (ListACLsRequest) returns (ListACLsResponse) {}
38
+ }
39
+
40
+ // The message for AccessControlList resource
41
+ message AccessControlList {
42
+ // The version of the API
43
+ string api_version = 1;
44
+ // The ACL reference
45
+ string ref = 2;
46
+ // A friendly name for the ACL
47
+ string name = 3;
48
+ // The list of allowed IP addresses
49
+ repeated string allow = 4;
50
+ // The list of denied IP addresses
51
+ repeated string deny = 5;
52
+ // The date the ACL was created
53
+ int32 created_at = 6;
54
+ // The date the ACL was last updated
55
+ int32 updated_at = 7;
56
+ // The extended attributes of the ACL
57
+ .google.protobuf.Struct extended = 8;
58
+ }
59
+
60
+ // The request message for the AccessControlList.Create method
61
+ message CreateACLRequest {
62
+ // A friendly name for the ACL
63
+ string name = 2;
64
+ // The list of allowed IP addresses
65
+ repeated string allow = 3;
66
+ // The list of denied IP addresses
67
+ repeated string deny = 4;
68
+ // The extended attributes of the ACL
69
+ .google.protobuf.Struct extended = 5;
70
+ }
71
+
72
+ // The request message for the AccessControlList.Update method
73
+ message UpdateACLRequest {
74
+ // The ACL reference
75
+ string ref = 1;
76
+ // A friendly name for the ACL
77
+ string name = 2;
78
+ // The list of allowed IP addresses
79
+ repeated string allow = 3;
80
+ // The list of denied IP addresses
81
+ repeated string deny = 4;
82
+ // The extended attributes of the ACL
83
+ .google.protobuf.Struct extended = 5;
84
+ }
85
+
86
+ // The request message for the AccessControlList.Get method
87
+ message GetACLRequest {
88
+ string ref = 1;
89
+ }
90
+
91
+ // The request message for the AccessControlList.Delete method
92
+ message DeleteACLRequest {
93
+ string ref = 1;
94
+ }
95
+
96
+ // The request message for the AccessControlList.List method
97
+ message ListACLsRequest {
98
+ // The maximum number of items in the list
99
+ int32 page_size = 1;
100
+
101
+ // The next_page_token value returned from the previous request, if any
102
+ string page_token = 2;
103
+ }
104
+
105
+ // The response message for the AccessControlList.List method
106
+ message ListACLsResponse {
107
+ // List of items
108
+ repeated AccessControlList items = 1;
109
+
110
+ // Token to retrieve the next page of results, or empty if there are no more results in the list
111
+ string next_page_token = 2;
112
+ }
@@ -0,0 +1,155 @@
1
+ /*
2
+ * Copyright (C) 2022 by Fonoster Inc (https://fonoster.com)
3
+ * http://github.com/fonoster/routr
4
+ *
5
+ * This file is part of Routr
6
+ *
7
+ * Licensed under the MIT License (the "License")
8
+ * you may not use this file except in compliance with
9
+ * the License. You may obtain a copy of the License at
10
+ *
11
+ * https://opensource.org/licenses/MIT
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, software
14
+ * distributed under the License is distributed on an "AS IS" BASIS,
15
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ * See the License for the specific language governing permissions and
17
+ * limitations under the License.
18
+ */
19
+ syntax = "proto3";
20
+
21
+ package fonoster.routr.connect.agents.v2draft1;
22
+
23
+ import "google/protobuf/struct.proto";
24
+ import "google/protobuf/empty.proto";
25
+ import "domains.proto";
26
+ import "credentials.proto";
27
+
28
+ // The Agents service definition
29
+ service Agents {
30
+ // Creates a new Agent
31
+ rpc Create (CreateAgentRequest) returns (Agent) {}
32
+ // Updates an existing Agent
33
+ rpc Update (UpdateAgentRequest) returns (Agent) {}
34
+ // Gets an existing Agent
35
+ rpc Get (GetAgentRequest) returns (Agent) {}
36
+ // Deletes an existing Agent
37
+ rpc Delete (DeleteAgentRequest) returns (.google.protobuf.Empty) {}
38
+ // Lists all Agents
39
+ rpc List (ListAgentsRequest) returns (ListAgentsResponse) {}
40
+ // Find Agents by field name and value
41
+ rpc FindBy (FindByRequest) returns (FindByResponse) {}
42
+ }
43
+
44
+ enum Privacy {
45
+ PRIVATE = 0;
46
+ NONE = 1;
47
+ }
48
+
49
+ // The message for the Agent resource
50
+ message Agent {
51
+ // The API version of the Agent
52
+ string api_version = 1;
53
+ // The unique identifier of the Agent
54
+ string ref = 2;
55
+ // The name of the Agent
56
+ string name = 3;
57
+ // The username of the Agent
58
+ string username = 4;
59
+ // The password of the Agent
60
+ Privacy privacy = 5;
61
+ // The enabled status of the Agent
62
+ bool enabled = 6;
63
+ // The created_at timestamp of the Agent
64
+ int32 created_at = 7;
65
+ // The updated_at timestamp of the Agent
66
+ int32 updated_at = 8;
67
+ // The domain of the Agent
68
+ fonoster.routr.connect.domains.v2draft1.Domain domain = 9;
69
+ // The credentials of the Agent
70
+ fonoster.routr.connect.credentials.v2draft1.Credentials credentials = 10;
71
+ // The extended attributes of the Agent
72
+ .google.protobuf.Struct extended = 11;
73
+ }
74
+
75
+ // The request message for the Agents.Create method
76
+ message CreateAgentRequest {
77
+ // The name of the Agent
78
+ string name = 1;
79
+ // The username of the Agent
80
+ string username = 2;
81
+ // The password of the Agent
82
+ Privacy privacy = 3;
83
+ // The enabled status of the Agent
84
+ bool enabled = 4;
85
+ // Reference to the Domain of the Agent
86
+ string domain_ref = 5;
87
+ // Reference to the Credentials of the Agent
88
+ string credentials_ref = 6;
89
+ // The extended attributes of the Agent
90
+ .google.protobuf.Struct extended = 7;
91
+ }
92
+
93
+ // The request message for the Agents.Update method
94
+ message UpdateAgentRequest {
95
+ // The unique identifier of the Agent
96
+ string ref = 1;
97
+ // The name of the Agent
98
+ string name = 2;
99
+ // The username of the Agent
100
+ string username = 3;
101
+ // The privacy settings of the Agent
102
+ Privacy privacy = 4;
103
+ // The enabled status of the Agent
104
+ bool enabled = 5;
105
+ // Reference to the Domain of the Agent
106
+ string domain_ref = 6;
107
+ // Reference to the Credentials of the Agent
108
+ string credentials_ref = 7;
109
+ // The extended attributes of the Agent
110
+ .google.protobuf.Struct extended = 8;
111
+ }
112
+
113
+ // The request message for the Agents.Get method
114
+ message GetAgentRequest {
115
+ // The unique identifier of the Agent
116
+ string ref = 1;
117
+ }
118
+
119
+ // The request message for the Agents.Delete method
120
+ message DeleteAgentRequest {
121
+ // The unique identifier of the Agent
122
+ string ref = 1;
123
+ }
124
+
125
+ // The request message for the Agents.FindBy method
126
+ message FindByRequest {
127
+ // The field name to search
128
+ string field_name = 1;
129
+ // The value to search
130
+ string field_value = 2;
131
+ }
132
+
133
+ // The response message for the Agents.FindBy method
134
+ message FindByResponse {
135
+ // The list of Agents
136
+ repeated Agent items = 1;
137
+ }
138
+
139
+ // The request message for the Agents.List method
140
+ message ListAgentsRequest {
141
+ // The maximum number of items in the list
142
+ int32 page_size = 1;
143
+
144
+ // The next_page_token value returned from the previous request, if any
145
+ string page_token = 2;
146
+ }
147
+
148
+ // The response message for the Agents.List method
149
+ message ListAgentsResponse {
150
+ // List of Agents
151
+ repeated Agent items = 1;
152
+
153
+ // Token to retrieve the next page of results, or empty if there are no more results in the list
154
+ string next_page_token = 2;
155
+ }