diff --git a/modules/distribution/product/src/main/assembly/bin.xml b/modules/distribution/product/src/main/assembly/bin.xml
index 97277ea1f6..d08e90bcd8 100644
--- a/modules/distribution/product/src/main/assembly/bin.xml
+++ b/modules/distribution/product/src/main/assembly/bin.xml
@@ -425,6 +425,17 @@
**/**.xml
+
+
+
+ ../../p2-profile/product/target/wso2carbon-core-${carbon.kernel.version}/repository/resources/api_definitions
+
+ wso2am-${pom.version}/repository/resources/api_definitions
+
+ **/**.yaml
+
+
+
src/main/conf/governance
wso2am-${pom.version}/repository/resources
diff --git a/modules/integration/tests-common/clients/admin/.openapi-generator/admin-api.yaml.sha256 b/modules/integration/tests-common/clients/admin/.openapi-generator/admin-api.yaml.sha256
index 219bbf22ef..4f5ee33907 100644
--- a/modules/integration/tests-common/clients/admin/.openapi-generator/admin-api.yaml.sha256
+++ b/modules/integration/tests-common/clients/admin/.openapi-generator/admin-api.yaml.sha256
@@ -1 +1 @@
-cca415b078e76654cef5d2b0ec616e8e322a3b7607e6a4a14b545c200ad7ec97
\ No newline at end of file
+107551f176df23e9935ec5689c024391825a72c2eaf11e3879bdf11d77401eeb
\ No newline at end of file
diff --git a/modules/integration/tests-common/clients/admin/api/openapi.yaml b/modules/integration/tests-common/clients/admin/api/openapi.yaml
index 47ea98940a..f672029e59 100644
--- a/modules/integration/tests-common/clients/admin/api/openapi.yaml
+++ b/modules/integration/tests-common/clients/admin/api/openapi.yaml
@@ -8147,6 +8147,7 @@ components:
- REQUESTCOUNTLIMIT
- BANDWIDTHLIMIT
- EVENTCOUNTLIMIT
+ - AIAPIQUOTALIMIT
example: REQUESTCOUNTLIMIT
type: string
requestCount:
@@ -8155,6 +8156,8 @@ components:
$ref: '#/components/schemas/BandwidthLimit'
eventCount:
$ref: '#/components/schemas/EventCountLimit'
+ aiApiQuota:
+ $ref: '#/components/schemas/AIAPIQuotaLimit'
required:
- type
title: Throttle Limit
@@ -8200,6 +8203,11 @@ components:
- $ref: '#/components/schemas/ThrottleLimitBase'
- $ref: '#/components/schemas/RequestCountLimit_allOf'
title: Request Count Limit object
+ AIAPIQuotaLimit:
+ allOf:
+ - $ref: '#/components/schemas/ThrottleLimitBase'
+ - $ref: '#/components/schemas/AIAPIQuotaLimit_allOf'
+ title: AI API Quota Limit object
EventCountLimit:
allOf:
- $ref: '#/components/schemas/ThrottleLimitBase'
@@ -10025,6 +10033,30 @@ components:
type: integer
required:
- requestCount
+ AIAPIQuotaLimit_allOf:
+ properties:
+ requestCount:
+ description: Maximum number of requests allowed
+ example: 30
+ format: int64
+ type: integer
+ totalTokenCount:
+ description: Maximum number of total tokens allowed
+ example: 1000
+ format: int64
+ type: integer
+ requestTokenCount:
+ description: Maximum number of request tokens allowed
+ example: 300
+ format: int64
+ type: integer
+ responseTokenCount:
+ description: Maximum number of response tokens allowed
+ example: 300
+ format: int64
+ type: integer
+ required:
+ - requestCount
EventCountLimit_allOf:
properties:
eventCount:
diff --git a/modules/integration/tests-common/clients/admin/src/gen/java/org/wso2/am/integration/clients/admin/api/dto/AIAPIQuotaLimitAllOfDTO.java b/modules/integration/tests-common/clients/admin/src/gen/java/org/wso2/am/integration/clients/admin/api/dto/AIAPIQuotaLimitAllOfDTO.java
new file mode 100644
index 0000000000..61e4581666
--- /dev/null
+++ b/modules/integration/tests-common/clients/admin/src/gen/java/org/wso2/am/integration/clients/admin/api/dto/AIAPIQuotaLimitAllOfDTO.java
@@ -0,0 +1,185 @@
+/*
+ * WSO2 API Manager - Admin
+ * This document specifies a **RESTful API** for WSO2 **API Manager** - **Admin Portal**. Please see [full OpenAPI Specification](https://raw.githubusercontent.com/wso2/carbon-apimgt/v6.7.206/components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/main/resources/admin-api.yaml) of the API which is written using [OAS 3.0](http://swagger.io/) specification. # Authentication Our REST APIs are protected using OAuth2 and access control is achieved through scopes. Before you start invoking the the API you need to obtain an access token with the required scopes. This guide will walk you through the steps that you will need to follow to obtain an access token. First you need to obtain the consumer key/secret key pair by calling the dynamic client registration (DCR) endpoint. You can add your preferred grant types in the payload. A sample payload is shown below. ``` { \"callbackUrl\":\"www.google.lk\", \"clientName\":\"rest_api_admin\", \"owner\":\"admin\", \"grantType\":\"client_credentials password refresh_token\", \"saasApp\":true } ``` Create a file (payload.json) with the above sample payload, and use the cURL shown bellow to invoke the DCR endpoint. Authorization header of this should contain the base64 encoded admin username and password. **Format of the request** ``` curl -X POST -H \"Authorization: Basic Base64(admin_username:admin_password)\" -H \"Content-Type: application/json\" \\ -d @payload.json https://:/client-registration/v0.17/register ``` **Sample request** ``` curl -X POST -H \"Authorization: Basic YWRtaW46YWRtaW4=\" -H \"Content-Type: application/json\" \\ -d @payload.json https://localhost:9443/client-registration/v0.17/register ``` Following is a sample response after invoking the above curl. ``` { \"clientId\": \"fOCi4vNJ59PpHucC2CAYfYuADdMa\", \"clientName\": \"rest_api_admin\", \"callBackURL\": \"www.google.lk\", \"clientSecret\": \"a4FwHlq0iCIKVs2MPIIDnepZnYMa\", \"isSaasApplication\": true, \"appOwner\": \"admin\", \"jsonString\": \"{\\\"grant_types\\\":\\\"client_credentials password refresh_token\\\",\\\"redirect_uris\\\":\\\"www.google.lk\\\",\\\"client_name\\\":\\\"rest_api_admin\\\"}\", \"jsonAppAttribute\": \"{}\", \"tokenType\": null } ``` Next you must use the above client id and secret to obtain the access token. We will be using the password grant type for this, you can use any grant type you desire. You also need to add the proper **scope** when getting the access token. All possible scopes for Admin REST API can be viewed in **OAuth2 Security** section of this document and scope for each resource is given in **authorizations** section of resource documentation. Following is the format of the request if you are using the password grant type. ``` curl -k -d \"grant_type=password&username=&password=&scope=\" \\ -H \"Authorization: Basic base64(cliet_id:client_secret)\" \\ https://:/token ``` **Sample request** ``` curl https://localhost:8243/token -k \\ -H \"Authorization: Basic Zk9DaTR2Tko1OVBwSHVjQzJDQVlmWXVBRGRNYTphNEZ3SGxxMGlDSUtWczJNUElJRG5lcFpuWU1h\" \\ -d \"grant_type=password&username=admin&password=admin&scope=apim:admin apim:tier_view\" ``` Shown below is a sample response to the above request. ``` { \"access_token\": \"e79bda48-3406-3178-acce-f6e4dbdcbb12\", \"refresh_token\": \"a757795d-e69f-38b8-bd85-9aded677a97c\", \"scope\": \"apim:admin apim:tier_view\", \"token_type\": \"Bearer\", \"expires_in\": 3600 } ``` Now you have a valid access token, which you can use to invoke an API. Navigate through the API descriptions to find the required API, obtain an access token as described above and invoke the API with the authentication header. If you use a different authentication mechanism, this process may change. # Try out in Postman If you want to try-out the embedded postman collection with \"Run in Postman\" option, please follow the guidelines listed below. * All of the OAuth2 secured endpoints have been configured with an Authorization Bearer header with a parameterized access token. Before invoking any REST API resource make sure you run the `Register DCR Application` and `Generate Access Token` requests to fetch an access token with all required scopes. * Make sure you have an API Manager instance up and running. * Update the `basepath` parameter to match the hostname and port of the APIM instance. [![Run in Postman](https://run.pstmn.io/button.svg)](https://app.getpostman.com/run-collection/f5ac2ca9fb22afef6ed6)
+ *
+ * The version of the OpenAPI document: v4
+ * Contact: architecture@wso2.com
+ *
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+ */
+
+
+package org.wso2.am.integration.clients.admin.api.dto;
+
+import java.util.Objects;
+import java.util.Arrays;
+import com.google.gson.TypeAdapter;
+import com.google.gson.annotations.JsonAdapter;
+import com.google.gson.annotations.SerializedName;
+import com.google.gson.stream.JsonReader;
+import com.google.gson.stream.JsonWriter;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import java.io.IOException;
+import com.fasterxml.jackson.annotation.JsonCreator;
+/**
+* AIAPIQuotaLimitAllOfDTO
+*/
+
+public class AIAPIQuotaLimitAllOfDTO {
+ public static final String SERIALIZED_NAME_REQUEST_COUNT = "requestCount";
+ @SerializedName(SERIALIZED_NAME_REQUEST_COUNT)
+ private Long requestCount;
+
+ public static final String SERIALIZED_NAME_TOTAL_TOKEN_COUNT = "totalTokenCount";
+ @SerializedName(SERIALIZED_NAME_TOTAL_TOKEN_COUNT)
+ private Long totalTokenCount;
+
+ public static final String SERIALIZED_NAME_REQUEST_TOKEN_COUNT = "requestTokenCount";
+ @SerializedName(SERIALIZED_NAME_REQUEST_TOKEN_COUNT)
+ private Long requestTokenCount;
+
+ public static final String SERIALIZED_NAME_RESPONSE_TOKEN_COUNT = "responseTokenCount";
+ @SerializedName(SERIALIZED_NAME_RESPONSE_TOKEN_COUNT)
+ private Long responseTokenCount;
+
+
+ public AIAPIQuotaLimitAllOfDTO requestCount(Long requestCount) {
+
+ this.requestCount = requestCount;
+ return this;
+ }
+
+ /**
+ * Maximum number of requests allowed
+ * @return requestCount
+ **/
+ @ApiModelProperty(example = "30", required = true, value = "Maximum number of requests allowed")
+
+ public Long getRequestCount() {
+ return requestCount;
+ }
+
+
+ public void setRequestCount(Long requestCount) {
+ this.requestCount = requestCount;
+ }
+
+
+ public AIAPIQuotaLimitAllOfDTO totalTokenCount(Long totalTokenCount) {
+
+ this.totalTokenCount = totalTokenCount;
+ return this;
+ }
+
+ /**
+ * Maximum number of total tokens allowed
+ * @return totalTokenCount
+ **/
+ @javax.annotation.Nullable
+ @ApiModelProperty(example = "1000", value = "Maximum number of total tokens allowed")
+
+ public Long getTotalTokenCount() {
+ return totalTokenCount;
+ }
+
+
+ public void setTotalTokenCount(Long totalTokenCount) {
+ this.totalTokenCount = totalTokenCount;
+ }
+
+
+ public AIAPIQuotaLimitAllOfDTO requestTokenCount(Long requestTokenCount) {
+
+ this.requestTokenCount = requestTokenCount;
+ return this;
+ }
+
+ /**
+ * Maximum number of request tokens allowed
+ * @return requestTokenCount
+ **/
+ @javax.annotation.Nullable
+ @ApiModelProperty(example = "300", value = "Maximum number of request tokens allowed")
+
+ public Long getRequestTokenCount() {
+ return requestTokenCount;
+ }
+
+
+ public void setRequestTokenCount(Long requestTokenCount) {
+ this.requestTokenCount = requestTokenCount;
+ }
+
+
+ public AIAPIQuotaLimitAllOfDTO responseTokenCount(Long responseTokenCount) {
+
+ this.responseTokenCount = responseTokenCount;
+ return this;
+ }
+
+ /**
+ * Maximum number of response tokens allowed
+ * @return responseTokenCount
+ **/
+ @javax.annotation.Nullable
+ @ApiModelProperty(example = "300", value = "Maximum number of response tokens allowed")
+
+ public Long getResponseTokenCount() {
+ return responseTokenCount;
+ }
+
+
+ public void setResponseTokenCount(Long responseTokenCount) {
+ this.responseTokenCount = responseTokenCount;
+ }
+
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ AIAPIQuotaLimitAllOfDTO aiAPIQuotaLimitAllOf = (AIAPIQuotaLimitAllOfDTO) o;
+ return Objects.equals(this.requestCount, aiAPIQuotaLimitAllOf.requestCount) &&
+ Objects.equals(this.totalTokenCount, aiAPIQuotaLimitAllOf.totalTokenCount) &&
+ Objects.equals(this.requestTokenCount, aiAPIQuotaLimitAllOf.requestTokenCount) &&
+ Objects.equals(this.responseTokenCount, aiAPIQuotaLimitAllOf.responseTokenCount);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(requestCount, totalTokenCount, requestTokenCount, responseTokenCount);
+ }
+
+
+@Override
+public String toString() {
+StringBuilder sb = new StringBuilder();
+sb.append("class AIAPIQuotaLimitAllOfDTO {\n");
+ sb.append(" requestCount: ").append(toIndentedString(requestCount)).append("\n");
+ sb.append(" totalTokenCount: ").append(toIndentedString(totalTokenCount)).append("\n");
+ sb.append(" requestTokenCount: ").append(toIndentedString(requestTokenCount)).append("\n");
+ sb.append(" responseTokenCount: ").append(toIndentedString(responseTokenCount)).append("\n");
+sb.append("}");
+return sb.toString();
+}
+
+/**
+* Convert the given object to string with each line indented by 4 spaces
+* (except the first line).
+*/
+private String toIndentedString(Object o) {
+if (o == null) {
+return "null";
+}
+return o.toString().replace("\n", "\n ");
+}
+
+}
+
diff --git a/modules/integration/tests-common/clients/admin/src/gen/java/org/wso2/am/integration/clients/admin/api/dto/AIAPIQuotaLimitDTO.java b/modules/integration/tests-common/clients/admin/src/gen/java/org/wso2/am/integration/clients/admin/api/dto/AIAPIQuotaLimitDTO.java
new file mode 100644
index 0000000000..8a3aa3fb13
--- /dev/null
+++ b/modules/integration/tests-common/clients/admin/src/gen/java/org/wso2/am/integration/clients/admin/api/dto/AIAPIQuotaLimitDTO.java
@@ -0,0 +1,243 @@
+/*
+ * WSO2 API Manager - Admin
+ * This document specifies a **RESTful API** for WSO2 **API Manager** - **Admin Portal**. Please see [full OpenAPI Specification](https://raw.githubusercontent.com/wso2/carbon-apimgt/v6.7.206/components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/main/resources/admin-api.yaml) of the API which is written using [OAS 3.0](http://swagger.io/) specification. # Authentication Our REST APIs are protected using OAuth2 and access control is achieved through scopes. Before you start invoking the the API you need to obtain an access token with the required scopes. This guide will walk you through the steps that you will need to follow to obtain an access token. First you need to obtain the consumer key/secret key pair by calling the dynamic client registration (DCR) endpoint. You can add your preferred grant types in the payload. A sample payload is shown below. ``` { \"callbackUrl\":\"www.google.lk\", \"clientName\":\"rest_api_admin\", \"owner\":\"admin\", \"grantType\":\"client_credentials password refresh_token\", \"saasApp\":true } ``` Create a file (payload.json) with the above sample payload, and use the cURL shown bellow to invoke the DCR endpoint. Authorization header of this should contain the base64 encoded admin username and password. **Format of the request** ``` curl -X POST -H \"Authorization: Basic Base64(admin_username:admin_password)\" -H \"Content-Type: application/json\" \\ -d @payload.json https://:/client-registration/v0.17/register ``` **Sample request** ``` curl -X POST -H \"Authorization: Basic YWRtaW46YWRtaW4=\" -H \"Content-Type: application/json\" \\ -d @payload.json https://localhost:9443/client-registration/v0.17/register ``` Following is a sample response after invoking the above curl. ``` { \"clientId\": \"fOCi4vNJ59PpHucC2CAYfYuADdMa\", \"clientName\": \"rest_api_admin\", \"callBackURL\": \"www.google.lk\", \"clientSecret\": \"a4FwHlq0iCIKVs2MPIIDnepZnYMa\", \"isSaasApplication\": true, \"appOwner\": \"admin\", \"jsonString\": \"{\\\"grant_types\\\":\\\"client_credentials password refresh_token\\\",\\\"redirect_uris\\\":\\\"www.google.lk\\\",\\\"client_name\\\":\\\"rest_api_admin\\\"}\", \"jsonAppAttribute\": \"{}\", \"tokenType\": null } ``` Next you must use the above client id and secret to obtain the access token. We will be using the password grant type for this, you can use any grant type you desire. You also need to add the proper **scope** when getting the access token. All possible scopes for Admin REST API can be viewed in **OAuth2 Security** section of this document and scope for each resource is given in **authorizations** section of resource documentation. Following is the format of the request if you are using the password grant type. ``` curl -k -d \"grant_type=password&username=&password=&scope=\" \\ -H \"Authorization: Basic base64(cliet_id:client_secret)\" \\ https://:/token ``` **Sample request** ``` curl https://localhost:8243/token -k \\ -H \"Authorization: Basic Zk9DaTR2Tko1OVBwSHVjQzJDQVlmWXVBRGRNYTphNEZ3SGxxMGlDSUtWczJNUElJRG5lcFpuWU1h\" \\ -d \"grant_type=password&username=admin&password=admin&scope=apim:admin apim:tier_view\" ``` Shown below is a sample response to the above request. ``` { \"access_token\": \"e79bda48-3406-3178-acce-f6e4dbdcbb12\", \"refresh_token\": \"a757795d-e69f-38b8-bd85-9aded677a97c\", \"scope\": \"apim:admin apim:tier_view\", \"token_type\": \"Bearer\", \"expires_in\": 3600 } ``` Now you have a valid access token, which you can use to invoke an API. Navigate through the API descriptions to find the required API, obtain an access token as described above and invoke the API with the authentication header. If you use a different authentication mechanism, this process may change. # Try out in Postman If you want to try-out the embedded postman collection with \"Run in Postman\" option, please follow the guidelines listed below. * All of the OAuth2 secured endpoints have been configured with an Authorization Bearer header with a parameterized access token. Before invoking any REST API resource make sure you run the `Register DCR Application` and `Generate Access Token` requests to fetch an access token with all required scopes. * Make sure you have an API Manager instance up and running. * Update the `basepath` parameter to match the hostname and port of the APIM instance. [![Run in Postman](https://run.pstmn.io/button.svg)](https://app.getpostman.com/run-collection/f5ac2ca9fb22afef6ed6)
+ *
+ * The version of the OpenAPI document: v4
+ * Contact: architecture@wso2.com
+ *
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+ */
+
+
+package org.wso2.am.integration.clients.admin.api.dto;
+
+import java.util.Objects;
+import java.util.Arrays;
+import com.google.gson.TypeAdapter;
+import com.google.gson.annotations.JsonAdapter;
+import com.google.gson.annotations.SerializedName;
+import com.google.gson.stream.JsonReader;
+import com.google.gson.stream.JsonWriter;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import java.io.IOException;
+import org.wso2.am.integration.clients.admin.api.dto.AIAPIQuotaLimitAllOfDTO;
+import org.wso2.am.integration.clients.admin.api.dto.ThrottleLimitBaseDTO;
+import com.fasterxml.jackson.annotation.JsonCreator;
+/**
+* AIAPIQuotaLimitDTO
+*/
+
+public class AIAPIQuotaLimitDTO {
+ public static final String SERIALIZED_NAME_TIME_UNIT = "timeUnit";
+ @SerializedName(SERIALIZED_NAME_TIME_UNIT)
+ private String timeUnit;
+
+ public static final String SERIALIZED_NAME_UNIT_TIME = "unitTime";
+ @SerializedName(SERIALIZED_NAME_UNIT_TIME)
+ private Integer unitTime;
+
+ public static final String SERIALIZED_NAME_REQUEST_COUNT = "requestCount";
+ @SerializedName(SERIALIZED_NAME_REQUEST_COUNT)
+ private Long requestCount;
+
+ public static final String SERIALIZED_NAME_TOTAL_TOKEN_COUNT = "totalTokenCount";
+ @SerializedName(SERIALIZED_NAME_TOTAL_TOKEN_COUNT)
+ private Long totalTokenCount;
+
+ public static final String SERIALIZED_NAME_REQUEST_TOKEN_COUNT = "requestTokenCount";
+ @SerializedName(SERIALIZED_NAME_REQUEST_TOKEN_COUNT)
+ private Long requestTokenCount;
+
+ public static final String SERIALIZED_NAME_RESPONSE_TOKEN_COUNT = "responseTokenCount";
+ @SerializedName(SERIALIZED_NAME_RESPONSE_TOKEN_COUNT)
+ private Long responseTokenCount;
+
+
+ public AIAPIQuotaLimitDTO timeUnit(String timeUnit) {
+
+ this.timeUnit = timeUnit;
+ return this;
+ }
+
+ /**
+ * Unit of the time. Allowed values are \"sec\", \"min\", \"hour\", \"day\"
+ * @return timeUnit
+ **/
+ @ApiModelProperty(example = "min", required = true, value = "Unit of the time. Allowed values are \"sec\", \"min\", \"hour\", \"day\"")
+
+ public String getTimeUnit() {
+ return timeUnit;
+ }
+
+
+ public void setTimeUnit(String timeUnit) {
+ this.timeUnit = timeUnit;
+ }
+
+
+ public AIAPIQuotaLimitDTO unitTime(Integer unitTime) {
+
+ this.unitTime = unitTime;
+ return this;
+ }
+
+ /**
+ * Time limit that the throttling limit applies.
+ * @return unitTime
+ **/
+ @ApiModelProperty(example = "10", required = true, value = "Time limit that the throttling limit applies.")
+
+ public Integer getUnitTime() {
+ return unitTime;
+ }
+
+
+ public void setUnitTime(Integer unitTime) {
+ this.unitTime = unitTime;
+ }
+
+
+ public AIAPIQuotaLimitDTO requestCount(Long requestCount) {
+
+ this.requestCount = requestCount;
+ return this;
+ }
+
+ /**
+ * Maximum number of requests allowed
+ * @return requestCount
+ **/
+ @ApiModelProperty(example = "30", required = true, value = "Maximum number of requests allowed")
+
+ public Long getRequestCount() {
+ return requestCount;
+ }
+
+
+ public void setRequestCount(Long requestCount) {
+ this.requestCount = requestCount;
+ }
+
+
+ public AIAPIQuotaLimitDTO totalTokenCount(Long totalTokenCount) {
+
+ this.totalTokenCount = totalTokenCount;
+ return this;
+ }
+
+ /**
+ * Maximum number of total tokens allowed
+ * @return totalTokenCount
+ **/
+ @javax.annotation.Nullable
+ @ApiModelProperty(example = "1000", value = "Maximum number of total tokens allowed")
+
+ public Long getTotalTokenCount() {
+ return totalTokenCount;
+ }
+
+
+ public void setTotalTokenCount(Long totalTokenCount) {
+ this.totalTokenCount = totalTokenCount;
+ }
+
+
+ public AIAPIQuotaLimitDTO requestTokenCount(Long requestTokenCount) {
+
+ this.requestTokenCount = requestTokenCount;
+ return this;
+ }
+
+ /**
+ * Maximum number of request tokens allowed
+ * @return requestTokenCount
+ **/
+ @javax.annotation.Nullable
+ @ApiModelProperty(example = "300", value = "Maximum number of request tokens allowed")
+
+ public Long getRequestTokenCount() {
+ return requestTokenCount;
+ }
+
+
+ public void setRequestTokenCount(Long requestTokenCount) {
+ this.requestTokenCount = requestTokenCount;
+ }
+
+
+ public AIAPIQuotaLimitDTO responseTokenCount(Long responseTokenCount) {
+
+ this.responseTokenCount = responseTokenCount;
+ return this;
+ }
+
+ /**
+ * Maximum number of response tokens allowed
+ * @return responseTokenCount
+ **/
+ @javax.annotation.Nullable
+ @ApiModelProperty(example = "300", value = "Maximum number of response tokens allowed")
+
+ public Long getResponseTokenCount() {
+ return responseTokenCount;
+ }
+
+
+ public void setResponseTokenCount(Long responseTokenCount) {
+ this.responseTokenCount = responseTokenCount;
+ }
+
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ AIAPIQuotaLimitDTO aiAPIQuotaLimit = (AIAPIQuotaLimitDTO) o;
+ return Objects.equals(this.timeUnit, aiAPIQuotaLimit.timeUnit) &&
+ Objects.equals(this.unitTime, aiAPIQuotaLimit.unitTime) &&
+ Objects.equals(this.requestCount, aiAPIQuotaLimit.requestCount) &&
+ Objects.equals(this.totalTokenCount, aiAPIQuotaLimit.totalTokenCount) &&
+ Objects.equals(this.requestTokenCount, aiAPIQuotaLimit.requestTokenCount) &&
+ Objects.equals(this.responseTokenCount, aiAPIQuotaLimit.responseTokenCount);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(timeUnit, unitTime, requestCount, totalTokenCount, requestTokenCount, responseTokenCount);
+ }
+
+
+@Override
+public String toString() {
+StringBuilder sb = new StringBuilder();
+sb.append("class AIAPIQuotaLimitDTO {\n");
+ sb.append(" timeUnit: ").append(toIndentedString(timeUnit)).append("\n");
+ sb.append(" unitTime: ").append(toIndentedString(unitTime)).append("\n");
+ sb.append(" requestCount: ").append(toIndentedString(requestCount)).append("\n");
+ sb.append(" totalTokenCount: ").append(toIndentedString(totalTokenCount)).append("\n");
+ sb.append(" requestTokenCount: ").append(toIndentedString(requestTokenCount)).append("\n");
+ sb.append(" responseTokenCount: ").append(toIndentedString(responseTokenCount)).append("\n");
+sb.append("}");
+return sb.toString();
+}
+
+/**
+* Convert the given object to string with each line indented by 4 spaces
+* (except the first line).
+*/
+private String toIndentedString(Object o) {
+if (o == null) {
+return "null";
+}
+return o.toString().replace("\n", "\n ");
+}
+
+}
+
diff --git a/modules/integration/tests-common/clients/admin/src/gen/java/org/wso2/am/integration/clients/admin/api/dto/ThrottleLimitDTO.java b/modules/integration/tests-common/clients/admin/src/gen/java/org/wso2/am/integration/clients/admin/api/dto/ThrottleLimitDTO.java
index 518b8e8085..c663b9be42 100644
--- a/modules/integration/tests-common/clients/admin/src/gen/java/org/wso2/am/integration/clients/admin/api/dto/ThrottleLimitDTO.java
+++ b/modules/integration/tests-common/clients/admin/src/gen/java/org/wso2/am/integration/clients/admin/api/dto/ThrottleLimitDTO.java
@@ -23,6 +23,7 @@
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.IOException;
+import org.wso2.am.integration.clients.admin.api.dto.AIAPIQuotaLimitDTO;
import org.wso2.am.integration.clients.admin.api.dto.BandwidthLimitDTO;
import org.wso2.am.integration.clients.admin.api.dto.EventCountLimitDTO;
import org.wso2.am.integration.clients.admin.api.dto.RequestCountLimitDTO;
@@ -41,7 +42,9 @@ public enum TypeEnum {
BANDWIDTHLIMIT("BANDWIDTHLIMIT"),
- EVENTCOUNTLIMIT("EVENTCOUNTLIMIT");
+ EVENTCOUNTLIMIT("EVENTCOUNTLIMIT"),
+
+ AIAPIQUOTALIMIT("AIAPIQUOTALIMIT");
private String value;
@@ -97,6 +100,10 @@ public TypeEnum read(final JsonReader jsonReader) throws IOException {
@SerializedName(SERIALIZED_NAME_EVENT_COUNT)
private EventCountLimitDTO eventCount = null;
+ public static final String SERIALIZED_NAME_AI_API_QUOTA = "aiApiQuota";
+ @SerializedName(SERIALIZED_NAME_AI_API_QUOTA)
+ private AIAPIQuotaLimitDTO aiApiQuota = null;
+
public ThrottleLimitDTO type(TypeEnum type) {
@@ -189,6 +196,29 @@ public void setEventCount(EventCountLimitDTO eventCount) {
}
+ public ThrottleLimitDTO aiApiQuota(AIAPIQuotaLimitDTO aiApiQuota) {
+
+ this.aiApiQuota = aiApiQuota;
+ return this;
+ }
+
+ /**
+ * Get aiApiQuota
+ * @return aiApiQuota
+ **/
+ @javax.annotation.Nullable
+ @ApiModelProperty(value = "")
+
+ public AIAPIQuotaLimitDTO getAiApiQuota() {
+ return aiApiQuota;
+ }
+
+
+ public void setAiApiQuota(AIAPIQuotaLimitDTO aiApiQuota) {
+ this.aiApiQuota = aiApiQuota;
+ }
+
+
@Override
public boolean equals(Object o) {
if (this == o) {
@@ -201,12 +231,13 @@ public boolean equals(Object o) {
return Objects.equals(this.type, throttleLimit.type) &&
Objects.equals(this.requestCount, throttleLimit.requestCount) &&
Objects.equals(this.bandwidth, throttleLimit.bandwidth) &&
- Objects.equals(this.eventCount, throttleLimit.eventCount);
+ Objects.equals(this.eventCount, throttleLimit.eventCount) &&
+ Objects.equals(this.aiApiQuota, throttleLimit.aiApiQuota);
}
@Override
public int hashCode() {
- return Objects.hash(type, requestCount, bandwidth, eventCount);
+ return Objects.hash(type, requestCount, bandwidth, eventCount, aiApiQuota);
}
@@ -218,6 +249,7 @@ public String toString() {
sb.append(" requestCount: ").append(toIndentedString(requestCount)).append("\n");
sb.append(" bandwidth: ").append(toIndentedString(bandwidth)).append("\n");
sb.append(" eventCount: ").append(toIndentedString(eventCount)).append("\n");
+ sb.append(" aiApiQuota: ").append(toIndentedString(aiApiQuota)).append("\n");
sb.append("}");
return sb.toString();
}
diff --git a/modules/integration/tests-common/clients/admin/src/main/resources/admin-api.yaml b/modules/integration/tests-common/clients/admin/src/main/resources/admin-api.yaml
index d8466dfc96..053906819e 100644
--- a/modules/integration/tests-common/clients/admin/src/main/resources/admin-api.yaml
+++ b/modules/integration/tests-common/clients/admin/src/main/resources/admin-api.yaml
@@ -4894,12 +4894,15 @@ components:
- REQUESTCOUNTLIMIT
- BANDWIDTHLIMIT
- EVENTCOUNTLIMIT
+ - AIAPIQUOTALIMIT
requestCount:
$ref: '#/components/schemas/RequestCountLimit'
bandwidth:
$ref: '#/components/schemas/BandwidthLimit'
eventCount:
$ref: '#/components/schemas/EventCountLimit'
+ aiApiQuota:
+ $ref: '#/components/schemas/AIAPIQuotaLimit'
BurstLimit:
title: Burst Limit object
type: object
@@ -4963,6 +4966,34 @@ components:
description: Maximum number of requests allowed
format: int64
example: 30
+ AIAPIQuotaLimit:
+ title: AI API Quota Limit object
+ allOf:
+ - $ref: '#/components/schemas/ThrottleLimitBase'
+ - required:
+ - requestCount
+ type: object
+ properties:
+ requestCount:
+ type: integer
+ description: Maximum number of requests allowed
+ format: int64
+ example: 30
+ totalTokenCount:
+ type: integer
+ description: Maximum number of total tokens allowed
+ format: int64
+ example: 1000
+ requestTokenCount:
+ type: integer
+ description: Maximum number of request tokens allowed
+ format: int64
+ example: 300
+ responseTokenCount:
+ type: integer
+ description: Maximum number of response tokens allowed
+ format: int64
+ example: 300
EventCountLimit:
title: Event Count Limit object
allOf:
diff --git a/modules/integration/tests-common/clients/internal-api/src/gen/java/org/wso2/am/integration/clients/internal/api/dto/AIAPIQuotaLimitDTO.java b/modules/integration/tests-common/clients/internal-api/src/gen/java/org/wso2/am/integration/clients/internal/api/dto/AIAPIQuotaLimitDTO.java
new file mode 100644
index 0000000000..1ccfbfbf87
--- /dev/null
+++ b/modules/integration/tests-common/clients/internal-api/src/gen/java/org/wso2/am/integration/clients/internal/api/dto/AIAPIQuotaLimitDTO.java
@@ -0,0 +1,210 @@
+/*
+ * Internal Utility API
+ * This API allows you to access internal data.
+ *
+ * OpenAPI spec version: 1.0.0
+ *
+ *
+ * NOTE: This class is auto generated by the swagger code generator program.
+ * https://github.com/swagger-api/swagger-codegen.git
+ * Do not edit the class manually.
+ */
+
+
+package org.wso2.am.integration.clients.internal.api.dto;
+
+import java.util.Objects;
+import java.util.Arrays;
+import com.google.gson.TypeAdapter;
+import com.google.gson.annotations.JsonAdapter;
+import com.google.gson.annotations.SerializedName;
+import com.google.gson.stream.JsonReader;
+import com.google.gson.stream.JsonWriter;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import java.io.IOException;
+import org.wso2.am.integration.clients.internal.api.dto.ThrottleLimitBaseDTO;
+
+/**
+ * AIAPIQuotaLimitDTO
+ */
+
+public class AIAPIQuotaLimitDTO {
+ @SerializedName("timeUnit")
+ private String timeUnit = null;
+
+ @SerializedName("unitTime")
+ private Integer unitTime = null;
+
+ @SerializedName("requestCount")
+ private Long requestCount = null;
+
+ @SerializedName("totalTokenCount")
+ private Long totalTokenCount = null;
+
+ @SerializedName("requestTokenCount")
+ private Long requestTokenCount = null;
+
+ @SerializedName("responseTokenCount")
+ private Long responseTokenCount = null;
+
+ public AIAPIQuotaLimitDTO timeUnit(String timeUnit) {
+ this.timeUnit = timeUnit;
+ return this;
+ }
+
+ /**
+ * Unit of the time. Allowed values are \"sec\", \"min\", \"hour\", \"day\"
+ * @return timeUnit
+ **/
+ @ApiModelProperty(example = "min", required = true, value = "Unit of the time. Allowed values are \"sec\", \"min\", \"hour\", \"day\"")
+ public String getTimeUnit() {
+ return timeUnit;
+ }
+
+ public void setTimeUnit(String timeUnit) {
+ this.timeUnit = timeUnit;
+ }
+
+ public AIAPIQuotaLimitDTO unitTime(Integer unitTime) {
+ this.unitTime = unitTime;
+ return this;
+ }
+
+ /**
+ * Time limit that the throttling limit applies.
+ * @return unitTime
+ **/
+ @ApiModelProperty(example = "10", required = true, value = "Time limit that the throttling limit applies.")
+ public Integer getUnitTime() {
+ return unitTime;
+ }
+
+ public void setUnitTime(Integer unitTime) {
+ this.unitTime = unitTime;
+ }
+
+ public AIAPIQuotaLimitDTO requestCount(Long requestCount) {
+ this.requestCount = requestCount;
+ return this;
+ }
+
+ /**
+ * Maximum number of requests allowed
+ * @return requestCount
+ **/
+ @ApiModelProperty(example = "1000", required = true, value = "Maximum number of requests allowed")
+ public Long getRequestCount() {
+ return requestCount;
+ }
+
+ public void setRequestCount(Long requestCount) {
+ this.requestCount = requestCount;
+ }
+
+ public AIAPIQuotaLimitDTO totalTokenCount(Long totalTokenCount) {
+ this.totalTokenCount = totalTokenCount;
+ return this;
+ }
+
+ /**
+ * Maximum number of total tokens allowed
+ * @return totalTokenCount
+ **/
+ @ApiModelProperty(example = "1000", value = "Maximum number of total tokens allowed")
+ public Long getTotalTokenCount() {
+ return totalTokenCount;
+ }
+
+ public void setTotalTokenCount(Long totalTokenCount) {
+ this.totalTokenCount = totalTokenCount;
+ }
+
+ public AIAPIQuotaLimitDTO requestTokenCount(Long requestTokenCount) {
+ this.requestTokenCount = requestTokenCount;
+ return this;
+ }
+
+ /**
+ * Maximum number of request tokens allowed
+ * @return requestTokenCount
+ **/
+ @ApiModelProperty(example = "300", value = "Maximum number of request tokens allowed")
+ public Long getRequestTokenCount() {
+ return requestTokenCount;
+ }
+
+ public void setRequestTokenCount(Long requestTokenCount) {
+ this.requestTokenCount = requestTokenCount;
+ }
+
+ public AIAPIQuotaLimitDTO responseTokenCount(Long responseTokenCount) {
+ this.responseTokenCount = responseTokenCount;
+ return this;
+ }
+
+ /**
+ * Maximum number of response tokens allowed
+ * @return responseTokenCount
+ **/
+ @ApiModelProperty(example = "300", value = "Maximum number of response tokens allowed")
+ public Long getResponseTokenCount() {
+ return responseTokenCount;
+ }
+
+ public void setResponseTokenCount(Long responseTokenCount) {
+ this.responseTokenCount = responseTokenCount;
+ }
+
+
+ @Override
+ public boolean equals(java.lang.Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ AIAPIQuotaLimitDTO aiAPIQuotaLimit = (AIAPIQuotaLimitDTO) o;
+ return Objects.equals(this.timeUnit, aiAPIQuotaLimit.timeUnit) &&
+ Objects.equals(this.unitTime, aiAPIQuotaLimit.unitTime) &&
+ Objects.equals(this.requestCount, aiAPIQuotaLimit.requestCount) &&
+ Objects.equals(this.totalTokenCount, aiAPIQuotaLimit.totalTokenCount) &&
+ Objects.equals(this.requestTokenCount, aiAPIQuotaLimit.requestTokenCount) &&
+ Objects.equals(this.responseTokenCount, aiAPIQuotaLimit.responseTokenCount);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(timeUnit, unitTime, requestCount, totalTokenCount, requestTokenCount, responseTokenCount);
+ }
+
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("class AIAPIQuotaLimitDTO {\n");
+
+ sb.append(" timeUnit: ").append(toIndentedString(timeUnit)).append("\n");
+ sb.append(" unitTime: ").append(toIndentedString(unitTime)).append("\n");
+ sb.append(" requestCount: ").append(toIndentedString(requestCount)).append("\n");
+ sb.append(" totalTokenCount: ").append(toIndentedString(totalTokenCount)).append("\n");
+ sb.append(" requestTokenCount: ").append(toIndentedString(requestTokenCount)).append("\n");
+ sb.append(" responseTokenCount: ").append(toIndentedString(responseTokenCount)).append("\n");
+ sb.append("}");
+ return sb.toString();
+ }
+
+ /**
+ * Convert the given object to string with each line indented by 4 spaces
+ * (except the first line).
+ */
+ private String toIndentedString(java.lang.Object o) {
+ if (o == null) {
+ return "null";
+ }
+ return o.toString().replace("\n", "\n ");
+ }
+
+}
+
diff --git a/modules/integration/tests-common/clients/internal-api/src/gen/java/org/wso2/am/integration/clients/internal/api/dto/ThrottleLimitDTO.java b/modules/integration/tests-common/clients/internal-api/src/gen/java/org/wso2/am/integration/clients/internal/api/dto/ThrottleLimitDTO.java
index bf6f596d12..55582c15bb 100644
--- a/modules/integration/tests-common/clients/internal-api/src/gen/java/org/wso2/am/integration/clients/internal/api/dto/ThrottleLimitDTO.java
+++ b/modules/integration/tests-common/clients/internal-api/src/gen/java/org/wso2/am/integration/clients/internal/api/dto/ThrottleLimitDTO.java
@@ -23,6 +23,7 @@
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.IOException;
+import org.wso2.am.integration.clients.internal.api.dto.AIAPIQuotaLimitDTO;
import org.wso2.am.integration.clients.internal.api.dto.BandwidthLimitDTO;
import org.wso2.am.integration.clients.internal.api.dto.EventCountLimitDTO;
import org.wso2.am.integration.clients.internal.api.dto.RequestCountLimitDTO;
@@ -44,6 +45,9 @@ public class ThrottleLimitDTO {
@SerializedName("eventCount")
private EventCountLimitDTO eventCount = null;
+ @SerializedName("aiApiQuota")
+ private AIAPIQuotaLimitDTO aiApiQuota = null;
+
public ThrottleLimitDTO quotaType(String quotaType) {
this.quotaType = quotaType;
return this;
@@ -116,6 +120,24 @@ public void setEventCount(EventCountLimitDTO eventCount) {
this.eventCount = eventCount;
}
+ public ThrottleLimitDTO aiApiQuota(AIAPIQuotaLimitDTO aiApiQuota) {
+ this.aiApiQuota = aiApiQuota;
+ return this;
+ }
+
+ /**
+ * Get aiApiQuota
+ * @return aiApiQuota
+ **/
+ @ApiModelProperty(value = "")
+ public AIAPIQuotaLimitDTO getAiApiQuota() {
+ return aiApiQuota;
+ }
+
+ public void setAiApiQuota(AIAPIQuotaLimitDTO aiApiQuota) {
+ this.aiApiQuota = aiApiQuota;
+ }
+
@Override
public boolean equals(java.lang.Object o) {
@@ -129,12 +151,13 @@ public boolean equals(java.lang.Object o) {
return Objects.equals(this.quotaType, throttleLimit.quotaType) &&
Objects.equals(this.requestCount, throttleLimit.requestCount) &&
Objects.equals(this.bandwidth, throttleLimit.bandwidth) &&
- Objects.equals(this.eventCount, throttleLimit.eventCount);
+ Objects.equals(this.eventCount, throttleLimit.eventCount) &&
+ Objects.equals(this.aiApiQuota, throttleLimit.aiApiQuota);
}
@Override
public int hashCode() {
- return Objects.hash(quotaType, requestCount, bandwidth, eventCount);
+ return Objects.hash(quotaType, requestCount, bandwidth, eventCount, aiApiQuota);
}
@@ -147,6 +170,7 @@ public String toString() {
sb.append(" requestCount: ").append(toIndentedString(requestCount)).append("\n");
sb.append(" bandwidth: ").append(toIndentedString(bandwidth)).append("\n");
sb.append(" eventCount: ").append(toIndentedString(eventCount)).append("\n");
+ sb.append(" aiApiQuota: ").append(toIndentedString(aiApiQuota)).append("\n");
sb.append("}");
return sb.toString();
}
diff --git a/modules/integration/tests-common/clients/internal-api/src/main/resources/api.yaml b/modules/integration/tests-common/clients/internal-api/src/main/resources/api.yaml
index 0fd3675db6..160c1bafe3 100644
--- a/modules/integration/tests-common/clients/internal-api/src/main/resources/api.yaml
+++ b/modules/integration/tests-common/clients/internal-api/src/main/resources/api.yaml
@@ -1373,6 +1373,8 @@ definitions:
$ref: '#/definitions/BandwidthLimit'
eventCount:
$ref: '#/definitions/EventCountLimit'
+ aiApiQuota:
+ $ref: '#/definitions/AIAPIQuotaLimit'
#-----------------------------------------------------
# The Throttling Bandwidth Limit resource
@@ -1428,3 +1430,33 @@ definitions:
format: int64
example: 3000
+ #-----------------------------------------------------
+ # The Throttling AI API Quota Limit resource
+ #-----------------------------------------------------
+ AIAPIQuotaLimit:
+ title: AI API Quota Limit object
+ allOf:
+ - $ref: '#/definitions/ThrottleLimitBase'
+ - required:
+ - requestCount
+ properties:
+ requestCount:
+ type: integer
+ format: int64
+ description: Maximum number of requests allowed
+ example: 1000
+ totalTokenCount:
+ type: integer
+ description: Maximum number of total tokens allowed
+ format: int64
+ example: 1000
+ requestTokenCount:
+ type: integer
+ description: Maximum number of request tokens allowed
+ format: int64
+ example: 300
+ responseTokenCount:
+ type: integer
+ description: Maximum number of response tokens allowed
+ format: int64
+ example: 300