Object handler¶
Handler for work with a object
- class luna_image_store.app.handlers.object_handler.ObjectHandler(request)[source]¶
Handler for work with object(text/json/zip/pdf).
Resource: “{api_version}/buckets/{bucketName}/objects/{objectId}”
- async delete(bucketName, objectId)[source]¶
Delete object from bucket. See spec_delete_object.
- Parameters
bucketName (
str
) – bucket nameobjectId (
str
) – object id
- Return type
HTTPResponse
- Returns
response with status code 204
- async get(bucketName, objectId)[source]¶
Get object from bucket. See spec_get_object.
- Parameters
bucketName (
str
) – bucket nameobjectId (
str
) – object id
- Return type
HTTPResponse
- Returns
response with object in body, if status code 200, Error.BadContentType with status code 400, if bad content type, Error.NotAcceptable with status code 406, if content-type not acceptable.
- async head(bucketName, objectId)[source]¶
Check object exists in bucket. See spec_head_object.
- Parameters
bucketName (
str
) – bucket nameobjectId (
str
) – object id
- Return type
HTTPResponse
- Returns
response with status code 200, if object exist, Error.BadContentType with status code 400, if bad content type, Error.NotAcceptable with status code 406, if content-type not acceptable.
- async put(bucketName, objectId)[source]¶
Put object to bucket. See spec_put_object.
- Parameters
bucketName (
str
) – bucket nameobjectId (
str
) – object id
- Return type
HTTPResponse
- Returns
response with object id and location, if status code 200, Error.NotContainsData with status code 400, if request does not contain data, Error.SpecifiedTypeNotMatchDataType with status code 400, if content type does not match data type, Error.UnsupportedMediaType with status code 415, if unsupported media type.