Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# CHANGELOG

## v2.3.0

### Date: 29-Sep-2025

- GCP-EU and AU region support

## v2.2.0

### Date: 25-Aug-2025
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.contentstack.sdk</groupId>
<artifactId>java</artifactId>
<version>2.2.0</version>
<version>2.3.0</version>
<packaging>jar</packaging>
<name>contentstack-java</name>
<description>Java SDK for Contentstack Content Delivery API</description>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/contentstack/sdk/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ public Config setManagementToken(@NotNull String managementToken) {
* The enum Contentstack region. for now contentstack supports [US, EU, AZURE_NA]
*/
public enum ContentstackRegion {
US, EU, AZURE_NA, AZURE_EU, GCP_NA
US, EU, AZURE_NA, AZURE_EU, GCP_NA, GCP_EU, AU
}

}
10 changes: 10 additions & 0 deletions src/main/java/com/contentstack/sdk/Stack.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,16 @@ protected void setConfig(Config config) {
urlDomain = "cdn.contentstack.com";
}
config.host = "gcp-na" + "-" + urlDomain;
} else if (region.equalsIgnoreCase("gcp_eu")) {
if (urlDomain.equalsIgnoreCase("cdn.contentstack.io")) {
urlDomain = "cdn.contentstack.com";
}
config.host = "gcp-eu" + "-" + urlDomain;
} else if (region.equalsIgnoreCase("au")) {
if (urlDomain.equalsIgnoreCase("cdn.contentstack.io")) {
urlDomain = "cdn.contentstack.com";
}
config.host = region + "-" + urlDomain;
}
}

Expand Down
11 changes: 11 additions & 0 deletions src/test/java/com/contentstack/sdk/TestGcpRegion.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,15 @@ void testGcpNARegionBehaviourGcpStackHost() throws IllegalAccessException {
Assertions.assertEquals("gcp-na-cdn.contentstack.com", stack.config.host);

}

@Test
void testGcpEURegionBehaviourGcpStack() throws IllegalAccessException {
Config config = new Config();
Config.ContentstackRegion region = Config.ContentstackRegion.GCP_EU;
config.setRegion(region);
Stack stack = Contentstack.stack("fakeApiKey", "fakeDeliveryToken", "fakeEnvironment", config);
Assertions.assertFalse(config.region.name().isEmpty());
Assertions.assertEquals("GCP_EU", stack.config.region.name());
Assertions.assertEquals("gcp-eu-cdn.contentstack.com", stack.config.host);
}
}
22 changes: 22 additions & 0 deletions src/test/java/com/contentstack/sdk/TestStack.java
Original file line number Diff line number Diff line change
Expand Up @@ -400,4 +400,26 @@ public void onCompletion(ResponseType responseType, Error error) {
});
}

@Test
@Order(44)
void testAURegionSupport() throws IllegalAccessException {
Config config = new Config();
Config.ContentstackRegion region = Config.ContentstackRegion.AU;
config.setRegion(region);
Assertions.assertFalse(config.region.name().isEmpty());
Assertions.assertEquals("AU", config.region.name());
}

@Test
@Order(45)
void testAURegionBehaviourStackHost() throws IllegalAccessException {
Config config = new Config();
Config.ContentstackRegion region = Config.ContentstackRegion.AU;
config.setRegion(region);
Stack stack = Contentstack.stack("fakeApiKey", "fakeDeliveryToken", "fakeEnvironment", config);
Assertions.assertFalse(config.region.name().isEmpty());
Assertions.assertEquals("au-cdn.contentstack.com", stack.config.host);

}

}
Loading