Compartilhar via


ConfidentialLedgerClient.GetCurrentLedgerEntry(String, RequestContext) 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 Azure.Response GetCurrentLedgerEntry (string collectionId = default, Azure.RequestContext context = default);
abstract member GetCurrentLedgerEntry : string * Azure.RequestContext -> Azure.Response
override this.GetCurrentLedgerEntry : string * Azure.RequestContext -> Azure.Response
Public Overridable Function GetCurrentLedgerEntry (Optional collectionId As String = Nothing, Optional context As RequestContext = Nothing) As 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 GetCurrentLedgerEntry 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 = client.GetCurrentLedgerEntry();

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

Este exemplo mostra como chamar GetCurrentLedgerEntry 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 = client.GetCurrentLedgerEntry("<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