示例

POST /api/smart_variables
{
  "smart_variable": {
    "variable": "QSFxqjVjdV",
    "puppetclass_id": 298486374,
    "hidden_value": true
  }
}
201
{
  "description": null,
  "parameter_type": null,
  "variable_type": null,
  "hidden_value?": true,
  "validator_type": null,
  "validator_rule": null,
  "override_value_order": "fqdn\nhostgroup\nos\ndomain",
  "merge_overrides": false,
  "merge_default": false,
  "avoid_duplicates": false,
  "puppetclass_id": 298486374,
  "puppetclass_name": "apache",
  "created_at": "2019-09-11 14:34:11 UTC",
  "updated_at": "2019-09-11 14:34:11 UTC",
  "variable": "QSFxqjVjdV",
  "id": 1018350798,
  "default_value": "*****",
  "override_values_count": 0,
  "override_values": []
}

參數

參數名字 描述
location_id
選填

位置範圍

Validations:

  • Must be a Integer

organization_id
選填

組織範圍

Validations:

  • Must be a Integer

smart_variable
必填

Validations:

  • Must be a Hash

smart_variable[variable]
必填

變數名稱

Validations:

  • Must be a String

smart_variable[puppetclass_id]
選填 , 允許空值

Puppet 類別 ID

Validations:

  • Must be a number.

smart_variable[default_value]
選填 , 允許空值

變數預設值

Validations:

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

smart_variable[hidden_value]
選填 , 允許空值

啟用時,參數會隱藏在 UI 裡

Validations:

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

smart_variable[override_value_order]
選填 , 允許空值

值解析的順序

Validations:

  • Must be a String

smart_variable[description]
選填 , 允許空值

變數描述

Validations:

  • Must be a String

smart_variable[validator_type]
選填 , 允許空值

驗證值的類型

Validations:

  • Must be one of: regexp, list.

smart_variable[validator_rule]
選填 , 允許空值

用來強制參數值的某些值

Validations:

  • Must be a String

smart_variable[variable_type]
選填 , 允許空值

變數值的類型

Validations:

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

smart_variable[merge_overrides]
選填 , 允許空值

合併所有相符的值(只有陣列 / 雜湊類型)

Validations:

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

smart_variable[merge_default]
選填 , 允許空值

合併所有相符合的值時包括預設值

Validations:

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

smart_variable[avoid_duplicates]
選填 , 允許空值

移除重複的值(只有陣列類型)

Validations:

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