Search in sources :

Example 6 with ApiServicesManagerException

use of com.bluenimble.platform.api.ApiServicesManagerException in project serverless by bluenimble.

the class DefaultApiServicesManager method delete.

@Override
public void delete(ApiVerb verb, String endpoint) throws ApiServicesManagerException {
    ApiServiceSet set = services.get(verb);
    if (set == null) {
        throw new ApiServicesManagerException("service [" + verb + " " + endpoint + "] not found");
    }
    ApiService service = set.get(endpoint);
    if (service == null) {
        throw new ApiServicesManagerException("service [" + verb + " " + endpoint + "] not found");
    }
    if (!ApiStatus.Failed.equals(service.status()) && !ApiStatus.Stopped.equals(service.status())) {
        throw new ApiServicesManagerException("can't delete service [" + verb + " " + endpoint + "]. Status=" + service.status());
    }
    set.remove(endpoint);
}
Also used : ApiServicesManagerException(com.bluenimble.platform.api.ApiServicesManagerException) ApiService(com.bluenimble.platform.api.ApiService) ApiServiceSet(com.bluenimble.platform.server.impls.fs.ApiServiceSet)

Aggregations

ApiServicesManagerException (com.bluenimble.platform.api.ApiServicesManagerException)6 ApiService (com.bluenimble.platform.api.ApiService)3 ApiManagementException (com.bluenimble.platform.api.ApiManagementException)2 ApiResourcesManagerException (com.bluenimble.platform.api.ApiResourcesManagerException)2 ApiServiceSet (com.bluenimble.platform.server.impls.fs.ApiServiceSet)2 ApiResourcesManager (com.bluenimble.platform.api.ApiResourcesManager)1 JsonObject (com.bluenimble.platform.json.JsonObject)1 InputStream (java.io.InputStream)1