Skip to content
This repository was archived by the owner on Nov 10, 2025. It is now read-only.

Commit e6f429d

Browse files
Merge pull request #6 from illegalstudio/cr-volume-delete-options
added cascade parameters to Volume parameters / revised deletable int…
2 parents 5dfc40d + 5cda44d commit e6f429d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+58
-46
lines changed

src/BlockStorage/v2/Models/QuotaSet.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public function update()
7979
/**
8080
* {@inheritdoc}
8181
*/
82-
public function delete()
82+
public function delete(array $userOptions = [])
8383
{
8484
$response = $this->executeWithState($this->api->deleteQuotaSet());
8585
$this->populateFromResponse($response);

src/BlockStorage/v2/Models/Snapshot.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public function update()
9898
$this->executeWithState($this->api->putSnapshot());
9999
}
100100

101-
public function delete()
101+
public function delete(array $userOptions = [])
102102
{
103103
$this->executeWithState($this->api->deleteSnapshot());
104104
}

src/BlockStorage/v2/Models/Volume.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ public function update()
125125
$this->populateFromResponse($response);
126126
}
127127

128-
public function delete()
128+
public function delete(array $userOptions = [])
129129
{
130130
$this->executeWithState($this->api->deleteVolume());
131131
}

src/BlockStorage/v2/Models/VolumeType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function update()
3939
$this->executeWithState($this->api->putType());
4040
}
4141

42-
public function delete()
42+
public function delete(array $userOptions = [])
4343
{
4444
$this->executeWithState($this->api->deleteType());
4545
}

src/BlockStorage/v3/Api.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,10 @@ public function deleteVolume(): array
9292
return [
9393
'method' => 'DELETE',
9494
'path' => 'volumes/{id}',
95-
'params' => ['id' => $this->params->idPath()],
95+
'params' => [
96+
'id' => $this->params->idPath(),
97+
'cascade' => $this->params->cascade()
98+
],
9699
];
97100
}
98101

src/BlockStorage/v3/Models/QuotaSet.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public function update()
8080
/**
8181
* {@inheritdoc}
8282
*/
83-
public function delete()
83+
public function delete(array $userOptions = [])
8484
{
8585
$response = $this->executeWithState($this->api->deleteQuotaSet());
8686
$this->populateFromResponse($response);

src/BlockStorage/v3/Models/Snapshot.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ public function update()
9999
$this->executeWithState($this->api->putSnapshot());
100100
}
101101

102-
public function delete()
102+
public function delete(array $userOptions = [])
103103
{
104104
$this->executeWithState($this->api->deleteSnapshot());
105105
}

src/BlockStorage/v3/Models/Volume.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,10 @@ public function update()
126126
$this->populateFromResponse($response);
127127
}
128128

129-
public function delete()
129+
public function delete(array $userOptions = [])
130130
{
131-
$this->executeWithState($this->api->deleteVolume());
131+
$userOptions = array_merge($userOptions, ['id' => $this->id]);
132+
$this->execute($this->api->deleteVolume(), $userOptions);
132133
}
133134

134135
public function getMetadata(): array

src/BlockStorage/v3/Models/VolumeType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function update()
4040
$this->executeWithState($this->api->putType());
4141
}
4242

43-
public function delete()
43+
public function delete(array $userOptions = [])
4444
{
4545
$this->executeWithState($this->api->deleteType());
4646
}

src/BlockStorage/v3/Params.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,15 @@ public function imageRef(): array
7070
];
7171
}
7272

73+
public function cascade(): array
74+
{
75+
return [
76+
'location' => self::QUERY,
77+
'type' => self::BOOL_TYPE,
78+
'description' => 'Indicates whether to force delete a volume even if the volume is in deleting or error_deleting.',
79+
];
80+
}
81+
7382
public function volumeType(): array
7483
{
7584
return [

0 commit comments

Comments
 (0)