files.com 1.2.264 → 1.2.265
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.
- package/_VERSION +1 -1
- package/docs/models/RemoteMountBackend.md +199 -0
- package/lib/Files.js +1 -1
- package/lib/models/RemoteMountBackend.js +657 -0
- package/package.json +1 -1
- package/src/Files.js +1 -1
- package/src/models/RemoteMountBackend.js +427 -0
package/_VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.2.
|
|
1
|
+
1.2.265
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
# RemoteMountBackend
|
|
2
|
+
|
|
3
|
+
## Example RemoteMountBackend Object
|
|
4
|
+
|
|
5
|
+
```
|
|
6
|
+
{
|
|
7
|
+
"canary_file_path": "backend1.txt",
|
|
8
|
+
"enabled": true,
|
|
9
|
+
"fall": 1,
|
|
10
|
+
"health_check_enabled": true,
|
|
11
|
+
"health_check_type": "active",
|
|
12
|
+
"interval": 60,
|
|
13
|
+
"min_free_cpu": 1.0,
|
|
14
|
+
"min_free_mem": 1.0,
|
|
15
|
+
"priority": 1,
|
|
16
|
+
"remote_path": "/path/on/remote",
|
|
17
|
+
"remote_server_id": 1,
|
|
18
|
+
"remote_server_mount_id": 1,
|
|
19
|
+
"rise": 1,
|
|
20
|
+
"status": "healthy",
|
|
21
|
+
"undergoing_maintenance": true
|
|
22
|
+
}
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
* `canary_file_path` (string): Path to the canary file used for health checks.
|
|
26
|
+
* `enabled` (boolean): True if this backend is enabled.
|
|
27
|
+
* `fall` (int64): Number of consecutive failures before considering the backend unhealthy.
|
|
28
|
+
* `health_check_enabled` (boolean): True if health checks are enabled for this backend.
|
|
29
|
+
* `health_check_type` (string): Type of health check to perform.
|
|
30
|
+
* `interval` (int64): Interval in seconds between health checks.
|
|
31
|
+
* `min_free_cpu` (double): Minimum free CPU percentage required for this backend to be considered healthy.
|
|
32
|
+
* `min_free_mem` (double): Minimum free memory percentage required for this backend to be considered healthy.
|
|
33
|
+
* `priority` (int64): Priority of this backend.
|
|
34
|
+
* `remote_path` (string): Path on the remote server to treat as the root of this mount.
|
|
35
|
+
* `remote_server_id` (int64): The remote server that this backend is associated with.
|
|
36
|
+
* `remote_server_mount_id` (int64): The mount ID of the Remote Server Mount that this backend is associated with.
|
|
37
|
+
* `rise` (int64): Number of consecutive successes before considering the backend healthy.
|
|
38
|
+
* `status` (string): Status of this backend.
|
|
39
|
+
* `undergoing_maintenance` (boolean): True if this backend is undergoing maintenance.
|
|
40
|
+
* `id` (int64): Remote Mount Backend ID.
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## List Remote Mount Backends
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
await RemoteMountBackend.list
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
### Parameters
|
|
52
|
+
|
|
53
|
+
* `cursor` (string): Used for pagination. When a list request has more records available, cursors are provided in the response headers `X-Files-Cursor-Next` and `X-Files-Cursor-Prev`. Send one of those cursor value here to resume an existing list from the next available record. Note: many of our SDKs have iterator methods that will automatically handle cursor-based pagination.
|
|
54
|
+
* `per_page` (int64): Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## Show Remote Mount Backend
|
|
59
|
+
|
|
60
|
+
```
|
|
61
|
+
await RemoteMountBackend.find(id)
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
### Parameters
|
|
66
|
+
|
|
67
|
+
* `id` (int64): Required - Remote Mount Backend ID.
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## Create Remote Mount Backend
|
|
72
|
+
|
|
73
|
+
```
|
|
74
|
+
await RemoteMountBackend.create({
|
|
75
|
+
'canary_file_path': "backend1.txt",
|
|
76
|
+
'remote_server_mount_id': 1,
|
|
77
|
+
'remote_server_id': 1,
|
|
78
|
+
'enabled': true,
|
|
79
|
+
'fall': 1,
|
|
80
|
+
'health_check_enabled': true,
|
|
81
|
+
'health_check_type': "active",
|
|
82
|
+
'interval': 60,
|
|
83
|
+
'min_free_cpu': 1.0,
|
|
84
|
+
'min_free_mem': 1.0,
|
|
85
|
+
'priority': 1,
|
|
86
|
+
'remote_path': "/path/on/remote",
|
|
87
|
+
'rise': 1,
|
|
88
|
+
})
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
### Parameters
|
|
93
|
+
|
|
94
|
+
* `canary_file_path` (string): Required - Path to the canary file used for health checks.
|
|
95
|
+
* `remote_server_mount_id` (int64): Required - The mount ID of the Remote Server Mount that this backend is associated with.
|
|
96
|
+
* `remote_server_id` (int64): Required - The remote server that this backend is associated with.
|
|
97
|
+
* `enabled` (boolean): True if this backend is enabled.
|
|
98
|
+
* `fall` (int64): Number of consecutive failures before considering the backend unhealthy.
|
|
99
|
+
* `health_check_enabled` (boolean): True if health checks are enabled for this backend.
|
|
100
|
+
* `health_check_type` (string): Type of health check to perform.
|
|
101
|
+
* `interval` (int64): Interval in seconds between health checks.
|
|
102
|
+
* `min_free_cpu` (double): Minimum free CPU percentage required for this backend to be considered healthy.
|
|
103
|
+
* `min_free_mem` (double): Minimum free memory percentage required for this backend to be considered healthy.
|
|
104
|
+
* `priority` (int64): Priority of this backend.
|
|
105
|
+
* `remote_path` (string): Path on the remote server to treat as the root of this mount.
|
|
106
|
+
* `rise` (int64): Number of consecutive successes before considering the backend healthy.
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
## Reset backend status to healthy
|
|
111
|
+
|
|
112
|
+
```
|
|
113
|
+
const remote_mount_backend = await RemoteMountBackend.find(id)
|
|
114
|
+
|
|
115
|
+
await remote_mount_backend.reset_status()
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### Parameters
|
|
119
|
+
|
|
120
|
+
* `id` (int64): Required - Remote Mount Backend ID.
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
## Update Remote Mount Backend
|
|
126
|
+
|
|
127
|
+
```
|
|
128
|
+
const remote_mount_backend = await RemoteMountBackend.find(id)
|
|
129
|
+
|
|
130
|
+
await remote_mount_backend.update({
|
|
131
|
+
'canary_file_path': "backend1.txt",
|
|
132
|
+
'remote_server_mount_id': 1,
|
|
133
|
+
'remote_server_id': 1,
|
|
134
|
+
'enabled': true,
|
|
135
|
+
'fall': 1,
|
|
136
|
+
'health_check_enabled': true,
|
|
137
|
+
'health_check_type': "active",
|
|
138
|
+
'interval': 60,
|
|
139
|
+
'min_free_cpu': 1.0,
|
|
140
|
+
'min_free_mem': 1.0,
|
|
141
|
+
'priority': 1,
|
|
142
|
+
'remote_path': "/path/on/remote",
|
|
143
|
+
'rise': 1,
|
|
144
|
+
})
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### Parameters
|
|
148
|
+
|
|
149
|
+
* `id` (int64): Required - Remote Mount Backend ID.
|
|
150
|
+
* `canary_file_path` (string): Required - Path to the canary file used for health checks.
|
|
151
|
+
* `remote_server_mount_id` (int64): Required - The mount ID of the Remote Server Mount that this backend is associated with.
|
|
152
|
+
* `remote_server_id` (int64): Required - The remote server that this backend is associated with.
|
|
153
|
+
* `enabled` (boolean): True if this backend is enabled.
|
|
154
|
+
* `fall` (int64): Number of consecutive failures before considering the backend unhealthy.
|
|
155
|
+
* `health_check_enabled` (boolean): True if health checks are enabled for this backend.
|
|
156
|
+
* `health_check_type` (string): Type of health check to perform.
|
|
157
|
+
* `interval` (int64): Interval in seconds between health checks.
|
|
158
|
+
* `min_free_cpu` (double): Minimum free CPU percentage required for this backend to be considered healthy.
|
|
159
|
+
* `min_free_mem` (double): Minimum free memory percentage required for this backend to be considered healthy.
|
|
160
|
+
* `priority` (int64): Priority of this backend.
|
|
161
|
+
* `remote_path` (string): Path on the remote server to treat as the root of this mount.
|
|
162
|
+
* `rise` (int64): Number of consecutive successes before considering the backend healthy.
|
|
163
|
+
|
|
164
|
+
### Example Response
|
|
165
|
+
|
|
166
|
+
```json
|
|
167
|
+
{
|
|
168
|
+
"canary_file_path": "backend1.txt",
|
|
169
|
+
"enabled": true,
|
|
170
|
+
"fall": 1,
|
|
171
|
+
"health_check_enabled": true,
|
|
172
|
+
"health_check_type": "active",
|
|
173
|
+
"interval": 60,
|
|
174
|
+
"min_free_cpu": 1.0,
|
|
175
|
+
"min_free_mem": 1.0,
|
|
176
|
+
"priority": 1,
|
|
177
|
+
"remote_path": "/path/on/remote",
|
|
178
|
+
"remote_server_id": 1,
|
|
179
|
+
"remote_server_mount_id": 1,
|
|
180
|
+
"rise": 1,
|
|
181
|
+
"status": "healthy",
|
|
182
|
+
"undergoing_maintenance": true
|
|
183
|
+
}
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
---
|
|
187
|
+
|
|
188
|
+
## Delete Remote Mount Backend
|
|
189
|
+
|
|
190
|
+
```
|
|
191
|
+
const remote_mount_backend = await RemoteMountBackend.find(id)
|
|
192
|
+
|
|
193
|
+
await remote_mount_backend.delete()
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
### Parameters
|
|
197
|
+
|
|
198
|
+
* `id` (int64): Required - Remote Mount Backend ID.
|
|
199
|
+
|
package/lib/Files.js
CHANGED
|
@@ -12,7 +12,7 @@ var apiKey;
|
|
|
12
12
|
var baseUrl = 'https://app.files.com';
|
|
13
13
|
var sessionId = null;
|
|
14
14
|
var language = null;
|
|
15
|
-
var version = '1.2.
|
|
15
|
+
var version = '1.2.265';
|
|
16
16
|
var userAgent = "Files.com JavaScript SDK v".concat(version);
|
|
17
17
|
var logLevel = _Logger.LogLevel.INFO;
|
|
18
18
|
var debugRequest = false;
|
|
@@ -0,0 +1,657 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
|
+
exports.__esModule = true;
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
8
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
9
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
10
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
11
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
12
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
13
|
+
var _Api = _interopRequireDefault(require("../Api"));
|
|
14
|
+
var errors = _interopRequireWildcard(require("../Errors"));
|
|
15
|
+
var _utils = require("../utils");
|
|
16
|
+
var _RemoteMountBackend;
|
|
17
|
+
/* eslint-disable no-unused-vars */
|
|
18
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
19
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
20
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
21
|
+
/* eslint-enable no-unused-vars */
|
|
22
|
+
/**
|
|
23
|
+
* Class RemoteMountBackend
|
|
24
|
+
*/
|
|
25
|
+
var RemoteMountBackend = /*#__PURE__*/(0, _createClass2.default)(function RemoteMountBackend() {
|
|
26
|
+
var _this = this;
|
|
27
|
+
var attributes = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
28
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
29
|
+
(0, _classCallCheck2.default)(this, RemoteMountBackend);
|
|
30
|
+
(0, _defineProperty2.default)(this, "attributes", {});
|
|
31
|
+
(0, _defineProperty2.default)(this, "options", {});
|
|
32
|
+
(0, _defineProperty2.default)(this, "isLoaded", function () {
|
|
33
|
+
return !!_this.attributes.id;
|
|
34
|
+
});
|
|
35
|
+
// string # Path to the canary file used for health checks.
|
|
36
|
+
(0, _defineProperty2.default)(this, "getCanaryFilePath", function () {
|
|
37
|
+
return _this.attributes.canary_file_path;
|
|
38
|
+
});
|
|
39
|
+
(0, _defineProperty2.default)(this, "setCanaryFilePath", function (value) {
|
|
40
|
+
_this.attributes.canary_file_path = value;
|
|
41
|
+
});
|
|
42
|
+
// boolean # True if this backend is enabled.
|
|
43
|
+
(0, _defineProperty2.default)(this, "getEnabled", function () {
|
|
44
|
+
return _this.attributes.enabled;
|
|
45
|
+
});
|
|
46
|
+
(0, _defineProperty2.default)(this, "setEnabled", function (value) {
|
|
47
|
+
_this.attributes.enabled = value;
|
|
48
|
+
});
|
|
49
|
+
// int64 # Number of consecutive failures before considering the backend unhealthy.
|
|
50
|
+
(0, _defineProperty2.default)(this, "getFall", function () {
|
|
51
|
+
return _this.attributes.fall;
|
|
52
|
+
});
|
|
53
|
+
(0, _defineProperty2.default)(this, "setFall", function (value) {
|
|
54
|
+
_this.attributes.fall = value;
|
|
55
|
+
});
|
|
56
|
+
// boolean # True if health checks are enabled for this backend.
|
|
57
|
+
(0, _defineProperty2.default)(this, "getHealthCheckEnabled", function () {
|
|
58
|
+
return _this.attributes.health_check_enabled;
|
|
59
|
+
});
|
|
60
|
+
(0, _defineProperty2.default)(this, "setHealthCheckEnabled", function (value) {
|
|
61
|
+
_this.attributes.health_check_enabled = value;
|
|
62
|
+
});
|
|
63
|
+
// string # Type of health check to perform.
|
|
64
|
+
(0, _defineProperty2.default)(this, "getHealthCheckType", function () {
|
|
65
|
+
return _this.attributes.health_check_type;
|
|
66
|
+
});
|
|
67
|
+
(0, _defineProperty2.default)(this, "setHealthCheckType", function (value) {
|
|
68
|
+
_this.attributes.health_check_type = value;
|
|
69
|
+
});
|
|
70
|
+
// int64 # Interval in seconds between health checks.
|
|
71
|
+
(0, _defineProperty2.default)(this, "getInterval", function () {
|
|
72
|
+
return _this.attributes.interval;
|
|
73
|
+
});
|
|
74
|
+
(0, _defineProperty2.default)(this, "setInterval", function (value) {
|
|
75
|
+
_this.attributes.interval = value;
|
|
76
|
+
});
|
|
77
|
+
// double # Minimum free CPU percentage required for this backend to be considered healthy.
|
|
78
|
+
(0, _defineProperty2.default)(this, "getMinFreeCpu", function () {
|
|
79
|
+
return _this.attributes.min_free_cpu;
|
|
80
|
+
});
|
|
81
|
+
(0, _defineProperty2.default)(this, "setMinFreeCpu", function (value) {
|
|
82
|
+
_this.attributes.min_free_cpu = value;
|
|
83
|
+
});
|
|
84
|
+
// double # Minimum free memory percentage required for this backend to be considered healthy.
|
|
85
|
+
(0, _defineProperty2.default)(this, "getMinFreeMem", function () {
|
|
86
|
+
return _this.attributes.min_free_mem;
|
|
87
|
+
});
|
|
88
|
+
(0, _defineProperty2.default)(this, "setMinFreeMem", function (value) {
|
|
89
|
+
_this.attributes.min_free_mem = value;
|
|
90
|
+
});
|
|
91
|
+
// int64 # Priority of this backend.
|
|
92
|
+
(0, _defineProperty2.default)(this, "getPriority", function () {
|
|
93
|
+
return _this.attributes.priority;
|
|
94
|
+
});
|
|
95
|
+
(0, _defineProperty2.default)(this, "setPriority", function (value) {
|
|
96
|
+
_this.attributes.priority = value;
|
|
97
|
+
});
|
|
98
|
+
// string # Path on the remote server to treat as the root of this mount.
|
|
99
|
+
(0, _defineProperty2.default)(this, "getRemotePath", function () {
|
|
100
|
+
return _this.attributes.remote_path;
|
|
101
|
+
});
|
|
102
|
+
(0, _defineProperty2.default)(this, "setRemotePath", function (value) {
|
|
103
|
+
_this.attributes.remote_path = value;
|
|
104
|
+
});
|
|
105
|
+
// int64 # The remote server that this backend is associated with.
|
|
106
|
+
(0, _defineProperty2.default)(this, "getRemoteServerId", function () {
|
|
107
|
+
return _this.attributes.remote_server_id;
|
|
108
|
+
});
|
|
109
|
+
(0, _defineProperty2.default)(this, "setRemoteServerId", function (value) {
|
|
110
|
+
_this.attributes.remote_server_id = value;
|
|
111
|
+
});
|
|
112
|
+
// int64 # The mount ID of the Remote Server Mount that this backend is associated with.
|
|
113
|
+
(0, _defineProperty2.default)(this, "getRemoteServerMountId", function () {
|
|
114
|
+
return _this.attributes.remote_server_mount_id;
|
|
115
|
+
});
|
|
116
|
+
(0, _defineProperty2.default)(this, "setRemoteServerMountId", function (value) {
|
|
117
|
+
_this.attributes.remote_server_mount_id = value;
|
|
118
|
+
});
|
|
119
|
+
// int64 # Number of consecutive successes before considering the backend healthy.
|
|
120
|
+
(0, _defineProperty2.default)(this, "getRise", function () {
|
|
121
|
+
return _this.attributes.rise;
|
|
122
|
+
});
|
|
123
|
+
(0, _defineProperty2.default)(this, "setRise", function (value) {
|
|
124
|
+
_this.attributes.rise = value;
|
|
125
|
+
});
|
|
126
|
+
// string # Status of this backend.
|
|
127
|
+
(0, _defineProperty2.default)(this, "getStatus", function () {
|
|
128
|
+
return _this.attributes.status;
|
|
129
|
+
});
|
|
130
|
+
(0, _defineProperty2.default)(this, "setStatus", function (value) {
|
|
131
|
+
_this.attributes.status = value;
|
|
132
|
+
});
|
|
133
|
+
// boolean # True if this backend is undergoing maintenance.
|
|
134
|
+
(0, _defineProperty2.default)(this, "getUndergoingMaintenance", function () {
|
|
135
|
+
return _this.attributes.undergoing_maintenance;
|
|
136
|
+
});
|
|
137
|
+
(0, _defineProperty2.default)(this, "setUndergoingMaintenance", function (value) {
|
|
138
|
+
_this.attributes.undergoing_maintenance = value;
|
|
139
|
+
});
|
|
140
|
+
// int64 # Remote Mount Backend ID.
|
|
141
|
+
(0, _defineProperty2.default)(this, "getId", function () {
|
|
142
|
+
return _this.attributes.id;
|
|
143
|
+
});
|
|
144
|
+
(0, _defineProperty2.default)(this, "setId", function (value) {
|
|
145
|
+
_this.attributes.id = value;
|
|
146
|
+
});
|
|
147
|
+
// Reset backend status to healthy
|
|
148
|
+
(0, _defineProperty2.default)(this, "resetStatus", /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
149
|
+
var params,
|
|
150
|
+
_args = arguments;
|
|
151
|
+
return _regenerator.default.wrap(function (_context) {
|
|
152
|
+
while (1) switch (_context.prev = _context.next) {
|
|
153
|
+
case 0:
|
|
154
|
+
params = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
|
|
155
|
+
if (_this.attributes.id) {
|
|
156
|
+
_context.next = 1;
|
|
157
|
+
break;
|
|
158
|
+
}
|
|
159
|
+
throw new errors.EmptyPropertyError('Current object has no id');
|
|
160
|
+
case 1:
|
|
161
|
+
if ((0, _utils.isObject)(params)) {
|
|
162
|
+
_context.next = 2;
|
|
163
|
+
break;
|
|
164
|
+
}
|
|
165
|
+
throw new errors.InvalidParameterError("Bad parameter: params must be of type object, received ".concat((0, _utils.getType)(params)));
|
|
166
|
+
case 2:
|
|
167
|
+
params.id = _this.attributes.id;
|
|
168
|
+
if (!(params.id && !(0, _utils.isInt)(params.id))) {
|
|
169
|
+
_context.next = 3;
|
|
170
|
+
break;
|
|
171
|
+
}
|
|
172
|
+
throw new errors.InvalidParameterError("Bad parameter: id must be of type Int, received ".concat((0, _utils.getType)(params.id)));
|
|
173
|
+
case 3:
|
|
174
|
+
if (params.id) {
|
|
175
|
+
_context.next = 5;
|
|
176
|
+
break;
|
|
177
|
+
}
|
|
178
|
+
if (!_this.attributes.id) {
|
|
179
|
+
_context.next = 4;
|
|
180
|
+
break;
|
|
181
|
+
}
|
|
182
|
+
params.id = _this.id;
|
|
183
|
+
_context.next = 5;
|
|
184
|
+
break;
|
|
185
|
+
case 4:
|
|
186
|
+
throw new errors.MissingParameterError('Parameter missing: id');
|
|
187
|
+
case 5:
|
|
188
|
+
_context.next = 6;
|
|
189
|
+
return _Api.default.sendRequest("/remote_mount_backends/".concat(encodeURIComponent(params.id), "/reset_status"), 'POST', params, _this.options);
|
|
190
|
+
case 6:
|
|
191
|
+
case "end":
|
|
192
|
+
return _context.stop();
|
|
193
|
+
}
|
|
194
|
+
}, _callee);
|
|
195
|
+
})));
|
|
196
|
+
// Parameters:
|
|
197
|
+
// canary_file_path (required) - string - Path to the canary file used for health checks.
|
|
198
|
+
// remote_server_mount_id (required) - int64 - The mount ID of the Remote Server Mount that this backend is associated with.
|
|
199
|
+
// remote_server_id (required) - int64 - The remote server that this backend is associated with.
|
|
200
|
+
// enabled - boolean - True if this backend is enabled.
|
|
201
|
+
// fall - int64 - Number of consecutive failures before considering the backend unhealthy.
|
|
202
|
+
// health_check_enabled - boolean - True if health checks are enabled for this backend.
|
|
203
|
+
// health_check_type - string - Type of health check to perform.
|
|
204
|
+
// interval - int64 - Interval in seconds between health checks.
|
|
205
|
+
// min_free_cpu - double - Minimum free CPU percentage required for this backend to be considered healthy.
|
|
206
|
+
// min_free_mem - double - Minimum free memory percentage required for this backend to be considered healthy.
|
|
207
|
+
// priority - int64 - Priority of this backend.
|
|
208
|
+
// remote_path - string - Path on the remote server to treat as the root of this mount.
|
|
209
|
+
// rise - int64 - Number of consecutive successes before considering the backend healthy.
|
|
210
|
+
(0, _defineProperty2.default)(this, "update", /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
|
211
|
+
var params,
|
|
212
|
+
response,
|
|
213
|
+
_args2 = arguments;
|
|
214
|
+
return _regenerator.default.wrap(function (_context2) {
|
|
215
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
216
|
+
case 0:
|
|
217
|
+
params = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : {};
|
|
218
|
+
if (_this.attributes.id) {
|
|
219
|
+
_context2.next = 1;
|
|
220
|
+
break;
|
|
221
|
+
}
|
|
222
|
+
throw new errors.EmptyPropertyError('Current object has no id');
|
|
223
|
+
case 1:
|
|
224
|
+
if ((0, _utils.isObject)(params)) {
|
|
225
|
+
_context2.next = 2;
|
|
226
|
+
break;
|
|
227
|
+
}
|
|
228
|
+
throw new errors.InvalidParameterError("Bad parameter: params must be of type object, received ".concat((0, _utils.getType)(params)));
|
|
229
|
+
case 2:
|
|
230
|
+
params.id = _this.attributes.id;
|
|
231
|
+
if (!(params.id && !(0, _utils.isInt)(params.id))) {
|
|
232
|
+
_context2.next = 3;
|
|
233
|
+
break;
|
|
234
|
+
}
|
|
235
|
+
throw new errors.InvalidParameterError("Bad parameter: id must be of type Int, received ".concat((0, _utils.getType)(params.id)));
|
|
236
|
+
case 3:
|
|
237
|
+
if (!(params.canary_file_path && !(0, _utils.isString)(params.canary_file_path))) {
|
|
238
|
+
_context2.next = 4;
|
|
239
|
+
break;
|
|
240
|
+
}
|
|
241
|
+
throw new errors.InvalidParameterError("Bad parameter: canary_file_path must be of type String, received ".concat((0, _utils.getType)(params.canary_file_path)));
|
|
242
|
+
case 4:
|
|
243
|
+
if (!(params.remote_server_mount_id && !(0, _utils.isInt)(params.remote_server_mount_id))) {
|
|
244
|
+
_context2.next = 5;
|
|
245
|
+
break;
|
|
246
|
+
}
|
|
247
|
+
throw new errors.InvalidParameterError("Bad parameter: remote_server_mount_id must be of type Int, received ".concat((0, _utils.getType)(params.remote_server_mount_id)));
|
|
248
|
+
case 5:
|
|
249
|
+
if (!(params.remote_server_id && !(0, _utils.isInt)(params.remote_server_id))) {
|
|
250
|
+
_context2.next = 6;
|
|
251
|
+
break;
|
|
252
|
+
}
|
|
253
|
+
throw new errors.InvalidParameterError("Bad parameter: remote_server_id must be of type Int, received ".concat((0, _utils.getType)(params.remote_server_id)));
|
|
254
|
+
case 6:
|
|
255
|
+
if (!(params.fall && !(0, _utils.isInt)(params.fall))) {
|
|
256
|
+
_context2.next = 7;
|
|
257
|
+
break;
|
|
258
|
+
}
|
|
259
|
+
throw new errors.InvalidParameterError("Bad parameter: fall must be of type Int, received ".concat((0, _utils.getType)(params.fall)));
|
|
260
|
+
case 7:
|
|
261
|
+
if (!(params.health_check_type && !(0, _utils.isString)(params.health_check_type))) {
|
|
262
|
+
_context2.next = 8;
|
|
263
|
+
break;
|
|
264
|
+
}
|
|
265
|
+
throw new errors.InvalidParameterError("Bad parameter: health_check_type must be of type String, received ".concat((0, _utils.getType)(params.health_check_type)));
|
|
266
|
+
case 8:
|
|
267
|
+
if (!(params.interval && !(0, _utils.isInt)(params.interval))) {
|
|
268
|
+
_context2.next = 9;
|
|
269
|
+
break;
|
|
270
|
+
}
|
|
271
|
+
throw new errors.InvalidParameterError("Bad parameter: interval must be of type Int, received ".concat((0, _utils.getType)(params.interval)));
|
|
272
|
+
case 9:
|
|
273
|
+
if (!(params.priority && !(0, _utils.isInt)(params.priority))) {
|
|
274
|
+
_context2.next = 10;
|
|
275
|
+
break;
|
|
276
|
+
}
|
|
277
|
+
throw new errors.InvalidParameterError("Bad parameter: priority must be of type Int, received ".concat((0, _utils.getType)(params.priority)));
|
|
278
|
+
case 10:
|
|
279
|
+
if (!(params.remote_path && !(0, _utils.isString)(params.remote_path))) {
|
|
280
|
+
_context2.next = 11;
|
|
281
|
+
break;
|
|
282
|
+
}
|
|
283
|
+
throw new errors.InvalidParameterError("Bad parameter: remote_path must be of type String, received ".concat((0, _utils.getType)(params.remote_path)));
|
|
284
|
+
case 11:
|
|
285
|
+
if (!(params.rise && !(0, _utils.isInt)(params.rise))) {
|
|
286
|
+
_context2.next = 12;
|
|
287
|
+
break;
|
|
288
|
+
}
|
|
289
|
+
throw new errors.InvalidParameterError("Bad parameter: rise must be of type Int, received ".concat((0, _utils.getType)(params.rise)));
|
|
290
|
+
case 12:
|
|
291
|
+
if (params.id) {
|
|
292
|
+
_context2.next = 14;
|
|
293
|
+
break;
|
|
294
|
+
}
|
|
295
|
+
if (!_this.attributes.id) {
|
|
296
|
+
_context2.next = 13;
|
|
297
|
+
break;
|
|
298
|
+
}
|
|
299
|
+
params.id = _this.id;
|
|
300
|
+
_context2.next = 14;
|
|
301
|
+
break;
|
|
302
|
+
case 13:
|
|
303
|
+
throw new errors.MissingParameterError('Parameter missing: id');
|
|
304
|
+
case 14:
|
|
305
|
+
if (params.canary_file_path) {
|
|
306
|
+
_context2.next = 16;
|
|
307
|
+
break;
|
|
308
|
+
}
|
|
309
|
+
if (!_this.attributes.canary_file_path) {
|
|
310
|
+
_context2.next = 15;
|
|
311
|
+
break;
|
|
312
|
+
}
|
|
313
|
+
params.canary_file_path = _this.canary_file_path;
|
|
314
|
+
_context2.next = 16;
|
|
315
|
+
break;
|
|
316
|
+
case 15:
|
|
317
|
+
throw new errors.MissingParameterError('Parameter missing: canary_file_path');
|
|
318
|
+
case 16:
|
|
319
|
+
if (params.remote_server_mount_id) {
|
|
320
|
+
_context2.next = 18;
|
|
321
|
+
break;
|
|
322
|
+
}
|
|
323
|
+
if (!_this.attributes.remote_server_mount_id) {
|
|
324
|
+
_context2.next = 17;
|
|
325
|
+
break;
|
|
326
|
+
}
|
|
327
|
+
params.remote_server_mount_id = _this.remote_server_mount_id;
|
|
328
|
+
_context2.next = 18;
|
|
329
|
+
break;
|
|
330
|
+
case 17:
|
|
331
|
+
throw new errors.MissingParameterError('Parameter missing: remote_server_mount_id');
|
|
332
|
+
case 18:
|
|
333
|
+
if (params.remote_server_id) {
|
|
334
|
+
_context2.next = 20;
|
|
335
|
+
break;
|
|
336
|
+
}
|
|
337
|
+
if (!_this.attributes.remote_server_id) {
|
|
338
|
+
_context2.next = 19;
|
|
339
|
+
break;
|
|
340
|
+
}
|
|
341
|
+
params.remote_server_id = _this.remote_server_id;
|
|
342
|
+
_context2.next = 20;
|
|
343
|
+
break;
|
|
344
|
+
case 19:
|
|
345
|
+
throw new errors.MissingParameterError('Parameter missing: remote_server_id');
|
|
346
|
+
case 20:
|
|
347
|
+
_context2.next = 21;
|
|
348
|
+
return _Api.default.sendRequest("/remote_mount_backends/".concat(encodeURIComponent(params.id)), 'PATCH', params, _this.options);
|
|
349
|
+
case 21:
|
|
350
|
+
response = _context2.sent;
|
|
351
|
+
return _context2.abrupt("return", new RemoteMountBackend(response === null || response === void 0 ? void 0 : response.data, _this.options));
|
|
352
|
+
case 22:
|
|
353
|
+
case "end":
|
|
354
|
+
return _context2.stop();
|
|
355
|
+
}
|
|
356
|
+
}, _callee2);
|
|
357
|
+
})));
|
|
358
|
+
(0, _defineProperty2.default)(this, "delete", /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee3() {
|
|
359
|
+
var params,
|
|
360
|
+
_args3 = arguments;
|
|
361
|
+
return _regenerator.default.wrap(function (_context3) {
|
|
362
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
363
|
+
case 0:
|
|
364
|
+
params = _args3.length > 0 && _args3[0] !== undefined ? _args3[0] : {};
|
|
365
|
+
if (_this.attributes.id) {
|
|
366
|
+
_context3.next = 1;
|
|
367
|
+
break;
|
|
368
|
+
}
|
|
369
|
+
throw new errors.EmptyPropertyError('Current object has no id');
|
|
370
|
+
case 1:
|
|
371
|
+
if ((0, _utils.isObject)(params)) {
|
|
372
|
+
_context3.next = 2;
|
|
373
|
+
break;
|
|
374
|
+
}
|
|
375
|
+
throw new errors.InvalidParameterError("Bad parameter: params must be of type object, received ".concat((0, _utils.getType)(params)));
|
|
376
|
+
case 2:
|
|
377
|
+
params.id = _this.attributes.id;
|
|
378
|
+
if (!(params.id && !(0, _utils.isInt)(params.id))) {
|
|
379
|
+
_context3.next = 3;
|
|
380
|
+
break;
|
|
381
|
+
}
|
|
382
|
+
throw new errors.InvalidParameterError("Bad parameter: id must be of type Int, received ".concat((0, _utils.getType)(params.id)));
|
|
383
|
+
case 3:
|
|
384
|
+
if (params.id) {
|
|
385
|
+
_context3.next = 5;
|
|
386
|
+
break;
|
|
387
|
+
}
|
|
388
|
+
if (!_this.attributes.id) {
|
|
389
|
+
_context3.next = 4;
|
|
390
|
+
break;
|
|
391
|
+
}
|
|
392
|
+
params.id = _this.id;
|
|
393
|
+
_context3.next = 5;
|
|
394
|
+
break;
|
|
395
|
+
case 4:
|
|
396
|
+
throw new errors.MissingParameterError('Parameter missing: id');
|
|
397
|
+
case 5:
|
|
398
|
+
_context3.next = 6;
|
|
399
|
+
return _Api.default.sendRequest("/remote_mount_backends/".concat(encodeURIComponent(params.id)), 'DELETE', params, _this.options);
|
|
400
|
+
case 6:
|
|
401
|
+
case "end":
|
|
402
|
+
return _context3.stop();
|
|
403
|
+
}
|
|
404
|
+
}, _callee3);
|
|
405
|
+
})));
|
|
406
|
+
(0, _defineProperty2.default)(this, "destroy", function () {
|
|
407
|
+
var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
408
|
+
return _this.delete(params);
|
|
409
|
+
});
|
|
410
|
+
(0, _defineProperty2.default)(this, "save", /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee4() {
|
|
411
|
+
var _newObject, newObject;
|
|
412
|
+
return _regenerator.default.wrap(function (_context4) {
|
|
413
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
414
|
+
case 0:
|
|
415
|
+
if (!_this.attributes.id) {
|
|
416
|
+
_context4.next = 2;
|
|
417
|
+
break;
|
|
418
|
+
}
|
|
419
|
+
_context4.next = 1;
|
|
420
|
+
return _this.update(_this.attributes);
|
|
421
|
+
case 1:
|
|
422
|
+
_newObject = _context4.sent;
|
|
423
|
+
_this.attributes = _objectSpread({}, _newObject.attributes);
|
|
424
|
+
return _context4.abrupt("return", true);
|
|
425
|
+
case 2:
|
|
426
|
+
_context4.next = 3;
|
|
427
|
+
return RemoteMountBackend.create(_this.attributes, _this.options);
|
|
428
|
+
case 3:
|
|
429
|
+
newObject = _context4.sent;
|
|
430
|
+
_this.attributes = _objectSpread({}, newObject.attributes);
|
|
431
|
+
return _context4.abrupt("return", true);
|
|
432
|
+
case 4:
|
|
433
|
+
case "end":
|
|
434
|
+
return _context4.stop();
|
|
435
|
+
}
|
|
436
|
+
}, _callee4);
|
|
437
|
+
})));
|
|
438
|
+
Object.entries(attributes).forEach(function (_ref5) {
|
|
439
|
+
var _ref6 = (0, _slicedToArray2.default)(_ref5, 2),
|
|
440
|
+
key = _ref6[0],
|
|
441
|
+
value = _ref6[1];
|
|
442
|
+
var normalizedKey = key.replace('?', '');
|
|
443
|
+
_this.attributes[normalizedKey] = value;
|
|
444
|
+
Object.defineProperty(_this, normalizedKey, {
|
|
445
|
+
value: value,
|
|
446
|
+
writable: false
|
|
447
|
+
});
|
|
448
|
+
});
|
|
449
|
+
this.options = _objectSpread({}, options);
|
|
450
|
+
});
|
|
451
|
+
_RemoteMountBackend = RemoteMountBackend;
|
|
452
|
+
// Parameters:
|
|
453
|
+
// cursor - string - Used for pagination. When a list request has more records available, cursors are provided in the response headers `X-Files-Cursor-Next` and `X-Files-Cursor-Prev`. Send one of those cursor value here to resume an existing list from the next available record. Note: many of our SDKs have iterator methods that will automatically handle cursor-based pagination.
|
|
454
|
+
// per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
|
|
455
|
+
(0, _defineProperty2.default)(RemoteMountBackend, "list", /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee5() {
|
|
456
|
+
var _response$data;
|
|
457
|
+
var params,
|
|
458
|
+
options,
|
|
459
|
+
response,
|
|
460
|
+
_args5 = arguments;
|
|
461
|
+
return _regenerator.default.wrap(function (_context5) {
|
|
462
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
463
|
+
case 0:
|
|
464
|
+
params = _args5.length > 0 && _args5[0] !== undefined ? _args5[0] : {};
|
|
465
|
+
options = _args5.length > 1 && _args5[1] !== undefined ? _args5[1] : {};
|
|
466
|
+
if (!(params.cursor && !(0, _utils.isString)(params.cursor))) {
|
|
467
|
+
_context5.next = 1;
|
|
468
|
+
break;
|
|
469
|
+
}
|
|
470
|
+
throw new errors.InvalidParameterError("Bad parameter: cursor must be of type String, received ".concat((0, _utils.getType)(params.cursor)));
|
|
471
|
+
case 1:
|
|
472
|
+
if (!(params.per_page && !(0, _utils.isInt)(params.per_page))) {
|
|
473
|
+
_context5.next = 2;
|
|
474
|
+
break;
|
|
475
|
+
}
|
|
476
|
+
throw new errors.InvalidParameterError("Bad parameter: per_page must be of type Int, received ".concat((0, _utils.getType)(params.per_page)));
|
|
477
|
+
case 2:
|
|
478
|
+
_context5.next = 3;
|
|
479
|
+
return _Api.default.sendRequest('/remote_mount_backends', 'GET', params, options);
|
|
480
|
+
case 3:
|
|
481
|
+
response = _context5.sent;
|
|
482
|
+
return _context5.abrupt("return", (response === null || response === void 0 || (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.map(function (obj) {
|
|
483
|
+
return new _RemoteMountBackend(obj, options);
|
|
484
|
+
})) || []);
|
|
485
|
+
case 4:
|
|
486
|
+
case "end":
|
|
487
|
+
return _context5.stop();
|
|
488
|
+
}
|
|
489
|
+
}, _callee5);
|
|
490
|
+
})));
|
|
491
|
+
(0, _defineProperty2.default)(RemoteMountBackend, "all", function () {
|
|
492
|
+
var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
493
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
494
|
+
return _RemoteMountBackend.list(params, options);
|
|
495
|
+
});
|
|
496
|
+
// Parameters:
|
|
497
|
+
// id (required) - int64 - Remote Mount Backend ID.
|
|
498
|
+
(0, _defineProperty2.default)(RemoteMountBackend, "find", /*#__PURE__*/function () {
|
|
499
|
+
var _ref8 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee6(id) {
|
|
500
|
+
var params,
|
|
501
|
+
options,
|
|
502
|
+
response,
|
|
503
|
+
_args6 = arguments;
|
|
504
|
+
return _regenerator.default.wrap(function (_context6) {
|
|
505
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
506
|
+
case 0:
|
|
507
|
+
params = _args6.length > 1 && _args6[1] !== undefined ? _args6[1] : {};
|
|
508
|
+
options = _args6.length > 2 && _args6[2] !== undefined ? _args6[2] : {};
|
|
509
|
+
if ((0, _utils.isObject)(params)) {
|
|
510
|
+
_context6.next = 1;
|
|
511
|
+
break;
|
|
512
|
+
}
|
|
513
|
+
throw new errors.InvalidParameterError("Bad parameter: params must be of type object, received ".concat((0, _utils.getType)(params)));
|
|
514
|
+
case 1:
|
|
515
|
+
params.id = id;
|
|
516
|
+
if (params.id) {
|
|
517
|
+
_context6.next = 2;
|
|
518
|
+
break;
|
|
519
|
+
}
|
|
520
|
+
throw new errors.MissingParameterError('Parameter missing: id');
|
|
521
|
+
case 2:
|
|
522
|
+
if (!(params.id && !(0, _utils.isInt)(params.id))) {
|
|
523
|
+
_context6.next = 3;
|
|
524
|
+
break;
|
|
525
|
+
}
|
|
526
|
+
throw new errors.InvalidParameterError("Bad parameter: id must be of type Int, received ".concat((0, _utils.getType)(params.id)));
|
|
527
|
+
case 3:
|
|
528
|
+
_context6.next = 4;
|
|
529
|
+
return _Api.default.sendRequest("/remote_mount_backends/".concat(encodeURIComponent(params.id)), 'GET', params, options);
|
|
530
|
+
case 4:
|
|
531
|
+
response = _context6.sent;
|
|
532
|
+
return _context6.abrupt("return", new _RemoteMountBackend(response === null || response === void 0 ? void 0 : response.data, options));
|
|
533
|
+
case 5:
|
|
534
|
+
case "end":
|
|
535
|
+
return _context6.stop();
|
|
536
|
+
}
|
|
537
|
+
}, _callee6);
|
|
538
|
+
}));
|
|
539
|
+
return function (_x) {
|
|
540
|
+
return _ref8.apply(this, arguments);
|
|
541
|
+
};
|
|
542
|
+
}());
|
|
543
|
+
(0, _defineProperty2.default)(RemoteMountBackend, "get", function (id) {
|
|
544
|
+
var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
545
|
+
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
546
|
+
return _RemoteMountBackend.find(id, params, options);
|
|
547
|
+
});
|
|
548
|
+
// Parameters:
|
|
549
|
+
// canary_file_path (required) - string - Path to the canary file used for health checks.
|
|
550
|
+
// remote_server_mount_id (required) - int64 - The mount ID of the Remote Server Mount that this backend is associated with.
|
|
551
|
+
// remote_server_id (required) - int64 - The remote server that this backend is associated with.
|
|
552
|
+
// enabled - boolean - True if this backend is enabled.
|
|
553
|
+
// fall - int64 - Number of consecutive failures before considering the backend unhealthy.
|
|
554
|
+
// health_check_enabled - boolean - True if health checks are enabled for this backend.
|
|
555
|
+
// health_check_type - string - Type of health check to perform.
|
|
556
|
+
// interval - int64 - Interval in seconds between health checks.
|
|
557
|
+
// min_free_cpu - double - Minimum free CPU percentage required for this backend to be considered healthy.
|
|
558
|
+
// min_free_mem - double - Minimum free memory percentage required for this backend to be considered healthy.
|
|
559
|
+
// priority - int64 - Priority of this backend.
|
|
560
|
+
// remote_path - string - Path on the remote server to treat as the root of this mount.
|
|
561
|
+
// rise - int64 - Number of consecutive successes before considering the backend healthy.
|
|
562
|
+
(0, _defineProperty2.default)(RemoteMountBackend, "create", /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee7() {
|
|
563
|
+
var params,
|
|
564
|
+
options,
|
|
565
|
+
response,
|
|
566
|
+
_args7 = arguments;
|
|
567
|
+
return _regenerator.default.wrap(function (_context7) {
|
|
568
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
569
|
+
case 0:
|
|
570
|
+
params = _args7.length > 0 && _args7[0] !== undefined ? _args7[0] : {};
|
|
571
|
+
options = _args7.length > 1 && _args7[1] !== undefined ? _args7[1] : {};
|
|
572
|
+
if (params.canary_file_path) {
|
|
573
|
+
_context7.next = 1;
|
|
574
|
+
break;
|
|
575
|
+
}
|
|
576
|
+
throw new errors.MissingParameterError('Parameter missing: canary_file_path');
|
|
577
|
+
case 1:
|
|
578
|
+
if (params.remote_server_mount_id) {
|
|
579
|
+
_context7.next = 2;
|
|
580
|
+
break;
|
|
581
|
+
}
|
|
582
|
+
throw new errors.MissingParameterError('Parameter missing: remote_server_mount_id');
|
|
583
|
+
case 2:
|
|
584
|
+
if (params.remote_server_id) {
|
|
585
|
+
_context7.next = 3;
|
|
586
|
+
break;
|
|
587
|
+
}
|
|
588
|
+
throw new errors.MissingParameterError('Parameter missing: remote_server_id');
|
|
589
|
+
case 3:
|
|
590
|
+
if (!(params.canary_file_path && !(0, _utils.isString)(params.canary_file_path))) {
|
|
591
|
+
_context7.next = 4;
|
|
592
|
+
break;
|
|
593
|
+
}
|
|
594
|
+
throw new errors.InvalidParameterError("Bad parameter: canary_file_path must be of type String, received ".concat((0, _utils.getType)(params.canary_file_path)));
|
|
595
|
+
case 4:
|
|
596
|
+
if (!(params.remote_server_mount_id && !(0, _utils.isInt)(params.remote_server_mount_id))) {
|
|
597
|
+
_context7.next = 5;
|
|
598
|
+
break;
|
|
599
|
+
}
|
|
600
|
+
throw new errors.InvalidParameterError("Bad parameter: remote_server_mount_id must be of type Int, received ".concat((0, _utils.getType)(params.remote_server_mount_id)));
|
|
601
|
+
case 5:
|
|
602
|
+
if (!(params.remote_server_id && !(0, _utils.isInt)(params.remote_server_id))) {
|
|
603
|
+
_context7.next = 6;
|
|
604
|
+
break;
|
|
605
|
+
}
|
|
606
|
+
throw new errors.InvalidParameterError("Bad parameter: remote_server_id must be of type Int, received ".concat((0, _utils.getType)(params.remote_server_id)));
|
|
607
|
+
case 6:
|
|
608
|
+
if (!(params.fall && !(0, _utils.isInt)(params.fall))) {
|
|
609
|
+
_context7.next = 7;
|
|
610
|
+
break;
|
|
611
|
+
}
|
|
612
|
+
throw new errors.InvalidParameterError("Bad parameter: fall must be of type Int, received ".concat((0, _utils.getType)(params.fall)));
|
|
613
|
+
case 7:
|
|
614
|
+
if (!(params.health_check_type && !(0, _utils.isString)(params.health_check_type))) {
|
|
615
|
+
_context7.next = 8;
|
|
616
|
+
break;
|
|
617
|
+
}
|
|
618
|
+
throw new errors.InvalidParameterError("Bad parameter: health_check_type must be of type String, received ".concat((0, _utils.getType)(params.health_check_type)));
|
|
619
|
+
case 8:
|
|
620
|
+
if (!(params.interval && !(0, _utils.isInt)(params.interval))) {
|
|
621
|
+
_context7.next = 9;
|
|
622
|
+
break;
|
|
623
|
+
}
|
|
624
|
+
throw new errors.InvalidParameterError("Bad parameter: interval must be of type Int, received ".concat((0, _utils.getType)(params.interval)));
|
|
625
|
+
case 9:
|
|
626
|
+
if (!(params.priority && !(0, _utils.isInt)(params.priority))) {
|
|
627
|
+
_context7.next = 10;
|
|
628
|
+
break;
|
|
629
|
+
}
|
|
630
|
+
throw new errors.InvalidParameterError("Bad parameter: priority must be of type Int, received ".concat((0, _utils.getType)(params.priority)));
|
|
631
|
+
case 10:
|
|
632
|
+
if (!(params.remote_path && !(0, _utils.isString)(params.remote_path))) {
|
|
633
|
+
_context7.next = 11;
|
|
634
|
+
break;
|
|
635
|
+
}
|
|
636
|
+
throw new errors.InvalidParameterError("Bad parameter: remote_path must be of type String, received ".concat((0, _utils.getType)(params.remote_path)));
|
|
637
|
+
case 11:
|
|
638
|
+
if (!(params.rise && !(0, _utils.isInt)(params.rise))) {
|
|
639
|
+
_context7.next = 12;
|
|
640
|
+
break;
|
|
641
|
+
}
|
|
642
|
+
throw new errors.InvalidParameterError("Bad parameter: rise must be of type Int, received ".concat((0, _utils.getType)(params.rise)));
|
|
643
|
+
case 12:
|
|
644
|
+
_context7.next = 13;
|
|
645
|
+
return _Api.default.sendRequest('/remote_mount_backends', 'POST', params, options);
|
|
646
|
+
case 13:
|
|
647
|
+
response = _context7.sent;
|
|
648
|
+
return _context7.abrupt("return", new _RemoteMountBackend(response === null || response === void 0 ? void 0 : response.data, options));
|
|
649
|
+
case 14:
|
|
650
|
+
case "end":
|
|
651
|
+
return _context7.stop();
|
|
652
|
+
}
|
|
653
|
+
}, _callee7);
|
|
654
|
+
})));
|
|
655
|
+
var _default = exports.default = RemoteMountBackend;
|
|
656
|
+
module.exports = RemoteMountBackend;
|
|
657
|
+
module.exports.default = RemoteMountBackend;
|
package/package.json
CHANGED
package/src/Files.js
CHANGED
|
@@ -0,0 +1,427 @@
|
|
|
1
|
+
/* eslint-disable no-unused-vars */
|
|
2
|
+
import Api from '../Api'
|
|
3
|
+
import * as errors from '../Errors'
|
|
4
|
+
import {
|
|
5
|
+
getType, isArray, isInt, isObject, isString,
|
|
6
|
+
} from '../utils'
|
|
7
|
+
/* eslint-enable no-unused-vars */
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Class RemoteMountBackend
|
|
11
|
+
*/
|
|
12
|
+
class RemoteMountBackend {
|
|
13
|
+
attributes = {}
|
|
14
|
+
|
|
15
|
+
options = {}
|
|
16
|
+
|
|
17
|
+
constructor(attributes = {}, options = {}) {
|
|
18
|
+
Object.entries(attributes).forEach(([key, value]) => {
|
|
19
|
+
const normalizedKey = key.replace('?', '')
|
|
20
|
+
|
|
21
|
+
this.attributes[normalizedKey] = value
|
|
22
|
+
|
|
23
|
+
Object.defineProperty(this, normalizedKey, { value, writable: false })
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
this.options = { ...options }
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
isLoaded = () => !!this.attributes.id
|
|
30
|
+
|
|
31
|
+
// string # Path to the canary file used for health checks.
|
|
32
|
+
getCanaryFilePath = () => this.attributes.canary_file_path
|
|
33
|
+
|
|
34
|
+
setCanaryFilePath = value => {
|
|
35
|
+
this.attributes.canary_file_path = value
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// boolean # True if this backend is enabled.
|
|
39
|
+
getEnabled = () => this.attributes.enabled
|
|
40
|
+
|
|
41
|
+
setEnabled = value => {
|
|
42
|
+
this.attributes.enabled = value
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// int64 # Number of consecutive failures before considering the backend unhealthy.
|
|
46
|
+
getFall = () => this.attributes.fall
|
|
47
|
+
|
|
48
|
+
setFall = value => {
|
|
49
|
+
this.attributes.fall = value
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// boolean # True if health checks are enabled for this backend.
|
|
53
|
+
getHealthCheckEnabled = () => this.attributes.health_check_enabled
|
|
54
|
+
|
|
55
|
+
setHealthCheckEnabled = value => {
|
|
56
|
+
this.attributes.health_check_enabled = value
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// string # Type of health check to perform.
|
|
60
|
+
getHealthCheckType = () => this.attributes.health_check_type
|
|
61
|
+
|
|
62
|
+
setHealthCheckType = value => {
|
|
63
|
+
this.attributes.health_check_type = value
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// int64 # Interval in seconds between health checks.
|
|
67
|
+
getInterval = () => this.attributes.interval
|
|
68
|
+
|
|
69
|
+
setInterval = value => {
|
|
70
|
+
this.attributes.interval = value
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// double # Minimum free CPU percentage required for this backend to be considered healthy.
|
|
74
|
+
getMinFreeCpu = () => this.attributes.min_free_cpu
|
|
75
|
+
|
|
76
|
+
setMinFreeCpu = value => {
|
|
77
|
+
this.attributes.min_free_cpu = value
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// double # Minimum free memory percentage required for this backend to be considered healthy.
|
|
81
|
+
getMinFreeMem = () => this.attributes.min_free_mem
|
|
82
|
+
|
|
83
|
+
setMinFreeMem = value => {
|
|
84
|
+
this.attributes.min_free_mem = value
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// int64 # Priority of this backend.
|
|
88
|
+
getPriority = () => this.attributes.priority
|
|
89
|
+
|
|
90
|
+
setPriority = value => {
|
|
91
|
+
this.attributes.priority = value
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// string # Path on the remote server to treat as the root of this mount.
|
|
95
|
+
getRemotePath = () => this.attributes.remote_path
|
|
96
|
+
|
|
97
|
+
setRemotePath = value => {
|
|
98
|
+
this.attributes.remote_path = value
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// int64 # The remote server that this backend is associated with.
|
|
102
|
+
getRemoteServerId = () => this.attributes.remote_server_id
|
|
103
|
+
|
|
104
|
+
setRemoteServerId = value => {
|
|
105
|
+
this.attributes.remote_server_id = value
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// int64 # The mount ID of the Remote Server Mount that this backend is associated with.
|
|
109
|
+
getRemoteServerMountId = () => this.attributes.remote_server_mount_id
|
|
110
|
+
|
|
111
|
+
setRemoteServerMountId = value => {
|
|
112
|
+
this.attributes.remote_server_mount_id = value
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// int64 # Number of consecutive successes before considering the backend healthy.
|
|
116
|
+
getRise = () => this.attributes.rise
|
|
117
|
+
|
|
118
|
+
setRise = value => {
|
|
119
|
+
this.attributes.rise = value
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// string # Status of this backend.
|
|
123
|
+
getStatus = () => this.attributes.status
|
|
124
|
+
|
|
125
|
+
setStatus = value => {
|
|
126
|
+
this.attributes.status = value
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// boolean # True if this backend is undergoing maintenance.
|
|
130
|
+
getUndergoingMaintenance = () => this.attributes.undergoing_maintenance
|
|
131
|
+
|
|
132
|
+
setUndergoingMaintenance = value => {
|
|
133
|
+
this.attributes.undergoing_maintenance = value
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
// int64 # Remote Mount Backend ID.
|
|
137
|
+
getId = () => this.attributes.id
|
|
138
|
+
|
|
139
|
+
setId = value => {
|
|
140
|
+
this.attributes.id = value
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
// Reset backend status to healthy
|
|
144
|
+
resetStatus = async (params = {}) => {
|
|
145
|
+
if (!this.attributes.id) {
|
|
146
|
+
throw new errors.EmptyPropertyError('Current object has no id')
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
if (!isObject(params)) {
|
|
150
|
+
throw new errors.InvalidParameterError(`Bad parameter: params must be of type object, received ${getType(params)}`)
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
params.id = this.attributes.id
|
|
154
|
+
if (params.id && !isInt(params.id)) {
|
|
155
|
+
throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params.id)}`)
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
if (!params.id) {
|
|
159
|
+
if (this.attributes.id) {
|
|
160
|
+
params.id = this.id
|
|
161
|
+
} else {
|
|
162
|
+
throw new errors.MissingParameterError('Parameter missing: id')
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
await Api.sendRequest(`/remote_mount_backends/${encodeURIComponent(params.id)}/reset_status`, 'POST', params, this.options)
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
// Parameters:
|
|
170
|
+
// canary_file_path (required) - string - Path to the canary file used for health checks.
|
|
171
|
+
// remote_server_mount_id (required) - int64 - The mount ID of the Remote Server Mount that this backend is associated with.
|
|
172
|
+
// remote_server_id (required) - int64 - The remote server that this backend is associated with.
|
|
173
|
+
// enabled - boolean - True if this backend is enabled.
|
|
174
|
+
// fall - int64 - Number of consecutive failures before considering the backend unhealthy.
|
|
175
|
+
// health_check_enabled - boolean - True if health checks are enabled for this backend.
|
|
176
|
+
// health_check_type - string - Type of health check to perform.
|
|
177
|
+
// interval - int64 - Interval in seconds between health checks.
|
|
178
|
+
// min_free_cpu - double - Minimum free CPU percentage required for this backend to be considered healthy.
|
|
179
|
+
// min_free_mem - double - Minimum free memory percentage required for this backend to be considered healthy.
|
|
180
|
+
// priority - int64 - Priority of this backend.
|
|
181
|
+
// remote_path - string - Path on the remote server to treat as the root of this mount.
|
|
182
|
+
// rise - int64 - Number of consecutive successes before considering the backend healthy.
|
|
183
|
+
update = async (params = {}) => {
|
|
184
|
+
if (!this.attributes.id) {
|
|
185
|
+
throw new errors.EmptyPropertyError('Current object has no id')
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
if (!isObject(params)) {
|
|
189
|
+
throw new errors.InvalidParameterError(`Bad parameter: params must be of type object, received ${getType(params)}`)
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
params.id = this.attributes.id
|
|
193
|
+
if (params.id && !isInt(params.id)) {
|
|
194
|
+
throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params.id)}`)
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
if (params.canary_file_path && !isString(params.canary_file_path)) {
|
|
198
|
+
throw new errors.InvalidParameterError(`Bad parameter: canary_file_path must be of type String, received ${getType(params.canary_file_path)}`)
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
if (params.remote_server_mount_id && !isInt(params.remote_server_mount_id)) {
|
|
202
|
+
throw new errors.InvalidParameterError(`Bad parameter: remote_server_mount_id must be of type Int, received ${getType(params.remote_server_mount_id)}`)
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
if (params.remote_server_id && !isInt(params.remote_server_id)) {
|
|
206
|
+
throw new errors.InvalidParameterError(`Bad parameter: remote_server_id must be of type Int, received ${getType(params.remote_server_id)}`)
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
if (params.fall && !isInt(params.fall)) {
|
|
210
|
+
throw new errors.InvalidParameterError(`Bad parameter: fall must be of type Int, received ${getType(params.fall)}`)
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
if (params.health_check_type && !isString(params.health_check_type)) {
|
|
214
|
+
throw new errors.InvalidParameterError(`Bad parameter: health_check_type must be of type String, received ${getType(params.health_check_type)}`)
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
if (params.interval && !isInt(params.interval)) {
|
|
218
|
+
throw new errors.InvalidParameterError(`Bad parameter: interval must be of type Int, received ${getType(params.interval)}`)
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
if (params.priority && !isInt(params.priority)) {
|
|
222
|
+
throw new errors.InvalidParameterError(`Bad parameter: priority must be of type Int, received ${getType(params.priority)}`)
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
if (params.remote_path && !isString(params.remote_path)) {
|
|
226
|
+
throw new errors.InvalidParameterError(`Bad parameter: remote_path must be of type String, received ${getType(params.remote_path)}`)
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
if (params.rise && !isInt(params.rise)) {
|
|
230
|
+
throw new errors.InvalidParameterError(`Bad parameter: rise must be of type Int, received ${getType(params.rise)}`)
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
if (!params.id) {
|
|
234
|
+
if (this.attributes.id) {
|
|
235
|
+
params.id = this.id
|
|
236
|
+
} else {
|
|
237
|
+
throw new errors.MissingParameterError('Parameter missing: id')
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
if (!params.canary_file_path) {
|
|
242
|
+
if (this.attributes.canary_file_path) {
|
|
243
|
+
params.canary_file_path = this.canary_file_path
|
|
244
|
+
} else {
|
|
245
|
+
throw new errors.MissingParameterError('Parameter missing: canary_file_path')
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
if (!params.remote_server_mount_id) {
|
|
250
|
+
if (this.attributes.remote_server_mount_id) {
|
|
251
|
+
params.remote_server_mount_id = this.remote_server_mount_id
|
|
252
|
+
} else {
|
|
253
|
+
throw new errors.MissingParameterError('Parameter missing: remote_server_mount_id')
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
if (!params.remote_server_id) {
|
|
258
|
+
if (this.attributes.remote_server_id) {
|
|
259
|
+
params.remote_server_id = this.remote_server_id
|
|
260
|
+
} else {
|
|
261
|
+
throw new errors.MissingParameterError('Parameter missing: remote_server_id')
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
const response = await Api.sendRequest(`/remote_mount_backends/${encodeURIComponent(params.id)}`, 'PATCH', params, this.options)
|
|
266
|
+
|
|
267
|
+
return new RemoteMountBackend(response?.data, this.options)
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
delete = async (params = {}) => {
|
|
271
|
+
if (!this.attributes.id) {
|
|
272
|
+
throw new errors.EmptyPropertyError('Current object has no id')
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
if (!isObject(params)) {
|
|
276
|
+
throw new errors.InvalidParameterError(`Bad parameter: params must be of type object, received ${getType(params)}`)
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
params.id = this.attributes.id
|
|
280
|
+
if (params.id && !isInt(params.id)) {
|
|
281
|
+
throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params.id)}`)
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
if (!params.id) {
|
|
285
|
+
if (this.attributes.id) {
|
|
286
|
+
params.id = this.id
|
|
287
|
+
} else {
|
|
288
|
+
throw new errors.MissingParameterError('Parameter missing: id')
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
await Api.sendRequest(`/remote_mount_backends/${encodeURIComponent(params.id)}`, 'DELETE', params, this.options)
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
destroy = (params = {}) =>
|
|
296
|
+
this.delete(params)
|
|
297
|
+
|
|
298
|
+
save = async () => {
|
|
299
|
+
if (this.attributes.id) {
|
|
300
|
+
const newObject = await this.update(this.attributes)
|
|
301
|
+
this.attributes = { ...newObject.attributes }
|
|
302
|
+
return true
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
const newObject = await RemoteMountBackend.create(this.attributes, this.options)
|
|
306
|
+
this.attributes = { ...newObject.attributes }
|
|
307
|
+
return true
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
// Parameters:
|
|
311
|
+
// cursor - string - Used for pagination. When a list request has more records available, cursors are provided in the response headers `X-Files-Cursor-Next` and `X-Files-Cursor-Prev`. Send one of those cursor value here to resume an existing list from the next available record. Note: many of our SDKs have iterator methods that will automatically handle cursor-based pagination.
|
|
312
|
+
// per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
|
|
313
|
+
static list = async (params = {}, options = {}) => {
|
|
314
|
+
if (params.cursor && !isString(params.cursor)) {
|
|
315
|
+
throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params.cursor)}`)
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
if (params.per_page && !isInt(params.per_page)) {
|
|
319
|
+
throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params.per_page)}`)
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
const response = await Api.sendRequest('/remote_mount_backends', 'GET', params, options)
|
|
323
|
+
|
|
324
|
+
return response?.data?.map(obj => new RemoteMountBackend(obj, options)) || []
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
static all = (params = {}, options = {}) =>
|
|
328
|
+
RemoteMountBackend.list(params, options)
|
|
329
|
+
|
|
330
|
+
// Parameters:
|
|
331
|
+
// id (required) - int64 - Remote Mount Backend ID.
|
|
332
|
+
static find = async (id, params = {}, options = {}) => {
|
|
333
|
+
if (!isObject(params)) {
|
|
334
|
+
throw new errors.InvalidParameterError(`Bad parameter: params must be of type object, received ${getType(params)}`)
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
params.id = id
|
|
338
|
+
|
|
339
|
+
if (!params.id) {
|
|
340
|
+
throw new errors.MissingParameterError('Parameter missing: id')
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
if (params.id && !isInt(params.id)) {
|
|
344
|
+
throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params.id)}`)
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
const response = await Api.sendRequest(`/remote_mount_backends/${encodeURIComponent(params.id)}`, 'GET', params, options)
|
|
348
|
+
|
|
349
|
+
return new RemoteMountBackend(response?.data, options)
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
static get = (id, params = {}, options = {}) =>
|
|
353
|
+
RemoteMountBackend.find(id, params, options)
|
|
354
|
+
|
|
355
|
+
// Parameters:
|
|
356
|
+
// canary_file_path (required) - string - Path to the canary file used for health checks.
|
|
357
|
+
// remote_server_mount_id (required) - int64 - The mount ID of the Remote Server Mount that this backend is associated with.
|
|
358
|
+
// remote_server_id (required) - int64 - The remote server that this backend is associated with.
|
|
359
|
+
// enabled - boolean - True if this backend is enabled.
|
|
360
|
+
// fall - int64 - Number of consecutive failures before considering the backend unhealthy.
|
|
361
|
+
// health_check_enabled - boolean - True if health checks are enabled for this backend.
|
|
362
|
+
// health_check_type - string - Type of health check to perform.
|
|
363
|
+
// interval - int64 - Interval in seconds between health checks.
|
|
364
|
+
// min_free_cpu - double - Minimum free CPU percentage required for this backend to be considered healthy.
|
|
365
|
+
// min_free_mem - double - Minimum free memory percentage required for this backend to be considered healthy.
|
|
366
|
+
// priority - int64 - Priority of this backend.
|
|
367
|
+
// remote_path - string - Path on the remote server to treat as the root of this mount.
|
|
368
|
+
// rise - int64 - Number of consecutive successes before considering the backend healthy.
|
|
369
|
+
static create = async (params = {}, options = {}) => {
|
|
370
|
+
if (!params.canary_file_path) {
|
|
371
|
+
throw new errors.MissingParameterError('Parameter missing: canary_file_path')
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
if (!params.remote_server_mount_id) {
|
|
375
|
+
throw new errors.MissingParameterError('Parameter missing: remote_server_mount_id')
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
if (!params.remote_server_id) {
|
|
379
|
+
throw new errors.MissingParameterError('Parameter missing: remote_server_id')
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
if (params.canary_file_path && !isString(params.canary_file_path)) {
|
|
383
|
+
throw new errors.InvalidParameterError(`Bad parameter: canary_file_path must be of type String, received ${getType(params.canary_file_path)}`)
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
if (params.remote_server_mount_id && !isInt(params.remote_server_mount_id)) {
|
|
387
|
+
throw new errors.InvalidParameterError(`Bad parameter: remote_server_mount_id must be of type Int, received ${getType(params.remote_server_mount_id)}`)
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
if (params.remote_server_id && !isInt(params.remote_server_id)) {
|
|
391
|
+
throw new errors.InvalidParameterError(`Bad parameter: remote_server_id must be of type Int, received ${getType(params.remote_server_id)}`)
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
if (params.fall && !isInt(params.fall)) {
|
|
395
|
+
throw new errors.InvalidParameterError(`Bad parameter: fall must be of type Int, received ${getType(params.fall)}`)
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
if (params.health_check_type && !isString(params.health_check_type)) {
|
|
399
|
+
throw new errors.InvalidParameterError(`Bad parameter: health_check_type must be of type String, received ${getType(params.health_check_type)}`)
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
if (params.interval && !isInt(params.interval)) {
|
|
403
|
+
throw new errors.InvalidParameterError(`Bad parameter: interval must be of type Int, received ${getType(params.interval)}`)
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
if (params.priority && !isInt(params.priority)) {
|
|
407
|
+
throw new errors.InvalidParameterError(`Bad parameter: priority must be of type Int, received ${getType(params.priority)}`)
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
if (params.remote_path && !isString(params.remote_path)) {
|
|
411
|
+
throw new errors.InvalidParameterError(`Bad parameter: remote_path must be of type String, received ${getType(params.remote_path)}`)
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
if (params.rise && !isInt(params.rise)) {
|
|
415
|
+
throw new errors.InvalidParameterError(`Bad parameter: rise must be of type Int, received ${getType(params.rise)}`)
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
const response = await Api.sendRequest('/remote_mount_backends', 'POST', params, options)
|
|
419
|
+
|
|
420
|
+
return new RemoteMountBackend(response?.data, options)
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
export default RemoteMountBackend
|
|
425
|
+
|
|
426
|
+
module.exports = RemoteMountBackend
|
|
427
|
+
module.exports.default = RemoteMountBackend
|