Class: Files::Restore
- Inherits:
-
Object
- Object
- Files::Restore
- Defined in:
- lib/files.com/models/restore.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Class Method Summary collapse
- .all(params = {}, options = {}) ⇒ Object
-
.create(params = {}, options = {}) ⇒ Object
Parameters: earliest_date (required) - string - Restore all files deleted after this date/time.
-
.list(params = {}, options = {}) ⇒ Object
Parameters: cursor - string - Used for pagination.
Instance Method Summary collapse
-
#api_keys_restored ⇒ Object
int64 - Number of API keys restored (only present for ‘restoration_type=users`).
- #api_keys_restored=(value) ⇒ Object
-
#dirs_errored ⇒ Object
int64 - Number of directories that were not able to be restored.
- #dirs_errored=(value) ⇒ Object
-
#dirs_restored ⇒ Object
int64 - Number of directories that were successfully restored.
- #dirs_restored=(value) ⇒ Object
-
#dirs_total ⇒ Object
int64 - Total number of directories processed.
- #dirs_total=(value) ⇒ Object
-
#earliest_date ⇒ Object
date-time - Restore all files deleted after this date/time.
- #earliest_date=(value) ⇒ Object
-
#error_messages ⇒ Object
array(string) - Error messages received while restoring files and/or directories.
- #error_messages=(value) ⇒ Object
-
#files_errored ⇒ Object
int64 - Number of files that were not able to be restored.
- #files_errored=(value) ⇒ Object
-
#files_restored ⇒ Object
int64 - Number of files successfully restored.
- #files_restored=(value) ⇒ Object
-
#files_total ⇒ Object
int64 - Total number of files processed.
- #files_total=(value) ⇒ Object
-
#id ⇒ Object
int64 - Restore Record ID.
- #id=(value) ⇒ Object
-
#initialize(attributes = {}, options = {}) ⇒ Restore
constructor
A new instance of Restore.
-
#prefix ⇒ Object
string - Prefix of the files/folders to restore.
- #prefix=(value) ⇒ Object
-
#public_keys_restored ⇒ Object
int64 - Number of public keys restored (only present for ‘restoration_type=users`).
- #public_keys_restored=(value) ⇒ Object
-
#restoration_type ⇒ Object
string - Type of restoration to perform.
- #restoration_type=(value) ⇒ Object
-
#restore_deleted_permissions ⇒ Object
boolean - If true, we will also restore any Permissions that match the same path prefix from the same dates.
- #restore_deleted_permissions=(value) ⇒ Object
-
#restore_in_place ⇒ Object
boolean - If true, we will restore the files in place (into their original paths).
- #restore_in_place=(value) ⇒ Object
- #save ⇒ Object
-
#status ⇒ Object
string - Status of the restoration process.
- #status=(value) ⇒ Object
-
#two_factor_authentication_methods_restored ⇒ Object
int64 - Number of two factor authentication methods restored (only present for ‘restoration_type=users`).
- #two_factor_authentication_methods_restored=(value) ⇒ Object
-
#update_timestamps ⇒ Object
boolean - If true, we will update the last modified timestamp of restored files to today’s date.
- #update_timestamps=(value) ⇒ Object
-
#users_errored ⇒ Object
int64 - Number of users that failed to restore (only present for ‘restoration_type=users`).
- #users_errored=(value) ⇒ Object
-
#users_restored ⇒ Object
int64 - Number of users successfully restored (only present for ‘restoration_type=users`).
- #users_restored=(value) ⇒ Object
-
#users_total ⇒ Object
int64 - Total number of users processed (only present for ‘restoration_type=users`).
- #users_total=(value) ⇒ Object
Constructor Details
#initialize(attributes = {}, options = {}) ⇒ Restore
Returns a new instance of Restore.
7 8 9 10 |
# File 'lib/files.com/models/restore.rb', line 7 def initialize(attributes = {}, = {}) @attributes = attributes || {} @options = || {} end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
5 6 7 |
# File 'lib/files.com/models/restore.rb', line 5 def attributes @attributes end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
5 6 7 |
# File 'lib/files.com/models/restore.rb', line 5 def @options end |
Class Method Details
.all(params = {}, options = {}) ⇒ Object
228 229 230 |
# File 'lib/files.com/models/restore.rb', line 228 def self.all(params = {}, = {}) list(params, ) end |
.create(params = {}, options = {}) ⇒ Object
Parameters:
earliest_date (required) - string - Restore all files deleted after this date/time. Don't set this earlier than you need. Can not be greater than 365 days prior to the restore request.
prefix - string - Prefix of the files/folders to restore. To restore a folder, add a trailing slash to the folder name. Do not use a leading slash. To restore all deleted items, specify an empty string (`''`) in the prefix field or omit the field from the request.
restoration_type - string - Type of restoration to perform. `files` restores deleted filesystem items. `users` restores deleted users and associated access/authentication records.
restore_deleted_permissions - boolean - If true, we will also restore any Permissions that match the same path prefix from the same dates.
restore_in_place - boolean - If true, we will restore the files in place (into their original paths). If false, we will create a new restoration folder in the root and restore files there.
update_timestamps - boolean - If true, we will update the last modified timestamp of restored files to today's date. If false, we might trigger File Expiration to delete the file again.
239 240 241 242 243 244 245 246 247 |
# File 'lib/files.com/models/restore.rb', line 239 def self.create(params = {}, = {}) raise InvalidParameterError.new("Bad parameter: earliest_date must be an String") if params[:earliest_date] and !params[:earliest_date].is_a?(String) raise InvalidParameterError.new("Bad parameter: prefix must be an String") if params[:prefix] and !params[:prefix].is_a?(String) raise InvalidParameterError.new("Bad parameter: restoration_type must be an String") if params[:restoration_type] and !params[:restoration_type].is_a?(String) raise MissingParameterError.new("Parameter missing: earliest_date") unless params[:earliest_date] response, = Api.send_request("/restores", :post, params, ) Restore.new(response.data, ) 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).
sort_by - object - If set, sort records by the specified field in either `asc` or `desc` direction. Valid fields are .
filter - object - If set, return records where the specified field is equal to the supplied value. Valid fields are `restoration_type`.
217 218 219 220 221 222 223 224 225 226 |
# File 'lib/files.com/models/restore.rb', line 217 def self.list(params = {}, = {}) 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: sort_by must be an Hash") if params[:sort_by] and !params[:sort_by].is_a?(Hash) raise InvalidParameterError.new("Bad parameter: filter must be an Hash") if params[:filter] and !params[:filter].is_a?(Hash) List.new(Restore, params) do Api.send_request("/restores", :get, params, ) end end |
Instance Method Details
#api_keys_restored ⇒ Object
int64 - Number of API keys restored (only present for ‘restoration_type=users`).
148 149 150 |
# File 'lib/files.com/models/restore.rb', line 148 def api_keys_restored @attributes[:api_keys_restored] end |
#api_keys_restored=(value) ⇒ Object
152 153 154 |
# File 'lib/files.com/models/restore.rb', line 152 def api_keys_restored=(value) @attributes[:api_keys_restored] = value end |
#dirs_errored ⇒ Object
int64 - Number of directories that were not able to be restored.
40 41 42 |
# File 'lib/files.com/models/restore.rb', line 40 def dirs_errored @attributes[:dirs_errored] end |
#dirs_errored=(value) ⇒ Object
44 45 46 |
# File 'lib/files.com/models/restore.rb', line 44 def dirs_errored=(value) @attributes[:dirs_errored] = value end |
#dirs_restored ⇒ Object
int64 - Number of directories that were successfully restored.
31 32 33 |
# File 'lib/files.com/models/restore.rb', line 31 def dirs_restored @attributes[:dirs_restored] end |
#dirs_restored=(value) ⇒ Object
35 36 37 |
# File 'lib/files.com/models/restore.rb', line 35 def dirs_restored=(value) @attributes[:dirs_restored] = value end |
#dirs_total ⇒ Object
int64 - Total number of directories processed.
49 50 51 |
# File 'lib/files.com/models/restore.rb', line 49 def dirs_total @attributes[:dirs_total] end |
#dirs_total=(value) ⇒ Object
53 54 55 |
# File 'lib/files.com/models/restore.rb', line 53 def dirs_total=(value) @attributes[:dirs_total] = value end |
#earliest_date ⇒ Object
date-time - Restore all files deleted after this date/time. Don’t set this earlier than you need. Can not be greater than 365 days prior to the restore request.
13 14 15 |
# File 'lib/files.com/models/restore.rb', line 13 def earliest_date @attributes[:earliest_date] end |
#earliest_date=(value) ⇒ Object
17 18 19 |
# File 'lib/files.com/models/restore.rb', line 17 def earliest_date=(value) @attributes[:earliest_date] = value end |
#error_messages ⇒ Object
array(string) - Error messages received while restoring files and/or directories. Only present if there were errors.
193 194 195 |
# File 'lib/files.com/models/restore.rb', line 193 def @attributes[:error_messages] end |
#error_messages=(value) ⇒ Object
197 198 199 |
# File 'lib/files.com/models/restore.rb', line 197 def (value) @attributes[:error_messages] = value end |
#files_errored ⇒ Object
int64 - Number of files that were not able to be restored.
67 68 69 |
# File 'lib/files.com/models/restore.rb', line 67 def files_errored @attributes[:files_errored] end |
#files_errored=(value) ⇒ Object
71 72 73 |
# File 'lib/files.com/models/restore.rb', line 71 def files_errored=(value) @attributes[:files_errored] = value end |
#files_restored ⇒ Object
int64 - Number of files successfully restored.
58 59 60 |
# File 'lib/files.com/models/restore.rb', line 58 def files_restored @attributes[:files_restored] end |
#files_restored=(value) ⇒ Object
62 63 64 |
# File 'lib/files.com/models/restore.rb', line 62 def files_restored=(value) @attributes[:files_restored] = value end |
#files_total ⇒ Object
int64 - Total number of files processed.
76 77 78 |
# File 'lib/files.com/models/restore.rb', line 76 def files_total @attributes[:files_total] end |
#files_total=(value) ⇒ Object
80 81 82 |
# File 'lib/files.com/models/restore.rb', line 80 def files_total=(value) @attributes[:files_total] = value end |
#id ⇒ Object
int64 - Restore Record ID.
22 23 24 |
# File 'lib/files.com/models/restore.rb', line 22 def id @attributes[:id] end |
#id=(value) ⇒ Object
26 27 28 |
# File 'lib/files.com/models/restore.rb', line 26 def id=(value) @attributes[:id] = value end |
#prefix ⇒ Object
string - Prefix of the files/folders to restore. To restore a folder, add a trailing slash to the folder name. Do not use a leading slash. To restore all deleted items, specify an empty string (‘”`) in the prefix field or omit the field from the request.
85 86 87 |
# File 'lib/files.com/models/restore.rb', line 85 def prefix @attributes[:prefix] end |
#prefix=(value) ⇒ Object
89 90 91 |
# File 'lib/files.com/models/restore.rb', line 89 def prefix=(value) @attributes[:prefix] = value end |
#public_keys_restored ⇒ Object
int64 - Number of public keys restored (only present for ‘restoration_type=users`).
157 158 159 |
# File 'lib/files.com/models/restore.rb', line 157 def public_keys_restored @attributes[:public_keys_restored] end |
#public_keys_restored=(value) ⇒ Object
161 162 163 |
# File 'lib/files.com/models/restore.rb', line 161 def public_keys_restored=(value) @attributes[:public_keys_restored] = value end |
#restoration_type ⇒ Object
string - Type of restoration to perform. ‘files` restores deleted filesystem items. `users` restores deleted users and associated access/authentication records.
94 95 96 |
# File 'lib/files.com/models/restore.rb', line 94 def restoration_type @attributes[:restoration_type] end |
#restoration_type=(value) ⇒ Object
98 99 100 |
# File 'lib/files.com/models/restore.rb', line 98 def restoration_type=(value) @attributes[:restoration_type] = value end |
#restore_deleted_permissions ⇒ Object
boolean - If true, we will also restore any Permissions that match the same path prefix from the same dates.
112 113 114 |
# File 'lib/files.com/models/restore.rb', line 112 def @attributes[:restore_deleted_permissions] end |
#restore_deleted_permissions=(value) ⇒ Object
116 117 118 |
# File 'lib/files.com/models/restore.rb', line 116 def (value) @attributes[:restore_deleted_permissions] = value end |
#restore_in_place ⇒ Object
boolean - If true, we will restore the files in place (into their original paths). If false, we will create a new restoration folder in the root and restore files there.
103 104 105 |
# File 'lib/files.com/models/restore.rb', line 103 def restore_in_place @attributes[:restore_in_place] end |
#restore_in_place=(value) ⇒ Object
107 108 109 |
# File 'lib/files.com/models/restore.rb', line 107 def restore_in_place=(value) @attributes[:restore_in_place] = value end |
#save ⇒ Object
201 202 203 204 205 206 207 208 209 210 |
# File 'lib/files.com/models/restore.rb', line 201 def save if @attributes[:id] raise NotImplementedError.new("The Restore object doesn't support updates.") else new_obj = Restore.create(@attributes, @options) end @attributes = new_obj.attributes true end |
#status ⇒ Object
string - Status of the restoration process.
175 176 177 |
# File 'lib/files.com/models/restore.rb', line 175 def status @attributes[:status] end |
#status=(value) ⇒ Object
179 180 181 |
# File 'lib/files.com/models/restore.rb', line 179 def status=(value) @attributes[:status] = value end |
#two_factor_authentication_methods_restored ⇒ Object
int64 - Number of two factor authentication methods restored (only present for ‘restoration_type=users`).
166 167 168 |
# File 'lib/files.com/models/restore.rb', line 166 def two_factor_authentication_methods_restored @attributes[:two_factor_authentication_methods_restored] end |
#two_factor_authentication_methods_restored=(value) ⇒ Object
170 171 172 |
# File 'lib/files.com/models/restore.rb', line 170 def two_factor_authentication_methods_restored=(value) @attributes[:two_factor_authentication_methods_restored] = value end |
#update_timestamps ⇒ Object
boolean - If true, we will update the last modified timestamp of restored files to today’s date. If false, we might trigger File Expiration to delete the file again.
184 185 186 |
# File 'lib/files.com/models/restore.rb', line 184 def @attributes[:update_timestamps] end |
#update_timestamps=(value) ⇒ Object
188 189 190 |
# File 'lib/files.com/models/restore.rb', line 188 def (value) @attributes[:update_timestamps] = value end |
#users_errored ⇒ Object
int64 - Number of users that failed to restore (only present for ‘restoration_type=users`).
130 131 132 |
# File 'lib/files.com/models/restore.rb', line 130 def users_errored @attributes[:users_errored] end |
#users_errored=(value) ⇒ Object
134 135 136 |
# File 'lib/files.com/models/restore.rb', line 134 def users_errored=(value) @attributes[:users_errored] = value end |
#users_restored ⇒ Object
int64 - Number of users successfully restored (only present for ‘restoration_type=users`).
121 122 123 |
# File 'lib/files.com/models/restore.rb', line 121 def users_restored @attributes[:users_restored] end |
#users_restored=(value) ⇒ Object
125 126 127 |
# File 'lib/files.com/models/restore.rb', line 125 def users_restored=(value) @attributes[:users_restored] = value end |
#users_total ⇒ Object
int64 - Total number of users processed (only present for ‘restoration_type=users`).
139 140 141 |
# File 'lib/files.com/models/restore.rb', line 139 def users_total @attributes[:users_total] end |
#users_total=(value) ⇒ Object
143 144 145 |
# File 'lib/files.com/models/restore.rb', line 143 def users_total=(value) @attributes[:users_total] = value end |