Skip to content

Commit 588ec19

Browse files
committed
Added new OCI Cloud regions:
"jnb", "af-johannesburg-1" "wga", "ap-dcc-canberra-1" "sin", "ap-singapore-1" "mrs", "eu-marseille-1" "arn", "eu-stockholm-1" "mct", "me-dcc-muscat-1" "auh", "me-abudhabi-1"
1 parent 257731e commit 588ec19

File tree

4 files changed

+154
-32
lines changed

4 files changed

+154
-32
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/).
55

66
## [Unreleased]
77

8+
### Changed
9+
- Updated OCI regions
10+
811
### Added
912
- Added client statistics. Users can enable internal driver statistics by
1013
using system property -Dcom.oracle.nosql.sdk.nosqldriver.stats.profile=

driver/src/main/java/oracle/nosql/driver/Region.java

Lines changed: 100 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -51,36 +51,44 @@ public class Region {
5151
private static final Map<String, Region> GOV_REGIONS = new HashMap<>();
5252
private static final Map<String, Region> OC4_REGIONS = new HashMap<>();
5353
private static final Map<String, Region> OC8_REGIONS = new HashMap<>();
54+
private static final Map<String, Region> OC9_REGIONS = new HashMap<>();
55+
private static final Map<String, Region> OC10_REGIONS = new HashMap<>();
5456

5557
/* OC1 */
56-
public static final Region AP_SEOUL_1 = new Region("ap-seoul-1");
57-
public static final Region AP_TOKYO_1 = new Region("ap-tokyo-1");
58-
public static final Region AP_MUMBAI_1 = new Region("ap-mumbai-1");
59-
public static final Region AP_SYDNEY_1 = new Region("ap-sydney-1");
58+
public static final Region AF_JOHANNESBURG_1 = new Region("af-johannesburg-1");
59+
60+
public static final Region AP_CHUNCHEON_1 = new Region("ap-chuncheon-1");
61+
public static final Region AP_HYDERABAD_1 = new Region("ap-hyderabad-1");
6062
public static final Region AP_MELBOURNE_1 = new Region("ap-melbourne-1");
63+
public static final Region AP_MUMBAI_1 = new Region("ap-mumbai-1");
6164
public static final Region AP_OSAKA_1 = new Region("ap-osaka-1");
62-
public static final Region AP_HYDERABAD_1 = new Region("ap-hyderabad-1");
63-
public static final Region AP_CHUNCHEON_1 = new Region("ap-chuncheon-1");
65+
public static final Region AP_SINGAPORE_1 = new Region("ap-singapore-1");
66+
public static final Region AP_SEOUL_1 = new Region("ap-seoul-1");
67+
public static final Region AP_SYDNEY_1 = new Region("ap-sydney-1");
68+
public static final Region AP_TOKYO_1 = new Region("ap-tokyo-1");
6469

65-
public static final Region UK_LONDON_1 = new Region("uk-london-1");
6670
public static final Region UK_CARDIFF_1 = new Region("uk-cardiff-1");
71+
public static final Region UK_LONDON_1 = new Region("uk-london-1");
6772

68-
public static final Region EU_FRANKFURT_1 = new Region("eu-frankfurt-1");
69-
public static final Region EU_ZURICH_1 = new Region("eu-zurich-1");
7073
public static final Region EU_AMSTERDAM_1 = new Region("eu-amsterdam-1");
74+
public static final Region EU_FRANKFURT_1 = new Region("eu-frankfurt-1");
75+
public static final Region EU_MARSEILLE_1 = new Region("eu-marseille-1");
7176
public static final Region EU_MILAN_1 = new Region("eu-milan-1");
77+
public static final Region EU_STOCKHOLM_1 = new Region("eu-stockholm-1");
78+
public static final Region EU_ZURICH_1 = new Region("eu-zurich-1");
7279

73-
public static final Region ME_JEDDAH_1 = new Region("me-jeddah-1");
80+
public static final Region ME_ABUDHABI_1 = new Region("me-abudhabi-1");
7481
public static final Region ME_DUBAI_1 = new Region("me-dubai-1");
82+
public static final Region ME_JEDDAH_1 = new Region("me-jeddah-1");
7583

7684
public static final Region IL_JERUSALEM_1 = new Region("il-jerusalem-1");
7785

7886
public static final Region US_ASHBURN_1 = new Region("us-ashburn-1");
7987
public static final Region US_PHOENIX_1 = new Region("us-phoenix-1");
8088
public static final Region US_SANJOSE_1 = new Region("us-sanjose-1");
8189

82-
public static final Region CA_TORONTO_1 = new Region("ca-toronto-1");
8390
public static final Region CA_MONTREAL_1 = new Region("ca-montreal-1");
91+
public static final Region CA_TORONTO_1 = new Region("ca-toronto-1");
8492

8593
public static final Region SA_SAOPAULO_1 = new Region("sa-saopaulo-1");
8694
public static final Region SA_SANTIAGO_1 = new Region("sa-santiago-1");
@@ -103,29 +111,39 @@ public class Region {
103111
public static final Region AP_CHIYODA_1 = new Region("ap-chiyoda-1");
104112
public static final Region AP_IBARAKI_1 = new Region("ap-ibaraki-1");
105113

114+
/* OC9 */
115+
public static final Region ME_DCC_MUSCAT_1 = new Region("me-dcc-muscat-1");
116+
117+
/* OC10 */
118+
public static final Region AP_DCC_CANBERRA_1 = new Region("ap-dcc-canberra-1");
119+
106120
static {
107121
/* OC1 */
108122
/* APAC */
109-
OC1_REGIONS.put(AP_SEOUL_1.getRegionId(), AP_SEOUL_1);
110-
OC1_REGIONS.put(AP_TOKYO_1.getRegionId(), AP_TOKYO_1);
111-
OC1_REGIONS.put(AP_MUMBAI_1.getRegionId(), AP_MUMBAI_1);
112-
OC1_REGIONS.put(AP_SYDNEY_1.getRegionId(), AP_SYDNEY_1);
123+
OC1_REGIONS.put(AP_CHUNCHEON_1.getRegionId(), AP_CHUNCHEON_1);
124+
OC1_REGIONS.put(AP_HYDERABAD_1.getRegionId(), AP_HYDERABAD_1);
113125
OC1_REGIONS.put(AP_MELBOURNE_1.getRegionId(), AP_MELBOURNE_1);
126+
OC1_REGIONS.put(AP_MUMBAI_1.getRegionId(), AP_MUMBAI_1);
114127
OC1_REGIONS.put(AP_OSAKA_1.getRegionId(), AP_OSAKA_1);
115-
OC1_REGIONS.put(AP_HYDERABAD_1.getRegionId(), AP_HYDERABAD_1);
116-
OC1_REGIONS.put(AP_CHUNCHEON_1.getRegionId(), AP_CHUNCHEON_1);
128+
OC1_REGIONS.put(AP_SINGAPORE_1.getRegionId(), AP_SINGAPORE_1);
129+
OC1_REGIONS.put(AP_SEOUL_1.getRegionId(), AP_SEOUL_1);
130+
OC1_REGIONS.put(AP_SYDNEY_1.getRegionId(), AP_SYDNEY_1);
131+
OC1_REGIONS.put(AP_TOKYO_1.getRegionId(), AP_TOKYO_1);
117132

118133
/* EMEA */
119-
OC1_REGIONS.put(UK_LONDON_1.getRegionId(), UK_LONDON_1);
120134
OC1_REGIONS.put(UK_CARDIFF_1.getRegionId(), UK_CARDIFF_1);
135+
OC1_REGIONS.put(UK_LONDON_1.getRegionId(), UK_LONDON_1);
121136

122-
OC1_REGIONS.put(EU_FRANKFURT_1.getRegionId(), EU_FRANKFURT_1);
123-
OC1_REGIONS.put(EU_ZURICH_1.getRegionId(), EU_ZURICH_1);
124137
OC1_REGIONS.put(EU_AMSTERDAM_1.getRegionId(), EU_AMSTERDAM_1);
138+
OC1_REGIONS.put(EU_FRANKFURT_1.getRegionId(), EU_FRANKFURT_1);
139+
OC1_REGIONS.put(EU_MARSEILLE_1.getRegionId(), EU_MARSEILLE_1);
125140
OC1_REGIONS.put(EU_MILAN_1.getRegionId(), EU_MILAN_1);
141+
OC1_REGIONS.put(EU_STOCKHOLM_1.getRegionId(), EU_STOCKHOLM_1);
142+
OC1_REGIONS.put(EU_ZURICH_1.getRegionId(), EU_ZURICH_1);
126143

127-
OC1_REGIONS.put(ME_JEDDAH_1.getRegionId(), ME_JEDDAH_1);
144+
OC1_REGIONS.put(ME_ABUDHABI_1.getRegionId(), ME_ABUDHABI_1);
128145
OC1_REGIONS.put(ME_DUBAI_1.getRegionId(), ME_DUBAI_1);
146+
OC1_REGIONS.put(ME_JEDDAH_1.getRegionId(), ME_JEDDAH_1);
129147

130148
OC1_REGIONS.put(IL_JERUSALEM_1.getRegionId(), IL_JERUSALEM_1);
131149

@@ -139,8 +157,8 @@ public class Region {
139157
OC1_REGIONS.put(US_PHOENIX_1.getRegionId(), US_PHOENIX_1);
140158
OC1_REGIONS.put(US_SANJOSE_1.getRegionId(), US_SANJOSE_1);
141159

142-
OC1_REGIONS.put(CA_TORONTO_1.getRegionId(), CA_TORONTO_1);
143160
OC1_REGIONS.put(CA_MONTREAL_1.getRegionId(), CA_MONTREAL_1);
161+
OC1_REGIONS.put(CA_TORONTO_1.getRegionId(), CA_TORONTO_1);
144162

145163
/* OC2 */
146164
GOV_REGIONS.put(US_LANGLEY_1.getRegionId(), US_LANGLEY_1);
@@ -158,6 +176,12 @@ public class Region {
158176
/* OC8 */
159177
OC8_REGIONS.put(AP_CHIYODA_1.getRegionId(), AP_CHIYODA_1);
160178
OC8_REGIONS.put(AP_IBARAKI_1.getRegionId(), AP_IBARAKI_1);
179+
180+
/* OC9 */
181+
OC9_REGIONS.put(ME_DCC_MUSCAT_1.getRegionId(), ME_DCC_MUSCAT_1);
182+
183+
/* OC10 */
184+
OC10_REGIONS.put(AP_DCC_CANBERRA_1.getRegionId(), AP_DCC_CANBERRA_1);
161185
}
162186

163187
private final static MessageFormat OC1_EP_BASE = new MessageFormat(
@@ -168,6 +192,10 @@ public class Region {
168192
"https://nosql.{0}.oci.oraclegovcloud.uk");
169193
private final static MessageFormat OC8_EP_BASE = new MessageFormat(
170194
"https://nosql.{0}.oci.oraclecloud8.com");
195+
private final static MessageFormat OC9_EP_BASE = new MessageFormat(
196+
"https://nosql.{0}.oci.oraclecloud9.com");
197+
private final static MessageFormat OC10_EP_BASE = new MessageFormat(
198+
"https://nosql.{0}.oci.oraclecloud10.com");
171199

172200
private String regionId;
173201

@@ -192,6 +220,12 @@ public String endpoint() {
192220
if (isOC8Region(regionId)) {
193221
return OC8_EP_BASE.format(new Object[] { regionId });
194222
}
223+
if (isOC9Region(regionId)) {
224+
return OC9_EP_BASE.format(new Object[] { regionId });
225+
}
226+
if (isOC10Region(regionId)) {
227+
return OC10_EP_BASE.format(new Object[] { regionId });
228+
}
195229
throw new IllegalArgumentException(
196230
"Unable to find endpoint for unknwon region" + regionId);
197231
}
@@ -219,6 +253,12 @@ public static Region fromRegionId(String regionId) {
219253
if (region == null) {
220254
region = OC8_REGIONS.get(regionId);
221255
}
256+
if (region == null) {
257+
region = OC9_REGIONS.get(regionId);
258+
}
259+
if (region == null) {
260+
region = OC10_REGIONS.get(regionId);
261+
}
222262

223263
return region;
224264
}
@@ -272,6 +312,26 @@ public static boolean isOC8Region(String regionId) {
272312
return (OC8_REGIONS.get(regionId) != null);
273313
}
274314

315+
/**
316+
* @hidden
317+
* Internal use only
318+
* @param regionId the region id
319+
* @return the value
320+
*/
321+
public static boolean isOC9Region(String regionId) {
322+
return (OC9_REGIONS.get(regionId) != null);
323+
}
324+
325+
/**
326+
* @hidden
327+
* Internal use only
328+
* @param regionId the region id
329+
* @return the value
330+
*/
331+
public static boolean isOC10Region(String regionId) {
332+
return (OC10_REGIONS.get(regionId) != null);
333+
}
334+
275335
/**
276336
* @hidden
277337
* Internal use only
@@ -308,6 +368,24 @@ public static Collection<Region> getOC8Regions() {
308368
return OC8_REGIONS.values();
309369
}
310370

371+
/**
372+
* @hidden
373+
* Internal use only
374+
* @return the regions
375+
*/
376+
public static Collection<Region> getOC9Regions() {
377+
return OC9_REGIONS.values();
378+
}
379+
380+
/**
381+
* @hidden
382+
* Internal use only
383+
* @return the regions
384+
*/
385+
public static Collection<Region> getOC10Regions() {
386+
return OC10_REGIONS.values();
387+
}
388+
311389
/**
312390
* @hidden
313391
* Internal use only

driver/src/main/java/oracle/nosql/driver/iam/Utils.java

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -99,28 +99,38 @@ class Utils {
9999
"https://auth.{0}.oraclegovcloud.uk");
100100
private final static MessageFormat OC8_EP_BASE = new MessageFormat(
101101
"https://auth.{0}.oraclecloud8.com");
102+
private final static MessageFormat OC9_EP_BASE = new MessageFormat(
103+
"https://auth.{0}.oraclecloud9.com");
104+
private final static MessageFormat OC10_EP_BASE = new MessageFormat(
105+
"https://auth.{0}.oraclecloud10.com");
102106

103107
static {
104108
/* OC1 */
109+
IAM_URI.put("jnb", OC1_EP_BASE.format(new Object[] {"af-johannesburg-1"}));
110+
111+
IAM_URI.put("yny", OC1_EP_BASE.format(new Object[] {"ap-chuncheon-1"}));
112+
IAM_URI.put("hyd", OC1_EP_BASE.format(new Object[] {"ap-hyderabad-1"}));
113+
IAM_URI.put("mel", OC1_EP_BASE.format(new Object[] {"ap-melbourne-1"}));
105114
IAM_URI.put("bom", OC1_EP_BASE.format(new Object[] {"ap-mumbai-1"}));
115+
IAM_URI.put("kix", OC1_EP_BASE.format(new Object[] {"ap-osaka-1"}));
106116
IAM_URI.put("icn", OC1_EP_BASE.format(new Object[] {"ap-seoul-1"}));
117+
IAM_URI.put("sin", OC1_EP_BASE.format(new Object[] {"ap-singapore-1"}));
107118
IAM_URI.put("syd", OC1_EP_BASE.format(new Object[] {"ap-sydney-1"}));
108119
IAM_URI.put("nrt", OC1_EP_BASE.format(new Object[] {"ap-tokyo-1"}));
109-
IAM_URI.put("mel", OC1_EP_BASE.format(new Object[] {"ap-melbourne-1"}));
110-
IAM_URI.put("kix", OC1_EP_BASE.format(new Object[] {"ap-osaka-1"}));
111-
IAM_URI.put("hyd", OC1_EP_BASE.format(new Object[] {"ap-hyderabad-1"}));
112-
IAM_URI.put("yny", OC1_EP_BASE.format(new Object[] {"ap-chuncheon-1"}));
113120

114-
IAM_URI.put("lhr", OC1_EP_BASE.format(new Object[] {"uk-london-1"}));
115121
IAM_URI.put("cwl", OC1_EP_BASE.format(new Object[] {"uk-cardiff-1"}));
122+
IAM_URI.put("lhr", OC1_EP_BASE.format(new Object[] {"uk-london-1"}));
116123

117-
IAM_URI.put("fra", OC1_EP_BASE.format(new Object[] {"eu-frankfurt-1"}));
118-
IAM_URI.put("zrh", OC1_EP_BASE.format(new Object[] {"eu-zurich-1"}));
119124
IAM_URI.put("ams", OC1_EP_BASE.format(new Object[] {"eu-amsterdam-1"}));
125+
IAM_URI.put("fra", OC1_EP_BASE.format(new Object[] {"eu-frankfurt-1"}));
126+
IAM_URI.put("mrs", OC1_EP_BASE.format(new Object[] {"eu-marseille-1"}));
120127
IAM_URI.put("lin", OC1_EP_BASE.format(new Object[] {"eu-milan-1"}));
128+
IAM_URI.put("arn", OC1_EP_BASE.format(new Object[] {"eu-stockholm-1"}));
129+
IAM_URI.put("zrh", OC1_EP_BASE.format(new Object[] {"eu-zurich-1"}));
121130

122-
IAM_URI.put("jed", OC1_EP_BASE.format(new Object[] {"me-jeddah-1"}));
131+
IAM_URI.put("auh", OC1_EP_BASE.format(new Object[] {"me-abudhabi-1"}));
123132
IAM_URI.put("dxb", OC1_EP_BASE.format(new Object[] {"me-dubai-1"}));
133+
IAM_URI.put("jed", OC1_EP_BASE.format(new Object[] {"me-jeddah-1"}));
124134

125135
IAM_URI.put("mtz", OC1_EP_BASE.format(new Object[] {"il-jerusalem-1"}));
126136

@@ -151,6 +161,12 @@ class Utils {
151161
/* OC8 */
152162
IAM_URI.put("nja", OC8_EP_BASE.format(new Object[] {"ap-chiyoda-1"}));
153163
IAM_URI.put("ukb", OC8_EP_BASE.format(new Object[] {"ap-ibaraki-1"}));
164+
165+
/* OC9 */
166+
IAM_URI.put("mct", OC9_EP_BASE.format(new Object[] {"me-dcc-muscat-1"}));
167+
168+
/* OC10 */
169+
IAM_URI.put("wga", OC10_EP_BASE.format(new Object[] {"ap-dcc-canberra-1"}));
154170
}
155171

156172
static String getIAMURL(String regionIdOrCode) {
@@ -168,6 +184,12 @@ static String getIAMURL(String regionIdOrCode) {
168184
if (Region.isOC8Region(regionIdOrCode)) {
169185
return OC8_EP_BASE.format(new Object[] {regionIdOrCode});
170186
}
187+
if (Region.isOC9Region(regionIdOrCode)) {
188+
return OC9_EP_BASE.format(new Object[] {regionIdOrCode});
189+
}
190+
if (Region.isOC10Region(regionIdOrCode)) {
191+
return OC10_EP_BASE.format(new Object[] {regionIdOrCode});
192+
}
171193
}
172194

173195
return uri;

driver/src/test/java/oracle/nosql/driver/iam/InstancePrincipalsProviderTest.java

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -457,8 +457,13 @@ public void testRegionURI() {
457457
}
458458

459459
/* test IAM URI by airport code */
460+
assertEquals(Utils.getIAMURL("jnb"),
461+
"https://auth.af-johannesburg-1.oraclecloud.com");
462+
460463
assertEquals(Utils.getIAMURL("bom"),
461464
"https://auth.ap-mumbai-1.oraclecloud.com");
465+
assertEquals(Utils.getIAMURL("sin"),
466+
"https://auth.ap-singapore-1.oraclecloud.com");
462467
assertEquals(Utils.getIAMURL("icn"),
463468
"https://auth.ap-seoul-1.oraclecloud.com");
464469
assertEquals(Utils.getIAMURL("syd"),
@@ -474,6 +479,10 @@ public void testRegionURI() {
474479
assertEquals(Utils.getIAMURL("yny"),
475480
"https://auth.ap-chuncheon-1.oraclecloud.com");
476481

482+
assertEquals(Utils.getIAMURL("mrs"),
483+
"https://auth.eu-marseille-1.oraclecloud.com");
484+
assertEquals(Utils.getIAMURL("arn"),
485+
"https://auth.eu-stockholm-1.oraclecloud.com");
477486
assertEquals(Utils.getIAMURL("fra"),
478487
"https://auth.eu-frankfurt-1.oraclecloud.com");
479488
assertEquals(Utils.getIAMURL("zrh"),
@@ -482,13 +491,17 @@ public void testRegionURI() {
482491
"https://auth.uk-london-1.oraclecloud.com");
483492
assertEquals(Utils.getIAMURL("ams"),
484493
"https://auth.eu-amsterdam-1.oraclecloud.com");
494+
495+
assertEquals(Utils.getIAMURL("auh"),
496+
"https://auth.me-abudhabi-1.oraclecloud.com");
485497
assertEquals(Utils.getIAMURL("jed"),
486498
"https://auth.me-jeddah-1.oraclecloud.com");
487-
assertEquals(Utils.getIAMURL("cwl"),
488-
"https://auth.uk-cardiff-1.oraclecloud.com");
489499
assertEquals(Utils.getIAMURL("dxb"),
490500
"https://auth.me-dubai-1.oraclecloud.com");
491501

502+
assertEquals(Utils.getIAMURL("cwl"),
503+
"https://auth.uk-cardiff-1.oraclecloud.com");
504+
492505
assertEquals(Utils.getIAMURL("iad"),
493506
"https://auth.us-ashburn-1.oraclecloud.com");
494507
assertEquals(Utils.getIAMURL("phx"),
@@ -522,5 +535,11 @@ public void testRegionURI() {
522535

523536
assertEquals(Utils.getIAMURL("nja"),
524537
"https://auth.ap-chiyoda-1.oraclecloud8.com");
538+
539+
assertEquals(Utils.getIAMURL("mct"),
540+
"https://auth.me-dcc-muscat-1.oraclecloud9.com");
541+
542+
assertEquals(Utils.getIAMURL("wga"),
543+
"https://auth.ap-dcc-canberra-1.oraclecloud10.com");
525544
}
526545
}

0 commit comments

Comments
 (0)