hashivaultlib package

Submodules

hashivaultlib.hashivaultlib module

Main code for hashivaultlib.

class hashivaultlib.hashivaultlib.BrokenToken(vault_instance, data)[source]

Bases: hashivaultlib.hashivaultlib.Token

Models a broken token with only an accessor ID and errors messages.

errors

The errors of the token.

class hashivaultlib.hashivaultlib.Token(vault_instance, data)[source]

Bases: object

Models a vault token and provides delete capabilities.

accessor

The accessor token of the token.

Returns:The accessor token of the token
Return type:string
auth

Auth data for the token.

Returns:The auth data
creation_time

The creation time of the token in seconds.

Returns:The creation time of the token in seconds
Return type:string
creation_time_day_format

The creation time of the token in a day duration format.

Returns:The creation time of the token in a day duration format
Return type:string
creation_ttl

The creation ttl of the token in seconds.

Returns:The creation ttl of the token in seconds
Return type:string
creation_ttl_day_format

The creation ttl of the token in a day duration format.

Returns:The creation ttl of the token in a day duration format
Return type:string
delete()[source]

Deletes the token by removing the accessor from the vault instance.

display_name

The display name of the token.

Returns:The display name of the token
Return type:string
expire_time

The expire time of the token.

Returns:The expire time of the token if any, None otherwise
Return type:datetime
explicit_max_ttl

The explicit max ttl.

Returns:The explicit max ttl
Return type:string
explicit_max_ttl_day_format

The explicit max ttl in a day duration format.

Returns:The explicit max ttl in a day duration format
Return type:string
id

The id of the token.

Returns:The id of the token
Return type:string
issue_time

The issue time of the token.

Returns:The issue time of the token
Return type:datetime
lease_duration

The duration of the lease of the token.

Returns:The duration of the lease of the token
Return type:string
lease_id

The lease ID.

Returns:The lease ID
Return type:string
meta

The meta of the token.

Returns:The meta of the token
Return type:string
num_uses

The number of uses of the token.

Returns:The number of uses of the token
Return type:string
orphan

Flag on whether the token is orphan.

Returns:True if the token is orphan, False otherwise
Return type:bool
path

The path to create the token.

Returns:The path to create the token
Return type:string
policies

The policies this token has enforced upon.

Returns:The policies of the token
Return type:list
raw_data

The raw data of the token.

Returns:The raw data of the token
Return type:dict
renewable

A flag on whether the token is renewable.

Returns:True if token is renewable, False otherwise
Return type:bool
request_id

The id of the request for the token.

Returns:The id of the request for the token
Return type:string
ttl

The ttl is seconds.

Returns:The ttl is seconds
Return type:string
ttl_day_format

The ttl in a day duration format.

Returns:The ttl in a day duration format
Return type:string
warnings

The warnings of the token.

Returns:The warnings of the token
wrap_info

The wrap info of the token.

Returns:The wrap info of the token
class hashivaultlib.hashivaultlib.TokenFactory[source]

Bases: object

Factory to create the appropriate Token type.

class hashivaultlib.hashivaultlib.Vault(*args, **kwargs)[source]

Bases: hvac.v1.Client

Extends the hvac client for vault with some extra handy usability.

delete_path(path)[source]

Deletes recursively a path from vault.

Parameters:path – The path to remove
restore_secrets(secrets)[source]

Restores secrets to vault in their original path.

Parameters:secrets – List of secret dictionaries with “original_path” attribute set
Returns:True on success, False otherwise
retrieve_secrets_from_path(path)[source]

Retrieves recursively all the secrets from a path in vault.

Parameters:path – The path to retrieve all the secrets for
tokens

Models the tokens of a vault installation.

Returns:All tokens of a vault in a Token object format
Return type:list

hashivaultlib.hashivaultlibexceptions module

Custom exception code for hashivaultlib.

Module contents

hashivaultlib package.

Import all parts from hashivaultlib here