ConfidentialLedgerClient.GetReceiptAsync(String, RequestContext) メソッド
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
[プロトコルメソッド]特定のトランザクション ID で台帳の内容を証明する領収書を取得します。
- この プロトコル メソッド を使用すると、高度なシナリオで応答の要求と処理を明示的に作成できます。
public virtual System.Threading.Tasks.Task<Azure.Response> GetReceiptAsync (string transactionId, Azure.RequestContext context = default);
abstract member GetReceiptAsync : string * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
override this.GetReceiptAsync : string * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
Public Overridable Function GetReceiptAsync (transactionId As String, Optional context As RequestContext = Nothing) As Task(Of Response)
パラメーター
- transactionId
- String
書き込みトランザクションを識別します。
- context
- RequestContext
要求コンテキスト。これは、クライアント パイプラインの既定の動作を呼び出しごとにオーバーライドできます。
戻り値
サービスから返された応答。
例外
transactionId
が null です。
transactionId
は空の文字列であり、空でないと予想されていました。
サービスから成功以外の状態コードが返されました。
例
このサンプルでは、必要なパラメーターを使用して GetReceiptAsync を呼び出し、結果を解析する方法を示します。
var credential = new DefaultAzureCredential();
var endpoint = new Uri("<https://my-service.azure.com>");
var client = new ConfidentialLedgerClient(endpoint, credential);
Response response = await client.GetReceiptAsync("<transactionId>");
JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("receipt").GetProperty("cert").ToString());
Console.WriteLine(result.GetProperty("receipt").GetProperty("leaf").ToString());
Console.WriteLine(result.GetProperty("receipt").GetProperty("leafComponents").GetProperty("claimsDigest").ToString());
Console.WriteLine(result.GetProperty("receipt").GetProperty("leafComponents").GetProperty("commitEvidence").ToString());
Console.WriteLine(result.GetProperty("receipt").GetProperty("leafComponents").GetProperty("writeSetDigest").ToString());
Console.WriteLine(result.GetProperty("receipt").GetProperty("nodeId").ToString());
Console.WriteLine(result.GetProperty("receipt").GetProperty("proof")[0].GetProperty("left").ToString());
Console.WriteLine(result.GetProperty("receipt").GetProperty("proof")[0].GetProperty("right").ToString());
Console.WriteLine(result.GetProperty("receipt").GetProperty("root").ToString());
Console.WriteLine(result.GetProperty("receipt").GetProperty("serviceEndorsements")[0].ToString());
Console.WriteLine(result.GetProperty("receipt").GetProperty("signature").ToString());
Console.WriteLine(result.GetProperty("state").ToString());
Console.WriteLine(result.GetProperty("transactionId").ToString());
注釈
応答ペイロードの JSON スキーマを次に示します。
応答本文:
の TransactionReceipt
スキーマ:
{
receipt: {
cert: string, # Optional.
leaf: string, # Optional.
leafComponents: {
claimsDigest: string, # Optional.
commitEvidence: string, # Optional.
writeSetDigest: string, # Optional.
}, # Optional.
nodeId: string, # Required.
proof: [
{
left: string, # Optional.
right: string, # Optional.
}
], # Required.
root: string, # Optional.
serviceEndorsements: [string], # Optional.
signature: string, # Required.
}, # Optional.
state: "Loading" | "Ready", # Required. State of a ledger query.
transactionId: string, # Required. 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.
}
適用対象
GitHub で Microsoft と共同作業する
このコンテンツのソースは GitHub にあります。そこで、issue や pull request を作成および確認することもできます。 詳細については、共同作成者ガイドを参照してください。
Azure SDK for .NET