-
Notifications
You must be signed in to change notification settings - Fork 24
/
terminus.backup.api.inc
44 lines (41 loc) · 1.25 KB
/
terminus.backup.api.inc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
/**
* API call to get the backup catalog.
*/
function terminus_api_backup_catalog($site_uuid, $environment) {
$realm = 'site';
$uuid = $site_uuid;
$path = 'environments/' . $environment . '/backups/catalog';
$method = 'GET';
return terminus_request($realm, $uuid, $path, $method);
}
/**
* API call to get a single backup item's S3 token
*/
function terminus_api_backup_download_url($site_uuid, $environment, $bucket, $element) {
$realm = 'site';
$uuid = $site_uuid;
$path = 'environments/' . $environment . '/backups/catalog/' . $bucket . '/' . $element . '/s3token';
$method = 'POST';
$data = array(
'method' => 'GET',
);
return terminus_request($realm, $uuid, $path, $method, $data);
}
/**
* API Function to make a backup.
*/
function terminus_api_site_make_backup($site_uuid, $environment, $entry_type = 'backup', $code = TRUE, $db = TRUE, $files = TRUE) {
$realm = 'site';
$uuid = $site_uuid;
$path = 'environments/' . $environment . '/backups/create';
$method = 'POST';
$data = array(
'entry_type' => $entry_type,
'scheduled_for' => time(),
'code' => ($code) ? 1 : 0,
'database' => ($db) ? 1 : 0,
'files' => ($files) ? 1 : 0,
);
return terminus_request($realm, $uuid, $path, $method, $data);
}