ConfidentialLedgerClient Class

An asynchronous client for putting data into and querying data from the Confidential Ledger service.

The transport parameter is typically accepted by Azure SDK clients to provide a custom transport stage in the pipeline. Since this client makes modifications to the default transport, using a custom transport will override and remove the following functionality:

  1. Authentication using a client certificate.

  2. TLS verification using the Confidential Ledger TLS certificate.

Inheritance
azure.confidentialledger.aio._client_base.AsyncConfidentialLedgerClientBase
ConfidentialLedgerClient

Constructor

ConfidentialLedgerClient(endpoint: str, credential: Union[azure.confidentialledger._shared.credential.ConfidentialLedgerCertificateCredential, TokenCredential], ledger_certificate_path: str, **kwargs: Any)

Parameters

endpoint
str
Required

URL of the Confidential Ledger service.

credential
ConfidentialLedgerCertificateCredential
Required

A credential object for authenticating with the Confidential Ledger.

ledger_certificate_path
str
Required

The path to the ledger's TLS certificate.

api_version

Version of the Confidential Ledger API to use. Defaults to the most recent. Support API versions:

  • 0.1-preview

Methods

append_to_ledger

Appends an entry to the Confidential Ledger.

create_or_update_user

Creates a new Confidential Ledger user, or updates an existing one.

delete_user

Deletes a user from the Confidential Ledger.

get_consortium

Gets the consortium members.

Consortium members can manage the Confidential Ledger.

get_constitution

Gets the constitution used for governance.

The constitution is a script that assesses and applies proposals from consortium members.

get_enclave_quotes

Gets enclave quotes from all nodes in the Confidential Ledger network.

get_ledger_entries

Gets a range of entries in the ledger.

get_ledger_entry

Gets an entry in the ledger.

get_transaction_receipt

Get a receipt for a specific transaction.

get_transaction_status

Gets the status of a transaction.

get_user

Gets a Confidential Ledger user.

wait_until_durable

Queries the status of the specified transaction until it is Committed, indicating that the transaction is durably stored in the Confidential Ledger. If this state is not reached by max_queries, a TimeoutError is raised.

append_to_ledger

Appends an entry to the Confidential Ledger.

async append_to_ledger(entry_contents: str, *, sub_ledger_id: Optional[str] = None, wait_for_commit: bool = False, **kwargs: Any) -> azure.confidentialledger._models.AppendResult

Parameters

entry_contents
str
Required

Text to write to the ledger.

sub_ledger_id
<xref:Optional>[str]
Required

Identifies the sub-ledger to append to, defaults to None. If none is specified, the service will use the service-default sub-ledger id.

wait_for_commit
bool, <xref:defaults to False.>
Required

If True, this method will not return until the write is durably saved to the ledger, defaults to False.

Returns

Details about the write transaction.

Return type

Exceptions

create_or_update_user

Creates a new Confidential Ledger user, or updates an existing one.

async create_or_update_user(user_id: str, role: Union[str, azure.confidentialledger._enums.LedgerUserRole], **kwargs: Any) -> azure.confidentialledger._models.LedgerUser

Parameters

user_id
str
Required

Identifies the user to delete. This should be an AAD object id or certificate fingerprint.

role
str or LedgerUserRole
Required

Role to assigned to the user.

Returns

Details of the updated ledger user.

Return type

Exceptions

delete_user

Deletes a user from the Confidential Ledger.

async delete_user(user_id: str, **kwargs: Any) -> None

Parameters

user_id
str
Required

Identifies the user to delete. This should be an AAD object id or certificate fingerprint.

Returns

None

Return type

Exceptions

get_consortium

Gets the consortium members.

Consortium members can manage the Confidential Ledger.

async get_consortium(**kwargs: Any) -> azure.confidentialledger._models.Consortium

Returns

Details about the consortium.

Return type

Exceptions

get_constitution

Gets the constitution used for governance.

The constitution is a script that assesses and applies proposals from consortium members.

async get_constitution(**kwargs: Any) -> azure.confidentialledger._models.Constitution

Returns

The contents of the constitution and its digest.

Return type

Exceptions

get_enclave_quotes

Gets enclave quotes from all nodes in the Confidential Ledger network.

async get_enclave_quotes(**kwargs: Any) -> azure.confidentialledger._models.LedgerEnclaves

Returns

Enclave quotes for nodes in the Confidential Ledger.

Return type

Exceptions

get_ledger_entries

Gets a range of entries in the ledger.

get_ledger_entries(*, from_transaction_id=None, to_transaction_id=None, sub_ledger_id=None, **kwargs) -> azure.core.async_paging.AsyncItemPaged[azure.confidentialledger._models.LedgerEntry]

Parameters

from_transaction_id
<xref:Optional>[str]
Required

Transaction identifier from which to start the query, defaults to None. If this is None, the query begins from the first transaction.

to_transaction_id
Required

Transaction identifier at which to end the query (inclusive), defaults to None. If this is None, the query ends at the end of the ledger.

sub_ledger_id
<xref:Optional>[str]
Required

Identifies the sub-ledger to fetch the ledger entry from, defaults to None.

Returns

An iterable for iterating over the entries in the range.

Return type

Exceptions

get_ledger_entry

Gets an entry in the ledger.

async get_ledger_entry(*, transaction_id: Optional[str] = None, sub_ledger_id: Optional[str] = None, interval: float = 0.5, max_tries: int = 6, **kwargs: Any) -> azure.confidentialledger._models.LedgerEntry

Parameters

transaction_id
<xref:Optional>[str]
Required

Transaction identifier, defaults to None. If this is None, the latest transaction is fetched.

sub_ledger_id
<xref:Optional>[str]
Required

Identifies the sub-ledger to fetch the ledger entry from, defaults to None.

interval
float
Required

Interval, in seconds, between retries while waiting for results.

max_tries
int
Required

Maximum number of times to try the query. Retries are attempted if the result is not Ready.

Returns

The corresponding ledger entry.

Return type

Exceptions

get_transaction_receipt

Get a receipt for a specific transaction.

async get_transaction_receipt(transaction_id: str, *, interval: float = 0.5, max_tries: int = 6, **kwargs: Any) -> azure.confidentialledger._models.TransactionReceipt

Parameters

transaction_id
str
Required

Transaction identifier.

interval
float
Required

Interval, in seconds, between retries while waiting for results.

max_tries
int
Required

Maximum number of times to try the query. Retries are attempted if the result is not Ready.

Returns

Receipt certifying the specified transaction.

Return type

Exceptions

get_transaction_status

Gets the status of a transaction.

async get_transaction_status(transaction_id: str, **kwargs: Any) -> azure.confidentialledger._models.TransactionStatus

Parameters

transaction_id
str
Required

Identifier for the transaction to get the status of.

Returns

Status object describing the transaction status.

Return type

Exceptions

get_user

Gets a Confidential Ledger user.

async get_user(user_id: str, **kwargs: Any) -> azure.confidentialledger._models.LedgerUser

Parameters

user_id
str
Required

Identifies the user to delete. This should be an AAD object id or certificate fingerprint.

Returns

Details about the user.

Return type

Exceptions

wait_until_durable

Queries the status of the specified transaction until it is Committed, indicating that the transaction is durably stored in the Confidential Ledger. If this state is not reached by max_queries, a TimeoutError is raised.

async wait_until_durable(transaction_id: str, *, interval: float = 0.5, max_queries: int = 3, **kwargs: Any) -> None

Parameters

transaction_id
str
Required

Identifies the transaction to wait for.

interval
float
Required

Time, in seconds, to wait between queries.

max_queries
int
Required

The maximum amount of queries to make before raising an exception.

Returns

None.

Return type

Exceptions