ConfidentialLedgerClient Class

A 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._client_base.ConfidentialLedgerClientBase
ConfidentialLedgerClient

Constructor

ConfidentialLedgerClient(endpoint: str, credential: Union[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. The query may need to be retried while the service is loading results.

get_transaction_receipt

Get a receipt for a specific transaction. The query may need to be retried while the service is loading results.

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.

append_to_ledger(entry_contents: str, **kwargs: Any) -> AppendResult

Parameters

entry_contents
str
Required

Text to write to the ledger.

sub_ledger_id
str

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

wait_for_commit
bool

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

create_or_update_user

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

create_or_update_user(user_id: str, role: Union[str, LedgerUserRole], **kwargs: Any) -> 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.

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.

get_consortium(**kwargs: Any) -> 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.

get_constitution(**kwargs: Any) -> 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.

get_enclave_quotes(**kwargs: Any) -> 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(**kwargs: Any) -> ItemPaged[LedgerEntry]

Parameters

from_transaction_id
str

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

to_transaction_id
str

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

sub_ledger_id
str

Identifies the sub-ledger to fetch the ledger entry from.

Returns

An iterable for iterating over the entries in the range.

Return type

Exceptions

get_ledger_entry

Gets an entry in the ledger. The query may need to be retried while the service is loading results.

get_ledger_entry(**kwargs: Any) -> LedgerEntry

Parameters

interval
float

Interval, in seconds, between retries while waiting for results, defaults to 0.5.

max_tries
int

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

transaction_id
str

A transaction identifier. If not specified, the latest transaction is fetched.

sub_ledger_id

Identifies the sub-ledger to fetch the ledger entry from.

Returns

The corresponding ledger entry.

Return type

Exceptions

get_transaction_receipt

Get a receipt for a specific transaction. The query may need to be retried while the service is loading results.

get_transaction_receipt(transaction_id: str, **kwargs: Any) -> TransactionReceipt

Parameters

transaction_id
str
Required

Transaction identifier.

interval
float

Interval, in seconds, between retries while waiting for results, defaults to 0.5.

max_tries
int

Maximum number of times to try the query, defaults to 6. 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.

get_transaction_status(transaction_id: str, **kwargs: Any) -> 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.

get_user(user_id: str, **kwargs: Any) -> 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.

wait_until_durable(transaction_id: str, **kwargs: Any) -> None

Parameters

transaction_id
str
Required

Identifies the transaction to wait for.

interval
float

Interval, in seconds, between retries while waiting for results, defaults to 0.5.

max_queries
int

Maximum number of queries to make for durability, defaults to 3.

Returns

None.

Return type

Exceptions