ConfidentialLedgerClient.GetReceipt(String, RequestContext) Methode
Definition
Wichtig
Einige Informationen beziehen sich auf Vorabversionen, die vor dem Release ggf. grundlegend überarbeitet werden. Microsoft übernimmt hinsichtlich der hier bereitgestellten Informationen keine Gewährleistungen, seien sie ausdrücklich oder konkludent.
[Protokollmethode] Ruft einen Beleg ab, der Ledgerinhalte an einer bestimmten Transaktions-ID zertifizieren soll.
- Diese Protokollmethode ermöglicht die explizite Erstellung der Anforderung und Verarbeitung der Antwort für erweiterte Szenarien.
public virtual Azure.Response GetReceipt (string transactionId, Azure.RequestContext context = default);
abstract member GetReceipt : string * Azure.RequestContext -> Azure.Response
override this.GetReceipt : string * Azure.RequestContext -> Azure.Response
Public Overridable Function GetReceipt (transactionId As String, Optional context As RequestContext = Nothing) As Response
Parameter
- transactionId
- String
Identifiziert eine Schreibtransaktion.
- context
- RequestContext
Der Anforderungskontext, der das Standardverhalten der Clientpipeline pro Aufruf außer Kraft setzen kann.
Gibt zurück
Die vom Dienst zurückgegebene Antwort.
Ausnahmen
transactionId
ist NULL.
transactionId
ist eine leere Zeichenfolge und wurde erwartet, dass sie nicht leer ist.
Der Dienst hat einen nicht erfolgreichen status Code zurückgegeben.
Beispiele
In diesem Beispiel wird gezeigt, wie Sie GetReceipt mit den erforderlichen Parametern aufrufen und das Ergebnis analysieren.
var credential = new DefaultAzureCredential();
var endpoint = new Uri("<https://my-service.azure.com>");
var client = new ConfidentialLedgerClient(endpoint, credential);
Response response = client.GetReceipt("<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());
Hinweise
Im Folgenden finden Sie das JSON-Schema für die Antwortnutzlast.
Antworttext:
Schema für 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.
}
Gilt für:
Azure SDK for .NET