You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

48 lines
1.5 KiB

import os
import sys
from typing import Optional
current_path = os.path.dirname(os.path.realpath(__file__))
app_specific_lib_path = os.path.join(current_path, "..", "lib")
sys.path.insert(0, app_specific_lib_path)
import logging
from splunkupgrade.utils.logger_utils import (
initialize_logger_for_rest_endpoints,
)
initialize_logger_for_rest_endpoints()
from splunkupgrade.processors.shc.shc_upgrade_rest_processor import ShcUpgradeRestProcessor
from splunkupgrade.utils.types import JsonObject
from splunk.persistconn.application import PersistentServerConnectionApplication
logger = logging.getLogger(__name__)
class UpgradeShcRestEndpoint(PersistentServerConnectionApplication):
def __init__(
self,
_command_line: Optional[str] = None,
_command_arg: Optional[str] = None,
):
super(PersistentServerConnectionApplication, self).__init__()
# Handle a syncronous from splunkd.
def handle(self, in_string: bytes) -> JsonObject:
"""
Called for a simple synchronous request.
@param in_string: request data passed in
@rtype: string or dict
@return: String to return in response. If a dict was passed in,
it will automatically be JSON encoded before being returned.
"""
return ShcUpgradeRestProcessor().handle(in_string)
def done(self):
"""
Virtual method which can be optionally overridden to receive a
callback after the request completes.
"""
pass

Powered by BW's shoe-string budget.