Skip to content

Commit 7960d70

Browse files
chore: request booleans to pointers in lbaas and objsto2 (#293)
1 parent 61b3cfc commit 7960d70

9 files changed

+113
-128
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ See updating [Changelog example here](https://keepachangelog.com/en/1.0.0/)
99
- **Breaking**, Managed Database: `ManagedDatabaseUserOpernSearchAccessControl` fields changed to pointers
1010
- **Breaking**, Managed Database: `ManagedDatabaseUserPGAccessControl` fields changed to pointers
1111
- **Breaking**, Managed Database: `ManagedDatabaseUserRedisAccessControl` fields changed to pointers
12+
- **Breaking**, Managed Load Balancer: `LoadBalancerFrontendProperties` field `InboundProxyProtocol` to pointer
13+
- **Breaking**, Managed Object Storage: `CreateManagedObjectStorageUserAccessKeyRequest` field `Enabled` to pointer
14+
- **Breaking**, Managed Object Storage: `ModifyManagedObjectStorageUserAccessKeyRequest` field `Enabled` to pointer
1215

1316
### Removed
1417
- **Breaking**, Managed Database: connection related methods in favor of session

upcloud/load_balancer.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ type LoadBalancerFrontendTLSConfig struct {
169169
// LoadBalancerFrontendProperties represents frontend properties
170170
type LoadBalancerFrontendProperties struct {
171171
TimeoutClient int `json:"timeout_client,omitempty"`
172-
InboundProxyProtocol bool `json:"inbound_proxy_protocol"`
172+
InboundProxyProtocol *bool `json:"inbound_proxy_protocol,omitempty"`
173173
HTTP2Enabled *bool `json:"http2_enabled,omitempty"`
174174
}
175175

upcloud/load_balancer_test.go

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -302,8 +302,7 @@ func TestLoadBalancerFrontend(t *testing.T) {
302302
"port": 443,
303303
"default_backend": "example-backend",
304304
"properties": {
305-
"timeout_client": 10,
306-
"inbound_proxy_protocol": false
305+
"timeout_client": 10
307306
},
308307
"created_at": "2021-12-07T13:58:30.817272Z",
309308
"updated_at": "2022-02-11T17:33:08.490581Z"
@@ -350,16 +349,15 @@ func TestLoadBalancerFrontendProperties(t *testing.T) {
350349
},
351350
`
352351
{
353-
"timeout_client": 10,
354-
"inbound_proxy_protocol": false
352+
"timeout_client": 10
355353
}
356354
`,
357355
)
358356
testJSON(t,
359357
&LoadBalancerFrontendProperties{},
360358
&LoadBalancerFrontendProperties{
361359
TimeoutClient: 10,
362-
InboundProxyProtocol: true,
360+
InboundProxyProtocol: BoolPtr(true),
363361
},
364362
`
365363
{
@@ -372,7 +370,7 @@ func TestLoadBalancerFrontendProperties(t *testing.T) {
372370
&LoadBalancerFrontendProperties{},
373371
&LoadBalancerFrontendProperties{
374372
TimeoutClient: 10,
375-
InboundProxyProtocol: false,
373+
InboundProxyProtocol: BoolPtr(false),
376374
},
377375
`
378376
{
@@ -385,7 +383,7 @@ func TestLoadBalancerFrontendProperties(t *testing.T) {
385383
&LoadBalancerFrontendProperties{},
386384
&LoadBalancerFrontendProperties{
387385
TimeoutClient: 10,
388-
InboundProxyProtocol: false,
386+
InboundProxyProtocol: BoolPtr(false),
389387
HTTP2Enabled: BoolPtr(false),
390388
},
391389
`
@@ -400,7 +398,7 @@ func TestLoadBalancerFrontendProperties(t *testing.T) {
400398
&LoadBalancerFrontendProperties{},
401399
&LoadBalancerFrontendProperties{
402400
TimeoutClient: 10,
403-
InboundProxyProtocol: false,
401+
InboundProxyProtocol: BoolPtr(false),
404402
HTTP2Enabled: BoolPtr(true),
405403
},
406404
`

upcloud/request/load_balancer_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -750,7 +750,7 @@ func TestCreateLoadBalancerFrontendRequest(t *testing.T) {
750750
DefaultBackend: "example-backend",
751751
Properties: &upcloud.LoadBalancerFrontendProperties{
752752
TimeoutClient: 10,
753-
InboundProxyProtocol: false,
753+
InboundProxyProtocol: upcloud.BoolPtr(false),
754754
},
755755
Rules: []LoadBalancerFrontendRule{{
756756
Name: "example-rule-1",
@@ -804,7 +804,7 @@ func TestModifyLoadBalancerFrontendRequest(t *testing.T) {
804804
DefaultBackend: "example-backend",
805805
Properties: &upcloud.LoadBalancerFrontendProperties{
806806
TimeoutClient: 10,
807-
InboundProxyProtocol: false,
807+
InboundProxyProtocol: upcloud.BoolPtr(false),
808808
HTTP2Enabled: upcloud.BoolPtr(false),
809809
},
810810
},

upcloud/request/managed_object_storage.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ type CreateManagedObjectStorageUserAccessKeyRequest struct {
231231
Username string `json:"-"`
232232
ServiceUUID string `json:"-"`
233233
Name string `json:"name"`
234-
Enabled bool `json:"enabled,omitempty"`
234+
Enabled *bool `json:"enabled,omitempty"`
235235
}
236236

237237
// RequestURL implements the Request interface
@@ -267,7 +267,7 @@ type ModifyManagedObjectStorageUserAccessKeyRequest struct {
267267
Username string `json:"-"`
268268
ServiceUUID string `json:"-"`
269269
Name string `json:"name,omitempty"`
270-
Enabled bool `json:"enabled,omitempty"`
270+
Enabled *bool `json:"enabled,omitempty"`
271271
}
272272

273273
// RequestURL implements the Request interface

upcloud/service/fixtures/createmanagedobjectstorageuseraccesskey.yaml

Lines changed: 22 additions & 74 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.11.0
13+
- upcloud-go-api/6.12.0
1414
url: https://api.upcloud.com/1.3/object-storage-2/regions
1515
method: GET
1616
response:
@@ -21,7 +21,7 @@ interactions:
2121
Content-Type:
2222
- application/json
2323
Date:
24-
- Thu, 18 Jan 2024 15:54:48 GMT
24+
- Fri, 26 Jan 2024 10:36:58 GMT
2525
Strict-Transport-Security:
2626
- max-age=63072000
2727
status: 200 OK
@@ -36,18 +36,18 @@ interactions:
3636
Content-Type:
3737
- application/json
3838
User-Agent:
39-
- upcloud-go-api/6.11.0
39+
- upcloud-go-api/6.12.0
4040
url: https://api.upcloud.com/1.3/object-storage-2
4141
method: POST
4242
response:
43-
body: '{"configured_status":"started","created_at":"2024-01-18T15:54:48.655272Z","endpoints":[{"domain_name":"ccbt2.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:54:48.655272Z","usage":{"total_objects":0,"total_size_bytes":0},"users":[{"access_keys":[],"created_at":"2024-01-18T15:54:48.655272Z","operational_state":"pending","updated_at":"2024-01-18T15:54:48.655272Z","username":"test"}],"uuid":"126317d1-8a64-46df-a05e-5924383ab797"}'
43+
body: '{"configured_status":"started","created_at":"2024-01-26T10:36:58.458676Z","endpoints":[{"domain_name":"gsaq8.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-26T10:36:58.458676Z","usage":{"total_objects":0,"total_size_bytes":0},"users":[{"access_keys":[],"created_at":"2024-01-26T10:36:58.458676Z","operational_state":"pending","updated_at":"2024-01-26T10:36:58.458676Z","username":"test"}],"uuid":"128715a4-0fa4-42eb-9d9b-ce1b95bf221e"}'
4444
headers:
4545
Content-Length:
4646
- "667"
4747
Content-Type:
4848
- application/json
4949
Date:
50-
- Thu, 18 Jan 2024 15:54:48 GMT
50+
- Fri, 26 Jan 2024 10:36:58 GMT
5151
Strict-Transport-Security:
5252
- max-age=63072000
5353
status: 201 Created
@@ -62,18 +62,18 @@ interactions:
6262
Content-Type:
6363
- application/json
6464
User-Agent:
65-
- upcloud-go-api/6.11.0
66-
url: https://api.upcloud.com/1.3/object-storage-2/126317d1-8a64-46df-a05e-5924383ab797/users
65+
- upcloud-go-api/6.12.0
66+
url: https://api.upcloud.com/1.3/object-storage-2/128715a4-0fa4-42eb-9d9b-ce1b95bf221e/users
6767
method: POST
6868
response:
69-
body: '{"access_keys":[],"created_at":"2024-01-18T15:54:48.894407Z","operational_state":"pending","updated_at":"2024-01-18T15:54:48.894407Z","username":"test2"}'
69+
body: '{"access_keys":[],"created_at":"2024-01-26T10:36:58.881467Z","operational_state":"pending","updated_at":"2024-01-26T10:36:58.881467Z","username":"test2"}'
7070
headers:
7171
Content-Length:
7272
- "153"
7373
Content-Type:
7474
- application/json
7575
Date:
76-
- Thu, 18 Jan 2024 15:54:48 GMT
76+
- Fri, 26 Jan 2024 10:36:58 GMT
7777
Strict-Transport-Security:
7878
- max-age=63072000
7979
status: 201 Created
@@ -88,96 +88,44 @@ interactions:
8888
Content-Type:
8989
- application/json
9090
User-Agent:
91-
- upcloud-go-api/6.11.0
92-
url: https://api.upcloud.com/1.3/object-storage-2/126317d1-8a64-46df-a05e-5924383ab797/users/test2
91+
- upcloud-go-api/6.12.0
92+
url: https://api.upcloud.com/1.3/object-storage-2/128715a4-0fa4-42eb-9d9b-ce1b95bf221e/users/test2
9393
method: GET
9494
response:
95-
body: '{"access_keys":[],"created_at":"2024-01-18T15:54:48.894407Z","operational_state":"pending","updated_at":"2024-01-18T15:54:48.894407Z","username":"test2"}'
96-
headers:
97-
Content-Length:
98-
- "153"
99-
Content-Type:
100-
- application/json
101-
Date:
102-
- Thu, 18 Jan 2024 15:54:49 GMT
103-
Strict-Transport-Security:
104-
- max-age=63072000
105-
status: 200 OK
106-
code: 200
107-
duration: ""
108-
- request:
109-
body: ""
110-
form: {}
111-
headers:
112-
Accept:
113-
- application/json
114-
Content-Type:
115-
- application/json
116-
User-Agent:
117-
- upcloud-go-api/6.11.0
118-
url: https://api.upcloud.com/1.3/object-storage-2/126317d1-8a64-46df-a05e-5924383ab797/users/test2
119-
method: GET
120-
response:
121-
body: '{"access_keys":[],"created_at":"2024-01-18T15:54:48.894407Z","operational_state":"pending","updated_at":"2024-01-18T15:54:48.894407Z","username":"test2"}'
122-
headers:
123-
Content-Length:
124-
- "153"
125-
Content-Type:
126-
- application/json
127-
Date:
128-
- Thu, 18 Jan 2024 15:54:54 GMT
129-
Strict-Transport-Security:
130-
- max-age=63072000
131-
status: 200 OK
132-
code: 200
133-
duration: ""
134-
- request:
135-
body: ""
136-
form: {}
137-
headers:
138-
Accept:
139-
- application/json
140-
Content-Type:
141-
- application/json
142-
User-Agent:
143-
- upcloud-go-api/6.11.0
144-
url: https://api.upcloud.com/1.3/object-storage-2/126317d1-8a64-46df-a05e-5924383ab797/users/test2
145-
method: GET
146-
response:
147-
body: '{"access_keys":[],"created_at":"2024-01-18T15:54:48.894407Z","operational_state":"ready","updated_at":"2024-01-18T15:54:59.194227Z","username":"test2"}'
95+
body: '{"access_keys":[],"created_at":"2024-01-26T10:36:58.881467Z","operational_state":"ready","updated_at":"2024-01-26T10:36:59.233235Z","username":"test2"}'
14896
headers:
14997
Content-Length:
15098
- "151"
15199
Content-Type:
152100
- application/json
153101
Date:
154-
- Thu, 18 Jan 2024 15:54:59 GMT
102+
- Fri, 26 Jan 2024 10:36:59 GMT
155103
Strict-Transport-Security:
156104
- max-age=63072000
157105
status: 200 OK
158106
code: 200
159107
duration: ""
160108
- request:
161-
body: '{"name":"example-access-key"}'
109+
body: '{"name":"example-access-key","enabled":false}'
162110
form: {}
163111
headers:
164112
Accept:
165113
- application/json
166114
Content-Type:
167115
- application/json
168116
User-Agent:
169-
- upcloud-go-api/6.11.0
170-
url: https://api.upcloud.com/1.3/object-storage-2/126317d1-8a64-46df-a05e-5924383ab797/users/test2/access-keys
117+
- upcloud-go-api/6.12.0
118+
url: https://api.upcloud.com/1.3/object-storage-2/128715a4-0fa4-42eb-9d9b-ce1b95bf221e/users/test2/access-keys
171119
method: POST
172120
response:
173-
body: '{"access_key_id":"AKIADE9B7DE2D940D6CB","created_at":"2024-01-18T15:54:59.755685Z","enabled":true,"last_used_at":"2024-01-18T15:54:59.755685Z","name":"example-access-key","secret_access_key":"eLzuULBRAQwjP4XIIAq4sVLwX/kl4SMfsSXdgHPT","updated_at":"2024-01-18T15:54:59.755685Z"}'
121+
body: '{"access_key_id":"AKIA2E7C18E1A9DE67C9","created_at":"2024-01-26T10:36:59.572827Z","enabled":false,"last_used_at":"2024-01-26T10:36:59.572827Z","name":"example-access-key","secret_access_key":"CDos+s2bmIklWj0knLrFeW+lCJjFRG5pWPwHZRDF","updated_at":"2024-01-26T10:36:59.572827Z"}'
174122
headers:
175123
Content-Length:
176-
- "277"
124+
- "278"
177125
Content-Type:
178126
- application/json
179127
Date:
180-
- Thu, 18 Jan 2024 15:54:59 GMT
128+
- Fri, 26 Jan 2024 10:36:59 GMT
181129
Strict-Transport-Security:
182130
- max-age=63072000
183131
status: 201 Created
@@ -192,14 +140,14 @@ interactions:
192140
Content-Type:
193141
- application/json
194142
User-Agent:
195-
- upcloud-go-api/6.11.0
196-
url: https://api.upcloud.com/1.3/object-storage-2/126317d1-8a64-46df-a05e-5924383ab797
143+
- upcloud-go-api/6.12.0
144+
url: https://api.upcloud.com/1.3/object-storage-2/128715a4-0fa4-42eb-9d9b-ce1b95bf221e
197145
method: DELETE
198146
response:
199147
body: ""
200148
headers:
201149
Date:
202-
- Thu, 18 Jan 2024 15:55:00 GMT
150+
- Fri, 26 Jan 2024 10:36:59 GMT
203151
Strict-Transport-Security:
204152
- max-age=63072000
205153
status: 204 No Content

0 commit comments

Comments
 (0)