Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rebase master to AI API gateway feature branch #12596

Merged
merged 7 commits into from
Sep 25, 2024
2 changes: 1 addition & 1 deletion components/apimgt/org.wso2.carbon.apimgt.api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<parent>
<groupId>org.wso2.carbon.apimgt</groupId>
<artifactId>apimgt</artifactId>
<version>9.29.205-SNAPSHOT</version>
<version>9.30.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<artifactId>apimgt</artifactId>
<groupId>org.wso2.carbon.apimgt</groupId>
<version>9.29.205-SNAPSHOT</version>
<version>9.30.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<parent>
<artifactId>apimgt</artifactId>
<groupId>org.wso2.carbon.apimgt</groupId>
<version>9.29.205-SNAPSHOT</version>
<version>9.30.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<parent>
<groupId>org.wso2.carbon.apimgt</groupId>
<artifactId>apimgt</artifactId>
<version>9.29.205-SNAPSHOT</version>
<version>9.30.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>org.wso2.carbon.apimgt</groupId>
<artifactId>apimgt</artifactId>
<version>9.29.205-SNAPSHOT</version>
<version>9.30.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>org.wso2.carbon.apimgt</groupId>
<artifactId>apimgt</artifactId>
<version>9.29.205-SNAPSHOT</version>
<version>9.30.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.wso2.carbon.apimgt</groupId>
<artifactId>apimgt</artifactId>
<version>9.29.205-SNAPSHOT</version>
<version>9.30.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion components/apimgt/org.wso2.carbon.apimgt.core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.wso2.carbon.apimgt</groupId>
<artifactId>apimgt</artifactId>
<version>9.29.205-SNAPSHOT</version>
<version>9.30.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<parent>
<groupId>org.wso2.carbon.apimgt</groupId>
<artifactId>apimgt</artifactId>
<version>9.29.205-SNAPSHOT</version>
<version>9.30.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<parent>
<artifactId>apimgt</artifactId>
<groupId>org.wso2.carbon.apimgt</groupId>
<version>9.29.205-SNAPSHOT</version>
<version>9.30.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion components/apimgt/org.wso2.carbon.apimgt.eventing/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<parent>
<artifactId>apimgt</artifactId>
<groupId>org.wso2.carbon.apimgt</groupId>
<version>9.29.205-SNAPSHOT</version>
<version>9.30.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion components/apimgt/org.wso2.carbon.apimgt.gateway/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<parent>
<groupId>org.wso2.carbon.apimgt</groupId>
<artifactId>apimgt</artifactId>
<version>9.29.205-SNAPSHOT</version>
<version>9.30.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion components/apimgt/org.wso2.carbon.apimgt.impl/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<parent>
<groupId>org.wso2.carbon.apimgt</groupId>
<artifactId>apimgt</artifactId>
<version>9.29.205-SNAPSHOT</version>
<version>9.30.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1082,6 +1082,7 @@ private Permissions() {
public static final String API_USAGE_DAS_REST_API_PASSWORD = API_ANALYTICS + "StreamProcessorRestApiPassword";

public static final String UNLIMITED_TIER = "Unlimited";
public static final String THROTTLING_TIER = "THROTTLING_TIER";
public static final String UNLIMITED_TIER_DESC = "Allows unlimited requests";

public static final String UNAUTHENTICATED_TIER = "Unauthenticated";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6808,7 +6808,11 @@ public ArrayList<URITemplate> getAllURITemplatesOldThrottle(String apiContext, S
uriTemplate.setHTTPVerb(rs.getString("HTTP_METHOD"));
uriTemplate.setAuthType(rs.getString("AUTH_SCHEME"));
uriTemplate.setUriTemplate(rs.getString("URL_PATTERN"));
uriTemplate.setThrottlingTier(rs.getString("THROTTLING_TIER"));
if (rs.getString(APIConstants.THROTTLING_TIER).isEmpty()) {
uriTemplate.setThrottlingTier(APIConstants.UNLIMITED_TIER);
} else {
uriTemplate.setThrottlingTier(rs.getString(APIConstants.THROTTLING_TIER));
}
InputStream mediationScriptBlob = rs.getBinaryStream("MEDIATION_SCRIPT");
if (mediationScriptBlob != null) {
script = APIMgtDBUtil.getStringFromInputStream(mediationScriptBlob);
Expand Down Expand Up @@ -6902,7 +6906,12 @@ private ArrayList<URITemplate> extractURITemplates(ResultSet rs) throws SQLExcep
String httpVerb = rs.getString("HTTP_METHOD");
String authType = rs.getString("AUTH_SCHEME");
String urlPattern = rs.getString("URL_PATTERN");
String policyName = rs.getString("THROTTLING_TIER");
String policyName;
if(rs.getString(APIConstants.THROTTLING_TIER).isEmpty()){
policyName = APIConstants.UNLIMITED_TIER;
} else {
policyName = rs.getString(APIConstants.THROTTLING_TIER);
}
String conditionGroupId = rs.getString("CONDITION_GROUP_ID");
String applicableLevel = rs.getString("APPLICABLE_LEVEL");
String policyConditionGroupId = "_condition_" + conditionGroupId;
Expand Down Expand Up @@ -7430,7 +7439,12 @@ public HashMap<String, String> getURITemplatesPerAPIAsString(String uuid)
String uriPattern = resultSet.getString("URL_PATTERN");
String httpMethod = resultSet.getString("HTTP_METHOD");
String authScheme = resultSet.getString("AUTH_SCHEME");
String throttlingTier = resultSet.getString("THROTTLING_TIER");
String throttlingTier;
if(resultSet.getString(APIConstants.THROTTLING_TIER).isEmpty()){
throttlingTier = APIConstants.UNLIMITED_TIER;
} else {
throttlingTier = resultSet.getString(APIConstants.THROTTLING_TIER);
}
InputStream mediationScriptBlob = resultSet.getBinaryStream("MEDIATION_SCRIPT");
if (mediationScriptBlob != null) {
script = APIMgtDBUtil.getStringFromInputStream(mediationScriptBlob);
Expand Down Expand Up @@ -7499,7 +7513,12 @@ public Set<URITemplate> getURITemplatesOfAPI(String uuid)
uriTemplate.setHttpVerbs(verb);
uriTemplate.setId(uriTemplateId);
String authType = rs.getString("AUTH_SCHEME");
String throttlingTier = rs.getString("THROTTLING_TIER");
String throttlingTier;
if(rs.getString(APIConstants.THROTTLING_TIER).isEmpty()) {
throttlingTier = APIConstants.UNLIMITED_TIER;
} else {
throttlingTier = rs.getString(APIConstants.THROTTLING_TIER);
}
if (StringUtils.isNotEmpty(scopeName)) {
Scope scope = new Scope();
scope.setKey(scopeName);
Expand Down Expand Up @@ -7559,7 +7578,12 @@ public Set<URITemplate> getURITemplatesOfAPI(String uuid)
uriTemplate.setHTTPVerb(verb);
uriTemplate.setHttpVerbs(verb);
String authType = rs.getString("AUTH_SCHEME");
String throttlingTier = rs.getString("THROTTLING_TIER");
String throttlingTier;
if (rs.getString(APIConstants.THROTTLING_TIER).isEmpty()) {
throttlingTier = APIConstants.UNLIMITED_TIER;
} else {
throttlingTier = rs.getString(APIConstants.THROTTLING_TIER);
}
if (StringUtils.isNotEmpty(scopeName)) {
Scope scope = new Scope();
scope.setKey(scopeName);
Expand Down Expand Up @@ -7627,7 +7651,12 @@ public Map<Integer, URITemplate> getURITemplatesOfAPIWithProductMapping(String u
uriTemplate.setHTTPVerb(verb);
uriTemplate.setHttpVerbs(verb);
String authType = rs.getString("AUTH_SCHEME");
String throttlingTier = rs.getString("THROTTLING_TIER");
String throttlingTier;
if (rs.getString(APIConstants.THROTTLING_TIER).isEmpty()) {
throttlingTier = APIConstants.UNLIMITED_TIER;
} else {
throttlingTier = rs.getString(APIConstants.THROTTLING_TIER);
}
if (StringUtils.isNotEmpty(scopeName)) {
Scope scope = new Scope();
scope.setKey(scopeName);
Expand Down Expand Up @@ -15073,7 +15102,11 @@ public void addAPIProductResourceMappings(List<APIProductResource> productResour
uriTemplate.setHTTPVerb(rs.getString("HTTP_METHOD"));
uriTemplate.setAuthType(rs.getString("AUTH_SCHEME"));
uriTemplate.setUriTemplate(rs.getString("URL_PATTERN"));
uriTemplate.setThrottlingTier(rs.getString("THROTTLING_TIER"));
if(rs.getString(APIConstants.THROTTLING_TIER).isEmpty()){
uriTemplate.setThrottlingTier(APIConstants.UNLIMITED_TIER);
} else {
uriTemplate.setThrottlingTier(rs.getString(APIConstants.THROTTLING_TIER));
}
String script = null;
InputStream mediationScriptBlob = rs.getBinaryStream("MEDIATION_SCRIPT");
if (mediationScriptBlob != null) {
Expand Down Expand Up @@ -15463,8 +15496,11 @@ public List<APIProductResource> getAPIProductResourceMappings(APIProductIdentifi
int uriTemplateId = rs.getInt("URL_MAPPING_ID");
uriTemplate.setId(uriTemplateId);
uriTemplate.setAuthType(rs.getString("AUTH_SCHEME"));
uriTemplate.setThrottlingTier(rs.getString("THROTTLING_TIER"));

if(rs.getString(APIConstants.THROTTLING_TIER).isEmpty()){
uriTemplate.setThrottlingTier(APIConstants.UNLIMITED_TIER);
} else {
uriTemplate.setThrottlingTier(rs.getString(APIConstants.THROTTLING_TIER));
}
try (PreparedStatement scopesStatement = connection.
prepareStatement(SQLConstants.GET_SCOPE_KEYS_BY_URL_MAPPING_ID)) {
scopesStatement.setInt(1, uriTemplateId);
Expand Down Expand Up @@ -15521,7 +15557,11 @@ public List<APIProductResource> getAPIProductResourceMappings(APIProductIdentifi
int uriTemplateId = rs.getInt("URL_MAPPING_ID");
uriTemplate.setId(uriTemplateId);
uriTemplate.setAuthType(rs.getString("AUTH_SCHEME"));
uriTemplate.setThrottlingTier(rs.getString("THROTTLING_TIER"));
if(rs.getString(APIConstants.THROTTLING_TIER).isEmpty()){
uriTemplate.setThrottlingTier(APIConstants.UNLIMITED_TIER);
} else {
uriTemplate.setThrottlingTier(rs.getString(APIConstants.THROTTLING_TIER));
}

try (PreparedStatement scopesStatement = connection.
prepareStatement(SQLConstants.GET_SCOPE_KEYS_BY_URL_MAPPING_ID)) {
Expand Down Expand Up @@ -18472,7 +18512,11 @@ public void restoreAPIProductRevision(APIRevision apiRevision) throws APIManagem
uriTemplate.setHTTPVerb(httpMethod);
uriTemplate.setAuthType(rs.getString("AUTH_SCHEME"));
uriTemplate.setUriTemplate(rs.getString("URL_PATTERN"));
uriTemplate.setThrottlingTier(rs.getString("THROTTLING_TIER"));
if(rs.getString(APIConstants.THROTTLING_TIER).isEmpty()){
uriTemplate.setThrottlingTier(APIConstants.UNLIMITED_TIER);
} else {
uriTemplate.setThrottlingTier(rs.getString(APIConstants.THROTTLING_TIER));
}
InputStream mediationScriptBlob = rs.getBinaryStream("MEDIATION_SCRIPT");
if (mediationScriptBlob != null) {
script = APIMgtDBUtil.getStringFromInputStream(mediationScriptBlob);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -290,16 +290,6 @@ protected void activate(ComponentContext componentContext) throws Exception {

//Adding default correlation configs at initial server start up
APIUtil.addDefaultCorrelationConfigs();
// Update all NULL THROTTLING_TIER values to Unlimited
boolean isNullThrottlingTierConversionEnabled = APIUtil.updateNullThrottlingTierAtStartup();
try {
if (isNullThrottlingTierConversionEnabled) {
ApiMgtDAO.getInstance().convertNullThrottlingTiers();
}
} catch (APIManagementException e) {
log.error("Failed to convert NULL THROTTLING_TIERS to Unlimited");
}

// // Initialise KeyManager.
// KeyManagerHolder.initializeKeyManager(configuration);
// Initialise sql constants
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<parent>
<groupId>org.wso2.carbon.apimgt</groupId>
<artifactId>apimgt</artifactId>
<version>9.29.205-SNAPSHOT</version>
<version>9.30.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.wso2.carbon.apimgt</groupId>
<artifactId>apimgt</artifactId>
<version>9.29.205-SNAPSHOT</version>
<version>9.30.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<parent>
<groupId>org.wso2.carbon.apimgt</groupId>
<artifactId>apimgt</artifactId>
<version>9.29.205-SNAPSHOT</version>
<version>9.30.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion components/apimgt/org.wso2.carbon.apimgt.keymgt/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<parent>
<groupId>org.wso2.carbon.apimgt</groupId>
<artifactId>apimgt</artifactId>
<version>9.29.205-SNAPSHOT</version>
<version>9.30.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<parent>
<artifactId>apimgt</artifactId>
<groupId>org.wso2.carbon.apimgt</groupId>
<version>9.29.205-SNAPSHOT</version>
<version>9.30.1-SNAPSHOT</version>
</parent>
<artifactId>org.wso2.carbon.apimgt.notification</artifactId>
<modelVersion>4.0.0</modelVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<parent>
<groupId>org.wso2.carbon.apimgt</groupId>
<artifactId>apimgt</artifactId>
<version>9.29.205-SNAPSHOT</version>
<version>9.30.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<artifactId>apimgt</artifactId>
<groupId>org.wso2.carbon.apimgt</groupId>
<version>9.29.205-SNAPSHOT</version>
<version>9.30.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<parent>
<groupId>org.wso2.carbon.apimgt</groupId>
<artifactId>apimgt</artifactId>
<version>9.29.205-SNAPSHOT</version>
<version>9.30.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<parent>
<groupId>org.wso2.carbon.apimgt</groupId>
<artifactId>apimgt</artifactId>
<version>9.29.205-SNAPSHOT</version>
<version>9.30.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<parent>
<groupId>org.wso2.carbon.apimgt</groupId>
<artifactId>apimgt</artifactId>
<version>9.29.205-SNAPSHOT</version>
<version>9.30.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<parent>
<groupId>org.wso2.carbon.apimgt</groupId>
<artifactId>apimgt</artifactId>
<version>9.29.205-SNAPSHOT</version>
<version>9.30.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<parent>
<groupId>org.wso2.carbon.apimgt</groupId>
<artifactId>apimgt</artifactId>
<version>9.29.205-SNAPSHOT</version>
<version>9.30.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<parent>
<groupId>org.wso2.carbon.apimgt</groupId>
<artifactId>apimgt</artifactId>
<version>9.29.205-SNAPSHOT</version>
<version>9.30.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
Loading
Loading