Skip to content

Latest commit

 

History

History
113 lines (71 loc) · 1.84 KB

README_swift.md

File metadata and controls

113 lines (71 loc) · 1.84 KB

lua-resty-ceph

A simple Lua wrapper for ceph with swift based on OpenResty.

More:

  1. http://docs.ceph.org.cn/radosgw/s3/
  2. http://docs.ceph.org.cn/radosgw/swift/

API

Synopsis

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

Usage

new

local app = cephs3:new(access_key, secret_key, auth_uri)

get_all_buckets

app:get_all_buckets()

create_bucket

app:create_bucket(bucket)

del_bucket

app:del_bucket(bucket)

get_all_objs

app:get_all_objs(bucket)

set_bucket_acl

app:set_bucket_acl(bucket)

create_obj

app:create_obj(bucket, file, content)

get_obj

app:get_obj(bucket, file)

del_obj

app:del_obj(bucket, file)

TODO

  • Upload operations.

Author

Linsir: https://github.com/linsir

Licence

BSD license.

All rights reserved.