Skip to content

Commit

Permalink
Docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
kkedziak-splunk committed Jan 17, 2025
1 parent 3710458 commit 3eb1ce8
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,9 @@ def __add_user_defined_paths(
open_api_object: OpenAPIObject,
global_config: global_config_lib.GlobalConfig,
) -> OpenAPIObject:
"""
Adds user defined paths (globalConfig["options"]["restHandlers"]) to the OpenAPI object.
"""
if open_api_object.paths is None:
open_api_object.paths = {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ def _eai_response_schema(schema: Any) -> oas.MediaTypeObject:

@dataclass
class RestHandlerConfig:
"""
Represents a REST handler configuration. See schema.json.
"""

name: str
endpoint: str
handlerType: str
Expand Down Expand Up @@ -268,6 +272,10 @@ def oas_paths(self) -> Dict[str, oas.PathItemObject]:


class UserDefinedRestHandlers:
"""
Represents a logic for dealing with user-defined REST handlers
"""

def __init__(self) -> None:
self._definitions: List[RestHandlerConfig] = []
self._names: Set[str] = set()
Expand Down
1 change: 1 addition & 0 deletions splunk_add_on_ucc_framework/global_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ def __init__(self, global_config_path: str) -> None:
self.user_defined_handlers = UserDefinedRestHandlers()

def parse_user_defined_handlers(self) -> None:
"""Parse user-defined REST handlers from globalConfig["options"]["restHandlers"]"""
rest_handlers = self._content.get("options", {}).get("restHandlers", [])
self.user_defined_handlers.add_definitions(rest_handlers)

Expand Down

0 comments on commit 3eb1ce8

Please sign in to comment.