Skip to content

Commit 5ecb8d5

Browse files
committed
Added project param to container snapshots
1 parent 96fbcf1 commit 5ecb8d5

File tree

1 file changed

+27
-6
lines changed

1 file changed

+27
-6
lines changed

src/Endpoint/Containers/Snapshots.php

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,18 @@ public function all($name)
2121
{
2222
$snapshots = [];
2323

24-
foreach ($this->get($this->getEndpoint().$name.'/snapshots/') as $snapshot) {
25-
$snapshots[] = str_replace(
24+
$config = [
25+
"project"=>$this->client->getProject()
26+
];
27+
28+
foreach ($this->get($this->getEndpoint().$name.'/snapshots/', $config) as $snapshot) {
29+
$snapshot = str_replace(
2630
'/'.$this->client->getApiVersion().'/containers/'.$name.'/snapshots/',
2731
'',
2832
$snapshot
2933
);
34+
$snapshot = str_replace("?project=".$config["project"], "", $snapshot);
35+
$snapshots[] = $snapshot;
3036
}
3137

3238
return $snapshots;
@@ -41,7 +47,11 @@ public function all($name)
4147
*/
4248
public function info($name, $snapshot)
4349
{
44-
return $this->get($this->getEndpoint().$name.'/snapshots/'.$snapshot);
50+
$config = [
51+
"project"=>$this->client->getProject()
52+
];
53+
54+
return $this->get($this->getEndpoint().$name.'/snapshots/'.$snapshot, $config);
4555
}
4656

4757
/**
@@ -63,7 +73,11 @@ public function create($name, $snapshot, $stateful = false, $wait = false)
6373
$opts['name'] = $snapshot;
6474
$opts['stateful'] = $stateful;
6575

66-
$response = $this->post($this->getEndpoint().$name.'/snapshots', $opts);
76+
$config = [
77+
"project"=>$this->client->getProject()
78+
];
79+
80+
$response = $this->post($this->getEndpoint().$name.'/snapshots', $opts, $config);
6781

6882
if ($wait) {
6983
$response = $this->client->operations->wait($response['id']);
@@ -101,7 +115,10 @@ public function restore($name, $snapshot, $wait = false)
101115
public function rename($name, $snaphot, $newSnapshot, $wait = false)
102116
{
103117
$opts['name'] = $newSnapshot;
104-
$response = $this->post($this->getEndpoint().$name.'/snapshots/'.$snaphot, $opts);
118+
$config = [
119+
"project"=>$this->client->getProject()
120+
];
121+
$response = $this->post($this->getEndpoint().$name.'/snapshots/'.$snaphot, $opts, $config);
105122

106123
if ($wait) {
107124
$response = $this->client->operations->wait($response['id']);
@@ -120,7 +137,11 @@ public function rename($name, $snaphot, $newSnapshot, $wait = false)
120137
*/
121138
public function remove($name, $snaphot, $wait = false)
122139
{
123-
$response = $this->delete($this->getEndpoint().$name.'/snapshots/'.$snaphot);
140+
$config = [
141+
"project"=>$this->client->getProject()
142+
];
143+
144+
$response = $this->delete($this->getEndpoint().$name.'/snapshots/'.$snaphot, $config);
124145

125146
if ($wait) {
126147
$response = $this->client->operations->wait($response['id']);

0 commit comments

Comments
 (0)