Package Exports
- wqcloud
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (wqcloud) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
WQCloud
比官方SDK更好用的腾讯云SDK。
已经疯狂得不能用代码行数来衡量该项目了,核心代码
src/index.js除仅有714(不含空格) 字节。
Minimum, Flexible, Scalable.
支持Lazy Require。
Table of Contents generated with DocToc
安装和使用
国际惯例:
npm install wqcloud --save公共参数:
var options = {
SecretId: '',
SecretKey: '',
// 不填,每次请求都会自动重新生成
// Signature: '',
Nonce: parseInt(Math.random() * 999999, 10),
Timestamp: parseInt(new Date() / 1000, 10)
};ES5:
var WQCLOUD = require('wqcloud');
var trade = WALIYUN.TRADE(options);
trade.DescribeUserInfo().then(function(instances){
// xxxx
});ES7:
import {TRADE} from 'wqcloud';
const trade = TRADE(options);
// Within Async Func
(async() => {
const userInfo = await trade.DescribeUserInfo();
// xxxx
})();已支持的接口
云服务器 CVM
API文档参考:https://www.qcloud.com/document/api/213/568
查询可用区示例:
const WQCLOUD = require('wqcloud');
const example = WQCLOUD.CVM({
SecretId: 'xxxx',
SecretKey: 'xxxx'
});
example.DescribeAvailabilityZones({
Region: 'gz'
}).then((data) => {
console.log(data);
});云硬盘 CBS
API文档参考:https://www.qcloud.com/document/api/362/2445
查询价格示例:
const example = WQCLOUD.CBS({
SecretId: 'xxxx',
SecretKey: 'xxxx'
});
example.InquiryStoragePrice({
inquiryType: 'create',
storageType: 'cloudBasic',
storageSize: 100,
goodsNum: 1,
period: 1,
payMode: 'prePay'
}).then((data) => {
console.log(data);
});黑石物理服务器 BM
API文档参考:https://www.qcloud.com/document/api/386/6628
查询可用区示例:
const example = WQCLOUD.BM({
SecretId: 'xxx',
SecretKey: 'xxx'
});
example.DescribeRegions().then((data) => {
console.log(data);
});弹性伸缩 SCALING
API文档参考:https://www.qcloud.com/document/api/377/3170
查询弹性伸缩组示例:
const example = WQCLOUD.SCALING({
SecretId: 'xxxx',
SecretKey: 'xxxx'
});
example.DescribeScalingGroup().then((data) => {
console.log(data);
});负载均衡 LB
API文档参考: https://www.qcloud.com/document/api/214/888
查询价格示例:
const example = WQCLOUD.LB({
SecretId: 'xxxx',
SecretKey: 'xxxx'
});
example.InquiryLBPrice({
loadBalancerType: 2
}).then((data) => {
console.log(data);
});私有网络 VPC
API文档参考: https://www.qcloud.com/document/api/215/908
查询私有网络列表示例:
const example = WQCLOUD.VPC({
SecretId: 'xxxx',
SecretKey: 'xxxx'
});
example.DescribeVpcEx().then((data) => {
console.log(data);
});内容分发网络
API文档参考: https://www.qcloud.com/document/api/228/1722
查询所有域名信息示例:
const example = WQCLOUD.CDN({
SecretId: 'xxxx',
SecretKey: 'xxxx'
});
example.DescribeCdnHosts().then((data) => {
console.log(data);
});数据库 CDB
API文档参考: https://www.qcloud.com/document/api/236/1209
数据库 TDSQL
API文档参考: https://www.qcloud.com/document/api/237/2246
数据库 SQLSERVER
API文档参考:https://www.qcloud.com/document/api/238/6430
弹性缓存 REDIS
API文档参考: https://www.qcloud.com/document/api/239/1748
弹性缓存 CMEM (Memcached)
API文档参考: https://www.qcloud.com/document/api/241/1762
网络安全 DAYU
API文档参考: https://www.qcloud.com/document/api/297/2314
天御业务安全防护 CSEC
API文档参考: https://www.qcloud.com/document/api/295/1773
云监控/自定义监控 MONITOR
API文档参考: https://www.qcloud.com/document/api/397/1785
云搜 YUNSOU
API文档参考: https://www.qcloud.com/document/api/270/1989
文智自然语言处理 WENZHI
API文档参考: https://www.qcloud.com/document/api/271/2049
账号相关 TRADE
API文档参考: https://www.qcloud.com/document/api/378/4367
获取账户余额示例:
import {TRADE} from 'wqcloud';
// const TRADE = require('wqcloud').TRADE;
const trade = TRADE({
SecretId: 'xxxxx',
SecretKey: 'xxxx'
});
// Within Async Func
(async() => {
const balance = await trade.describeAccountBalance();
console.log(balance);
})();地域相关 CVM
API文档参考: https://www.qcloud.com/document/api/558/7758
CHANGELOG
v2.0.2
2018-01-06
从 waliyun 阿里云SDK修改适配到 QCloud
v2.0.0
2016-09-06
- 使用元编程方式进行重构,减少重复代码和
Action限制; - 更新文档链接。
v1.0.0
2016-05-16 解决了签名偶发错误的问题。
License
MIT
通过支付宝捐赠:
