Skip to content

Commit 187f736

Browse files
committed
Convert changed Zone function to 1.3
1 parent b6b92d3 commit 187f736

File tree

4 files changed

+28
-16
lines changed

4 files changed

+28
-16
lines changed

upcloud/service/fixtures/getzones.yaml

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ interactions:
99
- application/json
1010
Content-Type:
1111
- application/json
12-
url: https://api.upcloud.com/1.2/zone
12+
url: https://api.upcloud.com/1.3/zone
1313
method: GET
1414
response:
1515
body: |
@@ -18,54 +18,64 @@ interactions:
1818
"zone" : [
1919
{
2020
"description" : "Frankfurt #1",
21-
"id" : "de-fra1"
21+
"id" : "de-fra1",
22+
"public" : "yes"
2223
},
2324
{
2425
"description" : "Helsinki #1",
25-
"id" : "fi-hel1"
26+
"id" : "fi-hel1",
27+
"public" : "yes"
2628
},
2729
{
2830
"description" : "Helsinki #2",
29-
"id" : "fi-hel2"
31+
"id" : "fi-hel2",
32+
"public" : "yes"
3033
},
3134
{
3235
"description" : "Amsterdam #1",
33-
"id" : "nl-ams1"
36+
"id" : "nl-ams1",
37+
"public" : "yes"
3438
},
3539
{
3640
"description" : "Singapore #1",
37-
"id" : "sg-sin1"
41+
"id" : "sg-sin1",
42+
"public" : "yes"
3843
},
3944
{
4045
"description" : "London #1",
41-
"id" : "uk-lon1"
46+
"id" : "uk-lon1",
47+
"public" : "yes"
4248
},
4349
{
4450
"description" : "Test Cloud #1",
45-
"id" : "uk-tst1"
51+
"id" : "uk-tst1",
52+
"public" : "no"
4653
},
4754
{
4855
"description" : "Chicago #1",
49-
"id" : "us-chi1"
56+
"id" : "us-chi1",
57+
"public" : "yes"
5058
},
5159
{
5260
"description" : "New York #1",
53-
"id" : "us-nyc1"
61+
"id" : "us-nyc1",
62+
"public" : "yes"
5463
},
5564
{
5665
"description" : "San Jose #1",
57-
"id" : "us-sjo1"
66+
"id" : "us-sjo1",
67+
"public" : "yes"
5868
}
5969
]
6070
}
6171
}
6272
headers:
6373
Content-Length:
64-
- "1000"
74+
- "1299"
6575
Content-Type:
6676
- application/json; charset=UTF-8
6777
Date:
68-
- Wed, 05 Aug 2020 09:01:46 GMT
78+
- Wed, 05 Aug 2020 10:03:27 GMT
6979
Server:
7080
- Apache
7181
Strict-Transport-Security:

upcloud/service/service.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ func (s *Service) GetAccount() (*upcloud.Account, error) {
4040
// GetZones returns the available zones
4141
func (s *Service) GetZones() (*upcloud.Zones, error) {
4242
zones := upcloud.Zones{}
43-
response, err := s.basicJSONGetRequest("/zone")
43+
response, err := s.basicFutureGetRequest("/zone")
4444

4545
if err != nil {
4646
return nil, err

upcloud/service/service_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ func TestGetZones(t *testing.T) {
155155
for _, z := range zones.Zones {
156156
if z.Description == "Helsinki #1" && z.ID == "fi-hel1" {
157157
found = true
158+
assert.True(t, bool(z.Public))
158159
break
159160
}
160161
}

upcloud/zone.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ func (s *Zones) UnmarshalJSON(b []byte) error {
2929

3030
// Zone represents a zone
3131
type Zone struct {
32-
ID string `json:"id"`
33-
Description string `json:"description"`
32+
ID string `json:"id"`
33+
Description string `json:"description"`
34+
Public Boolean `json:"public"`
3435
}

0 commit comments

Comments
 (0)