> For the complete documentation index, see [llms.txt](/llms.txt)

# GS2-Log SDK API リファレンス

各種プログラミング言語向け GS2-Log SDK の モデルの仕様 と API のリファレンス



## モデル

### Namespace

ネームスペース<br>

ネームスペースは、一つのプロジェクト内で同じサービスを異なる用途で複数利用するためのエンティティです。<br>
GS2 の各サービスはネームスペース単位で管理されます。ネームスペースが異なれば、同じサービスでも完全に独立したデータ空間として扱われます。<br>

そのため、各サービスの利用を開始するにあたってネームスペースを作成する必要があります。



|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| namespaceId | string |  | ※ |  |  ~ 1024文字 | ネームスペースGRN<br>※ サーバーが自動で設定 |
| name | string |  | ✓ |  |  ~ 128文字 | ネームスペース名<br>ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
| description | string |  |  |  |  ~ 1024文字 | 説明文 |
| type | 文字列列挙型<br>enum {<br>&nbsp;&nbsp;"gs2",<br>&nbsp;&nbsp;"bigquery",<br>&nbsp;&nbsp;"firehose"<br>}<br> |  |  | "gs2" |  | ログの書き出し方法<br>ログデータのエクスポート先を決定します。"gs2" はGS2のマネージドストレージにログを保存し、組み込みの検索・分析機能を利用できます。"bigquery" はGoogle BigQueryにログをエクスポートして高度な分析を行えます。"firehose" はAmazon Kinesis Data Firehoseにログをストリーミングし、S3やRedshiftなどのAWS送信先に配信します。"gs2": GS2による管理 / "bigquery": BigQuery への書き出し / "firehose": Kinesis Firehose への書き出し /  |
| gcpCredentialJson | string | {type} == "bigquery" | ✓※ |  |  ~ 5120文字 | GCPのクレデンシャル<br>BigQueryへのログエクスポート時の認証に使用するGCPクレデンシャルJSONです。サービスアカウントには対象データセットに対するBigQuery Data Editor権限が必要です。<br>※ type が "bigquery" であれば 必須 |
| bigQueryDatasetName | string | {type} == "bigquery" | ✓※ |  |  ~ 1024文字 | BigQueryのデータセット名<br>ログデータのエクスポート先となるBigQueryデータセットの名前です。データセットは提供されたクレデンシャルに関連付けられたGCPプロジェクト内にあらかじめ存在している必要があります。<br>※ type が "bigquery" であれば 必須 |
| logExpireDays | int | {type} in ["gs2", "bigquery"] | ✓※ |  | 0 ~ 3650 | ログの保存期間(日)<br>ログデータを保持する日数です。この期間を超えたログは自動的に削除されます。エクスポート方法が "gs2" または "bigquery" の場合に適用されます。最大3650日（約10年）まで設定可能です。<br>※ type が "gs2","bigquery"であれば 必須 |
| awsRegion | string | {type} == "firehose" | ✓※ |  |  ~ 256文字 | AWSのリージョン<br>Kinesis Data Firehose配信ストリームが存在するAWSリージョンです（例：us-east-1、ap-northeast-1）。<br>※ type が "firehose" であれば 必須 |
| awsAccessKeyId | string | {type} == "firehose" | ✓※ |  |  ~ 256文字 | AWSのアクセスキーID<br>Kinesis Data Firehoseへの認証に使用するAWSアクセスキーIDです。IAMユーザーには、指定されたFirehose配信ストリームへのレコード送信権限が必要です。<br>※ type が "firehose" であれば 必須 |
| awsSecretAccessKey | string | {type} == "firehose" | ✓※ |  |  ~ 256文字 | AWSのシークレットアクセスキー<br>Kinesis Data Firehose認証のためにアクセスキーIDと対になるAWSシークレットアクセスキーです。<br>※ type が "firehose" であれば 必須 |
| firehoseStreamName | string | {type} == "firehose" | ✓※ |  |  ~ 256文字 | Kinesis Firehose のストリーム名<br>ログデータの送信先となるKinesis Data Firehose配信ストリームの名前です。<br>※ type が "firehose" であれば 必須 |
| firehoseCompressData | 文字列列挙型<br>enum {<br>&nbsp;&nbsp;"none",<br>&nbsp;&nbsp;"gzip"<br>}<br> | {type} == "firehose" |  | "none" |  | Kinesis Firehose に出力するデータを圧縮するか<br>Kinesis Data Firehoseに送信する前にログデータを圧縮するかどうかの設定です。Gzip圧縮によりデータ転送量とストレージコストを削減できます。"none": 圧縮しない / "gzip": Gzip / <br>※ type が "firehose" であれば 有効 |
| status | string |  |  | "ACTIVE" |  ~ 128文字 | ステータス<br>このネームスペースの現在の動作ステータスです。ネームスペースがアクティブでログデータを受け付けているかどうかを示します。 |
| createdAt | long |  | ※ | 現在時刻 |  | 作成日時<br>UNIX 時間・ミリ秒<br/>※ サーバーが自動で設定 |
| updatedAt | long |  | ※ | 現在時刻 |  | 最終更新日時<br>UNIX 時間・ミリ秒<br/>※ サーバーが自動で設定 |
| revision | long |  |  | 0 | 0 ~ 9223372036854775805 | リビジョン |

**関連するメソッド:**
describeNamespaces - ネームスペースの一覧を取得
createNamespace - ネームスペースを新規作成
getNamespace - ネームスペースを取得
updateNamespace - ネームスペースを更新
deleteNamespace - ネームスペースを削除




---

### AccessLog

アクセスログ<br>

マイクロサービスへのリクエスト及びその応答内容を記録したログです。



|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| timestamp | long |  | ✓ |  |  | 日時<br>APIリクエストが処理された日時です。 |
| requestId | string |  | ✓ |  |  ~ 1024文字 | リクエストID<br>各APIリクエストに割り当てられる一意の識別子です。特定のAPI呼び出しの追跡やデバッグに使用されます。 |
| service | string |  | ✓ |  |  ~ 1024文字 | マイクロサービスの種類<br>リクエストを処理したGS2マイクロサービスの名前です（例：account、inventory、limit）。 |
| method | string |  | ✓ |  |  ~ 1024文字 | マイクロサービスのメソッド<br>マイクロサービス上で呼び出された具体的なAPIメソッドです（例：createNamespace、getItem）。 |
| userId | string |  |  |  |  ~ 128文字 | ユーザーID |
| request | string |  | ✓ |  |  ~ 10485760文字 | リクエストパラメータ<br>APIに送信されたリクエストパラメータの全内容（JSON形式）です。 |
| result | string |  | ✓ |  |  ~ 10485760文字 | 応答内容<br>APIから返されたレスポンスの全内容（JSON形式）で、正常な結果とエラーの詳細の両方を含みます。 |

**関連するメソッド:**
queryAccessLog - アクセスログの一覧を取得




---

### AccessLogCount

アクセスログ集計<br>

マイクロサービスの種類、メソッド、ユーザーごとにグループ化されたアクセスログエントリの集計件数です。APIの使用パターンの分析や頻繁に呼び出されるエンドポイントの特定に使用されます。



|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| service | string |  |  |  |  ~ 1024文字 | マイクロサービスの種類<br>GS2マイクロサービスの名前です。集計のグループ化キーとして使用されます。 |
| method | string |  |  |  |  ~ 1024文字 | マイクロサービスのメソッド<br>具体的なAPIメソッドです。集計のグループ化キーとして使用されます。 |
| userId | string |  |  |  |  ~ 128文字 | ユーザーID |
| count | long |  | ✓ |  | 0 ~ 9223372036854775805 | 回数<br>グループ化条件に一致するアクセスログエントリの総数です。 |

**関連するメソッド:**
countAccessLog - アクセスログの集計結果を取得




---

### IssueStampSheetLog

トランザクション発行ログ<br>

分散トランザクションの発行を記録します。各エントリは、発行時に1つのトランザクションとしてまとめられた入手アクションと関連する消費アクション（タスク）をキャプチャします。



|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| timestamp | long |  | ✓ |  |  | 日時<br>トランザクションが発行された日時です。 |
| transactionId | string |  | ✓ |  |  ~ 1024文字 | トランザクションID<br>発行された分散トランザクションの一意の識別子です。 |
| service | string |  | ✓ |  |  ~ 1024文字 | マイクロサービスの種類<br>トランザクションを発行したGS2マイクロサービスの名前です。 |
| method | string |  | ✓ |  |  ~ 1024文字 | マイクロサービスのメソッド<br>トランザクション発行をトリガーした具体的なAPIメソッドです。 |
| userId | string |  | ✓ |  |  ~ 128文字 | ユーザーID |
| action | string |  | ✓ |  |  ~ 1024文字 | 入手アクション<br>トランザクションに含まれる入手アクションで、実行時にユーザーが受け取る内容を指定します。 |
| args | string |  | ✓ |  |  ~ 5242880文字 | 引数<br>入手アクションのパラメータ（JSON形式）です。 |
| tasks | List&lt;string&gt; |  |  |  | 0 ~ 10 items | 消費アクションリスト<br>このトランザクションにバンドルされた消費アクションのリストです。入手アクションの前に実行され、前提条件としてリソースを消費します。 |

**関連するメソッド:**
queryIssueStampSheetLog - トランザクション発行ログの一覧を取得




---

### IssueStampSheetLogCount

トランザクション発行ログ集計<br>

マイクロサービスの種類、メソッド、ユーザー、アクションごとにグループ化されたトランザクション発行ログエントリの集計件数です。各サービスで発行された分散トランザクションのボリュームと分布の分析に使用されます。



|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| service | string |  |  |  |  ~ 1024文字 | マイクロサービスの種類<br>トランザクションを発行したGS2マイクロサービスの名前です。 |
| method | string |  |  |  |  ~ 1024文字 | マイクロサービスのメソッド<br>トランザクション発行をトリガーしたAPIメソッドです。 |
| userId | string |  |  |  |  ~ 128文字 | ユーザーID |
| action | string |  |  |  |  ~ 1024文字 | 入手アクション<br>発行されたトランザクションに含まれる入手アクションの種類です。 |
| count | long |  | ✓ |  | 0 ~ 9223372036854775805 | 回数<br>グループ化条件に一致するトランザクション発行ログエントリの総数です。 |

**関連するメソッド:**
countIssueStampSheetLog - トランザクション発行ログの集計結果を取得




---

### ExecuteStampSheetLog

入手アクション実行ログ<br>

マイクロサービスごとのトランザクションの実行内容ログです。



|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| timestamp | long |  | ✓ |  |  | 日時<br>入手アクションが実行された日時です。 |
| transactionId | string |  | ✓ |  |  ~ 1024文字 | トランザクションID<br>この入手アクションが属する分散トランザクションの一意の識別子です。 |
| service | string |  | ✓ |  |  ~ 1024文字 | マイクロサービスの種類<br>入手アクションを実行したGS2マイクロサービスの名前です（例：inventory、experience）。 |
| method | string |  | ✓ |  |  ~ 1024文字 | マイクロサービスのメソッド<br>入手アクションの実行のためにマイクロサービス上で呼び出された具体的なメソッドです。 |
| userId | string |  | ✓ |  |  ~ 128文字 | ユーザーID |
| action | string |  | ✓ |  |  ~ 1024文字 | 入手アクション<br>実行された入手アクションの種類です（例：Gs2Inventory:AcquireItemSetByUserId、Gs2Experience:AddExperienceByUserId）。 |
| args | string |  | ✓ |  |  ~ 5242880文字 | 引数<br>入手アクションに渡されたパラメータ（JSON形式）です。 |

**関連するメソッド:**
queryExecuteStampSheetLog - 入手アクション実行ログの一覧を取得




---

### ExecuteStampSheetLogCount

入手アクション実行ログ集計<br>

マイクロサービスの種類、メソッド、ユーザー、アクションごとにグループ化された入手アクション実行ログエントリの集計件数です。各種入手アクションの実行頻度の分析に使用されます。



|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| service | string |  |  |  |  ~ 1024文字 | マイクロサービスの種類<br>入手アクションを実行したGS2マイクロサービスの名前です。 |
| method | string |  |  |  |  ~ 1024文字 | マイクロサービスのメソッド<br>入手アクションの実行のために呼び出された具体的なメソッドです。 |
| userId | string |  |  |  |  ~ 128文字 | ユーザーID |
| action | string |  |  |  |  ~ 1024文字 | 入手アクション<br>実行された入手アクションの種類です。 |
| count | long |  | ✓ |  | 0 ~ 9223372036854775805 | 回数<br>グループ化条件に一致する入手アクション実行ログエントリの総数です。 |

**関連するメソッド:**
countExecuteStampSheetLog - 入手アクション実行ログの集計結果を取得




---

### ExecuteStampTaskLog

消費アクション実行ログ<br>

マイクロサービスごとの消費アクションの実行内容ログです。



|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| timestamp | long |  | ✓ |  |  | 日時<br>消費アクションが実行された日時です。 |
| taskId | string |  | ✓ |  |  ~ 1024文字 | タスクID<br>実行された消費アクションの一意の識別子です。 |
| service | string |  | ✓ |  |  ~ 1024文字 | マイクロサービスの種類<br>消費アクションを実行したGS2マイクロサービスの名前です（例：inventory、money）。 |
| method | string |  | ✓ |  |  ~ 1024文字 | マイクロサービスのメソッド<br>消費アクションの実行のためにマイクロサービス上で呼び出された具体的なメソッドです。 |
| userId | string |  | ✓ |  |  ~ 128文字 | ユーザーID |
| action | string |  | ✓ |  |  ~ 1024文字 | 消費アクション<br>実行された消費アクションの種類です（例：Gs2Inventory:ConsumeItemSetByUserId、Gs2Money:WithdrawByUserId）。 |
| args | string |  | ✓ |  |  ~ 5242880文字 | 引数<br>消費アクションに渡されたパラメータ（JSON形式）です。 |

**関連するメソッド:**
queryExecuteStampTaskLog - 消費アクション実行ログの一覧を取得




---

### ExecuteStampTaskLogCount

消費アクション実行ログ集計<br>

マイクロサービスの種類、メソッド、ユーザー、アクションごとにグループ化された消費アクション実行ログエントリの集計件数です。各種消費アクションの実行頻度の分析に使用されます。



|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| service | string |  |  |  |  ~ 1024文字 | マイクロサービスの種類<br>消費アクションを実行したGS2マイクロサービスの名前です。 |
| method | string |  |  |  |  ~ 1024文字 | マイクロサービスのメソッド<br>消費アクションの実行のために呼び出された具体的なメソッドです。 |
| userId | string |  |  |  |  ~ 128文字 | ユーザーID |
| action | string |  |  |  |  ~ 1024文字 | 消費アクション<br>実行された消費アクションの種類です。 |
| count | long |  | ✓ |  | 0 ~ 9223372036854775805 | 回数<br>グループ化条件に一致する消費アクション実行ログエントリの総数です。 |

**関連するメソッド:**
countExecuteStampTaskLog - 消費アクション実行ログの集計結果を取得




---

### InGameLog

インゲームログ<br>

ゲームクライアントまたはサーバーサイドスクリプトから送信されるカスタムログエントリです。GS2 API呼び出しにより自動生成されるアクセスログとは異なり、インゲームログはゲーム開発者がプレイヤーのアクション、ゲーム状態の変化、ビジネスメトリクスなどのゲーム固有のイベントを記録するために明示的に送信します。



|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| timestamp | long |  | ✓ |  |  | 日時<br>インゲームログが送信された日時です。 |
| requestId | string |  | ✓ |  |  ~ 1024文字 | リクエストID<br>重複排除と追跡のためにこのログエントリに割り当てられた一意の識別子です。 |
| userId | string |  |  |  |  ~ 128文字 | ユーザーID |
| tags | [List&lt;InGameLogTag&gt;](#ingamelogtag) |  |  | [] | 0 ~ 20 items | タグ<br>フィルタリングと分類のためにログエントリに付与されたキーバリューペアです。タグによりインゲームログの効率的な検索と集計が可能です（例：イベントタイプ、ステージID、アイテムカテゴリ）。 |
| payload | string |  | ✓ |  |  ~ 10485760文字 | ペイロード<br>JSON形式のカスタムログデータです。プレイヤーのアクション、ゲーム状態、ビジネスメトリクスなど、ゲーム固有の任意の情報を含めることができます。最大10MBまで。 |

**関連するメソッド:**
queryInGameLog - ゲーム内ログの一覧を取得
sendInGameLog - ゲーム内ログを送信
sendInGameLogByUserId - ユーザーIDを指定してゲーム内ログを送信




---

### AccessLogWithTelemetry

テレメトリー情報付きアクセスログ<br>

マイクロサービスへのリクエスト及びその応答内容を記録したログにレスポンスタイムや呼び出し元のコンテキスト情報を付加したログ



|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| timestamp | long |  | ✓ |  |  | 日時<br>APIリクエストが処理された日時です。 |
| sourceRequestId | string |  | ✓ |  |  ~ 1024文字 | 呼び出し元リクエストID<br>このリクエストを発生させた元の呼び出し元のリクエストIDです。関連するAPI呼び出しを元のリクエストまで遡って追跡するために使用されます。 |
| requestId | string |  | ✓ |  |  ~ 1024文字 | リクエストID<br>この特定のAPIリクエストに割り当てられた一意の識別子です。 |
| duration | long |  | ✓ |  | 0 ~ 9223372036854775805 | 実行時間 (ms)<br>このAPIリクエストの受信からレスポンスまでの処理にかかった時間（ミリ秒）です。 |
| service | string |  | ✓ |  |  ~ 1024文字 | マイクロサービスの種類<br>リクエストを処理したGS2マイクロサービスの名前です（例：account、inventory、limit）。 |
| method | string |  | ✓ |  |  ~ 1024文字 | マイクロサービスのメソッド<br>マイクロサービス上で呼び出された具体的なAPIメソッドです（例：createNamespace、getItem）。 |
| userId | string |  |  |  |  ~ 128文字 | ユーザーID |
| request | string |  | ✓ |  |  ~ 10485760文字 | リクエストパラメータ<br>APIに送信されたリクエストパラメータの全内容（JSON形式）です。 |
| result | string |  | ✓ |  |  ~ 10485760文字 | 応答内容<br>APIから返されたレスポンスの全内容（JSON形式）です。 |
| status | 文字列列挙型<br>enum {<br>&nbsp;&nbsp;"ok",<br>&nbsp;&nbsp;"error"<br>}<br> |  | ✓ |  |  | ステータス<br>APIリクエストの結果ステータスです。"ok" は正常処理を示し、"error" はエラーが発生したことを示します。"ok": 正常 / "error": 異常 /  |

**関連するメソッド:**
queryAccessLogWithTelemetry - テレメトリ付きのアクセスログの一覧を取得




---

### Insight

GS2-Insight は GS2-Log に蓄積されたアクセスログを可視化・分析するツールです。<br>
GS2-Insight 自体はオープンソースで github にて公開されています。<br>
https://github.com/gs2io/gs2-insight<br>

ここでは、公開されているオープンソースのコードをご自身でホスティングすることなく、オンデマンドで起動してご利用いただけます。<br>
オンデマンド起動された GS2-Insight は最大2時間利用することができます。<br>
2時間を超えて利用したい場合は、ご自身でホスティングしてご利用ください。



|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| insightId | string |  | ※ |  |  ~ 1024文字 | GS2-Insight GRN<br>※ サーバーが自動で設定 |
| name | string |  | ✓ | UUID |  ~ 36文字 | 名前 |
| taskId | string |  |  |  |  ~ 128文字 | タスクID |
| host | string |  |  |  |  ~ 256文字 | ホスト名 |
| password | string |  | ✓ |  |  ~ 32文字 | パスワード |
| status | 文字列列挙型<br>enum {<br>&nbsp;&nbsp;"ALLOCATING",<br>&nbsp;&nbsp;"LAUNCHING",<br>&nbsp;&nbsp;"ACTIVE",<br>&nbsp;&nbsp;"DELETED"<br>}<br> |  |  | "ALLOCATING" |  | ステータス"ALLOCATING": サーバーの割り当て中 / "LAUNCHING": 起動処理中 / "ACTIVE": 有効 / "DELETED": 削除済み /  |
| createdAt | long |  | ※ | 現在時刻 |  | 作成日時<br>UNIX 時間・ミリ秒<br/>※ サーバーが自動で設定 |
| revision | long |  |  | 0 | 0 ~ 9223372036854775805 | リビジョン |

**関連するメソッド:**
describeInsights - GS2-Insightインスタンスの一覧を取得
createInsight - GS2-Insightを起動
getInsight - GS2-Insightを取得
deleteInsight - GS2-Insightを削除




---

### Dashboard

ダッシュボード<br>

ログデータとメトリクスを可視化するためのカスタマイズ可能なダッシュボードです。各ダッシュボードはレイアウトとウィジェット設定をJSONペイロードとして保存し、ログ分析のカスタマイズされたビューを作成できます。



|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| dashboardId | string |  | ※ |  |  ~ 1024文字 | ダッシュボードGRN<br>※ サーバーが自動で設定 |
| name | string |  | ✓ | UUID |  ~ 36文字 | ダッシュボード名 |
| displayName | string |  | ✓ |  |  ~ 256文字 | 表示用の名前<br>このダッシュボードの人間が読める名前で、ダッシュボード一覧やヘッダーに表示されます。 |
| description | string |  |  |  |  ~ 1024文字 | 説明文 |
| payload | string |  | ✓ |  |  ~ 1048576文字 | ペイロード<br>JSON形式のダッシュボード設定で、ウィジェット定義、レイアウト情報、クエリ設定、可視化オプションを含みます。 |
| createdAt | long |  | ※ | 現在時刻 |  | 作成日時<br>UNIX 時間・ミリ秒<br/>※ サーバーが自動で設定 |
| updatedAt | long |  | ※ | 現在時刻 |  | 最終更新日時<br>UNIX 時間・ミリ秒<br/>※ サーバーが自動で設定 |

**関連するメソッド:**
describeDashboards - ダッシュボードの一覧を取得
createDashboard - ダッシュボードを新規作成
getDashboard - ダッシュボードを取得
updateDashboard - ダッシュボードを更新
duplicateDashboard - ダッシュボードを複製
deleteDashboard - ダッシュボードを削除




---

### FacetModel

ファセットモデル<br>

ログデータのフィルタリングと集計に使用できるファセットフィールドを定義します。ファセットにより、サービス名、メソッド、ステータス、カスタムフィールドなどの特定のディメンションでログ検索結果を絞り込めます。



|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| facetModelId | string |  | ※ |  |  ~ 1024文字 | ファセットモデルGRN<br>※ サーバーが自動で設定 |
| field | string |  | ✓ |  |  ~ 128文字 | ファセットのフィールド名<br>このファセットが対象とするログフィールドの名前です（例："service"、"method"、"status"）。 |
| type | 文字列列挙型<br>enum {<br>&nbsp;&nbsp;"string",<br>&nbsp;&nbsp;"double",<br>&nbsp;&nbsp;"measure"<br>}<br> |  | ✓ |  |  | ファセットのデータ型<br>ファセットフィールドのデータ型です。"string" は値のカウント付きカテゴリ値、"double" は範囲フィルタリング付き数値、"measure" は統計分析付き測定値に使用します。"string": 文字列 / "double": 数値 / "measure": 測定値 /  |
| displayName | string |  | ✓ |  |  ~ 128文字 | 表示用の名前<br>このファセットの人間が読める名前で、ログ検索UIに表示されます。 |
| order | int |  |  | 0 | 0 ~ 100000 | 表示順<br>UIでこのファセットを表示する際の並び順です。値が小さいほど先に表示されます。 |

**関連するメソッド:**
describeFacetModels - ファセットモデルの一覧を取得
createFacetModel - ファセットモデルを新規作成
getFacetModel - ファセットモデルを取得
updateFacetModel - ファセットモデルを更新
deleteFacetModel - ファセットモデルを削除




---

### MetricModel

メトリックモデル<br>

監視および可視化できるメトリクスを定義します。事前定義されたメトリクスには、各GS2マイクロサービスのリクエスト数、リクエスト時間、エラー率（4xx/5xx）が含まれます。各メトリクスにはグループ化とフィルタリングのための関連ラベルがあります。



|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| name | string |  | ✓ |  |  ~ 128文字 | メトリック名<br>このメトリクスの一意の識別子です（例："RequestCount"、"RequestDuration"、"Error4xxCount"、"Error5xxCount"）。サービス固有のメトリクスにはサービス名がプレフィックスとして付きます。 |
| type | 文字列列挙型<br>enum {<br>&nbsp;&nbsp;"string",<br>&nbsp;&nbsp;"double",<br>&nbsp;&nbsp;"measure"<br>}<br> |  | ✓ |  |  | メトリックのデータ型<br>メトリクス値のデータ型です。"double" は数値カウントに使用され、"measure" は時間/レイテンシの測定に使用されます。"string": 文字列 / "double": 数値 / "measure": 測定値 /  |
| labels | List&lt;string&gt; |  |  | [] | 0 ~ 10 items | ラベル<br>このメトリクスに関連付けられたラベル名で、メトリクスデータのグループ化とフィルタリングに使用されます（例："service"、"method"、"namespaceName"）。ラベルはメトリクスを分解できるディメンションを定義します。 |

**関連するメソッド:**
describeMetrics - メトリクスモデルの一覧を取得




---

### AggregationConfig

集計設定<br>

時系列データをクエリする際のログデータまたはメトリクスの集計方法の設定です。集計関数（カウント、平均、パーセンタイルなど）と集計対象フィールドを指定します。



|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| type | 文字列列挙型<br>enum {<br>&nbsp;&nbsp;"count",<br>&nbsp;&nbsp;"unique",<br>&nbsp;&nbsp;"sum",<br>&nbsp;&nbsp;"avg",<br>&nbsp;&nbsp;"max",<br>&nbsp;&nbsp;"min",<br>&nbsp;&nbsp;"p90",<br>&nbsp;&nbsp;"p95",<br>&nbsp;&nbsp;"p99"<br>}<br> |  |  | "count" |  | 集計タイプ:<br>- `unique`: ユニークな値の数<br/>- `avg`: 平均値<br/>- `max`: 最大値<br/>- `min`: 最小値<br/>- `p90`: 90パーセンタイル<br/>- `p99`: 99パーセンタイル"count": レコード数 / "unique": ユニークな値の数 / "sum": 合計値 / "avg": 平均値 / "max": 最大値 / "min": 最小値 / "p90": 90パーセンタイル / "p95": 95パーセンタイル / "p99": 99パーセンタイル /  |
| field | string |  |  |  |  ~ 128文字 | 集計対象フィールド（count以外の場合に必要） |

**関連するメソッド:**
queryTimeseries - タイムシリーズクエリ(Log)




---

### Facet

ファセット<br>

ログデータに対するファセットクエリの結果で、特定フィールドの値の分布を含みます。文字列フィールドの場合は値のカウント、数値フィールドの場合は現在のフィルタ条件での値の範囲とUIスライダー表示用のグローバル範囲を提供します。



|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| field | string |  | ✓ |  |  ~ 128文字 | ファセットのフィールド名 |
| values | [List&lt;FacetValueCount&gt;](#facetvaluecount) |  |  | [] | 0 ~ 100 items | 文字列ファセットの値とカウントの配列 |
| range | [NumericRange](#numericrange) |  |  |  |  | 現在のフィルター条件での数値範囲 |
| globalRange | [NumericRange](#numericrange) |  |  |  |  | フィルター適用前の全データ範囲（UIのスライダー範囲に使用） |

**関連するメソッド:**
queryFacets - ファセットクエリ




---

### FacetValueCount

ファセット値のカウント<br>

文字列ファセット結果内の単一の値とその出現回数です。特定のファセットフィールドに対してどれだけのログエントリがその値を持っているかを表します。



|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| value | string |  | ✓ |  |  ~ 256文字 | ファセットの値 |
| count | long |  | ✓ |  | 0 ~ 9223372036854775805 | この値を持つログの件数 |

**関連するモデル:**
Facet - ファセット




---

### Label

ラベル<br>

分類、フィルタリング、グループ化のためにログエントリやメトリクスに付与されるキーバリューペアです。



|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| key | string |  | ✓ |  |  ~ 128文字 | ラベルのキー<br>このラベルのキー名です（例："service"、"method"、"namespaceName"）。 |
| value | string |  | ✓ |  |  ~ 256文字 | ラベルの値<br>キーに対応するこのラベルの値です。 |

**関連するメソッド:**
describeLabelValues - 特定のメトリクスのラベル値の一覧を取得


**関連するモデル:**
LogEntry - ログエントリ




---

### LogEntry

ログエントリ<br>

トレース内の単一のログレコードで、1つの処理ステップまたはAPI呼び出しを表します。生のログデータ、処理時間、重要度ステータス、および分類用の関連ラベルを含みます。



|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| timestamp | long |  | ✓ |  |  | タイムスタンプ<br>このログエントリが記録された日時です。 |
| status | 文字列列挙型<br>enum {<br>&nbsp;&nbsp;"ok",<br>&nbsp;&nbsp;"info",<br>&nbsp;&nbsp;"notice",<br>&nbsp;&nbsp;"error",<br>&nbsp;&nbsp;"warn",<br>&nbsp;&nbsp;"emag"<br>}<br> |  | ✓ |  |  | ステータス<br>このログエントリの重要度レベルで、情報レベルから緊急レベルまであります。"ok": 正常 / "info": 情報 / "notice": 通知 / "error": エラー / "warn": 警告 / "emag": 緊急 /  |
| duration | long |  |  | 0 | 0 ~ 9223372036854775805 | 処理時間（ナノ秒）<br>このログエントリの処理にかかった時間（ナノ秒）です。 |
| line | string |  | ✓ |  |  ~ 10485760文字 | ログ行の生データ<br>JSON形式の生ログデータで、リクエスト/レスポンス情報を含む処理ステップの詳細全体が含まれます。 |
| labels | [List&lt;Label&gt;](#label) |  |  | [] | 0 ~ 128 items | ラベル<br>分類とフィルタリングのためにこのログエントリに付与されたキーバリューペアです（例：サービス名、メソッド、リクエストID）。 |

**関連するメソッド:**
queryLog - ログエントリをクエリ（v2）
getLog - リクエストIDを指定してログエントリを取得


**関連するモデル:**
Trace - トレース




---

### NumericRange

数値の範囲。<br>
- `range`: 現在のフィルター条件での範囲（他のフィルターは適用、自身は除外）<br>
- `globalRange`: フィルター適用前の全データ範囲（UIのスライダー範囲に使用）



|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| min | double |  | ✓ |  | 0 ~ 281474976710654 | 最小値 |
| max | double |  | ✓ |  | 0 ~ 281474976710654 | 最大値 |

**関連するモデル:**
Facet - ファセット




---

### TimeseriesMetadata

時系列データのメタデータ<br>

時系列クエリ結果に関するメタデータで、データに含まれるシリーズキーとグループ化に使用されたフィールドを記述します。クライアントが時系列データを適切に解釈・表示するために使用されます。



|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| keys | List&lt;string&gt; |  |  | [] | 0 ~ 10 items | データに含まれるシリーズキーの一覧 |
| groupBy | List&lt;string&gt; |  |  | [] | 0 ~ 10 items | グループ化に使用されたフィールド |

**関連するメソッド:**
queryMetricsTimeseries - タイムシリーズクエリ(Metrics)
queryTimeseries - タイムシリーズクエリ(Log)




---

### TimeseriesPoint

時系列データポイント<br>

時系列における単一のデータポイントで、特定のタイムスタンプでの集計値を表します。グループ化が適用されている場合、それぞれ異なるグループに対応する1つ以上の値を含みます。



|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| timestamp | long |  | ✓ |  |  | タイムスタンプ |
| values | [List&lt;TimeseriesValue&gt;](#timeseriesvalue) |  |  | [] | 0 ~ 10000 items | このタイムスタンプでの各グループの値 |

**関連するメソッド:**
queryMetricsTimeseries - タイムシリーズクエリ(Metrics)
queryTimeseries - タイムシリーズクエリ(Log)




---

### TimeseriesValue

時系列データの値<br>

時系列データポイント内の単一の集計値で、グループごとにキーが付けられます。データがグループ化されている場合（例：サービスやメソッド別）、各グループに固有の値があり、グループ化なしの場合はキーは "count" です。



|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| key | string |  | ✓ |  |  ~ 256文字 | グループキー（グループ化なしの場合は \"count\"） |
| value | double |  | ✓ |  | 0 ~ 281474976710654 | 集計値 |

**関連するモデル:**
TimeseriesPoint - 時系列データポイント




---

### Trace

トレース<br>

マイクロサービス呼び出しにまたがる関連ログエントリ（スパン）を1つのリクエストフローにグループ化する分散トレースです。ユーザーのAPIリクエストが複数のGS2マイクロサービスを通じてどのように伝搬するかをエンドツーエンドで可視化できます。



|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| traceId | string |  | ✓ | UUID |  ~ 36文字 | トレースID<br>このトレースの一意の識別子で、リクエストフロー内のすべての関連ログエントリ（スパン）で共有されます。 |
| spans | [List&lt;LogEntry&gt;](#logentry) |  |  | [] | 0 ~ 100 items | スパン<br>このトレースを構成するログエントリ（スパン）のリストで、マイクロサービス間のリクエストフローにおける各処理ステップを表します。 |
| truncated | bool |  |  | false |  | 切り捨て<br>スパンリストがエントリの最大数を超えたため切り捨てられたかどうかを示します。trueの場合、トレース内の一部のスパンがレスポンスに含まれていません。 |

**関連するメソッド:**
getTrace - トレースIDを指定してトレースを取得




---

### InGameLogTag

ゲーム内ログのタグ<br>

インゲームログエントリのフィルタリングと分類に使用されるキーバリューペアです。各タグキーは1つのログエントリ内で一意でなければなりません。



|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| key | string |  | ✓ |  |  ~ 64文字 | タグ名<br>このタグのキー名です。インゲームログを検索する際のフィルタ条件として使用されます。 |
| value | string |  | ✓ |  |  ~ 128文字 | タグ値<br>このタグの値です。キーと組み合わせて、特定の条件でのログフィルタリングを可能にします（例：key="stageId", value="stage-001"）。 |

**関連するモデル:**
InGameLog - インゲームログ




---
## メソッド

### describeNamespaces

ネームスペースの一覧を取得<br>

プロジェクト内において、サービス単位で作成されたネームスペースの一覧を取得します。<br>
オプションのページトークンを使用して、リストの特定の位置からデータの取得を開始できます。<br>
また、取得するネームスペースの数を制限することも可能です。



#### Request

|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| pageToken | string |  | |  |  ~ 1024文字 | データの取得を開始する位置を指定するトークン |
| limit | int |  | | 30 | 1 ~ 1000 | データの取得件数 |

#### Result

|  | 型 | 説明 |
| --- | --- | --- |
| items | [List&lt;Namespace&gt;](#namespace) | ネームスペースのリスト |
| nextPageToken | string | リストの続きを取得するためのページトークン |

#### 実装例




**Go**
```go

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/log"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := log.Gs2LogRestClient{
    Session: &session,
}
result, err := client.DescribeNamespaces(
    &log.DescribeNamespacesRequest {
        PageToken: nil,
        Limit: nil,
    }
)
if err != nil {
    panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageToken

```

**PHP**
```php

use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Log\Gs2LogRestClient;
use Gs2\Log\Request\DescribeNamespacesRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2LogRestClient(
    $session
);

try {
    $result = $client->describeNamespaces(
        (new DescribeNamespacesRequest())
            ->withPageToken(null)
            ->withLimit(null)
    );
    $items = $result->getItems();
    $nextPageToken = $result->getNextPageToken();
} catch (Gs2Exception $e) {
    exit("error occurred")
}

```

**Java**
```java

import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.log.rest.Gs2LogRestClient;
import io.gs2.log.request.DescribeNamespacesRequest;
import io.gs2.log.result.DescribeNamespacesResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2LogRestClient client = new Gs2LogRestClient(session);

try {
    DescribeNamespacesResult result = client.describeNamespaces(
        new DescribeNamespacesRequest()
            .withPageToken(null)
            .withLimit(null)
    );
    List<Namespace> items = result.getItems();
    String nextPageToken = result.getNextPageToken();
} catch (Gs2Exception e) {
    System.exit(1);
}

```

**C#**
```csharp

using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2LogRestClient(session);

AsyncResult<Gs2.Gs2Log.Result.DescribeNamespacesResult> asyncResult = null;
yield return client.DescribeNamespaces(
    new Gs2.Gs2Log.Request.DescribeNamespacesRequest()
        .WithPageToken(null)
        .WithLimit(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
var nextPageToken = result.NextPageToken;

```

**TypeScript**
```typescript

import Gs2Core from '@/gs2/core';
import * as Gs2Log from '@/gs2/log';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Log.Gs2LogRestClient(session);

try {
    const result = await client.describeNamespaces(
        new Gs2Log.DescribeNamespacesRequest()
            .withPageToken(null)
            .withLimit(null)
    );
    const items = result.getItems();
    const nextPageToken = result.getNextPageToken();
} catch (e) {
    process.exit(1);
}

```

**Python**
```python

from gs2 import core
from gs2 import log

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = log.Gs2LogRestClient(session)

try:
    result = client.describe_namespaces(
        log.DescribeNamespacesRequest()
            .with_page_token(None)
            .with_limit(None)
    )
    items = result.items
    next_page_token = result.next_page_token
except core.Gs2Exception as e:
    exit(1)


```

**GS2-Script**
```lua

client = gs2('log')

api_result = client.describe_namespaces({
    pageToken=nil,
    limit=nil,
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;

```

**GS2-Script(Async)**
```lua

client = gs2('log')

api_result_handler = client.describe_namespaces_async({
    pageToken=nil,
    limit=nil,
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;

```




---

### createNamespace

ネームスペースを新規作成<br>

ネームスペースの名前、説明、および各種設定を含む詳細情報を指定する必要があります。



#### Request

|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| name | string |  | ✓|  |  ~ 128文字 | ネームスペース名<br>ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
| description | string |  | |  |  ~ 1024文字 | 説明文 |
| type | 文字列列挙型<br>enum {<br>&nbsp;&nbsp;"gs2",<br>&nbsp;&nbsp;"bigquery",<br>&nbsp;&nbsp;"firehose"<br>}<br> |  | | "gs2" |  | ログの書き出し方法<br>ログデータのエクスポート先を決定します。"gs2" はGS2のマネージドストレージにログを保存し、組み込みの検索・分析機能を利用できます。"bigquery" はGoogle BigQueryにログをエクスポートして高度な分析を行えます。"firehose" はAmazon Kinesis Data Firehoseにログをストリーミングし、S3やRedshiftなどのAWS送信先に配信します。"gs2": GS2による管理 / "bigquery": BigQuery への書き出し / "firehose": Kinesis Firehose への書き出し /  |
| gcpCredentialJson | string | {type} == "bigquery" | ✓※|  |  ~ 5120文字 | GCPのクレデンシャル<br>BigQueryへのログエクスポート時の認証に使用するGCPクレデンシャルJSONです。サービスアカウントには対象データセットに対するBigQuery Data Editor権限が必要です。<br>※ type が "bigquery" であれば必須 |
| bigQueryDatasetName | string | {type} == "bigquery" | ✓※|  |  ~ 1024文字 | BigQueryのデータセット名<br>ログデータのエクスポート先となるBigQueryデータセットの名前です。データセットは提供されたクレデンシャルに関連付けられたGCPプロジェクト内にあらかじめ存在している必要があります。<br>※ type が "bigquery" であれば必須 |
| logExpireDays | int | {type} in ["gs2", "bigquery"] | ✓※|  | 0 ~ 3650 | ログの保存期間(日)<br>ログデータを保持する日数です。この期間を超えたログは自動的に削除されます。エクスポート方法が "gs2" または "bigquery" の場合に適用されます。最大3650日（約10年）まで設定可能です。<br>※ type が "gs2","bigquery"であれば 必須 |
| awsRegion | string | {type} == "firehose" | ✓※|  |  ~ 256文字 | AWSのリージョン<br>Kinesis Data Firehose配信ストリームが存在するAWSリージョンです（例：us-east-1、ap-northeast-1）。<br>※ type が "firehose" であれば必須 |
| awsAccessKeyId | string | {type} == "firehose" | ✓※|  |  ~ 256文字 | AWSのアクセスキーID<br>Kinesis Data Firehoseへの認証に使用するAWSアクセスキーIDです。IAMユーザーには、指定されたFirehose配信ストリームへのレコード送信権限が必要です。<br>※ type が "firehose" であれば必須 |
| awsSecretAccessKey | string | {type} == "firehose" | ✓※|  |  ~ 256文字 | AWSのシークレットアクセスキー<br>Kinesis Data Firehose認証のためにアクセスキーIDと対になるAWSシークレットアクセスキーです。<br>※ type が "firehose" であれば必須 |
| firehoseStreamName | string | {type} == "firehose" | ✓※|  |  ~ 256文字 | Kinesis Firehose のストリーム名<br>ログデータの送信先となるKinesis Data Firehose配信ストリームの名前です。<br>※ type が "firehose" であれば必須 |
| firehoseCompressData | 文字列列挙型<br>enum {<br>&nbsp;&nbsp;"none",<br>&nbsp;&nbsp;"gzip"<br>}<br> | {type} == "firehose" | | "none" |  | Kinesis Firehose に出力するデータを圧縮するか<br>Kinesis Data Firehoseに送信する前にログデータを圧縮するかどうかの設定です。Gzip圧縮によりデータ転送量とストレージコストを削減できます。"none": 圧縮しない / "gzip": Gzip / <br>※ type が "firehose" であれば必須 |

#### Result

|  | 型 | 説明 |
| --- | --- | --- |
| item | [Namespace](#namespace) | 作成したネームスペース |

#### 実装例




**Go**
```go

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/log"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := log.Gs2LogRestClient{
    Session: &session,
}
result, err := client.CreateNamespace(
    &log.CreateNamespaceRequest {
        Name: pointy.String("namespace-0001"),
        Description: nil,
        Type: pointy.String("gs2"),
        GcpCredentialJson: pointy.String("{\"project_id\": \"gs2-dev\"}"),
        BigQueryDatasetName: pointy.String("dataset_0001"),
        LogExpireDays: pointy.Int32(3),
        AwsRegion: pointy.String("awsRegion"),
        AwsAccessKeyId: pointy.String("awsAccessKeyId"),
        AwsSecretAccessKey: pointy.String("awsSecretAccessKey"),
        FirehoseStreamName: pointy.String("firehoseStreamName"),
        FirehoseCompressData: nil,
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item

```

**PHP**
```php

use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Log\Gs2LogRestClient;
use Gs2\Log\Request\CreateNamespaceRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2LogRestClient(
    $session
);

try {
    $result = $client->createNamespace(
        (new CreateNamespaceRequest())
            ->withName("namespace-0001")
            ->withDescription(null)
            ->withType("gs2")
            ->withGcpCredentialJson("{\"project_id\": \"gs2-dev\"}")
            ->withBigQueryDatasetName("dataset_0001")
            ->withLogExpireDays(3)
            ->withAwsRegion("awsRegion")
            ->withAwsAccessKeyId("awsAccessKeyId")
            ->withAwsSecretAccessKey("awsSecretAccessKey")
            ->withFirehoseStreamName("firehoseStreamName")
            ->withFirehoseCompressData(null)
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}

```

**Java**
```java

import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.log.rest.Gs2LogRestClient;
import io.gs2.log.request.CreateNamespaceRequest;
import io.gs2.log.result.CreateNamespaceResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2LogRestClient client = new Gs2LogRestClient(session);

try {
    CreateNamespaceResult result = client.createNamespace(
        new CreateNamespaceRequest()
            .withName("namespace-0001")
            .withDescription(null)
            .withType("gs2")
            .withGcpCredentialJson("{\"project_id\": \"gs2-dev\"}")
            .withBigQueryDatasetName("dataset_0001")
            .withLogExpireDays(3)
            .withAwsRegion("awsRegion")
            .withAwsAccessKeyId("awsAccessKeyId")
            .withAwsSecretAccessKey("awsSecretAccessKey")
            .withFirehoseStreamName("firehoseStreamName")
            .withFirehoseCompressData(null)
    );
    Namespace item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}

```

**C#**
```csharp

using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2LogRestClient(session);

AsyncResult<Gs2.Gs2Log.Result.CreateNamespaceResult> asyncResult = null;
yield return client.CreateNamespace(
    new Gs2.Gs2Log.Request.CreateNamespaceRequest()
        .WithName("namespace-0001")
        .WithDescription(null)
        .WithType("gs2")
        .WithGcpCredentialJson("{\"project_id\": \"gs2-dev\"}")
        .WithBigQueryDatasetName("dataset_0001")
        .WithLogExpireDays(3)
        .WithAwsRegion("awsRegion")
        .WithAwsAccessKeyId("awsAccessKeyId")
        .WithAwsSecretAccessKey("awsSecretAccessKey")
        .WithFirehoseStreamName("firehoseStreamName")
        .WithFirehoseCompressData(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;

```

**TypeScript**
```typescript

import Gs2Core from '@/gs2/core';
import * as Gs2Log from '@/gs2/log';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Log.Gs2LogRestClient(session);

try {
    const result = await client.createNamespace(
        new Gs2Log.CreateNamespaceRequest()
            .withName("namespace-0001")
            .withDescription(null)
            .withType("gs2")
            .withGcpCredentialJson("{\"project_id\": \"gs2-dev\"}")
            .withBigQueryDatasetName("dataset_0001")
            .withLogExpireDays(3)
            .withAwsRegion("awsRegion")
            .withAwsAccessKeyId("awsAccessKeyId")
            .withAwsSecretAccessKey("awsSecretAccessKey")
            .withFirehoseStreamName("firehoseStreamName")
            .withFirehoseCompressData(null)
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}

```

**Python**
```python

from gs2 import core
from gs2 import log

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = log.Gs2LogRestClient(session)

try:
    result = client.create_namespace(
        log.CreateNamespaceRequest()
            .with_name('namespace-0001')
            .with_description(None)
            .with_type('gs2')
            .with_gcp_credential_json('{"project_id": "gs2-dev"}')
            .with_big_query_dataset_name('dataset_0001')
            .with_log_expire_days(3)
            .with_aws_region('awsRegion')
            .with_aws_access_key_id('awsAccessKeyId')
            .with_aws_secret_access_key('awsSecretAccessKey')
            .with_firehose_stream_name('firehoseStreamName')
            .with_firehose_compress_data(None)
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)


```

**GS2-Script**
```lua

client = gs2('log')

api_result = client.create_namespace({
    name="namespace-0001",
    description=nil,
    type="gs2",
    gcpCredentialJson="{\"project_id\": \"gs2-dev\"}",
    bigQueryDatasetName="dataset_0001",
    logExpireDays=3,
    awsRegion="awsRegion",
    awsAccessKeyId="awsAccessKeyId",
    awsSecretAccessKey="awsSecretAccessKey",
    firehoseStreamName="firehoseStreamName",
    firehoseCompressData=nil,
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;

```

**GS2-Script(Async)**
```lua

client = gs2('log')

api_result_handler = client.create_namespace_async({
    name="namespace-0001",
    description=nil,
    type="gs2",
    gcpCredentialJson="{\"project_id\": \"gs2-dev\"}",
    bigQueryDatasetName="dataset_0001",
    logExpireDays=3,
    awsRegion="awsRegion",
    awsAccessKeyId="awsAccessKeyId",
    awsSecretAccessKey="awsSecretAccessKey",
    firehoseStreamName="firehoseStreamName",
    firehoseCompressData=nil,
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;

```




---

### getNamespaceStatus

ネームスペースの状態を取得<br>

指定されたネームスペースの現在の状態を取得します。<br>
これには、ネームスペースがアクティブか、保留中か、またはその他の状態にあるかが含まれます。



#### Request

|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| namespaceName | string |  | ✓|  |  ~ 128文字 | ネームスペース名<br>ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |

#### Result

|  | 型 | 説明 |
| --- | --- | --- |
| status | string |  |

#### 実装例




**Go**
```go

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/log"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := log.Gs2LogRestClient{
    Session: &session,
}
result, err := client.GetNamespaceStatus(
    &log.GetNamespaceStatusRequest {
        NamespaceName: pointy.String("namespace-0001"),
    }
)
if err != nil {
    panic("error occurred")
}
status := result.Status

```

**PHP**
```php

use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Log\Gs2LogRestClient;
use Gs2\Log\Request\GetNamespaceStatusRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2LogRestClient(
    $session
);

try {
    $result = $client->getNamespaceStatus(
        (new GetNamespaceStatusRequest())
            ->withNamespaceName("namespace-0001")
    );
    $status = $result->getStatus();
} catch (Gs2Exception $e) {
    exit("error occurred")
}

```

**Java**
```java

import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.log.rest.Gs2LogRestClient;
import io.gs2.log.request.GetNamespaceStatusRequest;
import io.gs2.log.result.GetNamespaceStatusResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2LogRestClient client = new Gs2LogRestClient(session);

try {
    GetNamespaceStatusResult result = client.getNamespaceStatus(
        new GetNamespaceStatusRequest()
            .withNamespaceName("namespace-0001")
    );
    String status = result.getStatus();
} catch (Gs2Exception e) {
    System.exit(1);
}

```

**C#**
```csharp

using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2LogRestClient(session);

AsyncResult<Gs2.Gs2Log.Result.GetNamespaceStatusResult> asyncResult = null;
yield return client.GetNamespaceStatus(
    new Gs2.Gs2Log.Request.GetNamespaceStatusRequest()
        .WithNamespaceName("namespace-0001"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var status = result.Status;

```

**TypeScript**
```typescript

import Gs2Core from '@/gs2/core';
import * as Gs2Log from '@/gs2/log';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Log.Gs2LogRestClient(session);

try {
    const result = await client.getNamespaceStatus(
        new Gs2Log.GetNamespaceStatusRequest()
            .withNamespaceName("namespace-0001")
    );
    const status = result.getStatus();
} catch (e) {
    process.exit(1);
}

```

**Python**
```python

from gs2 import core
from gs2 import log

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = log.Gs2LogRestClient(session)

try:
    result = client.get_namespace_status(
        log.GetNamespaceStatusRequest()
            .with_namespace_name('namespace-0001')
    )
    status = result.status
except core.Gs2Exception as e:
    exit(1)


```

**GS2-Script**
```lua

client = gs2('log')

api_result = client.get_namespace_status({
    namespaceName="namespace-0001",
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
status = result.status;

```

**GS2-Script(Async)**
```lua

client = gs2('log')

api_result_handler = client.get_namespace_status_async({
    namespaceName="namespace-0001",
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
status = result.status;

```




---

### getNamespace

ネームスペースを取得<br>

指定されたネームスペースの詳細情報を取得します。<br>
これには、ネームスペースの名前、説明、およびその他の設定情報が含まれます。



#### Request

|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| namespaceName | string |  | ✓|  |  ~ 128文字 | ネームスペース名<br>ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |

#### Result

|  | 型 | 説明 |
| --- | --- | --- |
| item | [Namespace](#namespace) | ネームスペース |

#### 実装例




**Go**
```go

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/log"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := log.Gs2LogRestClient{
    Session: &session,
}
result, err := client.GetNamespace(
    &log.GetNamespaceRequest {
        NamespaceName: pointy.String("namespace-0001"),
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item

```

**PHP**
```php

use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Log\Gs2LogRestClient;
use Gs2\Log\Request\GetNamespaceRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2LogRestClient(
    $session
);

try {
    $result = $client->getNamespace(
        (new GetNamespaceRequest())
            ->withNamespaceName("namespace-0001")
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}

```

**Java**
```java

import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.log.rest.Gs2LogRestClient;
import io.gs2.log.request.GetNamespaceRequest;
import io.gs2.log.result.GetNamespaceResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2LogRestClient client = new Gs2LogRestClient(session);

try {
    GetNamespaceResult result = client.getNamespace(
        new GetNamespaceRequest()
            .withNamespaceName("namespace-0001")
    );
    Namespace item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}

```

**C#**
```csharp

using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2LogRestClient(session);

AsyncResult<Gs2.Gs2Log.Result.GetNamespaceResult> asyncResult = null;
yield return client.GetNamespace(
    new Gs2.Gs2Log.Request.GetNamespaceRequest()
        .WithNamespaceName("namespace-0001"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;

```

**TypeScript**
```typescript

import Gs2Core from '@/gs2/core';
import * as Gs2Log from '@/gs2/log';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Log.Gs2LogRestClient(session);

try {
    const result = await client.getNamespace(
        new Gs2Log.GetNamespaceRequest()
            .withNamespaceName("namespace-0001")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}

```

**Python**
```python

from gs2 import core
from gs2 import log

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = log.Gs2LogRestClient(session)

try:
    result = client.get_namespace(
        log.GetNamespaceRequest()
            .with_namespace_name('namespace-0001')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)


```

**GS2-Script**
```lua

client = gs2('log')

api_result = client.get_namespace({
    namespaceName="namespace-0001",
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;

```

**GS2-Script(Async)**
```lua

client = gs2('log')

api_result_handler = client.get_namespace_async({
    namespaceName="namespace-0001",
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;

```




---

### updateNamespace

ネームスペースを更新<br>

指定されたネームスペースの設定を更新します。<br>
ネームスペースの説明や、特定の設定を変更することができます。



#### Request

|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| namespaceName | string |  | ✓|  |  ~ 128文字 | ネームスペース名<br>ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
| description | string |  | |  |  ~ 1024文字 | 説明文 |
| type | 文字列列挙型<br>enum {<br>&nbsp;&nbsp;"gs2",<br>&nbsp;&nbsp;"bigquery",<br>&nbsp;&nbsp;"firehose"<br>}<br> |  | | "gs2" |  | ログの書き出し方法<br>ログデータのエクスポート先を決定します。"gs2" はGS2のマネージドストレージにログを保存し、組み込みの検索・分析機能を利用できます。"bigquery" はGoogle BigQueryにログをエクスポートして高度な分析を行えます。"firehose" はAmazon Kinesis Data Firehoseにログをストリーミングし、S3やRedshiftなどのAWS送信先に配信します。"gs2": GS2による管理 / "bigquery": BigQuery への書き出し / "firehose": Kinesis Firehose への書き出し /  |
| gcpCredentialJson | string | {type} == "bigquery" | ✓※|  |  ~ 5120文字 | GCPのクレデンシャル<br>BigQueryへのログエクスポート時の認証に使用するGCPクレデンシャルJSONです。サービスアカウントには対象データセットに対するBigQuery Data Editor権限が必要です。<br>※ type が "bigquery" であれば必須 |
| bigQueryDatasetName | string | {type} == "bigquery" | ✓※|  |  ~ 1024文字 | BigQueryのデータセット名<br>ログデータのエクスポート先となるBigQueryデータセットの名前です。データセットは提供されたクレデンシャルに関連付けられたGCPプロジェクト内にあらかじめ存在している必要があります。<br>※ type が "bigquery" であれば必須 |
| logExpireDays | int | {type} in ["gs2", "bigquery"] | ✓※|  | 0 ~ 3650 | ログの保存期間(日)<br>ログデータを保持する日数です。この期間を超えたログは自動的に削除されます。エクスポート方法が "gs2" または "bigquery" の場合に適用されます。最大3650日（約10年）まで設定可能です。<br>※ type が "gs2","bigquery"であれば 必須 |
| awsRegion | string | {type} == "firehose" | ✓※|  |  ~ 256文字 | AWSのリージョン<br>Kinesis Data Firehose配信ストリームが存在するAWSリージョンです（例：us-east-1、ap-northeast-1）。<br>※ type が "firehose" であれば必須 |
| awsAccessKeyId | string | {type} == "firehose" | ✓※|  |  ~ 256文字 | AWSのアクセスキーID<br>Kinesis Data Firehoseへの認証に使用するAWSアクセスキーIDです。IAMユーザーには、指定されたFirehose配信ストリームへのレコード送信権限が必要です。<br>※ type が "firehose" であれば必須 |
| awsSecretAccessKey | string | {type} == "firehose" | ✓※|  |  ~ 256文字 | AWSのシークレットアクセスキー<br>Kinesis Data Firehose認証のためにアクセスキーIDと対になるAWSシークレットアクセスキーです。<br>※ type が "firehose" であれば必須 |
| firehoseStreamName | string | {type} == "firehose" | ✓※|  |  ~ 256文字 | Kinesis Firehose のストリーム名<br>ログデータの送信先となるKinesis Data Firehose配信ストリームの名前です。<br>※ type が "firehose" であれば必須 |
| firehoseCompressData | 文字列列挙型<br>enum {<br>&nbsp;&nbsp;"none",<br>&nbsp;&nbsp;"gzip"<br>}<br> | {type} == "firehose" | | "none" |  | Kinesis Firehose に出力するデータを圧縮するか<br>Kinesis Data Firehoseに送信する前にログデータを圧縮するかどうかの設定です。Gzip圧縮によりデータ転送量とストレージコストを削減できます。"none": 圧縮しない / "gzip": Gzip / <br>※ type が "firehose" であれば必須 |

#### Result

|  | 型 | 説明 |
| --- | --- | --- |
| item | [Namespace](#namespace) | 更新したネームスペース |

#### 実装例




**Go**
```go

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/log"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := log.Gs2LogRestClient{
    Session: &session,
}
result, err := client.UpdateNamespace(
    &log.UpdateNamespaceRequest {
        NamespaceName: pointy.String("namespace-0001"),
        Description: pointy.String("description1"),
        Type: pointy.String("firehose"),
        GcpCredentialJson: pointy.String("{\"project_id\": \"gs2-dev\"}"),
        BigQueryDatasetName: pointy.String("dataset_0001"),
        LogExpireDays: pointy.Int32(3),
        AwsRegion: pointy.String("awsRegion"),
        AwsAccessKeyId: pointy.String("awsAccessKeyId"),
        AwsSecretAccessKey: pointy.String("awsSecretAccessKey"),
        FirehoseStreamName: pointy.String("firehoseStreamName"),
        FirehoseCompressData: nil,
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item

```

**PHP**
```php

use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Log\Gs2LogRestClient;
use Gs2\Log\Request\UpdateNamespaceRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2LogRestClient(
    $session
);

try {
    $result = $client->updateNamespace(
        (new UpdateNamespaceRequest())
            ->withNamespaceName("namespace-0001")
            ->withDescription("description1")
            ->withType("firehose")
            ->withGcpCredentialJson("{\"project_id\": \"gs2-dev\"}")
            ->withBigQueryDatasetName("dataset_0001")
            ->withLogExpireDays(3)
            ->withAwsRegion("awsRegion")
            ->withAwsAccessKeyId("awsAccessKeyId")
            ->withAwsSecretAccessKey("awsSecretAccessKey")
            ->withFirehoseStreamName("firehoseStreamName")
            ->withFirehoseCompressData(null)
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}

```

**Java**
```java

import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.log.rest.Gs2LogRestClient;
import io.gs2.log.request.UpdateNamespaceRequest;
import io.gs2.log.result.UpdateNamespaceResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2LogRestClient client = new Gs2LogRestClient(session);

try {
    UpdateNamespaceResult result = client.updateNamespace(
        new UpdateNamespaceRequest()
            .withNamespaceName("namespace-0001")
            .withDescription("description1")
            .withType("firehose")
            .withGcpCredentialJson("{\"project_id\": \"gs2-dev\"}")
            .withBigQueryDatasetName("dataset_0001")
            .withLogExpireDays(3)
            .withAwsRegion("awsRegion")
            .withAwsAccessKeyId("awsAccessKeyId")
            .withAwsSecretAccessKey("awsSecretAccessKey")
            .withFirehoseStreamName("firehoseStreamName")
            .withFirehoseCompressData(null)
    );
    Namespace item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}

```

**C#**
```csharp

using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2LogRestClient(session);

AsyncResult<Gs2.Gs2Log.Result.UpdateNamespaceResult> asyncResult = null;
yield return client.UpdateNamespace(
    new Gs2.Gs2Log.Request.UpdateNamespaceRequest()
        .WithNamespaceName("namespace-0001")
        .WithDescription("description1")
        .WithType("firehose")
        .WithGcpCredentialJson("{\"project_id\": \"gs2-dev\"}")
        .WithBigQueryDatasetName("dataset_0001")
        .WithLogExpireDays(3)
        .WithAwsRegion("awsRegion")
        .WithAwsAccessKeyId("awsAccessKeyId")
        .WithAwsSecretAccessKey("awsSecretAccessKey")
        .WithFirehoseStreamName("firehoseStreamName")
        .WithFirehoseCompressData(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;

```

**TypeScript**
```typescript

import Gs2Core from '@/gs2/core';
import * as Gs2Log from '@/gs2/log';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Log.Gs2LogRestClient(session);

try {
    const result = await client.updateNamespace(
        new Gs2Log.UpdateNamespaceRequest()
            .withNamespaceName("namespace-0001")
            .withDescription("description1")
            .withType("firehose")
            .withGcpCredentialJson("{\"project_id\": \"gs2-dev\"}")
            .withBigQueryDatasetName("dataset_0001")
            .withLogExpireDays(3)
            .withAwsRegion("awsRegion")
            .withAwsAccessKeyId("awsAccessKeyId")
            .withAwsSecretAccessKey("awsSecretAccessKey")
            .withFirehoseStreamName("firehoseStreamName")
            .withFirehoseCompressData(null)
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}

```

**Python**
```python

from gs2 import core
from gs2 import log

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = log.Gs2LogRestClient(session)

try:
    result = client.update_namespace(
        log.UpdateNamespaceRequest()
            .with_namespace_name('namespace-0001')
            .with_description('description1')
            .with_type('firehose')
            .with_gcp_credential_json('{"project_id": "gs2-dev"}')
            .with_big_query_dataset_name('dataset_0001')
            .with_log_expire_days(3)
            .with_aws_region('awsRegion')
            .with_aws_access_key_id('awsAccessKeyId')
            .with_aws_secret_access_key('awsSecretAccessKey')
            .with_firehose_stream_name('firehoseStreamName')
            .with_firehose_compress_data(None)
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)


```

**GS2-Script**
```lua

client = gs2('log')

api_result = client.update_namespace({
    namespaceName="namespace-0001",
    description="description1",
    type="firehose",
    gcpCredentialJson="{\"project_id\": \"gs2-dev\"}",
    bigQueryDatasetName="dataset_0001",
    logExpireDays=3,
    awsRegion="awsRegion",
    awsAccessKeyId="awsAccessKeyId",
    awsSecretAccessKey="awsSecretAccessKey",
    firehoseStreamName="firehoseStreamName",
    firehoseCompressData=nil,
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;

```

**GS2-Script(Async)**
```lua

client = gs2('log')

api_result_handler = client.update_namespace_async({
    namespaceName="namespace-0001",
    description="description1",
    type="firehose",
    gcpCredentialJson="{\"project_id\": \"gs2-dev\"}",
    bigQueryDatasetName="dataset_0001",
    logExpireDays=3,
    awsRegion="awsRegion",
    awsAccessKeyId="awsAccessKeyId",
    awsSecretAccessKey="awsSecretAccessKey",
    firehoseStreamName="firehoseStreamName",
    firehoseCompressData=nil,
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;

```




---

### deleteNamespace

ネームスペースを削除<br>

指定されたネームスペースを削除します。<br>
この操作は不可逆であり、削除されたネームスペースに関連するすべてのデータは回復不能になります。



#### Request

|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| namespaceName | string |  | ✓|  |  ~ 128文字 | ネームスペース名<br>ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |

#### Result

|  | 型 | 説明 |
| --- | --- | --- |
| item | [Namespace](#namespace) | 削除したネームスペース |

#### 実装例




**Go**
```go

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/log"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := log.Gs2LogRestClient{
    Session: &session,
}
result, err := client.DeleteNamespace(
    &log.DeleteNamespaceRequest {
        NamespaceName: pointy.String("namespace-0001"),
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item

```

**PHP**
```php

use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Log\Gs2LogRestClient;
use Gs2\Log\Request\DeleteNamespaceRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2LogRestClient(
    $session
);

try {
    $result = $client->deleteNamespace(
        (new DeleteNamespaceRequest())
            ->withNamespaceName("namespace-0001")
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}

```

**Java**
```java

import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.log.rest.Gs2LogRestClient;
import io.gs2.log.request.DeleteNamespaceRequest;
import io.gs2.log.result.DeleteNamespaceResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2LogRestClient client = new Gs2LogRestClient(session);

try {
    DeleteNamespaceResult result = client.deleteNamespace(
        new DeleteNamespaceRequest()
            .withNamespaceName("namespace-0001")
    );
    Namespace item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}

```

**C#**
```csharp

using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2LogRestClient(session);

AsyncResult<Gs2.Gs2Log.Result.DeleteNamespaceResult> asyncResult = null;
yield return client.DeleteNamespace(
    new Gs2.Gs2Log.Request.DeleteNamespaceRequest()
        .WithNamespaceName("namespace-0001"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;

```

**TypeScript**
```typescript

import Gs2Core from '@/gs2/core';
import * as Gs2Log from '@/gs2/log';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Log.Gs2LogRestClient(session);

try {
    const result = await client.deleteNamespace(
        new Gs2Log.DeleteNamespaceRequest()
            .withNamespaceName("namespace-0001")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}

```

**Python**
```python

from gs2 import core
from gs2 import log

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = log.Gs2LogRestClient(session)

try:
    result = client.delete_namespace(
        log.DeleteNamespaceRequest()
            .with_namespace_name('namespace-0001')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)


```

**GS2-Script**
```lua

client = gs2('log')

api_result = client.delete_namespace({
    namespaceName="namespace-0001",
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;

```

**GS2-Script(Async)**
```lua

client = gs2('log')

api_result_handler = client.delete_namespace_async({
    namespaceName="namespace-0001",
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;

```




---

### getServiceVersion

マイクロサービスのバージョンを取得



#### Request

リクエストパラメータ: なし

#### Result

|  | 型 | 説明 |
| --- | --- | --- |
| item | string | バージョン |

#### 実装例




**Go**
```go

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/log"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := log.Gs2LogRestClient{
    Session: &session,
}
result, err := client.GetServiceVersion(
    &log.GetServiceVersionRequest {
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item

```

**PHP**
```php

use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Log\Gs2LogRestClient;
use Gs2\Log\Request\GetServiceVersionRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2LogRestClient(
    $session
);

try {
    $result = $client->getServiceVersion(
        (new GetServiceVersionRequest())
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}

```

**Java**
```java

import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.log.rest.Gs2LogRestClient;
import io.gs2.log.request.GetServiceVersionRequest;
import io.gs2.log.result.GetServiceVersionResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2LogRestClient client = new Gs2LogRestClient(session);

try {
    GetServiceVersionResult result = client.getServiceVersion(
        new GetServiceVersionRequest()
    );
    String item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}

```

**C#**
```csharp

using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2LogRestClient(session);

AsyncResult<Gs2.Gs2Log.Result.GetServiceVersionResult> asyncResult = null;
yield return client.GetServiceVersion(
    new Gs2.Gs2Log.Request.GetServiceVersionRequest(),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;

```

**TypeScript**
```typescript

import Gs2Core from '@/gs2/core';
import * as Gs2Log from '@/gs2/log';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Log.Gs2LogRestClient(session);

try {
    const result = await client.getServiceVersion(
        new Gs2Log.GetServiceVersionRequest()
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}

```

**Python**
```python

from gs2 import core
from gs2 import log

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = log.Gs2LogRestClient(session)

try:
    result = client.get_service_version(
        log.GetServiceVersionRequest()
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)


```

**GS2-Script**
```lua

client = gs2('log')

api_result = client.get_service_version({
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;

```

**GS2-Script(Async)**
```lua

client = gs2('log')

api_result_handler = client.get_service_version_async({
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;

```




---

### queryAccessLog

アクセスログの一覧を取得<br>

指定された時間範囲内のアクセスログをクエリします。サービス、メソッド、ユーザーIDによるフィルタリングが可能です。<br>
結果には総件数とスキャンサイズ（バイト）が含まれます。7日を超える期間を検索する場合は longTerm フラグを有効にする必要があり、スキャン容量の増加によりAPI実行料金が増加する場合があります。



#### Request

|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| namespaceName | string |  | ✓|  |  ~ 128文字 | ネームスペース名<br>ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
| service | string |  | |  |  ~ 1024文字 | マイクロサービスの種類<br>リクエストを処理したGS2マイクロサービスの名前です（例：account、inventory、limit）。 |
| method | string |  | |  |  ~ 1024文字 | マイクロサービスのメソッド<br>マイクロサービス上で呼び出された具体的なAPIメソッドです（例：createNamespace、getItem）。 |
| userId | string |  | |  |  ~ 128文字 | ユーザーID |
| begin | long |  | | 現在時刻から1時間前の絶対時刻 |  | 検索範囲開始日時 |
| end | long |  | | 現在時刻 |  | 検索範囲終了日時 |
| longTerm | bool |  | | false |  | 7日より長い期間のログを検索対象とするか |
| pageToken | string |  | |  |  ~ 1024文字 | データの取得を開始する位置を指定するトークン |
| limit | int |  | | 30 | 1 ~ 100 | データの取得件数 |
| timeOffsetToken | string |  | |  |  ~ 1024文字 | タイムオフセットトークン |

#### Result

|  | 型 | 説明 |
| --- | --- | --- |
| items | [List&lt;AccessLog&gt;](#accesslog) | アクセスログのリスト |
| nextPageToken | string | リストの続きを取得するためのページトークン |
| totalCount | long | クエリ結果の総件数 |
| scanSize | long | 検索時にスキャンした総容量(bytes) |

#### 実装例




**Go**
```go

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/log"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := log.Gs2LogRestClient{
    Session: &session,
}
result, err := client.QueryAccessLog(
    &log.QueryAccessLogRequest {
        NamespaceName: pointy.String("namespace-0001"),
        Service: pointy.String("account"),
        Method: pointy.String("createAccount"),
        UserId: pointy.String("user-0001"),
        Begin: pointy.Int64(1473174000000),
        End: pointy.Int64(1473177600000),
        LongTerm: pointy.Bool(false),
        PageToken: nil,
        Limit: nil,
        TimeOffsetToken: nil,
    }
)
if err != nil {
    panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageToken
totalCount := result.TotalCount
scanSize := result.ScanSize

```

**PHP**
```php

use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Log\Gs2LogRestClient;
use Gs2\Log\Request\QueryAccessLogRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2LogRestClient(
    $session
);

try {
    $result = $client->queryAccessLog(
        (new QueryAccessLogRequest())
            ->withNamespaceName("namespace-0001")
            ->withService("account")
            ->withMethod("createAccount")
            ->withUserId("user-0001")
            ->withBegin(1473174000000)
            ->withEnd(1473177600000)
            ->withLongTerm(false)
            ->withPageToken(null)
            ->withLimit(null)
            ->withTimeOffsetToken(null)
    );
    $items = $result->getItems();
    $nextPageToken = $result->getNextPageToken();
    $totalCount = $result->getTotalCount();
    $scanSize = $result->getScanSize();
} catch (Gs2Exception $e) {
    exit("error occurred")
}

```

**Java**
```java

import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.log.rest.Gs2LogRestClient;
import io.gs2.log.request.QueryAccessLogRequest;
import io.gs2.log.result.QueryAccessLogResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2LogRestClient client = new Gs2LogRestClient(session);

try {
    QueryAccessLogResult result = client.queryAccessLog(
        new QueryAccessLogRequest()
            .withNamespaceName("namespace-0001")
            .withService("account")
            .withMethod("createAccount")
            .withUserId("user-0001")
            .withBegin(1473174000000L)
            .withEnd(1473177600000L)
            .withLongTerm(false)
            .withPageToken(null)
            .withLimit(null)
            .withTimeOffsetToken(null)
    );
    List<AccessLog> items = result.getItems();
    String nextPageToken = result.getNextPageToken();
    long totalCount = result.getTotalCount();
    long scanSize = result.getScanSize();
} catch (Gs2Exception e) {
    System.exit(1);
}

```

**C#**
```csharp

using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2LogRestClient(session);

AsyncResult<Gs2.Gs2Log.Result.QueryAccessLogResult> asyncResult = null;
yield return client.QueryAccessLog(
    new Gs2.Gs2Log.Request.QueryAccessLogRequest()
        .WithNamespaceName("namespace-0001")
        .WithService("account")
        .WithMethod("createAccount")
        .WithUserId("user-0001")
        .WithBegin(1473174000000L)
        .WithEnd(1473177600000L)
        .WithLongTerm(false)
        .WithPageToken(null)
        .WithLimit(null)
        .WithTimeOffsetToken(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
var nextPageToken = result.NextPageToken;
var totalCount = result.TotalCount;
var scanSize = result.ScanSize;

```

**TypeScript**
```typescript

import Gs2Core from '@/gs2/core';
import * as Gs2Log from '@/gs2/log';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Log.Gs2LogRestClient(session);

try {
    const result = await client.queryAccessLog(
        new Gs2Log.QueryAccessLogRequest()
            .withNamespaceName("namespace-0001")
            .withService("account")
            .withMethod("createAccount")
            .withUserId("user-0001")
            .withBegin(1473174000000)
            .withEnd(1473177600000)
            .withLongTerm(false)
            .withPageToken(null)
            .withLimit(null)
            .withTimeOffsetToken(null)
    );
    const items = result.getItems();
    const nextPageToken = result.getNextPageToken();
    const totalCount = result.getTotalCount();
    const scanSize = result.getScanSize();
} catch (e) {
    process.exit(1);
}

```

**Python**
```python

from gs2 import core
from gs2 import log

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = log.Gs2LogRestClient(session)

try:
    result = client.query_access_log(
        log.QueryAccessLogRequest()
            .with_namespace_name('namespace-0001')
            .with_service('account')
            .with_method('createAccount')
            .with_user_id('user-0001')
            .with_begin(1473174000000)
            .with_end(1473177600000)
            .with_long_term(False)
            .with_page_token(None)
            .with_limit(None)
            .with_time_offset_token(None)
    )
    items = result.items
    next_page_token = result.next_page_token
    total_count = result.total_count
    scan_size = result.scan_size
except core.Gs2Exception as e:
    exit(1)


```

**GS2-Script**
```lua

client = gs2('log')

api_result = client.query_access_log({
    namespaceName="namespace-0001",
    service="account",
    method="createAccount",
    userId="user-0001",
    begin=1473174000000,
    end=1473177600000,
    longTerm=false,
    pageToken=nil,
    limit=nil,
    timeOffsetToken=nil,
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;
totalCount = result.totalCount;
scanSize = result.scanSize;

```

**GS2-Script(Async)**
```lua

client = gs2('log')

api_result_handler = client.query_access_log_async({
    namespaceName="namespace-0001",
    service="account",
    method="createAccount",
    userId="user-0001",
    begin=1473174000000,
    end=1473177600000,
    longTerm=false,
    pageToken=nil,
    limit=nil,
    timeOffsetToken=nil,
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;
totalCount = result.totalCount;
scanSize = result.scanSize;

```




---

### countAccessLog

アクセスログの集計結果を取得<br>

指定された時間範囲内のアクセスログ件数を集計します。サービス、メソッド、ユーザーIDによる分類が可能です。<br>
各分類フラグにより、その次元でのグループ化が制御されます。longTerm フラグを有効にすると、7日を超える期間を検索できます。



#### Request

|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| namespaceName | string |  | ✓|  |  ~ 128文字 | ネームスペース名<br>ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
| service | bool |  | | false |  | マイクロサービスの種類で分類するか |
| method | bool |  | | false |  | マイクロサービスのメソッドで分類するか |
| userId | bool |  | | false |  | ユーザーIDで分類するか |
| begin | long |  | | 現在時刻から1時間前の絶対時刻 |  | 検索範囲開始日時 |
| end | long |  | | 現在時刻 |  | 検索範囲終了日時 |
| longTerm | bool |  | | false |  | 7日より長い期間のログを検索対象とするか |
| pageToken | string |  | |  |  ~ 1024文字 | データの取得を開始する位置を指定するトークン |
| limit | int |  | | 30 | 1 ~ 1000 | データの取得件数 |
| timeOffsetToken | string |  | |  |  ~ 1024文字 | タイムオフセットトークン |

#### Result

|  | 型 | 説明 |
| --- | --- | --- |
| items | [List&lt;AccessLogCount&gt;](#accesslogcount) | アクセスログ集計のリスト |
| nextPageToken | string | リストの続きを取得するためのページトークン |
| totalCount | long | クエリ結果の総件数 |
| scanSize | long | 検索時にスキャンした総容量(bytes) |

#### 実装例




**Go**
```go

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/log"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := log.Gs2LogRestClient{
    Session: &session,
}
result, err := client.CountAccessLog(
    &log.CountAccessLogRequest {
        NamespaceName: pointy.String("namespace-0001"),
        Service: pointy.String("account"),
        Method: pointy.String("createAccount"),
        UserId: pointy.String("user-0001"),
        Begin: pointy.Int64(1473174000000),
        End: pointy.Int64(1473177600000),
        LongTerm: pointy.Bool(false),
        PageToken: nil,
        Limit: nil,
        TimeOffsetToken: nil,
    }
)
if err != nil {
    panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageToken
totalCount := result.TotalCount
scanSize := result.ScanSize

```

**PHP**
```php

use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Log\Gs2LogRestClient;
use Gs2\Log\Request\CountAccessLogRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2LogRestClient(
    $session
);

try {
    $result = $client->countAccessLog(
        (new CountAccessLogRequest())
            ->withNamespaceName("namespace-0001")
            ->withService("account")
            ->withMethod("createAccount")
            ->withUserId("user-0001")
            ->withBegin(1473174000000)
            ->withEnd(1473177600000)
            ->withLongTerm(false)
            ->withPageToken(null)
            ->withLimit(null)
            ->withTimeOffsetToken(null)
    );
    $items = $result->getItems();
    $nextPageToken = $result->getNextPageToken();
    $totalCount = $result->getTotalCount();
    $scanSize = $result->getScanSize();
} catch (Gs2Exception $e) {
    exit("error occurred")
}

```

**Java**
```java

import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.log.rest.Gs2LogRestClient;
import io.gs2.log.request.CountAccessLogRequest;
import io.gs2.log.result.CountAccessLogResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2LogRestClient client = new Gs2LogRestClient(session);

try {
    CountAccessLogResult result = client.countAccessLog(
        new CountAccessLogRequest()
            .withNamespaceName("namespace-0001")
            .withService("account")
            .withMethod("createAccount")
            .withUserId("user-0001")
            .withBegin(1473174000000L)
            .withEnd(1473177600000L)
            .withLongTerm(false)
            .withPageToken(null)
            .withLimit(null)
            .withTimeOffsetToken(null)
    );
    List<AccessLogCount> items = result.getItems();
    String nextPageToken = result.getNextPageToken();
    long totalCount = result.getTotalCount();
    long scanSize = result.getScanSize();
} catch (Gs2Exception e) {
    System.exit(1);
}

```

**C#**
```csharp

using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2LogRestClient(session);

AsyncResult<Gs2.Gs2Log.Result.CountAccessLogResult> asyncResult = null;
yield return client.CountAccessLog(
    new Gs2.Gs2Log.Request.CountAccessLogRequest()
        .WithNamespaceName("namespace-0001")
        .WithService("account")
        .WithMethod("createAccount")
        .WithUserId("user-0001")
        .WithBegin(1473174000000L)
        .WithEnd(1473177600000L)
        .WithLongTerm(false)
        .WithPageToken(null)
        .WithLimit(null)
        .WithTimeOffsetToken(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
var nextPageToken = result.NextPageToken;
var totalCount = result.TotalCount;
var scanSize = result.ScanSize;

```

**TypeScript**
```typescript

import Gs2Core from '@/gs2/core';
import * as Gs2Log from '@/gs2/log';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Log.Gs2LogRestClient(session);

try {
    const result = await client.countAccessLog(
        new Gs2Log.CountAccessLogRequest()
            .withNamespaceName("namespace-0001")
            .withService("account")
            .withMethod("createAccount")
            .withUserId("user-0001")
            .withBegin(1473174000000)
            .withEnd(1473177600000)
            .withLongTerm(false)
            .withPageToken(null)
            .withLimit(null)
            .withTimeOffsetToken(null)
    );
    const items = result.getItems();
    const nextPageToken = result.getNextPageToken();
    const totalCount = result.getTotalCount();
    const scanSize = result.getScanSize();
} catch (e) {
    process.exit(1);
}

```

**Python**
```python

from gs2 import core
from gs2 import log

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = log.Gs2LogRestClient(session)

try:
    result = client.count_access_log(
        log.CountAccessLogRequest()
            .with_namespace_name('namespace-0001')
            .with_service('account')
            .with_method('createAccount')
            .with_user_id('user-0001')
            .with_begin(1473174000000)
            .with_end(1473177600000)
            .with_long_term(False)
            .with_page_token(None)
            .with_limit(None)
            .with_time_offset_token(None)
    )
    items = result.items
    next_page_token = result.next_page_token
    total_count = result.total_count
    scan_size = result.scan_size
except core.Gs2Exception as e:
    exit(1)


```

**GS2-Script**
```lua

client = gs2('log')

api_result = client.count_access_log({
    namespaceName="namespace-0001",
    service="account",
    method="createAccount",
    userId="user-0001",
    begin=1473174000000,
    end=1473177600000,
    longTerm=false,
    pageToken=nil,
    limit=nil,
    timeOffsetToken=nil,
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;
totalCount = result.totalCount;
scanSize = result.scanSize;

```

**GS2-Script(Async)**
```lua

client = gs2('log')

api_result_handler = client.count_access_log_async({
    namespaceName="namespace-0001",
    service="account",
    method="createAccount",
    userId="user-0001",
    begin=1473174000000,
    end=1473177600000,
    longTerm=false,
    pageToken=nil,
    limit=nil,
    timeOffsetToken=nil,
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;
totalCount = result.totalCount;
scanSize = result.scanSize;

```




---

### queryIssueStampSheetLog

トランザクション発行ログの一覧を取得<br>

指定された時間範囲内のトランザクション発行ログをクエリします。<br>
サービス、メソッド、ユーザーID、アクションタイプによるフィルタリングが可能です。レスポンスには総件数とスキャンサイズが含まれます。7日を超える検索には longTerm フラグを有効にしてください。



#### Request

|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| namespaceName | string |  | ✓|  |  ~ 128文字 | ネームスペース名<br>ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
| service | string |  | |  |  ~ 1024文字 | マイクロサービスの種類<br>トランザクションを発行したGS2マイクロサービスの名前です。 |
| method | string |  | |  |  ~ 1024文字 | マイクロサービスのメソッド<br>トランザクション発行をトリガーした具体的なAPIメソッドです。 |
| userId | string |  | |  |  ~ 128文字 | ユーザーID |
| action | string |  | |  |  ~ 1024文字 | 入手アクション<br>トランザクションに含まれる入手アクションで、実行時にユーザーが受け取る内容を指定します。 |
| begin | long |  | | 現在時刻から1時間前の絶対時刻 |  | 検索範囲開始日時 |
| end | long |  | | 現在時刻 |  | 検索範囲終了日時 |
| longTerm | bool |  | | false |  | 7日より長い期間のログを検索対象とするか |
| pageToken | string |  | |  |  ~ 1024文字 | データの取得を開始する位置を指定するトークン |
| limit | int |  | | 30 | 1 ~ 100 | データの取得件数 |
| timeOffsetToken | string |  | |  |  ~ 1024文字 | タイムオフセットトークン |

#### Result

|  | 型 | 説明 |
| --- | --- | --- |
| items | [List&lt;IssueStampSheetLog&gt;](#issuestampsheetlog) | トランザクション発行ログのリスト |
| nextPageToken | string | リストの続きを取得するためのページトークン |
| totalCount | long | クエリ結果の総件数 |
| scanSize | long | 検索時にスキャンした総容量(bytes) |

#### 実装例




**Go**
```go

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/log"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := log.Gs2LogRestClient{
    Session: &session,
}
result, err := client.QueryIssueStampSheetLog(
    &log.QueryIssueStampSheetLogRequest {
        NamespaceName: pointy.String("namespace-0001"),
        Service: pointy.String("showcase"),
        Method: pointy.String("buy"),
        UserId: pointy.String("user-0001"),
        Action: pointy.String("Gs2Showcase:Buy"),
        Begin: pointy.Int64(1473174000000),
        End: pointy.Int64(1473177600000),
        LongTerm: pointy.Bool(false),
        PageToken: nil,
        Limit: nil,
        TimeOffsetToken: nil,
    }
)
if err != nil {
    panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageToken
totalCount := result.TotalCount
scanSize := result.ScanSize

```

**PHP**
```php

use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Log\Gs2LogRestClient;
use Gs2\Log\Request\QueryIssueStampSheetLogRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2LogRestClient(
    $session
);

try {
    $result = $client->queryIssueStampSheetLog(
        (new QueryIssueStampSheetLogRequest())
            ->withNamespaceName("namespace-0001")
            ->withService("showcase")
            ->withMethod("buy")
            ->withUserId("user-0001")
            ->withAction("Gs2Showcase:Buy")
            ->withBegin(1473174000000)
            ->withEnd(1473177600000)
            ->withLongTerm(false)
            ->withPageToken(null)
            ->withLimit(null)
            ->withTimeOffsetToken(null)
    );
    $items = $result->getItems();
    $nextPageToken = $result->getNextPageToken();
    $totalCount = $result->getTotalCount();
    $scanSize = $result->getScanSize();
} catch (Gs2Exception $e) {
    exit("error occurred")
}

```

**Java**
```java

import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.log.rest.Gs2LogRestClient;
import io.gs2.log.request.QueryIssueStampSheetLogRequest;
import io.gs2.log.result.QueryIssueStampSheetLogResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2LogRestClient client = new Gs2LogRestClient(session);

try {
    QueryIssueStampSheetLogResult result = client.queryIssueStampSheetLog(
        new QueryIssueStampSheetLogRequest()
            .withNamespaceName("namespace-0001")
            .withService("showcase")
            .withMethod("buy")
            .withUserId("user-0001")
            .withAction("Gs2Showcase:Buy")
            .withBegin(1473174000000L)
            .withEnd(1473177600000L)
            .withLongTerm(false)
            .withPageToken(null)
            .withLimit(null)
            .withTimeOffsetToken(null)
    );
    List<IssueStampSheetLog> items = result.getItems();
    String nextPageToken = result.getNextPageToken();
    long totalCount = result.getTotalCount();
    long scanSize = result.getScanSize();
} catch (Gs2Exception e) {
    System.exit(1);
}

```

**C#**
```csharp

using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2LogRestClient(session);

AsyncResult<Gs2.Gs2Log.Result.QueryIssueStampSheetLogResult> asyncResult = null;
yield return client.QueryIssueStampSheetLog(
    new Gs2.Gs2Log.Request.QueryIssueStampSheetLogRequest()
        .WithNamespaceName("namespace-0001")
        .WithService("showcase")
        .WithMethod("buy")
        .WithUserId("user-0001")
        .WithAction("Gs2Showcase:Buy")
        .WithBegin(1473174000000L)
        .WithEnd(1473177600000L)
        .WithLongTerm(false)
        .WithPageToken(null)
        .WithLimit(null)
        .WithTimeOffsetToken(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
var nextPageToken = result.NextPageToken;
var totalCount = result.TotalCount;
var scanSize = result.ScanSize;

```

**TypeScript**
```typescript

import Gs2Core from '@/gs2/core';
import * as Gs2Log from '@/gs2/log';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Log.Gs2LogRestClient(session);

try {
    const result = await client.queryIssueStampSheetLog(
        new Gs2Log.QueryIssueStampSheetLogRequest()
            .withNamespaceName("namespace-0001")
            .withService("showcase")
            .withMethod("buy")
            .withUserId("user-0001")
            .withAction("Gs2Showcase:Buy")
            .withBegin(1473174000000)
            .withEnd(1473177600000)
            .withLongTerm(false)
            .withPageToken(null)
            .withLimit(null)
            .withTimeOffsetToken(null)
    );
    const items = result.getItems();
    const nextPageToken = result.getNextPageToken();
    const totalCount = result.getTotalCount();
    const scanSize = result.getScanSize();
} catch (e) {
    process.exit(1);
}

```

**Python**
```python

from gs2 import core
from gs2 import log

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = log.Gs2LogRestClient(session)

try:
    result = client.query_issue_stamp_sheet_log(
        log.QueryIssueStampSheetLogRequest()
            .with_namespace_name('namespace-0001')
            .with_service('showcase')
            .with_method('buy')
            .with_user_id('user-0001')
            .with_action('Gs2Showcase:Buy')
            .with_begin(1473174000000)
            .with_end(1473177600000)
            .with_long_term(False)
            .with_page_token(None)
            .with_limit(None)
            .with_time_offset_token(None)
    )
    items = result.items
    next_page_token = result.next_page_token
    total_count = result.total_count
    scan_size = result.scan_size
except core.Gs2Exception as e:
    exit(1)


```

**GS2-Script**
```lua

client = gs2('log')

api_result = client.query_issue_stamp_sheet_log({
    namespaceName="namespace-0001",
    service="showcase",
    method="buy",
    userId="user-0001",
    action="Gs2Showcase:Buy",
    begin=1473174000000,
    end=1473177600000,
    longTerm=false,
    pageToken=nil,
    limit=nil,
    timeOffsetToken=nil,
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;
totalCount = result.totalCount;
scanSize = result.scanSize;

```

**GS2-Script(Async)**
```lua

client = gs2('log')

api_result_handler = client.query_issue_stamp_sheet_log_async({
    namespaceName="namespace-0001",
    service="showcase",
    method="buy",
    userId="user-0001",
    action="Gs2Showcase:Buy",
    begin=1473174000000,
    end=1473177600000,
    longTerm=false,
    pageToken=nil,
    limit=nil,
    timeOffsetToken=nil,
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;
totalCount = result.totalCount;
scanSize = result.scanSize;

```




---

### countIssueStampSheetLog

トランザクション発行ログの集計結果を取得<br>

指定された時間範囲内のトランザクション発行ログ件数を集計します。サービス、メソッド、ユーザーID、アクションタイプによる分類が可能です。<br>
各分類フラグにより、その次元でのグループ化が制御されます。



#### Request

|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| namespaceName | string |  | ✓|  |  ~ 128文字 | ネームスペース名<br>ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
| service | bool |  | | false |  | マイクロサービスの種類で分類するか |
| method | bool |  | | false |  | マイクロサービスのメソッドで分類するか |
| userId | bool |  | | false |  | ユーザーIDで分類するか |
| action | bool |  | | false |  | 入手アクションで分類するか |
| begin | long |  | | 現在時刻から1時間前の絶対時刻 |  | 検索範囲開始日時 |
| end | long |  | | 現在時刻 |  | 検索範囲終了日時 |
| longTerm | bool |  | | false |  | 7日より長い期間のログを検索対象とするか |
| pageToken | string |  | |  |  ~ 1024文字 | データの取得を開始する位置を指定するトークン |
| limit | int |  | | 30 | 1 ~ 1000 | データの取得件数 |
| timeOffsetToken | string |  | |  |  ~ 1024文字 | タイムオフセットトークン |

#### Result

|  | 型 | 説明 |
| --- | --- | --- |
| items | [List&lt;IssueStampSheetLogCount&gt;](#issuestampsheetlogcount) | トランザクション発行ログ集計のリスト |
| nextPageToken | string | リストの続きを取得するためのページトークン |
| totalCount | long | クエリ結果の総件数 |
| scanSize | long | 検索時にスキャンした総容量(bytes) |

#### 実装例




**Go**
```go

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/log"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := log.Gs2LogRestClient{
    Session: &session,
}
result, err := client.CountIssueStampSheetLog(
    &log.CountIssueStampSheetLogRequest {
        NamespaceName: pointy.String("namespace-0001"),
        Service: pointy.String("showcase"),
        Method: pointy.String("buy"),
        UserId: pointy.String("user-0001"),
        Action: pointy.String("Gs2Showcase:Buy"),
        Begin: pointy.Int64(1473174000000),
        End: pointy.Int64(1473177600000),
        LongTerm: pointy.Bool(false),
        PageToken: nil,
        Limit: nil,
        TimeOffsetToken: nil,
    }
)
if err != nil {
    panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageToken
totalCount := result.TotalCount
scanSize := result.ScanSize

```

**PHP**
```php

use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Log\Gs2LogRestClient;
use Gs2\Log\Request\CountIssueStampSheetLogRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2LogRestClient(
    $session
);

try {
    $result = $client->countIssueStampSheetLog(
        (new CountIssueStampSheetLogRequest())
            ->withNamespaceName("namespace-0001")
            ->withService("showcase")
            ->withMethod("buy")
            ->withUserId("user-0001")
            ->withAction("Gs2Showcase:Buy")
            ->withBegin(1473174000000)
            ->withEnd(1473177600000)
            ->withLongTerm(false)
            ->withPageToken(null)
            ->withLimit(null)
            ->withTimeOffsetToken(null)
    );
    $items = $result->getItems();
    $nextPageToken = $result->getNextPageToken();
    $totalCount = $result->getTotalCount();
    $scanSize = $result->getScanSize();
} catch (Gs2Exception $e) {
    exit("error occurred")
}

```

**Java**
```java

import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.log.rest.Gs2LogRestClient;
import io.gs2.log.request.CountIssueStampSheetLogRequest;
import io.gs2.log.result.CountIssueStampSheetLogResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2LogRestClient client = new Gs2LogRestClient(session);

try {
    CountIssueStampSheetLogResult result = client.countIssueStampSheetLog(
        new CountIssueStampSheetLogRequest()
            .withNamespaceName("namespace-0001")
            .withService("showcase")
            .withMethod("buy")
            .withUserId("user-0001")
            .withAction("Gs2Showcase:Buy")
            .withBegin(1473174000000L)
            .withEnd(1473177600000L)
            .withLongTerm(false)
            .withPageToken(null)
            .withLimit(null)
            .withTimeOffsetToken(null)
    );
    List<IssueStampSheetLogCount> items = result.getItems();
    String nextPageToken = result.getNextPageToken();
    long totalCount = result.getTotalCount();
    long scanSize = result.getScanSize();
} catch (Gs2Exception e) {
    System.exit(1);
}

```

**C#**
```csharp

using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2LogRestClient(session);

AsyncResult<Gs2.Gs2Log.Result.CountIssueStampSheetLogResult> asyncResult = null;
yield return client.CountIssueStampSheetLog(
    new Gs2.Gs2Log.Request.CountIssueStampSheetLogRequest()
        .WithNamespaceName("namespace-0001")
        .WithService("showcase")
        .WithMethod("buy")
        .WithUserId("user-0001")
        .WithAction("Gs2Showcase:Buy")
        .WithBegin(1473174000000L)
        .WithEnd(1473177600000L)
        .WithLongTerm(false)
        .WithPageToken(null)
        .WithLimit(null)
        .WithTimeOffsetToken(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
var nextPageToken = result.NextPageToken;
var totalCount = result.TotalCount;
var scanSize = result.ScanSize;

```

**TypeScript**
```typescript

import Gs2Core from '@/gs2/core';
import * as Gs2Log from '@/gs2/log';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Log.Gs2LogRestClient(session);

try {
    const result = await client.countIssueStampSheetLog(
        new Gs2Log.CountIssueStampSheetLogRequest()
            .withNamespaceName("namespace-0001")
            .withService("showcase")
            .withMethod("buy")
            .withUserId("user-0001")
            .withAction("Gs2Showcase:Buy")
            .withBegin(1473174000000)
            .withEnd(1473177600000)
            .withLongTerm(false)
            .withPageToken(null)
            .withLimit(null)
            .withTimeOffsetToken(null)
    );
    const items = result.getItems();
    const nextPageToken = result.getNextPageToken();
    const totalCount = result.getTotalCount();
    const scanSize = result.getScanSize();
} catch (e) {
    process.exit(1);
}

```

**Python**
```python

from gs2 import core
from gs2 import log

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = log.Gs2LogRestClient(session)

try:
    result = client.count_issue_stamp_sheet_log(
        log.CountIssueStampSheetLogRequest()
            .with_namespace_name('namespace-0001')
            .with_service('showcase')
            .with_method('buy')
            .with_user_id('user-0001')
            .with_action('Gs2Showcase:Buy')
            .with_begin(1473174000000)
            .with_end(1473177600000)
            .with_long_term(False)
            .with_page_token(None)
            .with_limit(None)
            .with_time_offset_token(None)
    )
    items = result.items
    next_page_token = result.next_page_token
    total_count = result.total_count
    scan_size = result.scan_size
except core.Gs2Exception as e:
    exit(1)


```

**GS2-Script**
```lua

client = gs2('log')

api_result = client.count_issue_stamp_sheet_log({
    namespaceName="namespace-0001",
    service="showcase",
    method="buy",
    userId="user-0001",
    action="Gs2Showcase:Buy",
    begin=1473174000000,
    end=1473177600000,
    longTerm=false,
    pageToken=nil,
    limit=nil,
    timeOffsetToken=nil,
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;
totalCount = result.totalCount;
scanSize = result.scanSize;

```

**GS2-Script(Async)**
```lua

client = gs2('log')

api_result_handler = client.count_issue_stamp_sheet_log_async({
    namespaceName="namespace-0001",
    service="showcase",
    method="buy",
    userId="user-0001",
    action="Gs2Showcase:Buy",
    begin=1473174000000,
    end=1473177600000,
    longTerm=false,
    pageToken=nil,
    limit=nil,
    timeOffsetToken=nil,
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;
totalCount = result.totalCount;
scanSize = result.scanSize;

```




---

### queryExecuteStampSheetLog

入手アクション実行ログの一覧を取得<br>

指定された時間範囲内の入手アクション実行ログをクエリします。<br>
サービス、メソッド、ユーザーID、アクションタイプによるフィルタリングが可能です。レスポンスには総件数とスキャンサイズが含まれます。7日を超える検索には longTerm フラグを有効にしてください。



#### Request

|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| namespaceName | string |  | ✓|  |  ~ 128文字 | ネームスペース名<br>ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
| service | string |  | |  |  ~ 1024文字 | マイクロサービスの種類<br>入手アクションを実行したGS2マイクロサービスの名前です（例：inventory、experience）。 |
| method | string |  | |  |  ~ 1024文字 | マイクロサービスのメソッド<br>入手アクションの実行のためにマイクロサービス上で呼び出された具体的なメソッドです。 |
| userId | string |  | |  |  ~ 128文字 | ユーザーID |
| action | string |  | |  |  ~ 1024文字 | 入手アクション<br>実行された入手アクションの種類です（例：Gs2Inventory:AcquireItemSetByUserId、Gs2Experience:AddExperienceByUserId）。 |
| begin | long |  | | 現在時刻から1時間前の絶対時刻 |  | 検索範囲開始日時 |
| end | long |  | | 現在時刻 |  | 検索範囲終了日時 |
| longTerm | bool |  | | false |  | 7日より長い期間のログを検索対象とするか |
| pageToken | string |  | |  |  ~ 1024文字 | データの取得を開始する位置を指定するトークン |
| limit | int |  | | 30 | 1 ~ 100 | データの取得件数 |
| timeOffsetToken | string |  | |  |  ~ 1024文字 | タイムオフセットトークン |

#### Result

|  | 型 | 説明 |
| --- | --- | --- |
| items | [List&lt;ExecuteStampSheetLog&gt;](#executestampsheetlog) | 入手アクション実行ログのリスト |
| nextPageToken | string | リストの続きを取得するためのページトークン |
| totalCount | long | クエリ結果の総件数 |
| scanSize | long | 検索時にスキャンした総容量(bytes) |

#### 実装例




**Go**
```go

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/log"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := log.Gs2LogRestClient{
    Session: &session,
}
result, err := client.QueryExecuteStampSheetLog(
    &log.QueryExecuteStampSheetLogRequest {
        NamespaceName: pointy.String("namespace-0001"),
        Service: pointy.String("inventory"),
        Method: pointy.String("acquireItemSetByUserId"),
        UserId: pointy.String("user-0001"),
        Action: nil,
        Begin: pointy.Int64(1473174000000),
        End: pointy.Int64(1473177600000),
        LongTerm: pointy.Bool(false),
        PageToken: nil,
        Limit: nil,
        TimeOffsetToken: nil,
    }
)
if err != nil {
    panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageToken
totalCount := result.TotalCount
scanSize := result.ScanSize

```

**PHP**
```php

use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Log\Gs2LogRestClient;
use Gs2\Log\Request\QueryExecuteStampSheetLogRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2LogRestClient(
    $session
);

try {
    $result = $client->queryExecuteStampSheetLog(
        (new QueryExecuteStampSheetLogRequest())
            ->withNamespaceName("namespace-0001")
            ->withService("inventory")
            ->withMethod("acquireItemSetByUserId")
            ->withUserId("user-0001")
            ->withAction(null)
            ->withBegin(1473174000000)
            ->withEnd(1473177600000)
            ->withLongTerm(false)
            ->withPageToken(null)
            ->withLimit(null)
            ->withTimeOffsetToken(null)
    );
    $items = $result->getItems();
    $nextPageToken = $result->getNextPageToken();
    $totalCount = $result->getTotalCount();
    $scanSize = $result->getScanSize();
} catch (Gs2Exception $e) {
    exit("error occurred")
}

```

**Java**
```java

import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.log.rest.Gs2LogRestClient;
import io.gs2.log.request.QueryExecuteStampSheetLogRequest;
import io.gs2.log.result.QueryExecuteStampSheetLogResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2LogRestClient client = new Gs2LogRestClient(session);

try {
    QueryExecuteStampSheetLogResult result = client.queryExecuteStampSheetLog(
        new QueryExecuteStampSheetLogRequest()
            .withNamespaceName("namespace-0001")
            .withService("inventory")
            .withMethod("acquireItemSetByUserId")
            .withUserId("user-0001")
            .withAction(null)
            .withBegin(1473174000000L)
            .withEnd(1473177600000L)
            .withLongTerm(false)
            .withPageToken(null)
            .withLimit(null)
            .withTimeOffsetToken(null)
    );
    List<ExecuteStampSheetLog> items = result.getItems();
    String nextPageToken = result.getNextPageToken();
    long totalCount = result.getTotalCount();
    long scanSize = result.getScanSize();
} catch (Gs2Exception e) {
    System.exit(1);
}

```

**C#**
```csharp

using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2LogRestClient(session);

AsyncResult<Gs2.Gs2Log.Result.QueryExecuteStampSheetLogResult> asyncResult = null;
yield return client.QueryExecuteStampSheetLog(
    new Gs2.Gs2Log.Request.QueryExecuteStampSheetLogRequest()
        .WithNamespaceName("namespace-0001")
        .WithService("inventory")
        .WithMethod("acquireItemSetByUserId")
        .WithUserId("user-0001")
        .WithAction(null)
        .WithBegin(1473174000000L)
        .WithEnd(1473177600000L)
        .WithLongTerm(false)
        .WithPageToken(null)
        .WithLimit(null)
        .WithTimeOffsetToken(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
var nextPageToken = result.NextPageToken;
var totalCount = result.TotalCount;
var scanSize = result.ScanSize;

```

**TypeScript**
```typescript

import Gs2Core from '@/gs2/core';
import * as Gs2Log from '@/gs2/log';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Log.Gs2LogRestClient(session);

try {
    const result = await client.queryExecuteStampSheetLog(
        new Gs2Log.QueryExecuteStampSheetLogRequest()
            .withNamespaceName("namespace-0001")
            .withService("inventory")
            .withMethod("acquireItemSetByUserId")
            .withUserId("user-0001")
            .withAction(null)
            .withBegin(1473174000000)
            .withEnd(1473177600000)
            .withLongTerm(false)
            .withPageToken(null)
            .withLimit(null)
            .withTimeOffsetToken(null)
    );
    const items = result.getItems();
    const nextPageToken = result.getNextPageToken();
    const totalCount = result.getTotalCount();
    const scanSize = result.getScanSize();
} catch (e) {
    process.exit(1);
}

```

**Python**
```python

from gs2 import core
from gs2 import log

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = log.Gs2LogRestClient(session)

try:
    result = client.query_execute_stamp_sheet_log(
        log.QueryExecuteStampSheetLogRequest()
            .with_namespace_name('namespace-0001')
            .with_service('inventory')
            .with_method('acquireItemSetByUserId')
            .with_user_id('user-0001')
            .with_action(None)
            .with_begin(1473174000000)
            .with_end(1473177600000)
            .with_long_term(False)
            .with_page_token(None)
            .with_limit(None)
            .with_time_offset_token(None)
    )
    items = result.items
    next_page_token = result.next_page_token
    total_count = result.total_count
    scan_size = result.scan_size
except core.Gs2Exception as e:
    exit(1)


```

**GS2-Script**
```lua

client = gs2('log')

api_result = client.query_execute_stamp_sheet_log({
    namespaceName="namespace-0001",
    service="inventory",
    method="acquireItemSetByUserId",
    userId="user-0001",
    action=nil,
    begin=1473174000000,
    end=1473177600000,
    longTerm=false,
    pageToken=nil,
    limit=nil,
    timeOffsetToken=nil,
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;
totalCount = result.totalCount;
scanSize = result.scanSize;

```

**GS2-Script(Async)**
```lua

client = gs2('log')

api_result_handler = client.query_execute_stamp_sheet_log_async({
    namespaceName="namespace-0001",
    service="inventory",
    method="acquireItemSetByUserId",
    userId="user-0001",
    action=nil,
    begin=1473174000000,
    end=1473177600000,
    longTerm=false,
    pageToken=nil,
    limit=nil,
    timeOffsetToken=nil,
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;
totalCount = result.totalCount;
scanSize = result.scanSize;

```




---

### countExecuteStampSheetLog

入手アクション実行ログの集計結果を取得<br>

指定された時間範囲内の入手アクション実行ログ件数を集計します。サービス、メソッド、ユーザーID、アクションタイプによる分類が可能です。<br>
各分類フラグにより、その次元でのグループ化が制御されます。



#### Request

|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| namespaceName | string |  | ✓|  |  ~ 128文字 | ネームスペース名<br>ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
| service | bool |  | | false |  | マイクロサービスの種類で分類するか |
| method | bool |  | | false |  | マイクロサービスのメソッドで分類するか |
| userId | bool |  | | false |  | ユーザーIDで分類するか |
| action | bool |  | | false |  | 入手アクションで分類するか |
| begin | long |  | | 現在時刻から1時間前の絶対時刻 |  | 検索範囲開始日時 |
| end | long |  | | 現在時刻 |  | 検索範囲終了日時 |
| longTerm | bool |  | | false |  | 7日より長い期間のログを検索対象とするか |
| pageToken | string |  | |  |  ~ 1024文字 | データの取得を開始する位置を指定するトークン |
| limit | int |  | | 30 | 1 ~ 1000 | データの取得件数 |
| timeOffsetToken | string |  | |  |  ~ 1024文字 | タイムオフセットトークン |

#### Result

|  | 型 | 説明 |
| --- | --- | --- |
| items | [List&lt;ExecuteStampSheetLogCount&gt;](#executestampsheetlogcount) | 入手アクション実行ログ集計のリスト |
| nextPageToken | string | リストの続きを取得するためのページトークン |
| totalCount | long | クエリ結果の総件数 |
| scanSize | long | 検索時にスキャンした総容量(bytes) |

#### 実装例




**Go**
```go

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/log"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := log.Gs2LogRestClient{
    Session: &session,
}
result, err := client.CountExecuteStampSheetLog(
    &log.CountExecuteStampSheetLogRequest {
        NamespaceName: pointy.String("namespace-0001"),
        Service: pointy.String("inventory"),
        Method: pointy.String("acquireItemSetByUserId"),
        UserId: pointy.String("user-0001"),
        Action: nil,
        Begin: pointy.Int64(1473174000000),
        End: pointy.Int64(1473177600000),
        LongTerm: pointy.Bool(false),
        PageToken: nil,
        Limit: nil,
        TimeOffsetToken: nil,
    }
)
if err != nil {
    panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageToken
totalCount := result.TotalCount
scanSize := result.ScanSize

```

**PHP**
```php

use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Log\Gs2LogRestClient;
use Gs2\Log\Request\CountExecuteStampSheetLogRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2LogRestClient(
    $session
);

try {
    $result = $client->countExecuteStampSheetLog(
        (new CountExecuteStampSheetLogRequest())
            ->withNamespaceName("namespace-0001")
            ->withService("inventory")
            ->withMethod("acquireItemSetByUserId")
            ->withUserId("user-0001")
            ->withAction(null)
            ->withBegin(1473174000000)
            ->withEnd(1473177600000)
            ->withLongTerm(false)
            ->withPageToken(null)
            ->withLimit(null)
            ->withTimeOffsetToken(null)
    );
    $items = $result->getItems();
    $nextPageToken = $result->getNextPageToken();
    $totalCount = $result->getTotalCount();
    $scanSize = $result->getScanSize();
} catch (Gs2Exception $e) {
    exit("error occurred")
}

```

**Java**
```java

import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.log.rest.Gs2LogRestClient;
import io.gs2.log.request.CountExecuteStampSheetLogRequest;
import io.gs2.log.result.CountExecuteStampSheetLogResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2LogRestClient client = new Gs2LogRestClient(session);

try {
    CountExecuteStampSheetLogResult result = client.countExecuteStampSheetLog(
        new CountExecuteStampSheetLogRequest()
            .withNamespaceName("namespace-0001")
            .withService("inventory")
            .withMethod("acquireItemSetByUserId")
            .withUserId("user-0001")
            .withAction(null)
            .withBegin(1473174000000L)
            .withEnd(1473177600000L)
            .withLongTerm(false)
            .withPageToken(null)
            .withLimit(null)
            .withTimeOffsetToken(null)
    );
    List<ExecuteStampSheetLogCount> items = result.getItems();
    String nextPageToken = result.getNextPageToken();
    long totalCount = result.getTotalCount();
    long scanSize = result.getScanSize();
} catch (Gs2Exception e) {
    System.exit(1);
}

```

**C#**
```csharp

using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2LogRestClient(session);

AsyncResult<Gs2.Gs2Log.Result.CountExecuteStampSheetLogResult> asyncResult = null;
yield return client.CountExecuteStampSheetLog(
    new Gs2.Gs2Log.Request.CountExecuteStampSheetLogRequest()
        .WithNamespaceName("namespace-0001")
        .WithService("inventory")
        .WithMethod("acquireItemSetByUserId")
        .WithUserId("user-0001")
        .WithAction(null)
        .WithBegin(1473174000000L)
        .WithEnd(1473177600000L)
        .WithLongTerm(false)
        .WithPageToken(null)
        .WithLimit(null)
        .WithTimeOffsetToken(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
var nextPageToken = result.NextPageToken;
var totalCount = result.TotalCount;
var scanSize = result.ScanSize;

```

**TypeScript**
```typescript

import Gs2Core from '@/gs2/core';
import * as Gs2Log from '@/gs2/log';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Log.Gs2LogRestClient(session);

try {
    const result = await client.countExecuteStampSheetLog(
        new Gs2Log.CountExecuteStampSheetLogRequest()
            .withNamespaceName("namespace-0001")
            .withService("inventory")
            .withMethod("acquireItemSetByUserId")
            .withUserId("user-0001")
            .withAction(null)
            .withBegin(1473174000000)
            .withEnd(1473177600000)
            .withLongTerm(false)
            .withPageToken(null)
            .withLimit(null)
            .withTimeOffsetToken(null)
    );
    const items = result.getItems();
    const nextPageToken = result.getNextPageToken();
    const totalCount = result.getTotalCount();
    const scanSize = result.getScanSize();
} catch (e) {
    process.exit(1);
}

```

**Python**
```python

from gs2 import core
from gs2 import log

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = log.Gs2LogRestClient(session)

try:
    result = client.count_execute_stamp_sheet_log(
        log.CountExecuteStampSheetLogRequest()
            .with_namespace_name('namespace-0001')
            .with_service('inventory')
            .with_method('acquireItemSetByUserId')
            .with_user_id('user-0001')
            .with_action(None)
            .with_begin(1473174000000)
            .with_end(1473177600000)
            .with_long_term(False)
            .with_page_token(None)
            .with_limit(None)
            .with_time_offset_token(None)
    )
    items = result.items
    next_page_token = result.next_page_token
    total_count = result.total_count
    scan_size = result.scan_size
except core.Gs2Exception as e:
    exit(1)


```

**GS2-Script**
```lua

client = gs2('log')

api_result = client.count_execute_stamp_sheet_log({
    namespaceName="namespace-0001",
    service="inventory",
    method="acquireItemSetByUserId",
    userId="user-0001",
    action=nil,
    begin=1473174000000,
    end=1473177600000,
    longTerm=false,
    pageToken=nil,
    limit=nil,
    timeOffsetToken=nil,
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;
totalCount = result.totalCount;
scanSize = result.scanSize;

```

**GS2-Script(Async)**
```lua

client = gs2('log')

api_result_handler = client.count_execute_stamp_sheet_log_async({
    namespaceName="namespace-0001",
    service="inventory",
    method="acquireItemSetByUserId",
    userId="user-0001",
    action=nil,
    begin=1473174000000,
    end=1473177600000,
    longTerm=false,
    pageToken=nil,
    limit=nil,
    timeOffsetToken=nil,
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;
totalCount = result.totalCount;
scanSize = result.scanSize;

```




---

### queryExecuteStampTaskLog

消費アクション実行ログの一覧を取得<br>

指定された時間範囲内の消費アクション実行ログをクエリします。<br>
サービス、メソッド、ユーザーID、アクションタイプによるフィルタリングが可能です。レスポンスには総件数とスキャンサイズが含まれます。7日を超える検索には longTerm フラグを有効にしてください。



#### Request

|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| namespaceName | string |  | ✓|  |  ~ 128文字 | ネームスペース名<br>ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
| service | string |  | |  |  ~ 1024文字 | マイクロサービスの種類<br>消費アクションを実行したGS2マイクロサービスの名前です（例：inventory、money）。 |
| method | string |  | |  |  ~ 1024文字 | マイクロサービスのメソッド<br>消費アクションの実行のためにマイクロサービス上で呼び出された具体的なメソッドです。 |
| userId | string |  | |  |  ~ 128文字 | ユーザーID |
| action | string |  | |  |  ~ 1024文字 | 消費アクション<br>実行された消費アクションの種類です（例：Gs2Inventory:ConsumeItemSetByUserId、Gs2Money:WithdrawByUserId）。 |
| begin | long |  | | 現在時刻から1時間前の絶対時刻 |  | 検索範囲開始日時 |
| end | long |  | | 現在時刻 |  | 検索範囲終了日時 |
| longTerm | bool |  | | false |  | 7日より長い期間のログを検索対象とするか |
| pageToken | string |  | |  |  ~ 1024文字 | データの取得を開始する位置を指定するトークン |
| limit | int |  | | 30 | 1 ~ 100 | データの取得件数 |
| timeOffsetToken | string |  | |  |  ~ 1024文字 | タイムオフセットトークン |

#### Result

|  | 型 | 説明 |
| --- | --- | --- |
| items | [List&lt;ExecuteStampTaskLog&gt;](#executestamptasklog) | 消費アクション実行実行ログのリスト |
| nextPageToken | string | リストの続きを取得するためのページトークン |
| totalCount | long | クエリ結果の総件数 |
| scanSize | long | 検索時にスキャンした総容量(bytes) |

#### 実装例




**Go**
```go

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/log"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := log.Gs2LogRestClient{
    Session: &session,
}
result, err := client.QueryExecuteStampTaskLog(
    &log.QueryExecuteStampTaskLogRequest {
        NamespaceName: pointy.String("namespace-0001"),
        Service: pointy.String("inventory"),
        Method: pointy.String("consumeItemSetByUserId"),
        UserId: pointy.String("user-0001"),
        Action: nil,
        Begin: pointy.Int64(1473174000000),
        End: pointy.Int64(1473177600000),
        LongTerm: pointy.Bool(false),
        PageToken: nil,
        Limit: nil,
        TimeOffsetToken: nil,
    }
)
if err != nil {
    panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageToken
totalCount := result.TotalCount
scanSize := result.ScanSize

```

**PHP**
```php

use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Log\Gs2LogRestClient;
use Gs2\Log\Request\QueryExecuteStampTaskLogRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2LogRestClient(
    $session
);

try {
    $result = $client->queryExecuteStampTaskLog(
        (new QueryExecuteStampTaskLogRequest())
            ->withNamespaceName("namespace-0001")
            ->withService("inventory")
            ->withMethod("consumeItemSetByUserId")
            ->withUserId("user-0001")
            ->withAction(null)
            ->withBegin(1473174000000)
            ->withEnd(1473177600000)
            ->withLongTerm(false)
            ->withPageToken(null)
            ->withLimit(null)
            ->withTimeOffsetToken(null)
    );
    $items = $result->getItems();
    $nextPageToken = $result->getNextPageToken();
    $totalCount = $result->getTotalCount();
    $scanSize = $result->getScanSize();
} catch (Gs2Exception $e) {
    exit("error occurred")
}

```

**Java**
```java

import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.log.rest.Gs2LogRestClient;
import io.gs2.log.request.QueryExecuteStampTaskLogRequest;
import io.gs2.log.result.QueryExecuteStampTaskLogResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2LogRestClient client = new Gs2LogRestClient(session);

try {
    QueryExecuteStampTaskLogResult result = client.queryExecuteStampTaskLog(
        new QueryExecuteStampTaskLogRequest()
            .withNamespaceName("namespace-0001")
            .withService("inventory")
            .withMethod("consumeItemSetByUserId")
            .withUserId("user-0001")
            .withAction(null)
            .withBegin(1473174000000L)
            .withEnd(1473177600000L)
            .withLongTerm(false)
            .withPageToken(null)
            .withLimit(null)
            .withTimeOffsetToken(null)
    );
    List<ExecuteStampTaskLog> items = result.getItems();
    String nextPageToken = result.getNextPageToken();
    long totalCount = result.getTotalCount();
    long scanSize = result.getScanSize();
} catch (Gs2Exception e) {
    System.exit(1);
}

```

**C#**
```csharp

using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2LogRestClient(session);

AsyncResult<Gs2.Gs2Log.Result.QueryExecuteStampTaskLogResult> asyncResult = null;
yield return client.QueryExecuteStampTaskLog(
    new Gs2.Gs2Log.Request.QueryExecuteStampTaskLogRequest()
        .WithNamespaceName("namespace-0001")
        .WithService("inventory")
        .WithMethod("consumeItemSetByUserId")
        .WithUserId("user-0001")
        .WithAction(null)
        .WithBegin(1473174000000L)
        .WithEnd(1473177600000L)
        .WithLongTerm(false)
        .WithPageToken(null)
        .WithLimit(null)
        .WithTimeOffsetToken(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
var nextPageToken = result.NextPageToken;
var totalCount = result.TotalCount;
var scanSize = result.ScanSize;

```

**TypeScript**
```typescript

import Gs2Core from '@/gs2/core';
import * as Gs2Log from '@/gs2/log';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Log.Gs2LogRestClient(session);

try {
    const result = await client.queryExecuteStampTaskLog(
        new Gs2Log.QueryExecuteStampTaskLogRequest()
            .withNamespaceName("namespace-0001")
            .withService("inventory")
            .withMethod("consumeItemSetByUserId")
            .withUserId("user-0001")
            .withAction(null)
            .withBegin(1473174000000)
            .withEnd(1473177600000)
            .withLongTerm(false)
            .withPageToken(null)
            .withLimit(null)
            .withTimeOffsetToken(null)
    );
    const items = result.getItems();
    const nextPageToken = result.getNextPageToken();
    const totalCount = result.getTotalCount();
    const scanSize = result.getScanSize();
} catch (e) {
    process.exit(1);
}

```

**Python**
```python

from gs2 import core
from gs2 import log

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = log.Gs2LogRestClient(session)

try:
    result = client.query_execute_stamp_task_log(
        log.QueryExecuteStampTaskLogRequest()
            .with_namespace_name('namespace-0001')
            .with_service('inventory')
            .with_method('consumeItemSetByUserId')
            .with_user_id('user-0001')
            .with_action(None)
            .with_begin(1473174000000)
            .with_end(1473177600000)
            .with_long_term(False)
            .with_page_token(None)
            .with_limit(None)
            .with_time_offset_token(None)
    )
    items = result.items
    next_page_token = result.next_page_token
    total_count = result.total_count
    scan_size = result.scan_size
except core.Gs2Exception as e:
    exit(1)


```

**GS2-Script**
```lua

client = gs2('log')

api_result = client.query_execute_stamp_task_log({
    namespaceName="namespace-0001",
    service="inventory",
    method="consumeItemSetByUserId",
    userId="user-0001",
    action=nil,
    begin=1473174000000,
    end=1473177600000,
    longTerm=false,
    pageToken=nil,
    limit=nil,
    timeOffsetToken=nil,
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;
totalCount = result.totalCount;
scanSize = result.scanSize;

```

**GS2-Script(Async)**
```lua

client = gs2('log')

api_result_handler = client.query_execute_stamp_task_log_async({
    namespaceName="namespace-0001",
    service="inventory",
    method="consumeItemSetByUserId",
    userId="user-0001",
    action=nil,
    begin=1473174000000,
    end=1473177600000,
    longTerm=false,
    pageToken=nil,
    limit=nil,
    timeOffsetToken=nil,
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;
totalCount = result.totalCount;
scanSize = result.scanSize;

```




---

### countExecuteStampTaskLog

消費アクション実行ログの集計結果を取得<br>

指定された時間範囲内の消費アクション実行ログ件数を集計します。サービス、メソッド、ユーザーID、アクションタイプによる分類が可能です。<br>
各分類フラグにより、その次元でのグループ化が制御されます。



#### Request

|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| namespaceName | string |  | ✓|  |  ~ 128文字 | ネームスペース名<br>ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
| service | bool |  | | false |  | マイクロサービスの種類で分類するか |
| method | bool |  | | false |  | マイクロサービスのメソッドで分類するか |
| userId | bool |  | | false |  | ユーザーIDで分類するか |
| action | bool |  | | false |  | 入手アクションで分類するか |
| begin | long |  | | 現在時刻から1時間前の絶対時刻 |  | 検索範囲開始日時 |
| end | long |  | | 現在時刻 |  | 検索範囲終了日時 |
| longTerm | bool |  | | false |  | 7日より長い期間のログを検索対象とするか |
| pageToken | string |  | |  |  ~ 1024文字 | データの取得を開始する位置を指定するトークン |
| limit | int |  | | 30 | 1 ~ 1000 | データの取得件数 |
| timeOffsetToken | string |  | |  |  ~ 1024文字 | タイムオフセットトークン |

#### Result

|  | 型 | 説明 |
| --- | --- | --- |
| items | [List&lt;ExecuteStampTaskLogCount&gt;](#executestamptasklogcount) | 消費アクション実行ログ集計のリスト |
| nextPageToken | string | リストの続きを取得するためのページトークン |
| totalCount | long | クエリ結果の総件数 |
| scanSize | long | 検索時にスキャンした総容量(bytes) |

#### 実装例




**Go**
```go

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/log"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := log.Gs2LogRestClient{
    Session: &session,
}
result, err := client.CountExecuteStampTaskLog(
    &log.CountExecuteStampTaskLogRequest {
        NamespaceName: pointy.String("namespace-0001"),
        Service: pointy.String("inventory"),
        Method: pointy.String("consumeItemSetByUserId"),
        UserId: pointy.String("user-0001"),
        Action: nil,
        Begin: pointy.Int64(1473174000000),
        End: pointy.Int64(1473177600000),
        LongTerm: pointy.Bool(false),
        PageToken: nil,
        Limit: nil,
        TimeOffsetToken: nil,
    }
)
if err != nil {
    panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageToken
totalCount := result.TotalCount
scanSize := result.ScanSize

```

**PHP**
```php

use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Log\Gs2LogRestClient;
use Gs2\Log\Request\CountExecuteStampTaskLogRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2LogRestClient(
    $session
);

try {
    $result = $client->countExecuteStampTaskLog(
        (new CountExecuteStampTaskLogRequest())
            ->withNamespaceName("namespace-0001")
            ->withService("inventory")
            ->withMethod("consumeItemSetByUserId")
            ->withUserId("user-0001")
            ->withAction(null)
            ->withBegin(1473174000000)
            ->withEnd(1473177600000)
            ->withLongTerm(false)
            ->withPageToken(null)
            ->withLimit(null)
            ->withTimeOffsetToken(null)
    );
    $items = $result->getItems();
    $nextPageToken = $result->getNextPageToken();
    $totalCount = $result->getTotalCount();
    $scanSize = $result->getScanSize();
} catch (Gs2Exception $e) {
    exit("error occurred")
}

```

**Java**
```java

import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.log.rest.Gs2LogRestClient;
import io.gs2.log.request.CountExecuteStampTaskLogRequest;
import io.gs2.log.result.CountExecuteStampTaskLogResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2LogRestClient client = new Gs2LogRestClient(session);

try {
    CountExecuteStampTaskLogResult result = client.countExecuteStampTaskLog(
        new CountExecuteStampTaskLogRequest()
            .withNamespaceName("namespace-0001")
            .withService("inventory")
            .withMethod("consumeItemSetByUserId")
            .withUserId("user-0001")
            .withAction(null)
            .withBegin(1473174000000L)
            .withEnd(1473177600000L)
            .withLongTerm(false)
            .withPageToken(null)
            .withLimit(null)
            .withTimeOffsetToken(null)
    );
    List<ExecuteStampTaskLogCount> items = result.getItems();
    String nextPageToken = result.getNextPageToken();
    long totalCount = result.getTotalCount();
    long scanSize = result.getScanSize();
} catch (Gs2Exception e) {
    System.exit(1);
}

```

**C#**
```csharp

using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2LogRestClient(session);

AsyncResult<Gs2.Gs2Log.Result.CountExecuteStampTaskLogResult> asyncResult = null;
yield return client.CountExecuteStampTaskLog(
    new Gs2.Gs2Log.Request.CountExecuteStampTaskLogRequest()
        .WithNamespaceName("namespace-0001")
        .WithService("inventory")
        .WithMethod("consumeItemSetByUserId")
        .WithUserId("user-0001")
        .WithAction(null)
        .WithBegin(1473174000000L)
        .WithEnd(1473177600000L)
        .WithLongTerm(false)
        .WithPageToken(null)
        .WithLimit(null)
        .WithTimeOffsetToken(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
var nextPageToken = result.NextPageToken;
var totalCount = result.TotalCount;
var scanSize = result.ScanSize;

```

**TypeScript**
```typescript

import Gs2Core from '@/gs2/core';
import * as Gs2Log from '@/gs2/log';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Log.Gs2LogRestClient(session);

try {
    const result = await client.countExecuteStampTaskLog(
        new Gs2Log.CountExecuteStampTaskLogRequest()
            .withNamespaceName("namespace-0001")
            .withService("inventory")
            .withMethod("consumeItemSetByUserId")
            .withUserId("user-0001")
            .withAction(null)
            .withBegin(1473174000000)
            .withEnd(1473177600000)
            .withLongTerm(false)
            .withPageToken(null)
            .withLimit(null)
            .withTimeOffsetToken(null)
    );
    const items = result.getItems();
    const nextPageToken = result.getNextPageToken();
    const totalCount = result.getTotalCount();
    const scanSize = result.getScanSize();
} catch (e) {
    process.exit(1);
}

```

**Python**
```python

from gs2 import core
from gs2 import log

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = log.Gs2LogRestClient(session)

try:
    result = client.count_execute_stamp_task_log(
        log.CountExecuteStampTaskLogRequest()
            .with_namespace_name('namespace-0001')
            .with_service('inventory')
            .with_method('consumeItemSetByUserId')
            .with_user_id('user-0001')
            .with_action(None)
            .with_begin(1473174000000)
            .with_end(1473177600000)
            .with_long_term(False)
            .with_page_token(None)
            .with_limit(None)
            .with_time_offset_token(None)
    )
    items = result.items
    next_page_token = result.next_page_token
    total_count = result.total_count
    scan_size = result.scan_size
except core.Gs2Exception as e:
    exit(1)


```

**GS2-Script**
```lua

client = gs2('log')

api_result = client.count_execute_stamp_task_log({
    namespaceName="namespace-0001",
    service="inventory",
    method="consumeItemSetByUserId",
    userId="user-0001",
    action=nil,
    begin=1473174000000,
    end=1473177600000,
    longTerm=false,
    pageToken=nil,
    limit=nil,
    timeOffsetToken=nil,
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;
totalCount = result.totalCount;
scanSize = result.scanSize;

```

**GS2-Script(Async)**
```lua

client = gs2('log')

api_result_handler = client.count_execute_stamp_task_log_async({
    namespaceName="namespace-0001",
    service="inventory",
    method="consumeItemSetByUserId",
    userId="user-0001",
    action=nil,
    begin=1473174000000,
    end=1473177600000,
    longTerm=false,
    pageToken=nil,
    limit=nil,
    timeOffsetToken=nil,
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;
totalCount = result.totalCount;
scanSize = result.scanSize;

```




---

### queryInGameLog

ゲーム内ログの一覧を取得<br>

指定された時間範囲内のカスタムゲーム内ログをクエリします。ユーザーIDとタグによるフィルタリングが可能です。<br>
ゲーム内ログは、開発者が定義したログエントリで、任意のペイロードデータと分類用のタグを含むことができます。7日を超える検索には longTerm フラグを有効にしてください。



#### Request

|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| namespaceName | string |  | ✓|  |  ~ 128文字 | ネームスペース名<br>ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
| userId | string |  | |  |  ~ 128文字 | ユーザーID |
| tags | [List&lt;InGameLogTag&gt;](#ingamelogtag) |  | | [] | 0 ~ 20 items | タグ<br>フィルタリングと分類のためにログエントリに付与されたキーバリューペアです。タグによりインゲームログの効率的な検索と集計が可能です（例：イベントタイプ、ステージID、アイテムカテゴリ）。 |
| begin | long |  | | 現在時刻から1時間前の絶対時刻 |  | 検索範囲開始日時 |
| end | long |  | | 現在時刻から1時間後の絶対時刻 |  | 検索範囲終了日時 |
| longTerm | bool |  | | false |  | 7日より長い期間のログを検索対象とするか |
| pageToken | string |  | |  |  ~ 1024文字 | データの取得を開始する位置を指定するトークン |
| limit | int |  | | 30 | 1 ~ 100 | データの取得件数 |
| timeOffsetToken | string |  | |  |  ~ 1024文字 | タイムオフセットトークン |

#### Result

|  | 型 | 説明 |
| --- | --- | --- |
| items | [List&lt;InGameLog&gt;](#ingamelog) | ゲーム内ログのリスト |
| nextPageToken | string | リストの続きを取得するためのページトークン |
| totalCount | long | クエリ結果の総件数 |
| scanSize | long | 検索時にスキャンした総容量(bytes) |

#### 実装例




**Go**
```go

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/log"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := log.Gs2LogRestClient{
    Session: &session,
}
result, err := client.QueryInGameLog(
    &log.QueryInGameLogRequest {
        NamespaceName: pointy.String("namespace-0001"),
        UserId: pointy.String("user-0001"),
        Tags: []log.InGameLogTag{
            log.InGameLogTag{
                Key: pointy.String("tag1"),
                Value: pointy.String("value1"),
            },
            log.InGameLogTag{
                Key: pointy.String("tag2"),
                Value: pointy.String("value2"),
            },
        },
        Begin: pointy.Int64(1473174000000),
        End: pointy.Int64(1473177600000),
        LongTerm: pointy.Bool(false),
        PageToken: nil,
        Limit: nil,
        TimeOffsetToken: nil,
    }
)
if err != nil {
    panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageToken
totalCount := result.TotalCount
scanSize := result.ScanSize

```

**PHP**
```php

use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Log\Gs2LogRestClient;
use Gs2\Log\Request\QueryInGameLogRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2LogRestClient(
    $session
);

try {
    $result = $client->queryInGameLog(
        (new QueryInGameLogRequest())
            ->withNamespaceName("namespace-0001")
            ->withUserId("user-0001")
            ->withTags([
                (new InGameLogTag())
                    ->withKey("tag1")
                    ->withValue("value1"),
                (new InGameLogTag())
                    ->withKey("tag2")
                    ->withValue("value2"),
            ])
            ->withBegin(1473174000000)
            ->withEnd(1473177600000)
            ->withLongTerm(false)
            ->withPageToken(null)
            ->withLimit(null)
            ->withTimeOffsetToken(null)
    );
    $items = $result->getItems();
    $nextPageToken = $result->getNextPageToken();
    $totalCount = $result->getTotalCount();
    $scanSize = $result->getScanSize();
} catch (Gs2Exception $e) {
    exit("error occurred")
}

```

**Java**
```java

import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.log.rest.Gs2LogRestClient;
import io.gs2.log.request.QueryInGameLogRequest;
import io.gs2.log.result.QueryInGameLogResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2LogRestClient client = new Gs2LogRestClient(session);

try {
    QueryInGameLogResult result = client.queryInGameLog(
        new QueryInGameLogRequest()
            .withNamespaceName("namespace-0001")
            .withUserId("user-0001")
            .withTags(Arrays.asList(
                new InGameLogTag()
                    .withKey("tag1")
                    .withValue("value1"),
                new InGameLogTag()
                    .withKey("tag2")
                    .withValue("value2")
            ))
            .withBegin(1473174000000L)
            .withEnd(1473177600000L)
            .withLongTerm(false)
            .withPageToken(null)
            .withLimit(null)
            .withTimeOffsetToken(null)
    );
    List<InGameLog> items = result.getItems();
    String nextPageToken = result.getNextPageToken();
    long totalCount = result.getTotalCount();
    long scanSize = result.getScanSize();
} catch (Gs2Exception e) {
    System.exit(1);
}

```

**C#**
```csharp

using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2LogRestClient(session);

AsyncResult<Gs2.Gs2Log.Result.QueryInGameLogResult> asyncResult = null;
yield return client.QueryInGameLog(
    new Gs2.Gs2Log.Request.QueryInGameLogRequest()
        .WithNamespaceName("namespace-0001")
        .WithUserId("user-0001")
        .WithTags(new Gs2.Gs2Log.Model.InGameLogTag[] {
            new Gs2.Gs2Log.Model.InGameLogTag()
                .WithKey("tag1")
                .WithValue("value1"),
            new Gs2.Gs2Log.Model.InGameLogTag()
                .WithKey("tag2")
                .WithValue("value2"),
        })
        .WithBegin(1473174000000L)
        .WithEnd(1473177600000L)
        .WithLongTerm(false)
        .WithPageToken(null)
        .WithLimit(null)
        .WithTimeOffsetToken(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
var nextPageToken = result.NextPageToken;
var totalCount = result.TotalCount;
var scanSize = result.ScanSize;

```

**TypeScript**
```typescript

import Gs2Core from '@/gs2/core';
import * as Gs2Log from '@/gs2/log';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Log.Gs2LogRestClient(session);

try {
    const result = await client.queryInGameLog(
        new Gs2Log.QueryInGameLogRequest()
            .withNamespaceName("namespace-0001")
            .withUserId("user-0001")
            .withTags([
                new Gs2Log.model.InGameLogTag()
                    .withKey("tag1")
                    .withValue("value1"),
                new Gs2Log.model.InGameLogTag()
                    .withKey("tag2")
                    .withValue("value2"),
            ])
            .withBegin(1473174000000)
            .withEnd(1473177600000)
            .withLongTerm(false)
            .withPageToken(null)
            .withLimit(null)
            .withTimeOffsetToken(null)
    );
    const items = result.getItems();
    const nextPageToken = result.getNextPageToken();
    const totalCount = result.getTotalCount();
    const scanSize = result.getScanSize();
} catch (e) {
    process.exit(1);
}

```

**Python**
```python

from gs2 import core
from gs2 import log

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = log.Gs2LogRestClient(session)

try:
    result = client.query_in_game_log(
        log.QueryInGameLogRequest()
            .with_namespace_name('namespace-0001')
            .with_user_id('user-0001')
            .with_tags([
                log.InGameLogTag()
                    .with_key('tag1')
                    .with_value('value1'),
                log.InGameLogTag()
                    .with_key('tag2')
                    .with_value('value2'),
            ])
            .with_begin(1473174000000)
            .with_end(1473177600000)
            .with_long_term(False)
            .with_page_token(None)
            .with_limit(None)
            .with_time_offset_token(None)
    )
    items = result.items
    next_page_token = result.next_page_token
    total_count = result.total_count
    scan_size = result.scan_size
except core.Gs2Exception as e:
    exit(1)


```

**GS2-Script**
```lua

client = gs2('log')

api_result = client.query_in_game_log({
    namespaceName="namespace-0001",
    userId="user-0001",
    tags={
        {
            key="tag1",
            value="value1",
        },
        {
            key="tag2",
            value="value2",
        }
    },
    begin=1473174000000,
    end=1473177600000,
    longTerm=false,
    pageToken=nil,
    limit=nil,
    timeOffsetToken=nil,
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;
totalCount = result.totalCount;
scanSize = result.scanSize;

```

**GS2-Script(Async)**
```lua

client = gs2('log')

api_result_handler = client.query_in_game_log_async({
    namespaceName="namespace-0001",
    userId="user-0001",
    tags={
        {
            key="tag1",
            value="value1",
        },
        {
            key="tag2",
            value="value2",
        }
    },
    begin=1473174000000,
    end=1473177600000,
    longTerm=false,
    pageToken=nil,
    limit=nil,
    timeOffsetToken=nil,
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;
totalCount = result.totalCount;
scanSize = result.scanSize;

```




---

### sendInGameLog

ゲーム内ログを送信<br>

指定されたタグとペイロードを含むカスタムゲーム内ログエントリをリクエストしたユーザーとして送信します。<br>
タグはログクエリ時の分類とフィルタリングに使用されます。ペイロードには開発者が定義した任意のデータを含めることができます。



#### Request

|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| namespaceName | string |  | ✓|  |  ~ 128文字 | ネームスペース名<br>ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
| accessToken | string |  | |  |  ~ 128文字 | アクセストークン |
| tags | [List&lt;InGameLogTag&gt;](#ingamelogtag) |  | | [] | 0 ~ 20 items | タグ<br>フィルタリングと分類のためにログエントリに付与されたキーバリューペアです。タグによりインゲームログの効率的な検索と集計が可能です（例：イベントタイプ、ステージID、アイテムカテゴリ）。 |
| payload | string |  | ✓|  |  ~ 10485760文字 | ペイロード<br>JSON形式のカスタムログデータです。プレイヤーのアクション、ゲーム状態、ビジネスメトリクスなど、ゲーム固有の任意の情報を含めることができます。最大10MBまで。 |

#### Result

|  | 型 | 説明 |
| --- | --- | --- |
| item | [InGameLog](#ingamelog) | ゲーム内ログ |

#### 実装例




**Go**
```go

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/log"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := log.Gs2LogRestClient{
    Session: &session,
}
result, err := client.SendInGameLog(
    &log.SendInGameLogRequest {
        NamespaceName: pointy.String("namespace-0001"),
        AccessToken: pointy.String("accessToken-0001"),
        Tags: []log.InGameLogTag{
            log.InGameLogTag{
                Key: pointy.String("tag1"),
                Value: pointy.String("value1"),
            },
            log.InGameLogTag{
                Key: pointy.String("tag2"),
                Value: pointy.String("value2"),
            },
        },
        Payload: pointy.String("{\"category\": \"use-item\", \"count\": 1, \"itemId\": \"item-0001\"}"),
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item

```

**PHP**
```php

use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Log\Gs2LogRestClient;
use Gs2\Log\Request\SendInGameLogRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2LogRestClient(
    $session
);

try {
    $result = $client->sendInGameLog(
        (new SendInGameLogRequest())
            ->withNamespaceName("namespace-0001")
            ->withAccessToken("accessToken-0001")
            ->withTags([
                (new InGameLogTag())
                    ->withKey("tag1")
                    ->withValue("value1"),
                (new InGameLogTag())
                    ->withKey("tag2")
                    ->withValue("value2"),
            ])
            ->withPayload("{\"category\": \"use-item\", \"count\": 1, \"itemId\": \"item-0001\"}")
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}

```

**Java**
```java

import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.log.rest.Gs2LogRestClient;
import io.gs2.log.request.SendInGameLogRequest;
import io.gs2.log.result.SendInGameLogResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2LogRestClient client = new Gs2LogRestClient(session);

try {
    SendInGameLogResult result = client.sendInGameLog(
        new SendInGameLogRequest()
            .withNamespaceName("namespace-0001")
            .withAccessToken("accessToken-0001")
            .withTags(Arrays.asList(
                new InGameLogTag()
                    .withKey("tag1")
                    .withValue("value1"),
                new InGameLogTag()
                    .withKey("tag2")
                    .withValue("value2")
            ))
            .withPayload("{\"category\": \"use-item\", \"count\": 1, \"itemId\": \"item-0001\"}")
    );
    InGameLog item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}

```

**C#**
```csharp

using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2LogRestClient(session);

AsyncResult<Gs2.Gs2Log.Result.SendInGameLogResult> asyncResult = null;
yield return client.SendInGameLog(
    new Gs2.Gs2Log.Request.SendInGameLogRequest()
        .WithNamespaceName("namespace-0001")
        .WithAccessToken("accessToken-0001")
        .WithTags(new Gs2.Gs2Log.Model.InGameLogTag[] {
            new Gs2.Gs2Log.Model.InGameLogTag()
                .WithKey("tag1")
                .WithValue("value1"),
            new Gs2.Gs2Log.Model.InGameLogTag()
                .WithKey("tag2")
                .WithValue("value2"),
        })
        .WithPayload("{\"category\": \"use-item\", \"count\": 1, \"itemId\": \"item-0001\"}"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;

```

**TypeScript**
```typescript

import Gs2Core from '@/gs2/core';
import * as Gs2Log from '@/gs2/log';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Log.Gs2LogRestClient(session);

try {
    const result = await client.sendInGameLog(
        new Gs2Log.SendInGameLogRequest()
            .withNamespaceName("namespace-0001")
            .withAccessToken("accessToken-0001")
            .withTags([
                new Gs2Log.model.InGameLogTag()
                    .withKey("tag1")
                    .withValue("value1"),
                new Gs2Log.model.InGameLogTag()
                    .withKey("tag2")
                    .withValue("value2"),
            ])
            .withPayload("{\"category\": \"use-item\", \"count\": 1, \"itemId\": \"item-0001\"}")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}

```

**Python**
```python

from gs2 import core
from gs2 import log

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = log.Gs2LogRestClient(session)

try:
    result = client.send_in_game_log(
        log.SendInGameLogRequest()
            .with_namespace_name('namespace-0001')
            .with_access_token('accessToken-0001')
            .with_tags([
                log.InGameLogTag()
                    .with_key('tag1')
                    .with_value('value1'),
                log.InGameLogTag()
                    .with_key('tag2')
                    .with_value('value2'),
            ])
            .with_payload('{"category": "use-item", "count": 1, "itemId": "item-0001"}')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)


```

**GS2-Script**
```lua

client = gs2('log')

api_result = client.send_in_game_log({
    namespaceName="namespace-0001",
    accessToken="accessToken-0001",
    tags={
        {
            key="tag1",
            value="value1",
        },
        {
            key="tag2",
            value="value2",
        }
    },
    payload="{\"category\": \"use-item\", \"count\": 1, \"itemId\": \"item-0001\"}",
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;

```

**GS2-Script(Async)**
```lua

client = gs2('log')

api_result_handler = client.send_in_game_log_async({
    namespaceName="namespace-0001",
    accessToken="accessToken-0001",
    tags={
        {
            key="tag1",
            value="value1",
        },
        {
            key="tag2",
            value="value2",
        }
    },
    payload="{\"category\": \"use-item\", \"count\": 1, \"itemId\": \"item-0001\"}",
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;

```




---

### sendInGameLogByUserId

ユーザーIDを指定してゲーム内ログを送信<br>

指定されたユーザーのカスタムゲーム内ログエントリを指定されたタグとペイロードで送信します。



#### Request

|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| namespaceName | string |  | ✓|  |  ~ 128文字 | ネームスペース名<br>ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
| userId | string |  | |  |  ~ 128文字 | ユーザーID |
| tags | [List&lt;InGameLogTag&gt;](#ingamelogtag) |  | | [] | 0 ~ 20 items | タグ<br>フィルタリングと分類のためにログエントリに付与されたキーバリューペアです。タグによりインゲームログの効率的な検索と集計が可能です（例：イベントタイプ、ステージID、アイテムカテゴリ）。 |
| payload | string |  | ✓|  |  ~ 10485760文字 | ペイロード<br>JSON形式のカスタムログデータです。プレイヤーのアクション、ゲーム状態、ビジネスメトリクスなど、ゲーム固有の任意の情報を含めることができます。最大10MBまで。 |
| timeOffsetToken | string |  | |  |  ~ 1024文字 | タイムオフセットトークン |

#### Result

|  | 型 | 説明 |
| --- | --- | --- |
| item | [InGameLog](#ingamelog) | ゲーム内ログ |

#### 実装例




**Go**
```go

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/log"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := log.Gs2LogRestClient{
    Session: &session,
}
result, err := client.SendInGameLogByUserId(
    &log.SendInGameLogByUserIdRequest {
        NamespaceName: pointy.String("namespace-0001"),
        UserId: pointy.String("user-0001"),
        Tags: []log.InGameLogTag{
            log.InGameLogTag{
                Key: pointy.String("tag1"),
                Value: pointy.String("value1"),
            },
            log.InGameLogTag{
                Key: pointy.String("tag2"),
                Value: pointy.String("value2"),
            },
        },
        Payload: pointy.String("{\"category\": \"use-item\", \"count\": 1, \"itemId\": \"item-0001\"}"),
        TimeOffsetToken: nil,
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item

```

**PHP**
```php

use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Log\Gs2LogRestClient;
use Gs2\Log\Request\SendInGameLogByUserIdRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2LogRestClient(
    $session
);

try {
    $result = $client->sendInGameLogByUserId(
        (new SendInGameLogByUserIdRequest())
            ->withNamespaceName("namespace-0001")
            ->withUserId("user-0001")
            ->withTags([
                (new InGameLogTag())
                    ->withKey("tag1")
                    ->withValue("value1"),
                (new InGameLogTag())
                    ->withKey("tag2")
                    ->withValue("value2"),
            ])
            ->withPayload("{\"category\": \"use-item\", \"count\": 1, \"itemId\": \"item-0001\"}")
            ->withTimeOffsetToken(null)
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}

```

**Java**
```java

import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.log.rest.Gs2LogRestClient;
import io.gs2.log.request.SendInGameLogByUserIdRequest;
import io.gs2.log.result.SendInGameLogByUserIdResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2LogRestClient client = new Gs2LogRestClient(session);

try {
    SendInGameLogByUserIdResult result = client.sendInGameLogByUserId(
        new SendInGameLogByUserIdRequest()
            .withNamespaceName("namespace-0001")
            .withUserId("user-0001")
            .withTags(Arrays.asList(
                new InGameLogTag()
                    .withKey("tag1")
                    .withValue("value1"),
                new InGameLogTag()
                    .withKey("tag2")
                    .withValue("value2")
            ))
            .withPayload("{\"category\": \"use-item\", \"count\": 1, \"itemId\": \"item-0001\"}")
            .withTimeOffsetToken(null)
    );
    InGameLog item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}

```

**C#**
```csharp

using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2LogRestClient(session);

AsyncResult<Gs2.Gs2Log.Result.SendInGameLogByUserIdResult> asyncResult = null;
yield return client.SendInGameLogByUserId(
    new Gs2.Gs2Log.Request.SendInGameLogByUserIdRequest()
        .WithNamespaceName("namespace-0001")
        .WithUserId("user-0001")
        .WithTags(new Gs2.Gs2Log.Model.InGameLogTag[] {
            new Gs2.Gs2Log.Model.InGameLogTag()
                .WithKey("tag1")
                .WithValue("value1"),
            new Gs2.Gs2Log.Model.InGameLogTag()
                .WithKey("tag2")
                .WithValue("value2"),
        })
        .WithPayload("{\"category\": \"use-item\", \"count\": 1, \"itemId\": \"item-0001\"}")
        .WithTimeOffsetToken(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;

```

**TypeScript**
```typescript

import Gs2Core from '@/gs2/core';
import * as Gs2Log from '@/gs2/log';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Log.Gs2LogRestClient(session);

try {
    const result = await client.sendInGameLogByUserId(
        new Gs2Log.SendInGameLogByUserIdRequest()
            .withNamespaceName("namespace-0001")
            .withUserId("user-0001")
            .withTags([
                new Gs2Log.model.InGameLogTag()
                    .withKey("tag1")
                    .withValue("value1"),
                new Gs2Log.model.InGameLogTag()
                    .withKey("tag2")
                    .withValue("value2"),
            ])
            .withPayload("{\"category\": \"use-item\", \"count\": 1, \"itemId\": \"item-0001\"}")
            .withTimeOffsetToken(null)
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}

```

**Python**
```python

from gs2 import core
from gs2 import log

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = log.Gs2LogRestClient(session)

try:
    result = client.send_in_game_log_by_user_id(
        log.SendInGameLogByUserIdRequest()
            .with_namespace_name('namespace-0001')
            .with_user_id('user-0001')
            .with_tags([
                log.InGameLogTag()
                    .with_key('tag1')
                    .with_value('value1'),
                log.InGameLogTag()
                    .with_key('tag2')
                    .with_value('value2'),
            ])
            .with_payload('{"category": "use-item", "count": 1, "itemId": "item-0001"}')
            .with_time_offset_token(None)
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)


```

**GS2-Script**
```lua

client = gs2('log')

api_result = client.send_in_game_log_by_user_id({
    namespaceName="namespace-0001",
    userId="user-0001",
    tags={
        {
            key="tag1",
            value="value1",
        },
        {
            key="tag2",
            value="value2",
        }
    },
    payload="{\"category\": \"use-item\", \"count\": 1, \"itemId\": \"item-0001\"}",
    timeOffsetToken=nil,
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;

```

**GS2-Script(Async)**
```lua

client = gs2('log')

api_result_handler = client.send_in_game_log_by_user_id_async({
    namespaceName="namespace-0001",
    userId="user-0001",
    tags={
        {
            key="tag1",
            value="value1",
        },
        {
            key="tag2",
            value="value2",
        }
    },
    payload="{\"category\": \"use-item\", \"count\": 1, \"itemId\": \"item-0001\"}",
    timeOffsetToken=nil,
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;

```




---

### queryAccessLogWithTelemetry

テレメトリ付きのアクセスログの一覧を取得<br>

指定された時間範囲内のテレメトリデータを含むアクセスログをクエリします。ユーザーIDによるフィルタリングが可能です。<br>
テレメトリデータは各API呼び出しに対する追加のパフォーマンス・診断情報を提供します。7日を超える期間を検索する場合は longTerm フラグを有効にする必要があります。



#### Request

|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| namespaceName | string |  | ✓|  |  ~ 128文字 | ネームスペース名<br>ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
| userId | string |  | |  |  ~ 128文字 | ユーザーID |
| begin | long |  | | 現在時刻から1時間前の絶対時刻 |  | 検索範囲開始日時 |
| end | long |  | | 現在時刻 |  | 検索範囲終了日時 |
| longTerm | bool |  | | false |  | 7日より長い期間のログを検索対象とするか |
| pageToken | string |  | |  |  ~ 1024文字 | データの取得を開始する位置を指定するトークン |
| limit | int |  | | 30 | 1 ~ 1000 | データの取得件数 |
| timeOffsetToken | string |  | |  |  ~ 1024文字 | タイムオフセットトークン |

#### Result

|  | 型 | 説明 |
| --- | --- | --- |
| items | [List&lt;AccessLogWithTelemetry&gt;](#accesslogwithtelemetry) | アクセスログのリスト |
| nextPageToken | string | リストの続きを取得するためのページトークン |
| totalCount | long | クエリ結果の総件数 |
| scanSize | long | 検索時にスキャンした総容量(bytes) |

#### 実装例




**Go**
```go

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/log"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := log.Gs2LogRestClient{
    Session: &session,
}
result, err := client.QueryAccessLogWithTelemetry(
    &log.QueryAccessLogWithTelemetryRequest {
        NamespaceName: pointy.String("namespace-0001"),
        UserId: pointy.String("user-0001"),
        Begin: pointy.Int64(1473174000000),
        End: pointy.Int64(1473177600000),
        LongTerm: pointy.Bool(false),
        PageToken: nil,
        Limit: nil,
        TimeOffsetToken: nil,
    }
)
if err != nil {
    panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageToken
totalCount := result.TotalCount
scanSize := result.ScanSize

```

**PHP**
```php

use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Log\Gs2LogRestClient;
use Gs2\Log\Request\QueryAccessLogWithTelemetryRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2LogRestClient(
    $session
);

try {
    $result = $client->queryAccessLogWithTelemetry(
        (new QueryAccessLogWithTelemetryRequest())
            ->withNamespaceName("namespace-0001")
            ->withUserId("user-0001")
            ->withBegin(1473174000000)
            ->withEnd(1473177600000)
            ->withLongTerm(false)
            ->withPageToken(null)
            ->withLimit(null)
            ->withTimeOffsetToken(null)
    );
    $items = $result->getItems();
    $nextPageToken = $result->getNextPageToken();
    $totalCount = $result->getTotalCount();
    $scanSize = $result->getScanSize();
} catch (Gs2Exception $e) {
    exit("error occurred")
}

```

**Java**
```java

import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.log.rest.Gs2LogRestClient;
import io.gs2.log.request.QueryAccessLogWithTelemetryRequest;
import io.gs2.log.result.QueryAccessLogWithTelemetryResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2LogRestClient client = new Gs2LogRestClient(session);

try {
    QueryAccessLogWithTelemetryResult result = client.queryAccessLogWithTelemetry(
        new QueryAccessLogWithTelemetryRequest()
            .withNamespaceName("namespace-0001")
            .withUserId("user-0001")
            .withBegin(1473174000000L)
            .withEnd(1473177600000L)
            .withLongTerm(false)
            .withPageToken(null)
            .withLimit(null)
            .withTimeOffsetToken(null)
    );
    List<AccessLogWithTelemetry> items = result.getItems();
    String nextPageToken = result.getNextPageToken();
    long totalCount = result.getTotalCount();
    long scanSize = result.getScanSize();
} catch (Gs2Exception e) {
    System.exit(1);
}

```

**C#**
```csharp

using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2LogRestClient(session);

AsyncResult<Gs2.Gs2Log.Result.QueryAccessLogWithTelemetryResult> asyncResult = null;
yield return client.QueryAccessLogWithTelemetry(
    new Gs2.Gs2Log.Request.QueryAccessLogWithTelemetryRequest()
        .WithNamespaceName("namespace-0001")
        .WithUserId("user-0001")
        .WithBegin(1473174000000L)
        .WithEnd(1473177600000L)
        .WithLongTerm(false)
        .WithPageToken(null)
        .WithLimit(null)
        .WithTimeOffsetToken(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
var nextPageToken = result.NextPageToken;
var totalCount = result.TotalCount;
var scanSize = result.ScanSize;

```

**TypeScript**
```typescript

import Gs2Core from '@/gs2/core';
import * as Gs2Log from '@/gs2/log';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Log.Gs2LogRestClient(session);

try {
    const result = await client.queryAccessLogWithTelemetry(
        new Gs2Log.QueryAccessLogWithTelemetryRequest()
            .withNamespaceName("namespace-0001")
            .withUserId("user-0001")
            .withBegin(1473174000000)
            .withEnd(1473177600000)
            .withLongTerm(false)
            .withPageToken(null)
            .withLimit(null)
            .withTimeOffsetToken(null)
    );
    const items = result.getItems();
    const nextPageToken = result.getNextPageToken();
    const totalCount = result.getTotalCount();
    const scanSize = result.getScanSize();
} catch (e) {
    process.exit(1);
}

```

**Python**
```python

from gs2 import core
from gs2 import log

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = log.Gs2LogRestClient(session)

try:
    result = client.query_access_log_with_telemetry(
        log.QueryAccessLogWithTelemetryRequest()
            .with_namespace_name('namespace-0001')
            .with_user_id('user-0001')
            .with_begin(1473174000000)
            .with_end(1473177600000)
            .with_long_term(False)
            .with_page_token(None)
            .with_limit(None)
            .with_time_offset_token(None)
    )
    items = result.items
    next_page_token = result.next_page_token
    total_count = result.total_count
    scan_size = result.scan_size
except core.Gs2Exception as e:
    exit(1)


```

**GS2-Script**
```lua

client = gs2('log')

api_result = client.query_access_log_with_telemetry({
    namespaceName="namespace-0001",
    userId="user-0001",
    begin=1473174000000,
    end=1473177600000,
    longTerm=false,
    pageToken=nil,
    limit=nil,
    timeOffsetToken=nil,
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;
totalCount = result.totalCount;
scanSize = result.scanSize;

```

**GS2-Script(Async)**
```lua

client = gs2('log')

api_result_handler = client.query_access_log_with_telemetry_async({
    namespaceName="namespace-0001",
    userId="user-0001",
    begin=1473174000000,
    end=1473177600000,
    longTerm=false,
    pageToken=nil,
    limit=nil,
    timeOffsetToken=nil,
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;
totalCount = result.totalCount;
scanSize = result.scanSize;

```




---

### describeInsights

GS2-Insightインスタンスの一覧を取得<br>

指定されたネームスペースの GS2-Insight インスタンスのページネーション付きリストを取得します。<br>
各 Insight はログ分析環境を表し、起動後2時間で自動的にシャットダウンされます。



#### Request

|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| namespaceName | string |  | ✓|  |  ~ 128文字 | ネームスペース名<br>ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
| pageToken | string |  | |  |  ~ 1024文字 | データの取得を開始する位置を指定するトークン |
| limit | int |  | | 30 | 1 ~ 1000 | データの取得件数 |

#### Result

|  | 型 | 説明 |
| --- | --- | --- |
| items | [List&lt;Insight&gt;](#insight) | GS2-Insightのリスト |
| nextPageToken | string | リストの続きを取得するためのページトークン |

#### 実装例




**Go**
```go

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/log"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := log.Gs2LogRestClient{
    Session: &session,
}
result, err := client.DescribeInsights(
    &log.DescribeInsightsRequest {
        NamespaceName: pointy.String("namespace-0001"),
        PageToken: nil,
        Limit: nil,
    }
)
if err != nil {
    panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageToken

```

**PHP**
```php

use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Log\Gs2LogRestClient;
use Gs2\Log\Request\DescribeInsightsRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2LogRestClient(
    $session
);

try {
    $result = $client->describeInsights(
        (new DescribeInsightsRequest())
            ->withNamespaceName("namespace-0001")
            ->withPageToken(null)
            ->withLimit(null)
    );
    $items = $result->getItems();
    $nextPageToken = $result->getNextPageToken();
} catch (Gs2Exception $e) {
    exit("error occurred")
}

```

**Java**
```java

import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.log.rest.Gs2LogRestClient;
import io.gs2.log.request.DescribeInsightsRequest;
import io.gs2.log.result.DescribeInsightsResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2LogRestClient client = new Gs2LogRestClient(session);

try {
    DescribeInsightsResult result = client.describeInsights(
        new DescribeInsightsRequest()
            .withNamespaceName("namespace-0001")
            .withPageToken(null)
            .withLimit(null)
    );
    List<Insight> items = result.getItems();
    String nextPageToken = result.getNextPageToken();
} catch (Gs2Exception e) {
    System.exit(1);
}

```

**C#**
```csharp

using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2LogRestClient(session);

AsyncResult<Gs2.Gs2Log.Result.DescribeInsightsResult> asyncResult = null;
yield return client.DescribeInsights(
    new Gs2.Gs2Log.Request.DescribeInsightsRequest()
        .WithNamespaceName("namespace-0001")
        .WithPageToken(null)
        .WithLimit(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
var nextPageToken = result.NextPageToken;

```

**TypeScript**
```typescript

import Gs2Core from '@/gs2/core';
import * as Gs2Log from '@/gs2/log';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Log.Gs2LogRestClient(session);

try {
    const result = await client.describeInsights(
        new Gs2Log.DescribeInsightsRequest()
            .withNamespaceName("namespace-0001")
            .withPageToken(null)
            .withLimit(null)
    );
    const items = result.getItems();
    const nextPageToken = result.getNextPageToken();
} catch (e) {
    process.exit(1);
}

```

**Python**
```python

from gs2 import core
from gs2 import log

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = log.Gs2LogRestClient(session)

try:
    result = client.describe_insights(
        log.DescribeInsightsRequest()
            .with_namespace_name('namespace-0001')
            .with_page_token(None)
            .with_limit(None)
    )
    items = result.items
    next_page_token = result.next_page_token
except core.Gs2Exception as e:
    exit(1)


```

**GS2-Script**
```lua

client = gs2('log')

api_result = client.describe_insights({
    namespaceName="namespace-0001",
    pageToken=nil,
    limit=nil,
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;

```

**GS2-Script(Async)**
```lua

client = gs2('log')

api_result_handler = client.describe_insights_async({
    namespaceName="namespace-0001",
    pageToken=nil,
    limit=nil,
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;

```




---

### createInsight

GS2-Insightを起動<br>

指定されたネームスペースに新しい GS2-Insight ログ分析環境を起動します。<br>
Insight インスタンスは起動後2時間で自動的にシャットダウンされます。ネームスペースごとに同時にアクティブにできるインスタンスは1つのみです。



#### Request

|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| namespaceName | string |  | ✓|  |  ~ 128文字 | ネームスペース名<br>ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |

#### Result

|  | 型 | 説明 |
| --- | --- | --- |
| item | [Insight](#insight) | GS2-Insight |

#### 実装例




**Go**
```go

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/log"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := log.Gs2LogRestClient{
    Session: &session,
}
result, err := client.CreateInsight(
    &log.CreateInsightRequest {
        NamespaceName: pointy.String("namespace-0001"),
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item

```

**PHP**
```php

use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Log\Gs2LogRestClient;
use Gs2\Log\Request\CreateInsightRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2LogRestClient(
    $session
);

try {
    $result = $client->createInsight(
        (new CreateInsightRequest())
            ->withNamespaceName("namespace-0001")
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}

```

**Java**
```java

import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.log.rest.Gs2LogRestClient;
import io.gs2.log.request.CreateInsightRequest;
import io.gs2.log.result.CreateInsightResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2LogRestClient client = new Gs2LogRestClient(session);

try {
    CreateInsightResult result = client.createInsight(
        new CreateInsightRequest()
            .withNamespaceName("namespace-0001")
    );
    Insight item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}

```

**C#**
```csharp

using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2LogRestClient(session);

AsyncResult<Gs2.Gs2Log.Result.CreateInsightResult> asyncResult = null;
yield return client.CreateInsight(
    new Gs2.Gs2Log.Request.CreateInsightRequest()
        .WithNamespaceName("namespace-0001"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;

```

**TypeScript**
```typescript

import Gs2Core from '@/gs2/core';
import * as Gs2Log from '@/gs2/log';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Log.Gs2LogRestClient(session);

try {
    const result = await client.createInsight(
        new Gs2Log.CreateInsightRequest()
            .withNamespaceName("namespace-0001")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}

```

**Python**
```python

from gs2 import core
from gs2 import log

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = log.Gs2LogRestClient(session)

try:
    result = client.create_insight(
        log.CreateInsightRequest()
            .with_namespace_name('namespace-0001')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)


```

**GS2-Script**
```lua

client = gs2('log')

api_result = client.create_insight({
    namespaceName="namespace-0001",
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;

```

**GS2-Script(Async)**
```lua

client = gs2('log')

api_result_handler = client.create_insight_async({
    namespaceName="namespace-0001",
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;

```




---

### getInsight

GS2-Insightを取得<br>

指定された GS2-Insight インスタンスの現在のステータスと起動時刻を含む情報を取得します。



#### Request

|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| namespaceName | string |  | ✓|  |  ~ 128文字 | ネームスペース名<br>ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
| insightName | string |  | ✓| UUID |  ~ 36文字 | 名前 |

#### Result

|  | 型 | 説明 |
| --- | --- | --- |
| item | [Insight](#insight) | GS2-Insight |

#### 実装例




**Go**
```go

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/log"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := log.Gs2LogRestClient{
    Session: &session,
}
result, err := client.GetInsight(
    &log.GetInsightRequest {
        NamespaceName: pointy.String("namespace-0001"),
        InsightName: pointy.String("insight1-0001"),
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item

```

**PHP**
```php

use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Log\Gs2LogRestClient;
use Gs2\Log\Request\GetInsightRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2LogRestClient(
    $session
);

try {
    $result = $client->getInsight(
        (new GetInsightRequest())
            ->withNamespaceName("namespace-0001")
            ->withInsightName("insight1-0001")
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}

```

**Java**
```java

import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.log.rest.Gs2LogRestClient;
import io.gs2.log.request.GetInsightRequest;
import io.gs2.log.result.GetInsightResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2LogRestClient client = new Gs2LogRestClient(session);

try {
    GetInsightResult result = client.getInsight(
        new GetInsightRequest()
            .withNamespaceName("namespace-0001")
            .withInsightName("insight1-0001")
    );
    Insight item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}

```

**C#**
```csharp

using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2LogRestClient(session);

AsyncResult<Gs2.Gs2Log.Result.GetInsightResult> asyncResult = null;
yield return client.GetInsight(
    new Gs2.Gs2Log.Request.GetInsightRequest()
        .WithNamespaceName("namespace-0001")
        .WithInsightName("insight1-0001"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;

```

**TypeScript**
```typescript

import Gs2Core from '@/gs2/core';
import * as Gs2Log from '@/gs2/log';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Log.Gs2LogRestClient(session);

try {
    const result = await client.getInsight(
        new Gs2Log.GetInsightRequest()
            .withNamespaceName("namespace-0001")
            .withInsightName("insight1-0001")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}

```

**Python**
```python

from gs2 import core
from gs2 import log

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = log.Gs2LogRestClient(session)

try:
    result = client.get_insight(
        log.GetInsightRequest()
            .with_namespace_name('namespace-0001')
            .with_insight_name('insight1-0001')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)


```

**GS2-Script**
```lua

client = gs2('log')

api_result = client.get_insight({
    namespaceName="namespace-0001",
    insightName="insight1-0001",
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;

```

**GS2-Script(Async)**
```lua

client = gs2('log')

api_result_handler = client.get_insight_async({
    namespaceName="namespace-0001",
    insightName="insight1-0001",
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;

```




---

### deleteInsight

GS2-Insightを削除<br>

指定された GS2-Insight インスタンスを削除し、ログ分析環境を即座にシャットダウンします。



#### Request

|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| namespaceName | string |  | ✓|  |  ~ 128文字 | ネームスペース名<br>ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
| insightName | string |  | ✓| UUID |  ~ 36文字 | 名前 |

#### Result

|  | 型 | 説明 |
| --- | --- | --- |
| item | [Insight](#insight) | GS2-Insight |

#### 実装例




**Go**
```go

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/log"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := log.Gs2LogRestClient{
    Session: &session,
}
result, err := client.DeleteInsight(
    &log.DeleteInsightRequest {
        NamespaceName: pointy.String("namespace-0001"),
        InsightName: pointy.String("insight1-0001"),
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item

```

**PHP**
```php

use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Log\Gs2LogRestClient;
use Gs2\Log\Request\DeleteInsightRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2LogRestClient(
    $session
);

try {
    $result = $client->deleteInsight(
        (new DeleteInsightRequest())
            ->withNamespaceName("namespace-0001")
            ->withInsightName("insight1-0001")
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}

```

**Java**
```java

import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.log.rest.Gs2LogRestClient;
import io.gs2.log.request.DeleteInsightRequest;
import io.gs2.log.result.DeleteInsightResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2LogRestClient client = new Gs2LogRestClient(session);

try {
    DeleteInsightResult result = client.deleteInsight(
        new DeleteInsightRequest()
            .withNamespaceName("namespace-0001")
            .withInsightName("insight1-0001")
    );
    Insight item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}

```

**C#**
```csharp

using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2LogRestClient(session);

AsyncResult<Gs2.Gs2Log.Result.DeleteInsightResult> asyncResult = null;
yield return client.DeleteInsight(
    new Gs2.Gs2Log.Request.DeleteInsightRequest()
        .WithNamespaceName("namespace-0001")
        .WithInsightName("insight1-0001"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;

```

**TypeScript**
```typescript

import Gs2Core from '@/gs2/core';
import * as Gs2Log from '@/gs2/log';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Log.Gs2LogRestClient(session);

try {
    const result = await client.deleteInsight(
        new Gs2Log.DeleteInsightRequest()
            .withNamespaceName("namespace-0001")
            .withInsightName("insight1-0001")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}

```

**Python**
```python

from gs2 import core
from gs2 import log

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = log.Gs2LogRestClient(session)

try:
    result = client.delete_insight(
        log.DeleteInsightRequest()
            .with_namespace_name('namespace-0001')
            .with_insight_name('insight1-0001')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)


```

**GS2-Script**
```lua

client = gs2('log')

api_result = client.delete_insight({
    namespaceName="namespace-0001",
    insightName="insight1-0001",
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;

```

**GS2-Script(Async)**
```lua

client = gs2('log')

api_result_handler = client.delete_insight_async({
    namespaceName="namespace-0001",
    insightName="insight1-0001",
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;

```




---

### describeDashboards

ダッシュボードの一覧を取得<br>

指定されたネームスペースのダッシュボードのページネーション付きリストを取得します。<br>
ダッシュボードはログデータとメトリクスを可視化するカスタマイズ可能なビューを提供します。名前の接頭辞でフィルタリングできます。



#### Request

|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| namespaceName | string |  | ✓|  |  ~ 128文字 | ネームスペース名<br>ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
| namePrefix | string |  | |  |  ~ 64文字 | ダッシュボード名のフィルター接頭辞 |
| pageToken | string |  | |  |  ~ 1024文字 | データの取得を開始する位置を指定するトークン |
| limit | int |  | | 30 | 1 ~ 1000 | データの取得件数 |

#### Result

|  | 型 | 説明 |
| --- | --- | --- |
| items | [List&lt;Dashboard&gt;](#dashboard) | ダッシュボードのリスト |
| nextPageToken | string | リストの続きを取得するためのページトークン |

#### 実装例




**Go**
```go

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/log"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := log.Gs2LogRestClient{
    Session: &session,
}
result, err := client.DescribeDashboards(
    &log.DescribeDashboardsRequest {
        NamespaceName: pointy.String("namespace-0001"),
        NamePrefix: nil,
        PageToken: nil,
        Limit: nil,
    }
)
if err != nil {
    panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageToken

```

**PHP**
```php

use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Log\Gs2LogRestClient;
use Gs2\Log\Request\DescribeDashboardsRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2LogRestClient(
    $session
);

try {
    $result = $client->describeDashboards(
        (new DescribeDashboardsRequest())
            ->withNamespaceName("namespace-0001")
            ->withNamePrefix(null)
            ->withPageToken(null)
            ->withLimit(null)
    );
    $items = $result->getItems();
    $nextPageToken = $result->getNextPageToken();
} catch (Gs2Exception $e) {
    exit("error occurred")
}

```

**Java**
```java

import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.log.rest.Gs2LogRestClient;
import io.gs2.log.request.DescribeDashboardsRequest;
import io.gs2.log.result.DescribeDashboardsResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2LogRestClient client = new Gs2LogRestClient(session);

try {
    DescribeDashboardsResult result = client.describeDashboards(
        new DescribeDashboardsRequest()
            .withNamespaceName("namespace-0001")
            .withNamePrefix(null)
            .withPageToken(null)
            .withLimit(null)
    );
    List<Dashboard> items = result.getItems();
    String nextPageToken = result.getNextPageToken();
} catch (Gs2Exception e) {
    System.exit(1);
}

```

**C#**
```csharp

using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2LogRestClient(session);

AsyncResult<Gs2.Gs2Log.Result.DescribeDashboardsResult> asyncResult = null;
yield return client.DescribeDashboards(
    new Gs2.Gs2Log.Request.DescribeDashboardsRequest()
        .WithNamespaceName("namespace-0001")
        .WithNamePrefix(null)
        .WithPageToken(null)
        .WithLimit(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
var nextPageToken = result.NextPageToken;

```

**TypeScript**
```typescript

import Gs2Core from '@/gs2/core';
import * as Gs2Log from '@/gs2/log';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Log.Gs2LogRestClient(session);

try {
    const result = await client.describeDashboards(
        new Gs2Log.DescribeDashboardsRequest()
            .withNamespaceName("namespace-0001")
            .withNamePrefix(null)
            .withPageToken(null)
            .withLimit(null)
    );
    const items = result.getItems();
    const nextPageToken = result.getNextPageToken();
} catch (e) {
    process.exit(1);
}

```

**Python**
```python

from gs2 import core
from gs2 import log

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = log.Gs2LogRestClient(session)

try:
    result = client.describe_dashboards(
        log.DescribeDashboardsRequest()
            .with_namespace_name('namespace-0001')
            .with_name_prefix(None)
            .with_page_token(None)
            .with_limit(None)
    )
    items = result.items
    next_page_token = result.next_page_token
except core.Gs2Exception as e:
    exit(1)


```

**GS2-Script**
```lua

client = gs2('log')

api_result = client.describe_dashboards({
    namespaceName="namespace-0001",
    namePrefix=nil,
    pageToken=nil,
    limit=nil,
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;

```

**GS2-Script(Async)**
```lua

client = gs2('log')

api_result_handler = client.describe_dashboards_async({
    namespaceName="namespace-0001",
    namePrefix=nil,
    pageToken=nil,
    limit=nil,
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;

```




---

### createDashboard

ダッシュボードを新規作成<br>

指定された表示名と説明で新しいダッシュボードを作成します。<br>
ダッシュボードのペイロード（レイアウトとウィジェット設定）は後から更新で設定できます。



#### Request

|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| namespaceName | string |  | ✓|  |  ~ 128文字 | ネームスペース名<br>ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
| displayName | string |  | ✓|  |  ~ 256文字 | 表示用の名前<br>このダッシュボードの人間が読める名前で、ダッシュボード一覧やヘッダーに表示されます。 |
| description | string |  | |  |  ~ 1024文字 | 説明文 |

#### Result

|  | 型 | 説明 |
| --- | --- | --- |
| item | [Dashboard](#dashboard) | 作成したダッシュボード |

#### 実装例




**Go**
```go

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/log"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := log.Gs2LogRestClient{
    Session: &session,
}
result, err := client.CreateDashboard(
    &log.CreateDashboardRequest {
        NamespaceName: pointy.String("namespace-0001"),
        DisplayName: pointy.String("Sample Dashboard 0001"),
        Description: nil,
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item

```

**PHP**
```php

use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Log\Gs2LogRestClient;
use Gs2\Log\Request\CreateDashboardRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2LogRestClient(
    $session
);

try {
    $result = $client->createDashboard(
        (new CreateDashboardRequest())
            ->withNamespaceName("namespace-0001")
            ->withDisplayName("Sample Dashboard 0001")
            ->withDescription(null)
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}

```

**Java**
```java

import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.log.rest.Gs2LogRestClient;
import io.gs2.log.request.CreateDashboardRequest;
import io.gs2.log.result.CreateDashboardResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2LogRestClient client = new Gs2LogRestClient(session);

try {
    CreateDashboardResult result = client.createDashboard(
        new CreateDashboardRequest()
            .withNamespaceName("namespace-0001")
            .withDisplayName("Sample Dashboard 0001")
            .withDescription(null)
    );
    Dashboard item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}

```

**C#**
```csharp

using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2LogRestClient(session);

AsyncResult<Gs2.Gs2Log.Result.CreateDashboardResult> asyncResult = null;
yield return client.CreateDashboard(
    new Gs2.Gs2Log.Request.CreateDashboardRequest()
        .WithNamespaceName("namespace-0001")
        .WithDisplayName("Sample Dashboard 0001")
        .WithDescription(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;

```

**TypeScript**
```typescript

import Gs2Core from '@/gs2/core';
import * as Gs2Log from '@/gs2/log';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Log.Gs2LogRestClient(session);

try {
    const result = await client.createDashboard(
        new Gs2Log.CreateDashboardRequest()
            .withNamespaceName("namespace-0001")
            .withDisplayName("Sample Dashboard 0001")
            .withDescription(null)
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}

```

**Python**
```python

from gs2 import core
from gs2 import log

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = log.Gs2LogRestClient(session)

try:
    result = client.create_dashboard(
        log.CreateDashboardRequest()
            .with_namespace_name('namespace-0001')
            .with_display_name('Sample Dashboard 0001')
            .with_description(None)
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)


```

**GS2-Script**
```lua

client = gs2('log')

api_result = client.create_dashboard({
    namespaceName="namespace-0001",
    displayName="Sample Dashboard 0001",
    description=nil,
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;

```

**GS2-Script(Async)**
```lua

client = gs2('log')

api_result_handler = client.create_dashboard_async({
    namespaceName="namespace-0001",
    displayName="Sample Dashboard 0001",
    description=nil,
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;

```




---

### getDashboard

ダッシュボードを取得<br>

指定されたダッシュボードの表示名、説明、ペイロード設定を含む情報を取得します。



#### Request

|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| namespaceName | string |  | ✓|  |  ~ 128文字 | ネームスペース名<br>ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
| dashboardName | string |  | ✓| UUID |  ~ 36文字 | ダッシュボード名 |

#### Result

|  | 型 | 説明 |
| --- | --- | --- |
| item | [Dashboard](#dashboard) | ダッシュボード |

#### 実装例




**Go**
```go

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/log"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := log.Gs2LogRestClient{
    Session: &session,
}
result, err := client.GetDashboard(
    &log.GetDashboardRequest {
        NamespaceName: pointy.String("namespace-0001"),
        DashboardName: pointy.String("dashboard-0001"),
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item

```

**PHP**
```php

use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Log\Gs2LogRestClient;
use Gs2\Log\Request\GetDashboardRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2LogRestClient(
    $session
);

try {
    $result = $client->getDashboard(
        (new GetDashboardRequest())
            ->withNamespaceName("namespace-0001")
            ->withDashboardName("dashboard-0001")
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}

```

**Java**
```java

import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.log.rest.Gs2LogRestClient;
import io.gs2.log.request.GetDashboardRequest;
import io.gs2.log.result.GetDashboardResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2LogRestClient client = new Gs2LogRestClient(session);

try {
    GetDashboardResult result = client.getDashboard(
        new GetDashboardRequest()
            .withNamespaceName("namespace-0001")
            .withDashboardName("dashboard-0001")
    );
    Dashboard item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}

```

**C#**
```csharp

using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2LogRestClient(session);

AsyncResult<Gs2.Gs2Log.Result.GetDashboardResult> asyncResult = null;
yield return client.GetDashboard(
    new Gs2.Gs2Log.Request.GetDashboardRequest()
        .WithNamespaceName("namespace-0001")
        .WithDashboardName("dashboard-0001"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;

```

**TypeScript**
```typescript

import Gs2Core from '@/gs2/core';
import * as Gs2Log from '@/gs2/log';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Log.Gs2LogRestClient(session);

try {
    const result = await client.getDashboard(
        new Gs2Log.GetDashboardRequest()
            .withNamespaceName("namespace-0001")
            .withDashboardName("dashboard-0001")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}

```

**Python**
```python

from gs2 import core
from gs2 import log

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = log.Gs2LogRestClient(session)

try:
    result = client.get_dashboard(
        log.GetDashboardRequest()
            .with_namespace_name('namespace-0001')
            .with_dashboard_name('dashboard-0001')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)


```

**GS2-Script**
```lua

client = gs2('log')

api_result = client.get_dashboard({
    namespaceName="namespace-0001",
    dashboardName="dashboard-0001",
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;

```

**GS2-Script(Async)**
```lua

client = gs2('log')

api_result_handler = client.get_dashboard_async({
    namespaceName="namespace-0001",
    dashboardName="dashboard-0001",
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;

```




---

### updateDashboard

ダッシュボードを更新<br>

指定されたダッシュボードの表示名、説明、ペイロード設定を更新します。<br>
ペイロードにはダッシュボードのレイアウトとウィジェット定義が含まれます。



#### Request

|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| namespaceName | string |  | ✓|  |  ~ 128文字 | ネームスペース名<br>ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
| dashboardName | string |  | ✓| UUID |  ~ 36文字 | ダッシュボード名 |
| displayName | string |  | ✓|  |  ~ 256文字 | 表示用の名前<br>このダッシュボードの人間が読める名前で、ダッシュボード一覧やヘッダーに表示されます。 |
| description | string |  | |  |  ~ 1024文字 | 説明文 |
| payload | string |  | ✓|  |  ~ 1048576文字 | ペイロード<br>JSON形式のダッシュボード設定で、ウィジェット定義、レイアウト情報、クエリ設定、可視化オプションを含みます。 |

#### Result

|  | 型 | 説明 |
| --- | --- | --- |
| item | [Dashboard](#dashboard) | 更新したダッシュボード |

#### 実装例




**Go**
```go

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/log"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := log.Gs2LogRestClient{
    Session: &session,
}
result, err := client.UpdateDashboard(
    &log.UpdateDashboardRequest {
        NamespaceName: pointy.String("namespace-0001"),
        DashboardName: pointy.String("dashboard-0001"),
        DisplayName: pointy.String("Sample Dashboard 0001"),
        Description: nil,
        Payload: pointy.String("{\"widgets\": []}"),
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item

```

**PHP**
```php

use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Log\Gs2LogRestClient;
use Gs2\Log\Request\UpdateDashboardRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2LogRestClient(
    $session
);

try {
    $result = $client->updateDashboard(
        (new UpdateDashboardRequest())
            ->withNamespaceName("namespace-0001")
            ->withDashboardName("dashboard-0001")
            ->withDisplayName("Sample Dashboard 0001")
            ->withDescription(null)
            ->withPayload("{\"widgets\": []}")
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}

```

**Java**
```java

import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.log.rest.Gs2LogRestClient;
import io.gs2.log.request.UpdateDashboardRequest;
import io.gs2.log.result.UpdateDashboardResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2LogRestClient client = new Gs2LogRestClient(session);

try {
    UpdateDashboardResult result = client.updateDashboard(
        new UpdateDashboardRequest()
            .withNamespaceName("namespace-0001")
            .withDashboardName("dashboard-0001")
            .withDisplayName("Sample Dashboard 0001")
            .withDescription(null)
            .withPayload("{\"widgets\": []}")
    );
    Dashboard item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}

```

**C#**
```csharp

using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2LogRestClient(session);

AsyncResult<Gs2.Gs2Log.Result.UpdateDashboardResult> asyncResult = null;
yield return client.UpdateDashboard(
    new Gs2.Gs2Log.Request.UpdateDashboardRequest()
        .WithNamespaceName("namespace-0001")
        .WithDashboardName("dashboard-0001")
        .WithDisplayName("Sample Dashboard 0001")
        .WithDescription(null)
        .WithPayload("{\"widgets\": []}"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;

```

**TypeScript**
```typescript

import Gs2Core from '@/gs2/core';
import * as Gs2Log from '@/gs2/log';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Log.Gs2LogRestClient(session);

try {
    const result = await client.updateDashboard(
        new Gs2Log.UpdateDashboardRequest()
            .withNamespaceName("namespace-0001")
            .withDashboardName("dashboard-0001")
            .withDisplayName("Sample Dashboard 0001")
            .withDescription(null)
            .withPayload("{\"widgets\": []}")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}

```

**Python**
```python

from gs2 import core
from gs2 import log

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = log.Gs2LogRestClient(session)

try:
    result = client.update_dashboard(
        log.UpdateDashboardRequest()
            .with_namespace_name('namespace-0001')
            .with_dashboard_name('dashboard-0001')
            .with_display_name('Sample Dashboard 0001')
            .with_description(None)
            .with_payload('{"widgets": []}')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)


```

**GS2-Script**
```lua

client = gs2('log')

api_result = client.update_dashboard({
    namespaceName="namespace-0001",
    dashboardName="dashboard-0001",
    displayName="Sample Dashboard 0001",
    description=nil,
    payload="{\"widgets\": []}",
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;

```

**GS2-Script(Async)**
```lua

client = gs2('log')

api_result_handler = client.update_dashboard_async({
    namespaceName="namespace-0001",
    dashboardName="dashboard-0001",
    displayName="Sample Dashboard 0001",
    description=nil,
    payload="{\"widgets\": []}",
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;

```




---

### duplicateDashboard

ダッシュボードを複製<br>

指定されたダッシュボードのペイロード（レイアウトとウィジェット定義）を含む全設定のコピーを作成します。



#### Request

|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| namespaceName | string |  | ✓|  |  ~ 128文字 | ネームスペース名<br>ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
| dashboardName | string |  | ✓| UUID |  ~ 36文字 | ダッシュボード名 |

#### Result

|  | 型 | 説明 |
| --- | --- | --- |
| item | [Dashboard](#dashboard) | 作成したダッシュボード |

#### 実装例




**Go**
```go

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/log"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := log.Gs2LogRestClient{
    Session: &session,
}
result, err := client.DuplicateDashboard(
    &log.DuplicateDashboardRequest {
        NamespaceName: pointy.String("namespace-0001"),
        DashboardName: pointy.String("dashboard-0001"),
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item

```

**PHP**
```php

use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Log\Gs2LogRestClient;
use Gs2\Log\Request\DuplicateDashboardRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2LogRestClient(
    $session
);

try {
    $result = $client->duplicateDashboard(
        (new DuplicateDashboardRequest())
            ->withNamespaceName("namespace-0001")
            ->withDashboardName("dashboard-0001")
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}

```

**Java**
```java

import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.log.rest.Gs2LogRestClient;
import io.gs2.log.request.DuplicateDashboardRequest;
import io.gs2.log.result.DuplicateDashboardResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2LogRestClient client = new Gs2LogRestClient(session);

try {
    DuplicateDashboardResult result = client.duplicateDashboard(
        new DuplicateDashboardRequest()
            .withNamespaceName("namespace-0001")
            .withDashboardName("dashboard-0001")
    );
    Dashboard item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}

```

**C#**
```csharp

using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2LogRestClient(session);

AsyncResult<Gs2.Gs2Log.Result.DuplicateDashboardResult> asyncResult = null;
yield return client.DuplicateDashboard(
    new Gs2.Gs2Log.Request.DuplicateDashboardRequest()
        .WithNamespaceName("namespace-0001")
        .WithDashboardName("dashboard-0001"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;

```

**TypeScript**
```typescript

import Gs2Core from '@/gs2/core';
import * as Gs2Log from '@/gs2/log';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Log.Gs2LogRestClient(session);

try {
    const result = await client.duplicateDashboard(
        new Gs2Log.DuplicateDashboardRequest()
            .withNamespaceName("namespace-0001")
            .withDashboardName("dashboard-0001")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}

```

**Python**
```python

from gs2 import core
from gs2 import log

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = log.Gs2LogRestClient(session)

try:
    result = client.duplicate_dashboard(
        log.DuplicateDashboardRequest()
            .with_namespace_name('namespace-0001')
            .with_dashboard_name('dashboard-0001')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)


```

**GS2-Script**
```lua

client = gs2('log')

api_result = client.duplicate_dashboard({
    namespaceName="namespace-0001",
    dashboardName="dashboard-0001",
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;

```

**GS2-Script(Async)**
```lua

client = gs2('log')

api_result_handler = client.duplicate_dashboard_async({
    namespaceName="namespace-0001",
    dashboardName="dashboard-0001",
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;

```




---

### deleteDashboard

ダッシュボードを削除<br>

指定されたダッシュボードとその全設定を完全に削除します。



#### Request

|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| namespaceName | string |  | ✓|  |  ~ 128文字 | ネームスペース名<br>ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
| dashboardName | string |  | ✓| UUID |  ~ 36文字 | ダッシュボード名 |

#### Result

|  | 型 | 説明 |
| --- | --- | --- |
| item | [Dashboard](#dashboard) | 削除したダッシュボード |

#### 実装例




**Go**
```go

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/log"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := log.Gs2LogRestClient{
    Session: &session,
}
result, err := client.DeleteDashboard(
    &log.DeleteDashboardRequest {
        NamespaceName: pointy.String("namespace-0001"),
        DashboardName: pointy.String("dashboard-0001"),
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item

```

**PHP**
```php

use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Log\Gs2LogRestClient;
use Gs2\Log\Request\DeleteDashboardRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2LogRestClient(
    $session
);

try {
    $result = $client->deleteDashboard(
        (new DeleteDashboardRequest())
            ->withNamespaceName("namespace-0001")
            ->withDashboardName("dashboard-0001")
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}

```

**Java**
```java

import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.log.rest.Gs2LogRestClient;
import io.gs2.log.request.DeleteDashboardRequest;
import io.gs2.log.result.DeleteDashboardResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2LogRestClient client = new Gs2LogRestClient(session);

try {
    DeleteDashboardResult result = client.deleteDashboard(
        new DeleteDashboardRequest()
            .withNamespaceName("namespace-0001")
            .withDashboardName("dashboard-0001")
    );
    Dashboard item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}

```

**C#**
```csharp

using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2LogRestClient(session);

AsyncResult<Gs2.Gs2Log.Result.DeleteDashboardResult> asyncResult = null;
yield return client.DeleteDashboard(
    new Gs2.Gs2Log.Request.DeleteDashboardRequest()
        .WithNamespaceName("namespace-0001")
        .WithDashboardName("dashboard-0001"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;

```

**TypeScript**
```typescript

import Gs2Core from '@/gs2/core';
import * as Gs2Log from '@/gs2/log';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Log.Gs2LogRestClient(session);

try {
    const result = await client.deleteDashboard(
        new Gs2Log.DeleteDashboardRequest()
            .withNamespaceName("namespace-0001")
            .withDashboardName("dashboard-0001")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}

```

**Python**
```python

from gs2 import core
from gs2 import log

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = log.Gs2LogRestClient(session)

try:
    result = client.delete_dashboard(
        log.DeleteDashboardRequest()
            .with_namespace_name('namespace-0001')
            .with_dashboard_name('dashboard-0001')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)


```

**GS2-Script**
```lua

client = gs2('log')

api_result = client.delete_dashboard({
    namespaceName="namespace-0001",
    dashboardName="dashboard-0001",
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;

```

**GS2-Script(Async)**
```lua

client = gs2('log')

api_result_handler = client.delete_dashboard_async({
    namespaceName="namespace-0001",
    dashboardName="dashboard-0001",
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;

```




---

### describeFacetModels

ファセットモデルの一覧を取得<br>

指定されたネームスペースのファセットモデルのページネーション付きリストを取得します。<br>
ファセットモデルはログクエリ用のカスタム分類フィールドを定義し、フィールド名、タイプ（string または measure）、表示名、並び順を指定します。



#### Request

|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| namespaceName | string |  | ✓|  |  ~ 128文字 | ネームスペース名<br>ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
| namePrefix | string |  | |  |  ~ 64文字 | ファセットモデル名のフィルター接頭辞 |
| pageToken | string |  | |  |  ~ 1024文字 | データの取得を開始する位置を指定するトークン |
| limit | int |  | | 30 | 1 ~ 1000 | データの取得件数 |

#### Result

|  | 型 | 説明 |
| --- | --- | --- |
| items | [List&lt;FacetModel&gt;](#facetmodel) | ファセットモデルのリスト |
| nextPageToken | string | リストの続きを取得するためのページトークン |

#### 実装例




**Go**
```go

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/log"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := log.Gs2LogRestClient{
    Session: &session,
}
result, err := client.DescribeFacetModels(
    &log.DescribeFacetModelsRequest {
        NamespaceName: pointy.String("namespace-0001"),
        NamePrefix: nil,
        PageToken: nil,
        Limit: nil,
    }
)
if err != nil {
    panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageToken

```

**PHP**
```php

use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Log\Gs2LogRestClient;
use Gs2\Log\Request\DescribeFacetModelsRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2LogRestClient(
    $session
);

try {
    $result = $client->describeFacetModels(
        (new DescribeFacetModelsRequest())
            ->withNamespaceName("namespace-0001")
            ->withNamePrefix(null)
            ->withPageToken(null)
            ->withLimit(null)
    );
    $items = $result->getItems();
    $nextPageToken = $result->getNextPageToken();
} catch (Gs2Exception $e) {
    exit("error occurred")
}

```

**Java**
```java

import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.log.rest.Gs2LogRestClient;
import io.gs2.log.request.DescribeFacetModelsRequest;
import io.gs2.log.result.DescribeFacetModelsResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2LogRestClient client = new Gs2LogRestClient(session);

try {
    DescribeFacetModelsResult result = client.describeFacetModels(
        new DescribeFacetModelsRequest()
            .withNamespaceName("namespace-0001")
            .withNamePrefix(null)
            .withPageToken(null)
            .withLimit(null)
    );
    List<FacetModel> items = result.getItems();
    String nextPageToken = result.getNextPageToken();
} catch (Gs2Exception e) {
    System.exit(1);
}

```

**C#**
```csharp

using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2LogRestClient(session);

AsyncResult<Gs2.Gs2Log.Result.DescribeFacetModelsResult> asyncResult = null;
yield return client.DescribeFacetModels(
    new Gs2.Gs2Log.Request.DescribeFacetModelsRequest()
        .WithNamespaceName("namespace-0001")
        .WithNamePrefix(null)
        .WithPageToken(null)
        .WithLimit(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
var nextPageToken = result.NextPageToken;

```

**TypeScript**
```typescript

import Gs2Core from '@/gs2/core';
import * as Gs2Log from '@/gs2/log';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Log.Gs2LogRestClient(session);

try {
    const result = await client.describeFacetModels(
        new Gs2Log.DescribeFacetModelsRequest()
            .withNamespaceName("namespace-0001")
            .withNamePrefix(null)
            .withPageToken(null)
            .withLimit(null)
    );
    const items = result.getItems();
    const nextPageToken = result.getNextPageToken();
} catch (e) {
    process.exit(1);
}

```

**Python**
```python

from gs2 import core
from gs2 import log

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = log.Gs2LogRestClient(session)

try:
    result = client.describe_facet_models(
        log.DescribeFacetModelsRequest()
            .with_namespace_name('namespace-0001')
            .with_name_prefix(None)
            .with_page_token(None)
            .with_limit(None)
    )
    items = result.items
    next_page_token = result.next_page_token
except core.Gs2Exception as e:
    exit(1)


```

**GS2-Script**
```lua

client = gs2('log')

api_result = client.describe_facet_models({
    namespaceName="namespace-0001",
    namePrefix=nil,
    pageToken=nil,
    limit=nil,
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;

```

**GS2-Script(Async)**
```lua

client = gs2('log')

api_result_handler = client.describe_facet_models_async({
    namespaceName="namespace-0001",
    namePrefix=nil,
    pageToken=nil,
    limit=nil,
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;

```




---

### createFacetModel

ファセットモデルを新規作成<br>

指定されたフィールド名、タイプ、表示名、並び順で新しいファセットモデルを作成します。<br>
フィールドタイプは、カテゴリ分類用の 'string' またはログクエリでの数値集計用の 'measure' を指定できます。



#### Request

|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| namespaceName | string |  | ✓|  |  ~ 128文字 | ネームスペース名<br>ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
| field | string |  | ✓|  |  ~ 128文字 | ファセットのフィールド名<br>このファセットが対象とするログフィールドの名前です（例："service"、"method"、"status"）。 |
| type | 文字列列挙型<br>enum {<br>&nbsp;&nbsp;"string",<br>&nbsp;&nbsp;"double",<br>&nbsp;&nbsp;"measure"<br>}<br> |  | ✓|  |  | ファセットのデータ型<br>ファセットフィールドのデータ型です。"string" は値のカウント付きカテゴリ値、"double" は範囲フィルタリング付き数値、"measure" は統計分析付き測定値に使用します。"string": 文字列 / "double": 数値 / "measure": 測定値 /  |
| displayName | string |  | ✓|  |  ~ 128文字 | 表示用の名前<br>このファセットの人間が読める名前で、ログ検索UIに表示されます。 |
| order | int |  | | 0 | 0 ~ 100000 | 表示順<br>UIでこのファセットを表示する際の並び順です。値が小さいほど先に表示されます。 |

#### Result

|  | 型 | 説明 |
| --- | --- | --- |
| item | [FacetModel](#facetmodel) | 作成したファセットモデル |

#### 実装例




**Go**
```go

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/log"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := log.Gs2LogRestClient{
    Session: &session,
}
result, err := client.CreateFacetModel(
    &log.CreateFacetModelRequest {
        NamespaceName: pointy.String("namespace-0001"),
        Field: pointy.String("facet-model-0001"),
        Type: pointy.String("string"),
        DisplayName: pointy.String("Sample Facet Model 0001"),
        Order: nil,
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item

```

**PHP**
```php

use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Log\Gs2LogRestClient;
use Gs2\Log\Request\CreateFacetModelRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2LogRestClient(
    $session
);

try {
    $result = $client->createFacetModel(
        (new CreateFacetModelRequest())
            ->withNamespaceName("namespace-0001")
            ->withField("facet-model-0001")
            ->withType("string")
            ->withDisplayName("Sample Facet Model 0001")
            ->withOrder(null)
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}

```

**Java**
```java

import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.log.rest.Gs2LogRestClient;
import io.gs2.log.request.CreateFacetModelRequest;
import io.gs2.log.result.CreateFacetModelResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2LogRestClient client = new Gs2LogRestClient(session);

try {
    CreateFacetModelResult result = client.createFacetModel(
        new CreateFacetModelRequest()
            .withNamespaceName("namespace-0001")
            .withField("facet-model-0001")
            .withType("string")
            .withDisplayName("Sample Facet Model 0001")
            .withOrder(null)
    );
    FacetModel item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}

```

**C#**
```csharp

using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2LogRestClient(session);

AsyncResult<Gs2.Gs2Log.Result.CreateFacetModelResult> asyncResult = null;
yield return client.CreateFacetModel(
    new Gs2.Gs2Log.Request.CreateFacetModelRequest()
        .WithNamespaceName("namespace-0001")
        .WithField("facet-model-0001")
        .WithType("string")
        .WithDisplayName("Sample Facet Model 0001")
        .WithOrder(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;

```

**TypeScript**
```typescript

import Gs2Core from '@/gs2/core';
import * as Gs2Log from '@/gs2/log';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Log.Gs2LogRestClient(session);

try {
    const result = await client.createFacetModel(
        new Gs2Log.CreateFacetModelRequest()
            .withNamespaceName("namespace-0001")
            .withField("facet-model-0001")
            .withType("string")
            .withDisplayName("Sample Facet Model 0001")
            .withOrder(null)
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}

```

**Python**
```python

from gs2 import core
from gs2 import log

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = log.Gs2LogRestClient(session)

try:
    result = client.create_facet_model(
        log.CreateFacetModelRequest()
            .with_namespace_name('namespace-0001')
            .with_field('facet-model-0001')
            .with_type('string')
            .with_display_name('Sample Facet Model 0001')
            .with_order(None)
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)


```

**GS2-Script**
```lua

client = gs2('log')

api_result = client.create_facet_model({
    namespaceName="namespace-0001",
    field="facet-model-0001",
    type="string",
    displayName="Sample Facet Model 0001",
    order=nil,
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;

```

**GS2-Script(Async)**
```lua

client = gs2('log')

api_result_handler = client.create_facet_model_async({
    namespaceName="namespace-0001",
    field="facet-model-0001",
    type="string",
    displayName="Sample Facet Model 0001",
    order=nil,
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;

```




---

### getFacetModel

ファセットモデルを取得<br>

指定されたファセットモデルのフィールド名、タイプ、表示名、並び順を含む情報を取得します。



#### Request

|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| namespaceName | string |  | ✓|  |  ~ 128文字 | ネームスペース名<br>ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
| field | string |  | ✓|  |  ~ 128文字 | ファセットのフィールド名<br>このファセットが対象とするログフィールドの名前です（例："service"、"method"、"status"）。 |

#### Result

|  | 型 | 説明 |
| --- | --- | --- |
| item | [FacetModel](#facetmodel) | ファセットモデル |

#### 実装例




**Go**
```go

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/log"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := log.Gs2LogRestClient{
    Session: &session,
}
result, err := client.GetFacetModel(
    &log.GetFacetModelRequest {
        NamespaceName: pointy.String("namespace-0001"),
        Field: pointy.String("facet-model-0001"),
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item

```

**PHP**
```php

use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Log\Gs2LogRestClient;
use Gs2\Log\Request\GetFacetModelRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2LogRestClient(
    $session
);

try {
    $result = $client->getFacetModel(
        (new GetFacetModelRequest())
            ->withNamespaceName("namespace-0001")
            ->withField("facet-model-0001")
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}

```

**Java**
```java

import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.log.rest.Gs2LogRestClient;
import io.gs2.log.request.GetFacetModelRequest;
import io.gs2.log.result.GetFacetModelResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2LogRestClient client = new Gs2LogRestClient(session);

try {
    GetFacetModelResult result = client.getFacetModel(
        new GetFacetModelRequest()
            .withNamespaceName("namespace-0001")
            .withField("facet-model-0001")
    );
    FacetModel item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}

```

**C#**
```csharp

using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2LogRestClient(session);

AsyncResult<Gs2.Gs2Log.Result.GetFacetModelResult> asyncResult = null;
yield return client.GetFacetModel(
    new Gs2.Gs2Log.Request.GetFacetModelRequest()
        .WithNamespaceName("namespace-0001")
        .WithField("facet-model-0001"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;

```

**TypeScript**
```typescript

import Gs2Core from '@/gs2/core';
import * as Gs2Log from '@/gs2/log';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Log.Gs2LogRestClient(session);

try {
    const result = await client.getFacetModel(
        new Gs2Log.GetFacetModelRequest()
            .withNamespaceName("namespace-0001")
            .withField("facet-model-0001")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}

```

**Python**
```python

from gs2 import core
from gs2 import log

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = log.Gs2LogRestClient(session)

try:
    result = client.get_facet_model(
        log.GetFacetModelRequest()
            .with_namespace_name('namespace-0001')
            .with_field('facet-model-0001')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)


```

**GS2-Script**
```lua

client = gs2('log')

api_result = client.get_facet_model({
    namespaceName="namespace-0001",
    field="facet-model-0001",
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;

```

**GS2-Script(Async)**
```lua

client = gs2('log')

api_result_handler = client.get_facet_model_async({
    namespaceName="namespace-0001",
    field="facet-model-0001",
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;

```




---

### updateFacetModel

ファセットモデルを更新<br>

指定されたファセットモデルのタイプ、表示名、並び順を更新します。



#### Request

|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| namespaceName | string |  | ✓|  |  ~ 128文字 | ネームスペース名<br>ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
| field | string |  | ✓|  |  ~ 128文字 | ファセットのフィールド名<br>このファセットが対象とするログフィールドの名前です（例："service"、"method"、"status"）。 |
| type | 文字列列挙型<br>enum {<br>&nbsp;&nbsp;"string",<br>&nbsp;&nbsp;"double",<br>&nbsp;&nbsp;"measure"<br>}<br> |  | ✓|  |  | ファセットのデータ型<br>ファセットフィールドのデータ型です。"string" は値のカウント付きカテゴリ値、"double" は範囲フィルタリング付き数値、"measure" は統計分析付き測定値に使用します。"string": 文字列 / "double": 数値 / "measure": 測定値 /  |
| displayName | string |  | ✓|  |  ~ 128文字 | 表示用の名前<br>このファセットの人間が読める名前で、ログ検索UIに表示されます。 |
| order | int |  | | 0 | 0 ~ 100000 | 表示順<br>UIでこのファセットを表示する際の並び順です。値が小さいほど先に表示されます。 |

#### Result

|  | 型 | 説明 |
| --- | --- | --- |
| item | [FacetModel](#facetmodel) | 更新したファセットモデル |

#### 実装例




**Go**
```go

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/log"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := log.Gs2LogRestClient{
    Session: &session,
}
result, err := client.UpdateFacetModel(
    &log.UpdateFacetModelRequest {
        NamespaceName: pointy.String("namespace-0001"),
        Field: pointy.String("facet-model-0001"),
        Type: pointy.String("gs2"),
        DisplayName: pointy.String("Sample Facet Model 0001"),
        Order: nil,
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item

```

**PHP**
```php

use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Log\Gs2LogRestClient;
use Gs2\Log\Request\UpdateFacetModelRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2LogRestClient(
    $session
);

try {
    $result = $client->updateFacetModel(
        (new UpdateFacetModelRequest())
            ->withNamespaceName("namespace-0001")
            ->withField("facet-model-0001")
            ->withType("gs2")
            ->withDisplayName("Sample Facet Model 0001")
            ->withOrder(null)
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}

```

**Java**
```java

import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.log.rest.Gs2LogRestClient;
import io.gs2.log.request.UpdateFacetModelRequest;
import io.gs2.log.result.UpdateFacetModelResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2LogRestClient client = new Gs2LogRestClient(session);

try {
    UpdateFacetModelResult result = client.updateFacetModel(
        new UpdateFacetModelRequest()
            .withNamespaceName("namespace-0001")
            .withField("facet-model-0001")
            .withType("gs2")
            .withDisplayName("Sample Facet Model 0001")
            .withOrder(null)
    );
    FacetModel item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}

```

**C#**
```csharp

using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2LogRestClient(session);

AsyncResult<Gs2.Gs2Log.Result.UpdateFacetModelResult> asyncResult = null;
yield return client.UpdateFacetModel(
    new Gs2.Gs2Log.Request.UpdateFacetModelRequest()
        .WithNamespaceName("namespace-0001")
        .WithField("facet-model-0001")
        .WithType("gs2")
        .WithDisplayName("Sample Facet Model 0001")
        .WithOrder(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;

```

**TypeScript**
```typescript

import Gs2Core from '@/gs2/core';
import * as Gs2Log from '@/gs2/log';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Log.Gs2LogRestClient(session);

try {
    const result = await client.updateFacetModel(
        new Gs2Log.UpdateFacetModelRequest()
            .withNamespaceName("namespace-0001")
            .withField("facet-model-0001")
            .withType("gs2")
            .withDisplayName("Sample Facet Model 0001")
            .withOrder(null)
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}

```

**Python**
```python

from gs2 import core
from gs2 import log

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = log.Gs2LogRestClient(session)

try:
    result = client.update_facet_model(
        log.UpdateFacetModelRequest()
            .with_namespace_name('namespace-0001')
            .with_field('facet-model-0001')
            .with_type('gs2')
            .with_display_name('Sample Facet Model 0001')
            .with_order(None)
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)


```

**GS2-Script**
```lua

client = gs2('log')

api_result = client.update_facet_model({
    namespaceName="namespace-0001",
    field="facet-model-0001",
    type="gs2",
    displayName="Sample Facet Model 0001",
    order=nil,
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;

```

**GS2-Script(Async)**
```lua

client = gs2('log')

api_result_handler = client.update_facet_model_async({
    namespaceName="namespace-0001",
    field="facet-model-0001",
    type="gs2",
    displayName="Sample Facet Model 0001",
    order=nil,
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;

```




---

### deleteFacetModel

ファセットモデルを削除<br>

指定されたファセットモデルを削除します。削除されたファセットモデルはログクエリでの分類に使用できなくなります。



#### Request

|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| namespaceName | string |  | ✓|  |  ~ 128文字 | ネームスペース名<br>ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
| field | string |  | ✓|  |  ~ 128文字 | ファセットのフィールド名<br>このファセットが対象とするログフィールドの名前です（例："service"、"method"、"status"）。 |

#### Result

|  | 型 | 説明 |
| --- | --- | --- |
| item | [FacetModel](#facetmodel) | 削除したファセットモデル |

#### 実装例




**Go**
```go

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/log"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := log.Gs2LogRestClient{
    Session: &session,
}
result, err := client.DeleteFacetModel(
    &log.DeleteFacetModelRequest {
        NamespaceName: pointy.String("namespace-0001"),
        Field: pointy.String("facet-model-0001"),
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item

```

**PHP**
```php

use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Log\Gs2LogRestClient;
use Gs2\Log\Request\DeleteFacetModelRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2LogRestClient(
    $session
);

try {
    $result = $client->deleteFacetModel(
        (new DeleteFacetModelRequest())
            ->withNamespaceName("namespace-0001")
            ->withField("facet-model-0001")
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}

```

**Java**
```java

import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.log.rest.Gs2LogRestClient;
import io.gs2.log.request.DeleteFacetModelRequest;
import io.gs2.log.result.DeleteFacetModelResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2LogRestClient client = new Gs2LogRestClient(session);

try {
    DeleteFacetModelResult result = client.deleteFacetModel(
        new DeleteFacetModelRequest()
            .withNamespaceName("namespace-0001")
            .withField("facet-model-0001")
    );
    FacetModel item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}

```

**C#**
```csharp

using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2LogRestClient(session);

AsyncResult<Gs2.Gs2Log.Result.DeleteFacetModelResult> asyncResult = null;
yield return client.DeleteFacetModel(
    new Gs2.Gs2Log.Request.DeleteFacetModelRequest()
        .WithNamespaceName("namespace-0001")
        .WithField("facet-model-0001"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;

```

**TypeScript**
```typescript

import Gs2Core from '@/gs2/core';
import * as Gs2Log from '@/gs2/log';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Log.Gs2LogRestClient(session);

try {
    const result = await client.deleteFacetModel(
        new Gs2Log.DeleteFacetModelRequest()
            .withNamespaceName("namespace-0001")
            .withField("facet-model-0001")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}

```

**Python**
```python

from gs2 import core
from gs2 import log

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = log.Gs2LogRestClient(session)

try:
    result = client.delete_facet_model(
        log.DeleteFacetModelRequest()
            .with_namespace_name('namespace-0001')
            .with_field('facet-model-0001')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)


```

**GS2-Script**
```lua

client = gs2('log')

api_result = client.delete_facet_model({
    namespaceName="namespace-0001",
    field="facet-model-0001",
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;

```

**GS2-Script(Async)**
```lua

client = gs2('log')

api_result_handler = client.delete_facet_model_async({
    namespaceName="namespace-0001",
    field="facet-model-0001",
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;

```




---

### queryMetricsTimeseries

タイムシリーズクエリ(Metrics)<br>

設定可能な集計、グループ化、間隔でメトリクスからタイムシリーズデータをクエリします。<br>
複数の集計設定、多次元分析のための groupBy ラベル、値または名前による昇順/降順のソートをサポートします。データポイントの最大数は1500で、この制限を超えるリクエストは拒否されます。



#### Request

|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| namespaceName | string |  | ✓|  |  ~ 128文字 | ネームスペース名<br>ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
| begin | long |  | | 現在時刻から1時間前の絶対時刻 |  | 検索範囲開始日時 |
| end | long |  | | 現在時刻 |  | 検索範囲終了日時 |
| query | string |  | |  |  ~ 10240文字 | 検索クエリ文字列 |
| groupBy | List&lt;string&gt; |  | | [] | 0 ~ 10 items | グループ化するフィールド |
| aggregations | [List&lt;AggregationConfig&gt;](#aggregationconfig) |  | | [] | 0 ~ 10 items | 集計設定のリスト |
| interval | int |  | | 60000 | 1000 ~ 86400000 | 集計間隔（ミリ秒） |
| seriesLimit | int |  | | 10 | 1 ~ 1000 | 取得するシリーズ数 |
| orderKey | 文字列列挙型<br>enum {<br>&nbsp;&nbsp;"value",<br>&nbsp;&nbsp;"name"<br>}<br> |  | | "value" |  | 並び替えキー"value": 値 / "name": 名前 /  |
| orderBy | 文字列列挙型<br>enum {<br>&nbsp;&nbsp;"asc",<br>&nbsp;&nbsp;"desc"<br>}<br> |  | | "desc" |  | 並び順"asc": 昇順 / "desc": 降順 /  |

#### Result

|  | 型 | 説明 |
| --- | --- | --- |
| items | [List&lt;TimeseriesPoint&gt;](#timeseriespoint) | タイムシリーズ値のリスト |
| timeseriesMetadata | [TimeseriesMetadata](#timeseriesmetadata) | タイムシリーズのメタデータ |

#### 実装例




**Go**
```go

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/log"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := log.Gs2LogRestClient{
    Session: &session,
}
result, err := client.QueryMetricsTimeseries(
    &log.QueryMetricsTimeseriesRequest {
        NamespaceName: pointy.String("namespace-0001"),
        Begin: nil,
        End: nil,
        Query: nil,
        GroupBy: nil,
        Aggregations: nil,
        Interval: nil,
        SeriesLimit: nil,
        OrderKey: nil,
        OrderBy: nil,
    }
)
if err != nil {
    panic("error occurred")
}
items := result.Items
timeseriesMetadata := result.TimeseriesMetadata

```

**PHP**
```php

use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Log\Gs2LogRestClient;
use Gs2\Log\Request\QueryMetricsTimeseriesRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2LogRestClient(
    $session
);

try {
    $result = $client->queryMetricsTimeseries(
        (new QueryMetricsTimeseriesRequest())
            ->withNamespaceName("namespace-0001")
            ->withBegin(null)
            ->withEnd(null)
            ->withQuery(null)
            ->withGroupBy(null)
            ->withAggregations(null)
            ->withInterval(null)
            ->withSeriesLimit(null)
            ->withOrderKey(null)
            ->withOrderBy(null)
    );
    $items = $result->getItems();
    $timeseriesMetadata = $result->getTimeseriesMetadata();
} catch (Gs2Exception $e) {
    exit("error occurred")
}

```

**Java**
```java

import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.log.rest.Gs2LogRestClient;
import io.gs2.log.request.QueryMetricsTimeseriesRequest;
import io.gs2.log.result.QueryMetricsTimeseriesResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2LogRestClient client = new Gs2LogRestClient(session);

try {
    QueryMetricsTimeseriesResult result = client.queryMetricsTimeseries(
        new QueryMetricsTimeseriesRequest()
            .withNamespaceName("namespace-0001")
            .withBegin(null)
            .withEnd(null)
            .withQuery(null)
            .withGroupBy(null)
            .withAggregations(null)
            .withInterval(null)
            .withSeriesLimit(null)
            .withOrderKey(null)
            .withOrderBy(null)
    );
    List<TimeseriesPoint> items = result.getItems();
    TimeseriesMetadata timeseriesMetadata = result.getTimeseriesMetadata();
} catch (Gs2Exception e) {
    System.exit(1);
}

```

**C#**
```csharp

using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2LogRestClient(session);

AsyncResult<Gs2.Gs2Log.Result.QueryMetricsTimeseriesResult> asyncResult = null;
yield return client.QueryMetricsTimeseries(
    new Gs2.Gs2Log.Request.QueryMetricsTimeseriesRequest()
        .WithNamespaceName("namespace-0001")
        .WithBegin(null)
        .WithEnd(null)
        .WithQuery(null)
        .WithGroupBy(null)
        .WithAggregations(null)
        .WithInterval(null)
        .WithSeriesLimit(null)
        .WithOrderKey(null)
        .WithOrderBy(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
var timeseriesMetadata = result.TimeseriesMetadata;

```

**TypeScript**
```typescript

import Gs2Core from '@/gs2/core';
import * as Gs2Log from '@/gs2/log';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Log.Gs2LogRestClient(session);

try {
    const result = await client.queryMetricsTimeseries(
        new Gs2Log.QueryMetricsTimeseriesRequest()
            .withNamespaceName("namespace-0001")
            .withBegin(null)
            .withEnd(null)
            .withQuery(null)
            .withGroupBy(null)
            .withAggregations(null)
            .withInterval(null)
            .withSeriesLimit(null)
            .withOrderKey(null)
            .withOrderBy(null)
    );
    const items = result.getItems();
    const timeseriesMetadata = result.getTimeseriesMetadata();
} catch (e) {
    process.exit(1);
}

```

**Python**
```python

from gs2 import core
from gs2 import log

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = log.Gs2LogRestClient(session)

try:
    result = client.query_metrics_timeseries(
        log.QueryMetricsTimeseriesRequest()
            .with_namespace_name('namespace-0001')
            .with_begin(None)
            .with_end(None)
            .with_query(None)
            .with_group_by(None)
            .with_aggregations(None)
            .with_interval(None)
            .with_series_limit(None)
            .with_order_key(None)
            .with_order_by(None)
    )
    items = result.items
    timeseries_metadata = result.timeseries_metadata
except core.Gs2Exception as e:
    exit(1)


```

**GS2-Script**
```lua

client = gs2('log')

api_result = client.query_metrics_timeseries({
    namespaceName="namespace-0001",
    begin=nil,
    end=nil,
    query=nil,
    groupBy=nil,
    aggregations=nil,
    interval=nil,
    seriesLimit=nil,
    orderKey=nil,
    orderBy=nil,
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
items = result.items;
timeseriesMetadata = result.timeseriesMetadata;

```

**GS2-Script(Async)**
```lua

client = gs2('log')

api_result_handler = client.query_metrics_timeseries_async({
    namespaceName="namespace-0001",
    begin=nil,
    end=nil,
    query=nil,
    groupBy=nil,
    aggregations=nil,
    interval=nil,
    seriesLimit=nil,
    orderKey=nil,
    orderBy=nil,
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
items = result.items;
timeseriesMetadata = result.timeseriesMetadata;

```




---

### describeMetrics

メトリクスモデルの一覧を取得<br>

指定されたネームスペースで利用可能なメトリクスモデルのページネーション付きリストを取得します。<br>
メトリクスモデルはタイムシリーズAPIでクエリ可能な組み込みメトリクスを定義します。名前の接頭辞でフィルタリングできます。



#### Request

|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| namespaceName | string |  | ✓|  |  ~ 128文字 | ネームスペース名<br>ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
| namePrefix | string |  | |  |  ~ 64文字 | メトリクスモデル名のフィルター接頭辞 |
| pageToken | string |  | |  |  ~ 1024文字 | データの取得を開始する位置を指定するトークン |
| limit | int |  | | 30 | 1 ~ 1000 | データの取得件数 |

#### Result

|  | 型 | 説明 |
| --- | --- | --- |
| items | [List&lt;MetricModel&gt;](#metricmodel) | メトリクスモデルのリスト |
| nextPageToken | string | リストの続きを取得するためのページトークン |

#### 実装例




**Go**
```go

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/log"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := log.Gs2LogRestClient{
    Session: &session,
}
result, err := client.DescribeMetrics(
    &log.DescribeMetricsRequest {
        NamespaceName: pointy.String("namespace-0001"),
        NamePrefix: nil,
        PageToken: nil,
        Limit: nil,
    }
)
if err != nil {
    panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageToken

```

**PHP**
```php

use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Log\Gs2LogRestClient;
use Gs2\Log\Request\DescribeMetricsRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2LogRestClient(
    $session
);

try {
    $result = $client->describeMetrics(
        (new DescribeMetricsRequest())
            ->withNamespaceName("namespace-0001")
            ->withNamePrefix(null)
            ->withPageToken(null)
            ->withLimit(null)
    );
    $items = $result->getItems();
    $nextPageToken = $result->getNextPageToken();
} catch (Gs2Exception $e) {
    exit("error occurred")
}

```

**Java**
```java

import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.log.rest.Gs2LogRestClient;
import io.gs2.log.request.DescribeMetricsRequest;
import io.gs2.log.result.DescribeMetricsResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2LogRestClient client = new Gs2LogRestClient(session);

try {
    DescribeMetricsResult result = client.describeMetrics(
        new DescribeMetricsRequest()
            .withNamespaceName("namespace-0001")
            .withNamePrefix(null)
            .withPageToken(null)
            .withLimit(null)
    );
    List<MetricModel> items = result.getItems();
    String nextPageToken = result.getNextPageToken();
} catch (Gs2Exception e) {
    System.exit(1);
}

```

**C#**
```csharp

using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2LogRestClient(session);

AsyncResult<Gs2.Gs2Log.Result.DescribeMetricsResult> asyncResult = null;
yield return client.DescribeMetrics(
    new Gs2.Gs2Log.Request.DescribeMetricsRequest()
        .WithNamespaceName("namespace-0001")
        .WithNamePrefix(null)
        .WithPageToken(null)
        .WithLimit(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
var nextPageToken = result.NextPageToken;

```

**TypeScript**
```typescript

import Gs2Core from '@/gs2/core';
import * as Gs2Log from '@/gs2/log';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Log.Gs2LogRestClient(session);

try {
    const result = await client.describeMetrics(
        new Gs2Log.DescribeMetricsRequest()
            .withNamespaceName("namespace-0001")
            .withNamePrefix(null)
            .withPageToken(null)
            .withLimit(null)
    );
    const items = result.getItems();
    const nextPageToken = result.getNextPageToken();
} catch (e) {
    process.exit(1);
}

```

**Python**
```python

from gs2 import core
from gs2 import log

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = log.Gs2LogRestClient(session)

try:
    result = client.describe_metrics(
        log.DescribeMetricsRequest()
            .with_namespace_name('namespace-0001')
            .with_name_prefix(None)
            .with_page_token(None)
            .with_limit(None)
    )
    items = result.items
    next_page_token = result.next_page_token
except core.Gs2Exception as e:
    exit(1)


```

**GS2-Script**
```lua

client = gs2('log')

api_result = client.describe_metrics({
    namespaceName="namespace-0001",
    namePrefix=nil,
    pageToken=nil,
    limit=nil,
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;

```

**GS2-Script(Async)**
```lua

client = gs2('log')

api_result_handler = client.describe_metrics_async({
    namespaceName="namespace-0001",
    namePrefix=nil,
    pageToken=nil,
    limit=nil,
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;

```




---

### describeLabelValues

特定のメトリクスのラベル値の一覧を取得<br>

特定のメトリクスの利用可能なラベル値を取得します。<br>
ラベル値はタイムシリーズクエリの groupBy フィールドやフィルターとして使用できます。ラベル名の接頭辞でフィルタリングできます。



#### Request

|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| namespaceName | string |  | ✓|  |  ~ 128文字 | ネームスペース名<br>ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
| metricName | string |  | ✓|  |  ~ 128文字 | フィルター対象のメトリクス名 |
| labelNamePrefix | string |  | |  |  ~ 64文字 | ラベル名のフィルター接頭辞 |
| pageToken | string |  | |  |  ~ 1024文字 | データの取得を開始する位置を指定するトークン |
| limit | int |  | | 30 | 1 ~ 1000 | データの取得件数 |

#### Result

|  | 型 | 説明 |
| --- | --- | --- |
| items | [List&lt;Label&gt;](#label) | ラベル値のリスト |
| nextPageToken | string | リストの続きを取得するためのページトークン |

#### 実装例




**Go**
```go

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/log"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := log.Gs2LogRestClient{
    Session: &session,
}
result, err := client.DescribeLabelValues(
    &log.DescribeLabelValuesRequest {
        NamespaceName: pointy.String("namespace-0001"),
        MetricName: nil,
        LabelNamePrefix: nil,
        PageToken: nil,
        Limit: nil,
    }
)
if err != nil {
    panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageToken

```

**PHP**
```php

use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Log\Gs2LogRestClient;
use Gs2\Log\Request\DescribeLabelValuesRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2LogRestClient(
    $session
);

try {
    $result = $client->describeLabelValues(
        (new DescribeLabelValuesRequest())
            ->withNamespaceName("namespace-0001")
            ->withMetricName(null)
            ->withLabelNamePrefix(null)
            ->withPageToken(null)
            ->withLimit(null)
    );
    $items = $result->getItems();
    $nextPageToken = $result->getNextPageToken();
} catch (Gs2Exception $e) {
    exit("error occurred")
}

```

**Java**
```java

import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.log.rest.Gs2LogRestClient;
import io.gs2.log.request.DescribeLabelValuesRequest;
import io.gs2.log.result.DescribeLabelValuesResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2LogRestClient client = new Gs2LogRestClient(session);

try {
    DescribeLabelValuesResult result = client.describeLabelValues(
        new DescribeLabelValuesRequest()
            .withNamespaceName("namespace-0001")
            .withMetricName(null)
            .withLabelNamePrefix(null)
            .withPageToken(null)
            .withLimit(null)
    );
    List<Label> items = result.getItems();
    String nextPageToken = result.getNextPageToken();
} catch (Gs2Exception e) {
    System.exit(1);
}

```

**C#**
```csharp

using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2LogRestClient(session);

AsyncResult<Gs2.Gs2Log.Result.DescribeLabelValuesResult> asyncResult = null;
yield return client.DescribeLabelValues(
    new Gs2.Gs2Log.Request.DescribeLabelValuesRequest()
        .WithNamespaceName("namespace-0001")
        .WithMetricName(null)
        .WithLabelNamePrefix(null)
        .WithPageToken(null)
        .WithLimit(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
var nextPageToken = result.NextPageToken;

```

**TypeScript**
```typescript

import Gs2Core from '@/gs2/core';
import * as Gs2Log from '@/gs2/log';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Log.Gs2LogRestClient(session);

try {
    const result = await client.describeLabelValues(
        new Gs2Log.DescribeLabelValuesRequest()
            .withNamespaceName("namespace-0001")
            .withMetricName(null)
            .withLabelNamePrefix(null)
            .withPageToken(null)
            .withLimit(null)
    );
    const items = result.getItems();
    const nextPageToken = result.getNextPageToken();
} catch (e) {
    process.exit(1);
}

```

**Python**
```python

from gs2 import core
from gs2 import log

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = log.Gs2LogRestClient(session)

try:
    result = client.describe_label_values(
        log.DescribeLabelValuesRequest()
            .with_namespace_name('namespace-0001')
            .with_metric_name(None)
            .with_label_name_prefix(None)
            .with_page_token(None)
            .with_limit(None)
    )
    items = result.items
    next_page_token = result.next_page_token
except core.Gs2Exception as e:
    exit(1)


```

**GS2-Script**
```lua

client = gs2('log')

api_result = client.describe_label_values({
    namespaceName="namespace-0001",
    metricName=nil,
    labelNamePrefix=nil,
    pageToken=nil,
    limit=nil,
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;

```

**GS2-Script(Async)**
```lua

client = gs2('log')

api_result_handler = client.describe_label_values_async({
    namespaceName="namespace-0001",
    metricName=nil,
    labelNamePrefix=nil,
    pageToken=nil,
    limit=nil,
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;

```




---

### queryLog

ログエントリをクエリ（v2）<br>

v2 ログクエリAPIを使用してログエントリをクエリします。全文検索によるフィルタリングが可能です。<br>
クエリ文字列によるフィルタリングをサポートし、総エントリ数を返します（10000件を超える場合は10001が返されます）。



#### Request

|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| namespaceName | string |  | ✓|  |  ~ 128文字 | ネームスペース名<br>ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
| begin | long |  | | 現在時刻から1時間前の絶対時刻 |  | 検索範囲開始日時 |
| end | long |  | | 現在時刻 |  | 検索範囲終了日時 |
| query | string |  | |  |  ~ 10240文字 | 検索クエリ文字列 |
| pageToken | string |  | |  |  ~ 1024文字 | データの取得を開始する位置を指定するトークン |
| limit | int |  | | 30 | 1 ~ 1000 | データの取得件数 |

#### Result

|  | 型 | 説明 |
| --- | --- | --- |
| items | [List&lt;LogEntry&gt;](#logentry) | アクセスログのリスト |
| totalEntryCount | int | クエリ結果の総件数 10000件を超える場合は10001が返却されます |
| nextPageToken | string | リストの続きを取得するためのページトークン |

#### 実装例




**Go**
```go

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/log"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := log.Gs2LogRestClient{
    Session: &session,
}
result, err := client.QueryLog(
    &log.QueryLogRequest {
        NamespaceName: pointy.String("namespace-0001"),
        Begin: nil,
        End: nil,
        Query: nil,
        PageToken: nil,
        Limit: nil,
    }
)
if err != nil {
    panic("error occurred")
}
items := result.Items
totalEntryCount := result.TotalEntryCount
nextPageToken := result.NextPageToken

```

**PHP**
```php

use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Log\Gs2LogRestClient;
use Gs2\Log\Request\QueryLogRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2LogRestClient(
    $session
);

try {
    $result = $client->queryLog(
        (new QueryLogRequest())
            ->withNamespaceName("namespace-0001")
            ->withBegin(null)
            ->withEnd(null)
            ->withQuery(null)
            ->withPageToken(null)
            ->withLimit(null)
    );
    $items = $result->getItems();
    $totalEntryCount = $result->getTotalEntryCount();
    $nextPageToken = $result->getNextPageToken();
} catch (Gs2Exception $e) {
    exit("error occurred")
}

```

**Java**
```java

import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.log.rest.Gs2LogRestClient;
import io.gs2.log.request.QueryLogRequest;
import io.gs2.log.result.QueryLogResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2LogRestClient client = new Gs2LogRestClient(session);

try {
    QueryLogResult result = client.queryLog(
        new QueryLogRequest()
            .withNamespaceName("namespace-0001")
            .withBegin(null)
            .withEnd(null)
            .withQuery(null)
            .withPageToken(null)
            .withLimit(null)
    );
    List<LogEntry> items = result.getItems();
    int totalEntryCount = result.getTotalEntryCount();
    String nextPageToken = result.getNextPageToken();
} catch (Gs2Exception e) {
    System.exit(1);
}

```

**C#**
```csharp

using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2LogRestClient(session);

AsyncResult<Gs2.Gs2Log.Result.QueryLogResult> asyncResult = null;
yield return client.QueryLog(
    new Gs2.Gs2Log.Request.QueryLogRequest()
        .WithNamespaceName("namespace-0001")
        .WithBegin(null)
        .WithEnd(null)
        .WithQuery(null)
        .WithPageToken(null)
        .WithLimit(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
var totalEntryCount = result.TotalEntryCount;
var nextPageToken = result.NextPageToken;

```

**TypeScript**
```typescript

import Gs2Core from '@/gs2/core';
import * as Gs2Log from '@/gs2/log';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Log.Gs2LogRestClient(session);

try {
    const result = await client.queryLog(
        new Gs2Log.QueryLogRequest()
            .withNamespaceName("namespace-0001")
            .withBegin(null)
            .withEnd(null)
            .withQuery(null)
            .withPageToken(null)
            .withLimit(null)
    );
    const items = result.getItems();
    const totalEntryCount = result.getTotalEntryCount();
    const nextPageToken = result.getNextPageToken();
} catch (e) {
    process.exit(1);
}

```

**Python**
```python

from gs2 import core
from gs2 import log

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = log.Gs2LogRestClient(session)

try:
    result = client.query_log(
        log.QueryLogRequest()
            .with_namespace_name('namespace-0001')
            .with_begin(None)
            .with_end(None)
            .with_query(None)
            .with_page_token(None)
            .with_limit(None)
    )
    items = result.items
    total_entry_count = result.total_entry_count
    next_page_token = result.next_page_token
except core.Gs2Exception as e:
    exit(1)


```

**GS2-Script**
```lua

client = gs2('log')

api_result = client.query_log({
    namespaceName="namespace-0001",
    begin=nil,
    end=nil,
    query=nil,
    pageToken=nil,
    limit=nil,
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
items = result.items;
totalEntryCount = result.totalEntryCount;
nextPageToken = result.nextPageToken;

```

**GS2-Script(Async)**
```lua

client = gs2('log')

api_result_handler = client.query_log_async({
    namespaceName="namespace-0001",
    begin=nil,
    end=nil,
    query=nil,
    pageToken=nil,
    limit=nil,
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
items = result.items;
totalEntryCount = result.totalEntryCount;
nextPageToken = result.nextPageToken;

```




---

### getLog

リクエストIDを指定してログエントリを取得<br>

指定された時間範囲内の特定のログエントリをリクエストIDで取得します。<br>
リクエストIDは単一のAPI呼び出しログエントリを一意に識別します。



#### Request

|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| namespaceName | string |  | ✓|  |  ~ 128文字 | ネームスペース名<br>ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
| logRequestId | string |  | ✓|  |  ~ 128文字 | リクエストID |
| begin | long |  | | 現在時刻から1時間前の絶対時刻 |  | 検索範囲開始日時 |
| end | long |  | | 現在時刻 |  | 検索範囲終了日時 |

#### Result

|  | 型 | 説明 |
| --- | --- | --- |
| item | [LogEntry](#logentry) | アクセスログ |

#### 実装例




**Go**
```go

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/log"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := log.Gs2LogRestClient{
    Session: &session,
}
result, err := client.GetLog(
    &log.GetLogRequest {
        NamespaceName: pointy.String("namespace-0001"),
        LogRequestId: pointy.String("requestId-0001"),
        Begin: nil,
        End: nil,
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item

```

**PHP**
```php

use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Log\Gs2LogRestClient;
use Gs2\Log\Request\GetLogRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2LogRestClient(
    $session
);

try {
    $result = $client->getLog(
        (new GetLogRequest())
            ->withNamespaceName("namespace-0001")
            ->withLogRequestId("requestId-0001")
            ->withBegin(null)
            ->withEnd(null)
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}

```

**Java**
```java

import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.log.rest.Gs2LogRestClient;
import io.gs2.log.request.GetLogRequest;
import io.gs2.log.result.GetLogResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2LogRestClient client = new Gs2LogRestClient(session);

try {
    GetLogResult result = client.getLog(
        new GetLogRequest()
            .withNamespaceName("namespace-0001")
            .withLogRequestId("requestId-0001")
            .withBegin(null)
            .withEnd(null)
    );
    LogEntry item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}

```

**C#**
```csharp

using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2LogRestClient(session);

AsyncResult<Gs2.Gs2Log.Result.GetLogResult> asyncResult = null;
yield return client.GetLog(
    new Gs2.Gs2Log.Request.GetLogRequest()
        .WithNamespaceName("namespace-0001")
        .WithLogRequestId("requestId-0001")
        .WithBegin(null)
        .WithEnd(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;

```

**TypeScript**
```typescript

import Gs2Core from '@/gs2/core';
import * as Gs2Log from '@/gs2/log';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Log.Gs2LogRestClient(session);

try {
    const result = await client.getLog(
        new Gs2Log.GetLogRequest()
            .withNamespaceName("namespace-0001")
            .withLogRequestId("requestId-0001")
            .withBegin(null)
            .withEnd(null)
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}

```

**Python**
```python

from gs2 import core
from gs2 import log

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = log.Gs2LogRestClient(session)

try:
    result = client.get_log(
        log.GetLogRequest()
            .with_namespace_name('namespace-0001')
            .with_log_request_id('requestId-0001')
            .with_begin(None)
            .with_end(None)
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)


```

**GS2-Script**
```lua

client = gs2('log')

api_result = client.get_log({
    namespaceName="namespace-0001",
    logRequestId="requestId-0001",
    begin=nil,
    end=nil,
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;

```

**GS2-Script(Async)**
```lua

client = gs2('log')

api_result_handler = client.get_log_async({
    namespaceName="namespace-0001",
    logRequestId="requestId-0001",
    begin=nil,
    end=nil,
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;

```




---

### queryFacets

ファセットクエリ<br>

指定された時間範囲内のログエントリのファセット（分類）データを取得します。<br>
組み込みファセット（service、function、status、duration）とネームスペースに定義されたカスタムファセットモデルの両方を返します。クエリ文字列によるフィルタリングでファセットの範囲を絞り込めます。



#### Request

|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| namespaceName | string |  | ✓|  |  ~ 128文字 | ネームスペース名<br>ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
| begin | long |  | | 現在時刻から1時間前の絶対時刻 |  | 検索範囲開始日時 |
| end | long |  | | 現在時刻 |  | 検索範囲終了日時 |
| query | string |  | |  |  ~ 10240文字 | 検索クエリ文字列 |

#### Result

|  | 型 | 説明 |
| --- | --- | --- |
| items | [List&lt;Facet&gt;](#facet) | ファセットのリスト |

#### 実装例




**Go**
```go

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/log"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := log.Gs2LogRestClient{
    Session: &session,
}
result, err := client.QueryFacets(
    &log.QueryFacetsRequest {
        NamespaceName: pointy.String("namespace-0001"),
        Begin: nil,
        End: nil,
        Query: nil,
    }
)
if err != nil {
    panic("error occurred")
}
items := result.Items

```

**PHP**
```php

use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Log\Gs2LogRestClient;
use Gs2\Log\Request\QueryFacetsRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2LogRestClient(
    $session
);

try {
    $result = $client->queryFacets(
        (new QueryFacetsRequest())
            ->withNamespaceName("namespace-0001")
            ->withBegin(null)
            ->withEnd(null)
            ->withQuery(null)
    );
    $items = $result->getItems();
} catch (Gs2Exception $e) {
    exit("error occurred")
}

```

**Java**
```java

import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.log.rest.Gs2LogRestClient;
import io.gs2.log.request.QueryFacetsRequest;
import io.gs2.log.result.QueryFacetsResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2LogRestClient client = new Gs2LogRestClient(session);

try {
    QueryFacetsResult result = client.queryFacets(
        new QueryFacetsRequest()
            .withNamespaceName("namespace-0001")
            .withBegin(null)
            .withEnd(null)
            .withQuery(null)
    );
    List<Facet> items = result.getItems();
} catch (Gs2Exception e) {
    System.exit(1);
}

```

**C#**
```csharp

using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2LogRestClient(session);

AsyncResult<Gs2.Gs2Log.Result.QueryFacetsResult> asyncResult = null;
yield return client.QueryFacets(
    new Gs2.Gs2Log.Request.QueryFacetsRequest()
        .WithNamespaceName("namespace-0001")
        .WithBegin(null)
        .WithEnd(null)
        .WithQuery(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;

```

**TypeScript**
```typescript

import Gs2Core from '@/gs2/core';
import * as Gs2Log from '@/gs2/log';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Log.Gs2LogRestClient(session);

try {
    const result = await client.queryFacets(
        new Gs2Log.QueryFacetsRequest()
            .withNamespaceName("namespace-0001")
            .withBegin(null)
            .withEnd(null)
            .withQuery(null)
    );
    const items = result.getItems();
} catch (e) {
    process.exit(1);
}

```

**Python**
```python

from gs2 import core
from gs2 import log

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = log.Gs2LogRestClient(session)

try:
    result = client.query_facets(
        log.QueryFacetsRequest()
            .with_namespace_name('namespace-0001')
            .with_begin(None)
            .with_end(None)
            .with_query(None)
    )
    items = result.items
except core.Gs2Exception as e:
    exit(1)


```

**GS2-Script**
```lua

client = gs2('log')

api_result = client.query_facets({
    namespaceName="namespace-0001",
    begin=nil,
    end=nil,
    query=nil,
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
items = result.items;

```

**GS2-Script(Async)**
```lua

client = gs2('log')

api_result_handler = client.query_facets_async({
    namespaceName="namespace-0001",
    begin=nil,
    end=nil,
    query=nil,
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
items = result.items;

```




---

### queryTimeseries

タイムシリーズクエリ(Log)<br>

設定可能な集計、グループ化、間隔でログエントリからタイムシリーズデータをクエリします。<br>
多次元分析のための groupBy フィールドと単一の集計設定をサポートします。データポイントの最大数は1500で、この制限を超えるリクエストは拒否されます。結果はページネーション可能で、シリーズ数を制限できます。



#### Request

|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| namespaceName | string |  | ✓|  |  ~ 128文字 | ネームスペース名<br>ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
| begin | long |  | | 現在時刻から1時間前の絶対時刻 |  | 検索範囲開始日時 |
| end | long |  | | 現在時刻 |  | 検索範囲終了日時 |
| query | string |  | |  |  ~ 10240文字 | 検索クエリ文字列 |
| groupBy | List&lt;string&gt; |  | | [] | 0 ~ 10 items | グループ化するフィールド |
| aggregation | [AggregationConfig](#aggregationconfig) |  | ✓|  |  | 集計設定 |
| interval | int |  | | 60000 | 1000 ~ 86400000 | 集計間隔（ミリ秒） |
| seriesLimit | int |  | | 10 | 1 ~ 1000 | 取得するシリーズ数 |
| pageToken | string |  | |  |  ~ 1024文字 | データの取得を開始する位置を指定するトークン |
| limit | int |  | | 30 | 1 ~ 1000 | データの取得件数 |

#### Result

|  | 型 | 説明 |
| --- | --- | --- |
| items | [List&lt;TimeseriesPoint&gt;](#timeseriespoint) | タイムシリーズ値のリスト |
| timeseriesMetadata | [TimeseriesMetadata](#timeseriesmetadata) | タイムシリーズのメタデータ |
| nextPageToken | string | リストの続きを取得するためのページトークン |

#### 実装例




**Go**
```go

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/log"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := log.Gs2LogRestClient{
    Session: &session,
}
result, err := client.QueryTimeseries(
    &log.QueryTimeseriesRequest {
        NamespaceName: pointy.String("namespace-0001"),
        Begin: nil,
        End: nil,
        Query: nil,
        GroupBy: nil,
        Aggregation: nil,
        Interval: nil,
        SeriesLimit: nil,
        PageToken: nil,
        Limit: nil,
    }
)
if err != nil {
    panic("error occurred")
}
items := result.Items
timeseriesMetadata := result.TimeseriesMetadata
nextPageToken := result.NextPageToken

```

**PHP**
```php

use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Log\Gs2LogRestClient;
use Gs2\Log\Request\QueryTimeseriesRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2LogRestClient(
    $session
);

try {
    $result = $client->queryTimeseries(
        (new QueryTimeseriesRequest())
            ->withNamespaceName("namespace-0001")
            ->withBegin(null)
            ->withEnd(null)
            ->withQuery(null)
            ->withGroupBy(null)
            ->withAggregation(null)
            ->withInterval(null)
            ->withSeriesLimit(null)
            ->withPageToken(null)
            ->withLimit(null)
    );
    $items = $result->getItems();
    $timeseriesMetadata = $result->getTimeseriesMetadata();
    $nextPageToken = $result->getNextPageToken();
} catch (Gs2Exception $e) {
    exit("error occurred")
}

```

**Java**
```java

import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.log.rest.Gs2LogRestClient;
import io.gs2.log.request.QueryTimeseriesRequest;
import io.gs2.log.result.QueryTimeseriesResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2LogRestClient client = new Gs2LogRestClient(session);

try {
    QueryTimeseriesResult result = client.queryTimeseries(
        new QueryTimeseriesRequest()
            .withNamespaceName("namespace-0001")
            .withBegin(null)
            .withEnd(null)
            .withQuery(null)
            .withGroupBy(null)
            .withAggregation(null)
            .withInterval(null)
            .withSeriesLimit(null)
            .withPageToken(null)
            .withLimit(null)
    );
    List<TimeseriesPoint> items = result.getItems();
    TimeseriesMetadata timeseriesMetadata = result.getTimeseriesMetadata();
    String nextPageToken = result.getNextPageToken();
} catch (Gs2Exception e) {
    System.exit(1);
}

```

**C#**
```csharp

using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2LogRestClient(session);

AsyncResult<Gs2.Gs2Log.Result.QueryTimeseriesResult> asyncResult = null;
yield return client.QueryTimeseries(
    new Gs2.Gs2Log.Request.QueryTimeseriesRequest()
        .WithNamespaceName("namespace-0001")
        .WithBegin(null)
        .WithEnd(null)
        .WithQuery(null)
        .WithGroupBy(null)
        .WithAggregation(null)
        .WithInterval(null)
        .WithSeriesLimit(null)
        .WithPageToken(null)
        .WithLimit(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
var timeseriesMetadata = result.TimeseriesMetadata;
var nextPageToken = result.NextPageToken;

```

**TypeScript**
```typescript

import Gs2Core from '@/gs2/core';
import * as Gs2Log from '@/gs2/log';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Log.Gs2LogRestClient(session);

try {
    const result = await client.queryTimeseries(
        new Gs2Log.QueryTimeseriesRequest()
            .withNamespaceName("namespace-0001")
            .withBegin(null)
            .withEnd(null)
            .withQuery(null)
            .withGroupBy(null)
            .withAggregation(null)
            .withInterval(null)
            .withSeriesLimit(null)
            .withPageToken(null)
            .withLimit(null)
    );
    const items = result.getItems();
    const timeseriesMetadata = result.getTimeseriesMetadata();
    const nextPageToken = result.getNextPageToken();
} catch (e) {
    process.exit(1);
}

```

**Python**
```python

from gs2 import core
from gs2 import log

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = log.Gs2LogRestClient(session)

try:
    result = client.query_timeseries(
        log.QueryTimeseriesRequest()
            .with_namespace_name('namespace-0001')
            .with_begin(None)
            .with_end(None)
            .with_query(None)
            .with_group_by(None)
            .with_aggregation(None)
            .with_interval(None)
            .with_series_limit(None)
            .with_page_token(None)
            .with_limit(None)
    )
    items = result.items
    timeseries_metadata = result.timeseries_metadata
    next_page_token = result.next_page_token
except core.Gs2Exception as e:
    exit(1)


```

**GS2-Script**
```lua

client = gs2('log')

api_result = client.query_timeseries({
    namespaceName="namespace-0001",
    begin=nil,
    end=nil,
    query=nil,
    groupBy=nil,
    aggregation=nil,
    interval=nil,
    seriesLimit=nil,
    pageToken=nil,
    limit=nil,
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
items = result.items;
timeseriesMetadata = result.timeseriesMetadata;
nextPageToken = result.nextPageToken;

```

**GS2-Script(Async)**
```lua

client = gs2('log')

api_result_handler = client.query_timeseries_async({
    namespaceName="namespace-0001",
    begin=nil,
    end=nil,
    query=nil,
    groupBy=nil,
    aggregation=nil,
    interval=nil,
    seriesLimit=nil,
    pageToken=nil,
    limit=nil,
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
items = result.items;
timeseriesMetadata = result.timeseriesMetadata;
nextPageToken = result.nextPageToken;

```




---

### getTrace

トレースIDを指定してトレースを取得<br>

指定された時間範囲内のトレースとそれに関連するログエントリをトレースIDで取得します。<br>
メイントレースと並列実行されたトレースを返し、パラレルリストが切り捨てられたかどうかを示すフラグが含まれます。



#### Request

|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| namespaceName | string |  | ✓|  |  ~ 128文字 | ネームスペース名<br>ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
| traceId | string |  | ✓| UUID |  ~ 36文字 | トレースID<br>このトレースの一意の識別子で、リクエストフロー内のすべての関連ログエントリ（スパン）で共有されます。 |
| begin | long |  | | 現在時刻から1時間前の絶対時刻 |  | 検索範囲開始日時 |
| end | long |  | | 現在時刻 |  | 検索範囲終了日時 |

#### Result

|  | 型 | 説明 |
| --- | --- | --- |
| trace | [Trace](#trace) | トレース |
| parallels | [List&lt;Trace&gt;](#trace) | 並列実行されていたトレースのリスト |
| parallelTruncated | bool | パラレルリストが切り捨てられたかどうかを示します |

#### 実装例




**Go**
```go

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/log"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := log.Gs2LogRestClient{
    Session: &session,
}
result, err := client.GetTrace(
    &log.GetTraceRequest {
        NamespaceName: pointy.String("namespace-0001"),
        TraceId: pointy.String("traceId-0001"),
        Begin: nil,
        End: nil,
    }
)
if err != nil {
    panic("error occurred")
}
trace := result.Trace
parallels := result.Parallels
parallelTruncated := result.ParallelTruncated

```

**PHP**
```php

use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Log\Gs2LogRestClient;
use Gs2\Log\Request\GetTraceRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2LogRestClient(
    $session
);

try {
    $result = $client->getTrace(
        (new GetTraceRequest())
            ->withNamespaceName("namespace-0001")
            ->withTraceId("traceId-0001")
            ->withBegin(null)
            ->withEnd(null)
    );
    $trace = $result->getTrace();
    $parallels = $result->getParallels();
    $parallelTruncated = $result->getParallelTruncated();
} catch (Gs2Exception $e) {
    exit("error occurred")
}

```

**Java**
```java

import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.log.rest.Gs2LogRestClient;
import io.gs2.log.request.GetTraceRequest;
import io.gs2.log.result.GetTraceResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2LogRestClient client = new Gs2LogRestClient(session);

try {
    GetTraceResult result = client.getTrace(
        new GetTraceRequest()
            .withNamespaceName("namespace-0001")
            .withTraceId("traceId-0001")
            .withBegin(null)
            .withEnd(null)
    );
    Trace trace = result.getTrace();
    List<Trace> parallels = result.getParallels();
    boolean parallelTruncated = result.getParallelTruncated();
} catch (Gs2Exception e) {
    System.exit(1);
}

```

**C#**
```csharp

using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2LogRestClient(session);

AsyncResult<Gs2.Gs2Log.Result.GetTraceResult> asyncResult = null;
yield return client.GetTrace(
    new Gs2.Gs2Log.Request.GetTraceRequest()
        .WithNamespaceName("namespace-0001")
        .WithTraceId("traceId-0001")
        .WithBegin(null)
        .WithEnd(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var trace = result.Trace;
var parallels = result.Parallels;
var parallelTruncated = result.ParallelTruncated;

```

**TypeScript**
```typescript

import Gs2Core from '@/gs2/core';
import * as Gs2Log from '@/gs2/log';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Log.Gs2LogRestClient(session);

try {
    const result = await client.getTrace(
        new Gs2Log.GetTraceRequest()
            .withNamespaceName("namespace-0001")
            .withTraceId("traceId-0001")
            .withBegin(null)
            .withEnd(null)
    );
    const trace = result.getTrace();
    const parallels = result.getParallels();
    const parallelTruncated = result.getParallelTruncated();
} catch (e) {
    process.exit(1);
}

```

**Python**
```python

from gs2 import core
from gs2 import log

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = log.Gs2LogRestClient(session)

try:
    result = client.get_trace(
        log.GetTraceRequest()
            .with_namespace_name('namespace-0001')
            .with_trace_id('traceId-0001')
            .with_begin(None)
            .with_end(None)
    )
    trace = result.trace
    parallels = result.parallels
    parallel_truncated = result.parallel_truncated
except core.Gs2Exception as e:
    exit(1)


```

**GS2-Script**
```lua

client = gs2('log')

api_result = client.get_trace({
    namespaceName="namespace-0001",
    traceId="traceId-0001",
    begin=nil,
    end=nil,
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
trace = result.trace;
parallels = result.parallels;
parallelTruncated = result.parallelTruncated;

```

**GS2-Script(Async)**
```lua

client = gs2('log')

api_result_handler = client.get_trace_async({
    namespaceName="namespace-0001",
    traceId="traceId-0001",
    begin=nil,
    end=nil,
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
trace = result.trace;
parallels = result.parallels;
parallelTruncated = result.parallelTruncated;

```




---



