Search in sources :

Example 1 with APILoggingImpl

use of org.wso2.carbon.apimgt.devops.impl.logging.APILoggingImpl in project carbon-apimgt by wso2.

the class TenantLogsApiServiceImpl method tenantLogsTenantIdApisApiIdGet.

public Response tenantLogsTenantIdApisApiIdGet(String tenantId, String apiId, MessageContext messageContext) throws APIManagementException {
    APILoggingImpl apiLoggingImpl = new APILoggingImpl();
    List<APILogInfoDTO> apiLogInfoDTOList = apiLoggingImpl.getAPILoggerListByApiId(tenantId, apiId);
    LoggingApiOutputListDTO loggingApiOutputListDT = DevopsAPIUtils.getLoggingAPIList(apiLogInfoDTOList);
    return Response.ok().entity(loggingApiOutputListDT).build();
}
Also used : APILogInfoDTO(org.wso2.carbon.apimgt.impl.dto.APILogInfoDTO) LoggingApiOutputListDTO(org.wso2.carbon.apimgt.rest.api.devops.dto.LoggingApiOutputListDTO) APILoggingImpl(org.wso2.carbon.apimgt.devops.impl.logging.APILoggingImpl)

Example 2 with APILoggingImpl

use of org.wso2.carbon.apimgt.devops.impl.logging.APILoggingImpl in project carbon-apimgt by wso2.

the class TenantLogsApiServiceImpl method tenantLogsTenantIdApisGet.

public Response tenantLogsTenantIdApisGet(String tenantId, String logLevel, MessageContext messageContext) throws APIManagementException {
    APILoggingImpl apiLoggingImpl = new APILoggingImpl();
    List<APILogInfoDTO> apiLogInfoDTOList = apiLoggingImpl.getAPILoggerList(tenantId, logLevel);
    LoggingApiOutputListDTO loggingApiOutputListDTO = DevopsAPIUtils.getLoggingAPIList(apiLogInfoDTOList);
    return Response.ok().entity(loggingApiOutputListDTO).build();
}
Also used : APILogInfoDTO(org.wso2.carbon.apimgt.impl.dto.APILogInfoDTO) LoggingApiOutputListDTO(org.wso2.carbon.apimgt.rest.api.devops.dto.LoggingApiOutputListDTO) APILoggingImpl(org.wso2.carbon.apimgt.devops.impl.logging.APILoggingImpl)

Example 3 with APILoggingImpl

use of org.wso2.carbon.apimgt.devops.impl.logging.APILoggingImpl in project carbon-apimgt by wso2.

the class TenantLogsApiServiceImpl method tenantLogsTenantIdApisApiIdPut.

public Response tenantLogsTenantIdApisApiIdPut(String tenantId, String apiId, LoggingApiInputDTO loggingApiInputDTO, MessageContext messageContext) throws APIManagementException {
    if (apiId != null) {
        if (DevopsAPIUtils.validateLogLevel(loggingApiInputDTO.getLogLevel())) {
            APILoggingImpl apiLoggingImpl = new APILoggingImpl();
            apiLoggingImpl.addUpdateAPILogger(tenantId, apiId, loggingApiInputDTO.getLogLevel().toUpperCase());
            return Response.ok().entity(loggingApiInputDTO).build();
        } else {
            throw new APIManagementException("The input log level is incorrect: Input log level : " + loggingApiInputDTO.getLogLevel(), ExceptionCodes.from(ExceptionCodes.LOGGING_API_INCORRECT_LOG_LEVEL));
        }
    } else {
        throw new APIManagementException("API ID is missing", ExceptionCodes.from(ExceptionCodes.LOGGING_API_MISSING_DATA));
    }
}
Also used : APIManagementException(org.wso2.carbon.apimgt.api.APIManagementException) APILoggingImpl(org.wso2.carbon.apimgt.devops.impl.logging.APILoggingImpl)

Aggregations

APILoggingImpl (org.wso2.carbon.apimgt.devops.impl.logging.APILoggingImpl)3 APILogInfoDTO (org.wso2.carbon.apimgt.impl.dto.APILogInfoDTO)2 LoggingApiOutputListDTO (org.wso2.carbon.apimgt.rest.api.devops.dto.LoggingApiOutputListDTO)2 APIManagementException (org.wso2.carbon.apimgt.api.APIManagementException)1