Module aws_lambda_powertools.utilities.feature_flags.base
Expand source code
from abc import ABC, abstractmethod
from typing import Any, Dict
class StoreProvider(ABC):
@abstractmethod
def get_configuration(self) -> Dict[str, Any]:
"""Get configuration from any store and return the parsed JSON dictionary
Raises
------
ConfigurationStoreError
Any error that can occur during schema fetch or JSON parse
Returns
-------
Dict[str, Any]
parsed JSON dictionary
**Example**
```python
{
"premium_features": {
"default": False,
"rules": {
"customer tier equals premium": {
"when_match": True,
"conditions": [
{
"action": "EQUALS",
"key": "tier",
"value": "premium",
}
],
}
},
},
"feature_two": {
"default": False
}
}
```
"""
return NotImplemented # pragma: no cover
class BaseValidator(ABC):
@abstractmethod
def validate(self):
return NotImplemented # pragma: no cover
Classes
class BaseValidator
-
Helper class that provides a standard way to create an ABC using inheritance.
Expand source code
class BaseValidator(ABC): @abstractmethod def validate(self): return NotImplemented # pragma: no cover
Ancestors
- abc.ABC
Subclasses
Methods
def validate(self)
-
Expand source code
@abstractmethod def validate(self): return NotImplemented # pragma: no cover
class StoreProvider
-
Helper class that provides a standard way to create an ABC using inheritance.
Expand source code
class StoreProvider(ABC): @abstractmethod def get_configuration(self) -> Dict[str, Any]: """Get configuration from any store and return the parsed JSON dictionary Raises ------ ConfigurationStoreError Any error that can occur during schema fetch or JSON parse Returns ------- Dict[str, Any] parsed JSON dictionary **Example** ```python { "premium_features": { "default": False, "rules": { "customer tier equals premium": { "when_match": True, "conditions": [ { "action": "EQUALS", "key": "tier", "value": "premium", } ], } }, }, "feature_two": { "default": False } } ``` """ return NotImplemented # pragma: no cover
Ancestors
- abc.ABC
Subclasses
Methods
def get_configuration(self) ‑> Dict[str, Any]
-
Get configuration from any store and return the parsed JSON dictionary
Raises
ConfigurationStoreError
- Any error that can occur during schema fetch or JSON parse
Returns
Dict[str, Any]
-
parsed JSON dictionary
Example
{ "premium_features": { "default": False, "rules": { "customer tier equals premium": { "when_match": True, "conditions": [ { "action": "EQUALS", "key": "tier", "value": "premium", } ], } }, }, "feature_two": { "default": False } }
Expand source code
@abstractmethod def get_configuration(self) -> Dict[str, Any]: """Get configuration from any store and return the parsed JSON dictionary Raises ------ ConfigurationStoreError Any error that can occur during schema fetch or JSON parse Returns ------- Dict[str, Any] parsed JSON dictionary **Example** ```python { "premium_features": { "default": False, "rules": { "customer tier equals premium": { "when_match": True, "conditions": [ { "action": "EQUALS", "key": "tier", "value": "premium", } ], } }, }, "feature_two": { "default": False } } ``` """ return NotImplemented # pragma: no cover