API - Utilities
This part of the module provides a collection of generic utilities which are
largely for internal use.
The various utilities are typically imported like so:
from mosromgr.utils import s3
Warning
This part of the module should not be considered part of the stable API and
is subject to backwards-incompatible changes.
S3
AWS S3 utilities
get_mos_files
-
mosromgr.utils.s3.
get_mos_files
(bucket_name, prefix=None, *, suffix='.mos.xml')[source]
Retrieve MOS files from given S3 bucket in location defined by prefix.
Returns a list of file keys.
get_file_contents
-
mosromgr.utils.s3.
get_file_contents
(bucket_name, file_key)[source]
Open the S3 file and return its contents as a string
XML
XML helper functions
remove_node
-
mosromgr.utils.xml.
remove_node
(parent, node)[source]
Remove node from parent.
replace_node
-
mosromgr.utils.xml.
replace_node
(parent, old_node, new_node, index)[source]
Replace old_node with new_node in parent at index.
insert_node
-
mosromgr.utils.xml.
insert_node
(parent, node, index)[source]
Insert node in parent at index.
find_child
-
mosromgr.utils.xml.
find_child
(parent, child_tag, id=None)[source]
Find an element with child_tag in parent and return (child, index)
or (None, None)
if not found. If id is provided, it will be searched
for, otherwise the first child will be returned.