KeyvaultClient
Classes
KeyMetadataCollection
dataclass
KeyMetadataCollection(*, value: Optional[List[KeyMetadata | Mapping[str, Any]]] = None, continuation_token: Optional[str] = None)
KeyMetadata
dataclass
KeyMetadata(*, name: Optional[str] = None, version: Optional[str] = None, is_enabled: Optional[bool] = None, created_time: Optional[str] = None, last_updated_time: Optional[str] = None, validity_start_time: Optional[str] = None, validity_end_time: Optional[str] = None, allowed_operations: Optional[List[str]] = None, key_type: Optional[str] = None)
Response for Get key metadata
Attributes
name
class-attribute
instance-attribute
Name of the key
version
class-attribute
instance-attribute
Version of the key
is_enabled
class-attribute
instance-attribute
is_enabled: Optional[bool] = dataclass_field(default=None, kw_only=True, metadata={'wire_name': 'isEnabled'})
A flag indicating whether the key is enabled
created_time
class-attribute
instance-attribute
created_time: Optional[str] = dataclass_field(default=None, kw_only=True, metadata={'wire_name': 'createdTime'})
Time when the key was created
last_updated_time
class-attribute
instance-attribute
last_updated_time: Optional[str] = dataclass_field(default=None, kw_only=True, metadata={'wire_name': 'lastUpdatedTime'})
Time when the key was last updated
validity_start_time
class-attribute
instance-attribute
validity_start_time: Optional[str] = dataclass_field(default=None, kw_only=True, metadata={'wire_name': 'validityStartTime'})
Time when the key validity starts.
validity_end_time
class-attribute
instance-attribute
validity_end_time: Optional[str] = dataclass_field(default=None, kw_only=True, metadata={'wire_name': 'validityEndTime'})
Time when the key validity ends.
KeyEncryptOutput
dataclass
KeyDecryptOutput
dataclass
SecretMetadataCollection
dataclass
SecretMetadataCollection(*, value: Optional[List[SecretMetadata | Mapping[str, Any]]] = None, continuation_token: Optional[str] = None)
SecretMetadata
dataclass
SecretMetadata(*, name: Optional[str] = None, version: Optional[str] = None, content_type: Optional[str] = None, is_enabled: Optional[bool] = None, created_time: Optional[str] = None, last_updated_time: Optional[str] = None, validity_start_time: Optional[str] = None, validity_end_time: Optional[str] = None)
Response for Get secret metadata
Attributes
name
class-attribute
instance-attribute
Name of the secret
version
class-attribute
instance-attribute
Version of the secret
content_type
class-attribute
instance-attribute
content_type: Optional[str] = dataclass_field(default=None, kw_only=True, metadata={'wire_name': 'contentType'})
Content type of the secret
is_enabled
class-attribute
instance-attribute
is_enabled: Optional[bool] = dataclass_field(default=None, kw_only=True, metadata={'wire_name': 'isEnabled'})
A flag indicating whether the secret is enabled
created_time
class-attribute
instance-attribute
created_time: Optional[str] = dataclass_field(default=None, kw_only=True, metadata={'wire_name': 'createdTime'})
Time when the secret was created
last_updated_time
class-attribute
instance-attribute
last_updated_time: Optional[str] = dataclass_field(default=None, kw_only=True, metadata={'wire_name': 'lastUpdatedTime'})
Time when the secret was last updated
Secret
dataclass
Secret(*, value: Optional[str] = None, name: Optional[str] = None, version: Optional[str] = None, content_type: Optional[str] = None, is_enabled: Optional[bool] = None, created_time: Optional[str] = None, last_updated_time: Optional[str] = None, validity_start_time: Optional[str] = None, validity_end_time: Optional[str] = None)
Response for Get secret
Attributes
value
class-attribute
instance-attribute
Value of the secret
name
class-attribute
instance-attribute
Name of the secret
version
class-attribute
instance-attribute
Version of the secret
content_type
class-attribute
instance-attribute
content_type: Optional[str] = dataclass_field(default=None, kw_only=True, metadata={'wire_name': 'contentType'})
Content type of the secret
is_enabled
class-attribute
instance-attribute
is_enabled: Optional[bool] = dataclass_field(default=None, kw_only=True, metadata={'wire_name': 'isEnabled'})
A flag indicating whether the secret is enabled
created_time
class-attribute
instance-attribute
created_time: Optional[str] = dataclass_field(default=None, kw_only=True, metadata={'wire_name': 'createdTime'})
Time when the secret was created
last_updated_time
class-attribute
instance-attribute
last_updated_time: Optional[str] = dataclass_field(default=None, kw_only=True, metadata={'wire_name': 'lastUpdatedTime'})
Time when the secret was last updated
KeyEncryptInput
dataclass
KeyDecryptInput
dataclass
KeyvaultClient
KeyvaultClient(connection_runtime_url: str, credential: AsyncTokenCredential | AzureKeyCredential, *, max_retry_attempts: int = 3, timeout: float = 30.0, use_exponential_backoff: bool = True, initial_retry_delay_seconds: float = 0.5, maximum_retry_delay_seconds: float = 120.0, retry_jitter_factor: float = 0.1, retry_unsafe_http_methods: bool = False, transport: Optional[AsyncHttpTransport] = None, **kwargs: Any)
Bases: ConnectorClientBase
Typed client for keyvault connector.
Initialize a KeyvaultClient.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
connection_runtime_url
|
str
|
The connection runtime URL from Azure Portal. |
required |
credential
|
AsyncTokenCredential | AzureKeyCredential
|
Caller-owned Azure Core credential. |
required |
max_retry_attempts
|
int
|
The maximum number of request attempts. |
3
|
timeout
|
float
|
The network timeout in seconds for each request. The value configures Azure Core retry and transport deadlines. Nonpositive values disable SDK and transport deadlines. |
30.0
|
use_exponential_backoff
|
bool
|
Whether retries use exponential backoff. |
True
|
initial_retry_delay_seconds
|
float
|
The initial retry delay in seconds. |
0.5
|
maximum_retry_delay_seconds
|
float
|
The maximum retry delay in seconds. |
120.0
|
retry_jitter_factor
|
float
|
The jitter fraction applied to retry delays. |
0.1
|
retry_unsafe_http_methods
|
bool
|
Whether unsafe HTTP methods may be retried. |
False
|
transport
|
Optional[AsyncHttpTransport]
|
Optional Azure Core async HTTP transport closed by the client through its asynchronous lifecycle. |
None
|
**kwargs
|
Any
|
Optional Azure Core pipeline policy settings. |
{}
|
Methods:
list_keys
list_keys(*, timeout: Optional[float] = None, headers: Optional[Mapping[str, str]] = None, client_request_id: Optional[str] = None, response_hook: Optional[ConnectorResponseHook] = None) -> AsyncItemPaged[dict[str, Any]]
List keys
List keys.
Returns a single-page Azure Core async collection.
Swagger operation ID: ListKeys.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
timeout
|
Optional[float]
|
The request timeout in seconds. |
None
|
headers
|
Optional[Mapping[str, str]]
|
Additional HTTP request headers. |
None
|
client_request_id
|
Optional[str]
|
A caller-provided request identifier. |
None
|
response_hook
|
Optional[ConnectorResponseHook]
|
A callback invoked with the connector response. |
None
|
Returns:
| Type | Description |
|---|---|
AsyncItemPaged[dict[str, Any]]
|
AsyncItemPaged[dict[str, Any]]: An Azure Core pager over connector
results. Consume it with |
Raises:
| Type | Description |
|---|---|
ConnectorException
|
If the connector request fails. |
list_key_versions
list_key_versions(key_name: str, *, timeout: Optional[float] = None, headers: Optional[Mapping[str, str]] = None, client_request_id: Optional[str] = None, response_hook: Optional[ConnectorResponseHook] = None) -> AsyncItemPaged[dict[str, Any]]
List key versions
List versions of a key.
Returns a single-page Azure Core async collection.
Swagger operation ID: ListKeyVersions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key_name
|
str
|
Name of the key. |
required |
timeout
|
Optional[float]
|
The request timeout in seconds. |
None
|
headers
|
Optional[Mapping[str, str]]
|
Additional HTTP request headers. |
None
|
client_request_id
|
Optional[str]
|
A caller-provided request identifier. |
None
|
response_hook
|
Optional[ConnectorResponseHook]
|
A callback invoked with the connector response. |
None
|
Returns:
| Type | Description |
|---|---|
AsyncItemPaged[dict[str, Any]]
|
AsyncItemPaged[dict[str, Any]]: An Azure Core pager over connector
results. Consume it with |
Raises:
| Type | Description |
|---|---|
ConnectorException
|
If the connector request fails. |
get_key_metadata
async
get_key_metadata(key_name: str, *, timeout: Optional[float] = None, headers: Optional[Mapping[str, str]] = None, client_request_id: Optional[str] = None, response_hook: Optional[ConnectorResponseHook] = None) -> dict[str, Any] | None
Get key metadata
Gets metadata of a key.
Swagger operation ID: GetKeyMetadata.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key_name
|
str
|
Name of the key. |
required |
timeout
|
Optional[float]
|
The request timeout in seconds. |
None
|
headers
|
Optional[Mapping[str, str]]
|
Additional HTTP request headers. |
None
|
client_request_id
|
Optional[str]
|
A caller-provided request identifier. |
None
|
response_hook
|
Optional[ConnectorResponseHook]
|
A callback invoked with the connector response. |
None
|
Returns:
| Type | Description |
|---|---|
dict[str, Any] | None
|
dict[str, Any] | None: The connector operation result. |
Raises:
| Type | Description |
|---|---|
ConnectorException
|
If the connector request fails. |
get_key_version_metadata
async
get_key_version_metadata(key_name: str, key_version: str, *, timeout: Optional[float] = None, headers: Optional[Mapping[str, str]] = None, client_request_id: Optional[str] = None, response_hook: Optional[ConnectorResponseHook] = None) -> dict[str, Any] | None
Get key version metadata
Gets metadata of a version of a key.
Swagger operation ID: GetKeyVersionMetadata.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key_name
|
str
|
Name of the key. |
required |
key_version
|
str
|
Version of the key. |
required |
timeout
|
Optional[float]
|
The request timeout in seconds. |
None
|
headers
|
Optional[Mapping[str, str]]
|
Additional HTTP request headers. |
None
|
client_request_id
|
Optional[str]
|
A caller-provided request identifier. |
None
|
response_hook
|
Optional[ConnectorResponseHook]
|
A callback invoked with the connector response. |
None
|
Returns:
| Type | Description |
|---|---|
dict[str, Any] | None
|
dict[str, Any] | None: The connector operation result. |
Raises:
| Type | Description |
|---|---|
ConnectorException
|
If the connector request fails. |
encrypt_data
async
encrypt_data(input: KeyEncryptInput | Mapping[str, Any], key_name: str, *, timeout: Optional[float] = None, headers: Optional[Mapping[str, str]] = None, client_request_id: Optional[str] = None, response_hook: Optional[ConnectorResponseHook] = None) -> dict[str, Any] | None
Encrypt data with key
Encrypt data using the latest version of a key.
Swagger operation ID: EncryptData.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input
|
KeyEncryptInput | Mapping[str, Any]
|
The request body. Mapping keys use serialized Swagger wire names. |
required |
key_name
|
str
|
Name of the key. |
required |
timeout
|
Optional[float]
|
The request timeout in seconds. |
None
|
headers
|
Optional[Mapping[str, str]]
|
Additional HTTP request headers. |
None
|
client_request_id
|
Optional[str]
|
A caller-provided request identifier. |
None
|
response_hook
|
Optional[ConnectorResponseHook]
|
A callback invoked with the connector response. |
None
|
Returns:
| Type | Description |
|---|---|
dict[str, Any] | None
|
dict[str, Any] | None: The connector operation result. |
Raises:
| Type | Description |
|---|---|
ConnectorException
|
If the connector request fails. |
encrypt_data_with_version
async
encrypt_data_with_version(input: KeyEncryptInput | Mapping[str, Any], key_name: str, key_version: str, *, timeout: Optional[float] = None, headers: Optional[Mapping[str, str]] = None, client_request_id: Optional[str] = None, response_hook: Optional[ConnectorResponseHook] = None) -> dict[str, Any] | None
Encrypt data with key version
Encrypt data using a specific version of a key.
Swagger operation ID: EncryptDataWithVersion.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input
|
KeyEncryptInput | Mapping[str, Any]
|
The request body. Mapping keys use serialized Swagger wire names. |
required |
key_name
|
str
|
Name of the key. |
required |
key_version
|
str
|
Version of the key. |
required |
timeout
|
Optional[float]
|
The request timeout in seconds. |
None
|
headers
|
Optional[Mapping[str, str]]
|
Additional HTTP request headers. |
None
|
client_request_id
|
Optional[str]
|
A caller-provided request identifier. |
None
|
response_hook
|
Optional[ConnectorResponseHook]
|
A callback invoked with the connector response. |
None
|
Returns:
| Type | Description |
|---|---|
dict[str, Any] | None
|
dict[str, Any] | None: The connector operation result. |
Raises:
| Type | Description |
|---|---|
ConnectorException
|
If the connector request fails. |
decrypt_data
async
decrypt_data(input: KeyDecryptInput | Mapping[str, Any], key_name: str, *, timeout: Optional[float] = None, headers: Optional[Mapping[str, str]] = None, client_request_id: Optional[str] = None, response_hook: Optional[ConnectorResponseHook] = None) -> dict[str, Any] | None
Decrypt data with key
Decrypt data using the latest version of a key. Output of this operation is typically classified as secret and can be visible in the run history.
Swagger operation ID: DecryptData.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input
|
KeyDecryptInput | Mapping[str, Any]
|
The request body. Mapping keys use serialized Swagger wire names. |
required |
key_name
|
str
|
Name of the key. |
required |
timeout
|
Optional[float]
|
The request timeout in seconds. |
None
|
headers
|
Optional[Mapping[str, str]]
|
Additional HTTP request headers. |
None
|
client_request_id
|
Optional[str]
|
A caller-provided request identifier. |
None
|
response_hook
|
Optional[ConnectorResponseHook]
|
A callback invoked with the connector response. |
None
|
Returns:
| Type | Description |
|---|---|
dict[str, Any] | None
|
dict[str, Any] | None: The connector operation result. |
Raises:
| Type | Description |
|---|---|
ConnectorException
|
If the connector request fails. |
decrypt_data_with_version
async
decrypt_data_with_version(input: KeyDecryptInput | Mapping[str, Any], key_name: str, key_version: str, *, timeout: Optional[float] = None, headers: Optional[Mapping[str, str]] = None, client_request_id: Optional[str] = None, response_hook: Optional[ConnectorResponseHook] = None) -> dict[str, Any] | None
Decrypt data with key version
Decrypt data using a specific version of a key. Output of this operation is typically classified as secret and can be visible in the run history.
Swagger operation ID: DecryptDataWithVersion.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input
|
KeyDecryptInput | Mapping[str, Any]
|
The request body. Mapping keys use serialized Swagger wire names. |
required |
key_name
|
str
|
Name of the key. |
required |
key_version
|
str
|
Version of the key. |
required |
timeout
|
Optional[float]
|
The request timeout in seconds. |
None
|
headers
|
Optional[Mapping[str, str]]
|
Additional HTTP request headers. |
None
|
client_request_id
|
Optional[str]
|
A caller-provided request identifier. |
None
|
response_hook
|
Optional[ConnectorResponseHook]
|
A callback invoked with the connector response. |
None
|
Returns:
| Type | Description |
|---|---|
dict[str, Any] | None
|
dict[str, Any] | None: The connector operation result. |
Raises:
| Type | Description |
|---|---|
ConnectorException
|
If the connector request fails. |
list_secrets
list_secrets(*, timeout: Optional[float] = None, headers: Optional[Mapping[str, str]] = None, client_request_id: Optional[str] = None, response_hook: Optional[ConnectorResponseHook] = None) -> AsyncItemPaged[dict[str, Any]]
List secrets
List secrets.
Returns a single-page Azure Core async collection.
Swagger operation ID: ListSecrets.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
timeout
|
Optional[float]
|
The request timeout in seconds. |
None
|
headers
|
Optional[Mapping[str, str]]
|
Additional HTTP request headers. |
None
|
client_request_id
|
Optional[str]
|
A caller-provided request identifier. |
None
|
response_hook
|
Optional[ConnectorResponseHook]
|
A callback invoked with the connector response. |
None
|
Returns:
| Type | Description |
|---|---|
AsyncItemPaged[dict[str, Any]]
|
AsyncItemPaged[dict[str, Any]]: An Azure Core pager over connector
results. Consume it with |
Raises:
| Type | Description |
|---|---|
ConnectorException
|
If the connector request fails. |
list_secret_versions
list_secret_versions(secret_name: str, *, timeout: Optional[float] = None, headers: Optional[Mapping[str, str]] = None, client_request_id: Optional[str] = None, response_hook: Optional[ConnectorResponseHook] = None) -> AsyncItemPaged[dict[str, Any]]
List secret versions
List versions of a secret.
Returns a single-page Azure Core async collection.
Swagger operation ID: ListSecretVersions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
secret_name
|
str
|
Name of the secret. |
required |
timeout
|
Optional[float]
|
The request timeout in seconds. |
None
|
headers
|
Optional[Mapping[str, str]]
|
Additional HTTP request headers. |
None
|
client_request_id
|
Optional[str]
|
A caller-provided request identifier. |
None
|
response_hook
|
Optional[ConnectorResponseHook]
|
A callback invoked with the connector response. |
None
|
Returns:
| Type | Description |
|---|---|
AsyncItemPaged[dict[str, Any]]
|
AsyncItemPaged[dict[str, Any]]: An Azure Core pager over connector
results. Consume it with |
Raises:
| Type | Description |
|---|---|
ConnectorException
|
If the connector request fails. |
get_secret_metadata
async
get_secret_metadata(secret_name: str, *, timeout: Optional[float] = None, headers: Optional[Mapping[str, str]] = None, client_request_id: Optional[str] = None, response_hook: Optional[ConnectorResponseHook] = None) -> dict[str, Any] | None
Get secret metadata
Gets metadata of a secret.
Swagger operation ID: GetSecretMetadata.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
secret_name
|
str
|
Name of the secret. |
required |
timeout
|
Optional[float]
|
The request timeout in seconds. |
None
|
headers
|
Optional[Mapping[str, str]]
|
Additional HTTP request headers. |
None
|
client_request_id
|
Optional[str]
|
A caller-provided request identifier. |
None
|
response_hook
|
Optional[ConnectorResponseHook]
|
A callback invoked with the connector response. |
None
|
Returns:
| Type | Description |
|---|---|
dict[str, Any] | None
|
dict[str, Any] | None: The connector operation result. |
Raises:
| Type | Description |
|---|---|
ConnectorException
|
If the connector request fails. |
get_secret_version_metadata
async
get_secret_version_metadata(secret_name: str, secret_version: str, *, timeout: Optional[float] = None, headers: Optional[Mapping[str, str]] = None, client_request_id: Optional[str] = None, response_hook: Optional[ConnectorResponseHook] = None) -> dict[str, Any] | None
Get secret version metadata
Gets metadata of a version of a secret.
Swagger operation ID: GetSecretVersionMetadata.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
secret_name
|
str
|
Name of the secret. |
required |
secret_version
|
str
|
Version of the secret. |
required |
timeout
|
Optional[float]
|
The request timeout in seconds. |
None
|
headers
|
Optional[Mapping[str, str]]
|
Additional HTTP request headers. |
None
|
client_request_id
|
Optional[str]
|
A caller-provided request identifier. |
None
|
response_hook
|
Optional[ConnectorResponseHook]
|
A callback invoked with the connector response. |
None
|
Returns:
| Type | Description |
|---|---|
dict[str, Any] | None
|
dict[str, Any] | None: The connector operation result. |
Raises:
| Type | Description |
|---|---|
ConnectorException
|
If the connector request fails. |
get_secret
async
get_secret(secret_name: str, *, timeout: Optional[float] = None, headers: Optional[Mapping[str, str]] = None, client_request_id: Optional[str] = None, response_hook: Optional[ConnectorResponseHook] = None) -> dict[str, Any] | None
Get secret
Gets a secret. Output of this operation is typically classified as secret and can be visible in the run history.
Swagger operation ID: GetSecret.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
secret_name
|
str
|
Name of the secret. |
required |
timeout
|
Optional[float]
|
The request timeout in seconds. |
None
|
headers
|
Optional[Mapping[str, str]]
|
Additional HTTP request headers. |
None
|
client_request_id
|
Optional[str]
|
A caller-provided request identifier. |
None
|
response_hook
|
Optional[ConnectorResponseHook]
|
A callback invoked with the connector response. |
None
|
Returns:
| Type | Description |
|---|---|
dict[str, Any] | None
|
dict[str, Any] | None: The connector operation result. |
Raises:
| Type | Description |
|---|---|
ConnectorException
|
If the connector request fails. |
get_secret_version
async
get_secret_version(secret_name: str, secret_version: str, *, timeout: Optional[float] = None, headers: Optional[Mapping[str, str]] = None, client_request_id: Optional[str] = None, response_hook: Optional[ConnectorResponseHook] = None) -> dict[str, Any] | None
Get secret version
Gets a version of a secret. Output of this operation is typically classified as secret and can be visible in the run history.
Swagger operation ID: GetSecretVersion.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
secret_name
|
str
|
Name of the secret. |
required |
secret_version
|
str
|
Version of the secret. |
required |
timeout
|
Optional[float]
|
The request timeout in seconds. |
None
|
headers
|
Optional[Mapping[str, str]]
|
Additional HTTP request headers. |
None
|
client_request_id
|
Optional[str]
|
A caller-provided request identifier. |
None
|
response_hook
|
Optional[ConnectorResponseHook]
|
A callback invoked with the connector response. |
None
|
Returns:
| Type | Description |
|---|---|
dict[str, Any] | None
|
dict[str, Any] | None: The connector operation result. |
Raises:
| Type | Description |
|---|---|
ConnectorException
|
If the connector request fails. |