1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
|
from typing import Any
from moto.core.common_types import TYPE_RESPONSE
from moto.core.responses import BaseResponse
from ... import recorder
class RecorderResponse(BaseResponse):
def reset_recording(
self,
req: Any,
url: str,
headers: Any,
) -> TYPE_RESPONSE:
recorder.reset_recording()
return 200, {}, ""
def start_recording(
self,
req: Any,
url: str,
headers: Any,
) -> TYPE_RESPONSE:
recorder.start_recording()
return 200, {}, "Recording is set to True"
def stop_recording(
self,
req: Any,
url: str,
headers: Any,
) -> TYPE_RESPONSE:
recorder.stop_recording()
return 200, {}, "Recording is set to False"
def upload_recording(
self,
req: Any,
url: str,
headers: Any,
) -> TYPE_RESPONSE:
data = req.data
recorder.upload_recording(data)
return 200, {}, ""
def download_recording(
self,
req: Any,
url: str,
headers: Any,
) -> TYPE_RESPONSE:
data = recorder.download_recording()
return 200, {}, data
# NOTE: Replaying assumes, for simplicity, that it is the only action
# running against moto at the time. No recording happens while replaying.
def replay_recording(
self,
req: Any,
url: str,
headers: Any,
) -> TYPE_RESPONSE:
recorder.replay_recording(target_host=url)
return 200, {}, ""
|