# カスタムのレコードタイプ

## 概要

KeeperシークレットマネージャーCLIでは、デフォルトのレコードタイプが用意されていますが、カスタムレコードタイプを作成し、レコードタイプに基づいたレコードを作成することも可能です。

{% hint style="info" %}
カスタムレコードタイプについて、詳しくはエンタープライズガイドの[こちらのページ](/enterprise-guide/jp/record-types.md)カスタムをご参照ください。
{% endhint %}

カスタムレコードタイプを使用したレコードを作成するには、CLI内でスキーマを定義します。そのために、[Keeperコマンダー](/keeperpam/jp/secrets-manager/secrets-manager-command-line-interface.md)を使用してカスタムレコードタイプをエクスポートします。

以下の例では、「My Custom」レコードタイプを、JSONとして`my_record_type.json`ファイルにエクスポートします。

```
My Vault> rti --format json -lr "My Custom" --output my_record_type.json
```

このJSONファイルを、`record_type`ディレクトリにコピーします。`record_type`ディレクトリは、`keeper.ini`ファイルと同じ場所にあります。`record_type`は、`keeper.ini`と同じディレクトリに存在する必要はありませんが、CLIが`keeper.ini`を確認する場所に存在する必要があります。

* 環境変&#x6570;**`KSM_INI_DIR`**&#x3067;定義されたパス
* 現在のディレクトリ
* ユーザーのホームディレクトリ
  * `${HOME}`
  * `${HOME}/.config/ksm`
  * `$env:USERPROFILE`
* 様々なシステムディレクトリ
  * `/etc`
  * `/etc/ksm`
  * `/etc/keeper`
  * `$env:APPDATA/Keeper`
  * `$env:ProgamData/Keeper`
  * `$env:ProgramFiles/Keeper`

代替ディレクトリは[configコマンド](/keeperpam/jp/secrets-manager/secrets-manager-command-line-interface/config-command.md)で設定できます。

```
$ ksm config record-type-dir -d /path/to/my/record/type/schemas
```

このファイルが`record_type`ディレクトリにコピーされると、使用できるレコードタイプのリストに表示されます。

```
 $ ksm secret template record -l
 Record Type
 ------------------------
 login
 bankAccount
 address
 ...
 My Custom
```

これで、カスタムレコードタイプを使用して新しいレコードを作成できます。

```
$ ksm secret add field --sf XXXX --rt "My Custom" -t "My Record" \
    "login=jsmith" "password=XXXX" "url=https://localhost"
```

カスタムのレコードタイプ名にスペースが含まれている場合は、レコードタイプ名を引用符で囲む必要があります。

{% hint style="info" %}
すべてのカスタムレコードタイプ名は固有である必要があります。同じ名前のレコードタイプがすでにインポートされている場合はエラーが発生します。また、デフォルトのレコードタイプを上書きすることもできません。
{% endhint %}


---

# 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/secrets-manager/secrets-manager-command-line-interface/custom-record-types.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.
