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
選填

Display hidden values

Validations:

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

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
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
選填

Display hidden values

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]
選填

Deprecated, please use omit

Validations:

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

smart_class_parameter[omit]
選填

Foreman will not send this parameter in classification output. Puppet will use the value defined in the Puppet manifest for this parameter

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]
選填

若為真而沒有預設值並且比對器未提供值的話,將會造成錯誤發生。

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.