GET /api/ptables
列出所有分割表

GET /api/operatingsystems/:operatingsystem_id/ptables
列出作業系統的所有分割表

GET /api/locations/:location_id/ptables
列出每個地點的所有分割表

GET /api/organizations/:organization_id/ptables
列出各個組織的所有分割表

示例

GET /api/ptables
200
{
  "total": 2,
  "subtotal": 2,
  "page": 1,
  "per_page": 20,
  "search": null,
  "sort": {
    "by": null,
    "order": null
  },
  "results": [
    {
      "os_family": null,
      "created_at": "2019-09-11 14:34:13 UTC",
      "updated_at": "2019-09-11 14:34:13 UTC",
      "name": "Example partition table",
      "id": 615088209
    },
    {
      "os_family": "Redhat",
      "created_at": "2019-09-11 14:34:42 UTC",
      "updated_at": "2019-09-11 14:34:42 UTC",
      "name": "ptable214",
      "id": 1007981802
    }
  ]
}

參數

參數名字 描述
operatingsystem_id
選填

作業系統 ID

Validations:

  • Must be a String

location_id
選填

位置範圍

Validations:

  • Must be a Integer

organization_id
選填

組織範圍

Validations:

  • Must be a Integer

search
選填

篩選結果

Validations:

  • Must be a String

order
選填

Sort field and order, eg. ‘id DESC’

Validations:

  • Must be a String

page
選填

頁數,從 1 開始

Validations:

  • Must be a number.

per_page
選填

每頁要傳回的結果數量

Validations:

  • Must be a number.

Search fields

Field name 類型 Possible values
default true, false
family string
layout text
location string
location_id integer
locked true, false
name string
organization string
organization_id integer
snippet true, false
template text
vendor string

GET /api/ptables/:id
顯示分割表

示例

GET /api/ptables/1007981804-ptable216
200
{
  "layout": "zerombr\\nclearpart --all    --initlabel\\npart /boot --fstype ext3 --size=<%= 10 * 10 %> --asprimary\\npart /     --f   stype ext3 --size=1024 --grow\\npart swap  --recommended",
  "locked": false,
  "os_family": "Redhat",
  "created_at": "2019-09-11 14:34:43 UTC",
  "updated_at": "2019-09-11 14:34:43 UTC",
  "name": "ptable216",
  "id": 1007981804,
  "operatingsystems": [
    {
      "id": 1073012828,
      "name": "Redhat",
      "title": "RHEL 6.1"
    }
  ],
  "locations": [
    {
      "id": 255093256,
      "name": "Location 1",
      "title": "Location 1",
      "description": null
    }
  ],
  "organizations": [
    {
      "id": 447626438,
      "name": "Organization 1",
      "title": "Organization 1",
      "description": null
    }
  ]
}

參數

參數名字 描述
location_id
選填

位置範圍

Validations:

  • Must be a Integer

organization_id
選填

組織範圍

Validations:

  • Must be a Integer

id
必填

Validations:

  • Must be an identifier, string from 1 to 128 characters containing only alphanumeric characters, space, underscore(_), hypen(-) with no leading or trailing space.


POST /api/ptables
建立分割表

示例

POST /api/ptables
{
  "ptable": {
    "name": "W",
    "layout": "d-i partman-auto/disk"
  }
}
201
{
  "layout": "d-i partman-auto/disk",
  "locked": false,
  "os_family": null,
  "created_at": "2019-09-11 14:34:42 UTC",
  "updated_at": "2019-09-11 14:34:42 UTC",
  "name": "W",
  "id": 1007981781,
  "operatingsystems": [],
  "locations": [],
  "organizations": []
}

參數

參數名字 描述
location_id
選填

位置範圍

Validations:

  • Must be a Integer

organization_id
選填

組織範圍

Validations:

  • Must be a Integer

ptable
必填

Validations:

  • Must be a Hash

ptable[name]
必填

Validations:

  • Must be a String

ptable[layout]
必填

Validations:

  • Must be a String

ptable[snippet]
選填 , 允許空值

Validations:

  • Must be one of: true, false, 1, 0.

ptable[audit_comment]
選填 , 允許空值

Validations:

  • Must be a String

ptable[locked]
選填 , 允許空值

範本是否鎖定並禁止進行編輯

Validations:

  • Must be one of: true, false, 1, 0.

ptable[os_family]
選填 , 允許空值

Validations:

  • Must be a String

ptable[operatingsystem_ids]
選填 , 允許空值

與分割表相關連的作業系統 ID 之陣列

Validations:

  • Must be an array of any type

ptable[host_ids]
選填 , 允許空值

與分割表相關的主機 ID 陣列

Validations:

  • Must be an array of any type

ptable[hostgroup_ids]
選填 , 允許空值

與分割表相關連的主機群組 ID 之陣列

Validations:

  • Must be an array of any type

ptable[location_ids]
選填 , 允許空值

將位置取代為特定 ID

Validations:

  • Must be an array of any type

ptable[organization_ids]
選填 , 允許空值

將組織取代為特定 ID。

Validations:

  • Must be an array of any type


POST /api/ptables/import
Import a provisioning template

示例

POST /api/ptables/import
{
  "ptable": {
    "name": "ptable212",
    "template": "b"
  }
}
201
{
  "template": "b",
  "name": "ptable212",
  "id": 1007981800,
  "snippet": false,
  "template_kind_id": null,
  "created_at": "2019-09-11T14:34:42.858Z",
  "updated_at": "2019-09-11T14:34:42.873Z",
  "locked": false,
  "default": false,
  "vendor": null,
  "os_family": "Redhat"
}

參數

參數名字 描述
location_id
選填

位置範圍

Validations:

  • Must be a Integer

organization_id
選填

組織範圍

Validations:

  • Must be a Integer

ptable
必填

Validations:

  • Must be a Hash

ptable[name]
選填

範本名稱

Validations:

  • Must be a String

ptable[template]
選填

template contents including metadata

Validations:

  • Must be a String

ptable[location_ids]
選填 , 允許空值

將位置取代為特定 ID

Validations:

  • Must be an array of any type

ptable[organization_ids]
選填 , 允許空值

將組織取代為特定 ID。

Validations:

  • Must be an array of any type

options
選填

Validations:

  • Must be a Hash

options[force]
選填 , 允許空值

use if you want update locked templates

Validations:

  • Must be one of: true, false, 1, 0.

options[associate]
選填 , 允許空值

determines when the template should associate objects based on metadata, new means only when new template is being created, always means both for new and existing template which is only being updated, never ignores metadata

Validations:

  • Must be one of: new, always, never.

options[lock]
選填 , 允許空值

lock imported templates (false by default)

Validations:

  • Must be one of: true, false, 1, 0.

options[default]
選填 , 允許空值

makes the template default meaning it will be automatically associated with newly created organizations and locations (false by default)

Validations:

  • Must be one of: true, false, 1, 0.


GET /api/ptables/revision

參數

參數名字 描述
location_id
選填

位置範圍

Validations:

  • Must be a Integer

organization_id
選填

組織範圍

Validations:

  • Must be a Integer

version
選填

範本版本

Validations:

  • Must be a String


PUT /api/ptables/:id
更新分割表

示例

PUT /api/ptables/1007981787-ptable201
{
  "ptable": {
    "audit_comment": "aha",
    "template": "tmp"
  }
}
200
{
  "layout": "tmp",
  "locked": false,
  "os_family": "Redhat",
  "created_at": "2019-09-11 14:34:42 UTC",
  "updated_at": "2019-09-11 14:34:42 UTC",
  "name": "ptable201",
  "id": 1007981787,
  "operatingsystems": [],
  "locations": [
    {
      "id": 255093256,
      "name": "Location 1",
      "title": "Location 1",
      "description": null
    }
  ],
  "organizations": [
    {
      "id": 447626438,
      "name": "Organization 1",
      "title": "Organization 1",
      "description": null
    }
  ]
}

參數

參數名字 描述
location_id
選填

位置範圍

Validations:

  • Must be a Integer

organization_id
選填

組織範圍

Validations:

  • Must be a Integer

id
必填

Validations:

  • Must be a String

ptable
必填

Validations:

  • Must be a Hash

ptable[name]
選填

Validations:

  • Must be a String

ptable[layout]
選填

Validations:

  • Must be a String

ptable[snippet]
選填 , 允許空值

Validations:

  • Must be one of: true, false, 1, 0.

ptable[audit_comment]
選填 , 允許空值

Validations:

  • Must be a String

ptable[locked]
選填 , 允許空值

範本是否鎖定並禁止進行編輯

Validations:

  • Must be one of: true, false, 1, 0.

ptable[os_family]
選填 , 允許空值

Validations:

  • Must be a String

ptable[operatingsystem_ids]
選填 , 允許空值

與分割表相關連的作業系統 ID 之陣列

Validations:

  • Must be an array of any type

ptable[host_ids]
選填 , 允許空值

與分割表相關的主機 ID 陣列

Validations:

  • Must be an array of any type

ptable[hostgroup_ids]
選填 , 允許空值

與分割表相關連的主機群組 ID 之陣列

Validations:

  • Must be an array of any type

ptable[location_ids]
選填 , 允許空值

將位置取代為特定 ID

Validations:

  • Must be an array of any type

ptable[organization_ids]
選填 , 允許空值

將組織取代為特定 ID。

Validations:

  • Must be an array of any type


DELETE /api/ptables/:id
刪除磁碟分割表

示例

DELETE /api/ptables/1007981794-ptable206
{
  "ptable": {}
}
422
{
  "error": {
    "id": 1007981794,
    "errors": {
      "base": [
        "ptable206 is used by host312"
      ]
    },
    "full_messages": [
      "ptable206 is used by host312"
    ]
  }
}

參數

參數名字 描述
location_id
選填

位置範圍

Validations:

  • Must be a Integer

organization_id
選填

組織範圍

Validations:

  • Must be a Integer

id
必填

Validations:

  • Must be a String


POST /api/ptables/:id/clone
複製範本

示例

POST /api/ptables/1007981806-ptable218/clone
{
  "ptable": {
    "name": ""
  }
}
422
{
  "error": {
    "id": 1007981806,
    "errors": {
      "name": [
        "can't be blank"
      ]
    },
    "full_messages": [
      "Name can't be blank"
    ]
  }
}

參數

參數名字 描述
location_id
選填

位置範圍

Validations:

  • Must be a Integer

organization_id
選填

組織範圍

Validations:

  • Must be a Integer

id
必填

Validations:

  • Must be an identifier, string from 1 to 128 characters containing only alphanumeric characters, space, underscore(_), hypen(-) with no leading or trailing space.

ptable
必填

Validations:

  • Must be a Hash

ptable[name]
必填

範本名稱

Validations:

  • Must be a String


GET /api/ptables/:id/export
Export a partition template to ERB

示例

GET /api/ptables/1007981785-ptable199/export
200
zerombr\nclearpart --all    --initlabel\npart /boot --fstype ext3 --size=<%= 10 * 10 %> --asprimary\npart /     --f   stype ext3 --size=1024 --grow\npart swap  --recommended
<%#
name: ptable199
snippet: false
model: Ptable
os_family: Redhat
organizations:
- Organization 1
locations:
- Location 1
%>

參數

參數名字 描述
location_id
選填

位置範圍

Validations:

  • Must be a Integer

organization_id
選填

組織範圍

Validations:

  • Must be a Integer

id
必填

Validations:

  • Must be an identifier, string from 1 to 128 characters containing only alphanumeric characters, space, underscore(_), hypen(-) with no leading or trailing space.