API Documentation¶
ECSTransformer¶
- class container_transform.ecs.ECSTransformer(filename=None)¶
A transformer for ECS Tasks
To use this class:
transformer = ECSTransformer('./task.json') output = transformer.ingest_containers() print(json.dumps(output, indent=4))
- static ingest_port_mappings(port_mappings)¶
Transform the ECS mappings to base schema mappings
Parameters: port_mappings (list of dict) – The ECS port mappings Returns: The base schema mappings Return type: list of dict
FigTransformer¶
- class container_transform.fig.FigTransformer(filename=None)¶
A transformer for Fig
To use this class:
transformer = FigTransformer('./fig.yml') normalized_keys = transformer.ingest_containers()
- static emit_port_mappings(port_mappings)¶
Parameters: port_mappings (list of dict) – the base schema port_mappings Returns: Return type: list of str
- ingest_containers(containers=None)¶
Transform the YAML into a dict with normalized keys
BaseTransformer¶
- class container_transform.transformer.BaseTransformer(filename=None)¶
The base class for Transformer classes to inherit from.
Basic usage should look like
transformer = MyTransformer('./my-file.txt') normalized_keys = transformer.ingest_containers()
- ingest_containers(containers=None)¶
Ingest self.stream and return a list of un-converted container definitions dictionaries.
This is to normalize where all the container information is. For example, Fig places the container name outside the rest of the container definition. We need to have a ‘name’ key in the container definition.
Return type: list of dict