Security News
38% of CISOs Fear They’re Not Moving Fast Enough on AI
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
比官方SDK更好用的阿里云SDK。
Minimum, Flexible, Scalable.
支持Lazy Require。
Table of Contents generated with DocToc
国际惯例:
npm install waliyun --save
公共参数:
var options = {
AccessKeyId: 'xxxx-xxxx-xxxx-xxxx',
AccessKeySecret: 'xxxx-xxxx-xxxx-xxxx',
// 选填,不同接口类型注意版本日期,2.0.0之后版本会带上默认版本,但可能会落后于最新,需要注意
Version: '2014-05-26',
// 选填
SignatureMethod: 'HMAC-SHA1',
Format: 'json',
SignatureVersion: '1.0',
// 不填,每次请求都会自动重新生成
SignatureNonce: Math.random(),
Timestamp: new Date().toISOString()
};
ES5:
var WALIYUN = require('waliyun');
var ecs = WALIYUN.ECS(options);
ecs.describeInstances({
RegionId: 'cn-hangzhou'
}).then(function(instances){
// xxxx
});
ES7:
import {ECS} from 'waliyun';
const ecs = ECS(options);
// Within Async Func
(async() => {
const instances = await ecs.describeInstances({
RegionId: 'cn-hangzhou'
});
// xxxx
});
ES7:
import {ECS} from 'waliyun';
const ecs = ECS(options);
console.log(ecs.version());
API文档参考: https://help.aliyun.com/document_detail/27155.html
API文档参考: https://help.aliyun.com/document_detail/30074.html
API文档参考: https://help.aliyun.com/document_detail/29435.html
发送示例:
const { DM } = require('waliyun');
const dm = DM({
AccessKeyId: 'xxxx',
AccessKeySecret: 'xxxxx'
});
dm.singleSendMail({
AccountName: 'no-reply@xxx.com',
ReplyToAddress: false,
AddressType: 1,
ToAddress: 'xxx@qq.com',
FromAlias: '用户名',
Subject: '注册邮件',
HtmlBody: '<p>您的注册验证码为:1234</p>'
}).then(data => {
console.log(data);
}).catch(err => {
console.log(err);
});
阿里云已停止开通原短信服务(整合在消息服务内)。新开通阿里云短信服务的用户,请参考下方的
新短信服务
调用示例
发送示例:
const { SMS } = require('waliyun');
const sms = SMS({
AccessKeyId: 'xxxx',
AccessKeySecret: 'xxxx'
});
sms.singleSendSMS({
ParamString: '{"customer":"1234"}',
RecNum: '13812341234',
SignName: '您的签名',
TemplateCode: 'SMS_77778888'
}).then(data => {
console.log(data);
});
API文档参考: https://help.aliyun.com/document_detail/56189.html
发送示例:
const { DYSMS } = require('waliyun');
const sms = DYSMS({
AccessKeyId: 'xxxx',
AccessKeySecret: 'xxxx'
});
sms.sendSms({
TemplateParam: JSON.stringify({customer: '1234'}),
PhoneNumbers: mobileNo,
SignName: '您的签名',
TemplateCode: 'SMS_77778888'
})
API文档参考: https://help.aliyun.com/document_detail/35276.html
API文档参考: https://help.aliyun.com/document_detail/25485.html
ES7 示例:
import {ECS} from 'waliyun';
(async() => {
const ces = ECS({
AccessKeyId: 'xxxx',
AccessKeySecret: 'xxxx',
Version: '2014-05-26'
});
const data = await ces.describeInstances({
RegionId: 'cn-hangzhou'
});
console.log(data.Instances.Instance);
})();
API文档参考: https://help.aliyun.com/document_detail/56190.html
API文档参考: https://help.aliyun.com/document_detail/25925.html
API文档参考: https://help.aliyun.com/document_detail/29739.html
API文档参考: https://help.aliyun.com/document_detail/30122.html
API文档参考: https://help.aliyun.com/document_detail/30557.html
ES7 示例:
import {IOT} from 'waliyun';
(async() => {
const iot = IOT({
Api:'https://iot.cn-shanghai.aliyuncs.com/',//可不填,默认为https://iot.aliyuncs.com/
AccessKeyId: 'xxxx',
AccessKeySecret: 'xxxxx',
Version: '2016-05-30'
});
const data = await iot.sub({
ProductKey: 'xxxx',
SubCallback: 'http://xxxx:xxx/',
'Topic.1': '/ProductKey/Topic'
});
console.log(data);
})();
API文档参考: https://help.aliyun.com/document_detail/28616.html
ES7 示例:
import {METRICS} from 'waliyun';
(async() => {
const metrics = METRICS({
AccessKeyId: 'xxxxxx',
AccessKeySecret: 'xxxxxx',
Version: '2015-10-20',
RegionId: 'cn-hangzhou'
});
const data = await metrics.queryMetric({
Project: 'acs_rds',
Metric: 'CpuUsage',
Period: '300',
StartTime: new Date() - 60 * 1000 * 1000,
Dimensions: '{instanceId:\'xxxxxx\'}'
});
console.log(data.Datapoints);
})();
API文档参考: https://help.aliyun.com/document_detail/29212.html
API文档参考: https://help.aliyun.com/document_detail/28672.html
API文档参考: https://help.aliyun.com/document_detail/26226.html
API文档参考: https://help.aliyun.com/document_detail/27566.html
API文档参考: https://help.aliyun.com/document_detail/28756.html
ES5示例:
var WALIYUN = require('waliyun');
var sts = WALIYUN.STS({
AccessKeyId: 'xxxx',
AccessKeySecret: 'xxxx',
Version: '2015-04-01'
});
sts.AssumeRole({
RoleArn: 'acs:ram::xxxx:role/xxxx',
RoleSessionName: 'xxxxx'
},'post').then(function(token){
// xxxx
});
ES7 示例:
import {STS} from 'waliyun';
const sts = STS({
AccessKeyId: 'xxxx',
AccessKeySecret: 'xxxx',
Version: '2015-04-01'
});
(async() => {
const token = await sts.AssumeRole({
RoleArn: 'acs:ram::xxxx:role/xxxx',
RoleSessionName: 'xxxxx'
},'post');
// xxxx
})();
API文档参考: https://help.aliyun.com/document_detail/26043.html
注意,容器服务版本号停留在:2015-12-15。新版改动较为奇葩,暂不支持。
旧版本方法列表:
[
'GetClusterList',
'CreateCluster',
'DeleteCluster',
'GetClusterById',
'GetClusterCerts',
'UpdateClusterSizeById',
'ListProjects',
'CreateProject',
'RetrieveProject',
'StartProject',
'StopProject',
'UpdateProject',
'DeleteProject'
]
2016-09-06
Action
限制;2016-05-16 解决了签名偶发错误的问题。
MIT
通过支付宝捐赠:
FAQs
ALL Aliyun APIs
The npm package waliyun receives a total of 18 weekly downloads. As such, waliyun popularity was classified as not popular.
We found that waliyun demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.
Security News
Company News
Socket is joining TC54 to help develop standards for software supply chain security, contributing to the evolution of SBOMs, CycloneDX, and Package URL specifications.