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

Change ai ratelimit name #2503

Merged
merged 1 commit into from
Sep 30, 2024
Merged
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
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
Loading