@certd/jdcloud 1.40.2 → 1.40.3

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 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.40.3](https://github.com/certd/certd/compare/v1.40.2...v1.40.3) (2026-05-21)
7
+
8
+ **Note:** Version bump only for package @certd/jdcloud
9
+
6
10
  ## [1.40.2](https://github.com/certd/certd/compare/v1.40.1...v1.40.2) (2026-05-19)
7
11
 
8
12
  **Note:** Version bump only for package @certd/jdcloud
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@certd/jdcloud",
3
- "version": "1.40.2",
3
+ "version": "1.40.3",
4
4
  "description": "jdcloud openApi sdk",
5
5
  "main": "./dist/bundle.js",
6
6
  "module": "./dist/bundle.js",
@@ -59,5 +59,5 @@
59
59
  "fetch"
60
60
  ]
61
61
  },
62
- "gitHead": "678b70cee8510a2b5217788c5db9469f49cbd439"
62
+ "gitHead": "01c91ba294f88bd07fddf9358c4301bbb4027916"
63
63
  }
@@ -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
- })
@@ -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
- })
@@ -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
- })
@@ -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
- })