Class: Files::RemoteMountBackend

Inherits:
Object
  • Object
show all
Defined in:
lib/files.com/models/remote_mount_backend.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}, options = {}) ⇒ RemoteMountBackend

Returns a new instance of RemoteMountBackend.



7
8
9
10
# File 'lib/files.com/models/remote_mount_backend.rb', line 7

def initialize(attributes = {}, options = {})
  @attributes = attributes || {}
  @options = options || {}
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



5
6
7
# File 'lib/files.com/models/remote_mount_backend.rb', line 5

def attributes
  @attributes
end

#optionsObject (readonly)

Returns the value of attribute options.



5
6
7
# File 'lib/files.com/models/remote_mount_backend.rb', line 5

def options
  @options
end

Class Method Details

.all(params = {}, options = {}) ⇒ Object



247
248
249
# File 'lib/files.com/models/remote_mount_backend.rb', line 247

def self.all(params = {}, options = {})
  list(params, options)
end

.create(params = {}, options = {}) ⇒ Object

Parameters:

enabled - boolean - True if this backend is enabled.
fall - int64 - Number of consecutive failures before considering the backend unhealthy.
health_check_enabled - boolean - True if health checks are enabled for this backend.
health_check_type - string - Type of health check to perform.
interval - int64 - Interval in seconds between health checks.
min_free_cpu - double - Minimum free CPU percentage required for this backend to be considered healthy.
min_free_mem - double - Minimum free memory percentage required for this backend to be considered healthy.
priority - int64 - Priority of this backend.
remote_path - string - Path on the remote server to treat as the root of this mount.
rise - int64 - Number of consecutive successes before considering the backend healthy.
canary_file_path (required) - string - Path to the canary file used for health checks.
remote_server_mount_id (required) - int64 - The mount ID of the Remote Server Mount that this backend is associated with.
remote_server_id (required) - int64 - The remote server that this backend is associated with.


281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
# File 'lib/files.com/models/remote_mount_backend.rb', line 281

def self.create(params = {}, options = {})
  raise InvalidParameterError.new("Bad parameter: fall must be an Integer") if params[:fall] and !params[:fall].is_a?(Integer)
  raise InvalidParameterError.new("Bad parameter: health_check_type must be an String") if params[:health_check_type] and !params[:health_check_type].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: interval must be an Integer") if params[:interval] and !params[:interval].is_a?(Integer)
  raise InvalidParameterError.new("Bad parameter: min_free_cpu must be an Float") if params[:min_free_cpu] and !params[:min_free_cpu].is_a?(Float)
  raise InvalidParameterError.new("Bad parameter: min_free_mem must be an Float") if params[:min_free_mem] and !params[:min_free_mem].is_a?(Float)
  raise InvalidParameterError.new("Bad parameter: priority must be an Integer") if params[:priority] and !params[:priority].is_a?(Integer)
  raise InvalidParameterError.new("Bad parameter: remote_path must be an String") if params[:remote_path] and !params[:remote_path].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: rise must be an Integer") if params[:rise] and !params[:rise].is_a?(Integer)
  raise InvalidParameterError.new("Bad parameter: canary_file_path must be an String") if params[:canary_file_path] and !params[:canary_file_path].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: remote_server_mount_id must be an Integer") if params[:remote_server_mount_id] and !params[:remote_server_mount_id].is_a?(Integer)
  raise InvalidParameterError.new("Bad parameter: remote_server_id must be an Integer") if params[:remote_server_id] and !params[:remote_server_id].is_a?(Integer)
  raise MissingParameterError.new("Parameter missing: canary_file_path") unless params[:canary_file_path]
  raise MissingParameterError.new("Parameter missing: remote_server_mount_id") unless params[:remote_server_mount_id]
  raise MissingParameterError.new("Parameter missing: remote_server_id") unless params[:remote_server_id]

  response, options = Api.send_request("/remote_mount_backends", :post, params, options)
  RemoteMountBackend.new(response.data, options)
end

.delete(id, params = {}, options = {}) ⇒ Object



345
346
347
348
349
350
351
352
353
# File 'lib/files.com/models/remote_mount_backend.rb', line 345

def self.delete(id, params = {}, options = {})
  params ||= {}
  params[:id] = id
  raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params[:id] and !params[:id].is_a?(Integer)
  raise MissingParameterError.new("Parameter missing: id") unless params[:id]

  Api.send_request("/remote_mount_backends/#{params[:id]}", :delete, params, options)
  nil
end

.destroy(id, params = {}, options = {}) ⇒ Object



355
356
357
358
# File 'lib/files.com/models/remote_mount_backend.rb', line 355

def self.destroy(id, params = {}, options = {})
  delete(id, params, options)
  nil
end

.find(id, params = {}, options = {}) ⇒ Object

Parameters:

id (required) - int64 - Remote Mount Backend ID.


253
254
255
256
257
258
259
260
261
# File 'lib/files.com/models/remote_mount_backend.rb', line 253

def self.find(id, params = {}, options = {})
  params ||= {}
  params[:id] = id
  raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params[:id] and !params[:id].is_a?(Integer)
  raise MissingParameterError.new("Parameter missing: id") unless params[:id]

  response, options = Api.send_request("/remote_mount_backends/#{params[:id]}", :get, params, options)
  RemoteMountBackend.new(response.data, options)
end

.get(id, params = {}, options = {}) ⇒ Object



263
264
265
# File 'lib/files.com/models/remote_mount_backend.rb', line 263

def self.get(id, params = {}, options = {})
  find(id, params, options)
end

.list(params = {}, options = {}) ⇒ Object

Parameters:

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.
per_page - int64 - Number of records to show per page.  (Max: 10,000, 1,000 or less is recommended).
filter - object - If set, return records where the specified field is equal to the supplied value. Valid fields are `remote_server_mount_id`.


237
238
239
240
241
242
243
244
245
# File 'lib/files.com/models/remote_mount_backend.rb', line 237

def self.list(params = {}, options = {})
  raise InvalidParameterError.new("Bad parameter: cursor must be an String") if params[:cursor] and !params[:cursor].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: per_page must be an Integer") if params[:per_page] and !params[:per_page].is_a?(Integer)
  raise InvalidParameterError.new("Bad parameter: filter must be an Hash") if params[:filter] and !params[:filter].is_a?(Hash)

  List.new(RemoteMountBackend, params) do
    Api.send_request("/remote_mount_backends", :get, params, options)
  end
end

.reset_status(id, params = {}, options = {}) ⇒ Object

Reset backend status to healthy



302
303
304
305
306
307
308
309
310
# File 'lib/files.com/models/remote_mount_backend.rb', line 302

def self.reset_status(id, params = {}, options = {})
  params ||= {}
  params[:id] = id
  raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params[:id] and !params[:id].is_a?(Integer)
  raise MissingParameterError.new("Parameter missing: id") unless params[:id]

  Api.send_request("/remote_mount_backends/#{params[:id]}/reset_status", :post, params, options)
  nil
end

.update(id, params = {}, options = {}) ⇒ Object

Parameters:

enabled - boolean - True if this backend is enabled.
fall - int64 - Number of consecutive failures before considering the backend unhealthy.
health_check_enabled - boolean - True if health checks are enabled for this backend.
health_check_type - string - Type of health check to perform.
interval - int64 - Interval in seconds between health checks.
min_free_cpu - double - Minimum free CPU percentage required for this backend to be considered healthy.
min_free_mem - double - Minimum free memory percentage required for this backend to be considered healthy.
priority - int64 - Priority of this backend.
remote_path - string - Path on the remote server to treat as the root of this mount.
rise - int64 - Number of consecutive successes before considering the backend healthy.
canary_file_path - string - Path to the canary file used for health checks.
remote_server_id - int64 - The remote server that this backend is associated with.


325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
# File 'lib/files.com/models/remote_mount_backend.rb', line 325

def self.update(id, params = {}, options = {})
  params ||= {}
  params[:id] = id
  raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params[:id] and !params[:id].is_a?(Integer)
  raise InvalidParameterError.new("Bad parameter: fall must be an Integer") if params[:fall] and !params[:fall].is_a?(Integer)
  raise InvalidParameterError.new("Bad parameter: health_check_type must be an String") if params[:health_check_type] and !params[:health_check_type].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: interval must be an Integer") if params[:interval] and !params[:interval].is_a?(Integer)
  raise InvalidParameterError.new("Bad parameter: min_free_cpu must be an Float") if params[:min_free_cpu] and !params[:min_free_cpu].is_a?(Float)
  raise InvalidParameterError.new("Bad parameter: min_free_mem must be an Float") if params[:min_free_mem] and !params[:min_free_mem].is_a?(Float)
  raise InvalidParameterError.new("Bad parameter: priority must be an Integer") if params[:priority] and !params[:priority].is_a?(Integer)
  raise InvalidParameterError.new("Bad parameter: remote_path must be an String") if params[:remote_path] and !params[:remote_path].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: rise must be an Integer") if params[:rise] and !params[:rise].is_a?(Integer)
  raise InvalidParameterError.new("Bad parameter: canary_file_path must be an String") if params[:canary_file_path] and !params[:canary_file_path].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: remote_server_id must be an Integer") if params[:remote_server_id] and !params[:remote_server_id].is_a?(Integer)
  raise MissingParameterError.new("Parameter missing: id") unless params[:id]

  response, options = Api.send_request("/remote_mount_backends/#{params[:id]}", :patch, params, options)
  RemoteMountBackend.new(response.data, options)
end

Instance Method Details

#canary_file_pathObject

string - Path to the canary file used for health checks.



13
14
15
# File 'lib/files.com/models/remote_mount_backend.rb', line 13

def canary_file_path
  @attributes[:canary_file_path]
end

#canary_file_path=(value) ⇒ Object



17
18
19
# File 'lib/files.com/models/remote_mount_backend.rb', line 17

def canary_file_path=(value)
  @attributes[:canary_file_path] = value
end

#delete(params = {}) ⇒ Object



207
208
209
210
211
212
213
214
215
# File 'lib/files.com/models/remote_mount_backend.rb', line 207

def delete(params = {})
  params ||= {}
  params[:id] = @attributes[:id]
  raise MissingParameterError.new("Current object doesn't have a id") unless @attributes[:id]
  raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params[:id] and !params[:id].is_a?(Integer)
  raise MissingParameterError.new("Parameter missing: id") unless params[:id]

  Api.send_request("/remote_mount_backends/#{@attributes[:id]}", :delete, params, @options)
end

#destroy(params = {}) ⇒ Object



217
218
219
220
# File 'lib/files.com/models/remote_mount_backend.rb', line 217

def destroy(params = {})
  delete(params)
  nil
end

#enabledObject

boolean - True if this backend is enabled.



22
23
24
# File 'lib/files.com/models/remote_mount_backend.rb', line 22

def enabled
  @attributes[:enabled]
end

#enabled=(value) ⇒ Object



26
27
28
# File 'lib/files.com/models/remote_mount_backend.rb', line 26

def enabled=(value)
  @attributes[:enabled] = value
end

#fallObject

int64 - Number of consecutive failures before considering the backend unhealthy.



31
32
33
# File 'lib/files.com/models/remote_mount_backend.rb', line 31

def fall
  @attributes[:fall]
end

#fall=(value) ⇒ Object



35
36
37
# File 'lib/files.com/models/remote_mount_backend.rb', line 35

def fall=(value)
  @attributes[:fall] = value
end

#health_check_enabledObject

boolean - True if health checks are enabled for this backend.



40
41
42
# File 'lib/files.com/models/remote_mount_backend.rb', line 40

def health_check_enabled
  @attributes[:health_check_enabled]
end

#health_check_enabled=(value) ⇒ Object



44
45
46
# File 'lib/files.com/models/remote_mount_backend.rb', line 44

def health_check_enabled=(value)
  @attributes[:health_check_enabled] = value
end

#health_check_resultsObject

array(object) - Array of recent health check results.



49
50
51
# File 'lib/files.com/models/remote_mount_backend.rb', line 49

def health_check_results
  @attributes[:health_check_results]
end

#health_check_results=(value) ⇒ Object



53
54
55
# File 'lib/files.com/models/remote_mount_backend.rb', line 53

def health_check_results=(value)
  @attributes[:health_check_results] = value
end

#health_check_typeObject

string - Type of health check to perform.



58
59
60
# File 'lib/files.com/models/remote_mount_backend.rb', line 58

def health_check_type
  @attributes[:health_check_type]
end

#health_check_type=(value) ⇒ Object



62
63
64
# File 'lib/files.com/models/remote_mount_backend.rb', line 62

def health_check_type=(value)
  @attributes[:health_check_type] = value
end

#idObject

int64 - Unique identifier for this backend.



67
68
69
# File 'lib/files.com/models/remote_mount_backend.rb', line 67

def id
  @attributes[:id]
end

#id=(value) ⇒ Object



71
72
73
# File 'lib/files.com/models/remote_mount_backend.rb', line 71

def id=(value)
  @attributes[:id] = value
end

#intervalObject

int64 - Interval in seconds between health checks.



76
77
78
# File 'lib/files.com/models/remote_mount_backend.rb', line 76

def interval
  @attributes[:interval]
end

#interval=(value) ⇒ Object



80
81
82
# File 'lib/files.com/models/remote_mount_backend.rb', line 80

def interval=(value)
  @attributes[:interval] = value
end

#min_free_cpuObject

double - Minimum free CPU percentage required for this backend to be considered healthy.



85
86
87
# File 'lib/files.com/models/remote_mount_backend.rb', line 85

def min_free_cpu
  @attributes[:min_free_cpu]
end

#min_free_cpu=(value) ⇒ Object



89
90
91
# File 'lib/files.com/models/remote_mount_backend.rb', line 89

def min_free_cpu=(value)
  @attributes[:min_free_cpu] = value
end

#min_free_memObject

double - Minimum free memory percentage required for this backend to be considered healthy.



94
95
96
# File 'lib/files.com/models/remote_mount_backend.rb', line 94

def min_free_mem
  @attributes[:min_free_mem]
end

#min_free_mem=(value) ⇒ Object



98
99
100
# File 'lib/files.com/models/remote_mount_backend.rb', line 98

def min_free_mem=(value)
  @attributes[:min_free_mem] = value
end

#priorityObject

int64 - Priority of this backend.



103
104
105
# File 'lib/files.com/models/remote_mount_backend.rb', line 103

def priority
  @attributes[:priority]
end

#priority=(value) ⇒ Object



107
108
109
# File 'lib/files.com/models/remote_mount_backend.rb', line 107

def priority=(value)
  @attributes[:priority] = value
end

#remote_pathObject

string - Path on the remote server to treat as the root of this mount.



112
113
114
# File 'lib/files.com/models/remote_mount_backend.rb', line 112

def remote_path
  @attributes[:remote_path]
end

#remote_path=(value) ⇒ Object



116
117
118
# File 'lib/files.com/models/remote_mount_backend.rb', line 116

def remote_path=(value)
  @attributes[:remote_path] = value
end

#remote_server_idObject

int64 - The remote server that this backend is associated with.



121
122
123
# File 'lib/files.com/models/remote_mount_backend.rb', line 121

def remote_server_id
  @attributes[:remote_server_id]
end

#remote_server_id=(value) ⇒ Object



125
126
127
# File 'lib/files.com/models/remote_mount_backend.rb', line 125

def remote_server_id=(value)
  @attributes[:remote_server_id] = value
end

#remote_server_mount_idObject

int64 - The mount ID of the Remote Server Mount that this backend is associated with.



130
131
132
# File 'lib/files.com/models/remote_mount_backend.rb', line 130

def remote_server_mount_id
  @attributes[:remote_server_mount_id]
end

#remote_server_mount_id=(value) ⇒ Object



134
135
136
# File 'lib/files.com/models/remote_mount_backend.rb', line 134

def remote_server_mount_id=(value)
  @attributes[:remote_server_mount_id] = value
end

#reset_status(params = {}) ⇒ Object

Reset backend status to healthy



166
167
168
169
170
171
172
173
174
# File 'lib/files.com/models/remote_mount_backend.rb', line 166

def reset_status(params = {})
  params ||= {}
  params[:id] = @attributes[:id]
  raise MissingParameterError.new("Current object doesn't have a id") unless @attributes[:id]
  raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params[:id] and !params[:id].is_a?(Integer)
  raise MissingParameterError.new("Parameter missing: id") unless params[:id]

  Api.send_request("/remote_mount_backends/#{@attributes[:id]}/reset_status", :post, params, @options)
end

#riseObject

int64 - Number of consecutive successes before considering the backend healthy.



139
140
141
# File 'lib/files.com/models/remote_mount_backend.rb', line 139

def rise
  @attributes[:rise]
end

#rise=(value) ⇒ Object



143
144
145
# File 'lib/files.com/models/remote_mount_backend.rb', line 143

def rise=(value)
  @attributes[:rise] = value
end

#saveObject



222
223
224
225
226
227
228
229
230
231
# File 'lib/files.com/models/remote_mount_backend.rb', line 222

def save
  if @attributes[:id]
    new_obj = update(@attributes)
  else
    new_obj = RemoteMountBackend.create(@attributes, @options)
  end

  @attributes = new_obj.attributes
  true
end

#statusObject

string - Status of this backend.



148
149
150
# File 'lib/files.com/models/remote_mount_backend.rb', line 148

def status
  @attributes[:status]
end

#status=(value) ⇒ Object



152
153
154
# File 'lib/files.com/models/remote_mount_backend.rb', line 152

def status=(value)
  @attributes[:status] = value
end

#undergoing_maintenanceObject

boolean - True if this backend is undergoing maintenance.



157
158
159
# File 'lib/files.com/models/remote_mount_backend.rb', line 157

def undergoing_maintenance
  @attributes[:undergoing_maintenance]
end

#undergoing_maintenance=(value) ⇒ Object



161
162
163
# File 'lib/files.com/models/remote_mount_backend.rb', line 161

def undergoing_maintenance=(value)
  @attributes[:undergoing_maintenance] = value
end

#update(params = {}) ⇒ Object

Parameters:

enabled - boolean - True if this backend is enabled.
fall - int64 - Number of consecutive failures before considering the backend unhealthy.
health_check_enabled - boolean - True if health checks are enabled for this backend.
health_check_type - string - Type of health check to perform.
interval - int64 - Interval in seconds between health checks.
min_free_cpu - double - Minimum free CPU percentage required for this backend to be considered healthy.
min_free_mem - double - Minimum free memory percentage required for this backend to be considered healthy.
priority - int64 - Priority of this backend.
remote_path - string - Path on the remote server to treat as the root of this mount.
rise - int64 - Number of consecutive successes before considering the backend healthy.
canary_file_path - string - Path to the canary file used for health checks.
remote_server_id - int64 - The remote server that this backend is associated with.


189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
# File 'lib/files.com/models/remote_mount_backend.rb', line 189

def update(params = {})
  params ||= {}
  params[:id] = @attributes[:id]
  raise MissingParameterError.new("Current object doesn't have a id") unless @attributes[:id]
  raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params[:id] and !params[:id].is_a?(Integer)
  raise InvalidParameterError.new("Bad parameter: fall must be an Integer") if params[:fall] and !params[:fall].is_a?(Integer)
  raise InvalidParameterError.new("Bad parameter: health_check_type must be an String") if params[:health_check_type] and !params[:health_check_type].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: interval must be an Integer") if params[:interval] and !params[:interval].is_a?(Integer)
  raise InvalidParameterError.new("Bad parameter: priority must be an Integer") if params[:priority] and !params[:priority].is_a?(Integer)
  raise InvalidParameterError.new("Bad parameter: remote_path must be an String") if params[:remote_path] and !params[:remote_path].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: rise must be an Integer") if params[:rise] and !params[:rise].is_a?(Integer)
  raise InvalidParameterError.new("Bad parameter: canary_file_path must be an String") if params[:canary_file_path] and !params[:canary_file_path].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: remote_server_id must be an Integer") if params[:remote_server_id] and !params[:remote_server_id].is_a?(Integer)
  raise MissingParameterError.new("Parameter missing: id") unless params[:id]

  Api.send_request("/remote_mount_backends/#{@attributes[:id]}", :patch, params, @options)
end