Manifest
This module defines the Manifest class for handling ankaios manifests.
Classes
- Manifest:
Represents a workload manifest and provides methods to validate and load it.
Usage
- Load a manifest from a file:
manifest = Manifest.from_file("path/to/manifest.yaml")
- Load a manifest from a string:
manifest = Manifest.from_string("apiVersion: 1.0\nworkloads: {}")
- Load a manifest from a dictionary:
manifest = Manifest.from_dict({"apiVersion": "1.0", "workloads": {}})
- Check if the manifest is valid:
try: manifest = Manifest.from_file("path/to/manifest.yaml") except InvalidManifestException as e: print(f"Invalid manifest: {e}")
Manifest Class
- class ankaios_sdk._components.manifest.Manifest(manifest)[source]
Bases:
object
Represents a workload manifest. The manifest can be loaded from a yaml file, string or dictionary.
- __init__(manifest)[source]
Initializes a Manifest instance with the given manifest data.
- Parameters:
manifest (dict) – The manifest data.
- Raises:
ValueError – If the manifest data is invalid.
- static from_file(file_path)[source]
Loads a manifest from a file.
- Parameters:
file_path (str) – The path to the manifest file.
- Returns:
An instance of the Manifest class with the loaded data.
- Return type:
- Raises:
FileNotFoundError – If the file does not exist.
yaml.YAMLError – If there is an error parsing the YAML file.
- static from_string(manifest)[source]
Creates a Manifest instance from a YAML string.
- Parameters:
manifest (str) – The YAML string representing the manifest.
- Returns:
An instance of the Manifest class with the parsed data.
- Return type:
- Raises:
ValueError – If there is an error parsing the YAML string.
- static from_dict(manifest)[source]
Creates a Manifest instance from a dictionary.
- Parameters:
manifest (dict) – The dictionary representing the manifest.
- Returns:
An instance of the Manifest class with the given data.
- Return type:
- check()[source]
Validates the manifest data.
- Raises:
InvalidManifestException – If the manifest is invalid.
- Return type:
None