files.com 1.2.263 → 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/As2Partner.md +10 -3
- package/docs/models/RemoteMountBackend.md +199 -0
- package/lib/Files.js +1 -1
- package/lib/models/As2Partner.js +57 -36
- package/lib/models/RemoteMountBackend.js +657 -0
- package/package.json +1 -1
- package/src/Files.js +1 -1
- package/src/models/As2Partner.js +20 -3
- package/src/models/RemoteMountBackend.js +427 -0
package/src/models/As2Partner.js
CHANGED
|
@@ -84,13 +84,20 @@ class As2Partner {
|
|
|
84
84
|
this.attributes.default_mime_type = value
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
-
// string # How should Files.com evaluate message transfer success based on a partner's MDN response? This setting does not affect MDN storage; all MDNs received from a partner are always stored. `none`: MDN is stored for informational purposes only, a successful HTTPS transfer is a successful AS2 transfer. `weak`: Inspect the MDN for MIC and Disposition only. `normal`: `weak` plus validate MDN signature matches body, `strict`: `normal` but do not allow signatures from self-signed or incorrectly purposed certificates.
|
|
87
|
+
// string # How should Files.com evaluate message transfer success based on a partner's MDN response? This setting does not affect MDN storage; all MDNs received from a partner are always stored. `none`: MDN is stored for informational purposes only, a successful HTTPS transfer is a successful AS2 transfer. `weak`: Inspect the MDN for MIC and Disposition only. `normal`: `weak` plus validate MDN signature matches body, `strict`: `normal` but do not allow signatures from self-signed or incorrectly purposed certificates. `auto`: Automatically set the correct value for this setting based on next mdn received.
|
|
88
88
|
getMdnValidationLevel = () => this.attributes.mdn_validation_level
|
|
89
89
|
|
|
90
90
|
setMdnValidationLevel = value => {
|
|
91
91
|
this.attributes.mdn_validation_level = value
|
|
92
92
|
}
|
|
93
93
|
|
|
94
|
+
// string # Should Files.com require signatures on incoming AS2 messages? `normal`: require that incoming messages are signed with a valid matching signature. `none`: Unsigned incoming messages are allowed. `auto`: Automatically set the correct value for this setting based on next message received.
|
|
95
|
+
getSignatureValidationLevel = () => this.attributes.signature_validation_level
|
|
96
|
+
|
|
97
|
+
setSignatureValidationLevel = value => {
|
|
98
|
+
this.attributes.signature_validation_level = value
|
|
99
|
+
}
|
|
100
|
+
|
|
94
101
|
// boolean # If `true`, we will use your site's dedicated IPs for all outbound connections to this AS2 Partner.
|
|
95
102
|
getEnableDedicatedIps = () => this.attributes.enable_dedicated_ips
|
|
96
103
|
|
|
@@ -165,7 +172,8 @@ class As2Partner {
|
|
|
165
172
|
// enable_dedicated_ips - boolean - If `true`, we will use your site's dedicated IPs for all outbound connections to this AS2 Partner.
|
|
166
173
|
// http_auth_username - string - Username to send to server for HTTP Authentication.
|
|
167
174
|
// http_auth_password - string - Password to send to server for HTTP Authentication.
|
|
168
|
-
// mdn_validation_level - string - How should Files.com evaluate message transfer success based on a partner's MDN response? This setting does not affect MDN storage; all MDNs received from a partner are always stored. `none`: MDN is stored for informational purposes only, a successful HTTPS transfer is a successful AS2 transfer. `weak`: Inspect the MDN for MIC and Disposition only. `normal`: `weak` plus validate MDN signature matches body, `strict`: `normal` but do not allow signatures from self-signed or incorrectly purposed certificates.
|
|
175
|
+
// mdn_validation_level - string - How should Files.com evaluate message transfer success based on a partner's MDN response? This setting does not affect MDN storage; all MDNs received from a partner are always stored. `none`: MDN is stored for informational purposes only, a successful HTTPS transfer is a successful AS2 transfer. `weak`: Inspect the MDN for MIC and Disposition only. `normal`: `weak` plus validate MDN signature matches body, `strict`: `normal` but do not allow signatures from self-signed or incorrectly purposed certificates. `auto`: Automatically set the correct value for this setting based on next mdn received.
|
|
176
|
+
// signature_validation_level - string - Should Files.com require signatures on incoming AS2 messages? `normal`: require that incoming messages are signed with a valid matching signature. `none`: Unsigned incoming messages are allowed. `auto`: Automatically set the correct value for this setting based on next message received.
|
|
169
177
|
// server_certificate - string - Should we require that the remote HTTP server have a valid SSL Certificate for HTTPS? (This only applies to Outgoing AS2 message from Files.com to a Partner.)
|
|
170
178
|
// default_mime_type - string - Default mime type of the file attached to the encrypted message
|
|
171
179
|
// additional_http_headers - object - Additional HTTP Headers for outgoing message sent to this partner.
|
|
@@ -198,6 +206,10 @@ class As2Partner {
|
|
|
198
206
|
throw new errors.InvalidParameterError(`Bad parameter: mdn_validation_level must be of type String, received ${getType(params.mdn_validation_level)}`)
|
|
199
207
|
}
|
|
200
208
|
|
|
209
|
+
if (params.signature_validation_level && !isString(params.signature_validation_level)) {
|
|
210
|
+
throw new errors.InvalidParameterError(`Bad parameter: signature_validation_level must be of type String, received ${getType(params.signature_validation_level)}`)
|
|
211
|
+
}
|
|
212
|
+
|
|
201
213
|
if (params.server_certificate && !isString(params.server_certificate)) {
|
|
202
214
|
throw new errors.InvalidParameterError(`Bad parameter: server_certificate must be of type String, received ${getType(params.server_certificate)}`)
|
|
203
215
|
}
|
|
@@ -320,7 +332,8 @@ class As2Partner {
|
|
|
320
332
|
// enable_dedicated_ips - boolean - If `true`, we will use your site's dedicated IPs for all outbound connections to this AS2 Partner.
|
|
321
333
|
// http_auth_username - string - Username to send to server for HTTP Authentication.
|
|
322
334
|
// http_auth_password - string - Password to send to server for HTTP Authentication.
|
|
323
|
-
// mdn_validation_level - string - How should Files.com evaluate message transfer success based on a partner's MDN response? This setting does not affect MDN storage; all MDNs received from a partner are always stored. `none`: MDN is stored for informational purposes only, a successful HTTPS transfer is a successful AS2 transfer. `weak`: Inspect the MDN for MIC and Disposition only. `normal`: `weak` plus validate MDN signature matches body, `strict`: `normal` but do not allow signatures from self-signed or incorrectly purposed certificates.
|
|
335
|
+
// mdn_validation_level - string - How should Files.com evaluate message transfer success based on a partner's MDN response? This setting does not affect MDN storage; all MDNs received from a partner are always stored. `none`: MDN is stored for informational purposes only, a successful HTTPS transfer is a successful AS2 transfer. `weak`: Inspect the MDN for MIC and Disposition only. `normal`: `weak` plus validate MDN signature matches body, `strict`: `normal` but do not allow signatures from self-signed or incorrectly purposed certificates. `auto`: Automatically set the correct value for this setting based on next mdn received.
|
|
336
|
+
// signature_validation_level - string - Should Files.com require signatures on incoming AS2 messages? `normal`: require that incoming messages are signed with a valid matching signature. `none`: Unsigned incoming messages are allowed. `auto`: Automatically set the correct value for this setting based on next message received.
|
|
324
337
|
// server_certificate - string - Should we require that the remote HTTP server have a valid SSL Certificate for HTTPS? (This only applies to Outgoing AS2 message from Files.com to a Partner.)
|
|
325
338
|
// default_mime_type - string - Default mime type of the file attached to the encrypted message
|
|
326
339
|
// additional_http_headers - object - Additional HTTP Headers for outgoing message sent to this partner.
|
|
@@ -357,6 +370,10 @@ class As2Partner {
|
|
|
357
370
|
throw new errors.InvalidParameterError(`Bad parameter: mdn_validation_level must be of type String, received ${getType(params.mdn_validation_level)}`)
|
|
358
371
|
}
|
|
359
372
|
|
|
373
|
+
if (params.signature_validation_level && !isString(params.signature_validation_level)) {
|
|
374
|
+
throw new errors.InvalidParameterError(`Bad parameter: signature_validation_level must be of type String, received ${getType(params.signature_validation_level)}`)
|
|
375
|
+
}
|
|
376
|
+
|
|
360
377
|
if (params.server_certificate && !isString(params.server_certificate)) {
|
|
361
378
|
throw new errors.InvalidParameterError(`Bad parameter: server_certificate must be of type String, received ${getType(params.server_certificate)}`)
|
|
362
379
|
}
|
|
@@ -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
|