package com.vip.saturn.job.console.service;

import com.vip.saturn.job.console.domain.JobConfig;
import com.vip.saturn.job.console.domain.RestApiJobInfo;
import com.vip.saturn.job.console.exception.SaturnJobConsoleException;

import java.util.List;

/**
 * @author hebelala
 */
public interface RestApiService {

    /**
     * Create a new job.
     *
     * @param jobConfig construct from the request.
     *
     * @throws SaturnJobConsoleException once the exception is thrown, which means the creation is not successfully. the caller should handle the exception by itself.
     */
    void createJob(String namespace, JobConfig jobConfig) throws SaturnJobConsoleException;

    /**
     * Get the jobs info under the namespace
     */
    List<RestApiJobInfo> getRestApiJobInfos(String namespace) throws SaturnJobConsoleException;

    /**
     * Enable the job if the job is disable.
     *
     * Nothing will return once the the job is enable successfully;
     *
     * @throws SaturnJobConsoleException for below scenarios:
     * <li> The job was already enabled (statusCode = 201) </li>
     * <li> The update interval time cannot less than 3 seconds (statusCode = 403)</li>
     * <li> Enable the job after creation within 10 seconds (statusCode = 403)</li>
     * <li> Other exceptions (statusCode = 500) </li>
     *
     */
    void enableJob(String namespace, String jobName) throws SaturnJobConsoleException;

    /**
     * Disable the job if the job is enable.<br>
     *
     * Nothing will return when disable successfully;
     *
     * @throws SaturnJobConsoleException for below scenarios:
     * <li> The job was already disabled (statusCode = 201) </li>
     * <li> The update interval time cannot less than 3 seconds (statusCode = 403)</li>
     * <li> Other exceptions (statusCode = 500) </li>
     *
     */
    void disableJob(String namespace, String jobName) throws SaturnJobConsoleException;

}

@@ -468,133 +468,163 @@
 ion 
-once the exception is thrown, which means the creation is not successfully. the caller should handle the exception by itself.
+for below scenarios:%0D%0A     * - namespace or jobName is not found (statusCode = 404)%0D%0A     * - Job with the same name is already created. (statusCode = 400)
 %0D%0A  
@@ -1090,36 +1090,33 @@
 narios:%0D%0A     * 
-%3Cli%3E
+-
  The job was alr
@@ -1139,37 +1139,32 @@
 atusCode = 201) 
-%3C/li%3E
 %0D%0A     * %3Cli%3E Th
@@ -1148,36 +1148,33 @@
 = 201) %0D%0A     * 
-%3Cli%3E
+-
  The update inte
@@ -1220,37 +1220,32 @@
 tatusCode = 403)
-%3C/li%3E
 %0D%0A     * %3Cli%3E En
@@ -1237,20 +1237,17 @@
 %0A     * 
-%3Cli%3E
+-
  Enable 
@@ -1297,37 +1297,32 @@
 tatusCode = 403)
-%3C/li%3E
 %0D%0A     * %3Cli%3E Ot
@@ -1306,36 +1306,33 @@
  = 403)%0D%0A     * 
-%3Cli%3E
+-
  Other exception
@@ -1344,37 +1344,32 @@
 atusCode = 500) 
-%3C/li%3E
 %0D%0A     *%0D%0A     *
@@ -1657,28 +1657,25 @@
 os:%0D%0A     * 
-%3Cli%3E
+-
  The job was
@@ -1711,21 +1711,16 @@
  = 201) 
-%3C/li%3E
 %0D%0A     *
@@ -1720,20 +1720,17 @@
 %0A     * 
-%3Cli%3E
+-
  The upd
@@ -1792,21 +1792,16 @@
 e = 403)
-%3C/li%3E
 %0D%0A     *
@@ -1805,12 +1805,9 @@
   * 
-%3Cli%3E
+-
  Oth
@@ -1843,13 +1843,8 @@
 00) 
-%3C/li%3E
 %0D%0A  

update javadoc