Search in sources :

Example 1 with DeployResponseDTO

use of org.wso2.carbon.apimgt.rest.api.gateway.dto.DeployResponseDTO in project carbon-apimgt by wso2.

the class RedeployApiApiServiceImpl method redployAPI.

public Response redployAPI(String apiName, String version, String tenantDomain, MessageContext messageContext) {
    tenantDomain = RestApiCommonUtil.getValidateTenantDomain(tenantDomain);
    InMemoryAPIDeployer inMemoryApiDeployer = new InMemoryAPIDeployer();
    try {
        inMemoryApiDeployer.reDeployAPI(apiName, version, tenantDomain);
        if (debugEnabled) {
            log.debug("Successfully deployed " + apiName + " in gateway");
        }
        DeployResponseDTO responseDTO = new DeployResponseDTO();
        responseDTO.setDeployStatus(DeployResponseDTO.DeployStatusEnum.DEPLOYED);
        responseDTO.setJsonPayload(apiName + " redeployed from the gateway");
        return Response.ok().entity(responseDTO).build();
    } catch (ArtifactSynchronizerException e) {
        String errorMessage = "Error in fetching artifacts from storage";
        log.error(errorMessage, e);
        RestApiUtil.handleInternalServerError(errorMessage, e, log);
    }
    return null;
}
Also used : ArtifactSynchronizerException(org.wso2.carbon.apimgt.impl.gatewayartifactsynchronizer.exception.ArtifactSynchronizerException) InMemoryAPIDeployer(org.wso2.carbon.apimgt.gateway.InMemoryAPIDeployer) DeployResponseDTO(org.wso2.carbon.apimgt.rest.api.gateway.dto.DeployResponseDTO)

Example 2 with DeployResponseDTO

use of org.wso2.carbon.apimgt.rest.api.gateway.dto.DeployResponseDTO in project carbon-apimgt by wso2.

the class UndeployApiApiServiceImpl method undeployAPI.

public Response undeployAPI(String apiName, String version, String tenantDomain, MessageContext messageContext) {
    InMemoryAPIDeployer inMemoryApiDeployer = new InMemoryAPIDeployer();
    tenantDomain = RestApiCommonUtil.getValidateTenantDomain(tenantDomain);
    try {
        inMemoryApiDeployer.unDeployAPI(apiName, version, tenantDomain);
        if (debugEnabled) {
            log.debug("Successfully undeployed " + apiName + " in gateway");
        }
        DeployResponseDTO deployResponseDTO = new DeployResponseDTO();
        deployResponseDTO.setDeployStatus(DeployResponseDTO.DeployStatusEnum.UNDEPLOYED);
        deployResponseDTO.setJsonPayload(apiName + " Undeployed from the gateway");
        return Response.ok().entity(deployResponseDTO).build();
    } catch (ArtifactSynchronizerException e) {
        String errorMessage = "Error in fetching artifacts from storage";
        log.error(errorMessage, e);
        RestApiUtil.handleInternalServerError(errorMessage, e, log);
    }
    return null;
}
Also used : ArtifactSynchronizerException(org.wso2.carbon.apimgt.impl.gatewayartifactsynchronizer.exception.ArtifactSynchronizerException) InMemoryAPIDeployer(org.wso2.carbon.apimgt.gateway.InMemoryAPIDeployer) DeployResponseDTO(org.wso2.carbon.apimgt.rest.api.gateway.dto.DeployResponseDTO)

Aggregations

InMemoryAPIDeployer (org.wso2.carbon.apimgt.gateway.InMemoryAPIDeployer)2 ArtifactSynchronizerException (org.wso2.carbon.apimgt.impl.gatewayartifactsynchronizer.exception.ArtifactSynchronizerException)2 DeployResponseDTO (org.wso2.carbon.apimgt.rest.api.gateway.dto.DeployResponseDTO)2