A simple Lua wrapper for ceph with swift based on OpenResty.
More:
- new
- get_all_buckets
- create_bucket
- del_bucket
- get_all_buckets
- get_all_objs
- get_buckets_location
- get_buckets_acl
- create_obj
- get_obj
- del_obj
- check_for_existance
- get_obj_acl
- set_obj_acl
function swiftrun()
bucket = ngx.var.arg_b
file = ngx.var.arg_f
content = ngx.var.arg_c
del = ngx.var.arg_d
local cephswift = require("resty.cephswift")
app = cephswift:new(config.swift_user, config.swift_secret_key, config.auth_uri)
-- app:create_bucket(bucket)
-- app:get_all_objs(bucket)
if content then
local url = app:create_obj(bucket, file, content)
ngx.say(url)
end
if file then
local data = app:get_obj(bucket, file)
ngx.say(data)
-- app:del_obj(bucket, file)
end
if del == "y" then
local res = app:del_bucket(bucket)
end
end
local app = cephs3:new(access_key, secret_key, auth_uri)
app:get_all_buckets()
app:create_bucket(bucket)
app:del_bucket(bucket)
app:get_all_objs(bucket)
app:set_bucket_acl(bucket)
app:create_obj(bucket, file, content)
app:get_obj(bucket, file)
app:del_obj(bucket, file)
- Upload operations.
Linsir: https://github.com/linsir
BSD license.
All rights reserved.