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": [
    {
      "description": null,
      "os_family": null,
      "created_at": "2019-11-07 09:06:52 UTC",
      "updated_at": "2019-11-07 09:06:52 UTC",
      "name": "Example partition table",
      "id": 615088209
    },
    {
      "description": null,
      "os_family": "Redhat",
      "created_at": "2019-11-07 09:07:17 UTC",
      "updated_at": "2019-11-07 09:07:17 UTC",
      "name": "ptable813",
      "id": 1007981737
    }
  ]
}

参数

参数名字 描述
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
选填

排序项和顺序,例如 ‘id DESC’

Validations:

  • Must be a String

page
选填

页号,从 1 开始

Validations:

  • Must be a number.

per_page
选填

每页中显示的返回结果数

Validations:

  • Must be a number.

搜索字段

字段名 类型 可能的值
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/1007981743-ptable819
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,
  "description": null,
  "os_family": "Redhat",
  "created_at": "2019-11-07 09:07:17 UTC",
  "updated_at": "2019-11-07 09:07:17 UTC",
  "name": "ptable819",
  "id": 1007981743,
  "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
选填

Set the current location context for the request

Validations:

  • Must be a Integer

organization_id
选填

Set the current organization context for the request

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": "",
    "layout": "d-i partman-auto/disk"
  }
}
422
{
  "error": {
    "id": null,
    "errors": {
      "name": [
        "can't be blank"
      ]
    },
    "full_messages": [
      "Name can't be blank"
    ]
  }
}

参数

参数名字 描述
location_id
选填

Set the current location context for the request

Validations:

  • Must be a Integer

organization_id
选填

Set the current organization context for the request

Validations:

  • Must be a Integer

ptable
必填

Validations:

  • Must be a Hash

ptable[name]
必填

Validations:

  • Must be a String

ptable[description]
选填 , 允许空值

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
导入预配模板

示例

POST /api/ptables/import
{
  "ptable": {
    "name": "ptable824",
    "template": "b"
  }
}
201
{
  "template": "b",
  "name": "ptable824",
  "id": 1007981749,
  "snippet": false,
  "description": null,
  "template_kind_id": null,
  "created_at": "2019-11-07T09:07:18.340Z",
  "updated_at": "2019-11-07T09:07:18.356Z",
  "locked": false,
  "default": false,
  "vendor": null,
  "os_family": "Redhat"
}

参数

参数名字 描述
location_id
选填

Set the current location context for the request

Validations:

  • Must be a Integer

organization_id
选填

Set the current organization context for the request

Validations:

  • Must be a Integer

ptable
必填

Validations:

  • Must be a Hash

ptable[name]
选填

模板名称

Validations:

  • Must be a String

ptable[template]
选填

包括元数据的模板内容

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]
选填 , 允许空值

在您希望更新锁定的模板时使用

Validations:

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

options[associate]
选填 , 允许空值

确定模板何时应基于元数据关联对象,new 表示只在创建新模板时,always 表示同时适用于新模板和的只进行更新的现有模板,never 表示忽略元数据

Validations:

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

options[lock]
选填 , 允许空值

锁定导入的模板(默认为 false)

Validations:

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

options[default]
选填 , 允许空值

把模块设为默认意味着它将自动与新创建的组织和位置相关联(默认为 false)

Validations:

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


GET /api/ptables/revision

参数

参数名字 描述
location_id
选填

Set the current location context for the request

Validations:

  • Must be a Integer

organization_id
选填

Set the current organization context for the request

Validations:

  • Must be a Integer

version
选填

模板版本

Validations:

  • Must be a String


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

示例

PUT /api/ptables/1007981738
{
  "ptable": {
    "layout": "new ptable layout"
  }
}
200
{
  "layout": "new ptable layout",
  "locked": false,
  "description": null,
  "os_family": "Redhat",
  "created_at": "2019-11-07 09:07:17 UTC",
  "updated_at": "2019-11-07 09:07:17 UTC",
  "name": "ptable814",
  "id": 1007981738,
  "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
选填

Set the current location context for the request

Validations:

  • Must be a Integer

organization_id
选填

Set the current organization context for the request

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[description]
选填 , 允许空值

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/1007981740-ptable816
{
  "ptable": {}
}
422
{
  "error": {
    "id": 1007981740,
    "errors": {
      "base": [
        "ptable816 is used by host2478"
      ]
    },
    "full_messages": [
      "ptable816 is used by host2478"
    ]
  }
}

参数

参数名字 描述
location_id
选填

Set the current location context for the request

Validations:

  • Must be a Integer

organization_id
选填

Set the current organization context for the request

Validations:

  • Must be a Integer

id
必填

Validations:

  • Must be a String


POST /api/ptables/:id/clone
克隆模板

示例

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

参数

参数名字 描述
location_id
选填

Set the current location context for the request

Validations:

  • Must be a Integer

organization_id
选填

Set the current organization context for the request

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
导出分区模板到 ERB

示例

GET /api/ptables/1007981755-ptable829/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: ptable829
snippet: false
model: Ptable
os_family: Redhat
organizations:
- Organization 1
locations:
- Location 1
%>

参数

参数名字 描述
location_id
选填

Set the current location context for the request

Validations:

  • Must be a Integer

organization_id
选填

Set the current organization context for the request

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.