github.com/ncodes/nomad@v0.5.7-0.20170403112158-97adf4a74fb3/website/source/docs/http/validate.html.md (about)

     1  ---
     2  layout: "http"
     3  page_title: "HTTP API: /v1/validate/"
     4  sidebar_current: "docs-http-validate"
     5  description: |-
     6    The '/1/validate/' endpoints are used to for validation of objects.
     7  ---
     8  
     9  # /v1/validate/job
    10  
    11  The `/validate/job` endpoint is to validate a Nomad job file. The local Nomad
    12  agent forwards the request to a server. In the event a server can't be
    13  reached the agent verifies the job file locally but skips validating driver
    14  configurations.
    15  
    16  ## POST
    17  
    18  <dl>
    19    <dt>Description</dt>
    20    <dd>
    21      Validates a Nomad job file
    22    </dd>
    23  
    24    <dt>Method</dt>
    25    <dd>POST</dd>
    26  
    27    <dt>URL</dt>
    28    <dd>`/v1/validate/job`</dd>
    29  
    30    <dt>Parameters</dt>
    31    <dd>
    32      None
    33    </dd>
    34    <dt>Body</dt>
    35    <dd>
    36  
    37    ```javascript
    38  {
    39      "Job": {
    40          "Region": "global",
    41          "ID": "example",
    42          "ParentID": null,
    43          "Name": "example",
    44          "Type": "service",
    45          "Priority": 50,
    46          "AllAtOnce": null,
    47          "Datacenters": [
    48              "dc1"
    49          ],
    50          "Constraints": null,
    51          "TaskGroups": [
    52              {
    53                  "Name": "cache",
    54                  "Count": 1,
    55                  "Constraints": null,
    56                  "Tasks": [
    57                      {
    58                          "Name": "mongo",
    59                          "Driver": "exec",
    60                          "User": "",
    61                          "Config": {
    62                              "args": [
    63                                  "-l",
    64                                  "127.0.0.1",
    65                                  "0"
    66                              ],
    67                              "command": "/bin/nc"
    68                          },
    69                          "Constraints": null,
    70                          "Env": null,
    71                          "Services": null,
    72                          "Resources": {
    73                              "CPU": 1,
    74                              "MemoryMB": 10,
    75                              "DiskMB": null,
    76                              "IOPS": 0,
    77                              "Networks": [
    78                                  {
    79                                      "Public": false,
    80                                      "CIDR": "",
    81                                      "ReservedPorts": null,
    82                                      "DynamicPorts": [
    83                                          {
    84                                              "Label": "db111",
    85                                              "Value": 0
    86                                          },
    87                                          {
    88                                              "Label": "http111",
    89                                              "Value": 0
    90                                          }
    91                                      ],
    92                                      "IP": "",
    93                                      "MBits": 10
    94                                  }
    95                              ]
    96                          },
    97                          "Meta": null,
    98                          "KillTimeout": null,
    99                          "LogConfig": {
   100                              "MaxFiles": 10,
   101                              "MaxFileSizeMB": 10
   102                          },
   103                          "Artifacts": null,
   104                          "Vault": null,
   105                          "Templates": null,
   106                          "DispatchPayload": null
   107                      },
   108                      {
   109                          "Name": "redis",
   110                          "Driver": "raw_exec",
   111                          "User": "",
   112                          "Config": {
   113                              "args": [
   114                                  "-l",
   115                                  "127.0.0.1",
   116                                  "0"
   117                              ],
   118                              "command": "/usr/bin/nc"
   119                          },
   120                          "Constraints": null,
   121                          "Env": null,
   122                          "Services": null,
   123                          "Resources": {
   124                              "CPU": 1,
   125                              "MemoryMB": 10,
   126                              "DiskMB": null,
   127                              "IOPS": 0,
   128                              "Networks": [
   129                                  {
   130                                      "Public": false,
   131                                      "CIDR": "",
   132                                      "ReservedPorts": null,
   133                                      "DynamicPorts": [
   134                                          {
   135                                              "Label": "db",
   136                                              "Value": 0
   137                                          },
   138                                          {
   139                                              "Label": "http",
   140                                              "Value": 0
   141                                          }
   142                                      ],
   143                                      "IP": "",
   144                                      "MBits": 10
   145                                  }
   146                              ]
   147                          },
   148                          "Meta": null,
   149                          "KillTimeout": null,
   150                          "LogConfig": {
   151                              "MaxFiles": 10,
   152                              "MaxFileSizeMB": 10
   153                          },
   154                          "Artifacts": null,
   155                          "Vault": null,
   156                          "Templates": null,
   157                          "DispatchPayload": null
   158                      }
   159                  ],
   160                  "RestartPolicy": {
   161                      "Interval": 300000000000,
   162                      "Attempts": 10,
   163                      "Delay": 25000000000,
   164                      "Mode": "delay"
   165                  },
   166                  "EphemeralDisk": {
   167                      "Sticky": null,
   168                      "Migrate": null,
   169                      "SizeMB": 300
   170                  },
   171                  "Meta": null
   172              }
   173          ],
   174          "Update": {
   175              "Stagger": 10000000000,
   176              "MaxParallel": 0
   177          },
   178          "Periodic": null,
   179          "ParameterizedJob": null,
   180          "Payload": null,
   181          "Meta": null,
   182          "VaultToken": null,
   183          "Status": null,
   184          "StatusDescription": null,
   185          "CreateIndex": null,
   186          "ModifyIndex": null,
   187          "JobModifyIndex": null
   188      }
   189  }
   190    ```
   191  
   192    </dd>
   193  
   194  
   195    <dt>Returns</dt>
   196    <dd>
   197      
   198      ```javascript
   199  {
   200    "DriverConfigValidated": true,
   201    "ValidationErrors": [
   202      "Task group cache validation failed: 1 error(s) occurred:\n\n* Task redis validation failed: 1 error(s) occurred:\n\n* 1 error(s) occurred:\n\n* minimum CPU value is 20; got 1"
   203    ],
   204    "Error": "1 error(s) occurred:\n\n* Task group cache validation failed: 1 error(s) occurred:\n\n* Task redis validation failed: 1 error(s) occurred:\n\n* 1 error(s) occurred:\n\n* minimum CPU value is 20; got 1"
   205  }
   206      ```
   207  
   208    </dd>
   209  </dl>