POST /api/smart_proxies/:id/import_puppetclasses
Import puppet classes from puppet proxy

POST /api/smart_proxies/:smart_proxy_id/environments/:id/import_puppetclasses
為環境由 puppet 代理伺服器匯入 puppet 類別

POST /api/environments/:environment_id/smart_proxies/:id/import_puppetclasses
為環境由 puppet 代理伺服器匯入 puppet 類別

示例

POST /api/smart_proxies/182953976/import_puppetclasses
{
  "smart_proxy": {}
}
200
{
  "message": "Successfully updated environment and puppetclasses from the on-disk puppet installation",
  "environments_with_new_puppetclasses": 2,
  "environments_updated_puppetclasses": 0,
  "environments_obsolete": 3,
  "environments_ignored": 0,
  "results": [
    {
      "name": "env1",
      "actions": [
        "new"
      ],
      "new_puppetclasses": [
        "a"
      ]
    },
    {
      "name": "env2",
      "actions": [
        "new"
      ],
      "new_puppetclasses": [
        "b"
      ]
    },
    {
      "name": "global_puppetmaster",
      "actions": [
        "obsolete"
      ],
      "removed_environment": "global_puppetmaster"
    },
    {
      "name": "production",
      "actions": [
        "obsolete"
      ],
      "removed_environment": "production"
    },
    {
      "name": "testing",
      "actions": [
        "obsolete"
      ],
      "removed_environment": "testing"
    }
  ]
}

參數

參數名字 描述
location_id
選填

位置範圍

Validations:

  • Must be a Integer

organization_id
選填

組織範圍

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

Validations:

  • Must be a String

environment_id
選填

Validations:

  • Must be a String

dryrun
選填

Validations:

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

except
選填

選用性的逗號分隔字串,包含了「new」、「updated」或是「obsolete」,以用來限制匯入的 Puppet 類別

Validations:

  • Must be a String


GET /api/smart_proxies
列出所有智慧型代理伺服器

示例

GET /api/smart_proxies
200
{
  "total": 8,
  "subtotal": 1,
  "page": 1,
  "per_page": 20,
  "search": "feature=TFTP",
  "sort": {
    "by": null,
    "order": null
  },
  "results": [
    {
      "created_at": "2019-09-11 14:48:32 UTC",
      "updated_at": "2019-09-11 14:48:32 UTC",
      "name": "TFTP Proxy",
      "id": 298486374,
      "url": "http://somewhere.else",
      "features": [
        {
          "capabilities": [],
          "name": "TFTP",
          "id": 303403661
        }
      ]
    }
  ]
}

參數

參數名字 描述
location_id
選填

位置範圍

Validations:

  • Must be a Integer

organization_id
選填

組織範圍

Validations:

  • Must be a Integer

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
feature string
location string
location_id integer
name string
organization string
organization_id integer
url string

GET /api/smart_proxies/:id
顯示智慧型代理伺服器

示例

GET /api/smart_proxies/980190962-DHCP%20Proxy
200
{
  "created_at": "2019-09-11 14:48:32 UTC",
  "updated_at": "2019-09-11 14:48:32 UTC",
  "name": "DHCP Proxy",
  "id": 980190962,
  "url": "https://somewhere.net:8443",
  "features": [
    {
      "capabilities": [],
      "name": "DHCP",
      "id": 219245707
    }
  ],
  "locations": [
    {
      "id": 255093256,
      "name": "Location 1",
      "title": "Location 1",
      "description": null
    }
  ],
  "organizations": [
    {
      "id": 447626438,
      "name": "Organization 1",
      "title": "Organization 1",
      "description": null
    }
  ]
}

參數

參數名字 描述
location_id
選填

位置範圍

Validations:

  • Must be a Integer

organization_id
選填

組織範圍

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.


POST /api/smart_proxies
建立智慧型代理伺服器

示例

POST /api/smart_proxies
{
  "smart_proxy": {
    "name": "",
    "url": "http://server:8443"
  }
}
422
{
  "error": {
    "id": null,
    "errors": {
      "name": [
        "can't be blank"
      ]
    },
    "full_messages": [
      "Name can't be blank"
    ]
  }
}

參數

參數名字 描述
location_id
選填

位置範圍

Validations:

  • Must be a Integer

organization_id
選填

組織範圍

Validations:

  • Must be a Integer

smart_proxy
必填

Validations:

  • Must be a Hash

smart_proxy[name]
必填

Validations:

  • Must be a String

smart_proxy[url]
必填

Validations:

  • Must be a String

smart_proxy[location_ids]
選填 , 允許空值

將位置取代為特定 ID

Validations:

  • Must be an array of any type

smart_proxy[organization_ids]
選填 , 允許空值

將組織取代為特定 ID。

Validations:

  • Must be an array of any type


PUT /api/smart_proxies/:id
更新智慧型代理伺服器

示例

PUT /api/smart_proxies/980190962-DHCP%20Proxy
{
  "smart_proxy": {
    "name": "master02",
    "url": "http://server:8443"
  }
}
200
{
  "created_at": "2019-09-11 14:48:32 UTC",
  "updated_at": "2019-09-11 14:48:39 UTC",
  "name": "master02",
  "id": 980190962,
  "url": "http://server:8443",
  "features": [
    {
      "capabilities": [],
      "name": "DHCP",
      "id": 219245707
    },
    {
      "capabilities": [],
      "name": "DNS",
      "id": 49142851
    },
    {
      "capabilities": [],
      "name": "TFTP",
      "id": 303403661
    },
    {
      "capabilities": [],
      "name": "DHCP",
      "id": 219245707
    },
    {
      "capabilities": [],
      "name": "Puppet CA",
      "id": 783807086
    },
    {
      "capabilities": [],
      "name": "Puppet",
      "id": 1006510553
    },
    {
      "capabilities": [],
      "name": "BMC",
      "id": 821748566
    },
    {
      "capabilities": [],
      "name": "Chef Proxy",
      "id": 848995175
    },
    {
      "capabilities": [],
      "name": "Realm",
      "id": 982965213
    },
    {
      "capabilities": [],
      "name": "Logs",
      "id": 814728799
    }
  ],
  "locations": [
    {
      "id": 255093256,
      "name": "Location 1",
      "title": "Location 1",
      "description": null
    }
  ],
  "organizations": [
    {
      "id": 447626438,
      "name": "Organization 1",
      "title": "Organization 1",
      "description": null
    }
  ]
}

參數

參數名字 描述
location_id
選填

位置範圍

Validations:

  • Must be a Integer

organization_id
選填

組織範圍

Validations:

  • Must be a Integer

id
必填

Validations:

  • Must be a String

smart_proxy
必填

Validations:

  • Must be a Hash

smart_proxy[name]
選填

Validations:

  • Must be a String

smart_proxy[url]
選填

Validations:

  • Must be a String

smart_proxy[location_ids]
選填 , 允許空值

將位置取代為特定 ID

Validations:

  • Must be an array of any type

smart_proxy[organization_ids]
選填 , 允許空值

將組織取代為特定 ID。

Validations:

  • Must be an array of any type


DELETE /api/smart_proxies/:id
刪除智慧型代理伺服器

示例

DELETE /api/smart_proxies/281110143-Unused%20Proxy
{
  "smart_proxy": {}
}
200
{
  "id": 281110143,
  "name": "Unused Proxy",
  "url": "http://else.where:45672",
  "created_at": "2019-09-11T14:48:32.049Z",
  "updated_at": "2019-09-11T14:48:32.049Z",
  "expired_logs": "0"
}

參數

參數名字 描述
location_id
選填

位置範圍

Validations:

  • Must be a Integer

organization_id
選填

組織範圍

Validations:

  • Must be a Integer

id
必填

Validations:

  • Must be a String


PUT /api/smart_proxies/:id/refresh
更新智慧型代理伺服器的功能

示例

POST /api/smart_proxies/980190962-DHCP%20Proxy/refresh
{
  "smart_proxy": {}
}
201
{
  "created_at": "2019-09-11 14:48:32 UTC",
  "updated_at": "2019-09-11 14:48:32 UTC",
  "name": "DHCP Proxy",
  "id": 980190962,
  "url": "https://somewhere.net:8443",
  "features": [
    {
      "capabilities": [],
      "name": "DHCP",
      "id": 219245707
    },
    {
      "capabilities": [],
      "name": "DNS",
      "id": 49142851
    },
    {
      "capabilities": [],
      "name": "TFTP",
      "id": 303403661
    },
    {
      "capabilities": [],
      "name": "Puppet CA",
      "id": 783807086
    },
    {
      "capabilities": [],
      "name": "Puppet",
      "id": 1006510553
    },
    {
      "capabilities": [],
      "name": "BMC",
      "id": 821748566
    },
    {
      "capabilities": [],
      "name": "Chef Proxy",
      "id": 848995175
    },
    {
      "capabilities": [],
      "name": "Realm",
      "id": 982965213
    },
    {
      "capabilities": [],
      "name": "Logs",
      "id": 814728799
    }
  ],
  "locations": [
    {
      "id": 255093256,
      "name": "Location 1",
      "title": "Location 1",
      "description": null
    }
  ],
  "organizations": [
    {
      "id": 447626438,
      "name": "Organization 1",
      "title": "Organization 1",
      "description": null
    }
  ]
}

參數

參數名字 描述
location_id
選填

位置範圍

Validations:

  • Must be a Integer

organization_id
選填

組織範圍

Validations:

  • Must be a Integer

id
必填

Validations:

  • Must be a String