Skip to content

Commit

Permalink
Merge pull request #2503 from Tharsanan1/apk-agent-airl
Browse files Browse the repository at this point in the history
Change ai ratelimit name
  • Loading branch information
Tharsanan1 authored Sep 30, 2024
2 parents 6134087 + 2e24b50 commit 9f39594
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions runtime/config-deployer-service/ballerina/APIClient.bal
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ public class APIClient {
};
AIRatelimit? aiRatelimit = sandboxEndpointConfig.aiRatelimit;
if aiRatelimit is AIRatelimit && aiRatelimit.enabled {
model:AIRateLimitPolicy airl = self.generateAIRateLimitPolicyCR(apkConf, aiRatelimit.token, aiRatelimit.request, backendService.metadata.name, organization);
model:AIRateLimitPolicy airl = self.generateAIRateLimitPolicyCR(apkConf, aiRatelimit.token, aiRatelimit.request, backendService.metadata.name, organization, SANDBOX_TYPE);
apiArtifact.aiRatelimitPolicies[airl.metadata.name] = airl;
}
}
Expand All @@ -253,7 +253,7 @@ public class APIClient {
};
AIRatelimit? aiRatelimit = productionEndpointConfig.aiRatelimit;
if aiRatelimit is AIRatelimit && aiRatelimit.enabled {
model:AIRateLimitPolicy airl = self.generateAIRateLimitPolicyCR(apkConf, aiRatelimit.token, aiRatelimit.request, backendService.metadata.name, organization);
model:AIRateLimitPolicy airl = self.generateAIRateLimitPolicyCR(apkConf, aiRatelimit.token, aiRatelimit.request, backendService.metadata.name, organization, PRODUCTION_TYPE);
apiArtifact.aiRatelimitPolicies[airl.metadata.name] = airl;
}
}
Expand Down Expand Up @@ -1516,11 +1516,11 @@ public class APIClient {
return rateLimitPolicyCR;
}

public isolated function generateAIRateLimitPolicyCR(APKConf apkConf, TokenAIRL tokenAIRL, RequestAIRL requestAIRL, string targetRefName, commons:Organization organization) returns model:AIRateLimitPolicy {
string apiIdentifierHash = crypto:hashSha1((apkConf.name + apkConf.version).toBytes()).toBase16();
public isolated function generateAIRateLimitPolicyCR(APKConf apkConf, TokenAIRL tokenAIRL, RequestAIRL requestAIRL, string targetRefName, commons:Organization organization, string env) returns model:AIRateLimitPolicy {
string apiIdentifierHash = crypto:hashSha1((apkConf.name + apkConf.version + env).toBytes()).toBase16();
model:AIRateLimitPolicy aiRateLimitPolicyCR = {
metadata: {
name: self.retrieveAIRateLimitPolicyName(apiIdentifierHash, targetRefName),
name: apiIdentifierHash,
labels: self.getLabels(apkConf, organization)
},
spec: {
Expand Down

0 comments on commit 9f39594

Please sign in to comment.