azure.confidentialledger.aio package

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

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.

Parameters
  • endpoint (str) – URL of the Confidential Ledger service.

  • credential (ConfidentialLedgerCertificateCredential) – A credential object for authenticating with the Confidential Ledger.

  • ledger_certificate_path (str) – The path to the ledger’s TLS certificate.

Keyword Arguments

api_version

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

  • 0.1-preview

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

Appends an entry to the Confidential Ledger.

Parameters
  • entry_contents (str) – Text to write to the ledger.

  • sub_ledger_id (Optional[str]) – 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, defaults to False.) – 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

AppendResult

Raises

~azure.core.exceptions.HttpResponseError

async close()None

Close sockets opened by the client.

Calling this method is unnecessary when using the client as a context manager.

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

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

Parameters
  • user_id (str) – Identifies the user to delete. This should be an AAD object id or certificate fingerprint.

  • role (str or LedgerUserRole) – Role to assigned to the user.

Returns

Details of the updated ledger user.

Return type

LedgerUser

Raises

~azure.core.exceptions.HttpResponseError

async delete_user(user_id: str, **kwargs: Any)None[source]

Deletes a user from the Confidential Ledger.

Parameters

user_id (str) – Identifies the user to delete. This should be an AAD object id or certificate fingerprint.

Returns

None

Return type

None

Raises

~azure.core.exceptions.HttpResponseError

async get_consortium(**kwargs: Any) → azure.confidentialledger._models.Consortium[source]

Gets the consortium members.

Consortium members can manage the Confidential Ledger.

Returns

Details about the consortium.

Return type

Consortium

Raises

~azure.core.exceptions.HttpResponseError

async get_constitution(**kwargs: Any) → azure.confidentialledger._models.Constitution[source]

Gets the constitution used for governance.

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

Returns

The contents of the constitution and its digest.

Return type

Constitution

Raises

~azure.core.exceptions.HttpResponseError

async get_enclave_quotes(**kwargs: Any) → azure.confidentialledger._models.LedgerEnclaves[source]

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

Returns

Enclave quotes for nodes in the Confidential Ledger.

Return type

LedgerEnclaves

Raises

~azure.core.exceptions.HttpResponseError

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][source]

Gets a range of entries in the ledger.

Parameters
  • from_transaction_id (Optional[str]) – 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 – 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 (Optional[str]) – 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

AsyncItemPaged[LedgerEntry]

Raises

~azure.core.exceptions.HttpResponseError

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[source]

Gets an entry in the ledger.

Parameters
  • transaction_id (Optional[str]) – Transaction identifier, defaults to None. If this is None, the latest transaction is fetched.

  • sub_ledger_id (Optional[str]) – Identifies the sub-ledger to fetch the ledger entry from, defaults to None.

  • interval (float) – Interval, in seconds, between retries while waiting for results.

  • max_tries (int) – Maximum number of times to try the query. Retries are attempted if the result is not Ready.

Returns

The corresponding ledger entry.

Return type

LedgerEntry

Raises

~azure.core.exceptions.HttpResponseError

async get_transaction_receipt(transaction_id: str, *, interval: float = 0.5, max_tries: int = 6, **kwargs: Any) → azure.confidentialledger._models.TransactionReceipt[source]

Get a receipt for a specific transaction.

Parameters
  • transaction_id (str) – Transaction identifier.

  • interval (float) – Interval, in seconds, between retries while waiting for results.

  • max_tries (int) – 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

TransactionReceipt

Raises

~azure.core.exceptions.HttpResponseError

async get_transaction_status(transaction_id: str, **kwargs: Any) → azure.confidentialledger._models.TransactionStatus[source]

Gets the status of a transaction.

Parameters

transaction_id (str) – Identifier for the transaction to get the status of.

Returns

Status object describing the transaction status.

Return type

TransactionStatus

Raises

~azure.core.exceptions.HttpResponseError

async get_user(user_id: str, **kwargs: Any) → azure.confidentialledger._models.LedgerUser[source]

Gets a Confidential Ledger user.

Parameters

user_id (str) – Identifies the user to delete. This should be an AAD object id or certificate fingerprint.

Returns

Details about the user.

Return type

LedgerUser

Raises

~azure.core.exceptions.HttpResponseError

async wait_until_durable(transaction_id: str, *, interval: float = 0.5, max_queries: int = 3, **kwargs: Any)None[source]

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.

Parameters
  • transaction_id (str) – Identifies the transaction to wait for.

  • interval (float) – Time, in seconds, to wait between queries.

  • max_queries (int) – The maximum amount of queries to make before raising an exception.

Returns

None.

Return type

None

Raises

~azure.core.exceptions.HttpResponseError

property endpoint

The URL this client is connected to.