Skip to content

Commit

Permalink
Remove unused aiConfiguration from subscription validation flow
Browse files Browse the repository at this point in the history
  • Loading branch information
nimsara66 committed Oct 19, 2024
1 parent b5ea775 commit 5801196
Show file tree
Hide file tree
Showing 9 changed files with 4 additions and 189 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

package org.wso2.carbon.apimgt.api.model.subscription;

import org.wso2.carbon.apimgt.api.model.AIConfiguration;
import org.wso2.carbon.apimgt.api.model.OperationPolicy;
import org.wso2.carbon.apimgt.api.model.policy.APIPolicy;

Expand Down Expand Up @@ -47,7 +46,6 @@ public class API implements CacheableEntity<String> {
private String organization;
private Set<OperationPolicy> apiPolicies = new HashSet<>();
private boolean isSubscriptionValidationDisabled = false;
private AIConfiguration aiConfiguration;
private int isEgress;
private String subtype;

Expand Down Expand Up @@ -227,14 +225,6 @@ public void setSubscriptionValidationDisabled(boolean subscriptionValidationDisa
isSubscriptionValidationDisabled = subscriptionValidationDisabled;
}

public AIConfiguration getAiConfiguration() {
return aiConfiguration;
}

public void setAiConfiguration(AIConfiguration aiConfiguration) {
this.aiConfiguration = aiConfiguration;
}

public int isEgress() {
return isEgress;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import org.wso2.carbon.apimgt.api.SubscriptionAlreadyExistingException;
import org.wso2.carbon.apimgt.api.dto.ConditionDTO;
import org.wso2.carbon.apimgt.api.dto.ConditionGroupDTO;
import org.wso2.carbon.apimgt.api.model.AIConfiguration;
import org.wso2.carbon.apimgt.api.model.OperationPolicy;
import org.wso2.carbon.apimgt.api.model.policy.AIAPIQuotaLimit;
import org.wso2.carbon.apimgt.api.model.policy.BandwidthLimit;
Expand Down Expand Up @@ -1142,11 +1141,6 @@ public List<API> getAllApis(String organization, String deployment, boolean isEx
api.setStatus(resultSet.getString("STATUS"));
api.setPolicy(resultSet.getString("API_TIER"));
api.setOrganization(resultSet.getString("ORGANIZATION"));
if (resultSet.getString("AI_CONFIGURATION_UUID") != null) {
AIConfiguration aiConfiguration = new AIConfiguration();
aiConfiguration.setLlmProviderId(resultSet.getString("LLM_PROVIDER_UUID"));
api.setAiConfiguration(aiConfiguration);
}
if (resultSet.getString("IS_EGRESS") != null) {
api.setEgress(parseInt(resultSet.getString("IS_EGRESS")));
}
Expand Down Expand Up @@ -1277,11 +1271,6 @@ public API getAPIByContextAndVersion(String context, String version, String depl
api.setStatus(resultSet.getString("STATUS"));
api.setOrganization(resultSet.getString("ORGANIZATION"));
api.setIsDefaultVersion(isAPIDefaultVersion(connection, provider, name, version));
if (resultSet.getString("AI_CONFIGURATION_UUID") != null) {
AIConfiguration aiConfiguration = new AIConfiguration();
aiConfiguration.setLlmProviderId(resultSet.getString("LLM_PROVIDER_UUID"));
api.setAiConfiguration(aiConfiguration);
}
if (resultSet.getString("IS_EGRESS") != null) {
api.setEgress(parseInt(resultSet.getString("IS_EGRESS")));
}
Expand Down Expand Up @@ -1497,11 +1486,6 @@ public API getApiByUUID(String apiId, String deployment, String organization, bo
api.setPolicy(resultSet.getString("API_TIER"));
api.setContext(context);
api.setStatus(resultSet.getString("STATUS"));
if (resultSet.getString("AI_CONFIGURATION_UUID") != null) {
AIConfiguration aiConfiguration = new AIConfiguration();
aiConfiguration.setLlmProviderId(resultSet.getString("LLM_PROVIDER_UUID"));
api.setAiConfiguration(aiConfiguration);
}
if (resultSet.getString("IS_EGRESS") != null) {
api.setEgress(parseInt(resultSet.getString("IS_EGRESS")));
}
Expand Down Expand Up @@ -1597,11 +1581,6 @@ public List<API> getAllApisByLabel(String gatewayLabel, Boolean expand) {
String revision = resultSet.getString("REVISION_UUID");
api.setRevision(revision);
api.setEnvironment(deploymentName);
if (resultSet.getString("AI_CONFIGURATION_UUID") != null) {
AIConfiguration aiConfiguration = new AIConfiguration();
aiConfiguration.setLlmProviderId(resultSet.getString("LLM_PROVIDER_UUID"));
api.setAiConfiguration(aiConfiguration);
}
if (resultSet.getString("IS_EGRESS") != null) {
api.setEgress(parseInt(resultSet.getString("IS_EGRESS")));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -602,15 +602,12 @@ public class SubscriptionValidationSQLConstants {
"AM_API.API_ID, AM_API.API_TIER, AM_API.API_VERSION, AM_API.API_TYPE, AM_API.STATUS, " +
"AM_REVISION.REVISION_UUID AS REVISION_UUID,AM_DEPLOYMENT_REVISION_MAPPING.NAME AS " +
"DEPLOYMENT_NAME,AM_API.ORGANIZATION, " +
"AM_API_AI_CONFIGURATION.AI_CONFIGURATION_UUID AS AI_CONFIGURATION_UUID, " +
"AM_API_AI_CONFIGURATION.LLM_PROVIDER_UUID AS LLM_PROVIDER_UUID, " +
"AM_API.API_SUBTYPE AS API_SUBTYPE, " +
"AM_API.IS_EGRESS AS IS_EGRESS " +
"FROM " +
"AM_API LEFT JOIN AM_REVISION ON AM_API.API_UUID = AM_REVISION.API_UUID " +
"LEFT JOIN AM_DEPLOYMENT_REVISION_MAPPING " +
"ON AM_REVISION.REVISION_UUID=AM_DEPLOYMENT_REVISION_MAPPING.REVISION_UUID " +
"LEFT JOIN AM_API_AI_CONFIGURATION ON AM_API_AI_CONFIGURATION.API_REVISION_UUID = AM_REVISION.REVISION_UUID " +
"WHERE AM_API.API_UUID = ? AND AM_DEPLOYMENT_REVISION_MAPPING.NAME = ? ";

public static final String GET_DEFAULT_VERSION_API_SQL = "SELECT PUBLISHED_DEFAULT_API_VERSION FROM " +
Expand Down Expand Up @@ -641,16 +638,13 @@ public class SubscriptionValidationSQLConstants {
".API_TYPE,AM_API.STATUS,AM_REVISION.REVISION_UUID AS REVISION_UUID,AM_DEPLOYMENT_REVISION_MAPPING.NAME " +
"AS DEPLOYMENT_NAME, " +
"AM_API_DEFAULT_VERSION.PUBLISHED_DEFAULT_API_VERSION AS PUBLISHED_DEFAULT_API_VERSION,AM_API.ORGANIZATION, " +
"AM_API_AI_CONFIGURATION.AI_CONFIGURATION_UUID AS AI_CONFIGURATION_UUID, " +
"AM_API_AI_CONFIGURATION.LLM_PROVIDER_UUID AS LLM_PROVIDER_UUID, " +
"AM_API.API_SUBTYPE AS API_SUBTYPE, " +
"AM_API.IS_EGRESS AS IS_EGRESS " +
"FROM AM_API LEFT JOIN AM_REVISION ON AM_API.API_UUID=AM_REVISION.API_UUID LEFT JOIN " +
"AM_DEPLOYMENT_REVISION_MAPPING ON AM_REVISION.REVISION_UUID=AM_DEPLOYMENT_REVISION_MAPPING.REVISION_UUID" +
" LEFT JOIN AM_API_DEFAULT_VERSION ON AM_API_DEFAULT_VERSION.API_NAME = AM_API.API_NAME AND " +
"AM_API_DEFAULT_VERSION.API_PROVIDER=AM_API.API_PROVIDER AND " +
"AM_API_DEFAULT_VERSION.ORGANIZATION = AM_API.ORGANIZATION " +
"LEFT JOIN AM_API_AI_CONFIGURATION ON AM_API_AI_CONFIGURATION.API_REVISION_UUID = AM_REVISION.REVISION_UUID ";
"AM_API_DEFAULT_VERSION.ORGANIZATION = AM_API.ORGANIZATION ";

public static final String GET_ALL_API_PRODUCT_URI_TEMPLATES_SQL = "SELECT AM_API_URL_MAPPING.URL_MAPPING_ID," +
"AM_API_URL_MAPPING.HTTP_METHOD,AM_API_URL_MAPPING.AUTH_SCHEME,AM_API_URL_MAPPING.URL_PATTERN," +
Expand All @@ -662,14 +656,11 @@ public class SubscriptionValidationSQLConstants {
"AM_API.CONTEXT, AM_API.CONTEXT_TEMPLATE, AM_API.API_UUID, AM_API.API_ID,AM_API.API_TIER, " +
"AM_API.API_VERSION, AM_API.API_TYPE, AM_API.STATUS, AM_REVISION.REVISION_UUID AS REVISION_UUID, " +
"AM_DEPLOYMENT_REVISION_MAPPING.NAME AS DEPLOYMENT_NAME, AM_API.ORGANIZATION, " +
"AM_API_AI_CONFIGURATION.AI_CONFIGURATION_UUID AS AI_CONFIGURATION_UUID, " +
"AM_API_AI_CONFIGURATION.LLM_PROVIDER_UUID AS LLM_PROVIDER_UUID, " +
"AM_API.API_SUBTYPE AS API_SUBTYPE, " +
"AM_API.IS_EGRESS AS IS_EGRESS " +
"FROM AM_API LEFT JOIN AM_REVISION ON AM_API.API_UUID=AM_REVISION.API_UUID " +
"LEFT JOIN AM_DEPLOYMENT_REVISION_MAPPING ON " +
"AM_REVISION.REVISION_UUID=AM_DEPLOYMENT_REVISION_MAPPING.REVISION_UUID " +
"LEFT JOIN AM_API_AI_CONFIGURATION ON AM_API_AI_CONFIGURATION.API_REVISION_UUID = AM_REVISION.REVISION_UUID " +
"WHERE ((AM_API.CONTEXT_TEMPLATE IS NULL AND AM_API.CONTEXT = ?) " +
"OR (AM_API.CONTEXT_TEMPLATE IS NOT NULL AND AM_API.CONTEXT = ?)) AND AM_API.API_VERSION = ?";

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import com.fasterxml.jackson.annotation.JsonCreator;
import java.util.ArrayList;
import java.util.List;
import org.wso2.carbon.apimgt.internal.service.dto.AIConfigurationDTO;
import org.wso2.carbon.apimgt.internal.service.dto.OperationPolicyDTO;
import org.wso2.carbon.apimgt.internal.service.dto.URLMappingDTO;
import javax.validation.constraints.*;
Expand Down Expand Up @@ -36,7 +35,6 @@ public class APIDTO {
private List<URLMappingDTO> urlMappings = new ArrayList<>();
private String securityScheme = null;
private Boolean isSubscriptionValidationDisabled = false;
private AIConfigurationDTO aiConfiguration = null;
private Boolean isEgress = null;
private String subtype = null;

Expand Down Expand Up @@ -307,23 +305,6 @@ public void setIsSubscriptionValidationDisabled(Boolean isSubscriptionValidation
this.isSubscriptionValidationDisabled = isSubscriptionValidationDisabled;
}

/**
**/
public APIDTO aiConfiguration(AIConfigurationDTO aiConfiguration) {
this.aiConfiguration = aiConfiguration;
return this;
}


@ApiModelProperty(value = "")
@JsonProperty("aiConfiguration")
public AIConfigurationDTO getAiConfiguration() {
return aiConfiguration;
}
public void setAiConfiguration(AIConfigurationDTO aiConfiguration) {
this.aiConfiguration = aiConfiguration;
}

/**
* Indicates if the API is an egress API.
**/
Expand Down Expand Up @@ -385,14 +366,13 @@ public boolean equals(java.lang.Object o) {
Objects.equals(urlMappings, API.urlMappings) &&
Objects.equals(securityScheme, API.securityScheme) &&
Objects.equals(isSubscriptionValidationDisabled, API.isSubscriptionValidationDisabled) &&
Objects.equals(aiConfiguration, API.aiConfiguration) &&
Objects.equals(isEgress, API.isEgress) &&
Objects.equals(subtype, API.subtype);
}

@Override
public int hashCode() {
return Objects.hash(uuid, apiId, provider, name, version, context, policy, apiType, status, organization, isDefaultVersion, apiPolicies, urlMappings, securityScheme, isSubscriptionValidationDisabled, aiConfiguration, isEgress, subtype);
return Objects.hash(uuid, apiId, provider, name, version, context, policy, apiType, status, organization, isDefaultVersion, apiPolicies, urlMappings, securityScheme, isSubscriptionValidationDisabled, isEgress, subtype);

Check warning on line 375 in components/apimgt/org.wso2.carbon.apimgt.internal.service/src/gen/java/org/wso2/carbon/apimgt/internal/service/dto/APIDTO.java

View check run for this annotation

Codecov / codecov/patch

components/apimgt/org.wso2.carbon.apimgt.internal.service/src/gen/java/org/wso2/carbon/apimgt/internal/service/dto/APIDTO.java#L375

Added line #L375 was not covered by tests
}

@Override
Expand All @@ -415,7 +395,6 @@ public String toString() {
sb.append(" urlMappings: ").append(toIndentedString(urlMappings)).append("\n");
sb.append(" securityScheme: ").append(toIndentedString(securityScheme)).append("\n");
sb.append(" isSubscriptionValidationDisabled: ").append(toIndentedString(isSubscriptionValidationDisabled)).append("\n");
sb.append(" aiConfiguration: ").append(toIndentedString(aiConfiguration)).append("\n");
sb.append(" isEgress: ").append(toIndentedString(isEgress)).append("\n");
sb.append(" subtype: ").append(toIndentedString(subtype)).append("\n");
sb.append("}");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import org.wso2.carbon.apimgt.api.APIManagementException;
import org.wso2.carbon.apimgt.api.APIProvider;
import org.wso2.carbon.apimgt.api.dto.ConditionDTO;
import org.wso2.carbon.apimgt.api.model.AIConfiguration;
import org.wso2.carbon.apimgt.api.model.ApiTypeWrapper;
import org.wso2.carbon.apimgt.api.model.OperationPolicy;
import org.wso2.carbon.apimgt.api.model.Scope;
Expand Down Expand Up @@ -119,12 +118,6 @@ private static APIDTO fromAPItoDTO(API model) throws APIManagementException {
}
apidto.setApiPolicies(apiPolicies);
apidto.setUrlMappings(urlMappingsDTO);
AIConfiguration aiConfiguration = model.getAiConfiguration();
if (aiConfiguration != null) {
AIConfigurationDTO aiConfigurationDTO = new AIConfigurationDTO();
aiConfigurationDTO.setLlmProviderId(aiConfiguration.getLlmProviderId());
apidto.setAiConfiguration(aiConfigurationDTO);
}
apidto.setIsEgress(model.isEgress() != 0);
apidto.setSubtype(model.getSubtype());
}
Expand Down Expand Up @@ -187,12 +180,6 @@ public static APIListDTO fromAPIToAPIListDTO(API model) throws APIManagementExce
}
apidto.setApiPolicies(apiPolicies);
apidto.setUrlMappings(urlMappingsDTO);
AIConfiguration aiConfiguration = model.getAiConfiguration();
if (aiConfiguration != null) {
AIConfigurationDTO aiConfigurationDTO = new AIConfigurationDTO();
aiConfigurationDTO.setLlmProviderId(aiConfiguration.getLlmProviderId());
apidto.setAiConfiguration(aiConfigurationDTO);
}
apidto.setIsEgress(model.isEgress() != 0);
apidto.setSubtype(model.getSubtype());
apiListdto.setCount(1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1080,8 +1080,6 @@ definitions:
description: Whether subscription validation is disabled.
default: false
example: false
aiConfiguration:
$ref: '#/definitions/AIConfiguration'
isEgress:
type: boolean
description: Indicates if the API is an egress API.
Expand All @@ -1091,16 +1089,6 @@ definitions:
description: The subtype of the API.
example: Default


#-----------------------------------------------------
# The AIConfiguration resource
#-----------------------------------------------------
AIConfiguration:
properties:
llmProviderId:
type: string
description: UUID of the LLM (Large Language Model) provider.

#-----------------------------------------------------
# synapse Artifact resource
#-----------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1384,9 +1384,6 @@
"description" : "Whether subscription validation is disabled.",
"default" : false
},
"aiConfiguration" : {
"$ref" : "#/definitions/AIConfiguration"
},
"isEgress" : {
"type" : "boolean",
"example" : false,
Expand All @@ -1399,14 +1396,6 @@
}
}
},
"AIConfiguration" : {
"properties" : {
"llmProviderId" : {
"type" : "string",
"description" : "UUID of the LLM (Large Language Model) provider."
}
}
},
"synapseArtifact" : {
"properties" : {
"apiId" : {
Expand Down Expand Up @@ -1536,8 +1525,8 @@
"type" : "string",
"example" : "EXCHANGED",
"description" : "The type of the tokens to be used (exchanged or without exchanged). Accepted values are EXCHANGED, DIRECT or BOTH.",
"enum" : [ "EXCHANGED", "DIRECT", "BOTH" ],
"default" : "DIRECT"
"default" : "DIRECT",
"enum" : [ "EXCHANGED", "DIRECT", "BOTH" ]
}
}
},
Expand Down
Loading

0 comments on commit 5801196

Please sign in to comment.