GET /api/puppetclasses
列出所有 Puppet 类别

GET /api/hosts/:host_id/puppetclasses
列出主机的所有 Puppet 类别

GET /api/hostgroups/:hostgroup_id/puppetclasses
列出主机组的所有 Puppet 类别

GET /api/environments/:environment_id/puppetclasses
列出环境的所有 Puppet 类别

示例

GET /api/puppetclasses
200
{
  "total": 1,
  "subtotal": 1,
  "page": 1,
  "per_page": 20,
  "search": null,
  "sort": {
    "by": null,
    "order": null
  },
  "results": {
    "class82": [
      {
        "id": 1018350796,
        "name": "class82",
        "created_at": "2019-09-11T14:53:24.240Z",
        "updated_at": "2019-09-11T14:53:24.240Z"
      }
    ]
  }
}

参数

参数名字 描述
location_id
选填

根据位置界定的范围

Validations:

  • Must be a Integer

organization_id
选填

根据机构界定的范围

Validations:

  • Must be a Integer

host_id
选填

主机 ID

Validations:

  • Must be a String

hostgroup_id
选填

主机组 ID

Validations:

  • Must be a String

environment_id
选填

环境 ID

Validations:

  • Must be a String

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.

搜索字段

字段名 类型 可能的值
config_group string
environment string
host string
hostgroup string
key string
location string
name string
organization string

GET /api/puppetclasses/:id
显示 Puppet 类别

GET /api/hosts/:host_id/puppetclasses/:id
显示主机的 Puppet 类别

GET /api/hostgroups/:hostgroup_id/puppetclasses/:id
显示主机组的 Puppet 类别

GET /api/environments/:environment_id/puppetclasses/:id
显示环境的 Puppet 类别

示例

GET /api/environments/production/puppetclasses/980190962
200
{
  "created_at": "2019-09-11 14:57:07 UTC",
  "updated_at": "2019-09-11 14:57:07 UTC",
  "id": 980190962,
  "name": "base",
  "module_name": "base",
  "environments": [
    {
      "name": "production",
      "id": 334344675
    }
  ],
  "hostgroups": [
    {
      "id": 636252244,
      "name": "Common",
      "title": "Common",
      "description": null
    }
  ],
  "smart_variables": [
    {
      "variable": "bool_test",
      "id": 638205575
    },
    {
      "variable": "ssl_port",
      "id": 298486374
    }
  ],
  "smart_class_parameters": [
    {
      "parameter": "cluster",
      "id": 328495940
    }
  ]
}

参数

参数名字 描述
location_id
选填

根据位置界定的范围

Validations:

  • Must be a Integer

organization_id
选填

根据机构界定的范围

Validations:

  • Must be a Integer

host_id
选填

主机 ID

Validations:

  • Must be a String

hostgroup_id
选填

主机组 ID

Validations:

  • Must be a String

environment_id
选填

环境 ID

Validations:

  • Must be a String

id
必填

Puppet 类别 ID

Validations:

  • Must be a String


POST /api/puppetclasses
创建 Puppet 类别

示例

POST /api/puppetclasses
{
  "puppetclass": {
    "name": "test_puppetclass",
    "lookup_keys_attributes": [
      {
        "key": "smart_variable1"
      }
    ]
  }
}
201
{
  "created_at": "2019-09-11 14:57:13 UTC",
  "updated_at": "2019-09-11 14:57:13 UTC",
  "id": 1018350800,
  "name": "test_puppetclass",
  "module_name": "test_puppetclass",
  "environments": [],
  "hostgroups": [],
  "smart_variables": [
    {
      "variable": "smart_variable1",
      "id": 1018350797
    }
  ],
  "smart_class_parameters": []
}

参数

参数名字 描述
location_id
选填

根据位置界定的范围

Validations:

  • Must be a Integer

organization_id
选填

根据机构界定的范围

Validations:

  • Must be a Integer

puppetclass
必填

Validations:

  • Must be a Hash

puppetclass[name]
必填

Validations:

  • Must be a String


PUT /api/puppetclasses/:id
更新 Puppet 类别

示例

PUT /api/puppetclasses/1018350797
{
  "smart_class_parameter_ids": [],
  "puppetclass": {}
}
200
{
  "created_at": "2019-09-11 14:57:13 UTC",
  "updated_at": "2019-09-11 14:57:13 UTC",
  "id": 1018350797,
  "name": "class376",
  "module_name": "class376",
  "environments": [
    {
      "name": "environment350",
      "id": 687036944
    }
  ],
  "hostgroups": [],
  "smart_variables": [],
  "smart_class_parameters": [
    {
      "parameter": "param335",
      "id": 1018350796
    }
  ]
}

参数

参数名字 描述
location_id
选填

根据位置界定的范围

Validations:

  • Must be a Integer

organization_id
选填

根据机构界定的范围

Validations:

  • Must be a Integer

id
必填

Validations:

  • Must be a String

puppetclass
必填

Validations:

  • Must be a Hash

puppetclass[name]
选填

Validations:

  • Must be a String


DELETE /api/puppetclasses/:id
删除 Puppet 类别

示例

DELETE /api/puppetclasses/980190962-base
{
  "puppetclass": {}
}
200
{
  "id": 980190962,
  "name": "base",
  "created_at": "2019-09-11T14:57:07.101Z",
  "updated_at": "2019-09-11T14:57:07.101Z"
}

参数

参数名字 描述
location_id
选填

根据位置界定的范围

Validations:

  • Must be a Integer

organization_id
选填

根据机构界定的范围

Validations:

  • Must be a Integer

id
必填

Validations:

  • Must be a String