From ae5d7880b1997533c8541862c30791645bd7917c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20L=C3=A9one?= Date: Wed, 23 Sep 2020 16:26:16 +0200 Subject: [PATCH] feat: add support for pl-waw-1 zone and pl-waw region (#557) --- scw/client_option_test.go | 4 ++-- scw/locality.go | 8 ++++++++ scw/locality_test.go | 18 +++++++++++++----- 3 files changed, 23 insertions(+), 7 deletions(-) diff --git a/scw/client_option_test.go b/scw/client_option_test.go index ffa07134f..e0a03c4b7 100644 --- a/scw/client_option_test.go +++ b/scw/client_option_test.go @@ -117,7 +117,7 @@ func TestClientOptions(t *testing.T) { s.token = auth.NewToken(testAccessKey, testSecretKey) s.defaultRegion = &v }, - errStr: "scaleway-sdk-go: invalid default region format 'invalid', available regions are: fr-par, nl-ams", + errStr: "scaleway-sdk-go: invalid default region format 'invalid', available regions are: fr-par, nl-ams, pl-waw", }, { name: "Should throw a zone error", @@ -135,7 +135,7 @@ func TestClientOptions(t *testing.T) { s.token = auth.NewToken(testAccessKey, testSecretKey) s.defaultZone = &v }, - errStr: "scaleway-sdk-go: invalid default zone format 'invalid', available zones are: fr-par-1, fr-par-2, nl-ams-1", + errStr: "scaleway-sdk-go: invalid default zone format 'invalid', available zones are: fr-par-1, fr-par-2, nl-ams-1, pl-waw-1", }, } diff --git a/scw/locality.go b/scw/locality.go index 9cf72987b..6e6fd3c23 100644 --- a/scw/locality.go +++ b/scw/locality.go @@ -23,6 +23,8 @@ const ( ZoneFrPar2 = Zone("fr-par-2") // ZoneNlAms1 represents the nl-ams-1 zone ZoneNlAms1 = Zone("nl-ams-1") + // ZonePlWaw1 represents the pl-waw-1 zone + ZonePlWaw1 = Zone("pl-waw-1") ) var ( @@ -31,6 +33,7 @@ var ( ZoneFrPar1, ZoneFrPar2, ZoneNlAms1, + ZonePlWaw1, } ) @@ -68,6 +71,8 @@ const ( RegionFrPar = Region("fr-par") // RegionNlAms represents the nl-ams region RegionNlAms = Region("nl-ams") + // RegionPlWaw represents the pl-waw region + RegionPlWaw = Region("pl-waw") ) var ( @@ -75,6 +80,7 @@ var ( AllRegions = []Region{ RegionFrPar, RegionNlAms, + RegionPlWaw, } ) @@ -95,6 +101,8 @@ func (region Region) GetZones() []Zone { return []Zone{ZoneFrPar1, ZoneFrPar2} case RegionNlAms: return []Zone{ZoneNlAms1} + case RegionPlWaw: + return []Zone{ZonePlWaw1} default: return []Zone{} } diff --git a/scw/locality_test.go b/scw/locality_test.go index b6e1b9f52..c144fe94f 100644 --- a/scw/locality_test.go +++ b/scw/locality_test.go @@ -18,6 +18,10 @@ func TestParseZone(t *testing.T) { input: "fr-par-1", expected: ZoneFrPar1, }, + { + input: "pl-waw-1", + expected: ZonePlWaw1, + }, { input: "par1", expected: ZoneFrPar1, @@ -33,17 +37,17 @@ func TestParseZone(t *testing.T) { { input: "fr-par", expected: "", - err: errors.New("bad zone format, available zones are: fr-par-1, fr-par-2, nl-ams-1"), + err: errors.New("bad zone format, available zones are: fr-par-1, fr-par-2, nl-ams-1, pl-waw-1"), }, { input: "fr-par-n", expected: "", - err: errors.New("bad zone format, available zones are: fr-par-1, fr-par-2, nl-ams-1"), + err: errors.New("bad zone format, available zones are: fr-par-1, fr-par-2, nl-ams-1, pl-waw-1"), }, { input: "fr-par-0", expected: "", - err: errors.New("bad zone format, available zones are: fr-par-1, fr-par-2, nl-ams-1"), + err: errors.New("bad zone format, available zones are: fr-par-1, fr-par-2, nl-ams-1, pl-waw-1"), }, } @@ -96,6 +100,10 @@ func TestParseRegion(t *testing.T) { input: "ams1", expected: RegionNlAms, }, + { + input: "pl-waw", + expected: RegionPlWaw, + }, { input: "xx-xxx", expected: "xx-xxx", @@ -103,12 +111,12 @@ func TestParseRegion(t *testing.T) { { input: "fr-par-1", expected: "", - err: errors.New("bad region format, available regions are: fr-par, nl-ams"), + err: errors.New("bad region format, available regions are: fr-par, nl-ams, pl-waw"), }, { input: "fr-pa1", expected: "", - err: errors.New("bad region format, available regions are: fr-par, nl-ams"), + err: errors.New("bad region format, available regions are: fr-par, nl-ams, pl-waw"), }, }