Update README.md
This commit is contained in:
parent
9e821cc3cc
commit
c6ae46f33c
12
README.md
12
README.md
|
@ -2,7 +2,7 @@
|
|||
|
||||
## 介绍
|
||||
|
||||
这是一个非官方的阿里云 OpenAPI Shell SDK,为了方便 Shell 脚本调用阿里云 OpenAPI,SDK 主要实现了自动计算请求签名。
|
||||
这是一个非官方的阿里云 OpenAPI Shell SDK,方便 Shell 脚本调用阿里云 OpenAPI,SDK 主要实现了自动计算请求签名。
|
||||
|
||||
虽然阿里云官方有 [AliyunCLI](https://github.com/aliyun/aliyun-cli),可以在 Shell 环境下使用阿里云 OpenAPI,不过某些 API (比如 SSL 证书) 它并不支持,或者说还没来得及支持,所以我就想写一个可能是最好用的阿里云 Shell SDK。
|
||||
|
||||
|
@ -15,9 +15,9 @@
|
|||
|
||||
## 使用
|
||||
|
||||
1. 导出 `AliAccessKeyId` 和 `AliAccessKeySecret` 环境变量
|
||||
1. 导出环境变量 `AliAccessKeyId` 和 `AliAccessKeySecret`
|
||||
2. 导入 `AliyunOpenApiSDK.sh`
|
||||
3. 调用 `aliapi_rpi` 函数
|
||||
3. 调用 `aliapi_rpc` 函数
|
||||
|
||||
函数签名:`aliapi_rpc(host, http_method, api_version, api_action, api_custom_key[], api_custom_value[]): JsonResult | ErrorCode`
|
||||
|
||||
|
@ -51,8 +51,8 @@ api_custom_value=(
|
|||
)
|
||||
# 获取 SSL 证书列表:https://help.aliyun.com/document_detail/126511.html
|
||||
aliapi_rpc "cas.aliyuncs.com" "GET" "2018-07-13" "DescribeUserCertificateList" "${api_custom_key[*]}" "${api_custom_value[*]}"
|
||||
# 可以通过 $? 是否等于 0 判断是否执行成功(HTTP CODE == 200)
|
||||
# 执行成功返回 JSON 格式的结果,执行失败返回 HTTP CODE 或 curl 的退出代码。
|
||||
# $? (返回代码) 等于 0 (HTTP 状态码 == 200) 代表执行成功
|
||||
# 执行成功返回 JSON 数据,执行失败返回 HTTP 状态码或 curl 的错误代码。
|
||||
if [[ $? -eq 0 ]]; then
|
||||
# 执行成功
|
||||
else
|
||||
|
@ -65,4 +65,4 @@ fi
|
|||
|
||||
如果你有好的示例,欢迎提交 [PR](https://github.com/Hill-98/aliyun-openapi-shell-sdk/pulls)
|
||||
|
||||
如果你有问题 / BUG 要反馈,也欢迎提交 [Issue](https://github.com/Hill-98/aliyun-openapi-shell-sdk/issues)
|
||||
如果你有建议 / BUG 要反馈,也欢迎提交 [Issue](https://github.com/Hill-98/aliyun-openapi-shell-sdk/issues)
|
||||
|
|
Loading…
Reference in New Issue