forked from pantheon-deprecated/terminus-deprecated
-
Notifications
You must be signed in to change notification settings - Fork 0
/
terminus.workflow.api.inc
60 lines (56 loc) · 1.58 KB
/
terminus.workflow.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<?php
/**
* @file
* API functions for Atlas/Ygg Workflow Integration
*/
/**
* API call to clone a database between site environments.
*/
function terminus_api_environment_clone_database($site_uuid, $env_source, $env_target, $updatedb = 0) {
$realm = 'site';
$path = 'environments/' . $env_target . '/database';
$method = 'POST';
$uuid = $site_uuid;
$data = array(
'clone-from-environment' => $env_source,
'updatedb' => $updatedb,
);
return terminus_request($realm, $uuid, $path, $method, $data);
}
/**
* API call to clone user files between site environments.
*/
function terminus_api_environment_clone_files($site_uuid, $env_source, $env_target) {
$realm = 'site';
$path = 'environments/' . $env_target . '/files';
$method = 'POST';
$uuid = $site_uuid;
$data = array(
'clone-from-environment' => $env_source,
);
return terminus_request($realm, $uuid, $path, $method, $data);
}
/**
* API Function to deploy code to a site environment.
*/
function terminus_api_environment_deploy_code($site_uuid, $newenv, $updatedb = 0) {
$realm = 'site';
$uuid = $site_uuid;
$path ='environments/' . $newenv . '/code';
$method = 'POST';
$data = json_encode(array(
'updatedb' => $updatedb,
));
terminus_request($realm, $uuid, $path, $method, $data);
}
/**
* API Function to Wipe an Environment
*/
function terminus_api_environment_content_wipe($site_uuid, $environment) {
$realm = 'site';
$uuid = $site_uuid;
$path ='environments/' . $environment . '/wipe';
$method = 'POST';
$data = '';
terminus_request($realm, $uuid, $path, $method, $data);
}