Open BLasan opened 2 months ago
Please find the below attachment related to the issue. https://docs.google.com/document/d/1DxjI4f-XIwvr414PkT0Mo7C4vuJT_BCGzCidEKwSdF0/edit
[Update 1]
As per the initial discussion, following was the proposed solution.
Custom Sequence
to upload a sequence. requestBody:
content:
multipart/form-data:
schema:
properties:
sequence:
type: string
description: The sequence that needs to be uploaded.
format: binary
type:
type: string
description: Type of the Endpoint
apiData:
type: string
description: API Data to be updated
sequences
directory of the APIM pack. This might affect the reeadabiility of the api.xml
.endpointConfig:
endpoint_type: custom_sequence
sequence: FILE_NAME
[Update 2]
As per the second suggestion, changed the velocity template logic to refer the sequence file provided. Following is the approached followed.
sequences
directory which is used to load all sequences by synapse. #if( $endpoint_config.get("endpoint_type") == 'custom_sequence' )
#set( $sequenceKey = $endpoint_config.get("sequence_key") )
<sequence key="$sequenceKey"/>
[Update 3]
Changed the REST API to support add, delete, get operations of the custom sequence as the UI requirement. Followings are the changes introduced.
requestBody:
content:
multipart/form-data:
schema:
properties:
sequence:
type: string
description: The sequence that needs to be uploaded.
format: binary
type:
type: string
description: Type of the Endpoint
AM_API_CUSTOM_BACKEND
to store sequence related data. Following is the proposed schema for the table.
CREATE TABLE IF NOT EXISTS AM_API_CUSTOM_BACKEND (
ID INTEGER NOT NULL AUTO_INCREMENT,
API_UUID VARCHAR(256) NOT NULL,
REVISION_UUID VARCHAR(256) DEFAULT NULL,
SEQUENCE MEDIUMBLOB,
NAME VARCHAR(256) NOT NULL,
TYPE VARCHAR(120) NOT NULL,
PRIMARY KEY (ID),
FOREIGN KEY (API_UUID) REFERENCES AM_API(API_UUID) ON DELETE CASCADE
)ENGINE INNODB;
AM_API_CUSTOM_BACKEND
table using API_UUID
and REVISION_ID
.[Update 4]
Changed the schema of the new table as follows.
CREATE TABLE IF NOT EXISTS AM_API_CUSTOM_BACKEND (
ID VARCHAR(60) NOT NULL,
API_UUID VARCHAR(256) NOT NULL,
REVISION_UUID VARCHAR(256) DEFAULT NULL,
SEQUENCE MEDIUMBLOB,
NAME VARCHAR(256) NOT NULL,
TYPE VARCHAR(120) NOT NULL,
PRIMARY KEY (ID),
FOREIGN KEY (API_UUID) REFERENCES AM_API(API_UUID) ON DELETE CASCADE
)ENGINE INNODB;
Name of the Custom Backend should be in the following format.
<API_UUID>-<ENDPOINT_TYPE>
Issue with the current table schema.
Solutions for the schema issue.
REVISION_UUID, ID, API_UUID
)[Update 5]
Production
and Sandbox
endpoints.
endpointConfig: {
"endpoint_type": "custom_backend",
"production": {
"sequence_id": xxxxx,
"sequence_name": xxxxxx,
"type": "PRODUCTION"
},
"sandbox": {
"sequence_id": xxxxx,
"sequence_name": xxxxxx,
"type": "SANDBOX"
}
}
2 Implemented get, delete REST APIs which fetches and deletes the Custom Backends from the API_UUID
, BACKEND_UUID
, TYPE
and REVISION_UUID
REVISION_UUID
, API_UUID
, TYPE
and ID
)[Update 6]:
Draft PR - https://github.com/wso2/carbon-apimgt/pull/12524 Updated REST API - https://github.com/wso2/carbon-apimgt/pull/12524/files#diff-d8623bfc39bc03ceb819b7dff3e7cb16254f9eb97238c795f40d3b025a4a3747R491
[Update 7]:
Tested the following flows against the new feature and working without an issue. (Tested for MySQL 8)
New REST API changes can be found via the following links
Tasks completed
Tasks remaining
All scenarios to be tested
Problem
Some API developers want to use connectors within the api manager to implement mediation logic as they do not want to use an additional MI deployment if their use cases are simple. Within the API Manager, currently, we do not have a construct that will allow us to facilitate this requirement.
Solution
Introduce a way to define a Custom Backend for an API which gets added to the api.xml file of the API.
Affected Component
APIM
Version
No response
Implementation
No response
Related Issues
No response
Suggested Labels
No response