Foreman considers a domain and a DNS zone as the same thing. That is, if you are planning to manage a site where all the machines are of the form hostname.somewhere.com then the domain is somewhere.com. This allows Foreman to associate a puppet variable with a domain/site and automatically append this variable to all external node requests made by machines at that site.


GET /api/domains
域列表

GET /api/subnets/:subnet_id/domains
每个子网的域列表

GET /api/locations/:location_id/domains
每个位置的域列表

GET /api/organizations/:organization_id/domains
每个机构的域列表

示例

GET /api/locations/447626442/organizations/447626440/domains
200
{
  "total": 1,
  "subtotal": 1,
  "page": 1,
  "per_page": 20,
  "search": null,
  "sort": {
    "by": null,
    "order": null
  },
  "results": [
    {
      "fullname": "example235.com",
      "created_at": "2019-11-07 08:37:31 UTC",
      "updated_at": "2019-11-07 08:37:31 UTC",
      "id": 759776772,
      "name": "example235.com",
      "dns_id": null,
      "dns": null
    }
  ]
}

参数

参数名字 描述
subnet_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.

搜索字段

字段名 类型 可能的值
fullname string
location string
location_id integer
name string
organization string
organization_id integer
params text

GET /api/domains/:id
显示域

示例

GET /api/domains/759776768-example929-com
200
{
  "fullname": "example929.com",
  "created_at": "2019-11-07 08:53:46 UTC",
  "updated_at": "2019-11-07 08:53:46 UTC",
  "id": 759776768,
  "name": "example929.com",
  "dns_id": null,
  "dns": null,
  "subnets": [],
  "interfaces": [],
  "parameters": [
    {
      "priority": 30,
      "created_at": "2019-11-07 08:53:46 UTC",
      "updated_at": "2019-11-07 08:53:46 UTC",
      "id": 767575243,
      "name": "parameter323",
      "parameter_type": "string",
      "value": "parameter value 345"
    }
  ],
  "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
必填

数字 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.

show_hidden_parameters
选填

显示隐藏的参数值

Validations:

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


POST /api/domains
创建域

The fullname field is used for human readability in reports and other pages that refer to domains, and also available as an external node parameter

示例

POST /api/domains
{
  "organization_id": 447626448,
  "domain": {
    "name": "example243.com",
    "organization_ids": [
      447626448
    ],
    "location_ids": [
      447626450
    ]
  }
}
201
{
  "fullname": null,
  "created_at": "2019-11-07 08:37:32 UTC",
  "updated_at": "2019-11-07 08:37:32 UTC",
  "id": 759776780,
  "name": "example243.com",
  "dns_id": null,
  "dns": null,
  "subnets": [],
  "interfaces": [],
  "parameters": [],
  "locations": [
    {
      "id": 447626450,
      "name": "loc67",
      "title": "loc67",
      "description": null
    }
  ],
  "organizations": [
    {
      "id": 447626448,
      "name": "org79",
      "title": "org79",
      "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

domain
必填

Validations:

  • Must be a Hash

domain[name]
必填

完整 DNS 域名

Validations:

  • Must be a String

domain[fullname]
选填 , 允许空值

域描述

Validations:

  • Must be a String

domain[dns_id]
选填 , 允许空值

要在此域中使用的 DNS 代理 ID

Validations:

  • Must be a number.

domain[domain_parameters_attributes]
选填 , 允许空值

参数阵列(name,value)

Validations:

  • Must be an array of any type

domain[location_ids]
选填 , 允许空值

使用给定 id 替换位置

Validations:

  • Must be an array of any type

domain[organization_ids]
选填 , 允许空值

使用给定 id 替换机构

Validations:

  • Must be an array of any type


PUT /api/domains/:id
更新域

示例

PUT /api/domains/759776766
{
  "domain": {
    "domain_parameters_attributes": [
      {
        "name": "foo",
        "value": "new_value"
      }
    ]
  }
}
200
{
  "fullname": "example927.com",
  "created_at": "2019-11-07 08:53:46 UTC",
  "updated_at": "2019-11-07 08:53:46 UTC",
  "id": 759776766,
  "name": "example927.com",
  "dns_id": null,
  "dns": null,
  "subnets": [],
  "interfaces": [],
  "parameters": [
    {
      "priority": 30,
      "created_at": "2019-11-07 08:53:46 UTC",
      "updated_at": "2019-11-07 08:53:46 UTC",
      "id": 767575241,
      "name": "foo",
      "parameter_type": "string",
      "value": "new_value"
    }
  ],
  "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.

domain
必填

Validations:

  • Must be a Hash

domain[name]
选填

完整 DNS 域名

Validations:

  • Must be a String

domain[fullname]
选填 , 允许空值

域描述

Validations:

  • Must be a String

domain[dns_id]
选填 , 允许空值

要在此域中使用的 DNS 代理 ID

Validations:

  • Must be a number.

domain[domain_parameters_attributes]
选填 , 允许空值

参数阵列(name,value)

Validations:

  • Must be an array of any type

domain[location_ids]
选填 , 允许空值

使用给定 id 替换位置

Validations:

  • Must be an array of any type

domain[organization_ids]
选填 , 允许空值

使用给定 id 替换机构

Validations:

  • Must be an array of any type


DELETE /api/domains/:id
删除域

示例

DELETE /api/domains/22495316-mydomain-net
{
  "domain": {}
}
200
{
  "id": 22495316,
  "name": "mydomain.net",
  "fullname": null,
  "created_at": "2019-11-07T08:53:42.031Z",
  "updated_at": "2019-11-07T08:53:42.031Z",
  "dns_id": 113629430
}

参数

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