Partilhar via


ConfidentialLedgerClient.GetCurrentLedgerEntryAsync Método

Definição

[Método protocol] Obtém o valor atual disponível no razão.

  • Esse método de protocolo permite a criação explícita da solicitação e o processamento da resposta para cenários avançados.
public virtual System.Threading.Tasks.Task<Azure.Response> GetCurrentLedgerEntryAsync (string collectionId = default, Azure.RequestContext context = default);
abstract member GetCurrentLedgerEntryAsync : string * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
override this.GetCurrentLedgerEntryAsync : string * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
Public Overridable Function GetCurrentLedgerEntryAsync (Optional collectionId As String = Nothing, Optional context As RequestContext = Nothing) As Task(Of Response)

Parâmetros

collectionId
String

A ID da coleção.

context
RequestContext

O contexto de solicitação, que pode substituir os comportamentos padrão do pipeline do cliente por chamada.

Retornos

A resposta retornada do serviço.

Exceções

O serviço retornou um código de status sem êxito.

Exemplos

Este exemplo mostra como chamar GetCurrentLedgerEntryAsync e analisar o resultado.

var credential = new DefaultAzureCredential();
var endpoint = new Uri("<https://my-service.azure.com>");
var client = new ConfidentialLedgerClient(endpoint, credential);

Response response = await client.GetCurrentLedgerEntryAsync();

JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("contents").ToString());

Este exemplo mostra como chamar GetCurrentLedgerEntryAsync com todos os parâmetros e como analisar o resultado.

var credential = new DefaultAzureCredential();
var endpoint = new Uri("<https://my-service.azure.com>");
var client = new ConfidentialLedgerClient(endpoint, credential);

Response response = await client.GetCurrentLedgerEntryAsync("<collectionId>");

JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("contents").ToString());
Console.WriteLine(result.GetProperty("collectionId").ToString());
Console.WriteLine(result.GetProperty("transactionId").ToString());

Comentários

Opcionalmente, uma ID de coleção pode ser especificada.

Abaixo está o esquema JSON para o conteúdo da resposta.

Corpo da resposta:

Esquema para LedgerEntry:

{
  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.
}

Aplica-se a