netunicorn.base.environment_definitions.RuntimeContext

class RuntimeContext(ports_mapping=<factory>, environment_variables=<factory>, network=None, additional_arguments=<factory>)[source]

Bases: object

Stores a runtime context for a Deployment, such as port mapping or environment variables, that would be available during deployment

Parameters:
  • ports_mapping (Dict[int, int], default: <factory>) – map of ports to be mapped to the host

  • environment_variables (Dict[str, str], default: <factory>) – map of environment variables to be set

  • additional_arguments (List[str], default: <factory>) – list of additional arguments to be passed to the runtime

  • network (Optional[str], default: None)

Attributes

network

Desired network or interface name

ports_mapping

Desired port mapping (for all protocols)

environment_variables

Desired values of environment variables

additional_arguments

Additional arguments (could be interpreted by runtimes)

Methods

from_json

Creates RuntimeContext from JSON representation.

ports_mapping: Dict[int, int][source]

Desired port mapping (for all protocols)

environment_variables: Dict[str, str][source]

Desired values of environment variables

network: Optional[str] = None[source]

Desired network or interface name

additional_arguments: List[str][source]

Additional arguments (could be interpreted by runtimes)

classmethod from_json(data)[source]

Creates RuntimeContext from JSON representation.

Parameters:

data (RuntimeContextRepresentation) – JSON representation of RuntimeContext

Returns:

RuntimeContext – Deserialized RuntimeContext