30 use \HPCloud\Services\DBaaS\SnapshotDetails;
74 $url = $this->
url .
'/snapshots';
75 if (!empty($instanceId)) {
76 $url .=
'?instanceId=' . rawurlencode($instanceId);
79 $retval = $resp = $this->client->doRequest(
$url,
'GET', $headers);
81 $json = json_decode($retval, TRUE);
83 foreach ($json[
'snapshots'] as $item) {
84 $list[] = SnapshotDetails::newFromJSON($item);
112 $url = $this->
url .
'/snapshots';
115 'instanceId' => $instanceId,
120 $json = json_encode($create);
121 $resp = $this->client->doRequest(
$url,
'POST', $this->
headers(), $json);
123 $data = json_decode($resp, TRUE);
125 return SnapshotDetails::newFromJSON($data[
'snapshot']);
141 public function delete($snapshotId) {
142 $url = sprintf(
'%s/snapshots/%s', $this->
url, $snapshotId);
143 $this->client->doRequest(
$url,
'DELETE', $this->
headers());
159 $url = sprintf(
'%s/snapshots/%s', $this->
url, $snapshotId);
160 $res = $this->client->doRequest(
$url,
'GET', $this->
headers());
162 $json = json_decode($res->content(), TRUE);
164 return SnapshotDetails::newFromJSON($json[
'snapshot']);