Skip to content

Commit 148c897

Browse files
fix(managed_object_storage): use correct path for bucket metrics request (#285)
1 parent 3b92d78 commit 148c897

24 files changed

+554
-4396
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ See updating [Changelog example here](https://keepachangelog.com/en/1.0.0/)
88
### Added
99
- Server groups: Add `AddServerToServerGroup` and `RemoveServerFromServerGroup` methods.
1010

11+
### Fixed
12+
- Managed Object Storage: use correct path for `GetManagedObjectStorageBucketMetricsRequest`
13+
1114
## [6.11.0]
1215

1316
### Added

upcloud/request/managed_object_storage.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ type GetManagedObjectStorageBucketMetricsRequest struct {
129129

130130
// RequestURL implements the Request interface
131131
func (r *GetManagedObjectStorageBucketMetricsRequest) RequestURL() string {
132-
path := fmt.Sprintf("%s/%s/metrics/buckets", managedObjectStorageBasePath, r.ServiceUUID)
132+
path := fmt.Sprintf("%s/%s/buckets", managedObjectStorageBasePath, r.ServiceUUID)
133133
if r.Page != nil {
134134
return fmt.Sprintf("%s?%s", path, r.Page.String())
135135
}

upcloud/request/managed_object_storage_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ func TestGetManagedObjectStorageBucketMetricsRequest_RequestURL(t *testing.T) {
105105
ServiceUUID: "service",
106106
Page: DefaultPage,
107107
}
108-
assert.Equal(t, "/object-storage-2/service/metrics/buckets?limit=100&offset=0", req.RequestURL())
108+
assert.Equal(t, "/object-storage-2/service/buckets?limit=100&offset=0", req.RequestURL())
109109
}
110110

111111
func TestCreateManagedObjectStorageNetworkRequest_RequestURL(t *testing.T) {

upcloud/service/fixtures/createmanagedobjectstorage.yaml

Lines changed: 10 additions & 187 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ interactions:
1010
Content-Type:
1111
- application/json
1212
User-Agent:
13-
- upcloud-go-api/6.6.0
13+
- upcloud-go-api/6.11.0
1414
url: https://api.upcloud.com/1.3/object-storage-2/regions
1515
method: GET
1616
response:
@@ -21,131 +21,33 @@ interactions:
2121
Content-Type:
2222
- application/json
2323
Date:
24-
- Tue, 10 Oct 2023 00:42:02 GMT
24+
- Thu, 18 Jan 2024 15:42:50 GMT
2525
Strict-Transport-Security:
2626
- max-age=63072000
2727
status: 200 OK
2828
code: 200
2929
duration: ""
3030
- request:
31-
body: '{"sub_account":{"username":"managedobjectstorage","password":"","first_name":"","last_name":"","company":"","address":"","postal_code":"","city":"","email":"managedobjectstorage@example.com","phone":"+358.123456789","state":"","country":"","currency":"EUR","language":"en","vat_number":"","timezone":"Europe/Helsinki","allow_api":"no","allow_gui":"no","tag_access":{"tag":null},"roles":{"role":null},"server_access":{"server":null},"storage_access":{"storage":null},"network_access":{"network":null},"ip_filters":{"ip_filter":null}}}'
31+
body: '{"configured_status":"started","labels":[{"key":"example-key","value":"example-value"}],"name":"go-sdk-integration-test","networks":[{"family":"IPv4","name":"example-public-network","type":"public"}],"region":"europe-1","users":[{"username":"test"}]}'
3232
form: {}
3333
headers:
3434
Accept:
3535
- application/json
3636
Content-Type:
3737
- application/json
3838
User-Agent:
39-
- upcloud-go-api/6.6.0
40-
url: https://api.upcloud.com/1.3/account/sub
41-
method: POST
42-
response:
43-
body: ""
44-
headers:
45-
Date:
46-
- Tue, 10 Oct 2023 00:42:02 GMT
47-
Server:
48-
- Apache
49-
Strict-Transport-Security:
50-
- max-age=63072000
51-
status: 204 No Content
52-
code: 204
53-
duration: ""
54-
- request:
55-
body: ""
56-
form: {}
57-
headers:
58-
Accept:
59-
- application/json
60-
Content-Type:
61-
- application/json
62-
User-Agent:
63-
- upcloud-go-api/6.6.0
64-
url: https://api.upcloud.com/1.3/account/details/managedobjectstorage
65-
method: GET
66-
response:
67-
body: |
68-
{
69-
"account" : {
70-
"address" : "",
71-
"allow_api" : "no",
72-
"allow_gui" : "no",
73-
"campaigns" : {
74-
"campaign" : []
75-
},
76-
"city" : "",
77-
"company" : "",
78-
"country" : "",
79-
"currency" : "EUR",
80-
"email" : "managedobjectstorage@example.com",
81-
"enable_3rd_party_services" : "yes",
82-
"first_name" : "",
83-
"ip_filters" : {
84-
"ip_filter" : []
85-
},
86-
"labels" : [],
87-
"language" : "en",
88-
"last_name" : "",
89-
"main_account" : "example",
90-
"network_access" : {
91-
"network" : []
92-
},
93-
"phone" : "+358.123456789",
94-
"postal_code" : "",
95-
"roles" : {
96-
"role" : []
97-
},
98-
"server_access" : {
99-
"server" : []
100-
},
101-
"state" : "",
102-
"storage_access" : {
103-
"storage" : []
104-
},
105-
"tag_access" : {
106-
"tag" : []
107-
},
108-
"timezone" : "Europe/Helsinki",
109-
"type" : "sub",
110-
"username" : "managedobjectstorage",
111-
"vat_number" : ""
112-
}
113-
}
114-
headers:
115-
Content-Length:
116-
- "1013"
117-
Content-Type:
118-
- application/json; charset=UTF-8
119-
Date:
120-
- Tue, 10 Oct 2023 00:42:02 GMT
121-
Server:
122-
- Apache
123-
Strict-Transport-Security:
124-
- max-age=63072000
125-
status: 200 OK
126-
code: 200
127-
duration: ""
128-
- request:
129-
body: '{"configured_status":"started","labels":[{"key":"example-key","value":"example-value"}],"networks":[{"family":"IPv4","name":"example-public-network","type":"public"}],"region":"europe-1","users":[{"username":"managedobjectstorage"}]}'
130-
form: {}
131-
headers:
132-
Accept:
133-
- application/json
134-
Content-Type:
135-
- application/json
136-
User-Agent:
137-
- upcloud-go-api/6.6.0
39+
- upcloud-go-api/6.11.0
13840
url: https://api.upcloud.com/1.3/object-storage-2
13941
method: POST
14042
response:
141-
body: '{"configured_status":"started","created_at":"2023-10-10T00:42:02.968155Z","endpoints":[{"domain_name":"6jp9e.upcloudobjects.com","type":"public"}],"labels":[{"key":"example-key","value":"example-value"}],"networks":[{"family":"IPv4","name":"example-public-network","type":"public"}],"operational_state":"pending","region":"europe-1","updated_at":"2023-10-10T00:42:02.968155Z","users":[{"access_keys":[],"created_at":"2023-10-10T00:42:02.968155Z","operational_state":"pending","updated_at":"2023-10-10T00:42:02.968155Z","username":"managedobjectstorage"}],"uuid":"1234f297-ee4a-4e47-b725-eec5dec580f1"}'
43+
body: '{"configured_status":"started","created_at":"2024-01-18T15:42:50.934973Z","endpoints":[{"domain_name":"2tt4g.upcloudobjects.com","type":"public"}],"labels":[{"key":"example-key","value":"example-value"}],"name":"go-sdk-integration-test","networks":[{"family":"IPv4","name":"example-public-network","type":"public"}],"operational_state":"pending","region":"europe-1","updated_at":"2024-01-18T15:42:50.934973Z","usage":{"total_objects":0,"total_size_bytes":0},"users":[{"access_keys":[],"created_at":"2024-01-18T15:42:50.934973Z","operational_state":"pending","updated_at":"2024-01-18T15:42:50.934973Z","username":"test"}],"uuid":"12177a48-1a9f-4aa1-a741-75b4ab2613f7"}'
14244
headers:
14345
Content-Length:
144-
- "601"
46+
- "667"
14547
Content-Type:
14648
- application/json
14749
Date:
148-
- Tue, 10 Oct 2023 00:42:02 GMT
50+
- Thu, 18 Jan 2024 15:42:50 GMT
14951
Strict-Transport-Security:
15052
- max-age=63072000
15153
status: 201 Created
@@ -160,95 +62,16 @@ interactions:
16062
Content-Type:
16163
- application/json
16264
User-Agent:
163-
- upcloud-go-api/6.6.0
164-
url: https://api.upcloud.com/1.3/object-storage-2/1234f297-ee4a-4e47-b725-eec5dec580f1/users
165-
method: GET
166-
response:
167-
body: '[{"access_keys":[],"created_at":"2023-10-10T00:42:02.968155Z","operational_state":"pending","updated_at":"2023-10-10T00:42:02.968155Z","username":"managedobjectstorage"}]'
168-
headers:
169-
Content-Length:
170-
- "170"
171-
Content-Type:
172-
- application/json
173-
Date:
174-
- Tue, 10 Oct 2023 00:42:03 GMT
175-
Strict-Transport-Security:
176-
- max-age=63072000
177-
status: 200 OK
178-
code: 200
179-
duration: ""
180-
- request:
181-
body: ""
182-
form: {}
183-
headers:
184-
Accept:
185-
- application/json
186-
Content-Type:
187-
- application/json
188-
User-Agent:
189-
- upcloud-go-api/6.6.0
190-
url: https://api.upcloud.com/1.3/object-storage-2/1234f297-ee4a-4e47-b725-eec5dec580f1
65+
- upcloud-go-api/6.11.0
66+
url: https://api.upcloud.com/1.3/object-storage-2/12177a48-1a9f-4aa1-a741-75b4ab2613f7
19167
method: DELETE
19268
response:
19369
body: ""
19470
headers:
19571
Date:
196-
- Tue, 10 Oct 2023 00:42:03 GMT
72+
- Thu, 18 Jan 2024 15:42:51 GMT
19773
Strict-Transport-Security:
19874
- max-age=63072000
19975
status: 204 No Content
20076
code: 204
20177
duration: ""
202-
- request:
203-
body: ""
204-
form: {}
205-
headers:
206-
Accept:
207-
- application/json
208-
Content-Type:
209-
- application/json
210-
User-Agent:
211-
- upcloud-go-api/6.6.0
212-
url: https://api.upcloud.com/1.3/object-storage-2/1234f297-ee4a-4e47-b725-eec5dec580f1
213-
method: GET
214-
response:
215-
body: |
216-
{"type":"https://developers.upcloud.com/1.3/errors#ERROR_RESOURCE_NOT_FOUND","title":"The resource you requested does not exist.","correlation_id":"01HCBGHJEG8AT24TRA2VZQT0DV","status":404}
217-
headers:
218-
Content-Language:
219-
- en
220-
Content-Length:
221-
- "190"
222-
Content-Type:
223-
- application/problem+json
224-
Date:
225-
- Tue, 10 Oct 2023 00:42:13 GMT
226-
Strict-Transport-Security:
227-
- max-age=63072000
228-
status: 404 Not Found
229-
code: 404
230-
duration: ""
231-
- request:
232-
body: ""
233-
form: {}
234-
headers:
235-
Accept:
236-
- application/json
237-
Content-Type:
238-
- application/json
239-
User-Agent:
240-
- upcloud-go-api/6.6.0
241-
url: https://api.upcloud.com/1.3/account/sub/managedobjectstorage
242-
method: DELETE
243-
response:
244-
body: ""
245-
headers:
246-
Date:
247-
- Tue, 10 Oct 2023 00:42:13 GMT
248-
Server:
249-
- Apache
250-
Strict-Transport-Security:
251-
- max-age=63072000
252-
status: 204 No Content
253-
code: 204
254-
duration: ""

0 commit comments

Comments
 (0)