Skip to content

Commit

Permalink
fixing issues with test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
CrowleyRajapakse committed Feb 4, 2025
1 parent 224ad22 commit ce98807
Show file tree
Hide file tree
Showing 7 changed files with 131 additions and 121 deletions.
7 changes: 7 additions & 0 deletions gateway/enforcer/internal/datastore/api_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,13 @@ func (s *APIStore) GetMatchedAPI(apiKey string) *requestconfig.API {
return s.apis[apiKey]
}

// UpdateMatchedAPI updates the API that matches the given API key.
func (s *APIStore) UpdateMatchedAPI(apiKey string, api *requestconfig.API) {
s.mu.Lock()
defer s.mu.Unlock()
s.apis[apiKey] = api
}

// ConvertBackendJWTTokenInfoToJWTConfig converts BackendJWTTokenInfo to JWTConfiguration.
func convertBackendJWTTokenInfoToJWTConfig(info *api.BackendJWTTokenInfo, cfg *config.Server, apiName string) *dto.BackendJWTConfiguration {
if info == nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ package dto
// ExternalProcessingEnvoyAttributes represents the attributes extracted from the external processing request.
type ExternalProcessingEnvoyAttributes struct {
EnableBackendBasedAIRatelimit string `json:"enableBackendBasedAIRatelimitAttribute"`
SuspendAIModel string `json:"suspendAIModelAttribute"`
SuspendAIModel string `json:"suspendAIModelAttribute"`
BackendBasedAIRatelimitDescriptorValue string `json:"backendBasedAIRatelimitDescriptorValueAttribute"`
Path string `json:"pathAttribute"`
VHost string `json:"vHostAttribute"`
Expand All @@ -32,5 +32,5 @@ type ExternalProcessingEnvoyAttributes struct {
RequestMehod string `json:"requestMehodAttribute"`
Organization string `json:"organizationAttribute"`
ApplicationID string `json:"applicationIdAttribute"`
CorrelationID string `json:"correlationIdAttribute"`
CorrelationID string `json:"correlationIdAttribute"`
}
202 changes: 105 additions & 97 deletions gateway/enforcer/internal/extproc/ext_proc.go

Large diffs are not rendered by default.

21 changes: 8 additions & 13 deletions runtime/config-deployer-service/ballerina/APIClient.bal
Original file line number Diff line number Diff line change
Expand Up @@ -146,14 +146,14 @@ public class APIClient {
}
}

model:Endpoint[]? productionEndpoints = createdEndpoints.hasKey(PRODUCTION_TYPE) ? createdEndpoints.get(PRODUCTION_TYPE) : ();
model:Endpoint[]? sandboxEndpoints = createdEndpoints.hasKey(SANDBOX_TYPE) ? createdEndpoints.get(SANDBOX_TYPE) : ();
if productionEndpoints is model:Endpoint[] && productionEndpoints.length() > 0 {
_ = check self.setRoute(apiArtifact, apkConf, createdEndpoints.hasKey(PRODUCTION_TYPE) ? createdEndpoints.get(PRODUCTION_TYPE) : (), uniqueId, PRODUCTION_TYPE, organization);
}
if sandboxEndpoints is model:Endpoint[] && sandboxEndpoints.length() > 0 {
_ = check self.setRoute(apiArtifact, apkConf, createdEndpoints.hasKey(SANDBOX_TYPE) ? createdEndpoints.get(SANDBOX_TYPE) : (), uniqueId, SANDBOX_TYPE, organization);
}
// model:Endpoint[]? productionEndpoints = createdEndpoints.hasKey(PRODUCTION_TYPE) ? createdEndpoints.get(PRODUCTION_TYPE) : ();
// model:Endpoint[]? sandboxEndpoints = createdEndpoints.hasKey(SANDBOX_TYPE) ? createdEndpoints.get(SANDBOX_TYPE) : ();
// if productionEndpoints is model:Endpoint[] && productionEndpoints.length() > 0 {
_ = check self.setRoute(apiArtifact, apkConf, createdEndpoints.hasKey(PRODUCTION_TYPE) ? createdEndpoints.get(PRODUCTION_TYPE) : (), uniqueId, PRODUCTION_TYPE, organization);
//}
//if sandboxEndpoints is model:Endpoint[] && sandboxEndpoints.length() > 0 {
_ = check self.setRoute(apiArtifact, apkConf, createdEndpoints.hasKey(SANDBOX_TYPE) ? createdEndpoints.get(SANDBOX_TYPE) : (), uniqueId, SANDBOX_TYPE, organization);
//}
string|json generatedSwagger = check self.retrieveGeneratedSwaggerDefinition(apkConf, definition);
check self.retrieveGeneratedConfigmapForDefinition(apiArtifact, apkConf, generatedSwagger, uniqueId, organization);
self.generateAndSetAPICRArtifact(apiArtifact, apkConf, organization);
Expand Down Expand Up @@ -564,11 +564,6 @@ public class APIClient {
APKOperations[][] operationsArray = [];
int row = 0;
int column = 0;
if endpoint is model:Endpoint[] && endpoint.length() > 0 {
operationsArray = [apiOperations];
} else {
operationsArray = [apiOperations];
}
foreach APKOperations item in apiOperations {
if column > 7 {
row = row + 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ type: "REST"
defaultVersion: false
endpointConfigurations:
production:
- endpoint: "http://backend:80/anything"
- endpoint: "http://backend:80/anything"
sandbox:
- endpoint: "http://backend:80/anything/test"
- endpoint: "http://backend:80/anything/test"
operations:
- target: "/employee"
verb: "GET"
Expand All @@ -21,9 +21,9 @@ operations:
scopes: []
endpointConfigurations:
production:
endpoint: "http://backend:80/anything/test"
- endpoint: "http://backend:80/anything/test"
sandbox:
endpoint: "http://backend:80/anything"
- endpoint: "http://backend:80/anything"
- target: "/employee/{employeeId}"
verb: "PUT"
secured: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ type: "REST"
defaultVersion: false
endpointConfigurations:
production:
- endpoint: "http://backend:80/anything"
- endpoint: "http://backend:80/anything"
operations:
- target: "/employee"
verb: "GET"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,28 +12,28 @@ operations:
scopes: []
endpointConfigurations:
production:
- endpoint: "http://backend:80/anything"
- endpoint: "http://backend:80/anything"
- target: "/employee"
verb: "POST"
secured: true
scopes: []
endpointConfigurations:
production:
- endpoint: "http://backend:80/anything"
- endpoint: "http://backend:80/anything"
- target: "/employee/{employeeId}"
verb: "PUT"
secured: true
scopes: []
endpointConfigurations:
production:
- endpoint: "http://backend:80/anything"
- endpoint: "http://backend:80/anything"
- target: "/employee/{employeeId}"
verb: "DELETE"
secured: true
scopes: []
endpointConfigurations:
production:
- endpoint: "http://backend:80/anything"
- endpoint: "http://backend:80/anything"
authentication:
- authType: OAuth2
enabled: true
Expand Down

0 comments on commit ce98807

Please sign in to comment.