GET /api/smart_class_parameters
列出所有智能类别参数

GET /api/hosts/:host_id/smart_class_parameters
具体主机的智能类别参数列表

GET /api/hostgroups/:hostgroup_id/smart_class_parameters
具体主机组的智能类别参数列表

GET /api/puppetclasses/:puppetclass_id/smart_class_parameters
具体 Puppet 类别的智能类别参数列表

GET /api/environments/:environment_id/smart_class_parameters
具体环境的智能类别参数列表

GET /api/environments/:environment_id/puppetclasses/:puppetclass_id/smart_class_parameters
具体环境/Puppet 类别组合的智能类别参数列表

示例

GET /api/puppetclasses/980190962/smart_class_parameters
200
{
  "total": 1,
  "subtotal": 1,
  "page": 1,
  "per_page": 20,
  "search": null,
  "sort": {
    "by": null,
    "order": null
  },
  "results": [
    {
      "description": null,
      "override": true,
      "parameter_type": "string",
      "hidden_value?": false,
      "omit": null,
      "required": false,
      "validator_type": null,
      "validator_rule": null,
      "merge_overrides": false,
      "merge_default": false,
      "avoid_duplicates": false,
      "override_value_order": "fqdn\norganization,location\nhostgroup\nos",
      "created_at": "2019-11-07 08:52:01 UTC",
      "updated_at": "2019-11-07 08:52:01 UTC",
      "use_puppet_default": null,
      "parameter": "cluster",
      "id": 328495940,
      "puppetclass_id": 980190962,
      "override_values_count": 2,
      "default_value": "secret",
      "puppetclass_name": "base"
    }
  ]
}

参数

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

host_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.

hostgroup_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.

puppetclass_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.

environment_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
选填

显示隐藏值

Validations:

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

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.

搜索字段

字段名 类型 可能的值
avoid_duplicates true, false
environment string
key string
merge_default true, false
merge_overrides true, false
override true, false
parameter string
puppetclass string
puppetclass_name string

GET /api/smart_class_parameters/:id
显示智能类别参数

示例

GET /api/puppetclasses/980190962/smart_class_parameters/1018350796
200
{
  "description": null,
  "override": false,
  "parameter_type": null,
  "hidden_value?": true,
  "omit": null,
  "required": false,
  "validator_type": null,
  "validator_rule": null,
  "merge_overrides": false,
  "merge_default": false,
  "avoid_duplicates": false,
  "override_value_order": "fqdn\nhostgroup\nos\ndomain",
  "created_at": "2019-11-07 08:36:36 UTC",
  "updated_at": "2019-11-07 08:36:36 UTC",
  "use_puppet_default": null,
  "parameter": "param38",
  "id": 1018350796,
  "puppetclass_id": 980190962,
  "override_values_count": 1,
  "default_value": "hidden",
  "puppetclass_name": "base",
  "environments": [],
  "override_values": [
    {
      "created_at": "2019-11-07 08:36:36 UTC",
      "updated_at": "2019-11-07 08:36:36 UTC",
      "id": 1018350796,
      "match": "os=fake",
      "value": "abc",
      "omit": false,
      "use_puppet_default": false
    }
  ]
}

参数

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

show_hidden
选填

显示隐藏值

Validations:

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


PUT /api/smart_class_parameters/:id
更新智能类别参数

示例

PUT /api/smart_class_parameters/1018350796
{
  "smart_class_parameter": {
    "parameter_type": "boolean",
    "default_value": "bTreQsKkLv"
  }
}
500
{
  "error": {
    "message": "Validation failed: Default value is invalid, Lookup values is invalid"
  }
}

参数

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

smart_class_parameter
必填

Validations:

  • Must be a Hash

smart_class_parameter[override]
选填

是否由 Foreman 管理智能类别参数值

Validations:

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

smart_class_parameter[description]
选填

智能类别描述

Validations:

  • Must be a String

smart_class_parameter[default_value]
选填

无映射时使用的值

Validations:

  • Must be one of types: string, boolean, integer, real, array, hash, yaml, json

smart_class_parameter[hidden_value]
选填

何时将启用的参数隐藏到 UI 中

Validations:

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

smart_class_parameter[use_puppet_default]
选填

已弃用,请使用 omit

Validations:

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

smart_class_parameter[omit]
选填

Foreman 不会在分类输出中发送此参数。Puppet 将使用 Puppet 清单中为此参数定义的值

Validations:

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

smart_class_parameter[path]
选填

解析参数值的指令

Validations:

  • Must be a String

smart_class_parameter[validator_type]
选填

验证值类型

Validations:

  • Must be one of: regexp, list.

smart_class_parameter[validator_rule]
选填

用来在参数中强制使用某些值

Validations:

  • Must be a String

smart_class_parameter[override_value_order]
选填

解析参数值的指令

Validations:

  • Must be a String

smart_class_parameter[parameter_type]
选填

变量值类型

Validations:

  • Must be one of: string, boolean, integer, real, array, hash, yaml, json.

smart_class_parameter[required]
选填

如为 true,则会在没有默认值且没有匹配程序提供参数值时出错

Validations:

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

smart_class_parameter[merge_overrides]
选填

合并所有匹配的值(仅用于阵列/哈希类型)

Validations:

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

smart_class_parameter[merge_default]
选填

合并所有匹配值时包括默认值

Validations:

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

smart_class_parameter[avoid_duplicates]
选填

删除重复值(仅用于阵列类型)

Validations:

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