-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Now that the server API supports hypervisor cluster delete, we can add support in the Terraform provider.
- Loading branch information
1 parent
bafc39c
commit 7c105f9
Showing
7 changed files
with
118 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
internal/simulator/fixtures/hypervisorclusters/delete/async1.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"associatedResources":[],"createdAt":"2024-11-18T13:44:13.288731414Z","customerId":"131608da3faa11efb5afca2247c626ef","displayName":"Remove Hypervisor Clusters","endedAt":null,"error":null,"estimatedRunningDurationMinutes":10,"generation":1,"groups":[{"id":"131608da3faa11efb5afca2247c626ef","name":"Default Group"}],"hasChildOperations":false,"healthStatus":"OK","id":"a73607cc-ae57-4efe-b573-615813e6c77d","logMessages":[{"message":"Remove hypervisor clusters from hci system group-mip-array5305 starting","timestamp":"2024-11-18T13:44:13.288733298Z"}],"name":"Remove Hypervisor Clusters","parent":null,"progressPercent":0,"recommendations":[],"resourceUri":"/data-services/v1beta1/async-operations/a73607cc-ae57-4efe-b573-615813e6c77d","rootOperation":{"id":"a73607cc-ae57-4efe-b573-615813e6c77d","name":"","resourceUri":"/data-services/v1beta1/async-operations/a73607cc-ae57-4efe-b573-615813e6c77d","type":"task"},"services":["private-cloud-business-edition"],"sourceResourceUri":"/private-cloud-business/v1beta1/systems/126fd201-9e6e-5e31-9ffb-a766265b1fd3","startedAt":"2024-11-18T13:44:13.288731842Z","state":"RUNNING","subtreeOperationCount":0,"suggestedPollingIntervalSeconds":2,"type":"task","updatedAt":"2024-11-18T13:44:13.304000116Z","userId":"stuart.mclaren@hpe.com"} |
2 changes: 2 additions & 0 deletions
2
internal/simulator/fixtures/hypervisorclusters/delete/async2.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
{"associatedResources":[],"createdAt":"2024-11-18T13:44:13.288731414Z","customerId":"131608da3faa11efb5afca2247c626ef","displayName":"Remove Hypervisor Clusters","endedAt":"2024-11-18T13:45:47.844753953Z","error":null,"estimatedRunningDurationMinutes":10,"generation":3,"groups":[{"id":"131608da3faa11efb5afca2247c626ef","name":"Default Group"}],"hasChildOperations":false,"healthStatus":"OK","id":"a73607cc-ae57-4efe-b573-615813e6c77d","logMessages":[{"message":"Remove hypervisor clusters from hci system group-mip-array5305 starting","timestamp":"2024-11-18T13:44:13.288733298Z"},{"message":"Deleted hypervisor cluster mclaren01 in datacenter mip-array5305-DC on HCI system group-mip-array5305","timestamp":"2024-11-18T13:45:47.806931074Z"},{"message":"Remove hypervisor clusters from hci system group-mip-array5305 done","timestamp":"2024-11-18T13:45:47.844715917Z"}],"name":"Remove Hypervisor Clusters","parent":null,"progressPercent":100,"recommendations":[],"resourceUri":"/data-services/v1beta1/async-operations/a73607cc-ae57-4efe-b573-615813e6c77d","rootOperation":{"id":"a73607cc-ae57-4efe-b573-615813e6c77d","name":"","resourceUri":"/data-services/v1beta1/async-operations/a73607cc-ae57-4efe-b573-615813e6c77d","type":"task"},"services":["private-cloud-business-edition"],"sourceResourceUri":"/private-cloud-business/v1beta1/systems/126fd201-9e6e-5e31-9ffb-a766265b1fd3","startedAt":"2024-11-18T13:44:13.288731842Z","state":"SUCCEEDED","subtreeOperationCount":0,"suggestedPollingIntervalSeconds":2,"type":"task","updatedAt":"2024-11-18T13:45:48.024461169Z","userId":"stuart.mclaren@hpe.com"} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// (C) Copyright 2024 Hewlett Packard Enterprise Development LP | ||
|
||
package simulator | ||
|
||
func HypervisorCluster() { | ||
hypervisorClusterCreate() | ||
hypervisorClusterDelete() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// (C) Copyright 2024 Hewlett Packard Enterprise Development LP | ||
|
||
package simulator | ||
|
||
import ( | ||
_ "embed" | ||
|
||
"github.com/h2non/gock" | ||
) | ||
|
||
//go:embed fixtures/hypervisorclusters/delete/async1.json | ||
var deleteTaskOne string | ||
|
||
//go:embed fixtures/hypervisorclusters/delete/async2.json | ||
var deleteTaskTwo string | ||
|
||
func hypervisorClusterDelete() { | ||
taskID := "a73607cc-ae57-4efe-b573-615813e6c77d" | ||
systemID := "126fd201-9e6e-5e31-9ffb-a766265b1fd3" | ||
clusterID := "298a299e-78f5-5acb-86ce-4e9fdc290ab7" | ||
|
||
gock.New("http://localhost"). | ||
Post("/private-cloud-business/v1beta1/systems/"+systemID+ | ||
"/remove-hypervisor-clusters"). | ||
MatchType("json"). | ||
JSON(map[string][]string{"hypervisor_cluster_ids": {clusterID}}). | ||
Reply(202). | ||
SetHeader("Location", "/data-services/v1beta1/async-operations/"+taskID) | ||
|
||
gock.New("http://localhost"). | ||
Get("/data-services/v1beta1/async-operations/"+taskID). | ||
Reply(200). | ||
SetHeader("Content-Type", "application/json"). | ||
BodyString(deleteTaskOne) | ||
|
||
gock.New("http://localhost"). | ||
Get("/data-services/v1beta1/async-operations/"+taskID). | ||
Reply(200). | ||
SetHeader("Content-Type", "application/json"). | ||
BodyString(deleteTaskTwo) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters