sh_cpl/src/sh_edraft/configuration/base/configuration_base.py

35 lines
932 B
Python
Raw Normal View History

from abc import abstractmethod, ABC
2020-11-25 21:41:45 +01:00
from collections import Callable
from typing import Type
2020-11-25 21:41:45 +01:00
2020-11-26 10:45:02 +01:00
from sh_edraft.configuration.base.configuration_model_base import ConfigurationModelBase
from sh_edraft.environment.base.environment_base import EnvironmentBase
2020-11-25 21:41:45 +01:00
class ConfigurationBase(ABC):
2020-11-25 21:41:45 +01:00
@abstractmethod
def __init__(self): pass
2020-11-25 21:41:45 +01:00
@property
2020-11-25 21:41:45 +01:00
@abstractmethod
def environment(self) -> EnvironmentBase: pass
2020-11-25 21:41:45 +01:00
@abstractmethod
def add_environment_variables(self, prefix: str): pass
@abstractmethod
def add_argument_variables(self): pass
@abstractmethod
def add_json_file(self, name: str, optional: bool = None): pass
@abstractmethod
def add_configuration(self, key_type: type, value: object): pass
@abstractmethod
def get_configuration(self, search_type: Type[ConfigurationModelBase]) -> Callable[ConfigurationModelBase]: pass
@abstractmethod
def create(self): pass