@Path("/{containerName}/create/pool") @POST @Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) @StatusCodes({ @ResponseCode(code = 201, condition = "Pool created successfully"), @ResponseCode(code = 404, condition = "The containerName not found"), @ResponseCode(code = 503, condition = "Load balancer service is unavailable"), @ResponseCode(code = 409, condition = "Pool already exist"), @ResponseCode(code = 415, condition = "Invalid input data") }) public Response addPool( @PathParam("containerName") String containerName, @TypeHint(Pool.class) Pool inPool) { Pool poolInput = inPool; String name = poolInput.getName(); String lbMethod = poolInput.getLbMethod(); if (name.isEmpty() || lbMethod.isEmpty()) { throw new UnsupportedMediaTypeException(RestMessages.INVALIDDATA.toString()); } IConfigManager configManager = getConfigManagerService(containerName); if (configManager == null) { throw new ServiceUnavailableException( "Load Balancer " + RestMessages.SERVICEUNAVAILABLE.toString()); } if (!configManager.poolExists(name)) { Pool pool = configManager.createPool(name, lbMethod); if (pool != null) { return Response.status(Response.Status.CREATED).build(); } } else { throw new ResourceConflictException(NBConst.RES_POOL_ALREADY_EXIST); } throw new InternalServerErrorException(NBConst.RES_POOL_CREATION_FAILED); }