ConfidentialLedgerClient.GetLedgerEntryAsync メソッド
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
[プロトコルメソッド]指定したトランザクション ID にある台帳エントリを取得します。必要に応じて、値のフェッチ元のコレクションを示すコレクション ID を指定できます。
- この プロトコル メソッド を使用すると、高度なシナリオで応答の要求と処理を明示的に作成できます。
public virtual System.Threading.Tasks.Task<Azure.Response> GetLedgerEntryAsync (string transactionId, string collectionId = default, Azure.RequestContext context = default);
abstract member GetLedgerEntryAsync : string * string * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
override this.GetLedgerEntryAsync : string * string * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
Public Overridable Function GetLedgerEntryAsync (transactionId As String, Optional collectionId As String = Nothing, Optional context As RequestContext = Nothing) As Task(Of Response)
パラメーター
- transactionId
- String
書き込みトランザクションを識別します。
- collectionId
- String
コレクション ID。
- context
- RequestContext
要求コンテキスト。これは、クライアント パイプラインの既定の動作を呼び出しごとにオーバーライドできます。
戻り値
サービスから返された応答。
例外
transactionId
が null です。
transactionId
は空の文字列であり、空でないと予想されていました。
サービスから成功以外の状態コードが返されました。
例
このサンプルでは、必要なパラメーターを使用して GetLedgerEntryAsync を呼び出し、結果を解析する方法を示します。
var credential = new DefaultAzureCredential();
var endpoint = new Uri("<https://my-service.azure.com>");
var client = new ConfidentialLedgerClient(endpoint, credential);
Response response = await client.GetLedgerEntryAsync("<transactionId>");
JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("state").ToString());
このサンプルでは、すべてのパラメーターを使用して GetLedgerEntryAsync を呼び出す方法と、結果を解析する方法を示します。
var credential = new DefaultAzureCredential();
var endpoint = new Uri("<https://my-service.azure.com>");
var client = new ConfidentialLedgerClient(endpoint, credential);
Response response = await client.GetLedgerEntryAsync("<transactionId>", "<collectionId>");
JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("state").ToString());
Console.WriteLine(result.GetProperty("entry").GetProperty("contents").ToString());
Console.WriteLine(result.GetProperty("entry").GetProperty("collectionId").ToString());
Console.WriteLine(result.GetProperty("entry").GetProperty("transactionId").ToString());
注釈
古い台帳エントリを返すには、台帳の関連セクションをディスクから読み取り、検証する必要があります。 エンクレーブ内でのブロックを防ぐために、応答はエントリの準備ができているか、応答の一部なのか、読み込みがまだ進行中であるかを示します。
応答ペイロードの JSON スキーマを次に示します。
応答本文:
の LedgerQueryResult
スキーマ:
{
state: "Loading" | "Ready", # Required. State of a ledger query.
entry: {
contents: string, # Required. Contents of the ledger entry.
collectionId: string, # Optional.
transactionId: string, # Optional. A unique identifier for the state of the ledger. If returned as part of a LedgerEntry, it indicates the state from which the entry was read.
}, # Optional. The ledger entry found as a result of the query. This is only available if the query is in Ready state.
}
適用対象
Azure SDK for .NET