public class RestApiAdmin
extends org.wso2.carbon.mediation.initializer.AbstractServiceBusAdmin
| Modifier and Type | Field and Description |
|---|---|
static String |
SYNAPSE_CONFIGURATION |
| Constructor and Description |
|---|
RestApiAdmin() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
addApi(APIData apiData) |
boolean |
addApiForTenant(String apiData,
String tenantDomain)
Set the tenant domain when a publisher publishes his API in MT mode.
|
boolean |
addApiFromString(String apiData) |
void |
addSwaggerDocument(String apiName,
String swaggerJsonString,
int tenantId)
Replace the swagger document in the registry with the given swagger json string
|
void |
deleteAllApi()
Delete All API in the synapse configuration
|
boolean |
deleteApi(String apiName) |
boolean |
deleteApiForTenant(String apiName,
String tenantDomain)
Set the tenant domain when a publisher deletes his API in MT mode.
|
void |
deleteSelectedApi(String[] apiNames)
Delete Selected API
|
String |
disableStatistics(String apiName) |
String |
disableTracing(String apiName) |
String |
enableStatistics(String apiName) |
String |
enableTracing(String apiName) |
String |
generateAPIFromSwagger(String swaggerJsonString)
Function to generate API from swagger definition (from JSON representation)
|
String |
generateAPIFromSwaggerByFormat(String swaggerString,
boolean isJSON)
Function to generate API from swagger definition (from JSON representation)
|
String |
generateSwaggerFromSynapseAPI(org.apache.synapse.api.API api)
Function to generate API from swagger definition (from Synapse API)
|
String |
generateSwaggerFromSynapseAPIByFormat(org.apache.synapse.api.API api,
boolean isJSON)
Function to generate API from swagger definition (from Synapse API).
|
String |
generateUpdatedAPIFromSwagger(String swaggerJsonString,
String existingApiName)
Function to generate updated existing API by referring to swagger definition (from JSON representation)
|
String |
generateUpdatedAPIFromSwaggerByFormat(String swaggerJsonString,
boolean isJSON,
org.apache.synapse.api.API existingApi)
Function to generate updated existing API by referring to swagger definition.
|
String |
generateUpdatedAPIFromSwaggerForAPI(String swaggerJsonString,
org.apache.synapse.api.API existingApi)
Function to generate updated existing API by referring to swagger definition (from JSON representation)
|
String |
generateUpdatedSwaggerFromAPI(String existingSwagger,
boolean isJSONIn,
boolean isJSONOut,
org.apache.synapse.api.API api)
Generate updated OpenApi definition using an updated API.
|
APIData |
getApiByName(String apiName) |
org.apache.axiom.om.OMElement |
getAPIContent(String apiName,
String tenantDomain) |
int |
getAPICount() |
APIData |
getApiForTenant(String apiName,
String tenantDomain)
Set the tenant domain when a publisher tries to retrieve API his API in MT mode.
|
String[] |
getApiNames() |
APIData[] |
getAPIsForListing(int pageNumber,
int itemsPerPage) |
String |
getApiSource(APIData apiData) |
protected org.apache.axis2.engine.AxisConfiguration |
getAxisConfig()
Override the AbstarctAdmin.java's getAxisConfig() to create the CarbonContext from ThreadLoaclContext.
|
protected org.apache.axis2.context.ConfigurationContext |
getConfigContext() |
String |
getResourceSource(ResourceData resourceData) |
String[] |
getSequences() |
String |
getServerContext() |
String |
getSwaggerDocument(String apiName,
int tenantId)
Return the registry resource for the provided location
|
protected org.apache.synapse.api.API |
getSynapseAPIByName(String apiName)
Function to retrieve synapse API object for given API name
|
protected org.apache.synapse.config.SynapseConfiguration |
getSynapseConfiguration()
Override the parent's getSynapseconfig() method to retrieve the Synapse
configuration from the relevant axis configuration
|
boolean |
updateApi(String apiName,
APIData apiData) |
boolean |
updateApiForTenant(String apiName,
String apiData,
String tenantDomain)
Set the tenant domain when a publisher updates his API in MT mode.
|
boolean |
updateApiFromString(String apiName,
String apiData) |
String |
updateNameInSwagger(String newName,
String swagger)
Update the title of a given swagger document.
|
void |
updateSwaggerDocument(String apiName,
String swaggerJsonString,
int tenantId)
Create a registry resource for the swagger document and update the registry resource with the default swagger
|
getLock, getMediationPersistenceManager, getServerConfigurationInformation, getServerContextInformation, getSynapseEnvironment, getSynapseEnvironment, lockSynapseConfiguration, unlockSynapseConfigurationgetConfigSystemRegistry, getConfigUserRegistry, getGovernanceRegistry, getGovernanceSystemRegistry, getGovernanceUserRegistry, getHttpSession, getLocalRepo, getRegistry, getTenantDomain, getUsername, getUserRealm, setConfigurationContext, setPermissionUpdateTimestamppublic static final String SYNAPSE_CONFIGURATION
public boolean addApi(APIData apiData) throws APIException
APIExceptionpublic boolean addApiFromString(String apiData) throws APIException
APIExceptionpublic boolean addApiForTenant(String apiData, String tenantDomain) throws APIException
apiData - tenantDomain - APIExceptionpublic boolean updateApi(String apiName, APIData apiData) throws APIException
APIExceptionpublic boolean updateApiFromString(String apiName, String apiData) throws APIException
APIExceptionpublic boolean updateApiForTenant(String apiName, String apiData, String tenantDomain) throws APIException
apiName - apiData - APIExceptionpublic boolean deleteApi(String apiName) throws APIException
APIExceptionpublic void deleteSelectedApi(String[] apiNames) throws APIException
apiNames - APIExceptionpublic void deleteAllApi()
throws APIException
APIExceptionpublic boolean deleteApiForTenant(String apiName, String tenantDomain) throws APIException
apiName - tenantDomain - APIExceptionpublic APIData[] getAPIsForListing(int pageNumber, int itemsPerPage)
public int getAPICount()
public String getServerContext() throws APIException
APIExceptionpublic String[] getApiNames()
protected org.apache.synapse.api.API getSynapseAPIByName(String apiName)
apiName - API namepublic APIData getApiForTenant(String apiName, String tenantDomain) throws APIException
apiName - tenantDomain - APIExceptionpublic String[] getSequences()
public String enableStatistics(String apiName) throws APIException
APIExceptionpublic String disableStatistics(String apiName) throws APIException
APIExceptionpublic String enableTracing(String apiName) throws APIException
APIExceptionpublic String disableTracing(String apiName) throws APIException
APIExceptionpublic String getResourceSource(ResourceData resourceData)
protected org.apache.synapse.config.SynapseConfiguration getSynapseConfiguration()
getSynapseConfiguration in class org.wso2.carbon.mediation.initializer.AbstractServiceBusAdminprotected org.apache.axis2.engine.AxisConfiguration getAxisConfig()
getAxisConfig in class org.wso2.carbon.core.AbstractAdminprotected org.apache.axis2.context.ConfigurationContext getConfigContext()
getConfigContext in class org.wso2.carbon.core.AbstractAdminpublic void addSwaggerDocument(String apiName, String swaggerJsonString, int tenantId) throws APIException
apiName - swaggerJsonString - tenantId - APIExceptionpublic void updateSwaggerDocument(String apiName, String swaggerJsonString, int tenantId) throws APIException
apiName - Name of the APIswaggerJsonString - tenantId - APIExceptionpublic String getSwaggerDocument(String apiName, int tenantId) throws APIException
apiName - tenantId - APIExceptionpublic String generateSwaggerFromSynapseAPIByFormat(org.apache.synapse.api.API api, boolean isJSON) throws APIException
api - api existing synapse APIisJSON - generate Swagger in YAML / JSON format.APIException - error occurred while retrieving host details.public String generateSwaggerFromSynapseAPI(org.apache.synapse.api.API api) throws APIException
api - existing synapse APIAPIExceptionpublic String generateAPIFromSwagger(String swaggerJsonString) throws APIException
swaggerJsonString - swagger definitionAPIException - error occurred while retrieving host details.public String generateAPIFromSwaggerByFormat(String swaggerString, boolean isJSON) throws APIException
swaggerString - swagger definitionisJSON - input in YAML / JSON format.APIException - error occurred while retrieving host details.public String generateUpdatedAPIFromSwagger(String swaggerJsonString, String existingApiName) throws APIException
swaggerJsonString - swagger definitionexistingApiName - name of the existing APIAPIExceptionpublic String generateUpdatedAPIFromSwaggerByFormat(String swaggerJsonString, boolean isJSON, org.apache.synapse.api.API existingApi) throws APIException
swaggerJsonString - swagger definition.isJSON - input in YAML / JSON format.existingApi - existing synapse API.APIException - error occurred while retrieving host details.public String generateUpdatedAPIFromSwaggerForAPI(String swaggerJsonString, org.apache.synapse.api.API existingApi) throws APIException
swaggerJsonString - swagger definitionexistingApi - existing synapse APIAPIExceptionpublic String generateUpdatedSwaggerFromAPI(String existingSwagger, boolean isJSONIn, boolean isJSONOut, org.apache.synapse.api.API api) throws org.wso2.carbon.mediation.commons.rest.api.swagger.APIGenException
existingSwagger - existing OpenApi definition of the API.isJSONIn - input data-type JSON / YAML.isJSONOut - output required in JSON / YAML.api - updated synapse API.org.wso2.carbon.mediation.commons.rest.api.swagger.APIGenException - Error occurred while generating the updated definition.public String updateNameInSwagger(String newName, String swagger) throws APIException
newName - new title which should be added.swagger - swagger document.APIException - Error occurred while updating the title of the swagger.Copyright © 2021 WSO2. All rights reserved.