use of org.wso2.carbon.governance.api.endpoints.EndpointManager in project carbon-apimgt by wso2.
the class APIUtil method createEndpoint.
/**
* Create an Endpoint
*
* @param endpointUrl Endpoint url
* @param registry Registry space to save the endpoint
* @return Path of the created resource
* @throws APIManagementException If an error occurs while adding the endpoint
*/
public static String createEndpoint(String endpointUrl, Registry registry) throws APIManagementException {
try {
EndpointManager endpointManager = new EndpointManager(registry);
Endpoint endpoint = endpointManager.newEndpoint(endpointUrl);
endpointManager.addEndpoint(endpoint);
return GovernanceUtils.getArtifactPath(registry, endpoint.getId());
} catch (RegistryException e) {
String msg = "Failed to import endpoint " + endpointUrl + " to registry ";
log.error(msg, e);
throw new APIManagementException(msg, e);
}
}
Aggregations