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;
}
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;
}
Aggregations