@certd/jdcloud 1.34.0 → 1.34.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/dist/bundle.js +27 -30
- package/dist/index.d.ts +5 -0
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -0
- package/package.json +4 -3
- package/test/callStyle.spec.js +0 -28
- package/test/config.spec.js +0 -85
- package/test/services/monitor.spec.js +0 -122
- package/test/services/nc.spec.js +0 -33
- package/test/services/oss.spec.js +0 -61
- package/test/services/vm.spec.js +0 -70
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,10 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [1.34.1](https://github.com/certd/certd/compare/v1.34.0...v1.34.1) (2025-05-05)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @certd/jdcloud
|
|
9
|
+
|
|
6
10
|
# [1.34.0](https://github.com/certd/certd/compare/v1.33.8...v1.34.0) (2025-04-28)
|
|
7
11
|
|
|
8
12
|
**Note:** Version bump only for package @certd/jdcloud
|
package/dist/bundle.js
CHANGED
|
@@ -10,17 +10,16 @@ var require$$0$1 = require('crypto');
|
|
|
10
10
|
var require$$2 = require('buffer');
|
|
11
11
|
var require$$4 = require('querystring');
|
|
12
12
|
|
|
13
|
-
function getDefaultExportFromCjs (x) {
|
|
14
|
-
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
13
|
function getAugmentedNamespace(n) {
|
|
18
14
|
if (n.__esModule) return n;
|
|
19
15
|
var f = n.default;
|
|
20
16
|
if (typeof f == "function") {
|
|
21
17
|
var a = function a () {
|
|
22
18
|
if (this instanceof a) {
|
|
23
|
-
|
|
19
|
+
var args = [null];
|
|
20
|
+
args.push.apply(args, arguments);
|
|
21
|
+
var Ctor = Function.bind.apply(f, args);
|
|
22
|
+
return new Ctor();
|
|
24
23
|
}
|
|
25
24
|
return f.apply(this, arguments);
|
|
26
25
|
};
|
|
@@ -41,7 +40,11 @@ function getAugmentedNamespace(n) {
|
|
|
41
40
|
|
|
42
41
|
var publicApi = {};
|
|
43
42
|
|
|
44
|
-
var
|
|
43
|
+
var URLExports = {};
|
|
44
|
+
var URL$2 = {
|
|
45
|
+
get exports(){ return URLExports; },
|
|
46
|
+
set exports(v){ URLExports = v; },
|
|
47
|
+
};
|
|
45
48
|
|
|
46
49
|
var conversions = {};
|
|
47
50
|
var lib$1 = conversions;
|
|
@@ -231,7 +234,11 @@ conversions["RegExp"] = function (V, opts) {
|
|
|
231
234
|
return V;
|
|
232
235
|
};
|
|
233
236
|
|
|
234
|
-
var
|
|
237
|
+
var utilsExports = {};
|
|
238
|
+
var utils = {
|
|
239
|
+
get exports(){ return utilsExports; },
|
|
240
|
+
set exports(v){ utilsExports = v; },
|
|
241
|
+
};
|
|
235
242
|
|
|
236
243
|
(function (module) {
|
|
237
244
|
|
|
@@ -251,14 +258,16 @@ var utils = {exports: {}};
|
|
|
251
258
|
|
|
252
259
|
module.exports.implForWrapper = function (wrapper) {
|
|
253
260
|
return wrapper[module.exports.implSymbol];
|
|
254
|
-
};
|
|
261
|
+
};
|
|
255
262
|
} (utils));
|
|
256
263
|
|
|
257
|
-
var utilsExports = utils.exports;
|
|
258
|
-
|
|
259
264
|
var URLImpl = {};
|
|
260
265
|
|
|
261
|
-
var
|
|
266
|
+
var urlStateMachineExports = {};
|
|
267
|
+
var urlStateMachine = {
|
|
268
|
+
get exports(){ return urlStateMachineExports; },
|
|
269
|
+
set exports(v){ urlStateMachineExports = v; },
|
|
270
|
+
};
|
|
262
271
|
|
|
263
272
|
var tr46 = {};
|
|
264
273
|
|
|
@@ -79400,11 +79409,9 @@ tr46.PROCESSING_OPTIONS = PROCESSING_OPTIONS;
|
|
|
79400
79409
|
|
|
79401
79410
|
// We don't handle blobs, so this just delegates:
|
|
79402
79411
|
return module.exports.basicURLParse(input, { baseURL: options.baseURL, encodingOverride: options.encodingOverride });
|
|
79403
|
-
};
|
|
79412
|
+
};
|
|
79404
79413
|
} (urlStateMachine));
|
|
79405
79414
|
|
|
79406
|
-
var urlStateMachineExports = urlStateMachine.exports;
|
|
79407
|
-
|
|
79408
79415
|
const usm = urlStateMachineExports;
|
|
79409
79416
|
|
|
79410
79417
|
URLImpl.implementation = class URLImpl {
|
|
@@ -79799,11 +79806,9 @@ URLImpl.implementation = class URLImpl {
|
|
|
79799
79806
|
Window: { URL: URL },
|
|
79800
79807
|
Worker: { URL: URL }
|
|
79801
79808
|
}
|
|
79802
|
-
};
|
|
79809
|
+
};
|
|
79803
79810
|
} (URL$2));
|
|
79804
79811
|
|
|
79805
|
-
var URLExports = URL$2.exports;
|
|
79806
|
-
|
|
79807
79812
|
publicApi.URL = URLExports.interface;
|
|
79808
79813
|
publicApi.serializeURL = urlStateMachineExports.serializeURL;
|
|
79809
79814
|
publicApi.serializeURLOrigin = urlStateMachineExports.serializeURLOrigin;
|
|
@@ -83063,10 +83068,8 @@ function requireCore () {
|
|
|
83063
83068
|
}
|
|
83064
83069
|
|
|
83065
83070
|
var coreExports = requireCore();
|
|
83066
|
-
var jdCloud = /*@__PURE__*/getDefaultExportFromCjs(coreExports);
|
|
83067
83071
|
|
|
83068
83072
|
var serviceExports = requireService();
|
|
83069
|
-
var jdService = /*@__PURE__*/getDefaultExportFromCjs(serviceExports);
|
|
83070
83073
|
|
|
83071
83074
|
var JDCloud$5 = requireCore();
|
|
83072
83075
|
|
|
@@ -86723,8 +86726,6 @@ JDCloud$3.DOMAINSERVICE = class DOMAINSERVICE extends Service$2 {
|
|
|
86723
86726
|
};
|
|
86724
86727
|
var domainservice = JDCloud$3.DOMAINSERVICE;
|
|
86725
86728
|
|
|
86726
|
-
var domainService = /*@__PURE__*/getDefaultExportFromCjs(domainservice);
|
|
86727
|
-
|
|
86728
86729
|
/*
|
|
86729
86730
|
* Copyright 2018 JDCLOUD.COM
|
|
86730
86731
|
*
|
|
@@ -109339,8 +109340,6 @@ class CDN extends Service$1 {
|
|
|
109339
109340
|
}
|
|
109340
109341
|
var cdn = CDN;
|
|
109341
109342
|
|
|
109342
|
-
var cdnService = /*@__PURE__*/getDefaultExportFromCjs(cdn);
|
|
109343
|
-
|
|
109344
109343
|
/*
|
|
109345
109344
|
* Copyright 2018 JDCLOUD.COM
|
|
109346
109345
|
*
|
|
@@ -110169,13 +110168,11 @@ JDCloud$1.SSL = class SSL extends Service {
|
|
|
110169
110168
|
};
|
|
110170
110169
|
var ssl = JDCloud$1.SSL;
|
|
110171
110170
|
|
|
110172
|
-
|
|
110173
|
-
|
|
110174
|
-
const
|
|
110175
|
-
const
|
|
110176
|
-
const
|
|
110177
|
-
const JDCdnService = cdnService;
|
|
110178
|
-
const JDSslService = sslService;
|
|
110171
|
+
const JDCloud = coreExports;
|
|
110172
|
+
const JDService = serviceExports;
|
|
110173
|
+
const JDDomainService = domainservice;
|
|
110174
|
+
const JDCdnService = cdn;
|
|
110175
|
+
const JDSslService = ssl;
|
|
110179
110176
|
|
|
110180
110177
|
exports.JDCdnService = JDCdnService;
|
|
110181
110178
|
exports.JDCloud = JDCloud;
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import jdCloud from "./lib/core.js";
|
|
2
|
+
import jdService from './lib/service.js';
|
|
3
|
+
import domainService from './repo/domainservice/v2/domainservice.js';
|
|
4
|
+
import cdnService from './repo/cdn/v1/cdn.js';
|
|
5
|
+
import sslService from './repo/ssl/v1/ssl.js';
|
|
6
|
+
export const JDCloud = jdCloud;
|
|
7
|
+
export const JDService = jdService;
|
|
8
|
+
export const JDDomainService = domainService;
|
|
9
|
+
export const JDCdnService = cdnService;
|
|
10
|
+
export const JDSslService = sslService;
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAO,eAAe,CAAC;AACrC,OAAO,SAAS,MAAM,kBAAkB,CAAA;AAExC,OAAO,aAAa,MAAM,0CAA0C,CAAA;AACpE,OAAO,UAAU,MAAM,sBAAsB,CAAA;AAC7C,OAAO,UAAU,MAAM,sBAAsB,CAAA;AAC7C,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC;AAC/B,MAAM,CAAC,MAAM,SAAS,GAAG,SAAS,CAAC;AACnC,MAAM,CAAC,MAAM,eAAe,GAAG,aAAa,CAAC;AAC7C,MAAM,CAAC,MAAM,YAAY,GAAG,UAAU,CAAC;AACvC,MAAM,CAAC,MAAM,YAAY,GAAG,UAAU,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@certd/jdcloud",
|
|
3
|
-
"version": "1.34.
|
|
3
|
+
"version": "1.34.1",
|
|
4
4
|
"description": "jdcloud openApi sdk",
|
|
5
5
|
"main": "./dist/bundle.js",
|
|
6
6
|
"module": "./dist/bundle.js",
|
|
@@ -9,7 +9,8 @@
|
|
|
9
9
|
"test": "cross-env NODE_CONFIG_DIR=./test/config mocha --recursive --require babel-register",
|
|
10
10
|
"dev": "babel src --out-dir babel -w",
|
|
11
11
|
"build": "rollup -c ",
|
|
12
|
-
"dev-build": "npm run build"
|
|
12
|
+
"dev-build": "npm run build",
|
|
13
|
+
"pub": "npm publish"
|
|
13
14
|
},
|
|
14
15
|
"author": "",
|
|
15
16
|
"license": "Apache",
|
|
@@ -60,5 +61,5 @@
|
|
|
60
61
|
"fetch"
|
|
61
62
|
]
|
|
62
63
|
},
|
|
63
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "6c74148c277432f91014bf1eebd824e7423c6f4b"
|
|
64
65
|
}
|
package/test/callStyle.spec.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
var NC = require('../src/services/nc')
|
|
2
|
-
var config = require('config')
|
|
3
|
-
var global = config.get('global')
|
|
4
|
-
var expec = require('chai').expect
|
|
5
|
-
describe('JDCloud.CallStyle', function () {
|
|
6
|
-
var nc = new NC({
|
|
7
|
-
credentials: {
|
|
8
|
-
accessKeyId: global.accessKeyId,
|
|
9
|
-
secretAccessKey: global.secretAccessKey
|
|
10
|
-
}
|
|
11
|
-
})
|
|
12
|
-
it('use Promise style', function () {
|
|
13
|
-
return nc.describeContainers(
|
|
14
|
-
{
|
|
15
|
-
},
|
|
16
|
-
'cn-north-1'
|
|
17
|
-
)
|
|
18
|
-
})
|
|
19
|
-
it('use callback style', function (done) {
|
|
20
|
-
nc.describeContainers({}, 'cn-north-1', function (err, data) {
|
|
21
|
-
if (err) {
|
|
22
|
-
done(err)
|
|
23
|
-
} else {
|
|
24
|
-
done()
|
|
25
|
-
}
|
|
26
|
-
})
|
|
27
|
-
})
|
|
28
|
-
})
|
package/test/config.spec.js
DELETED
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
var JDCloud = require('../src/lib/jc')
|
|
2
|
-
var config = require('config')
|
|
3
|
-
var global = config.get('global')
|
|
4
|
-
var expect = require('chai').expect
|
|
5
|
-
|
|
6
|
-
describe('JDCloud.Config', function () {
|
|
7
|
-
describe('constructor', function () {
|
|
8
|
-
it('should be able to bass in a Config object as parameter', function () {
|
|
9
|
-
var config = new JDCloud.Config({
|
|
10
|
-
apiVersions: '1',
|
|
11
|
-
vm: {
|
|
12
|
-
apiVersions: '2'
|
|
13
|
-
}
|
|
14
|
-
})
|
|
15
|
-
var copyConfig = new JDCloud.Config(config)
|
|
16
|
-
expect(copyConfig).not.to.equal(config)
|
|
17
|
-
expect(config.apiVersions).to.equal('1')
|
|
18
|
-
expect(copyConfig.apiVersions).to.equal('1')
|
|
19
|
-
})
|
|
20
|
-
it('should be able to pass credential values directly', function () {
|
|
21
|
-
var config = new JDCloud.Config({
|
|
22
|
-
accessKeyId: 'akid',
|
|
23
|
-
secretAccessKey: 'secret'
|
|
24
|
-
})
|
|
25
|
-
expect(config.credentials.accessKeyId).to.equal('akid')
|
|
26
|
-
expect(config.credentials.secretAccessKey).to.equal('secret')
|
|
27
|
-
})
|
|
28
|
-
|
|
29
|
-
it('should use right config value', function () {
|
|
30
|
-
var NC = require('../src/services/nc')
|
|
31
|
-
var nc = new NC()
|
|
32
|
-
expect(nc.config.endpoint.host).to.not.be.empty
|
|
33
|
-
|
|
34
|
-
var config = new JDCloud.Config({
|
|
35
|
-
endpoint: {
|
|
36
|
-
host: 'globalHost.com'
|
|
37
|
-
}
|
|
38
|
-
})
|
|
39
|
-
JDCloud.config.update(config)
|
|
40
|
-
var ncUseGlobal = new NC()
|
|
41
|
-
expect(ncUseGlobal.config.endpoint.host).to.equal('globalHost.com')
|
|
42
|
-
|
|
43
|
-
config = new JDCloud.Config({
|
|
44
|
-
endpoint: {
|
|
45
|
-
host: 'globalHost.com'
|
|
46
|
-
},
|
|
47
|
-
nc: {
|
|
48
|
-
endpoint: {
|
|
49
|
-
host: 'globalNCHost.com'
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
})
|
|
53
|
-
JDCloud.config.update(config)
|
|
54
|
-
var ncUseGlobalNCConfig = new NC()
|
|
55
|
-
expect(ncUseGlobalNCConfig.config.endpoint.host).to.equal(
|
|
56
|
-
'globalNCHost.com'
|
|
57
|
-
)
|
|
58
|
-
|
|
59
|
-
var ncUseSelf = new NC({
|
|
60
|
-
endpoint: {
|
|
61
|
-
host: 'ncSelfHost.com'
|
|
62
|
-
}
|
|
63
|
-
})
|
|
64
|
-
expect(ncUseSelf.config.endpoint.host).to.equal('ncSelfHost.com')
|
|
65
|
-
})
|
|
66
|
-
})
|
|
67
|
-
describe('usage', function () {
|
|
68
|
-
it('should use default regionId', function () {
|
|
69
|
-
JDCloud.config = new JDCloud.Config()
|
|
70
|
-
var nc = new JDCloud.NC({
|
|
71
|
-
regionId: 'cn-north-1',
|
|
72
|
-
credentials: {
|
|
73
|
-
accessKeyId: global.accessKeyId,
|
|
74
|
-
secretAccessKey: global.secretAccessKey
|
|
75
|
-
},
|
|
76
|
-
logger: function (str, level = 'INFO') {
|
|
77
|
-
if (level === 'INFO') {
|
|
78
|
-
console.log(str)
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
})
|
|
82
|
-
return nc.describeContainers()
|
|
83
|
-
})
|
|
84
|
-
})
|
|
85
|
-
})
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
var MONITOR = require('../../src/services/monitor')
|
|
2
|
-
var config = require('config')
|
|
3
|
-
var global = config.get('global')
|
|
4
|
-
var expect = require('chai').expect
|
|
5
|
-
|
|
6
|
-
describe('JDCloud.MONITOR', function () {
|
|
7
|
-
var monitor = new MONITOR({
|
|
8
|
-
credentials: {
|
|
9
|
-
accessKeyId: global.accessKeyId,
|
|
10
|
-
secretAccessKey: global.secretAccessKey
|
|
11
|
-
},
|
|
12
|
-
version: {
|
|
13
|
-
monitor: 'v1'
|
|
14
|
-
},
|
|
15
|
-
regionId: 'cn-north-1'
|
|
16
|
-
})
|
|
17
|
-
|
|
18
|
-
it('describeMetrics', function () {
|
|
19
|
-
return monitor.describeMetrics({
|
|
20
|
-
serviceCode: 'vm',
|
|
21
|
-
})
|
|
22
|
-
.then(function (data) {
|
|
23
|
-
console.log(data)
|
|
24
|
-
})
|
|
25
|
-
})
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
it('describeMetricData', function () {
|
|
29
|
-
return monitor.describeMetricData({
|
|
30
|
-
serviceCode: 'vm',
|
|
31
|
-
resourceId: 'i-p1jskbki8',
|
|
32
|
-
metric: 'cpu_util',
|
|
33
|
-
timeInterval: '1h'
|
|
34
|
-
}, 'cn-north-1')
|
|
35
|
-
.then(function (data) {
|
|
36
|
-
console.log(data)
|
|
37
|
-
})
|
|
38
|
-
})
|
|
39
|
-
|
|
40
|
-
it('createAlarm', function () {
|
|
41
|
-
return monitor.createAlarm({
|
|
42
|
-
createAlarmSpec: {
|
|
43
|
-
serviceCode: 'vm',
|
|
44
|
-
resourceIds: ['i-p1jskbki8'],
|
|
45
|
-
metric: 'cpu_util',
|
|
46
|
-
period: 2,
|
|
47
|
-
calculation: 'max',
|
|
48
|
-
operation: '==',
|
|
49
|
-
threshold: 100.0,
|
|
50
|
-
times: 1
|
|
51
|
-
},
|
|
52
|
-
clientToken: 'dsf4safd6hjsfssdf567jaf'
|
|
53
|
-
}, 'cn-north-1')
|
|
54
|
-
.then(function (data) {
|
|
55
|
-
console.log(data)
|
|
56
|
-
})
|
|
57
|
-
})
|
|
58
|
-
|
|
59
|
-
it('updateAlarm', function () {
|
|
60
|
-
return monitor.updateAlarm({
|
|
61
|
-
alarmId: '265945',
|
|
62
|
-
serviceCode: 'vm',
|
|
63
|
-
resourceIds: ['i-p1jskbki8'],
|
|
64
|
-
metric: 'cpu_util',
|
|
65
|
-
period: 2,
|
|
66
|
-
calculation: 'max',
|
|
67
|
-
operation: '==',
|
|
68
|
-
threshold: 99.0,
|
|
69
|
-
times: 1
|
|
70
|
-
}, 'cn-north-1')
|
|
71
|
-
.then(function (data) {
|
|
72
|
-
console.log(data)
|
|
73
|
-
})
|
|
74
|
-
})
|
|
75
|
-
|
|
76
|
-
it('disableAlarm', function () {
|
|
77
|
-
return monitor.disableAlarm({
|
|
78
|
-
alarmId: '265945',
|
|
79
|
-
}, 'cn-north-1')
|
|
80
|
-
.then(function (data) {
|
|
81
|
-
console.log(data)
|
|
82
|
-
})
|
|
83
|
-
})
|
|
84
|
-
|
|
85
|
-
it('enableAlarm', function () {
|
|
86
|
-
return monitor.enableAlarm({
|
|
87
|
-
alarmId: '265945',
|
|
88
|
-
}, 'cn-north-1')
|
|
89
|
-
.then(function (data) {
|
|
90
|
-
console.log(data)
|
|
91
|
-
})
|
|
92
|
-
})
|
|
93
|
-
|
|
94
|
-
it('describeAlarmsByID', function () {
|
|
95
|
-
return monitor.describeAlarmsByID({
|
|
96
|
-
alarmId: '265945',
|
|
97
|
-
}, 'cn-north-1')
|
|
98
|
-
.then(function (data) {
|
|
99
|
-
console.log(data)
|
|
100
|
-
})
|
|
101
|
-
})
|
|
102
|
-
|
|
103
|
-
it('describeAlarms', function () {
|
|
104
|
-
return monitor.describeAlarms({
|
|
105
|
-
pageNumber: 1,
|
|
106
|
-
pageSize: 50
|
|
107
|
-
}, 'cn-north-1')
|
|
108
|
-
.then(function (data) {
|
|
109
|
-
console.log(data)
|
|
110
|
-
})
|
|
111
|
-
})
|
|
112
|
-
|
|
113
|
-
it('deleteAlarms', function () {
|
|
114
|
-
return monitor.deleteAlarms({
|
|
115
|
-
ids: '265945',
|
|
116
|
-
}, 'cn-north-1')
|
|
117
|
-
.then(function (data) {
|
|
118
|
-
console.log(data)
|
|
119
|
-
})
|
|
120
|
-
})
|
|
121
|
-
|
|
122
|
-
})
|
package/test/services/nc.spec.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
var NC = require('../../src/services/nativecontainer')
|
|
2
|
-
var config = require('config')
|
|
3
|
-
var global = config.get('global')
|
|
4
|
-
describe('JDCloud.NC', function () {
|
|
5
|
-
var nc = new NATIVECONTAINER({
|
|
6
|
-
credentials: {
|
|
7
|
-
accessKeyId: global.accessKeyId,
|
|
8
|
-
secretAccessKey: global.secretAccessKey
|
|
9
|
-
},
|
|
10
|
-
endpoint: {
|
|
11
|
-
host: 'nativecontainer.internal.cn-north-1.jdcloud-api.com', //指定非默认Endpoint
|
|
12
|
-
protocol: 'http' //设置使用HTTP而不是HTTPS,vpc专用域名不支持HTTPS
|
|
13
|
-
},
|
|
14
|
-
'x-extra-header': { //指定额外header
|
|
15
|
-
"x-jdcloud-security-token" : "xxx", //要调用开启了MFA操作保护的接口需要传递
|
|
16
|
-
"x-jdcloud-content-sha256" : "xxx", //body过大,希望用此value替代对body进行哈希的过程
|
|
17
|
-
"MyOwn" : "xxx"
|
|
18
|
-
},
|
|
19
|
-
version: {
|
|
20
|
-
nativecontainer: 'v1'
|
|
21
|
-
}
|
|
22
|
-
})
|
|
23
|
-
// var nc = new NC();
|
|
24
|
-
describe('describeContainers', function () {
|
|
25
|
-
it('should be able to get nc list', function () {
|
|
26
|
-
return nc.describeContainers({
|
|
27
|
-
filters: [
|
|
28
|
-
{name: 'containerId', values: ['c-rxjwzysxu', 'c-73woiy7iz']}
|
|
29
|
-
],
|
|
30
|
-
}, 'cn-north-1')
|
|
31
|
-
})
|
|
32
|
-
})
|
|
33
|
-
})
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
var OSS = require('../../src/services/oss')
|
|
2
|
-
var config = require('config')
|
|
3
|
-
var global = config.get('global')
|
|
4
|
-
var expect = require('chai').expect
|
|
5
|
-
|
|
6
|
-
describe('JDCloud.OSS', function () {
|
|
7
|
-
|
|
8
|
-
var oss = new OSS({
|
|
9
|
-
credentials: {
|
|
10
|
-
accessKeyId: global.accessKeyId,
|
|
11
|
-
secretAccessKey: global.secretAccessKey
|
|
12
|
-
},
|
|
13
|
-
version: {
|
|
14
|
-
oss: 'v1'
|
|
15
|
-
},
|
|
16
|
-
basePath : '/v1', //默认要设为空""
|
|
17
|
-
})
|
|
18
|
-
|
|
19
|
-
describe('listBucket', function () {
|
|
20
|
-
it('should be able to get bucket list', function () {
|
|
21
|
-
return oss.listBuckets({
|
|
22
|
-
},'cn-east-1')
|
|
23
|
-
.then(function (data) {
|
|
24
|
-
console.log(data)
|
|
25
|
-
})
|
|
26
|
-
})
|
|
27
|
-
})
|
|
28
|
-
|
|
29
|
-
describe('putBucket', function () {
|
|
30
|
-
it('should be able to put bucket', function () {
|
|
31
|
-
return oss.putBucket({
|
|
32
|
-
bucketname : "apitest"
|
|
33
|
-
},'cn-east-1')
|
|
34
|
-
.then(function (data) {
|
|
35
|
-
console.log(data)
|
|
36
|
-
})
|
|
37
|
-
})
|
|
38
|
-
})
|
|
39
|
-
|
|
40
|
-
describe('headBucket', function () {
|
|
41
|
-
it('should be able to get head', function () {
|
|
42
|
-
return oss.headBucket({
|
|
43
|
-
bucketname : "apitest"
|
|
44
|
-
},'cn-east-1')
|
|
45
|
-
.then(function (data) {
|
|
46
|
-
console.log(data)
|
|
47
|
-
})
|
|
48
|
-
})
|
|
49
|
-
})
|
|
50
|
-
|
|
51
|
-
describe('deleteBucket', function () {
|
|
52
|
-
it('should be able to get head', function () {
|
|
53
|
-
return oss.deleteBucket({
|
|
54
|
-
bucketname : "apitest"
|
|
55
|
-
},'cn-east-1')
|
|
56
|
-
.then(function (data) {
|
|
57
|
-
console.log(data)
|
|
58
|
-
})
|
|
59
|
-
})
|
|
60
|
-
})
|
|
61
|
-
})
|
package/test/services/vm.spec.js
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
var VM = require('../../src/services/vm')
|
|
2
|
-
var config = require('config')
|
|
3
|
-
var global = config.get('global')
|
|
4
|
-
var expect = require('chai').expect
|
|
5
|
-
|
|
6
|
-
describe('JDCloud.VM', function () {
|
|
7
|
-
var vm = new VM({
|
|
8
|
-
credentials: {
|
|
9
|
-
accessKeyId: global.accessKeyId,
|
|
10
|
-
secretAccessKey: global.secretAccessKey
|
|
11
|
-
},
|
|
12
|
-
regionId: 'cn-north-1',
|
|
13
|
-
version: {
|
|
14
|
-
vm: 'v1'
|
|
15
|
-
}
|
|
16
|
-
})
|
|
17
|
-
it('describeInstances', function () {
|
|
18
|
-
console.log("========DescribeInstances=======");
|
|
19
|
-
return vm.describeInstances({
|
|
20
|
-
filters: [{ name: "name" , values:[ "i-6za0ovr24v",
|
|
21
|
-
"i-rj5ve7jegu",
|
|
22
|
-
"i-rj5ve7jegu1",
|
|
23
|
-
"i-rj5ve7jegu2",
|
|
24
|
-
"i-rj5ve7jegu3",
|
|
25
|
-
"i-rj5ve7jegu4",
|
|
26
|
-
"i-rj5ve7jegdu"] ,operator: "eq"}]
|
|
27
|
-
}, 'cn-north-1')
|
|
28
|
-
.then(function (data) {
|
|
29
|
-
console.log(data)
|
|
30
|
-
})
|
|
31
|
-
})
|
|
32
|
-
describe('should create and delete a instance', function () {
|
|
33
|
-
var instanceId = null
|
|
34
|
-
it('createInstances', function () {
|
|
35
|
-
return vm
|
|
36
|
-
.createInstances({
|
|
37
|
-
instanceSpec: {
|
|
38
|
-
instanceType: 'g.s1.micro',
|
|
39
|
-
az: 'cn-north-1a',
|
|
40
|
-
imageId: '9d44a0f-88c1-451a-8971-f1f769073b6c',
|
|
41
|
-
name: 'node-sdk-test',
|
|
42
|
-
elasticIp: { bandwidthMbps: 2, provider: 'BGP' },
|
|
43
|
-
primaryNetworkInterface: {
|
|
44
|
-
networkInterface: {
|
|
45
|
-
subnetId: 'subnet-3dm3k30gh',
|
|
46
|
-
az: 'cn-north-1a'
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
|
-
systemDisk: { diskCategory: 'local' },
|
|
50
|
-
description: 'sdk'
|
|
51
|
-
},
|
|
52
|
-
maxCount: 1
|
|
53
|
-
}, 'cn-north-1')
|
|
54
|
-
.then(function (data) {
|
|
55
|
-
|
|
56
|
-
// instanceIds = data.data.instanceIds
|
|
57
|
-
// return expec(instanceIds[0]).to.not.be.empty
|
|
58
|
-
})
|
|
59
|
-
})
|
|
60
|
-
it('deleteInstance', function () {
|
|
61
|
-
if (instanceId) {
|
|
62
|
-
return vm.deleteInstance({
|
|
63
|
-
instanceId: instanceId
|
|
64
|
-
})
|
|
65
|
-
} else {
|
|
66
|
-
this.skip()
|
|
67
|
-
}
|
|
68
|
-
})
|
|
69
|
-
})
|
|
70
|
-
})
|