組織のインベントリのリスト
get
/api/v2/organizations/{id}/inventories/
このリソースに対してGETリクエストを行って、選択した組織に関連付けられたインベントリのリストを取得します。
結果のデータ構造には次が含まれます。
{
"count": 99,
"next": null,
"previous": null,
"results": [
...
]
}
count
フィールドは、対象となる問合せで見つかったインベントリの合計数を示します。 next
フィールドとprevious
フィールドには、結果が1ページに収まらない場合に、追加の結果へのリンクが表示されます。 results
リストには、0個以上のインベントリ・レコードが含まれます。
結果
それぞれのインベントリ・データ構造には次のフィールドが含まれます。
id
: このインベントリのデータベースID。(整数)type
: このインベントリのデータ型。(選択)url
: このインベントリのURL。(文字列)related
: 関連リソースのURLを含むデータ構造。(オブジェクト)summary_fields
: 関連リソースの名前/説明を含むデータ構造。 一部のオブジェクトの出力は、パフォーマンス上の理由によって制限される場合があります。(オブジェクト)created
: このインベントリが作成されたときのタイムスタンプ。(日時)modified
: このインベントリが最後に変更されたときのタイムスタンプ。(日時)name
: このインベントリの名前。(文字列)description
: このインベントリのオプションの説明。(文字列)organization
: このインベントリを含む組織。(id)kind
: 表されているインベントリの種類。(選択)""
: ホストに、このインベントリへの直接リンクがあります。smart
: host_filterプロパティを使用して生成されたインベントリのホスト。
host_filter
: このインベントリのホストに適用されるフィルタ。(文字列)variables
: JSONまたはYAML形式のインベントリ変数。(json)has_active_failures
: このフィールドは非推奨であり、今後のリリースで削除される予定です。 このインベントリのホストが失敗したかどうかを示すフラグ。(ブール)total_hosts
: このフィールドは非推奨であり、今後のリリースで削除される予定です。 このインベントリのホストの合計数。(整数)hosts_with_active_failures
: このフィールドは非推奨であり、今後のリリースで削除される予定です。 アクティブなエラーのあるこのインベントリのホスト数。(整数)total_groups
: このフィールドは非推奨であり、今後のリリースで削除される予定です。 このインベントリのグループの合計数。(整数)has_inventory_sources
: このフィールドは非推奨であり、今後のリリースで削除される予定です。 このインベントリに外部のインベントリ・ソースがあるかどうかを示すフラグ。(ブール)total_inventory_sources
: このインベントリ内に構成されている外部のインベントリ・ソースの合計数。(整数)inventory_sources_with_failures
: エラーのあるこのインベントリの外部のインベントリ・ソースの数。(整数)pending_deletion
: インベントリが削除中であることを示すフラグ。(ブール)
ソート
インベントリが特定の順序で返されるように指定するには、GETリクエストでorder_by
問合せ文字列パラメータを使用します。
?order_by=name
フィールド名の先頭にダッシュ-
を付けると逆の順序でソートされます。
?order_by=-name
フィールド名をカンマ,
で区切ると、複数のソート・フィールドを指定できます。
?order_by=name,some_other_field
ページ区切り
リクエストごとに返される結果の数を変更するには、page_size
問合せ文字列パラメータを使用します。 特定のページの結果を取得するには、page
問合せ文字列パラメータを使用します。
?page_size=100&page=2
結果で返されるprevious
リンクおよびnext
リンクは、これらの問合せ文字列パラメータを自動的に設定します。
検索
モデルのすべての指定テキスト・フィールド内で大/小文字を区別しない検索を実行するには、search
問合せ文字列パラメータを使用します。
?search=findme
( 「Oracle Linux Automation Manaerに追加」)関連フィールド全体を検索します:
?related__search=findme
リクエスト
サポートされているメディア・タイプ
- application/json
パス・パラメータ
問合せパラメータ
- page(オプション): 整数
ページ区切りが設定された結果セット内のページ番号。
- page_size(オプション): 整数
ページごとに返す結果の数。
- search(オプション): 文字列
検索条件。
レスポンス
サポートされているメディア・タイプ
- application/json
200レスポンス
レスポンスの例(application/json)
{
"count":1,
"next":null,
"previous":null,
"results":[
{
"created":"2018-02-01T08:00:00.000000Z",
"description":"",
"has_active_failures":false,
"has_inventory_sources":false,
"host_filter":null,
"hosts_with_active_failures":0,
"id":1,
"inventory_sources_with_failures":0,
"kind":"",
"modified":"2018-02-01T08:00:00.000000Z",
"name":"inventory-one",
"organization":1,
"pending_deletion":false,
"related":{
"access_list":"/api/v2/inventories/1/access_list/",
"activity_stream":"/api/v2/inventories/1/activity_stream/",
"ad_hoc_commands":"/api/v2/inventories/1/ad_hoc_commands/",
"copy":"/api/v2/inventories/1/copy/",
"groups":"/api/v2/inventories/1/groups/",
"hosts":"/api/v2/inventories/1/hosts/",
"instance_groups":"/api/v2/inventories/1/instance_groups/",
"inventory_sources":"/api/v2/inventories/1/inventory_sources/",
"job_templates":"/api/v2/inventories/1/job_templates/",
"object_roles":"/api/v2/inventories/1/object_roles/",
"organization":"/api/v2/organizations/1/",
"root_groups":"/api/v2/inventories/1/root_groups/",
"script":"/api/v2/inventories/1/script/",
"tree":"/api/v2/inventories/1/tree/",
"update_inventory_sources":"/api/v2/inventories/1/update_inventory_sources/",
"variable_data":"/api/v2/inventories/1/variable_data/"
},
"summary_fields":{
"object_roles":{
"adhoc_role":{
"description":"May run ad hoc commands on the inventory",
"id":18,
"name":"Ad Hoc"
},
"admin_role":{
"description":"Can manage all aspects of the inventory",
"id":16,
"name":"Admin"
},
"read_role":{
"description":"May view settings for the inventory",
"id":20,
"name":"Read"
},
"update_role":{
"description":"May update the inventory",
"id":17,
"name":"Update"
},
"use_role":{
"description":"Can use the inventory in a job template",
"id":19,
"name":"Use"
}
},
"organization":{
"description":"test-org-desc",
"id":1,
"name":"test-org"
},
"user_capabilities":{
"adhoc":false,
"copy":false,
"delete":false,
"edit":false
}
},
"total_groups":0,
"total_hosts":0,
"total_inventory_sources":0,
"type":"inventory",
"url":"/api/v2/inventories/1/",
"variables":""
}
]
}
403レスポンス
レスポンスの例(application/json)
{
"detail":"You do not have permission to perform this action."
}