Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Adding in reset status
  • Loading branch information
clwells committed Sep 7, 2017
commit 32538768a485ca019df917c57769117abd8f301a
13 changes: 13 additions & 0 deletions src/BlockStorage/v2/Api.php
Original file line number Diff line number Diff line change
Expand Up @@ -316,4 +316,17 @@ public function extendVolume(): array
];
}

public function resetVolumeStatus(): array
{
return [
'method' => 'POST',
'path' => 'volumes/{id}/action',
'jsonKey' => 'os-reset_status',
'params' => [
'id' => $this->params->idPath(),
'status' => $this->params->status()
],
];
}

}
13 changes: 10 additions & 3 deletions src/BlockStorage/v2/Models/Volume.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,14 @@ public function delete()
$this->executeWithState($this->api->deleteVolume());
}

public function resetStatus(string $status) {
$response = $this->execute($this->api->resetVolumeStatus(), [
'id' => $this->id,
'status' => $status
]);
$this->populateFromResponse($response);
}

public function getMetadata(): array
{
$response = $this->executeWithState($this->api->getVolumeMetadata());
Expand Down Expand Up @@ -139,10 +147,9 @@ public function parseMetadata(ResponseInterface $response): array
public function extend(int $size_in_gb)
{
$response = $this->execute($this->api->extendVolume(), [
'id' => $this->id,
'new_size' => $size_in_gb
'id' => $this->id,
'new_size' => $size_in_gb
]);

$this->populateFromResponse($response);
}
}
10 changes: 10 additions & 0 deletions src/BlockStorage/v2/Params.php
Original file line number Diff line number Diff line change
Expand Up @@ -233,4 +233,14 @@ public function nullAction(): array
'required' => true
];
}

public function status(): array
{
return [
'type' => self::STRING_TYPE,
'location' => self::JSON,
'required' => true,
'description' => 'The new status of the volume',
];
}
}