Class: Appwrite::Backups
- Defined in:
- lib/appwrite/services/backups.rb
Instance Method Summary collapse
-
#create_archive(services:, resource_id: nil) ⇒ BackupArchive
Create a new archive asynchronously for a project.
-
#create_policy(policy_id:, services:, retention:, schedule:, name: nil, resource_id: nil, enabled: nil) ⇒ BackupPolicy
Create a new backup policy.
-
#create_restoration(archive_id:, services:, new_resource_id: nil, new_resource_name: nil) ⇒ BackupRestoration
Create and trigger a new restoration for a backup on a project.
-
#delete_archive(archive_id:) ⇒ Object
Delete an existing archive for a project.
-
#delete_policy(policy_id:) ⇒ Object
Delete a policy using it’s ID.
-
#get_archive(archive_id:) ⇒ BackupArchive
Get a backup archive using it’s ID.
-
#get_policy(policy_id:) ⇒ BackupPolicy
Get a backup policy using it’s ID.
-
#get_restoration(restoration_id:) ⇒ BackupRestoration
Get the current status of a backup restoration.
-
#initialize(client) ⇒ Backups
constructor
A new instance of Backups.
-
#list_archives(queries: nil) ⇒ BackupArchiveList
List all archives for a project.
-
#list_policies(queries: nil) ⇒ BackupPolicyList
List all policies for a project.
-
#list_restorations(queries: nil) ⇒ BackupRestorationList
List all backup restorations for a project.
-
#update_policy(policy_id:, name: nil, retention: nil, schedule: nil, enabled: nil) ⇒ BackupPolicy
Update an existing policy using it’s ID.
Constructor Details
#initialize(client) ⇒ Backups
Returns a new instance of Backups.
6 7 8 |
# File 'lib/appwrite/services/backups.rb', line 6 def initialize(client) @client = client end |
Instance Method Details
#create_archive(services:, resource_id: nil) ⇒ BackupArchive
Create a new archive asynchronously for a project.
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/appwrite/services/backups.rb', line 40 def create_archive(services:, resource_id: nil) api_path = '/backups/archives' if services.nil? raise Appwrite::Exception.new('Missing required parameter: "services"') end api_params = { services: services, resourceId: resource_id, } api_headers = { "content-type": 'application/json', } @client.call( method: 'POST', path: api_path, headers: api_headers, params: api_params, response_type: Models::BackupArchive ) end |
#create_policy(policy_id:, services:, retention:, schedule:, name: nil, resource_id: nil, enabled: nil) ⇒ BackupPolicy
Create a new backup policy.
156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 |
# File 'lib/appwrite/services/backups.rb', line 156 def create_policy(policy_id:, services:, retention:, schedule:, name: nil, resource_id: nil, enabled: nil) api_path = '/backups/policies' if policy_id.nil? raise Appwrite::Exception.new('Missing required parameter: "policyId"') end if services.nil? raise Appwrite::Exception.new('Missing required parameter: "services"') end if retention.nil? raise Appwrite::Exception.new('Missing required parameter: "retention"') end if schedule.nil? raise Appwrite::Exception.new('Missing required parameter: "schedule"') end api_params = { policyId: policy_id, name: name, services: services, resourceId: resource_id, enabled: enabled, retention: retention, schedule: schedule, } api_headers = { "content-type": 'application/json', } @client.call( method: 'POST', path: api_path, headers: api_headers, params: api_params, response_type: Models::BackupPolicy ) end |
#create_restoration(archive_id:, services:, new_resource_id: nil, new_resource_name: nil) ⇒ BackupRestoration
Create and trigger a new restoration for a backup on a project.
299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 |
# File 'lib/appwrite/services/backups.rb', line 299 def create_restoration(archive_id:, services:, new_resource_id: nil, new_resource_name: nil) api_path = '/backups/restoration' if archive_id.nil? raise Appwrite::Exception.new('Missing required parameter: "archiveId"') end if services.nil? raise Appwrite::Exception.new('Missing required parameter: "services"') end api_params = { archiveId: archive_id, services: services, newResourceId: new_resource_id, newResourceName: new_resource_name, } api_headers = { "content-type": 'application/json', } @client.call( method: 'POST', path: api_path, headers: api_headers, params: api_params, response_type: Models::BackupRestoration ) end |
#delete_archive(archive_id:) ⇒ Object
Delete an existing archive for a project.
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 |
# File 'lib/appwrite/services/backups.rb', line 98 def delete_archive(archive_id:) api_path = '/backups/archives/{archiveId}' .gsub('{archiveId}', archive_id) if archive_id.nil? raise Appwrite::Exception.new('Missing required parameter: "archiveId"') end api_params = { } api_headers = { "content-type": 'application/json', } @client.call( method: 'DELETE', path: api_path, headers: api_headers, params: api_params, ) end |
#delete_policy(policy_id:) ⇒ Object
Delete a policy using it’s ID.
268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 |
# File 'lib/appwrite/services/backups.rb', line 268 def delete_policy(policy_id:) api_path = '/backups/policies/{policyId}' .gsub('{policyId}', policy_id) if policy_id.nil? raise Appwrite::Exception.new('Missing required parameter: "policyId"') end api_params = { } api_headers = { "content-type": 'application/json', } @client.call( method: 'DELETE', path: api_path, headers: api_headers, params: api_params, ) end |
#get_archive(archive_id:) ⇒ BackupArchive
Get a backup archive using it’s ID.
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/appwrite/services/backups.rb', line 70 def get_archive(archive_id:) api_path = '/backups/archives/{archiveId}' .gsub('{archiveId}', archive_id) if archive_id.nil? raise Appwrite::Exception.new('Missing required parameter: "archiveId"') end api_params = { } api_headers = { } @client.call( method: 'GET', path: api_path, headers: api_headers, params: api_params, response_type: Models::BackupArchive ) end |
#get_policy(policy_id:) ⇒ BackupPolicy
Get a backup policy using it’s ID.
203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 |
# File 'lib/appwrite/services/backups.rb', line 203 def get_policy(policy_id:) api_path = '/backups/policies/{policyId}' .gsub('{policyId}', policy_id) if policy_id.nil? raise Appwrite::Exception.new('Missing required parameter: "policyId"') end api_params = { } api_headers = { } @client.call( method: 'GET', path: api_path, headers: api_headers, params: api_params, response_type: Models::BackupPolicy ) end |
#get_restoration(restoration_id:) ⇒ BackupRestoration
Get the current status of a backup restoration.
359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 |
# File 'lib/appwrite/services/backups.rb', line 359 def get_restoration(restoration_id:) api_path = '/backups/restorations/{restorationId}' .gsub('{restorationId}', restoration_id) if restoration_id.nil? raise Appwrite::Exception.new('Missing required parameter: "restorationId"') end api_params = { } api_headers = { } @client.call( method: 'GET', path: api_path, headers: api_headers, params: api_params, response_type: Models::BackupRestoration ) end |
#list_archives(queries: nil) ⇒ BackupArchiveList
List all archives for a project.
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/appwrite/services/backups.rb', line 15 def list_archives(queries: nil) api_path = '/backups/archives' api_params = { queries: queries, } api_headers = { } @client.call( method: 'GET', path: api_path, headers: api_headers, params: api_params, response_type: Models::BackupArchiveList ) end |
#list_policies(queries: nil) ⇒ BackupPolicyList
List all policies for a project.
126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 |
# File 'lib/appwrite/services/backups.rb', line 126 def list_policies(queries: nil) api_path = '/backups/policies' api_params = { queries: queries, } api_headers = { } @client.call( method: 'GET', path: api_path, headers: api_headers, params: api_params, response_type: Models::BackupPolicyList ) end |
#list_restorations(queries: nil) ⇒ BackupRestorationList
List all backup restorations for a project.
335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 |
# File 'lib/appwrite/services/backups.rb', line 335 def list_restorations(queries: nil) api_path = '/backups/restorations' api_params = { queries: queries, } api_headers = { } @client.call( method: 'GET', path: api_path, headers: api_headers, params: api_params, response_type: Models::BackupRestorationList ) end |
#update_policy(policy_id:, name: nil, retention: nil, schedule: nil, enabled: nil) ⇒ BackupPolicy
Update an existing policy using it’s ID.
235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 |
# File 'lib/appwrite/services/backups.rb', line 235 def update_policy(policy_id:, name: nil, retention: nil, schedule: nil, enabled: nil) api_path = '/backups/policies/{policyId}' .gsub('{policyId}', policy_id) if policy_id.nil? raise Appwrite::Exception.new('Missing required parameter: "policyId"') end api_params = { name: name, retention: retention, schedule: schedule, enabled: enabled, } api_headers = { "content-type": 'application/json', } @client.call( method: 'PATCH', path: api_path, headers: api_headers, params: api_params, response_type: Models::BackupPolicy ) end |