インベントリのアドホック・コマンドのリスト
get
/api/v2/inventories/{id}/ad_hoc_commands/
このリソースに対して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
: このアドホック・コマンドの名前。(文字列)launch_type
: (選択)manual
: 手動relaunch
: 再起動callback
: コールバックscheduled
: スケジュール済dependency
: 依存性workflow
: ワークフローwebhook
: Webフックsync
: 同期scm
: SCM更新
status
: (選択)new
: 新規pending
: 保留中waiting
: 待機中running
: 実行中successful
: 成功failed
: 失敗error
: エラーcanceled
: 取消し済
execution_environment
: 実行に使用されるコンテナ・イメージ。(id)failed
: (ブール)started
: ジョブが開始のためにキューに入れられた日時。(日時)finished
: ジョブの実行が終了した日時。(日時)canceled_on
: 取消しリクエストが送信された日時。(日時)elapsed
: ジョブが実行された経過時間(秒)。(10進)job_explanation
: stdoutを実行および取得できなかった場合のジョブの状態を示すステータス・フィールド(文字列)execution_node
: ジョブが実行されたノード。(文字列)controller_node
: 実行環境を管理したインスタンス。(文字列)launched_by
: (フィールド)work_unit_id
: このジョブに関連付けられた受信者作業ユニットID。(文字列)job_type
: (選択)run
: 実行check
: チェック
inventory
: (id)limit
: (文字列)credential
: (id)module_name
: (選択)command
shell
yum
apt
apt_key
apt_repository
apt_rpm
service
group
user
mount
ping
selinux
setup
win_ping
win_service
win_updates
win_group
win_user
module_args
: (文字列)forks
: (整数)verbosity
: (選択)0
: 0 (標準)1
: 1 (詳細)2
: 2 (より詳細)3
: 3 (デバッグ)4
: 4 (接続デバッグ)5
: 5 (WinRMデバッグ)
extra_vars
: (文字列)become_enabled
: (ブール)diff_mode
: (ブール)
ソート
アドホック・コマンドが特定の順序で返されるように指定するには、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":[
{
"become_enabled":false,
"canceled_on":null,
"controller_node":"",
"created":"2018-02-01T08:00:00.000000Z",
"credential":1,
"diff_mode":false,
"elapsed":0,
"execution_environment":null,
"execution_node":"",
"extra_vars":"",
"failed":false,
"finished":null,
"forks":0,
"id":2,
"inventory":3,
"job_explanation":"",
"job_type":"run",
"launch_type":"manual",
"launched_by":{
},
"limit":"",
"modified":"2018-02-01T08:00:00.000000Z",
"module_args":"uptime",
"module_name":"command",
"name":"command",
"related":{
"activity_stream":"/api/v2/ad_hoc_commands/2/activity_stream/",
"cancel":"/api/v2/ad_hoc_commands/2/cancel/",
"credential":"/api/v2/credentials/1/",
"events":"/api/v2/ad_hoc_commands/2/events/",
"inventory":"/api/v2/inventories/3/",
"notifications":"/api/v2/ad_hoc_commands/2/notifications/",
"relaunch":"/api/v2/ad_hoc_commands/2/relaunch/",
"stdout":"/api/v2/ad_hoc_commands/2/stdout/"
},
"started":null,
"status":"pending",
"summary_fields":{
"credential":{
"cloud":false,
"credential_type_id":1,
"description":"",
"id":1,
"kind":"ssh",
"kubernetes":false,
"name":"machine-cred"
},
"inventory":{
"description":"",
"has_active_failures":false,
"has_inventory_sources":false,
"hosts_with_active_failures":0,
"id":3,
"inventory_sources_with_failures":0,
"kind":"",
"name":"inv2",
"organization_id":1,
"total_groups":0,
"total_hosts":0,
"total_inventory_sources":0
},
"user_capabilities":{
"delete":true,
"start":true
}
},
"type":"ad_hoc_command",
"url":"/api/v2/ad_hoc_commands/2/",
"verbosity":0,
"work_unit_id":null
}
]
}
403レスポンス
レスポンスの例(application/json)
{
"detail":"You do not have permission to perform this action."
}