Resource URL: /platform/<<version=1>>/job/jobs

    Overview: This resource applies the standard collection pattern to jobs.

     Methods: GET, POST

********************************************************************************

Method GET: List running and paused jobs.

       URL: GET /platform/<<version=1>>/job/jobs

Query arguments:
  sort=<string> The field that will be used for sorting.
resume=<string> Continue returning results from previous call using this token
                (token should come from the previous call, resume cannot be
                used with other options).
batch=<boolean> If true, other arguments are ignored, and the query will return
                all results, unsorted, as quickly as possible.
   state=<enum> Where <enum> is one of running, paused_user, paused_system,
                paused_policy, paused_priority.  Limit the results to jobs in
                the specified state.
limit=<integer> Return no more than this many results at once (see resume).
     dir=<enum> Where <enum> is one of ASC, DESC.  The direction of the sort.

GET response body schema:
{
  "type": "object", 
  "properties": {
    "total": {
      "type": "integer", 
      "description": "Total number of items available."
    }, 
    "jobs": {
      "items": {
        "type": "object", 
        "properties": {
          "impact": {
            "enum": [
              "Low", 
              "Medium", 
              "High", 
              "Paused"
            ], 
            "type": "string", 
            "description": "The current impact of the job.", 
            "required": true
          }, 
          "paths": {
            "items": {
              "required": true, 
              "type": "string"
            }, 
            "type": "array", 
            "description": "Paths for which the job was queued."
          }, 
          "start_time": {
            "type": "integer", 
            "description": "The time the job started, in seconds since the Epoch."
          }, 
          "description": {
            "type": "string", 
            "description": "A text representation of the job."
          }, 
          "waiting_reason": {
            "enum": [
              "blocked_by_priority"
            ], 
            "type": "string", 
            "description": "The reason the job is waiting."
          }, 
          "type": {
            "required": true, 
            "type": "string", 
            "description": "The job type."
          }, 
          "current_phase": {
            "type": "integer", 
            "description": "The current phase of the job."
          }, 
          "state": {
            "enum": [
              "running", 
              "paused_user", 
              "paused_system", 
              "paused_policy", 
              "paused_priority", 
              "cancelled_user", 
              "cancelled_system", 
              "failed", 
              "succeeded", 
              "unknown"
            ], 
            "type": "string", 
            "description": "Current state of the job.", 
            "required": true
          }, 
          "priority": {
            "required": true, 
            "minimum": 1, 
            "type": "integer", 
            "description": "Current priority of the job; lower numbers preempt higher numbers.", 
            "maximum": 10
          }, 
          "participants": {
            "items": {
              "required": true, 
              "type": "integer"
            }, 
            "type": "array", 
            "description": "The set of devids working on the job."
          }, 
          "create_time": {
            "required": true, 
            "type": "integer", 
            "description": "The time the job was queued, in seconds since the epoch."
          }, 
          "end_time": {
            "type": "integer", 
            "description": "The time the job ended, in seconds since the Epoch."
          }, 
          "waiting_on": {
            "type": "integer", 
            "description": "The ID of a job for which this job is waiting."
          }, 
          "policy": {
            "required": true, 
            "type": "string", 
            "description": "Current impact policy of the job."
          }, 
          "progress": {
            "type": "string", 
            "description": "A text representation of the job's progress."
          }, 
          "retries_remaining": {
            "required": true, 
            "type": "integer", 
            "description": "The number of retries remaining if the job fails."
          }, 
          "total_phases": {
            "required": true, 
            "type": "integer", 
            "description": "The total number of phases of the job type."
          }, 
          "control_state": {
            "enum": [
              "running", 
              "paused_user", 
              "paused_system", 
              "paused_policy", 
              "paused_priority", 
              "cancelled_user", 
              "cancelled_system", 
              "failed", 
              "succeeded", 
              "unknown"
            ], 
            "type": "string", 
            "description": "State to which the job is transitioning; if control_state is identical to state, the job's state is stable.", 
            "required": false
          }, 
          "id": {
            "minimum": 1, 
            "type": "integer", 
            "description": "The ID of the job.", 
            "required": true
          }, 
          "running_time": {
            "type": "integer", 
            "description": "The number of seconds the job has executed."
          }
        }
      }, 
      "type": "array"
    }, 
    "resume": {
      "type": [
        "string", 
        "null"
      ], 
      "description": "Continue returning results from previous call using this token (token should come from the previous call, resume cannot be used with other options)."
    }
  }
}

********************************************************************************

Method POST: Queue a new instance of a job type.

        URL: POST /platform/<<version=1>>/job/jobs

There are no query arguments for this method.

Required POST request body fields:
type

POST request body schema:
{
  "type": "object", 
  "properties": {
    "smartpoolstree_params": {
      "type": [
        {
          "type": "object", 
          "properties": {
            "policy_only": {
              "required": false, 
              "type": "boolean", 
              "description": "Apply policies but skip restriping."
            }, 
            "nop": {
              "required": false, 
              "type": "boolean", 
              "description": "Calculate what would be done (dry run)."
            }, 
            "directory_only": {
              "required": false, 
              "type": "boolean", 
              "description": "Skip processing of regular files."
            }, 
            "recurse": {
              "required": false, 
              "type": "boolean", 
              "description": "Process children, recursively."
            }
          }
        }
      ], 
      "description": "Optional parameters for the SmartPoolsTree job."
    }, 
    "paths": {
      "minItems": 1, 
      "items": {
        "required": true, 
        "type": "string"
      }, 
      "type": "array", 
      "description": "For jobs which take paths, the IFS paths to pass to the job."
    }, 
    "prepair_params": {
      "type": [
        {
          "type": "object", 
          "properties": {
            "zone": {
              "type": "string", 
              "description": "Authentication zone; not accepted with mode=clone or mode=inherit."
            }, 
            "mapping_type": {
              "enum": [
                "global", 
                "sid", 
                "unix", 
                "native"
              ], 
              "type": "string", 
              "description": "Type of permissions; not accepted with mode=clone or mode=inherit."
            }, 
            "template": {
              "type": "string", 
              "description": "IFS file or directory to use as a template; required with mode=clone and mode=inherit, not accepted with mode=convert."
            }, 
            "mode": {
              "enum": [
                "clone", 
                "inherit", 
                "convert"
              ], 
              "type": "string", 
              "description": "Type of PermissionRepair operation.", 
              "required": true
            }
          }
        }
      ], 
      "description": "Parameters required for the PermissionRepair job."
    }, 
    "type": {
      "required": true, 
      "type": "string", 
      "description": "Job type to queue."
    }, 
    "changelistcreate_params": {
      "type": [
        {
          "type": "object", 
          "properties": {
            "retain_repstate": {
              "required": false, 
              "type": "boolean", 
              "description": "Whether to retain the replication record after a changelist is created. Retaining a replication record allows a changelist to be recreated later."
            }, 
            "newer_snapid": {
              "minimum": 1, 
              "type": "integer", 
              "description": "Newer snapshot ID.", 
              "required": true
            }, 
            "older_snapid": {
              "minimum": 1, 
              "type": "integer", 
              "description": "Older snapshot ID.", 
              "required": true
            }
          }
        }
      ], 
      "description": "Parameters required for the ChangelistCreate job."
    }, 
    "priority": {
      "minimum": 1, 
      "type": "integer", 
      "description": "Priority of this job instance; lower numbers preempt higher numbers.", 
      "maximum": 10
    }, 
    "snaprevert_params": {
      "type": [
        {
          "type": "object", 
          "properties": {
            "snapid": {
              "minimum": 1, 
              "type": "integer", 
              "description": "Snapshot to revert.", 
              "required": true
            }
          }
        }
      ], 
      "description": "Parameters required for the SnapRevert job."
    }, 
    "policy": {
      "type": "string", 
      "description": "Impact policy of this job instance."
    }, 
    "allow_dup": {
      "type": "boolean", 
      "description": "Whether or not to queue the job if one of the same type is already running or queued."
    }, 
    "domainmark_params": {
      "type": [
        {
          "type": "object", 
          "properties": {
            "type": {
              "enum": [
                "SnapRevert", 
                "SyncIQ", 
                "Worm"
              ], 
              "type": "string", 
              "description": "The type of domain.", 
              "required": true
            }, 
            "root": {
              "required": true, 
              "type": "string", 
              "description": "Base IFS path to associate with the domain."
            }, 
            "delete": {
              "required": false, 
              "type": "boolean", 
              "description": "Whether this is a delete operation."
            }
          }
        }
      ], 
      "description": "Parameters required for the DomainMark job."
    }
  }
}

POST response body schema:
{
  "type": "object", 
  "properties": {
    "id": {
      "minimum": 1, 
      "type": "integer", 
      "description": "The ID of the job.", 
      "required": true
    }
  }
}
