diff --git a/documentation/docs/getting-started-with-tirith.md b/documentation/docs/getting-started-with-tirith.md index acf0129f..fbac67a2 100644 --- a/documentation/docs/getting-started-with-tirith.md +++ b/documentation/docs/getting-started-with-tirith.md @@ -2,7 +2,7 @@ id: getting-started-with-tirith title: Getting started with Tirith sidebar_label: Getting Started -description: This documentation overviews you about the introduction of the tirith software. +description: This documentation provides an introduction to the Tirith software. keywords: - tirith - stack-guardian @@ -40,7 +40,7 @@ Tirith is a robust policy framework designed to automate and enforce security, g ## Key Benefits of Tirith -- **Centralized Policy Management :** Tirith offers a unified platform for centralized policy management, reducing duplication and streamlining governance across multiple infrastructures and environments. This ensures consistent application of policies, regardless of the platform being used. +- **Centralized Policy Management:** Tirith offers a unified platform for centralized policy management, reducing duplication and streamlining governance across multiple infrastructures and environments. This ensures consistent application of policies, regardless of the platform being used. - **Simplified Policy Creation :** Tirith’s [intuitive, no-code interface](https://tirith-policy-builder.vercel.app/) and declarative language simplify policy authoring, enabling users to define and manage policies effortlessly. This removes the need for deep technical expertise, allowing teams to quickly align with evolving regulatory requirements. diff --git a/documentation/docs/install-tirith-on-linux.md b/documentation/docs/install-tirith-on-linux.md index dbfdc76d..c0c4eb64 100644 --- a/documentation/docs/install-tirith-on-linux.md +++ b/documentation/docs/install-tirith-on-linux.md @@ -1,8 +1,8 @@ --- id: install-tirith-on-linux -title: Install Tirith on linux +title: Install Tirith on Linux sidebar_label: Linux -description: This documentation overviews you about the introduction of the tirith software. +description: This documentation provides an introduction to the Tirith software. keywords: - tirith - stack-guardian diff --git a/documentation/docs/install-tirith-on-windows.md b/documentation/docs/install-tirith-on-windows.md index 5577a135..aea8736c 100644 --- a/documentation/docs/install-tirith-on-windows.md +++ b/documentation/docs/install-tirith-on-windows.md @@ -2,7 +2,7 @@ id: install-tirith-on-windows title: Install Tirith on Windows sidebar_label: Windows -description: This documentation overviews you about the introduction of the tirith software. +description: This documentation overviews you about the introduction of the Tirith software. keywords: - tirith - stack-guardian diff --git a/documentation/docs/tirith-policy-conditions.md b/documentation/docs/tirith-policy-conditions.md index 185b47f8..37652482 100644 --- a/documentation/docs/tirith-policy-conditions.md +++ b/documentation/docs/tirith-policy-conditions.md @@ -2,7 +2,7 @@ id: tirith-policy-conditions title: Policy Conditions sidebar_label: Policy Conditions -description: This documentation overviews you about the introduction of the tirith software. +description: This documentation overviews you about the introduction of the Tirith software. keywords: - tirith - stack-guardian diff --git a/documentation/docs/tirith-policy-error-tolerance.md b/documentation/docs/tirith-policy-error-tolerance.md index 11520458..781e6299 100644 --- a/documentation/docs/tirith-policy-error-tolerance.md +++ b/documentation/docs/tirith-policy-error-tolerance.md @@ -2,7 +2,7 @@ id: tirith-policy-error-tolerance title: Error Tolerance sidebar_label: Error Tolerance -description: This documentation overviews you about the introduction of the tirith software. +description: This documentation overviews you about the introduction of the Tirith software. keywords: - tirith - stack-guardian diff --git a/documentation/docs/tirith-policy-examples.md b/documentation/docs/tirith-policy-examples.md index 31cc45a6..c710e206 100644 --- a/documentation/docs/tirith-policy-examples.md +++ b/documentation/docs/tirith-policy-examples.md @@ -2,7 +2,7 @@ id: tirith-policy-examples title: Example Policies sidebar_label: Example Policies -description: This documentation overviews you about the introduction of the tirith software. +description: This documentation overviews you about the introduction of the Tirith software. keywords: - tirith - stack-guardian diff --git a/documentation/docs/tirith-policy-structure.md b/documentation/docs/tirith-policy-structure.md index ae375abe..9df6b611 100644 --- a/documentation/docs/tirith-policy-structure.md +++ b/documentation/docs/tirith-policy-structure.md @@ -2,7 +2,7 @@ id: tirith-policy-structure title: Policy Structure sidebar_label: Policy Structure -description: This documentation overviews you about the introduction of the tirith software. +description: This documentation overviews you about the introduction of the Tirith software. keywords: - tirith - stack-guardian diff --git a/documentation/docs/tirith-policy-variables.md b/documentation/docs/tirith-policy-variables.md index 747f32bf..afb7db7e 100644 --- a/documentation/docs/tirith-policy-variables.md +++ b/documentation/docs/tirith-policy-variables.md @@ -2,7 +2,7 @@ id: tirith-policy-variables title: Policy Variables sidebar_label: Policy Variables -description: This documentation overviews you about the introduction of the tirith software. +description: This documentation overviews you about the introduction of the Tirith software. keywords: - tirith - stack-guardian diff --git a/src/tirith/providers/infracost/handler.py b/src/tirith/providers/infracost/handler.py index 956cc5f1..9ced0969 100644 --- a/src/tirith/providers/infracost/handler.py +++ b/src/tirith/providers/infracost/handler.py @@ -3,7 +3,7 @@ logger = logging.getLogger(__name__) -def __get_all_costs(operation_type, input_data): +def __get_all_costs(operation_type: str, input_data: dict) -> float: logger.debug(f"costType : {operation_type}") pointer = { "total_monthly_cost": ["totalMonthlyCost", "monthlyCost"], @@ -38,7 +38,7 @@ def __get_all_costs(operation_type, input_data): raise KeyError("projects not found in input_data") -def __get_resources_costs(resource_type, operation_type, input_data): +def __get_resources_costs(resource_type: str, operation_type: str, input_data: dict) -> float: logger.debug(f"costType : {operation_type}") pointer = {"total_monthly_cost": "totalMonthlyCost", "total_hourly_cost": "totalHourlyCost"} pointer = { @@ -77,7 +77,7 @@ def __get_resources_costs(resource_type, operation_type, input_data): raise KeyError("projects not found in input_data") -def provide(provider_args, input_data): +def provide(provider_args: dict, input_data: dict) -> List[Dict[str, Any]]: logger.debug("infracost provider") logger.debug(f"infracost provider inputs : {provider_args}") try: diff --git a/src/tirith/providers/json/handler.py b/src/tirith/providers/json/handler.py index ce4ced5b..1f6a25f0 100644 --- a/src/tirith/providers/json/handler.py +++ b/src/tirith/providers/json/handler.py @@ -1,6 +1,6 @@ import pydash -from typing import Callable, Dict, List +from typing import Callable, Dict, List, Any from ..common import create_result_dict, ProviderError, get_path_value_from_dict @@ -8,8 +8,8 @@ class PydashPathNotFound: pass -def _get_path_value_from_dict(splitted_paths, input_dict): - final_data = [] +def _get_path_value_from_dict(splitted_paths: List[str], input_dict: Dict[str, Any]) -> List[Any]: + final_data: List[Any] = [] for i, expression in enumerate(splitted_paths): intermediate_val = pydash.get(input_dict, expression, default=PydashPathNotFound) if isinstance(intermediate_val, list) and i < len(splitted_paths) - 1: @@ -28,7 +28,7 @@ def _get_path_value_from_dict(splitted_paths, input_dict): return final_data -def get_value(provider_args: Dict, input_data: Dict) -> List[dict]: +def get_value(provider_args: Dict[str, Any], input_data: Dict[str, Any]) -> List[Dict[str, Any]]: # Must be validated first whether the provider args are valid for this op type key_path: str = provider_args["key_path"] @@ -48,10 +48,11 @@ def get_value(provider_args: Dict, input_data: Dict) -> List[dict]: return outputs -SUPPORTED_OPS: Dict[str, Callable] = {"get_value": get_value} +SUPPORTED_OPS: Dict[str, Callable[[Dict[str, Any], Dict[str, Any]], List[Dict[str, Any]]]] -def provide(provider_args: Dict, input_data: Dict) -> List[Dict]: +def provide(provider_args: Dict[str, Any], input_data: Dict[str, Any]) -> List[Dict[str, Any]]: + operation_type = provider_args["operation_type"] op_handler = SUPPORTED_OPS.get(operation_type) diff --git a/src/tirith/providers/sg_workflow/handler.py b/src/tirith/providers/sg_workflow/handler.py index 29c1d9d0..2dc5b946 100644 --- a/src/tirith/providers/sg_workflow/handler.py +++ b/src/tirith/providers/sg_workflow/handler.py @@ -1,12 +1,13 @@ import logging +from typing import Any, Dict, List, Union logger = logging.getLogger(__name__) -def __getValue(key, data): +def __getValue(key: str, data: Dict[str, any]) -> Union[str, List[str]]: logger.debug(f"Searching {key} in input data") - result = "" + result: Union[str, List[str]] = "" if key == "integrationId": temp = [] if "DeploymentPlatformConfig" in data: @@ -70,7 +71,7 @@ def __getValue(key, data): return result -def provide(provider_args, input_data): +def provide(provider_args: Dict[str, Any], input_data: Dict[str, Any]) -> List[Dict[str, Any]]: logger.debug("sg_workflow provider") logger.debug(f"sg_workflow provider inputs : {provider_args}") try: