mosromgr.moscollection
This part of the module provides a wrapper class MosCollection
which stores references to specified MOS files, strings or S3 object keys so the ~mosromgr.mostypes.MosFile
objects can be recreated when needed rather than kept in memory.
Note
Note that creating a MosCollection
from strings does not benefit from memory efficiency as the strings would still be held in memory.
The MosCollection
is typically imported like so:
from mosromgr.moscollection import MosCollection
MOS collections are constructed using one of three classmethods. Either from a list of file paths:
mos_files = ['roCreate.mos.xml', 'roStorySend.mos.xml', 'roDelete.mos.xml']
mc = MosCollection.from_files(mos_files)
from a list of strings:
mos_strings = [roCreate, roStorySend, roDelete]
mc = MosCollection.from_strings(mos_files)
or from an S3 bucket:
mc = MosCollection.from_s3(bucket_name=bucket_name, prefix=prefix)
Note
Your AWS credentials must be configured to construct using the ~MosCollection.from_s3
classmethod. See https://boto3.amazonaws.com/v1/documentation/api/latest/guide/credentials.html
MosCollection()
The MosReader
class is internal and is not intended to be constructed by the user. A MosCollection
object will contain a list of MosReader
instances, so users may find it useful to refer to its members.
MosReader()