Key Vault API versions supported by this package
Return a translation table usable for str.translate().
If there is only one argument, it must be a dictionary mapping Unicode ordinals (integers) or characters to Unicode ordinals, strings or None. Character keys will be then converted to ordinals. If there are two arguments, they must be strings of equal length, and in the resulting dictionary, each character in x will be mapped to the character at the same position in y. If there is a third argument, it must be a string, whose characters will be mapped to None in the result.
Return a capitalized version of the string.
More specifically, make the first character have upper case and the rest lower case.
Return a version of the string suitable for caseless comparisons.
Return a centered string of length width.
Padding is done using the specified fill character (default is a space).
Return the number of non-overlapping occurrences of substring sub in string S[start:end].
Optional arguments start and end are interpreted as in slice notation.
Encode the string using the codec registered for encoding.
The encoding in which to encode the string.
The error handling scheme to use for encoding errors. The default is âstrictâ meaning that encoding errors raise a UnicodeEncodeError. Other possible values are âignoreâ, âreplaceâ and âxmlcharrefreplaceâ as well as any other name registered with codecs.register_error that can handle UnicodeEncodeErrors.
Return True if the string ends with the specified suffix, False otherwise.
A string or a tuple of strings to try.
Optional start position. Default: start of the string.
Optional stop position. Default: end of the string.
Return a copy where all tab characters are expanded using spaces.
If tabsize is not given, a tab size of 8 characters is assumed.
Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end].
Optional arguments start and end are interpreted as in slice notation. Return -1 on failure.
Return a formatted version of the string, using substitutions from args and kwargs. The substitutions are identified by braces (â{â and â}â).
Return a formatted version of the string, using substitutions from mapping. The substitutions are identified by braces (â{â and â}â).
Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end].
Optional arguments start and end are interpreted as in slice notation. Raises ValueError when the substring is not found.
Return True if the string is an alpha-numeric string, False otherwise.
A string is alpha-numeric if all characters in the string are alpha-numeric and there is at least one character in the string.
Return True if the string is an alphabetic string, False otherwise.
A string is alphabetic if all characters in the string are alphabetic and there is at least one character in the string.
Return True if all characters in the string are ASCII, False otherwise.
ASCII characters have code points in the range U+0000-U+007F. Empty string is ASCII too.
Return True if the string is a decimal string, False otherwise.
A string is a decimal string if all characters in the string are decimal and there is at least one character in the string.
Return True if the string is a digit string, False otherwise.
A string is a digit string if all characters in the string are digits and there is at least one character in the string.
Return True if the string is a valid Python identifier, False otherwise.
Call keyword.iskeyword(s) to test whether string s is a reserved identifier, such as âdefâ or âclassâ.
Return True if the string is a lowercase string, False otherwise.
A string is lowercase if all cased characters in the string are lowercase and there is at least one cased character in the string.
Return True if the string is a numeric string, False otherwise.
A string is numeric if all characters in the string are numeric and there is at least one character in the string.
Return True if all characters in the string are printable, False otherwise.
A character is printable if repr() may use it in its output.
Return True if the string is a whitespace string, False otherwise.
A string is whitespace if all characters in the string are whitespace and there is at least one character in the string.
Return True if the string is a title-cased string, False otherwise.
In a title-cased string, upper- and title-case characters may only follow uncased characters and lowercase characters only cased ones.
Return True if the string is an uppercase string, False otherwise.
A string is uppercase if all cased characters in the string are uppercase and there is at least one cased character in the string.
Concatenate any number of strings.
The string whose method is called is inserted in between each given string. The result is returned as a new string.
Example: â.â.join([âabâ, âpqâ, ârsâ]) -> âab.pq.rsâ
Return a left-justified string of length width.
Padding is done using the specified fill character (default is a space).
Return a copy of the string converted to lowercase.
Return a copy of the string with leading whitespace removed.
If chars is given and not None, remove characters in chars instead.
Partition the string into three parts using the given separator.
This will search for the separator in the string. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.
If the separator is not found, returns a 3-tuple containing the original string and two empty strings.
Return a str with the given prefix string removed if present.
If the string starts with the prefix string, return string[len(prefix):]. Otherwise, return a copy of the original string.
Return a str with the given suffix string removed if present.
If the string ends with the suffix string and that suffix is not empty, return string[:-len(suffix)]. Otherwise, return a copy of the original string.
Return a copy with all occurrences of substring old replaced by new.
- count
Maximum number of occurrences to replace. -1 (the default value) means replace all occurrences.
If the optional argument count is given, only the first count occurrences are replaced.
Return the highest index in S where substring sub is found, such that sub is contained within S[start:end].
Optional arguments start and end are interpreted as in slice notation. Return -1 on failure.
Return the highest index in S where substring sub is found, such that sub is contained within S[start:end].
Optional arguments start and end are interpreted as in slice notation. Raises ValueError when the substring is not found.
Return a right-justified string of length width.
Padding is done using the specified fill character (default is a space).
Partition the string into three parts using the given separator.
This will search for the separator in the string, starting at the end. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.
If the separator is not found, returns a 3-tuple containing two empty strings and the original string.
Return a list of the substrings in the string, using sep as the separator string.
- sep
The separator used to split the string.
When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.
- maxsplit
Maximum number of splits. -1 (the default value) means no limit.
Splitting starts at the end of the string and works to the front.
Return a copy of the string with trailing whitespace removed.
If chars is given and not None, remove characters in chars instead.
Return a list of the substrings in the string, using sep as the separator string.
- sep
The separator used to split the string.
When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.
- maxsplit
Maximum number of splits. -1 (the default value) means no limit.
Splitting starts at the front of the string and works to the end.
Note, str.split() is mainly useful for data that has been intentionally delimited. With natural text that includes punctuation, consider using the regular expression module.
Return a list of the lines in the string, breaking at line boundaries.
Line breaks are not included in the resulting list unless keepends is given and true.
Return True if the string starts with the specified prefix, False otherwise.
A string or a tuple of strings to try.
Optional start position. Default: start of the string.
Optional stop position. Default: end of the string.
Return a copy of the string with leading and trailing whitespace removed.
If chars is given and not None, remove characters in chars instead.
Convert uppercase characters to lowercase and lowercase characters to uppercase.
Return a version of the string where each word is titlecased.
More specifically, words start with uppercased characters and all remaining cased characters have lower case.
Replace each character in the string using the given translation table.
- table
Translation table, which must be a mapping of Unicode ordinals to Unicode ordinals, strings, or None.
The table must implement lookup/indexing via __getitem__, for instance a dictionary or list. If this operation raises LookupError, the character is left untouched. Characters mapped to None are deleted.
Return a copy of the string converted to uppercase.
Pad a numeric string with zeros on the left, to fill a field of the given width.
The string is never truncated.
this is the default version
A deleted secretâs properties and information about its deletion.
If soft-delete is enabled, returns information about its recovery as well.
properties (SecretProperties) â The deleted secretâs properties.
deleted_date (datetime or None) â When the secret was deleted, in UTC.
recovery_id (str or None) â An identifier used to recover the deleted secret.
scheduled_purge_date (datetime or None) â When the secret is scheduled to be purged by Key Vault, in UTC.
When the secret was deleted, in UTC.
When the secret was deleted, in UTC.
datetime or None
The secretâs ID.
The secretâs ID.
str or None
The secretâs name.
The secretâs name.
str or None
The properties of the deleted secret.
The properties of the deleted secret.
An identifier used to recover the deleted secret.
An identifier used to recover the deleted secret.
str or None
When the secret is scheduled to be purged by Key Vault, in UTC.
When the secret is scheduled to be purged by Key Vault, in UTC.
datetime or None
All of a secretâs properties, and its value.
properties (SecretProperties) â The secretâs properties.
value (str or None) â The value of the secret.
The secretâs ID.
The secretâs ID.
str or None
The secretâs name.
The secretâs name.
str or None
The secretâs properties.
The secretâs properties.
The secretâs value.
The secretâs value.
str or None
Information about a KeyVaultSecret parsed from a secret ID.
source_id (str) â the full original identifier of a secret
ValueError â if the secret ID is improperly formatted
Example
secret = client.get_secret(secret_name) parsed_secret_id = KeyVaultSecretIdentifier(secret.id) print(parsed_secret_id.name) print(parsed_secret_id.vault_url) print(parsed_secret_id.version) print(parsed_secret_id.source_id)
A high-level interface for managing a vaultâs secrets.
vault_url (str) â URL of the vault the client will access. This is also called the vaultâs âDNS Nameâ. You should validate that this URL references a valid Key Vault resource. See https://aka.ms/azsdk/blog/vault-uri for details.
credential (TokenCredential) â An object which can provide an access token for the vault, such as a credential from azure.identity
api_version (ApiVersion or str) â Version of the service API to use. Defaults to the most recent.
verify_challenge_resource (bool) â Whether to verify the authentication challenge resource matches the Key Vault domain. Defaults to True.
Example
Create a newSecretClient
ï
from azure.identity import DefaultAzureCredential from azure.keyvault.secrets import SecretClient # Create a SecretClient using default Azure credentials credential = DefaultAzureCredential() secret_client = SecretClient(vault_url, credential)
Back up a secret in a protected form useable only by Azure Key Vault. Requires secrets/backup permission.
name (str) â Name of the secret to back up
The backup result, in a protected bytes format that can only be used by Azure Key Vault.
ResourceNotFoundError or HttpResponseError â the former if the secret doesnât exist; the latter for other errors
Example
# backup secret # returns the raw bytes of the backed up secret secret_backup = secret_client.backup_secret(secret_name) print(secret_backup)
Delete all versions of a secret. Requires secrets/delete permission.
When this method returns Key Vault has begun deleting the secret. Deletion may take several seconds in a vault with soft-delete enabled. This method therefore returns a poller enabling you to wait for deletion to complete.
name (str) â Name of the secret to delete.
A poller for the delete operation. The pollerâs result method returns the DeletedSecret
without waiting for deletion to complete. If the vault has soft-delete enabled and you want to permanently delete the secret with purge_deleted_secret()
, call the pollerâs wait method first. It will block until the deletion is complete. The wait method requires secrets/get permission.
ResourceNotFoundError or HttpResponseError â the former if the secret doesnât exist; the latter for other errors
Example
# delete a secret deleted_secret_poller = secret_client.begin_delete_secret(secret_name) deleted_secret = deleted_secret_poller.result() print(deleted_secret.name) # if the vault has soft-delete enabled, the secret's, deleted_date # scheduled purge date and recovery id are set print(deleted_secret.deleted_date) print(deleted_secret.scheduled_purge_date) print(deleted_secret.recovery_id) # if you want to block until secret is deleted server-side, call wait() on the poller deleted_secret_poller.wait()
Recover a deleted secret to its latest version. Possible only in a vault with soft-delete enabled.
Requires the secrets/recover permission. If the vault does not have soft-delete enabled, begin_delete_secret()
is permanent, and this method will return an error. Attempting to recover a non-deleted secret will also return an error. When this method returns Key Vault has begun recovering the secret. Recovery may take several seconds. This method therefore returns a poller enabling you to wait for recovery to complete. Waiting is only necessary when you want to use the recovered secret in another operation immediately.
name (str) â Name of the deleted secret to recover
A poller for the recovery operation. The pollerâs result method returns the recovered secretâs SecretProperties
without waiting for recovery to complete. If you want to use the recovered secret immediately, call the pollerâs wait method, which blocks until the secret is ready to use. The wait method requires secrets/get permission.
Example
Recover a deleted secretï# recover deleted secret to the latest version recover_secret_poller = secret_client.begin_recover_deleted_secret(secret_name) recovered_secret = recover_secret_poller.result() print(recovered_secret.id) print(recovered_secret.name) # if you want to block until secret is recovered server-side, call wait() on the poller recover_secret_poller.wait()
Close sockets opened by the client.
Calling this method is unnecessary when using the client as a context manager.
Get a deleted secret. Possible only in vaults with soft-delete enabled. Requires secrets/get permission.
name (str) â Name of the deleted secret
The deleted secret.
ResourceNotFoundError or HttpResponseError â the former if the deleted secret doesnât exist; the latter for other errors
Example
# gets a deleted secret (requires soft-delete enabled for the vault) deleted_secret = secret_client.get_deleted_secret(secret_name) print(deleted_secret.name)
Get a secret. Requires the secrets/get permission.
The fetched secret.
ResourceNotFoundError or HttpResponseError â the former if the secret doesnât exist; the latter for other errors
Example
# get the latest version of a secret secret = secret_client.get_secret(secret_name) # alternatively, specify a version secret = secret_client.get_secret(secret_name, secret.properties.version) print(secret.id) print(secret.name) print(secret.properties.version) print(secret.properties.vault_url)
Lists all deleted secrets. Possible only in vaults with soft-delete enabled.
Requires secrets/list permission.
An iterator of deleted secrets, excluding their values
Example
# gets an iterator of deleted secrets (requires soft-delete enabled for the vault) deleted_secrets = secret_client.list_deleted_secrets() for secret in deleted_secrets: # the list doesn't include values or versions of the deleted secrets print(secret.id) print(secret.name) print(secret.scheduled_purge_date) print(secret.recovery_id) print(secret.deleted_date)
List properties of all versions of a secret, excluding their values. Requires secrets/list permission.
List items donât include secret values. Use get_secret()
to get a secretâs value.
name (str) â Name of the secret
An iterator of secrets, excluding their values
Example
List all versions of a secretïsecret_versions = secret_client.list_properties_of_secret_versions("secret-name") for secret in secret_versions: # the list doesn't include the values at each version print(secret.id) print(secret.enabled) print(secret.updated_on)
List identifiers and attributes of all secrets in the vault. Requires secrets/list permission.
List items donât include secret values. Use get_secret()
to get a secretâs value.
An iterator of secrets, excluding their values
Example
# list secrets secrets = secret_client.list_properties_of_secrets() for secret in secrets: # the list doesn't include values or versions of the secrets print(secret.id) print(secret.name) print(secret.enabled)
Permanently deletes a deleted secret. Possible only in vaults with soft-delete enabled.
Performs an irreversible deletion of the specified secret, without possibility for recovery. The operation is not available if the recovery_level
does not specify âPurgeableâ. This method is only necessary for purging a secret before its scheduled_purge_date
.
Requires secrets/purge permission.
name (str) â Name of the deleted secret to purge
None
Example
# if the vault has soft-delete enabled, purge permanently deletes the secret # (with soft-delete disabled, begin_delete_secret is permanent) secret_client.purge_deleted_secret("secret-name")
Restore a backed up secret. Requires the secrets/restore permission.
backup (bytes) â A secret backup as returned by backup_secret()
The restored secret
ResourceExistsError or HttpResponseError â the former if the secretâs name is already in use; the latter for other errors
Example
Restore a backed up secretï# restores a backed up secret restored_secret = secret_client.restore_secret_backup(secret_backup) print(restored_secret.id) print(restored_secret.version)
Runs a network request using the clientâs existing pipeline.
The request URL can be relative to the vault URL. The service API version used for the request is the same as the clientâs unless otherwise specified. This method does not raise if the response is an error; to raise an exception, call raise_for_status() on the returned response object. For more information about how to send custom requests with this method, see https://aka.ms/azsdk/dpcodegen/python/send_request.
request (HttpRequest) â The network request you want to make.
stream (bool) â Whether the response payload will be streamed. Defaults to False.
The response of your network call. Does not do error handling on your response.
Set a secret value. If name is in use, create a new version of the secret. If not, create a new secret.
Requires secrets/set permission.
enabled (bool) â Whether the secret is enabled for use.
tags (Dict[str, str] or None) â Application specific metadata in the form of key-value pairs.
content_type (str) â An arbitrary string indicating the type of the secret, e.g. âpasswordâ
not_before (datetime) â Not before date of the secret in UTC
expires_on (datetime) â Expiry date of the secret in UTC
The created or updated secret.
Example
Set a secretâs valueïfrom dateutil import parser as date_parse expires_on = date_parse.parse("2050-02-02T08:00:00.000Z") # create a secret, setting optional arguments secret = secret_client.set_secret(secret_name, "secret-value", expires_on=expires_on) print(secret.name) print(secret.properties.version) print(secret.properties.expires_on)
Update properties of a secret other than its value. Requires secrets/set permission.
This method updates properties of the secret, such as whether itâs enabled, but canât change the secretâs value. Use set_secret()
to change the secretâs value.
enabled (bool) â Whether the secret is enabled for use.
tags (Dict[str, str] or None) â Application specific metadata in the form of key-value pairs.
content_type (str) â An arbitrary string indicating the type of the secret, e.g. âpasswordâ
not_before (datetime) â Not before date of the secret in UTC
expires_on (datetime) â Expiry date of the secret in UTC
The updated secret properties.
ResourceNotFoundError or HttpResponseError â the former if the secret doesnât exist; the latter for other errors
Example
Update a secretâs attributesï# update attributes of an existing secret content_type = "text/plain" tags = {"foo": "updated tag"} updated_secret_properties = secret_client.update_secret_properties( secret_name, content_type=content_type, tags=tags ) print(updated_secret_properties.version) print(updated_secret_properties.updated_on) print(updated_secret_properties.content_type) print(updated_secret_properties.tags)
A secretâs ID and attributes.
An arbitrary string indicating the type of the secret.
The content type of the secret.
str or None
When the secret was created, in UTC.
When the secret was created, in UTC.
datetime or None
Whether the secret is enabled for use.
True if the secret is enabled for use; False otherwise.
bool or None
When the secret expires, in UTC.
When the secret expires, in UTC.
datetime or None
The secretâs ID.
The secretâs ID.
str or None
If this secret backs a certificate, this property is the identifier of the corresponding key.
The ID of the key backing the certificate thatâs backed by this secret. If the secret isnât backing a certificate, this is None.
str or None
Whether the secretâs lifetime is managed by Key Vault. If the secret backs a certificate, this will be true.
True if the secretâs lifetime is managed by Key Vault; False otherwise.
bool or None
The secretâs name.
The secretâs name.
str or None
The time before which the secret cannot be used, in UTC.
The time before which the secret cannot be used, in UTC.
datetime or None
The number of days the key is retained before being deleted from a soft-delete enabled Key Vault.
The number of days the key is retained before being deleted from a soft-delete enabled Key Vault.
int or None
The vaultâs deletion recovery level for secrets.
The vaultâs deletion recovery level for secrets.
str or None
Application specific metadata in the form of key-value pairs.
A dictionary of tags attached to this secret.
dict or None
When the secret was last updated, in UTC.
When the secret was last updated, in UTC.
datetime or None
URL of the vault containing the secret.
URL of the vault containing the secret.
str or None
The secretâs version.
The secretâs version.
str or None
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4