@@ -14,14 +14,18 @@ import (
1414
1515func (ms * MockSuite ) TestCloudStorageBlockListCmd (assert , require * td.T ) {
1616 httpmock .RegisterResponder (http .MethodGet ,
17- "https://eu.api.ovh.com/v1/cloud /project/fakeProjectID/volume" ,
17+ "https://eu.api.ovh.com/v2/publicCloud /project/fakeProjectID/storage/block /volume" ,
1818 httpmock .NewStringResponder (200 , `[
1919 {
2020 "id": "vol-1",
21- "name": "test-volume",
22- "region": "GRA9",
23- "type": "high-speed-gen2",
24- "status": "available"
21+ "resourceStatus": "READY",
22+ "currentState": {
23+ "name": "test-volume",
24+ "size": 50,
25+ "volumeType": "HIGH_SPEED_GEN2",
26+ "status": "AVAILABLE",
27+ "location": { "region": "EU-WEST-PAR" }
28+ }
2529 }
2630 ]` ))
2731
@@ -34,14 +38,22 @@ func (ms *MockSuite) TestCloudStorageBlockListCmd(assert, require *td.T) {
3438
3539func (ms * MockSuite ) TestCloudStorageBlockGetCmd (assert , require * td.T ) {
3640 httpmock .RegisterResponder (http .MethodGet ,
37- "https://eu.api.ovh.com/v1/cloud /project/fakeProjectID/volume/vol-1" ,
41+ "https://eu.api.ovh.com/v2/publicCloud /project/fakeProjectID/storage/block /volume/vol-1" ,
3842 httpmock .NewStringResponder (200 , `{
3943 "id": "vol-1",
40- "name": "test-volume",
41- "region": "GRA9",
42- "type": "high-speed-gen2",
43- "status": "available",
44- "size": 50
44+ "resourceStatus": "READY",
45+ "currentState": {
46+ "name": "test-volume",
47+ "size": 50,
48+ "volumeType": "HIGH_SPEED_GEN2",
49+ "status": "AVAILABLE",
50+ "location": { "region": "EU-WEST-PAR" }
51+ },
52+ "targetSpec": {
53+ "name": "test-volume",
54+ "size": 50,
55+ "volumeType": "HIGH_SPEED_GEN2"
56+ }
4557 }` ))
4658
4759 out , err := cmd .Execute ("cloud" , "storage" , "block" , "get" , "vol-1" , "--cloud-project" , "fakeProjectID" )
@@ -53,7 +65,7 @@ func (ms *MockSuite) TestCloudStorageBlockGetCmd(assert, require *td.T) {
5365
5466func (ms * MockSuite ) TestCloudStorageBlockDeleteCmd (assert , require * td.T ) {
5567 httpmock .RegisterResponder (http .MethodDelete ,
56- "https://eu.api.ovh.com/v1/cloud /project/fakeProjectID/volume/vol-1" ,
68+ "https://eu.api.ovh.com/v2/publicCloud /project/fakeProjectID/storage/block /volume/vol-1" ,
5769 httpmock .NewStringResponder (200 , `` ))
5870
5971 out , err := cmd .Execute ("cloud" , "storage" , "block" , "delete" , "vol-1" , "--cloud-project" , "fakeProjectID" )
@@ -64,14 +76,17 @@ func (ms *MockSuite) TestCloudStorageBlockDeleteCmd(assert, require *td.T) {
6476
6577func (ms * MockSuite ) TestCloudStorageBlockSnapshotListCmd (assert , require * td.T ) {
6678 httpmock .RegisterResponder (http .MethodGet ,
67- "https://eu.api.ovh.com/v1/cloud /project/fakeProjectID/volume /snapshot" ,
79+ "https://eu.api.ovh.com/v2/publicCloud /project/fakeProjectID/storage/block /snapshot" ,
6880 httpmock .NewStringResponder (200 , `[
6981 {
7082 "id": "snap-1",
71- "name": "test-snapshot",
72- "region": "GRA9",
73- "description": "test",
74- "status": "available"
83+ "resourceStatus": "READY",
84+ "currentState": {
85+ "name": "test-snapshot",
86+ "size": 10,
87+ "volumeId": "vol-1",
88+ "location": { "region": "EU-WEST-PAR" }
89+ }
7590 }
7691 ]` ))
7792
@@ -83,26 +98,17 @@ func (ms *MockSuite) TestCloudStorageBlockSnapshotListCmd(assert, require *td.T)
8398
8499func (ms * MockSuite ) TestCloudStorageBlockBackupListCmd (assert , require * td.T ) {
85100 httpmock .RegisterResponder (http .MethodGet ,
86- "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/region" ,
87- httpmock .NewStringResponder (200 , `["GRA9"]` ))
88-
89- httpmock .RegisterResponder (http .MethodGet ,
90- "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/region/GRA9" ,
91- httpmock .NewStringResponder (200 , `{
92- "name": "GRA9",
93- "type": "region",
94- "status": "UP",
95- "services": [{"name": "volume", "status": "UP"}]
96- }` ))
97-
98- httpmock .RegisterResponder (http .MethodGet ,
99- "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/region/GRA9/volumeBackup" ,
101+ "https://eu.api.ovh.com/v2/publicCloud/project/fakeProjectID/storage/block/backup" ,
100102 httpmock .NewStringResponder (200 , `[
101103 {
102104 "id": "backup-1",
103- "name": "test-backup",
104- "region": "GRA9",
105- "status": "ok"
105+ "resourceStatus": "READY",
106+ "currentState": {
107+ "name": "test-backup",
108+ "size": 10,
109+ "volumeId": "vol-1",
110+ "location": { "region": "EU-WEST-PAR" }
111+ }
106112 }
107113 ]` ))
108114
0 commit comments