Skip to content

Commit 315bcb9

Browse files
committed
Updated OCI regions (SGU, IFP)
1 parent 5e23e24 commit 315bcb9

File tree

3 files changed

+85
-0
lines changed

3 files changed

+85
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ field
2020
* PrepareRequest.setGetQuerySchema
2121
* PreparedStatement.getQuerySchema
2222
- Cloud only: added use of ETags, DefinedTags and FreeFormTags in TableRequest and TableResult
23+
- Cloud only: Updated OCI regions (SGU, IFP)
2324

2425
### Changed
2526
- Consistency is now a class and no longer a simple enumeration. Applications must

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

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ public class Region {
5555
private static final Map<String, Region> OC9_REGIONS = new HashMap<>();
5656
private static final Map<String, Region> OC10_REGIONS = new HashMap<>();
5757
private static final Map<String, Region> OC14_REGIONS = new HashMap<>();
58+
private static final Map<String, Region> OC16_REGIONS = new HashMap<>();
59+
private static final Map<String, Region> OC17_REGIONS = new HashMap<>();
5860

5961
/* OC1 */
6062
public static final Region AF_JOHANNESBURG_1 = new Region("af-johannesburg-1");
@@ -135,6 +137,12 @@ public class Region {
135137
public static final Region AP_DCC_RATING_1 = new Region("eu-dcc-rating-1");
136138
public static final Region AP_DCC_RATING_2 = new Region("eu-dcc-rating-2");
137139

140+
/* OC16 */
141+
public static final Region US_WESTJORDAN_1 = new Region("us-westjordan-1");
142+
143+
/* OC17 */
144+
public static final Region US_DCC_PHOENIX_1 = new Region("us-dcc-phoenix-1");
145+
138146
static {
139147
/* OC1 */
140148
/* AF */
@@ -219,6 +227,12 @@ public class Region {
219227
OC14_REGIONS.put(AP_DCC_MILAN_2.getRegionId(), AP_DCC_MILAN_2);
220228
OC14_REGIONS.put(AP_DCC_RATING_1.getRegionId(), AP_DCC_RATING_1);
221229
OC14_REGIONS.put(AP_DCC_RATING_2.getRegionId(), AP_DCC_RATING_2);
230+
231+
/* OC16 */
232+
OC16_REGIONS.put(US_WESTJORDAN_1.getRegionId(), US_WESTJORDAN_1);
233+
234+
/* OC17 */
235+
OC17_REGIONS.put(US_DCC_PHOENIX_1.getRegionId(), US_DCC_PHOENIX_1);
222236
}
223237

224238
private final static MessageFormat OC1_EP_BASE = new MessageFormat(
@@ -237,6 +251,10 @@ public class Region {
237251
"https://nosql.{0}.oci.oraclecloud10.com");
238252
private final static MessageFormat OC14_EP_BASE = new MessageFormat(
239253
"https://nosql.{0}.oci.oraclecloud14.com");
254+
private final static MessageFormat OC16_EP_BASE = new MessageFormat(
255+
"https://nosql.{0}.oci.oraclecloud16.com");
256+
private final static MessageFormat OC17_EP_BASE = new MessageFormat(
257+
"https://nosql.{0}.oci.oraclecloud17.com");
240258

241259
private String regionId;
242260

@@ -273,6 +291,12 @@ public String endpoint() {
273291
if (isOC14Region(regionId)) {
274292
return OC14_EP_BASE.format(new Object[] { regionId });
275293
}
294+
if (isOC16Region(regionId)) {
295+
return OC16_EP_BASE.format(new Object[] { regionId });
296+
}
297+
if (isOC17Region(regionId)) {
298+
return OC17_EP_BASE.format(new Object[] { regionId });
299+
}
276300
throw new IllegalArgumentException(
277301
"Unable to find endpoint for unknwon region" + regionId);
278302
}
@@ -312,6 +336,12 @@ public static Region fromRegionId(String regionId) {
312336
if (region == null) {
313337
region = OC14_REGIONS.get(regionId);
314338
}
339+
if (region == null) {
340+
region = OC16_REGIONS.get(regionId);
341+
}
342+
if (region == null) {
343+
region = OC17_REGIONS.get(regionId);
344+
}
315345

316346
return region;
317347
}
@@ -405,6 +435,26 @@ public static boolean isOC14Region(String regionId) {
405435
return (OC14_REGIONS.get(regionId) != null);
406436
}
407437

438+
/**
439+
* @hidden
440+
* Internal use only
441+
* @param regionId the region id
442+
* @return the value
443+
*/
444+
public static boolean isOC16Region(String regionId) {
445+
return (OC16_REGIONS.get(regionId) != null);
446+
}
447+
448+
/**
449+
* @hidden
450+
* Internal use only
451+
* @param regionId the region id
452+
* @return the value
453+
*/
454+
public static boolean isOC17Region(String regionId) {
455+
return (OC17_REGIONS.get(regionId) != null);
456+
}
457+
408458
/**
409459
* @hidden
410460
* Internal use only
@@ -477,6 +527,24 @@ public static Collection<Region> getOC14Regions() {
477527
return OC14_REGIONS.values();
478528
}
479529

530+
/**
531+
* @hidden
532+
* Internal use only
533+
* @return the regions
534+
*/
535+
public static Collection<Region> getOC16Regions() {
536+
return OC16_REGIONS.values();
537+
}
538+
539+
/**
540+
* @hidden
541+
* Internal use only
542+
* @return the regions
543+
*/
544+
public static Collection<Region> getOC17Regions() {
545+
return OC17_REGIONS.values();
546+
}
547+
480548
/**
481549
* @hidden
482550
* Internal use only

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,10 @@ class Utils {
107107
"https://auth.{0}.oraclecloud10.com");
108108
private final static MessageFormat OC14_EP_BASE = new MessageFormat(
109109
"https://auth.{0}.oraclecloud14.com");
110+
private final static MessageFormat OC16_EP_BASE = new MessageFormat(
111+
"https://auth.{0}.oraclecloud16.com");
112+
private final static MessageFormat OC17_EP_BASE = new MessageFormat(
113+
"https://auth.{0}.oraclecloud17.com");
110114

111115
static {
112116
/* OC1 */
@@ -187,6 +191,12 @@ class Utils {
187191
IAM_URI.put("mxp", OC14_EP_BASE.format(new Object[] {"eu-dcc-milan-2"}));
188192
IAM_URI.put("dus", OC14_EP_BASE.format(new Object[] {"eu-dcc-rating-1"}));
189193
IAM_URI.put("dtm", OC14_EP_BASE.format(new Object[] {"eu-dcc-rating-2"}));
194+
195+
/* OC16 */
196+
IAM_URI.put("sgu", OC16_EP_BASE.format(new Object[] {"us-westjordan-1"}));
197+
198+
/* OC17 */
199+
IAM_URI.put("ifp", OC17_EP_BASE.format(new Object[] {"us-dcc-phoenix-1"}));
190200
}
191201

192202
static String getIAMURL(String regionIdOrCode) {
@@ -216,6 +226,12 @@ static String getIAMURL(String regionIdOrCode) {
216226
if (Region.isOC14Region(regionIdOrCode)) {
217227
return OC14_EP_BASE.format(new Object[] {regionIdOrCode});
218228
}
229+
if (Region.isOC16Region(regionIdOrCode)) {
230+
return OC16_EP_BASE.format(new Object[] {regionIdOrCode});
231+
}
232+
if (Region.isOC17Region(regionIdOrCode)) {
233+
return OC17_EP_BASE.format(new Object[] {regionIdOrCode});
234+
}
219235
}
220236

221237
return uri;

0 commit comments

Comments
 (0)