# PAM Rotation Info JSON

## PAM Rotation Info — JSON出力

`pam rotation info` コマンドでは、 `--format json` により機械可読な出力が得られます。CI/CDパイプライン、宣言型ツール、ローテーション状態をプログラムで取得するスクリプトで利用できます。

{% hint style="info" %}
**対象バージョン:** Keeperコマンダー17.3以降 (PR #2003、2026-04-30マージ)
{% endhint %}

***

### 構文

```
pam rotation info -r <record-uid> [--format table|json] [--output <file>]
```

### オプション

| オプション                  | 説明                        |
| ---------------------- | ------------------------- |
| `-r <uid>`             | ローテーション情報を照会するPAMレコードのUID |
| `--format table\|json` | 出力形式。デフォルト: `table`       |
| `--output <file>`      | 標準出力の代わりにファイルへ出力          |

***

### テーブル出力 (デフォルト)

従来どおりの人間が読める形式の出力です。以前のバージョンから変更はありません。

```
My Vault> pam rotation info -r a1b2c3d4
Status:           Online
Ready to rotate:  Yes
PAM Config UID:   f6e5d4c3...
Gateway:          prod-gateway-01
Schedule:         cron (0 3 * * *)
...
```

***

### JSON出力

`--format json` を指定すると、構造化されたJSONオブジェクトが標準出力 (または `--output` で指定したファイル) に返されます。

```
My Vault> pam rotation info -r a1b2c3d4 --format json
```

#### オンライン時 — 完全なJSONスキーマ

```json
{
  "status": "Online",
  "ready_to_rotate": true,
  "pam_config_uid": "f6e5d4c3...",
  "node_id": 12345,
  "gateway_name": "prod-gateway-01",
  "gateway_uid": "9a8b7c6d...",
  "admin_resource_uid": "1a2b3c4d...",
  "password_complexity": 3,
  "password_complexity_detail": "12+ chars, upper, lower, digit, symbol",
  "schedule_type": "cron",
  "schedule_data": "0 3 * * *",
  "disabled": false,
  "script_name": null
}
```

#### 非オンライン時 — 最小JSONスキーマ

レコードに到達できない、またはローテーション用に構成されていない場合。

```json
{
  "status": "Offline",
  "ready_to_rotate": false
}
```

#### JSONフィールドリファレンス

| フィールド                        | 型              | 説明                                         |
| ---------------------------- | -------------- | ------------------------------------------ |
| `status`                     | string         | ローテーションゲートウェイの状態 (例: `Online` 、 `Offline`) |
| `ready_to_rotate`            | boolean        | 即時ローテーションの準備ができているか                        |
| `pam_config_uid`             | string         | 関連付けられたPAM構成のUID                           |
| `node_id`                    | integer        | エンタープライズノードID                              |
| `gateway_name`               | string         | 接続中ゲートウェイの表示名                              |
| `gateway_uid`                | string         | 接続中ゲートウェイレコードのUID                          |
| `admin_resource_uid`         | string         | ローテーションに使用する管理者認証情報のUID                    |
| `password_complexity`        | integer        | 複雑性レベル (1–4)                               |
| `password_complexity_detail` | string         | 複雑性の人が読める説明                                |
| `schedule_type`              | string         | `cron` 、 `interval` 、 `manual` のいずれか       |
| `schedule_data`              | string         | スケジュール定義 (cron式または間隔の値)                    |
| `disabled`                   | boolean        | このレコードでローテーションが無効か                         |
| `script_name`                | string \| null | 構成済みの場合、ポストローテーションスクリプト名                   |

***

### 例

#### JSONをファイルに書き出す

```
My Vault> pam rotation info -r a1b2c3d4 --format json --output /tmp/rotation-status.json
```

#### シェルパイプライン — 準備状態の確認

```bash
keeper pam rotation info -r a1b2c3d4 --format json \
  | python3 -c "import json,sys; d=json.load(sys.stdin); sys.exit(0 if d['ready_to_rotate'] else 1)"
echo "Exit: $?"
```

#### フォルダ内の全レコードを監査 (`pam rotation info` をUIDごとに実行)

```bash
for uid in $(keeper pam project list --format json | jq -r '.[].uid'); do
  keeper pam rotation info -r "$uid" --format json >> /tmp/rotation-audit.jsonl
done
```

***

### 注記

* `--format json` は `pam rotation info` (v2ルーター) とレガシーの `pam rotation info` (v1エンドポイント) の両方で利用でき、いずれも同じスキーマを返します。
* `--format json` と `--output` を併用すると、ファイルは整形済みJSONとして書き込まれます。
* テーブル出力は従来どおり維持されます。 `--format json` は追加機能です。


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.keeper.io/keeperpam/jp/commander-cli/command-reference/keeperpam-commands/pam-rotation-info-json.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
