File tree Expand file tree Collapse file tree 3 files changed +23
-1
lines changed
Expand file tree Collapse file tree 3 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,9 @@ See updating [Changelog example here](https://keepachangelog.com/en/1.0.0/)
88### Added
99- Managed Database sub-properties support. E.g., PostgreSQL property ` timescaledb ` is of type ` object ` and has ` max_background_workers ` sub-property.
1010
11+ ### Fixed
12+ - Managed Object Storage: omit empty labels slice when creating managed object storage instance
13+
1114## [ 6.10.0]
1215
1316### Added
Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ func (r *GetManagedObjectStorageRegionRequest) RequestURL() string {
3737// CreateManagedObjectStorageRequest represents a request for creating a new Managed Object Storage service
3838type CreateManagedObjectStorageRequest struct {
3939 ConfiguredStatus upcloud.ManagedObjectStorageConfiguredStatus `json:"configured_status"`
40- Labels []upcloud.Label `json:"labels"`
40+ Labels []upcloud.Label `json:"labels,omitempty "`
4141 Networks []upcloud.ManagedObjectStorageNetwork `json:"networks"`
4242 Region string `json:"region"`
4343 Users []ManagedObjectStorageUser `json:"users"`
Original file line number Diff line number Diff line change 11package request
22
33import (
4+ "encoding/json"
45 "testing"
56
67 "github.com/stretchr/testify/assert"
@@ -23,6 +24,24 @@ func TestCreateManagedObjectStorageRequest_RequestURL(t *testing.T) {
2324 assert .Equal (t , "/object-storage-2" , req .RequestURL ())
2425}
2526
27+ func TestCreateManagedObjectStorageRequest_MarshalJSON (t * testing.T ) {
28+ t .Run ("TestMinimal" , func (t * testing.T ) {
29+ req := CreateManagedObjectStorageRequest {
30+ Region : "europe-1" ,
31+ }
32+ d , err := json .Marshal (& req )
33+ assert .NoError (t , err )
34+
35+ const expected = `{
36+ "configured_status":"",
37+ "networks":null,
38+ "region":"europe-1",
39+ "users":null
40+ }`
41+ assert .JSONEq (t , expected , string (d ))
42+ })
43+ }
44+
2645func TestGetManagedObjectStoragesRequest_RequestURL (t * testing.T ) {
2746 req := & GetManagedObjectStoragesRequest {}
2847 assert .Equal (t , "/object-storage-2" , req .RequestURL ())
You can’t perform that action at this time.
0 commit comments