common Package¶
managers
Module¶
-
class
lemur.common.managers.
InstanceManager
(class_list=None, instances=True) Bases:
object
-
add
(class_path)
-
all
() Returns a list of cached instances.
-
get_class_list
()
-
remove
(class_path)
-
update
(class_list) Updates the class list and wipes the cache.
-
utils
Module¶
-
lemur.common.utils.
column_windows
(session, column, windowsize) Return a series of WHERE clauses against a given column that break it into windows.
Result is an iterable of tuples, consisting of ((start, end), whereclause), where (start, end) are the ids.
Requires a database that supports window functions, i.e. Postgresql, SQL Server, Oracle.
Enhance this yourself ! Add a “where” argument so that windows of just a subset of rows can be computed.
-
lemur.common.utils.
generate_private_key
(key_type) Generates a new private key based on key_type.
- Valid key types: RSA2048, RSA4096’, ‘ECCPRIME192V1’, ‘ECCPRIME256V1’, ‘ECCSECP192R1’,
- ‘ECCSECP224R1’, ‘ECCSECP256R1’, ‘ECCSECP384R1’, ‘ECCSECP521R1’, ‘ECCSECP256K1’, ‘ECCSECT163K1’, ‘ECCSECT233K1’, ‘ECCSECT283K1’, ‘ECCSECT409K1’, ‘ECCSECT571K1’, ‘ECCSECT163R2’, ‘ECCSECT233R1’, ‘ECCSECT283R1’, ‘ECCSECT409R1’, ‘ECCSECT571R2’
Parameters: key_type – Returns:
-
lemur.common.utils.
get_authority_key
(body) Returns the authority key for a given certificate in hex format
-
lemur.common.utils.
get_psuedo_random_string
() Create a random and strongish challenge.
-
lemur.common.utils.
is_weekend
(date) Determines if a given date is on a weekend.
Parameters: date – Returns:
-
lemur.common.utils.
parse_certificate
(body) Helper function that parses a PEM certificate.
Parameters: body – Returns:
-
lemur.common.utils.
parse_csr
(csr) Helper function that parses a CSR.
Parameters: csr – Returns:
-
lemur.common.utils.
truthiness
(s) If input string resembles something truthy then return True, else False.
-
lemur.common.utils.
validate_conf
(app, required_vars) Ensures that the given fields are set in the applications conf.
Parameters: - app –
- required_vars – list
-
lemur.common.utils.
windowed_query
(q, column, windowsize) “Break a Query into windows on a given column.