* Add delete container and list tags endpoints to MediaStore * Black reformat * Fixed Lint problems * Check if dictionary was deleted effectively * lint fix * MediaPackageClientError * Lint Fix * Test unknown channel describe * Concatenation Fix * MediaPackage - fix error message * MediaPackage ClientError part2 * Mediastoredata not working Base url tests and renaming typo List Items not returning proper JSON and wrongly hitting get_object response MediaStore2 Tests * More implementation * Fix tests and format * Comments fix * Comments 2 * MediastoreData - alternative logic to figure out appropriate host Co-authored-by: av <arcovoltaico@gmail.com> Co-authored-by: Bert Blommers <info@bertblommers.nl>
44 lines
1.4 KiB
Python
44 lines
1.4 KiB
Python
from __future__ import unicode_literals
|
|
|
|
import json
|
|
|
|
from moto.core.responses import BaseResponse
|
|
from .models import mediastoredata_backends
|
|
|
|
|
|
class MediaStoreDataResponse(BaseResponse):
|
|
SERVICE_NAME = "mediastore-data"
|
|
|
|
@property
|
|
def mediastoredata_backend(self):
|
|
return mediastoredata_backends[self.region]
|
|
|
|
def get_object(self):
|
|
path = self._get_param("Path")
|
|
range = self._get_param("Range")
|
|
result = self.mediastoredata_backend.get_object(path=path, range=range)
|
|
headers = {"Path": result.path}
|
|
return result.body, headers
|
|
|
|
def put_object(self):
|
|
body = self.body
|
|
path = self._get_param("Path")
|
|
new_object = self.mediastoredata_backend.put_object(body, path)
|
|
object_dict = new_object.to_dict()
|
|
return json.dumps(object_dict)
|
|
|
|
def delete_object(self):
|
|
item_id = self._get_param("Path")
|
|
result = self.mediastoredata_backend.delete_object(path=item_id)
|
|
return json.dumps(result)
|
|
|
|
def list_items(self):
|
|
path = self._get_param("Path")
|
|
max_results = self._get_param("MaxResults")
|
|
next_token = self._get_param("NextToken")
|
|
items = self.mediastoredata_backend.list_items(
|
|
path=path, max_results=max_results, next_token=next_token
|
|
)
|
|
response_items = json.dumps(dict(Items=items))
|
|
return response_items
|