lua-resty-s3
一个用于 ngx_lua 的 aws s3 客户端
$ opm get billythedummy/lua-resty-s3
名称
amazon s3 客户端 for ngx_lua.
实现了 Amazon 签名 V4: http://docs.aws.amazon.com/zh_cn/AmazonS3/latest/API/sig-v4-authenticating-requests.html.
用法
要加载此库
您需要在 ngx_lua 的 lua_package_path 指令中指定此库的路径。例如
http {
lua_package_path '/path/to/lua-resty-s3/lib/?.lua;;';
}
您使用 require 将库加载到一个本地 Lua 变量中
local stats = require("resty.s3")
方法
-- require package
local awss3 = require "resty.s3"
-- init instance.
local s3 = awss3:new(AWSAccessKeyId, AWSSecretAccessKey, aws_bucket, {timeout=1000*10})
-- get a object. http://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectGET.html
local ok, response = s3:get(key)
-- get a object. http://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectHEAD.html
local ok, response = s3:head(key)
-- put a object. http://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectPUT.html
local ok, response = s3:put(key, value, headers)
-- delete a object. http://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectDELETE.html
local ok, response = s3:delete(key)
-- delete multi objects. http://docs.aws.amazon.com/AmazonS3/latest/API/multiobjectdeleteapi.html
local ok, response = s3:deletes(keys, quiet)
-- list files. http://docs.aws.amazon.com/AmazonS3/latest/API/v2-RESTBucketGET.html
local ok, files = s3:list(prefix, delimiter, page_size, marker)
-- -- signature-v4. http://docs.aws.amazon.com/AmazonS3/latest/API/sig-v4-authenticating-requests.html
local authorization, signature, extinfo = s3:authorization_v4(method, url, headers)
依赖
"jkeys089/lua-resty-hmac "= 0.01|https://github.com/jkeys089/lua-resty-hmac>
测试依赖
"iresty/lua-resty-test "= 0.01|https://github.com/iresty/lua-resty-test>
s3 相关:
测试集:http://docs.aws.amazon.com/zh_cn/general/latest/gr/signature-v4-test-suite.html
s3 rest api: http://docs.aws.amazon.com/AmazonS3/latest/API/multiobjectdeleteapi.html
许可证
此模块根据 2-clause BSD 许可证授权。
版权所有 (c) 2017, Xiaojie Liu <jie123108@163.com>
保留所有权利。
允许以源代码和二进制形式重新分发和使用,无论是否修改,只要满足以下条件:
源代码的重新分发必须保留以上版权声明、此条件列表以及以下免责声明。
二进制形式的重新分发必须在随分发提供的文档和/或其他材料中复制以上版权声明、此条件列表以及以下免责声明。
此软件由版权持有人和贡献者“按现状”提供,并且任何明示或暗示的担保,包括但不限于适销性和特定用途适用性的暗示担保均被免除。在任何情况下,版权持有人或贡献者均不对任何直接、间接、偶然、特殊、示例性或后果性损害(包括但不限于替代商品或服务的采购;使用、数据或利润损失;或业务中断)负责,无论其因何种原因或责任理论引起,无论是合同、严格责任还是侵权行为(包括疏忽或其他原因)而产生的,即使已被告知可能发生此类损害。
POD 错误
您好!以上文档存在一些编码错误,解释如下:
- 大约在第 72 行
-
L<> 以空格开头或结尾
- 大约在第 86 行
-
L<> 以空格开头或结尾
作者
jie123108@163.com
许可证
2bsd
依赖
billythedummy/SLAXML >= 0.8, jkeys089/lua-resty-hmac >= 0.01, ledgetech/lua-resty-http >= 0.01, openresty >= 1.9.3.1
版本
-
一个用于 ngx_lua 的 aws s3 客户端 2020-05-19 08:15:28