mirror of
https://github.com/certd/certd.git
synced 2026-05-16 13:17:29 +08:00
perf: 支持京东云dns申请证书
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,261 @@
|
||||
/*
|
||||
* Copyright 2018 JDCLOUD.COM
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http:#www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* 应用管理平台API (仅对授权用户使用)
|
||||
* 应用管理平台API
|
||||
*
|
||||
* OpenAPI spec version: v1
|
||||
* Contact:
|
||||
*
|
||||
* NOTE: This class is auto generated by the jdcloud code generator program.
|
||||
*/
|
||||
|
||||
require('../../../lib/node_loader')
|
||||
var JDCloud = require('../../../lib/core')
|
||||
var Service = JDCloud.Service
|
||||
var serviceId = 'ams'
|
||||
Service._services[serviceId] = true
|
||||
|
||||
/**
|
||||
* ams service.
|
||||
* @version 1.0.0
|
||||
*/
|
||||
|
||||
JDCloud.AMS = class AMS extends Service {
|
||||
constructor (options = {}) {
|
||||
options._defaultEndpoint = {}
|
||||
options._defaultEndpoint.protocol =
|
||||
options._defaultEndpoint.protocol || 'https'
|
||||
options._defaultEndpoint.host =
|
||||
options._defaultEndpoint.host || 'ams.jdcloud-api.com'
|
||||
options.basePath = '/v1' // 默认要设为空""
|
||||
super(serviceId, options)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取收流基础数据查询
|
||||
* @param {Object} opts - parameters
|
||||
* @param {string} opts.streamId - 流ID
|
||||
* @param {string} [opts.startTime] - 起始时间 optional
|
||||
* @param {string} [opts.endTime] - 结束时间 optional
|
||||
* @param {string} callback - callback
|
||||
@return {Object} result
|
||||
* @param streamInputData streamInputDatas
|
||||
*/
|
||||
|
||||
describeStreamsInput (opts, callback) {
|
||||
opts = opts || {}
|
||||
|
||||
if (opts.streamId === undefined || opts.streamId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'opts.streamId' when calling describeStreamsInput"
|
||||
)
|
||||
}
|
||||
|
||||
let postBody = null
|
||||
let queryParams = {}
|
||||
if (opts.startTime !== undefined && opts.startTime !== null) {
|
||||
queryParams['startTime'] = opts.startTime
|
||||
}
|
||||
if (opts.endTime !== undefined && opts.endTime !== null) {
|
||||
queryParams['endTime'] = opts.endTime
|
||||
}
|
||||
|
||||
let pathParams = {
|
||||
regionId: 'jdcloud',
|
||||
streamId: opts.streamId
|
||||
}
|
||||
|
||||
let headerParams = {
|
||||
'User-Agent': 'JdcloudSdkNode/1.0.0 ams/1.0.0'
|
||||
}
|
||||
|
||||
let contentTypes = ['application/json']
|
||||
let accepts = ['application/json']
|
||||
|
||||
// 扩展自定义头
|
||||
if (opts['x-extra-header']) {
|
||||
for (let extraHeader in opts['x-extra-header']) {
|
||||
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
||||
contentTypes = opts['x-extra-header']['content-type']
|
||||
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
||||
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
||||
accepts = opts['x-extra-header']['accept']
|
||||
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
||||
accepts = opts['x-extra-header']['accept'].split(',')
|
||||
}
|
||||
}
|
||||
|
||||
let formParams = {}
|
||||
|
||||
let returnType = null
|
||||
|
||||
this.config.logger(
|
||||
`call describeStreamsInput with params:\npathParams:${JSON.stringify(
|
||||
pathParams
|
||||
)},\nqueryParams:${JSON.stringify(
|
||||
queryParams
|
||||
)}, \nheaderParams:${JSON.stringify(
|
||||
headerParams
|
||||
)}, \nformParams:${JSON.stringify(
|
||||
formParams
|
||||
)}, \npostBody:${JSON.stringify(postBody)}`,
|
||||
'DEBUG'
|
||||
)
|
||||
|
||||
let request = this.makeRequest(
|
||||
'/streams/{streamId}/inputs',
|
||||
'GET',
|
||||
pathParams,
|
||||
queryParams,
|
||||
headerParams,
|
||||
formParams,
|
||||
postBody,
|
||||
contentTypes,
|
||||
accepts,
|
||||
returnType,
|
||||
callback
|
||||
)
|
||||
|
||||
return request.then(
|
||||
function (result) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(null, result)
|
||||
}
|
||||
return result
|
||||
},
|
||||
function (error) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(error)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 客户端鉴权查询
|
||||
* @param {Object} opts - parameters
|
||||
* @param {string} opts.pId - PinId
|
||||
* @param {integer} [opts.ver] - 版本 optional
|
||||
* @param {string} callback - callback
|
||||
@return {Object} result
|
||||
* @param string pId PinId
|
||||
* @param integer ver 版本
|
||||
* @param number blacklist 集合
|
||||
* @param integer status 状态
|
||||
* @param string license 授权号
|
||||
*/
|
||||
|
||||
describeAuthenticate (opts, callback) {
|
||||
opts = opts || {}
|
||||
|
||||
if (opts.pId === undefined || opts.pId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'opts.pId' when calling describeAuthenticate"
|
||||
)
|
||||
}
|
||||
|
||||
let postBody = null
|
||||
let queryParams = {}
|
||||
if (opts.ver !== undefined && opts.ver !== null) {
|
||||
queryParams['ver'] = opts.ver
|
||||
}
|
||||
|
||||
let pathParams = {
|
||||
regionId: 'jdcloud',
|
||||
pId: opts.pId
|
||||
}
|
||||
|
||||
let headerParams = {
|
||||
'User-Agent': 'JdcloudSdkNode/1.0.0 ams/1.0.0'
|
||||
}
|
||||
|
||||
let contentTypes = ['application/json']
|
||||
let accepts = ['application/json']
|
||||
|
||||
// 扩展自定义头
|
||||
if (opts['x-extra-header']) {
|
||||
for (let extraHeader in opts['x-extra-header']) {
|
||||
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
||||
contentTypes = opts['x-extra-header']['content-type']
|
||||
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
||||
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
||||
accepts = opts['x-extra-header']['accept']
|
||||
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
||||
accepts = opts['x-extra-header']['accept'].split(',')
|
||||
}
|
||||
}
|
||||
|
||||
let formParams = {}
|
||||
|
||||
let returnType = null
|
||||
|
||||
this.config.logger(
|
||||
`call describeAuthenticate with params:\npathParams:${JSON.stringify(
|
||||
pathParams
|
||||
)},\nqueryParams:${JSON.stringify(
|
||||
queryParams
|
||||
)}, \nheaderParams:${JSON.stringify(
|
||||
headerParams
|
||||
)}, \nformParams:${JSON.stringify(
|
||||
formParams
|
||||
)}, \npostBody:${JSON.stringify(postBody)}`,
|
||||
'DEBUG'
|
||||
)
|
||||
|
||||
let request = this.makeRequest(
|
||||
'/appManager/{pId}/authenticates',
|
||||
'GET',
|
||||
pathParams,
|
||||
queryParams,
|
||||
headerParams,
|
||||
formParams,
|
||||
postBody,
|
||||
contentTypes,
|
||||
accepts,
|
||||
returnType,
|
||||
callback
|
||||
)
|
||||
|
||||
return request.then(
|
||||
function (result) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(null, result)
|
||||
}
|
||||
return result
|
||||
},
|
||||
function (error) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(error)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
module.exports = JDCloud.AMS
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,274 @@
|
||||
/*
|
||||
* Copyright 2018 JDCLOUD.COM
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http:#www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* JDCLOUD asset API
|
||||
* API JDCLOUD asset API
|
||||
*
|
||||
* OpenAPI spec version: v1
|
||||
* Contact:
|
||||
*
|
||||
* NOTE: This class is auto generated by the jdcloud code generator program.
|
||||
*/
|
||||
|
||||
require('../../../lib/node_loader')
|
||||
var JDCloud = require('../../../lib/core')
|
||||
var Service = JDCloud.Service
|
||||
var serviceId = 'asset'
|
||||
Service._services[serviceId] = true
|
||||
|
||||
/**
|
||||
* asset service.
|
||||
* @version 0.0.3
|
||||
*/
|
||||
|
||||
class ASSET extends Service {
|
||||
constructor (options = {}) {
|
||||
options._defaultEndpoint = {}
|
||||
options._defaultEndpoint.protocol =
|
||||
options._defaultEndpoint.protocol || 'https'
|
||||
options._defaultEndpoint.host =
|
||||
options._defaultEndpoint.host || 'asset.jdcloud-api.com'
|
||||
options.basePath = '/v1' // 默认要设为空""
|
||||
super(serviceId, options)
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询账户金额(总金额、可用金额、冻结金额、可提现金额、提现中金额)
|
||||
* @param {Object} opts - parameters
|
||||
* @param {string} regionId - ID of the region
|
||||
* @param {string} callback - callback
|
||||
@return {Object} result
|
||||
* @param string totalAmount 总金额:可用金额+冻结金额
|
||||
* @param string availableAmount 可用金额
|
||||
* @param string frozenAmount 冻结金额:提现失败、处理中或预占中金额
|
||||
* @param string enableWithdrawAmount 可提现金额:排除对公充值金额总额后的充值总额,如果余额大于非对公充值总额,则为非对公充值总额,否则为余额(对公充值=企业线下汇款+企业充值+活动充值金额)
|
||||
* @param string withdrawingAmount 提现中金额:提现状态为处理中和预占中的金额
|
||||
*/
|
||||
|
||||
describeAccountAmount (opts, regionId = this.config.regionId, callback) {
|
||||
if (typeof regionId === 'function') {
|
||||
callback = regionId
|
||||
regionId = this.config.regionId
|
||||
}
|
||||
|
||||
if (regionId === undefined || regionId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'regionId' when calling describeAccountAmount"
|
||||
)
|
||||
}
|
||||
|
||||
opts = opts || {}
|
||||
|
||||
let postBody = null
|
||||
let queryParams = {}
|
||||
|
||||
let pathParams = {
|
||||
regionId: regionId
|
||||
}
|
||||
|
||||
let headerParams = {
|
||||
'User-Agent': 'JdcloudSdkNode/1.0.0 asset/0.0.3'
|
||||
}
|
||||
|
||||
let contentTypes = ['application/json']
|
||||
let accepts = ['application/json']
|
||||
|
||||
// 扩展自定义头
|
||||
if (opts['x-extra-header']) {
|
||||
for (let extraHeader in opts['x-extra-header']) {
|
||||
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
||||
contentTypes = opts['x-extra-header']['content-type']
|
||||
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
||||
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
||||
accepts = opts['x-extra-header']['accept']
|
||||
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
||||
accepts = opts['x-extra-header']['accept'].split(',')
|
||||
}
|
||||
}
|
||||
|
||||
let formParams = {}
|
||||
|
||||
let returnType = null
|
||||
|
||||
this.config.logger(
|
||||
`call describeAccountAmount with params:\npathParams:${JSON.stringify(
|
||||
pathParams
|
||||
)},\nqueryParams:${JSON.stringify(
|
||||
queryParams
|
||||
)}, \nheaderParams:${JSON.stringify(
|
||||
headerParams
|
||||
)}, \nformParams:${JSON.stringify(
|
||||
formParams
|
||||
)}, \npostBody:${JSON.stringify(postBody)}`,
|
||||
'DEBUG'
|
||||
)
|
||||
|
||||
let request = super.makeRequest(
|
||||
'/regions/{regionId}/assets:describeAccountAmount',
|
||||
'GET',
|
||||
pathParams,
|
||||
queryParams,
|
||||
headerParams,
|
||||
formParams,
|
||||
postBody,
|
||||
contentTypes,
|
||||
accepts,
|
||||
returnType,
|
||||
callback
|
||||
)
|
||||
|
||||
return request.then(
|
||||
function (result) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(null, result)
|
||||
}
|
||||
return result
|
||||
},
|
||||
function (error) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(error)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置余额预警信息
|
||||
* @param {Object} opts - parameters
|
||||
* @param {balanceWarningInfoVo} opts.balanceWarningInfoVo
|
||||
* @param {string} regionId - ID of the region
|
||||
* @param {string} callback - callback
|
||||
@return {Object} result
|
||||
* @param boolean status
|
||||
*/
|
||||
|
||||
modifyBalanceWarningInfo (opts, regionId = this.config.regionId, callback) {
|
||||
if (typeof regionId === 'function') {
|
||||
callback = regionId
|
||||
regionId = this.config.regionId
|
||||
}
|
||||
|
||||
if (regionId === undefined || regionId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'regionId' when calling modifyBalanceWarningInfo"
|
||||
)
|
||||
}
|
||||
|
||||
opts = opts || {}
|
||||
|
||||
if (
|
||||
opts.balanceWarningInfoVo === undefined ||
|
||||
opts.balanceWarningInfoVo === null
|
||||
) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'opts.balanceWarningInfoVo' when calling modifyBalanceWarningInfo"
|
||||
)
|
||||
}
|
||||
|
||||
let postBody = {}
|
||||
if (
|
||||
opts.balanceWarningInfoVo !== undefined &&
|
||||
opts.balanceWarningInfoVo !== null
|
||||
) {
|
||||
postBody['balanceWarningInfoVo'] = opts.balanceWarningInfoVo
|
||||
}
|
||||
|
||||
let queryParams = {}
|
||||
|
||||
let pathParams = {
|
||||
regionId: regionId
|
||||
}
|
||||
|
||||
let headerParams = {
|
||||
'User-Agent': 'JdcloudSdkNode/1.0.0 asset/0.0.3'
|
||||
}
|
||||
|
||||
let contentTypes = ['application/json']
|
||||
let accepts = ['application/json']
|
||||
|
||||
// 扩展自定义头
|
||||
if (opts['x-extra-header']) {
|
||||
for (let extraHeader in opts['x-extra-header']) {
|
||||
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
||||
contentTypes = opts['x-extra-header']['content-type']
|
||||
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
||||
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
||||
accepts = opts['x-extra-header']['accept']
|
||||
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
||||
accepts = opts['x-extra-header']['accept'].split(',')
|
||||
}
|
||||
}
|
||||
|
||||
let formParams = {}
|
||||
|
||||
let returnType = null
|
||||
|
||||
this.config.logger(
|
||||
`call modifyBalanceWarningInfo with params:\npathParams:${JSON.stringify(
|
||||
pathParams
|
||||
)},\nqueryParams:${JSON.stringify(
|
||||
queryParams
|
||||
)}, \nheaderParams:${JSON.stringify(
|
||||
headerParams
|
||||
)}, \nformParams:${JSON.stringify(
|
||||
formParams
|
||||
)}, \npostBody:${JSON.stringify(postBody)}`,
|
||||
'DEBUG'
|
||||
)
|
||||
|
||||
let request = super.makeRequest(
|
||||
'/regions/{regionId}/assets:modifyBalanceWarningInfo',
|
||||
'POST',
|
||||
pathParams,
|
||||
queryParams,
|
||||
headerParams,
|
||||
formParams,
|
||||
postBody,
|
||||
contentTypes,
|
||||
accepts,
|
||||
returnType,
|
||||
callback
|
||||
)
|
||||
|
||||
return request.then(
|
||||
function (result) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(null, result)
|
||||
}
|
||||
return result
|
||||
},
|
||||
function (error) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(error)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
module.exports = ASSET
|
||||
@@ -0,0 +1,919 @@
|
||||
/*
|
||||
* Copyright 2018 JDCLOUD.COM
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http:#www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* LogConfig
|
||||
* 用户日志相关配置
|
||||
*
|
||||
* OpenAPI spec version: v1
|
||||
* Contact:
|
||||
*
|
||||
* NOTE: This class is auto generated by the jdcloud code generator program.
|
||||
*/
|
||||
|
||||
require('../../../lib/node_loader')
|
||||
var JDCloud = require('../../../lib/core')
|
||||
var Service = JDCloud.Service
|
||||
var serviceId = 'assistant'
|
||||
Service._services[serviceId] = true
|
||||
|
||||
/**
|
||||
* assistant service.
|
||||
* @version 1.0.2
|
||||
*/
|
||||
|
||||
class ASSISTANT extends Service {
|
||||
constructor (options = {}) {
|
||||
options._defaultEndpoint = {}
|
||||
options._defaultEndpoint.protocol =
|
||||
options._defaultEndpoint.protocol || 'https'
|
||||
options._defaultEndpoint.host =
|
||||
options._defaultEndpoint.host || 'assistant.jdcloud-api.com'
|
||||
options.basePath = '/v1' // 默认要设为空""
|
||||
super(serviceId, options)
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
保存用户自定义命令。
|
||||
|
||||
详细操作说明请参考帮助文档:[用户自定义命令概述](https://docs.jdcloud.com/cn/virtual-machines/assistant-overview)
|
||||
|
||||
## 接口说明
|
||||
- 该接口用于保存用户自定义命令。
|
||||
|
||||
* @param {Object} opts - parameters
|
||||
* @param {string} opts.commandName - 命令名称,长度为1\~128个字符,只允许中文、数字、大小写字母、英文下划线(\_)、连字符(-)及点(.)。
|
||||
|
||||
* @param {string} [opts.commandType] - 命令类型,可选值:shell和powershell,默认shell
|
||||
optional
|
||||
* @param {string} opts.commandContent - 以base64编码的命令内容,编码后长度小于36KB
|
||||
|
||||
* @param {integer} [opts.timeout] - 超时时间,取值范围:[10, 86400], 超过该时间后,尚未执行完的命令会置为失败。默认60s
|
||||
optional
|
||||
* @param {string} [opts.username] - 用户名,执行该命令时的用户身份。在linux上默认是root,windows上默认是administrator。长度小于256
|
||||
optional
|
||||
* @param {string} [opts.workdir] - 命令执行路径。在linux上默认是/root,windows上默认是C:\Windows\System32。长度小于256。
|
||||
optional
|
||||
* @param {string} [opts.commandDescription] - 命令描述,描述该命令详细信息,如功能、使用注意事项等。长度小于256。
|
||||
optional
|
||||
* @param {boolean} [opts.enableParameter] - 是否使用参数, 默认false,不使用参数 optional
|
||||
* @param {string} regionId - ID of the region
|
||||
* @param {string} callback - callback
|
||||
@return {Object} result
|
||||
* @param string commandId 命令Id。
|
||||
*/
|
||||
|
||||
createCommand (opts, regionId = this.config.regionId, callback) {
|
||||
if (typeof regionId === 'function') {
|
||||
callback = regionId
|
||||
regionId = this.config.regionId
|
||||
}
|
||||
|
||||
if (regionId === undefined || regionId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'regionId' when calling createCommand"
|
||||
)
|
||||
}
|
||||
|
||||
opts = opts || {}
|
||||
|
||||
if (opts.commandName === undefined || opts.commandName === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'opts.commandName' when calling createCommand"
|
||||
)
|
||||
}
|
||||
if (opts.commandContent === undefined || opts.commandContent === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'opts.commandContent' when calling createCommand"
|
||||
)
|
||||
}
|
||||
|
||||
let postBody = {}
|
||||
if (opts.commandName !== undefined && opts.commandName !== null) {
|
||||
postBody['commandName'] = opts.commandName
|
||||
}
|
||||
if (opts.commandType !== undefined && opts.commandType !== null) {
|
||||
postBody['commandType'] = opts.commandType
|
||||
}
|
||||
if (opts.commandContent !== undefined && opts.commandContent !== null) {
|
||||
postBody['commandContent'] = opts.commandContent
|
||||
}
|
||||
if (opts.timeout !== undefined && opts.timeout !== null) {
|
||||
postBody['timeout'] = opts.timeout
|
||||
}
|
||||
if (opts.username !== undefined && opts.username !== null) {
|
||||
postBody['username'] = opts.username
|
||||
}
|
||||
if (opts.workdir !== undefined && opts.workdir !== null) {
|
||||
postBody['workdir'] = opts.workdir
|
||||
}
|
||||
if (
|
||||
opts.commandDescription !== undefined &&
|
||||
opts.commandDescription !== null
|
||||
) {
|
||||
postBody['commandDescription'] = opts.commandDescription
|
||||
}
|
||||
if (opts.enableParameter !== undefined && opts.enableParameter !== null) {
|
||||
postBody['enableParameter'] = opts.enableParameter
|
||||
}
|
||||
|
||||
let queryParams = {}
|
||||
|
||||
let pathParams = {
|
||||
regionId: regionId
|
||||
}
|
||||
|
||||
let headerParams = {
|
||||
'User-Agent': 'JdcloudSdkNode/1.0.0 assistant/1.0.2'
|
||||
}
|
||||
|
||||
let contentTypes = ['application/json']
|
||||
let accepts = ['application/json']
|
||||
|
||||
// 扩展自定义头
|
||||
if (opts['x-extra-header']) {
|
||||
for (let extraHeader in opts['x-extra-header']) {
|
||||
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
||||
contentTypes = opts['x-extra-header']['content-type']
|
||||
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
||||
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
||||
accepts = opts['x-extra-header']['accept']
|
||||
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
||||
accepts = opts['x-extra-header']['accept'].split(',')
|
||||
}
|
||||
}
|
||||
|
||||
let formParams = {}
|
||||
|
||||
let returnType = null
|
||||
|
||||
this.config.logger(
|
||||
`call createCommand with params:\npathParams:${JSON.stringify(
|
||||
pathParams
|
||||
)},\nqueryParams:${JSON.stringify(
|
||||
queryParams
|
||||
)}, \nheaderParams:${JSON.stringify(
|
||||
headerParams
|
||||
)}, \nformParams:${JSON.stringify(
|
||||
formParams
|
||||
)}, \npostBody:${JSON.stringify(postBody)}`,
|
||||
'DEBUG'
|
||||
)
|
||||
|
||||
let request = super.makeRequest(
|
||||
'/regions/{regionId}/createCommand',
|
||||
'POST',
|
||||
pathParams,
|
||||
queryParams,
|
||||
headerParams,
|
||||
formParams,
|
||||
postBody,
|
||||
contentTypes,
|
||||
accepts,
|
||||
returnType,
|
||||
callback
|
||||
)
|
||||
|
||||
return request.then(
|
||||
function (result) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(null, result)
|
||||
}
|
||||
return result
|
||||
},
|
||||
function (error) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(error)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
查询用户自定义命令。
|
||||
|
||||
详细操作说明请参考帮助文档:[用户自定义命令概述](https://docs.jdcloud.com/cn/virtual-machines/assistant-overview)
|
||||
|
||||
## 接口说明
|
||||
- 该接口用于查询用户保存的自定义命令。
|
||||
|
||||
* @param {Object} opts - parameters
|
||||
* @param {integer} [opts.pageNumber] - 页数,默认是第一页,取值为 1
|
||||
optional
|
||||
* @param {integer} [opts.pageSize] - 每页命令数,默认为20,最大为100
|
||||
optional
|
||||
* @param {array} [opts.commandIds] - 命令Id,最多可传入100个命令Id
|
||||
optional
|
||||
* @param {array} [opts.commandNames] - 命令名称,长度为1\~128个字符,只允许中文、数字、大小写字母、英文下划线(\_)、连字符(-)及点(.)。最多可传入100个命令名称。
|
||||
optional
|
||||
* @param {array} [opts.commandTypes] - 命令类型,可选值:shell和powershell,默认shell
|
||||
optional
|
||||
* @param {string} [opts.sourceType] - 命令来源,可选值:jdcloud(官方)和self,默认self
|
||||
optional
|
||||
* @param {array} [opts.usernames] - 用户名,执行该命令时的用户身份。在linux上默认是root,windows上默认是administrator。长度小于256
|
||||
optional
|
||||
* @param {string} regionId - ID of the region
|
||||
* @param {string} callback - callback
|
||||
@return {Object} result
|
||||
* @param integer totalCount 总的命令数,可以根据该字段来决定是否继续查找
|
||||
* @param command commands
|
||||
*/
|
||||
|
||||
describeCommands (opts, regionId = this.config.regionId, callback) {
|
||||
if (typeof regionId === 'function') {
|
||||
callback = regionId
|
||||
regionId = this.config.regionId
|
||||
}
|
||||
|
||||
if (regionId === undefined || regionId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'regionId' when calling describeCommands"
|
||||
)
|
||||
}
|
||||
|
||||
opts = opts || {}
|
||||
|
||||
let postBody = {}
|
||||
if (opts.pageNumber !== undefined && opts.pageNumber !== null) {
|
||||
postBody['pageNumber'] = opts.pageNumber
|
||||
}
|
||||
if (opts.pageSize !== undefined && opts.pageSize !== null) {
|
||||
postBody['pageSize'] = opts.pageSize
|
||||
}
|
||||
if (opts.commandIds !== undefined && opts.commandIds !== null) {
|
||||
postBody['commandIds'] = opts.commandIds
|
||||
}
|
||||
if (opts.commandNames !== undefined && opts.commandNames !== null) {
|
||||
postBody['commandNames'] = opts.commandNames
|
||||
}
|
||||
if (opts.commandTypes !== undefined && opts.commandTypes !== null) {
|
||||
postBody['commandTypes'] = opts.commandTypes
|
||||
}
|
||||
if (opts.sourceType !== undefined && opts.sourceType !== null) {
|
||||
postBody['sourceType'] = opts.sourceType
|
||||
}
|
||||
if (opts.usernames !== undefined && opts.usernames !== null) {
|
||||
postBody['usernames'] = opts.usernames
|
||||
}
|
||||
|
||||
let queryParams = {}
|
||||
|
||||
let pathParams = {
|
||||
regionId: regionId
|
||||
}
|
||||
|
||||
let headerParams = {
|
||||
'User-Agent': 'JdcloudSdkNode/1.0.0 assistant/1.0.2'
|
||||
}
|
||||
|
||||
let contentTypes = ['application/json']
|
||||
let accepts = ['application/json']
|
||||
|
||||
// 扩展自定义头
|
||||
if (opts['x-extra-header']) {
|
||||
for (let extraHeader in opts['x-extra-header']) {
|
||||
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
||||
contentTypes = opts['x-extra-header']['content-type']
|
||||
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
||||
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
||||
accepts = opts['x-extra-header']['accept']
|
||||
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
||||
accepts = opts['x-extra-header']['accept'].split(',')
|
||||
}
|
||||
}
|
||||
|
||||
let formParams = {}
|
||||
|
||||
let returnType = null
|
||||
|
||||
this.config.logger(
|
||||
`call describeCommands with params:\npathParams:${JSON.stringify(
|
||||
pathParams
|
||||
)},\nqueryParams:${JSON.stringify(
|
||||
queryParams
|
||||
)}, \nheaderParams:${JSON.stringify(
|
||||
headerParams
|
||||
)}, \nformParams:${JSON.stringify(
|
||||
formParams
|
||||
)}, \npostBody:${JSON.stringify(postBody)}`,
|
||||
'DEBUG'
|
||||
)
|
||||
|
||||
let request = super.makeRequest(
|
||||
'/regions/{regionId}/describeCommands',
|
||||
'POST',
|
||||
pathParams,
|
||||
queryParams,
|
||||
headerParams,
|
||||
formParams,
|
||||
postBody,
|
||||
contentTypes,
|
||||
accepts,
|
||||
returnType,
|
||||
callback
|
||||
)
|
||||
|
||||
return request.then(
|
||||
function (result) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(null, result)
|
||||
}
|
||||
return result
|
||||
},
|
||||
function (error) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(error)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
删除用户自定义命令。
|
||||
|
||||
详细操作说明请参考帮助文档:[用户自定义命令概述](https://docs.jdcloud.com/cn/virtual-machines/assistant-overview)
|
||||
|
||||
## 接口说明
|
||||
- 该接口用于删除用户自定义命令。
|
||||
|
||||
* @param {Object} opts - parameters
|
||||
* @param {array} [opts.commandIds] - 用户创建的命令Id
|
||||
optional
|
||||
* @param {string} regionId - ID of the region
|
||||
* @param {string} callback - callback
|
||||
@return {Object} result
|
||||
* @param string commandId 命令Id。
|
||||
*/
|
||||
|
||||
deleteCommands (opts, regionId = this.config.regionId, callback) {
|
||||
if (typeof regionId === 'function') {
|
||||
callback = regionId
|
||||
regionId = this.config.regionId
|
||||
}
|
||||
|
||||
if (regionId === undefined || regionId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'regionId' when calling deleteCommands"
|
||||
)
|
||||
}
|
||||
|
||||
opts = opts || {}
|
||||
|
||||
let postBody = {}
|
||||
if (opts.commandIds !== undefined && opts.commandIds !== null) {
|
||||
postBody['commandIds'] = opts.commandIds
|
||||
}
|
||||
|
||||
let queryParams = {}
|
||||
|
||||
let pathParams = {
|
||||
regionId: regionId
|
||||
}
|
||||
|
||||
let headerParams = {
|
||||
'User-Agent': 'JdcloudSdkNode/1.0.0 assistant/1.0.2'
|
||||
}
|
||||
|
||||
let contentTypes = ['application/json']
|
||||
let accepts = ['application/json']
|
||||
|
||||
// 扩展自定义头
|
||||
if (opts['x-extra-header']) {
|
||||
for (let extraHeader in opts['x-extra-header']) {
|
||||
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
||||
contentTypes = opts['x-extra-header']['content-type']
|
||||
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
||||
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
||||
accepts = opts['x-extra-header']['accept']
|
||||
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
||||
accepts = opts['x-extra-header']['accept'].split(',')
|
||||
}
|
||||
}
|
||||
|
||||
let formParams = {}
|
||||
|
||||
let returnType = null
|
||||
|
||||
this.config.logger(
|
||||
`call deleteCommands with params:\npathParams:${JSON.stringify(
|
||||
pathParams
|
||||
)},\nqueryParams:${JSON.stringify(
|
||||
queryParams
|
||||
)}, \nheaderParams:${JSON.stringify(
|
||||
headerParams
|
||||
)}, \nformParams:${JSON.stringify(
|
||||
formParams
|
||||
)}, \npostBody:${JSON.stringify(postBody)}`,
|
||||
'DEBUG'
|
||||
)
|
||||
|
||||
let request = super.makeRequest(
|
||||
'/regions/{regionId}/deleteCommands',
|
||||
'POST',
|
||||
pathParams,
|
||||
queryParams,
|
||||
headerParams,
|
||||
formParams,
|
||||
postBody,
|
||||
contentTypes,
|
||||
accepts,
|
||||
returnType,
|
||||
callback
|
||||
)
|
||||
|
||||
return request.then(
|
||||
function (result) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(null, result)
|
||||
}
|
||||
return result
|
||||
},
|
||||
function (error) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(error)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
执行用户保存的自定义命令。
|
||||
|
||||
详细操作说明请参考帮助文档:[用户自定义命令概述](https://docs.jdcloud.com/cn/virtual-machines/assistant-overview)
|
||||
|
||||
## 接口说明
|
||||
- 该接口用于执行用户保存的自定义命令。
|
||||
|
||||
* @param {Object} opts - parameters
|
||||
* @param {string} opts.commandId - 命令Id
|
||||
|
||||
* @param {array} [opts.instances] - 运行该命令的云主机,与tags查到云主机取并集,一次最多云主机数50
|
||||
optional
|
||||
* @param {array} [opts.tags] - 根据tags确定运行该命令的云主机,与指定instances云主机取并集,一次最多云主机数50
|
||||
optional
|
||||
* @param {string} [opts.execTime] - 配置运行该命令的时刻,格式`yyyy-MM-dd HH:mm:ss`。不传该参数,立即执行命令。默认为空,可配置的时间范围为`当前时间+10minute`~`当前时间+6month`。
|
||||
optional
|
||||
* @param {integer} [opts.timeout] - 超时时间,取值范围:[10, 86400], 超过该时间后,尚未执行完的命令会置为失败。默认60s
|
||||
optional
|
||||
* @param {string} [opts.username] - 用户名,执行该命令时的用户身份。在linux上默认是root,windows上默认是administrator。长度小于256
|
||||
optional
|
||||
* @param {string} [opts.workdir] - 命令执行路径,在linux上默认为用户的home目录:/root, 在windows上默认为:C:\Windows\system32
|
||||
optional
|
||||
* @param {string} [opts.windowsPassword] - 和用户名相匹配的密码,仅适用于windows系统
|
||||
optional
|
||||
* @param {boolean} [opts.enableParameter] - 脚本中是否启用参数,true:启用,false:不启用。
|
||||
optional
|
||||
* @param {array} [opts.parameters] - 用户自定义参数和对应的参数值,数量不超过20。
|
||||
optional
|
||||
* @param {string} regionId - ID of the region
|
||||
* @param {string} callback - callback
|
||||
@return {Object} result
|
||||
* @param string invokeId 命令调用Id。
|
||||
*/
|
||||
|
||||
invokeCommand (opts, regionId = this.config.regionId, callback) {
|
||||
if (typeof regionId === 'function') {
|
||||
callback = regionId
|
||||
regionId = this.config.regionId
|
||||
}
|
||||
|
||||
if (regionId === undefined || regionId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'regionId' when calling invokeCommand"
|
||||
)
|
||||
}
|
||||
|
||||
opts = opts || {}
|
||||
|
||||
if (opts.commandId === undefined || opts.commandId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'opts.commandId' when calling invokeCommand"
|
||||
)
|
||||
}
|
||||
|
||||
let postBody = {}
|
||||
if (opts.commandId !== undefined && opts.commandId !== null) {
|
||||
postBody['commandId'] = opts.commandId
|
||||
}
|
||||
if (opts.instances !== undefined && opts.instances !== null) {
|
||||
postBody['instances'] = opts.instances
|
||||
}
|
||||
if (opts.tags !== undefined && opts.tags !== null) {
|
||||
postBody['tags'] = opts.tags
|
||||
}
|
||||
if (opts.execTime !== undefined && opts.execTime !== null) {
|
||||
postBody['execTime'] = opts.execTime
|
||||
}
|
||||
if (opts.timeout !== undefined && opts.timeout !== null) {
|
||||
postBody['timeout'] = opts.timeout
|
||||
}
|
||||
if (opts.username !== undefined && opts.username !== null) {
|
||||
postBody['username'] = opts.username
|
||||
}
|
||||
if (opts.workdir !== undefined && opts.workdir !== null) {
|
||||
postBody['workdir'] = opts.workdir
|
||||
}
|
||||
if (opts.windowsPassword !== undefined && opts.windowsPassword !== null) {
|
||||
postBody['windowsPassword'] = opts.windowsPassword
|
||||
}
|
||||
if (opts.enableParameter !== undefined && opts.enableParameter !== null) {
|
||||
postBody['enableParameter'] = opts.enableParameter
|
||||
}
|
||||
if (opts.parameters !== undefined && opts.parameters !== null) {
|
||||
postBody['parameters'] = opts.parameters
|
||||
}
|
||||
|
||||
let queryParams = {}
|
||||
|
||||
let pathParams = {
|
||||
regionId: regionId
|
||||
}
|
||||
|
||||
let headerParams = {
|
||||
'User-Agent': 'JdcloudSdkNode/1.0.0 assistant/1.0.2'
|
||||
}
|
||||
|
||||
let contentTypes = ['application/json']
|
||||
let accepts = ['application/json']
|
||||
|
||||
// 扩展自定义头
|
||||
if (opts['x-extra-header']) {
|
||||
for (let extraHeader in opts['x-extra-header']) {
|
||||
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
||||
contentTypes = opts['x-extra-header']['content-type']
|
||||
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
||||
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
||||
accepts = opts['x-extra-header']['accept']
|
||||
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
||||
accepts = opts['x-extra-header']['accept'].split(',')
|
||||
}
|
||||
}
|
||||
|
||||
let formParams = {}
|
||||
|
||||
let returnType = null
|
||||
|
||||
this.config.logger(
|
||||
`call invokeCommand with params:\npathParams:${JSON.stringify(
|
||||
pathParams
|
||||
)},\nqueryParams:${JSON.stringify(
|
||||
queryParams
|
||||
)}, \nheaderParams:${JSON.stringify(
|
||||
headerParams
|
||||
)}, \nformParams:${JSON.stringify(
|
||||
formParams
|
||||
)}, \npostBody:${JSON.stringify(postBody)}`,
|
||||
'DEBUG'
|
||||
)
|
||||
|
||||
let request = super.makeRequest(
|
||||
'/regions/{regionId}/invokeCommand',
|
||||
'POST',
|
||||
pathParams,
|
||||
queryParams,
|
||||
headerParams,
|
||||
formParams,
|
||||
postBody,
|
||||
contentTypes,
|
||||
accepts,
|
||||
returnType,
|
||||
callback
|
||||
)
|
||||
|
||||
return request.then(
|
||||
function (result) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(null, result)
|
||||
}
|
||||
return result
|
||||
},
|
||||
function (error) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(error)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
查询命令调用。
|
||||
|
||||
详细操作说明请参考帮助文档:[用户自定义命令概述](https://docs.jdcloud.com/cn/virtual-machines/assistant-overview)
|
||||
|
||||
## 接口说明
|
||||
- 该接口用于查询命令调用。
|
||||
|
||||
* @param {Object} opts - parameters
|
||||
* @param {integer} [opts.pageNumber] - 页数,默认是第一页,取值1
|
||||
optional
|
||||
* @param {integer} [opts.pageSize] - 每页大小,默认20, 最大100
|
||||
optional
|
||||
* @param {array} [opts.invokeIds] - 命令执行Id
|
||||
optional
|
||||
* @param {array} [opts.commandIds] - 命令Id
|
||||
optional
|
||||
* @param {array} [opts.status] - 命令执行状态
|
||||
optional
|
||||
* @param {array} [opts.commandNames] - 命令名字
|
||||
optional
|
||||
* @param {array} [opts.commandTypes] - 命令类型, shell or powershell
|
||||
optional
|
||||
* @param {array} [opts.userNames] - 命令执行用户
|
||||
optional
|
||||
* @param {string} regionId - ID of the region
|
||||
* @param {string} callback - callback
|
||||
@return {Object} result
|
||||
* @param integer totalCount 命令调用的总数
|
||||
* @param invocation invocations
|
||||
*/
|
||||
|
||||
describeInvocations (opts, regionId = this.config.regionId, callback) {
|
||||
if (typeof regionId === 'function') {
|
||||
callback = regionId
|
||||
regionId = this.config.regionId
|
||||
}
|
||||
|
||||
if (regionId === undefined || regionId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'regionId' when calling describeInvocations"
|
||||
)
|
||||
}
|
||||
|
||||
opts = opts || {}
|
||||
|
||||
let postBody = {}
|
||||
if (opts.pageNumber !== undefined && opts.pageNumber !== null) {
|
||||
postBody['pageNumber'] = opts.pageNumber
|
||||
}
|
||||
if (opts.pageSize !== undefined && opts.pageSize !== null) {
|
||||
postBody['pageSize'] = opts.pageSize
|
||||
}
|
||||
if (opts.invokeIds !== undefined && opts.invokeIds !== null) {
|
||||
postBody['invokeIds'] = opts.invokeIds
|
||||
}
|
||||
if (opts.commandIds !== undefined && opts.commandIds !== null) {
|
||||
postBody['commandIds'] = opts.commandIds
|
||||
}
|
||||
if (opts.status !== undefined && opts.status !== null) {
|
||||
postBody['status'] = opts.status
|
||||
}
|
||||
if (opts.commandNames !== undefined && opts.commandNames !== null) {
|
||||
postBody['commandNames'] = opts.commandNames
|
||||
}
|
||||
if (opts.commandTypes !== undefined && opts.commandTypes !== null) {
|
||||
postBody['commandTypes'] = opts.commandTypes
|
||||
}
|
||||
if (opts.userNames !== undefined && opts.userNames !== null) {
|
||||
postBody['userNames'] = opts.userNames
|
||||
}
|
||||
|
||||
let queryParams = {}
|
||||
|
||||
let pathParams = {
|
||||
regionId: regionId
|
||||
}
|
||||
|
||||
let headerParams = {
|
||||
'User-Agent': 'JdcloudSdkNode/1.0.0 assistant/1.0.2'
|
||||
}
|
||||
|
||||
let contentTypes = ['application/json']
|
||||
let accepts = ['application/json']
|
||||
|
||||
// 扩展自定义头
|
||||
if (opts['x-extra-header']) {
|
||||
for (let extraHeader in opts['x-extra-header']) {
|
||||
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
||||
contentTypes = opts['x-extra-header']['content-type']
|
||||
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
||||
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
||||
accepts = opts['x-extra-header']['accept']
|
||||
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
||||
accepts = opts['x-extra-header']['accept'].split(',')
|
||||
}
|
||||
}
|
||||
|
||||
let formParams = {}
|
||||
|
||||
let returnType = null
|
||||
|
||||
this.config.logger(
|
||||
`call describeInvocations with params:\npathParams:${JSON.stringify(
|
||||
pathParams
|
||||
)},\nqueryParams:${JSON.stringify(
|
||||
queryParams
|
||||
)}, \nheaderParams:${JSON.stringify(
|
||||
headerParams
|
||||
)}, \nformParams:${JSON.stringify(
|
||||
formParams
|
||||
)}, \npostBody:${JSON.stringify(postBody)}`,
|
||||
'DEBUG'
|
||||
)
|
||||
|
||||
let request = super.makeRequest(
|
||||
'/regions/{regionId}/describeInvocations',
|
||||
'POST',
|
||||
pathParams,
|
||||
queryParams,
|
||||
headerParams,
|
||||
formParams,
|
||||
postBody,
|
||||
contentTypes,
|
||||
accepts,
|
||||
returnType,
|
||||
callback
|
||||
)
|
||||
|
||||
return request.then(
|
||||
function (result) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(null, result)
|
||||
}
|
||||
return result
|
||||
},
|
||||
function (error) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(error)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
配置用户日志信息。
|
||||
|
||||
详细操作说明请参考帮助文档:[用户自定义命令概述](https://docs.jdcloud.com/cn/virtual-machines/assistant-overview)
|
||||
|
||||
## 接口说明
|
||||
- 该接口用于配置用户日志信息。
|
||||
|
||||
* @param {Object} opts - parameters
|
||||
* @param {string} [opts.logset] - 用户日志集名字
|
||||
optional
|
||||
* @param {string} opts.logtopic - 用户日志主题名字
|
||||
|
||||
* @param {string} regionId - ID of the region
|
||||
* @param {string} callback - callback
|
||||
@return {Object} result
|
||||
*/
|
||||
|
||||
addLogConfig (opts, regionId = this.config.regionId, callback) {
|
||||
if (typeof regionId === 'function') {
|
||||
callback = regionId
|
||||
regionId = this.config.regionId
|
||||
}
|
||||
|
||||
if (regionId === undefined || regionId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'regionId' when calling addLogConfig"
|
||||
)
|
||||
}
|
||||
|
||||
opts = opts || {}
|
||||
|
||||
if (opts.logtopic === undefined || opts.logtopic === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'opts.logtopic' when calling addLogConfig"
|
||||
)
|
||||
}
|
||||
|
||||
let postBody = {}
|
||||
if (opts.logset !== undefined && opts.logset !== null) {
|
||||
postBody['logset'] = opts.logset
|
||||
}
|
||||
if (opts.logtopic !== undefined && opts.logtopic !== null) {
|
||||
postBody['logtopic'] = opts.logtopic
|
||||
}
|
||||
|
||||
let queryParams = {}
|
||||
|
||||
let pathParams = {
|
||||
regionId: regionId
|
||||
}
|
||||
|
||||
let headerParams = {
|
||||
'User-Agent': 'JdcloudSdkNode/1.0.0 assistant/1.0.2'
|
||||
}
|
||||
|
||||
let contentTypes = ['application/json']
|
||||
let accepts = ['application/json']
|
||||
|
||||
// 扩展自定义头
|
||||
if (opts['x-extra-header']) {
|
||||
for (let extraHeader in opts['x-extra-header']) {
|
||||
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
||||
contentTypes = opts['x-extra-header']['content-type']
|
||||
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
||||
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
||||
accepts = opts['x-extra-header']['accept']
|
||||
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
||||
accepts = opts['x-extra-header']['accept'].split(',')
|
||||
}
|
||||
}
|
||||
|
||||
let formParams = {}
|
||||
|
||||
let returnType = null
|
||||
|
||||
this.config.logger(
|
||||
`call addLogConfig with params:\npathParams:${JSON.stringify(
|
||||
pathParams
|
||||
)},\nqueryParams:${JSON.stringify(
|
||||
queryParams
|
||||
)}, \nheaderParams:${JSON.stringify(
|
||||
headerParams
|
||||
)}, \nformParams:${JSON.stringify(
|
||||
formParams
|
||||
)}, \npostBody:${JSON.stringify(postBody)}`,
|
||||
'DEBUG'
|
||||
)
|
||||
|
||||
let request = super.makeRequest(
|
||||
'/regions/{regionId}/addLogConfig',
|
||||
'POST',
|
||||
pathParams,
|
||||
queryParams,
|
||||
headerParams,
|
||||
formParams,
|
||||
postBody,
|
||||
contentTypes,
|
||||
accepts,
|
||||
returnType,
|
||||
callback
|
||||
)
|
||||
|
||||
return request.then(
|
||||
function (result) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(null, result)
|
||||
}
|
||||
return result
|
||||
},
|
||||
function (error) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(error)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
module.exports = ASSISTANT
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,285 @@
|
||||
/*
|
||||
* Copyright 2018 JDCLOUD.COM
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http:#www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* instances
|
||||
* 续费查询实例信息接口
|
||||
*
|
||||
* OpenAPI spec version: v1
|
||||
* Contact:
|
||||
*
|
||||
* NOTE: This class is auto generated by the jdcloud code generator program.
|
||||
*/
|
||||
|
||||
require('../../../lib/node_loader')
|
||||
var JDCloud = require('../../../lib/core')
|
||||
var Service = JDCloud.Service
|
||||
var serviceId = 'bgw'
|
||||
Service._services[serviceId] = true
|
||||
|
||||
/**
|
||||
* bgw service.
|
||||
* @version 1.3.1
|
||||
*/
|
||||
|
||||
class BGW extends Service {
|
||||
constructor (options = {}) {
|
||||
options._defaultEndpoint = {}
|
||||
options._defaultEndpoint.protocol =
|
||||
options._defaultEndpoint.protocol || 'https'
|
||||
options._defaultEndpoint.host =
|
||||
options._defaultEndpoint.host || 'bgw.jdcloud-api.com'
|
||||
options.basePath = '/v1' // 默认要设为空""
|
||||
super(serviceId, options)
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改VPN隧道管理状态
|
||||
* @param {Object} opts - parameters
|
||||
* @param {string} opts.vpnTunnelId - VPN Tunnel ID
|
||||
* @param {string} opts.adminStatus - 隧道管理状态, UP, DOWN
|
||||
* @param {string} regionId - ID of the region
|
||||
* @param {string} callback - callback
|
||||
@return {Object} result
|
||||
*/
|
||||
|
||||
modifyAdminStatus (opts, regionId = this.config.regionId, callback) {
|
||||
if (typeof regionId === 'function') {
|
||||
callback = regionId
|
||||
regionId = this.config.regionId
|
||||
}
|
||||
|
||||
if (regionId === undefined || regionId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'regionId' when calling modifyAdminStatus"
|
||||
)
|
||||
}
|
||||
|
||||
opts = opts || {}
|
||||
|
||||
if (opts.vpnTunnelId === undefined || opts.vpnTunnelId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'opts.vpnTunnelId' when calling modifyAdminStatus"
|
||||
)
|
||||
}
|
||||
if (opts.adminStatus === undefined || opts.adminStatus === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'opts.adminStatus' when calling modifyAdminStatus"
|
||||
)
|
||||
}
|
||||
|
||||
let postBody = {}
|
||||
if (opts.adminStatus !== undefined && opts.adminStatus !== null) {
|
||||
postBody['adminStatus'] = opts.adminStatus
|
||||
}
|
||||
|
||||
let queryParams = {}
|
||||
|
||||
let pathParams = {
|
||||
regionId: regionId,
|
||||
vpnTunnelId: opts.vpnTunnelId
|
||||
}
|
||||
|
||||
let headerParams = {
|
||||
'User-Agent': 'JdcloudSdkNode/1.0.0 bgw/1.3.1'
|
||||
}
|
||||
|
||||
let contentTypes = ['application/json']
|
||||
let accepts = ['application/json']
|
||||
|
||||
// 扩展自定义头
|
||||
if (opts['x-extra-header']) {
|
||||
for (let extraHeader in opts['x-extra-header']) {
|
||||
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
||||
contentTypes = opts['x-extra-header']['content-type']
|
||||
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
||||
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
||||
accepts = opts['x-extra-header']['accept']
|
||||
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
||||
accepts = opts['x-extra-header']['accept'].split(',')
|
||||
}
|
||||
}
|
||||
|
||||
let formParams = {}
|
||||
|
||||
let returnType = null
|
||||
|
||||
this.config.logger(
|
||||
`call modifyAdminStatus with params:\npathParams:${JSON.stringify(
|
||||
pathParams
|
||||
)},\nqueryParams:${JSON.stringify(
|
||||
queryParams
|
||||
)}, \nheaderParams:${JSON.stringify(
|
||||
headerParams
|
||||
)}, \nformParams:${JSON.stringify(
|
||||
formParams
|
||||
)}, \npostBody:${JSON.stringify(postBody)}`,
|
||||
'DEBUG'
|
||||
)
|
||||
|
||||
let request = super.makeRequest(
|
||||
'/regions/{regionId}/vpnTunnels/{vpnTunnelId}:adminStatus',
|
||||
'POST',
|
||||
pathParams,
|
||||
queryParams,
|
||||
headerParams,
|
||||
formParams,
|
||||
postBody,
|
||||
contentTypes,
|
||||
accepts,
|
||||
returnType,
|
||||
callback
|
||||
)
|
||||
|
||||
return request.then(
|
||||
function (result) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(null, result)
|
||||
}
|
||||
return result
|
||||
},
|
||||
function (error) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(error)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询连接列表
|
||||
* @param {Object} opts - parameters
|
||||
* @param {integer} [opts.pageNumber] - 页码, 默认为1, 取值范围:[1,∞), 页码超过总页数时, 显示最后一页 optional
|
||||
* @param {integer} [opts.pageSize] - 分页大小,默认为20,取值范围:[10,100] optional
|
||||
* @param {filter} [opts.filters] - connectionIds - 连接ID列表,支持多个
|
||||
connectionNames - 连接名称列表,支持多个
|
||||
types - 类型,取值:jcloud_hosted:托管连接、jcloud_partner:合作伙伴连接、jcloud:自助连接, 支持多个
|
||||
status - Connection状态,支持单个。取值为:待审核(Ordering)、待支付(Installation_Paying)、施工中(Pending)、等待确认(Confirming)、可用(Active)、不可用(InActive)、删除中(Deleting)、已删除(Deleted)、审核未通过(Rejected)
|
||||
optional
|
||||
* @param {string} regionId - ID of the region
|
||||
* @param {string} callback - callback
|
||||
@return {Object} result
|
||||
* @param connection connections
|
||||
* @param integer totalCount 总数量
|
||||
*/
|
||||
|
||||
describeConnections (opts, regionId = this.config.regionId, callback) {
|
||||
if (typeof regionId === 'function') {
|
||||
callback = regionId
|
||||
regionId = this.config.regionId
|
||||
}
|
||||
|
||||
if (regionId === undefined || regionId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'regionId' when calling describeConnections"
|
||||
)
|
||||
}
|
||||
|
||||
opts = opts || {}
|
||||
|
||||
let postBody = null
|
||||
let queryParams = {}
|
||||
if (opts.pageNumber !== undefined && opts.pageNumber !== null) {
|
||||
queryParams['pageNumber'] = opts.pageNumber
|
||||
}
|
||||
if (opts.pageSize !== undefined && opts.pageSize !== null) {
|
||||
queryParams['pageSize'] = opts.pageSize
|
||||
}
|
||||
Object.assign(queryParams, super.buildFilterParam(opts.filters, 'filters'))
|
||||
|
||||
let pathParams = {
|
||||
regionId: regionId
|
||||
}
|
||||
|
||||
let headerParams = {
|
||||
'User-Agent': 'JdcloudSdkNode/1.0.0 bgw/1.3.1'
|
||||
}
|
||||
|
||||
let contentTypes = ['application/json']
|
||||
let accepts = ['application/json']
|
||||
|
||||
// 扩展自定义头
|
||||
if (opts['x-extra-header']) {
|
||||
for (let extraHeader in opts['x-extra-header']) {
|
||||
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
||||
contentTypes = opts['x-extra-header']['content-type']
|
||||
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
||||
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
||||
accepts = opts['x-extra-header']['accept']
|
||||
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
||||
accepts = opts['x-extra-header']['accept'].split(',')
|
||||
}
|
||||
}
|
||||
|
||||
let formParams = {}
|
||||
|
||||
let returnType = null
|
||||
|
||||
this.config.logger(
|
||||
`call describeConnections with params:\npathParams:${JSON.stringify(
|
||||
pathParams
|
||||
)},\nqueryParams:${JSON.stringify(
|
||||
queryParams
|
||||
)}, \nheaderParams:${JSON.stringify(
|
||||
headerParams
|
||||
)}, \nformParams:${JSON.stringify(
|
||||
formParams
|
||||
)}, \npostBody:${JSON.stringify(postBody)}`,
|
||||
'DEBUG'
|
||||
)
|
||||
|
||||
let request = super.makeRequest(
|
||||
'/regions/{regionId}/connections/',
|
||||
'GET',
|
||||
pathParams,
|
||||
queryParams,
|
||||
headerParams,
|
||||
formParams,
|
||||
postBody,
|
||||
contentTypes,
|
||||
accepts,
|
||||
returnType,
|
||||
callback
|
||||
)
|
||||
|
||||
return request.then(
|
||||
function (result) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(null, result)
|
||||
}
|
||||
return result
|
||||
},
|
||||
function (error) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(error)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
module.exports = BGW
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,490 @@
|
||||
/*
|
||||
* Copyright 2018 JDCLOUD.COM
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http:#www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* 页面测试检测接口
|
||||
* 京东云信用评分-OpenAPI页面测试检测接口
|
||||
*
|
||||
* OpenAPI spec version: v1
|
||||
* Contact:
|
||||
*
|
||||
* NOTE: This class is auto generated by the jdcloud code generator program.
|
||||
*/
|
||||
|
||||
require('../../../lib/node_loader')
|
||||
var JDCloud = require('../../../lib/core')
|
||||
var Service = JDCloud.Service
|
||||
var serviceId = 'bri'
|
||||
Service._services[serviceId] = true
|
||||
|
||||
/**
|
||||
* bri service.
|
||||
* @version 1.1.0
|
||||
*/
|
||||
|
||||
class BRI extends Service {
|
||||
constructor (options = {}) {
|
||||
options._defaultEndpoint = {}
|
||||
options._defaultEndpoint.protocol =
|
||||
options._defaultEndpoint.protocol || 'https'
|
||||
options._defaultEndpoint.host =
|
||||
options._defaultEndpoint.host || 'bri.jdcloud-api.com'
|
||||
options.basePath = '/v1' // 默认要设为空""
|
||||
super(serviceId, options)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取黑白名单列表
|
||||
* @param {Object} opts - parameters
|
||||
* @param {string} [opts.resourceType] - 数据类型,不传或者为空返回所有类型数据,ip-IP,phone-手机,addr-地址,card-身份,pin-账户,eid-设备 optional
|
||||
* @param {string} [opts.bwType] - 数据类型,不传或者为空返回所有类型数据,列表类型,black-黑名单,white-白名单 optional
|
||||
* @param {integer} [opts.size] - 页面大小,缺省为10 optional
|
||||
* @param {integer} [opts.index] - 起始页,缺省为1 optional
|
||||
* @param {string} regionId - ID of the region
|
||||
* @param {string} callback - callback
|
||||
@return {Object} result
|
||||
* @param integer totalCount 总量
|
||||
* @param integer index 分页-页码
|
||||
* @param integer size 分页-每页大小
|
||||
* @param bwcfg list
|
||||
*/
|
||||
|
||||
describeBWList (opts, regionId = this.config.regionId, callback) {
|
||||
if (typeof regionId === 'function') {
|
||||
callback = regionId
|
||||
regionId = this.config.regionId
|
||||
}
|
||||
|
||||
if (regionId === undefined || regionId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'regionId' when calling describeBWList"
|
||||
)
|
||||
}
|
||||
|
||||
opts = opts || {}
|
||||
|
||||
let postBody = null
|
||||
let queryParams = {}
|
||||
if (opts.resourceType !== undefined && opts.resourceType !== null) {
|
||||
queryParams['resourceType'] = opts.resourceType
|
||||
}
|
||||
if (opts.bwType !== undefined && opts.bwType !== null) {
|
||||
queryParams['bwType'] = opts.bwType
|
||||
}
|
||||
if (opts.size !== undefined && opts.size !== null) {
|
||||
queryParams['size'] = opts.size
|
||||
}
|
||||
if (opts.index !== undefined && opts.index !== null) {
|
||||
queryParams['index'] = opts.index
|
||||
}
|
||||
|
||||
let pathParams = {
|
||||
regionId: regionId
|
||||
}
|
||||
|
||||
let headerParams = {
|
||||
'User-Agent': 'JdcloudSdkNode/1.0.0 bri/1.1.0'
|
||||
}
|
||||
|
||||
let contentTypes = ['application/json']
|
||||
let accepts = ['application/json']
|
||||
|
||||
// 扩展自定义头
|
||||
if (opts['x-extra-header']) {
|
||||
for (let extraHeader in opts['x-extra-header']) {
|
||||
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
||||
contentTypes = opts['x-extra-header']['content-type']
|
||||
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
||||
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
||||
accepts = opts['x-extra-header']['accept']
|
||||
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
||||
accepts = opts['x-extra-header']['accept'].split(',')
|
||||
}
|
||||
}
|
||||
|
||||
let formParams = {}
|
||||
|
||||
let returnType = null
|
||||
|
||||
this.config.logger(
|
||||
`call describeBWList with params:\npathParams:${JSON.stringify(
|
||||
pathParams
|
||||
)},\nqueryParams:${JSON.stringify(
|
||||
queryParams
|
||||
)}, \nheaderParams:${JSON.stringify(
|
||||
headerParams
|
||||
)}, \nformParams:${JSON.stringify(
|
||||
formParams
|
||||
)}, \npostBody:${JSON.stringify(postBody)}`,
|
||||
'DEBUG'
|
||||
)
|
||||
|
||||
let request = super.makeRequest(
|
||||
'/regions/{regionId}/blackwhite:list',
|
||||
'GET',
|
||||
pathParams,
|
||||
queryParams,
|
||||
headerParams,
|
||||
formParams,
|
||||
postBody,
|
||||
contentTypes,
|
||||
accepts,
|
||||
returnType,
|
||||
callback
|
||||
)
|
||||
|
||||
return request.then(
|
||||
function (result) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(null, result)
|
||||
}
|
||||
return result
|
||||
},
|
||||
function (error) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(error)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置黑白名单
|
||||
* @param {Object} opts - parameters
|
||||
* @param {bwcfgSet} opts.req - 黑白名单数据
|
||||
* @param {string} regionId - ID of the region
|
||||
* @param {string} callback - callback
|
||||
@return {Object} result
|
||||
*/
|
||||
|
||||
setBWList (opts, regionId = this.config.regionId, callback) {
|
||||
if (typeof regionId === 'function') {
|
||||
callback = regionId
|
||||
regionId = this.config.regionId
|
||||
}
|
||||
|
||||
if (regionId === undefined || regionId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'regionId' when calling setBWList"
|
||||
)
|
||||
}
|
||||
|
||||
opts = opts || {}
|
||||
|
||||
if (opts.req === undefined || opts.req === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'opts.req' when calling setBWList"
|
||||
)
|
||||
}
|
||||
|
||||
let postBody = {}
|
||||
if (opts.req !== undefined && opts.req !== null) {
|
||||
postBody['req'] = opts.req
|
||||
}
|
||||
|
||||
let queryParams = {}
|
||||
|
||||
let pathParams = {
|
||||
regionId: regionId
|
||||
}
|
||||
|
||||
let headerParams = {
|
||||
'User-Agent': 'JdcloudSdkNode/1.0.0 bri/1.1.0'
|
||||
}
|
||||
|
||||
let contentTypes = ['application/json']
|
||||
let accepts = ['application/json']
|
||||
|
||||
// 扩展自定义头
|
||||
if (opts['x-extra-header']) {
|
||||
for (let extraHeader in opts['x-extra-header']) {
|
||||
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
||||
contentTypes = opts['x-extra-header']['content-type']
|
||||
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
||||
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
||||
accepts = opts['x-extra-header']['accept']
|
||||
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
||||
accepts = opts['x-extra-header']['accept'].split(',')
|
||||
}
|
||||
}
|
||||
|
||||
let formParams = {}
|
||||
|
||||
let returnType = null
|
||||
|
||||
this.config.logger(
|
||||
`call setBWList with params:\npathParams:${JSON.stringify(
|
||||
pathParams
|
||||
)},\nqueryParams:${JSON.stringify(
|
||||
queryParams
|
||||
)}, \nheaderParams:${JSON.stringify(
|
||||
headerParams
|
||||
)}, \nformParams:${JSON.stringify(
|
||||
formParams
|
||||
)}, \npostBody:${JSON.stringify(postBody)}`,
|
||||
'DEBUG'
|
||||
)
|
||||
|
||||
let request = super.makeRequest(
|
||||
'/regions/{regionId}/blackwhite:list',
|
||||
'POST',
|
||||
pathParams,
|
||||
queryParams,
|
||||
headerParams,
|
||||
formParams,
|
||||
postBody,
|
||||
contentTypes,
|
||||
accepts,
|
||||
returnType,
|
||||
callback
|
||||
)
|
||||
|
||||
return request.then(
|
||||
function (result) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(null, result)
|
||||
}
|
||||
return result
|
||||
},
|
||||
function (error) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(error)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除黑白名单
|
||||
* @param {Object} opts - parameters
|
||||
* @param {string} opts.id - 黑白名单ID, 多个用逗号分隔
|
||||
* @param {string} regionId - ID of the region
|
||||
* @param {string} callback - callback
|
||||
@return {Object} result
|
||||
*/
|
||||
|
||||
delBWList (opts, regionId = this.config.regionId, callback) {
|
||||
if (typeof regionId === 'function') {
|
||||
callback = regionId
|
||||
regionId = this.config.regionId
|
||||
}
|
||||
|
||||
if (regionId === undefined || regionId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'regionId' when calling delBWList"
|
||||
)
|
||||
}
|
||||
|
||||
opts = opts || {}
|
||||
|
||||
if (opts.id === undefined || opts.id === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'opts.id' when calling delBWList"
|
||||
)
|
||||
}
|
||||
|
||||
let postBody = null
|
||||
let queryParams = {}
|
||||
if (opts.id !== undefined && opts.id !== null) {
|
||||
queryParams['id'] = opts.id
|
||||
}
|
||||
|
||||
let pathParams = {
|
||||
regionId: regionId
|
||||
}
|
||||
|
||||
let headerParams = {
|
||||
'User-Agent': 'JdcloudSdkNode/1.0.0 bri/1.1.0'
|
||||
}
|
||||
|
||||
let contentTypes = ['application/json']
|
||||
let accepts = ['application/json']
|
||||
|
||||
// 扩展自定义头
|
||||
if (opts['x-extra-header']) {
|
||||
for (let extraHeader in opts['x-extra-header']) {
|
||||
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
||||
contentTypes = opts['x-extra-header']['content-type']
|
||||
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
||||
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
||||
accepts = opts['x-extra-header']['accept']
|
||||
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
||||
accepts = opts['x-extra-header']['accept'].split(',')
|
||||
}
|
||||
}
|
||||
|
||||
let formParams = {}
|
||||
|
||||
let returnType = null
|
||||
|
||||
this.config.logger(
|
||||
`call delBWList with params:\npathParams:${JSON.stringify(
|
||||
pathParams
|
||||
)},\nqueryParams:${JSON.stringify(
|
||||
queryParams
|
||||
)}, \nheaderParams:${JSON.stringify(
|
||||
headerParams
|
||||
)}, \nformParams:${JSON.stringify(
|
||||
formParams
|
||||
)}, \npostBody:${JSON.stringify(postBody)}`,
|
||||
'DEBUG'
|
||||
)
|
||||
|
||||
let request = super.makeRequest(
|
||||
'/regions/{regionId}/blackwhite:list',
|
||||
'DELETE',
|
||||
pathParams,
|
||||
queryParams,
|
||||
headerParams,
|
||||
formParams,
|
||||
postBody,
|
||||
contentTypes,
|
||||
accepts,
|
||||
returnType,
|
||||
callback
|
||||
)
|
||||
|
||||
return request.then(
|
||||
function (result) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(null, result)
|
||||
}
|
||||
return result
|
||||
},
|
||||
function (error) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(error)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取数据信用评分
|
||||
* @param {Object} opts - parameters
|
||||
* @param {} [opts.tasks] - 检测任务列表,包含一个或多个元素。每个元素是个结构体,最多可添加100元素,即最多对100个数据进行评分。每个元素的具体结构描述见creditTask。 optional
|
||||
* @param {string} callback - callback
|
||||
@return {Object} result
|
||||
* @param creditResult data
|
||||
*/
|
||||
|
||||
creditScore (opts, callback) {
|
||||
opts = opts || {}
|
||||
|
||||
let postBody = {}
|
||||
if (opts.tasks !== undefined && opts.tasks !== null) {
|
||||
postBody['tasks'] = opts.tasks
|
||||
}
|
||||
|
||||
let queryParams = {}
|
||||
|
||||
let pathParams = {
|
||||
regionId: 'jdcloud'
|
||||
}
|
||||
|
||||
let headerParams = {
|
||||
'User-Agent': 'JdcloudSdkNode/1.0.0 bri/1.1.0'
|
||||
}
|
||||
|
||||
let contentTypes = ['application/json']
|
||||
let accepts = ['application/json']
|
||||
|
||||
// 扩展自定义头
|
||||
if (opts['x-extra-header']) {
|
||||
for (let extraHeader in opts['x-extra-header']) {
|
||||
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
||||
contentTypes = opts['x-extra-header']['content-type']
|
||||
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
||||
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
||||
accepts = opts['x-extra-header']['accept']
|
||||
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
||||
accepts = opts['x-extra-header']['accept'].split(',')
|
||||
}
|
||||
}
|
||||
|
||||
let formParams = {}
|
||||
|
||||
let returnType = null
|
||||
|
||||
this.config.logger(
|
||||
`call creditScore with params:\npathParams:${JSON.stringify(
|
||||
pathParams
|
||||
)},\nqueryParams:${JSON.stringify(
|
||||
queryParams
|
||||
)}, \nheaderParams:${JSON.stringify(
|
||||
headerParams
|
||||
)}, \nformParams:${JSON.stringify(
|
||||
formParams
|
||||
)}, \npostBody:${JSON.stringify(postBody)}`,
|
||||
'DEBUG'
|
||||
)
|
||||
|
||||
let request = super.makeRequest(
|
||||
'/creditScore:check',
|
||||
'POST',
|
||||
pathParams,
|
||||
queryParams,
|
||||
headerParams,
|
||||
formParams,
|
||||
postBody,
|
||||
contentTypes,
|
||||
accepts,
|
||||
returnType,
|
||||
callback
|
||||
)
|
||||
|
||||
return request.then(
|
||||
function (result) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(null, result)
|
||||
}
|
||||
return result
|
||||
},
|
||||
function (error) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(error)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
module.exports = BRI
|
||||
@@ -0,0 +1,303 @@
|
||||
/*
|
||||
* Copyright 2018 JDCLOUD.COM
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http:#www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* 运营后台类接口
|
||||
* 京东云验证码-OpenAPI应用管理类接口
|
||||
*
|
||||
* OpenAPI spec version: v1
|
||||
* Contact:
|
||||
*
|
||||
* NOTE: This class is auto generated by the jdcloud code generator program.
|
||||
*/
|
||||
|
||||
require('../../../lib/node_loader')
|
||||
var JDCloud = require('../../../lib/core')
|
||||
var Service = JDCloud.Service
|
||||
var serviceId = 'captcha'
|
||||
Service._services[serviceId] = true
|
||||
|
||||
/**
|
||||
* captcha service.
|
||||
* @version 1.0.1
|
||||
*/
|
||||
|
||||
class CAPTCHA extends Service {
|
||||
constructor (options = {}) {
|
||||
options._defaultEndpoint = {}
|
||||
options._defaultEndpoint.protocol =
|
||||
options._defaultEndpoint.protocol || 'https'
|
||||
options._defaultEndpoint.host =
|
||||
options._defaultEndpoint.host || 'captcha.jdcloud-api.com'
|
||||
options.basePath = '/v1' // 默认要设为空""
|
||||
super(serviceId, options)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取会话id
|
||||
* @param {Object} opts - parameters
|
||||
* @param {} [opts.appId] - 应用id optional
|
||||
* @param {} [opts.sceneId] - 场景id optional
|
||||
* @param {} [opts.secret] - 密钥,从界面获取 optional
|
||||
* @param {} [opts.uuid] - uuid,ios客户端传openudid, android客户端传androidid, m, pc, wxapp客户端此值为空即可 optional
|
||||
* @param {} [opts.ip] - 客户端ip optional
|
||||
* @param {} [opts.userAgent] - 客户端userAgent optional
|
||||
* @param {} [opts.fingerPrint] - 指纹,ios和android客户端(clientType)从sdk获取, m, pc, wxapp客户端此值为空即可 optional
|
||||
* @param {} [opts.clientType] - 客户端类型, android, ios, pc, wxmapp, m optional
|
||||
* @param {} [opts.clientVersion] - 客户端版本,用户端app版本,可选 optional
|
||||
* @param {string} callback - callback
|
||||
@return {Object} result
|
||||
* @param sessionDataResp data
|
||||
*/
|
||||
|
||||
getSessionId (opts, callback) {
|
||||
opts = opts || {}
|
||||
|
||||
let postBody = {}
|
||||
if (opts.appId !== undefined && opts.appId !== null) {
|
||||
postBody['appId'] = opts.appId
|
||||
}
|
||||
if (opts.sceneId !== undefined && opts.sceneId !== null) {
|
||||
postBody['sceneId'] = opts.sceneId
|
||||
}
|
||||
if (opts.secret !== undefined && opts.secret !== null) {
|
||||
postBody['secret'] = opts.secret
|
||||
}
|
||||
if (opts.uuid !== undefined && opts.uuid !== null) {
|
||||
postBody['uuid'] = opts.uuid
|
||||
}
|
||||
if (opts.ip !== undefined && opts.ip !== null) {
|
||||
postBody['ip'] = opts.ip
|
||||
}
|
||||
if (opts.userAgent !== undefined && opts.userAgent !== null) {
|
||||
postBody['userAgent'] = opts.userAgent
|
||||
}
|
||||
if (opts.fingerPrint !== undefined && opts.fingerPrint !== null) {
|
||||
postBody['fingerPrint'] = opts.fingerPrint
|
||||
}
|
||||
if (opts.clientType !== undefined && opts.clientType !== null) {
|
||||
postBody['clientType'] = opts.clientType
|
||||
}
|
||||
if (opts.clientVersion !== undefined && opts.clientVersion !== null) {
|
||||
postBody['clientVersion'] = opts.clientVersion
|
||||
}
|
||||
|
||||
let queryParams = {}
|
||||
|
||||
let pathParams = {
|
||||
regionId: 'jdcloud'
|
||||
}
|
||||
|
||||
let headerParams = {
|
||||
'User-Agent': 'JdcloudSdkNode/1.0.0 captcha/1.0.1'
|
||||
}
|
||||
|
||||
let contentTypes = ['application/json']
|
||||
let accepts = ['application/json']
|
||||
|
||||
// 扩展自定义头
|
||||
if (opts['x-extra-header']) {
|
||||
for (let extraHeader in opts['x-extra-header']) {
|
||||
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
||||
contentTypes = opts['x-extra-header']['content-type']
|
||||
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
||||
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
||||
accepts = opts['x-extra-header']['accept']
|
||||
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
||||
accepts = opts['x-extra-header']['accept'].split(',')
|
||||
}
|
||||
}
|
||||
|
||||
let formParams = {}
|
||||
|
||||
let returnType = null
|
||||
|
||||
this.config.logger(
|
||||
`call getSessionId with params:\npathParams:${JSON.stringify(
|
||||
pathParams
|
||||
)},\nqueryParams:${JSON.stringify(
|
||||
queryParams
|
||||
)}, \nheaderParams:${JSON.stringify(
|
||||
headerParams
|
||||
)}, \nformParams:${JSON.stringify(
|
||||
formParams
|
||||
)}, \npostBody:${JSON.stringify(postBody)}`,
|
||||
'DEBUG'
|
||||
)
|
||||
|
||||
let request = super.makeRequest(
|
||||
'/captcha:getsessionid',
|
||||
'POST',
|
||||
pathParams,
|
||||
queryParams,
|
||||
headerParams,
|
||||
formParams,
|
||||
postBody,
|
||||
contentTypes,
|
||||
accepts,
|
||||
returnType,
|
||||
callback
|
||||
)
|
||||
|
||||
return request.then(
|
||||
function (result) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(null, result)
|
||||
}
|
||||
return result
|
||||
},
|
||||
function (error) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(error)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证verifyToken
|
||||
* @param {Object} opts - parameters
|
||||
* @param {} [opts.verifyToken] - 提交后台校验的token,客户端sdk获取 optional
|
||||
* @param {} [opts.sessionId] - 验证码会话id,getsessionid返回 optional
|
||||
* @param {} [opts.appId] - 应用id optional
|
||||
* @param {} [opts.sceneId] - 场景id optional
|
||||
* @param {} [opts.secret] - 密钥,从界面获取 optional
|
||||
* @param {} [opts.ip] - 客户端ip optional
|
||||
* @param {} [opts.userAgent] - 客户端userAgent optional
|
||||
* @param {} [opts.clientType] - 客户端类型, 可选值: android, ios, pc, wxapp, m optional
|
||||
* @param {} [opts.clientVersion] - 客户端版本,用户端app版本,可选 optional
|
||||
* @param {string} callback - callback
|
||||
@return {Object} result
|
||||
* @param verifyDataResp data
|
||||
*/
|
||||
|
||||
verifyToken (opts, callback) {
|
||||
opts = opts || {}
|
||||
|
||||
let postBody = {}
|
||||
if (opts.verifyToken !== undefined && opts.verifyToken !== null) {
|
||||
postBody['verifyToken'] = opts.verifyToken
|
||||
}
|
||||
if (opts.sessionId !== undefined && opts.sessionId !== null) {
|
||||
postBody['sessionId'] = opts.sessionId
|
||||
}
|
||||
if (opts.appId !== undefined && opts.appId !== null) {
|
||||
postBody['appId'] = opts.appId
|
||||
}
|
||||
if (opts.sceneId !== undefined && opts.sceneId !== null) {
|
||||
postBody['sceneId'] = opts.sceneId
|
||||
}
|
||||
if (opts.secret !== undefined && opts.secret !== null) {
|
||||
postBody['secret'] = opts.secret
|
||||
}
|
||||
if (opts.ip !== undefined && opts.ip !== null) {
|
||||
postBody['ip'] = opts.ip
|
||||
}
|
||||
if (opts.userAgent !== undefined && opts.userAgent !== null) {
|
||||
postBody['userAgent'] = opts.userAgent
|
||||
}
|
||||
if (opts.clientType !== undefined && opts.clientType !== null) {
|
||||
postBody['clientType'] = opts.clientType
|
||||
}
|
||||
if (opts.clientVersion !== undefined && opts.clientVersion !== null) {
|
||||
postBody['clientVersion'] = opts.clientVersion
|
||||
}
|
||||
|
||||
let queryParams = {}
|
||||
|
||||
let pathParams = {
|
||||
regionId: 'jdcloud'
|
||||
}
|
||||
|
||||
let headerParams = {
|
||||
'User-Agent': 'JdcloudSdkNode/1.0.0 captcha/1.0.1'
|
||||
}
|
||||
|
||||
let contentTypes = ['application/json']
|
||||
let accepts = ['application/json']
|
||||
|
||||
// 扩展自定义头
|
||||
if (opts['x-extra-header']) {
|
||||
for (let extraHeader in opts['x-extra-header']) {
|
||||
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
||||
contentTypes = opts['x-extra-header']['content-type']
|
||||
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
||||
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
||||
accepts = opts['x-extra-header']['accept']
|
||||
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
||||
accepts = opts['x-extra-header']['accept'].split(',')
|
||||
}
|
||||
}
|
||||
|
||||
let formParams = {}
|
||||
|
||||
let returnType = null
|
||||
|
||||
this.config.logger(
|
||||
`call verifyToken with params:\npathParams:${JSON.stringify(
|
||||
pathParams
|
||||
)},\nqueryParams:${JSON.stringify(
|
||||
queryParams
|
||||
)}, \nheaderParams:${JSON.stringify(
|
||||
headerParams
|
||||
)}, \nformParams:${JSON.stringify(
|
||||
formParams
|
||||
)}, \npostBody:${JSON.stringify(postBody)}`,
|
||||
'DEBUG'
|
||||
)
|
||||
|
||||
let request = super.makeRequest(
|
||||
'/captcha:verifytoken',
|
||||
'POST',
|
||||
pathParams,
|
||||
queryParams,
|
||||
headerParams,
|
||||
formParams,
|
||||
postBody,
|
||||
contentTypes,
|
||||
accepts,
|
||||
returnType,
|
||||
callback
|
||||
)
|
||||
|
||||
return request.then(
|
||||
function (result) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(null, result)
|
||||
}
|
||||
return result
|
||||
},
|
||||
function (error) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(error)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
module.exports = CAPTCHA
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,202 @@
|
||||
/*
|
||||
* Copyright 2018 JDCLOUD.COM
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http:#www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* 大屏数据查询接口
|
||||
* 陕西苹果大屏数据查询接口
|
||||
*
|
||||
* OpenAPI spec version: v1
|
||||
* Contact:
|
||||
*
|
||||
* NOTE: This class is auto generated by the jdcloud code generator program.
|
||||
*/
|
||||
|
||||
require('../../../lib/node_loader')
|
||||
var JDCloud = require('../../../lib/core')
|
||||
var Service = JDCloud.Service
|
||||
var serviceId = 'datastar'
|
||||
Service._services[serviceId] = true
|
||||
|
||||
/**
|
||||
* datastar service.
|
||||
* @version 1.0.6
|
||||
*/
|
||||
|
||||
JDCloud.DATASTAR = class DATASTAR extends Service {
|
||||
constructor (options = {}) {
|
||||
options._defaultEndpoint = {}
|
||||
options._defaultEndpoint.protocol =
|
||||
options._defaultEndpoint.protocol || 'https'
|
||||
options._defaultEndpoint.host =
|
||||
options._defaultEndpoint.host || 'datastar.cn-south-1.jdcloud-api.com'
|
||||
options.basePath = '/v1' // 默认要设为空""
|
||||
super(serviceId, options)
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据区域、行业、一级指标、二级指标、起始时间等条件查询数据
|
||||
* @param {Object} opts - parameters
|
||||
* @param {string} opts.region - 查询区域,比如某某省或某某市(可选区域以最终授权为准)
|
||||
* @param {string} opts.industry - 查询行业,比如某个水果或者农作物(可选行业以最终授权为准)
|
||||
* @param {string} opts.startDate - 查询起始时间,格式如下:yyyy-MM-dd
|
||||
* @param {string} opts.endDate - 查询结束时间,格式如下:yyyy-MM-dd
|
||||
* @param {string} opts.firstIndex - 数据对应的第一级分析指标(可选一级指标以最终授权为准)
|
||||
* @param {string} [opts.secondIndex] - 数据对应的第二级分析指标,如不填写,则默认把一级指标下的所有二级指标都查询出来(可选二级指标以最终授权为准) optional
|
||||
* @param {string} regionId - ID of the region
|
||||
* @param {string} callback - callback
|
||||
@return {Object} result
|
||||
* @param boolean status true为成功,false为失败
|
||||
* @param string message 描述信息
|
||||
* @param regionIndustryDataList data 查询数据结果
|
||||
*/
|
||||
|
||||
getLargeScreenData (opts, regionId = this.config.regionId, callback) {
|
||||
if (typeof regionId === 'function') {
|
||||
callback = regionId
|
||||
regionId = this.config.regionId
|
||||
}
|
||||
|
||||
if (regionId === undefined || regionId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'regionId' when calling getLargeScreenData"
|
||||
)
|
||||
}
|
||||
|
||||
opts = opts || {}
|
||||
|
||||
if (opts.region === undefined || opts.region === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'opts.region' when calling getLargeScreenData"
|
||||
)
|
||||
}
|
||||
if (opts.industry === undefined || opts.industry === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'opts.industry' when calling getLargeScreenData"
|
||||
)
|
||||
}
|
||||
if (opts.startDate === undefined || opts.startDate === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'opts.startDate' when calling getLargeScreenData"
|
||||
)
|
||||
}
|
||||
if (opts.endDate === undefined || opts.endDate === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'opts.endDate' when calling getLargeScreenData"
|
||||
)
|
||||
}
|
||||
if (opts.firstIndex === undefined || opts.firstIndex === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'opts.firstIndex' when calling getLargeScreenData"
|
||||
)
|
||||
}
|
||||
|
||||
let postBody = null
|
||||
let queryParams = {}
|
||||
if (opts.region !== undefined && opts.region !== null) {
|
||||
queryParams['region'] = opts.region
|
||||
}
|
||||
if (opts.industry !== undefined && opts.industry !== null) {
|
||||
queryParams['industry'] = opts.industry
|
||||
}
|
||||
if (opts.startDate !== undefined && opts.startDate !== null) {
|
||||
queryParams['startDate'] = opts.startDate
|
||||
}
|
||||
if (opts.endDate !== undefined && opts.endDate !== null) {
|
||||
queryParams['endDate'] = opts.endDate
|
||||
}
|
||||
if (opts.firstIndex !== undefined && opts.firstIndex !== null) {
|
||||
queryParams['firstIndex'] = opts.firstIndex
|
||||
}
|
||||
if (opts.secondIndex !== undefined && opts.secondIndex !== null) {
|
||||
queryParams['secondIndex'] = opts.secondIndex
|
||||
}
|
||||
|
||||
let pathParams = {
|
||||
regionId: regionId
|
||||
}
|
||||
|
||||
let headerParams = {
|
||||
'User-Agent': 'JdcloudSdkNode/1.0.0 datastar/1.0.6'
|
||||
}
|
||||
|
||||
let contentTypes = ['application/json']
|
||||
let accepts = ['application/json']
|
||||
|
||||
// 扩展自定义头
|
||||
if (opts['x-extra-header']) {
|
||||
for (let extraHeader in opts['x-extra-header']) {
|
||||
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
||||
contentTypes = opts['x-extra-header']['content-type']
|
||||
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
||||
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
||||
accepts = opts['x-extra-header']['accept']
|
||||
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
||||
accepts = opts['x-extra-header']['accept'].split(',')
|
||||
}
|
||||
}
|
||||
|
||||
let formParams = {}
|
||||
|
||||
let returnType = null
|
||||
|
||||
this.config.logger(
|
||||
`call getLargeScreenData with params:\npathParams:${JSON.stringify(
|
||||
pathParams
|
||||
)},\nqueryParams:${JSON.stringify(
|
||||
queryParams
|
||||
)}, \nheaderParams:${JSON.stringify(
|
||||
headerParams
|
||||
)}, \nformParams:${JSON.stringify(
|
||||
formParams
|
||||
)}, \npostBody:${JSON.stringify(postBody)}`,
|
||||
'DEBUG'
|
||||
)
|
||||
|
||||
let request = this.makeRequest(
|
||||
'/regions/{regionId}/largeScreen/getData',
|
||||
'GET',
|
||||
pathParams,
|
||||
queryParams,
|
||||
headerParams,
|
||||
formParams,
|
||||
postBody,
|
||||
contentTypes,
|
||||
accepts,
|
||||
returnType,
|
||||
callback
|
||||
)
|
||||
|
||||
return request.then(
|
||||
function (result) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(null, result)
|
||||
}
|
||||
return result
|
||||
},
|
||||
function (error) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(error)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
module.exports = JDCloud.DATASTAR
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,785 @@
|
||||
/*
|
||||
* Copyright 2018 JDCLOUD.COM
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http:#www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* 依赖
|
||||
* 云部署依赖相关接口
|
||||
*
|
||||
* OpenAPI spec version: v1
|
||||
* Contact:
|
||||
*
|
||||
* NOTE: This class is auto generated by the jdcloud code generator program.
|
||||
*/
|
||||
|
||||
require('../../../lib/node_loader')
|
||||
var JDCloud = require('../../../lib/core')
|
||||
var Service = JDCloud.Service
|
||||
var serviceId = 'deploy'
|
||||
Service._services[serviceId] = true
|
||||
|
||||
/**
|
||||
* deploy service.
|
||||
* @version 1.0.0
|
||||
*/
|
||||
|
||||
JDCloud.DEPLOY = class DEPLOY extends Service {
|
||||
constructor (options = {}) {
|
||||
options._defaultEndpoint = {}
|
||||
options._defaultEndpoint.protocol =
|
||||
options._defaultEndpoint.protocol || 'https'
|
||||
options._defaultEndpoint.host =
|
||||
options._defaultEndpoint.host || 'deploy.jdcloud-api.com'
|
||||
options.basePath = '/v1' // 默认要设为空""
|
||||
super(serviceId, options)
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量查询应用的信息,此接口支持分页查询,默认每页20条
|
||||
* @param {Object} opts - parameters
|
||||
* @param {integer} [opts.pageNumber] - 页码;默认为1 optional
|
||||
* @param {integer} [opts.pageSize] - 分页大小;默认为20;取值范围[10, 100] optional
|
||||
* @param {filter} [opts.filters] - appId - 应用ID,精确匹配
|
||||
appName - 应用名,精确匹配
|
||||
platform - 部署平台,精确匹配
|
||||
optional
|
||||
* @param {string} regionId - ID of the region
|
||||
* @param {string} callback - callback
|
||||
@return {Object} result
|
||||
* @param app apps
|
||||
* @param number totalCount
|
||||
*/
|
||||
|
||||
describeApps (opts, regionId = this.config.regionId, callback) {
|
||||
if (typeof regionId === 'function') {
|
||||
callback = regionId
|
||||
regionId = this.config.regionId
|
||||
}
|
||||
|
||||
if (regionId === undefined || regionId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'regionId' when calling describeApps"
|
||||
)
|
||||
}
|
||||
|
||||
opts = opts || {}
|
||||
|
||||
let postBody = null
|
||||
let queryParams = {}
|
||||
if (opts.pageNumber !== undefined && opts.pageNumber !== null) {
|
||||
queryParams['pageNumber'] = opts.pageNumber
|
||||
}
|
||||
if (opts.pageSize !== undefined && opts.pageSize !== null) {
|
||||
queryParams['pageSize'] = opts.pageSize
|
||||
}
|
||||
Object.assign(queryParams, this.buildFilterParam(opts.filters, 'filters'))
|
||||
|
||||
let pathParams = {
|
||||
regionId: regionId
|
||||
}
|
||||
|
||||
let headerParams = {
|
||||
'User-Agent': 'JdcloudSdkNode/1.0.0 deploy/1.0.0'
|
||||
}
|
||||
|
||||
let contentTypes = ['application/json']
|
||||
let accepts = ['application/json']
|
||||
|
||||
// 扩展自定义头
|
||||
if (opts['x-extra-header']) {
|
||||
for (let extraHeader in opts['x-extra-header']) {
|
||||
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
||||
contentTypes = opts['x-extra-header']['content-type']
|
||||
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
||||
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
||||
accepts = opts['x-extra-header']['accept']
|
||||
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
||||
accepts = opts['x-extra-header']['accept'].split(',')
|
||||
}
|
||||
}
|
||||
|
||||
let formParams = {}
|
||||
|
||||
let returnType = null
|
||||
|
||||
this.config.logger(
|
||||
`call describeApps with params:\npathParams:${JSON.stringify(
|
||||
pathParams
|
||||
)},\nqueryParams:${JSON.stringify(
|
||||
queryParams
|
||||
)}, \nheaderParams:${JSON.stringify(
|
||||
headerParams
|
||||
)}, \nformParams:${JSON.stringify(
|
||||
formParams
|
||||
)}, \npostBody:${JSON.stringify(postBody)}`,
|
||||
'DEBUG'
|
||||
)
|
||||
|
||||
let request = this.makeRequest(
|
||||
'/regions/{regionId}/apps',
|
||||
'GET',
|
||||
pathParams,
|
||||
queryParams,
|
||||
headerParams,
|
||||
formParams,
|
||||
postBody,
|
||||
contentTypes,
|
||||
accepts,
|
||||
returnType,
|
||||
callback
|
||||
)
|
||||
|
||||
return request.then(
|
||||
function (result) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(null, result)
|
||||
}
|
||||
return result
|
||||
},
|
||||
function (error) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(error)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询一个应用的信息
|
||||
* @param {Object} opts - parameters
|
||||
* @param {string} opts.appId - App Id
|
||||
* @param {string} regionId - ID of the region
|
||||
* @param {string} callback - callback
|
||||
@return {Object} result
|
||||
* @param app app
|
||||
*/
|
||||
|
||||
describeApp (opts, regionId = this.config.regionId, callback) {
|
||||
if (typeof regionId === 'function') {
|
||||
callback = regionId
|
||||
regionId = this.config.regionId
|
||||
}
|
||||
|
||||
if (regionId === undefined || regionId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'regionId' when calling describeApp"
|
||||
)
|
||||
}
|
||||
|
||||
opts = opts || {}
|
||||
|
||||
if (opts.appId === undefined || opts.appId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'opts.appId' when calling describeApp"
|
||||
)
|
||||
}
|
||||
|
||||
let postBody = null
|
||||
let queryParams = {}
|
||||
|
||||
let pathParams = {
|
||||
regionId: regionId,
|
||||
appId: opts.appId
|
||||
}
|
||||
|
||||
let headerParams = {
|
||||
'User-Agent': 'JdcloudSdkNode/1.0.0 deploy/1.0.0'
|
||||
}
|
||||
|
||||
let contentTypes = ['application/json']
|
||||
let accepts = ['application/json']
|
||||
|
||||
// 扩展自定义头
|
||||
if (opts['x-extra-header']) {
|
||||
for (let extraHeader in opts['x-extra-header']) {
|
||||
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
||||
contentTypes = opts['x-extra-header']['content-type']
|
||||
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
||||
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
||||
accepts = opts['x-extra-header']['accept']
|
||||
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
||||
accepts = opts['x-extra-header']['accept'].split(',')
|
||||
}
|
||||
}
|
||||
|
||||
let formParams = {}
|
||||
|
||||
let returnType = null
|
||||
|
||||
this.config.logger(
|
||||
`call describeApp with params:\npathParams:${JSON.stringify(
|
||||
pathParams
|
||||
)},\nqueryParams:${JSON.stringify(
|
||||
queryParams
|
||||
)}, \nheaderParams:${JSON.stringify(
|
||||
headerParams
|
||||
)}, \nformParams:${JSON.stringify(
|
||||
formParams
|
||||
)}, \npostBody:${JSON.stringify(postBody)}`,
|
||||
'DEBUG'
|
||||
)
|
||||
|
||||
let request = this.makeRequest(
|
||||
'/regions/{regionId}/app/{appId}',
|
||||
'GET',
|
||||
pathParams,
|
||||
queryParams,
|
||||
headerParams,
|
||||
formParams,
|
||||
postBody,
|
||||
contentTypes,
|
||||
accepts,
|
||||
returnType,
|
||||
callback
|
||||
)
|
||||
|
||||
return request.then(
|
||||
function (result) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(null, result)
|
||||
}
|
||||
return result
|
||||
},
|
||||
function (error) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(error)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建部署任务
|
||||
* @param {Object} opts - parameters
|
||||
* @param {string} opts.groupId - 部署组ID,部署组的唯一标识
|
||||
* @param {string} [opts.desc] - 描述 optional
|
||||
* @param {integer} opts.deploySource - 部署来源:1url,2云编译,3云存储
|
||||
* @param {string} [opts.deployCmd] - 部署操作 optional
|
||||
* @param {integer} [opts.cmdSource] - 1使用输入的操作,2使用程序自带操作 optional
|
||||
* @param {integer} [opts.cmdType] - 部署操作展示格式:1form,2ymal optional
|
||||
* @param {integer} [opts.productType] - 项目类型 1tomcat,2 optional
|
||||
* @param {string} [opts.downloadUrl] - 下载url optional
|
||||
* @param {string} [opts.md5] - md5 optional
|
||||
* @param {string} [opts.compileProject] - 云编译项目名 optional
|
||||
* @param {string} [opts.compileSeries] - 云编译构建序号 optional
|
||||
* @param {string} [opts.ossSpace] - 云存储空间 optional
|
||||
* @param {string} [opts.ossDir] - 云存储目录 optional
|
||||
* @param {integer} [opts.fileType] - 文件类型:1.tar,2.zip,3.tar.gz optional
|
||||
* @param {string} regionId - ID of the region
|
||||
* @param {string} callback - callback
|
||||
@return {Object} result
|
||||
* @param string deployId 上线单ID
|
||||
*/
|
||||
|
||||
createDeploy (opts, regionId = this.config.regionId, callback) {
|
||||
if (typeof regionId === 'function') {
|
||||
callback = regionId
|
||||
regionId = this.config.regionId
|
||||
}
|
||||
|
||||
if (regionId === undefined || regionId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'regionId' when calling createDeploy"
|
||||
)
|
||||
}
|
||||
|
||||
opts = opts || {}
|
||||
|
||||
if (opts.groupId === undefined || opts.groupId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'opts.groupId' when calling createDeploy"
|
||||
)
|
||||
}
|
||||
if (opts.deploySource === undefined || opts.deploySource === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'opts.deploySource' when calling createDeploy"
|
||||
)
|
||||
}
|
||||
|
||||
let postBody = {}
|
||||
if (opts.groupId !== undefined && opts.groupId !== null) {
|
||||
postBody['groupId'] = opts.groupId
|
||||
}
|
||||
if (opts.desc !== undefined && opts.desc !== null) {
|
||||
postBody['desc'] = opts.desc
|
||||
}
|
||||
if (opts.deploySource !== undefined && opts.deploySource !== null) {
|
||||
postBody['deploySource'] = opts.deploySource
|
||||
}
|
||||
if (opts.deployCmd !== undefined && opts.deployCmd !== null) {
|
||||
postBody['deployCmd'] = opts.deployCmd
|
||||
}
|
||||
if (opts.cmdSource !== undefined && opts.cmdSource !== null) {
|
||||
postBody['cmdSource'] = opts.cmdSource
|
||||
}
|
||||
if (opts.cmdType !== undefined && opts.cmdType !== null) {
|
||||
postBody['cmdType'] = opts.cmdType
|
||||
}
|
||||
if (opts.productType !== undefined && opts.productType !== null) {
|
||||
postBody['productType'] = opts.productType
|
||||
}
|
||||
if (opts.downloadUrl !== undefined && opts.downloadUrl !== null) {
|
||||
postBody['downloadUrl'] = opts.downloadUrl
|
||||
}
|
||||
if (opts.md5 !== undefined && opts.md5 !== null) {
|
||||
postBody['md5'] = opts.md5
|
||||
}
|
||||
if (opts.compileProject !== undefined && opts.compileProject !== null) {
|
||||
postBody['compileProject'] = opts.compileProject
|
||||
}
|
||||
if (opts.compileSeries !== undefined && opts.compileSeries !== null) {
|
||||
postBody['compileSeries'] = opts.compileSeries
|
||||
}
|
||||
if (opts.ossSpace !== undefined && opts.ossSpace !== null) {
|
||||
postBody['ossSpace'] = opts.ossSpace
|
||||
}
|
||||
if (opts.ossDir !== undefined && opts.ossDir !== null) {
|
||||
postBody['ossDir'] = opts.ossDir
|
||||
}
|
||||
if (opts.fileType !== undefined && opts.fileType !== null) {
|
||||
postBody['fileType'] = opts.fileType
|
||||
}
|
||||
|
||||
let queryParams = {}
|
||||
|
||||
let pathParams = {
|
||||
regionId: regionId
|
||||
}
|
||||
|
||||
let headerParams = {
|
||||
'User-Agent': 'JdcloudSdkNode/1.0.0 deploy/1.0.0'
|
||||
}
|
||||
|
||||
let contentTypes = ['application/json']
|
||||
let accepts = ['application/json']
|
||||
|
||||
// 扩展自定义头
|
||||
if (opts['x-extra-header']) {
|
||||
for (let extraHeader in opts['x-extra-header']) {
|
||||
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
||||
contentTypes = opts['x-extra-header']['content-type']
|
||||
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
||||
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
||||
accepts = opts['x-extra-header']['accept']
|
||||
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
||||
accepts = opts['x-extra-header']['accept'].split(',')
|
||||
}
|
||||
}
|
||||
|
||||
let formParams = {}
|
||||
|
||||
let returnType = null
|
||||
|
||||
this.config.logger(
|
||||
`call createDeploy with params:\npathParams:${JSON.stringify(
|
||||
pathParams
|
||||
)},\nqueryParams:${JSON.stringify(
|
||||
queryParams
|
||||
)}, \nheaderParams:${JSON.stringify(
|
||||
headerParams
|
||||
)}, \nformParams:${JSON.stringify(
|
||||
formParams
|
||||
)}, \npostBody:${JSON.stringify(postBody)}`,
|
||||
'DEBUG'
|
||||
)
|
||||
|
||||
let request = this.makeRequest(
|
||||
'/regions/{regionId}/deploy',
|
||||
'POST',
|
||||
pathParams,
|
||||
queryParams,
|
||||
headerParams,
|
||||
formParams,
|
||||
postBody,
|
||||
contentTypes,
|
||||
accepts,
|
||||
returnType,
|
||||
callback
|
||||
)
|
||||
|
||||
return request.then(
|
||||
function (result) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(null, result)
|
||||
}
|
||||
return result
|
||||
},
|
||||
function (error) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(error)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询一个部署任务详情
|
||||
* @param {Object} opts - parameters
|
||||
* @param {string} opts.deployId - Deploy Id
|
||||
* @param {string} regionId - ID of the region
|
||||
* @param {string} callback - callback
|
||||
@return {Object} result
|
||||
* @param deploy deploy
|
||||
*/
|
||||
|
||||
describeDeploy (opts, regionId = this.config.regionId, callback) {
|
||||
if (typeof regionId === 'function') {
|
||||
callback = regionId
|
||||
regionId = this.config.regionId
|
||||
}
|
||||
|
||||
if (regionId === undefined || regionId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'regionId' when calling describeDeploy"
|
||||
)
|
||||
}
|
||||
|
||||
opts = opts || {}
|
||||
|
||||
if (opts.deployId === undefined || opts.deployId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'opts.deployId' when calling describeDeploy"
|
||||
)
|
||||
}
|
||||
|
||||
let postBody = null
|
||||
let queryParams = {}
|
||||
|
||||
let pathParams = {
|
||||
regionId: regionId,
|
||||
deployId: opts.deployId
|
||||
}
|
||||
|
||||
let headerParams = {
|
||||
'User-Agent': 'JdcloudSdkNode/1.0.0 deploy/1.0.0'
|
||||
}
|
||||
|
||||
let contentTypes = ['application/json']
|
||||
let accepts = ['application/json']
|
||||
|
||||
// 扩展自定义头
|
||||
if (opts['x-extra-header']) {
|
||||
for (let extraHeader in opts['x-extra-header']) {
|
||||
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
||||
contentTypes = opts['x-extra-header']['content-type']
|
||||
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
||||
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
||||
accepts = opts['x-extra-header']['accept']
|
||||
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
||||
accepts = opts['x-extra-header']['accept'].split(',')
|
||||
}
|
||||
}
|
||||
|
||||
let formParams = {}
|
||||
|
||||
let returnType = null
|
||||
|
||||
this.config.logger(
|
||||
`call describeDeploy with params:\npathParams:${JSON.stringify(
|
||||
pathParams
|
||||
)},\nqueryParams:${JSON.stringify(
|
||||
queryParams
|
||||
)}, \nheaderParams:${JSON.stringify(
|
||||
headerParams
|
||||
)}, \nformParams:${JSON.stringify(
|
||||
formParams
|
||||
)}, \npostBody:${JSON.stringify(postBody)}`,
|
||||
'DEBUG'
|
||||
)
|
||||
|
||||
let request = this.makeRequest(
|
||||
'/regions/{regionId}/deploy/{deployId}',
|
||||
'GET',
|
||||
pathParams,
|
||||
queryParams,
|
||||
headerParams,
|
||||
formParams,
|
||||
postBody,
|
||||
contentTypes,
|
||||
accepts,
|
||||
returnType,
|
||||
callback
|
||||
)
|
||||
|
||||
return request.then(
|
||||
function (result) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(null, result)
|
||||
}
|
||||
return result
|
||||
},
|
||||
function (error) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(error)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量查询部署组的信息,此接口支持分页查询,默认每页20条
|
||||
* @param {Object} opts - parameters
|
||||
* @param {integer} [opts.pageNumber] - 页码;默认为1 optional
|
||||
* @param {integer} [opts.pageSize] - 分页大小;默认为20;取值范围[10, 100] optional
|
||||
* @param {filter} [opts.filters] - appId - 应用ID,精确匹配
|
||||
groupId - 部署组ID,精确匹配
|
||||
groupName - 部署组名,精确匹配
|
||||
optional
|
||||
* @param {string} regionId - ID of the region
|
||||
* @param {string} callback - callback
|
||||
@return {Object} result
|
||||
* @param group groups
|
||||
* @param number totalCount
|
||||
*/
|
||||
|
||||
describeGroups (opts, regionId = this.config.regionId, callback) {
|
||||
if (typeof regionId === 'function') {
|
||||
callback = regionId
|
||||
regionId = this.config.regionId
|
||||
}
|
||||
|
||||
if (regionId === undefined || regionId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'regionId' when calling describeGroups"
|
||||
)
|
||||
}
|
||||
|
||||
opts = opts || {}
|
||||
|
||||
let postBody = null
|
||||
let queryParams = {}
|
||||
if (opts.pageNumber !== undefined && opts.pageNumber !== null) {
|
||||
queryParams['pageNumber'] = opts.pageNumber
|
||||
}
|
||||
if (opts.pageSize !== undefined && opts.pageSize !== null) {
|
||||
queryParams['pageSize'] = opts.pageSize
|
||||
}
|
||||
Object.assign(queryParams, this.buildFilterParam(opts.filters, 'filters'))
|
||||
|
||||
let pathParams = {
|
||||
regionId: regionId
|
||||
}
|
||||
|
||||
let headerParams = {
|
||||
'User-Agent': 'JdcloudSdkNode/1.0.0 deploy/1.0.0'
|
||||
}
|
||||
|
||||
let contentTypes = ['application/json']
|
||||
let accepts = ['application/json']
|
||||
|
||||
// 扩展自定义头
|
||||
if (opts['x-extra-header']) {
|
||||
for (let extraHeader in opts['x-extra-header']) {
|
||||
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
||||
contentTypes = opts['x-extra-header']['content-type']
|
||||
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
||||
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
||||
accepts = opts['x-extra-header']['accept']
|
||||
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
||||
accepts = opts['x-extra-header']['accept'].split(',')
|
||||
}
|
||||
}
|
||||
|
||||
let formParams = {}
|
||||
|
||||
let returnType = null
|
||||
|
||||
this.config.logger(
|
||||
`call describeGroups with params:\npathParams:${JSON.stringify(
|
||||
pathParams
|
||||
)},\nqueryParams:${JSON.stringify(
|
||||
queryParams
|
||||
)}, \nheaderParams:${JSON.stringify(
|
||||
headerParams
|
||||
)}, \nformParams:${JSON.stringify(
|
||||
formParams
|
||||
)}, \npostBody:${JSON.stringify(postBody)}`,
|
||||
'DEBUG'
|
||||
)
|
||||
|
||||
let request = this.makeRequest(
|
||||
'/regions/{regionId}/groups',
|
||||
'GET',
|
||||
pathParams,
|
||||
queryParams,
|
||||
headerParams,
|
||||
formParams,
|
||||
postBody,
|
||||
contentTypes,
|
||||
accepts,
|
||||
returnType,
|
||||
callback
|
||||
)
|
||||
|
||||
return request.then(
|
||||
function (result) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(null, result)
|
||||
}
|
||||
return result
|
||||
},
|
||||
function (error) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(error)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询一个部署组的信息
|
||||
* @param {Object} opts - parameters
|
||||
* @param {string} opts.groupId - Group Id
|
||||
* @param {string} regionId - ID of the region
|
||||
* @param {string} callback - callback
|
||||
@return {Object} result
|
||||
* @param group group
|
||||
*/
|
||||
|
||||
describeGroup (opts, regionId = this.config.regionId, callback) {
|
||||
if (typeof regionId === 'function') {
|
||||
callback = regionId
|
||||
regionId = this.config.regionId
|
||||
}
|
||||
|
||||
if (regionId === undefined || regionId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'regionId' when calling describeGroup"
|
||||
)
|
||||
}
|
||||
|
||||
opts = opts || {}
|
||||
|
||||
if (opts.groupId === undefined || opts.groupId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'opts.groupId' when calling describeGroup"
|
||||
)
|
||||
}
|
||||
|
||||
let postBody = null
|
||||
let queryParams = {}
|
||||
|
||||
let pathParams = {
|
||||
regionId: regionId,
|
||||
groupId: opts.groupId
|
||||
}
|
||||
|
||||
let headerParams = {
|
||||
'User-Agent': 'JdcloudSdkNode/1.0.0 deploy/1.0.0'
|
||||
}
|
||||
|
||||
let contentTypes = ['application/json']
|
||||
let accepts = ['application/json']
|
||||
|
||||
// 扩展自定义头
|
||||
if (opts['x-extra-header']) {
|
||||
for (let extraHeader in opts['x-extra-header']) {
|
||||
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
||||
contentTypes = opts['x-extra-header']['content-type']
|
||||
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
||||
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
||||
accepts = opts['x-extra-header']['accept']
|
||||
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
||||
accepts = opts['x-extra-header']['accept'].split(',')
|
||||
}
|
||||
}
|
||||
|
||||
let formParams = {}
|
||||
|
||||
let returnType = null
|
||||
|
||||
this.config.logger(
|
||||
`call describeGroup with params:\npathParams:${JSON.stringify(
|
||||
pathParams
|
||||
)},\nqueryParams:${JSON.stringify(
|
||||
queryParams
|
||||
)}, \nheaderParams:${JSON.stringify(
|
||||
headerParams
|
||||
)}, \nformParams:${JSON.stringify(
|
||||
formParams
|
||||
)}, \npostBody:${JSON.stringify(postBody)}`,
|
||||
'DEBUG'
|
||||
)
|
||||
|
||||
let request = this.makeRequest(
|
||||
'/regions/{regionId}/group/{groupId}',
|
||||
'GET',
|
||||
pathParams,
|
||||
queryParams,
|
||||
headerParams,
|
||||
formParams,
|
||||
postBody,
|
||||
contentTypes,
|
||||
accepts,
|
||||
returnType,
|
||||
callback
|
||||
)
|
||||
|
||||
return request.then(
|
||||
function (result) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(null, result)
|
||||
}
|
||||
return result
|
||||
},
|
||||
function (error) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(error)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
module.exports = JDCloud.DEPLOY
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,855 @@
|
||||
/*
|
||||
* Copyright 2018 JDCLOUD.COM
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http:#www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* Task related APIs
|
||||
* 云拔测-任务相关接口
|
||||
*
|
||||
* OpenAPI spec version: v3
|
||||
* Contact:
|
||||
*
|
||||
* NOTE: This class is auto generated by the jdcloud code generator program.
|
||||
*/
|
||||
|
||||
require('../../../lib/node_loader')
|
||||
var JDCloud = require('../../../lib/core')
|
||||
var Service = JDCloud.Service
|
||||
var serviceId = 'detection'
|
||||
Service._services[serviceId] = true
|
||||
|
||||
/**
|
||||
* detection service.
|
||||
* @version 3.0.0
|
||||
*/
|
||||
|
||||
class DETECTION extends Service {
|
||||
constructor (options = {}) {
|
||||
options._defaultEndpoint = {}
|
||||
options._defaultEndpoint.protocol =
|
||||
options._defaultEndpoint.protocol || 'https'
|
||||
options._defaultEndpoint.host =
|
||||
options._defaultEndpoint.host || 'detection.jdcloud-api.com'
|
||||
options.basePath = '/v3' // 默认要设为空""
|
||||
super(serviceId, options)
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询任务列表
|
||||
* @param {Object} opts - parameters
|
||||
* @param {integer} [opts.taskId] - 任务Id optional
|
||||
* @param {string} [opts.taskName] - 任务名称 模糊匹配 optional
|
||||
* @param {string} [opts.taskUrl] - 任务地址 模糊匹配 optional
|
||||
* @param {integer} [opts.taskType] - 任务类型 1、协议 2、网络 optional
|
||||
* @param {integer} [opts.protocolType] - 协议类型 1、TCP 2、UDP 3、SMTP 4、HTTP_HTTPS 5、FTP optional
|
||||
* @param {integer} [opts.taskClassify] - 任务类别 1、定时拨测 2、即时拨测 默认定时拨测 optional
|
||||
* @param {integer} [opts.taskGroupId] - 任务组ID optional
|
||||
* @param {integer} opts.pageIndex - 当前页码 需大于等于1
|
||||
* @param {integer} opts.pageSize - 每页大小 取值范围1到100
|
||||
* @param {integer} [opts.status] - 任务状态 0开启 1禁用 optional
|
||||
* @param {string} callback - callback
|
||||
@return {Object} result
|
||||
* @param boolean success
|
||||
* @param string message
|
||||
* @param integer total
|
||||
* @param task data
|
||||
*/
|
||||
|
||||
queryTasks (opts, callback) {
|
||||
opts = opts || {}
|
||||
|
||||
if (opts.pageIndex === undefined || opts.pageIndex === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'opts.pageIndex' when calling queryTasks"
|
||||
)
|
||||
}
|
||||
if (opts.pageSize === undefined || opts.pageSize === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'opts.pageSize' when calling queryTasks"
|
||||
)
|
||||
}
|
||||
|
||||
let postBody = null
|
||||
let queryParams = {}
|
||||
if (opts.taskId !== undefined && opts.taskId !== null) {
|
||||
queryParams['taskId'] = opts.taskId
|
||||
}
|
||||
if (opts.taskName !== undefined && opts.taskName !== null) {
|
||||
queryParams['taskName'] = opts.taskName
|
||||
}
|
||||
if (opts.taskUrl !== undefined && opts.taskUrl !== null) {
|
||||
queryParams['taskUrl'] = opts.taskUrl
|
||||
}
|
||||
if (opts.taskType !== undefined && opts.taskType !== null) {
|
||||
queryParams['taskType'] = opts.taskType
|
||||
}
|
||||
if (opts.protocolType !== undefined && opts.protocolType !== null) {
|
||||
queryParams['protocolType'] = opts.protocolType
|
||||
}
|
||||
if (opts.taskClassify !== undefined && opts.taskClassify !== null) {
|
||||
queryParams['taskClassify'] = opts.taskClassify
|
||||
}
|
||||
if (opts.taskGroupId !== undefined && opts.taskGroupId !== null) {
|
||||
queryParams['taskGroupId'] = opts.taskGroupId
|
||||
}
|
||||
if (opts.pageIndex !== undefined && opts.pageIndex !== null) {
|
||||
queryParams['pageIndex'] = opts.pageIndex
|
||||
}
|
||||
if (opts.pageSize !== undefined && opts.pageSize !== null) {
|
||||
queryParams['pageSize'] = opts.pageSize
|
||||
}
|
||||
if (opts.status !== undefined && opts.status !== null) {
|
||||
queryParams['status'] = opts.status
|
||||
}
|
||||
|
||||
let pathParams = {
|
||||
regionId: 'jdcloud'
|
||||
}
|
||||
|
||||
let headerParams = {
|
||||
'User-Agent': 'JdcloudSdkNode/1.0.0 detection/3.0.0'
|
||||
}
|
||||
|
||||
let contentTypes = ['application/json']
|
||||
let accepts = ['application/json']
|
||||
|
||||
// 扩展自定义头
|
||||
if (opts['x-extra-header']) {
|
||||
for (let extraHeader in opts['x-extra-header']) {
|
||||
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
||||
contentTypes = opts['x-extra-header']['content-type']
|
||||
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
||||
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
||||
accepts = opts['x-extra-header']['accept']
|
||||
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
||||
accepts = opts['x-extra-header']['accept'].split(',')
|
||||
}
|
||||
}
|
||||
|
||||
let formParams = {}
|
||||
|
||||
let returnType = null
|
||||
|
||||
this.config.logger(
|
||||
`call queryTasks with params:\npathParams:${JSON.stringify(
|
||||
pathParams
|
||||
)},\nqueryParams:${JSON.stringify(
|
||||
queryParams
|
||||
)}, \nheaderParams:${JSON.stringify(
|
||||
headerParams
|
||||
)}, \nformParams:${JSON.stringify(
|
||||
formParams
|
||||
)}, \npostBody:${JSON.stringify(postBody)}`,
|
||||
'DEBUG'
|
||||
)
|
||||
|
||||
let request = super.makeRequest(
|
||||
'/tasks',
|
||||
'GET',
|
||||
pathParams,
|
||||
queryParams,
|
||||
headerParams,
|
||||
formParams,
|
||||
postBody,
|
||||
contentTypes,
|
||||
accepts,
|
||||
returnType,
|
||||
callback
|
||||
)
|
||||
|
||||
return request.then(
|
||||
function (result) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(null, result)
|
||||
}
|
||||
return result
|
||||
},
|
||||
function (error) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(error)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询网络类型任务拨测结果
|
||||
* @param {Object} opts - parameters
|
||||
* @param {integer} opts.taskId - 任务Id
|
||||
* @param {integer} opts.startTime - 开始时间 时间戳 需小于当前时间
|
||||
* @param {integer} opts.endTime - 结束时间 时间戳 需大于开始时间
|
||||
* @param {integer} opts.pageIndex - 当前页码 需大于等于1
|
||||
* @param {integer} opts.pageSize - 每页大小 取值范围1到500
|
||||
* @param {integer} [opts.status] - 结果状态 0成功 1失败 optional
|
||||
* @param {string} callback - callback
|
||||
@return {Object} result
|
||||
* @param boolean success
|
||||
* @param string message
|
||||
* @param integer total
|
||||
* @param net data
|
||||
*/
|
||||
|
||||
queryNetworkMonitorResults (opts, callback) {
|
||||
opts = opts || {}
|
||||
|
||||
if (opts.taskId === undefined || opts.taskId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'opts.taskId' when calling queryNetworkMonitorResults"
|
||||
)
|
||||
}
|
||||
if (opts.startTime === undefined || opts.startTime === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'opts.startTime' when calling queryNetworkMonitorResults"
|
||||
)
|
||||
}
|
||||
if (opts.endTime === undefined || opts.endTime === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'opts.endTime' when calling queryNetworkMonitorResults"
|
||||
)
|
||||
}
|
||||
if (opts.pageIndex === undefined || opts.pageIndex === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'opts.pageIndex' when calling queryNetworkMonitorResults"
|
||||
)
|
||||
}
|
||||
if (opts.pageSize === undefined || opts.pageSize === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'opts.pageSize' when calling queryNetworkMonitorResults"
|
||||
)
|
||||
}
|
||||
|
||||
let postBody = null
|
||||
let queryParams = {}
|
||||
if (opts.taskId !== undefined && opts.taskId !== null) {
|
||||
queryParams['taskId'] = opts.taskId
|
||||
}
|
||||
if (opts.startTime !== undefined && opts.startTime !== null) {
|
||||
queryParams['startTime'] = opts.startTime
|
||||
}
|
||||
if (opts.endTime !== undefined && opts.endTime !== null) {
|
||||
queryParams['endTime'] = opts.endTime
|
||||
}
|
||||
if (opts.pageIndex !== undefined && opts.pageIndex !== null) {
|
||||
queryParams['pageIndex'] = opts.pageIndex
|
||||
}
|
||||
if (opts.pageSize !== undefined && opts.pageSize !== null) {
|
||||
queryParams['pageSize'] = opts.pageSize
|
||||
}
|
||||
if (opts.status !== undefined && opts.status !== null) {
|
||||
queryParams['status'] = opts.status
|
||||
}
|
||||
|
||||
let pathParams = {
|
||||
regionId: 'jdcloud'
|
||||
}
|
||||
|
||||
let headerParams = {
|
||||
'User-Agent': 'JdcloudSdkNode/1.0.0 detection/3.0.0'
|
||||
}
|
||||
|
||||
let contentTypes = ['application/json']
|
||||
let accepts = ['application/json']
|
||||
|
||||
// 扩展自定义头
|
||||
if (opts['x-extra-header']) {
|
||||
for (let extraHeader in opts['x-extra-header']) {
|
||||
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
||||
contentTypes = opts['x-extra-header']['content-type']
|
||||
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
||||
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
||||
accepts = opts['x-extra-header']['accept']
|
||||
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
||||
accepts = opts['x-extra-header']['accept'].split(',')
|
||||
}
|
||||
}
|
||||
|
||||
let formParams = {}
|
||||
|
||||
let returnType = null
|
||||
|
||||
this.config.logger(
|
||||
`call queryNetworkMonitorResults with params:\npathParams:${JSON.stringify(
|
||||
pathParams
|
||||
)},\nqueryParams:${JSON.stringify(
|
||||
queryParams
|
||||
)}, \nheaderParams:${JSON.stringify(
|
||||
headerParams
|
||||
)}, \nformParams:${JSON.stringify(
|
||||
formParams
|
||||
)}, \npostBody:${JSON.stringify(postBody)}`,
|
||||
'DEBUG'
|
||||
)
|
||||
|
||||
let request = super.makeRequest(
|
||||
'/netMonitorResult',
|
||||
'GET',
|
||||
pathParams,
|
||||
queryParams,
|
||||
headerParams,
|
||||
formParams,
|
||||
postBody,
|
||||
contentTypes,
|
||||
accepts,
|
||||
returnType,
|
||||
callback
|
||||
)
|
||||
|
||||
return request.then(
|
||||
function (result) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(null, result)
|
||||
}
|
||||
return result
|
||||
},
|
||||
function (error) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(error)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询协议类型任务拨测结果
|
||||
* @param {Object} opts - parameters
|
||||
* @param {integer} opts.taskId - 任务Id
|
||||
* @param {integer} opts.startTime - 开始时间 时间戳 需小于当前时间
|
||||
* @param {integer} opts.endTime - 结束时间 时间戳 需大于开始时间
|
||||
* @param {integer} opts.pageIndex - 当前页码 需大于等于1
|
||||
* @param {integer} opts.pageSize - 每页大小 取值范围1到500
|
||||
* @param {integer} [opts.status] - 结果状态 0成功 1失败 optional
|
||||
* @param {string} callback - callback
|
||||
@return {Object} result
|
||||
* @param boolean success
|
||||
* @param string message
|
||||
* @param integer total
|
||||
* @param protocol data
|
||||
*/
|
||||
|
||||
queryProtocolMonitorResults (opts, callback) {
|
||||
opts = opts || {}
|
||||
|
||||
if (opts.taskId === undefined || opts.taskId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'opts.taskId' when calling queryProtocolMonitorResults"
|
||||
)
|
||||
}
|
||||
if (opts.startTime === undefined || opts.startTime === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'opts.startTime' when calling queryProtocolMonitorResults"
|
||||
)
|
||||
}
|
||||
if (opts.endTime === undefined || opts.endTime === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'opts.endTime' when calling queryProtocolMonitorResults"
|
||||
)
|
||||
}
|
||||
if (opts.pageIndex === undefined || opts.pageIndex === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'opts.pageIndex' when calling queryProtocolMonitorResults"
|
||||
)
|
||||
}
|
||||
if (opts.pageSize === undefined || opts.pageSize === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'opts.pageSize' when calling queryProtocolMonitorResults"
|
||||
)
|
||||
}
|
||||
|
||||
let postBody = null
|
||||
let queryParams = {}
|
||||
if (opts.taskId !== undefined && opts.taskId !== null) {
|
||||
queryParams['taskId'] = opts.taskId
|
||||
}
|
||||
if (opts.startTime !== undefined && opts.startTime !== null) {
|
||||
queryParams['startTime'] = opts.startTime
|
||||
}
|
||||
if (opts.endTime !== undefined && opts.endTime !== null) {
|
||||
queryParams['endTime'] = opts.endTime
|
||||
}
|
||||
if (opts.pageIndex !== undefined && opts.pageIndex !== null) {
|
||||
queryParams['pageIndex'] = opts.pageIndex
|
||||
}
|
||||
if (opts.pageSize !== undefined && opts.pageSize !== null) {
|
||||
queryParams['pageSize'] = opts.pageSize
|
||||
}
|
||||
if (opts.status !== undefined && opts.status !== null) {
|
||||
queryParams['status'] = opts.status
|
||||
}
|
||||
|
||||
let pathParams = {
|
||||
regionId: 'jdcloud'
|
||||
}
|
||||
|
||||
let headerParams = {
|
||||
'User-Agent': 'JdcloudSdkNode/1.0.0 detection/3.0.0'
|
||||
}
|
||||
|
||||
let contentTypes = ['application/json']
|
||||
let accepts = ['application/json']
|
||||
|
||||
// 扩展自定义头
|
||||
if (opts['x-extra-header']) {
|
||||
for (let extraHeader in opts['x-extra-header']) {
|
||||
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
||||
contentTypes = opts['x-extra-header']['content-type']
|
||||
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
||||
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
||||
accepts = opts['x-extra-header']['accept']
|
||||
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
||||
accepts = opts['x-extra-header']['accept'].split(',')
|
||||
}
|
||||
}
|
||||
|
||||
let formParams = {}
|
||||
|
||||
let returnType = null
|
||||
|
||||
this.config.logger(
|
||||
`call queryProtocolMonitorResults with params:\npathParams:${JSON.stringify(
|
||||
pathParams
|
||||
)},\nqueryParams:${JSON.stringify(
|
||||
queryParams
|
||||
)}, \nheaderParams:${JSON.stringify(
|
||||
headerParams
|
||||
)}, \nformParams:${JSON.stringify(
|
||||
formParams
|
||||
)}, \npostBody:${JSON.stringify(postBody)}`,
|
||||
'DEBUG'
|
||||
)
|
||||
|
||||
let request = super.makeRequest(
|
||||
'/protocolMonitorResult',
|
||||
'GET',
|
||||
pathParams,
|
||||
queryParams,
|
||||
headerParams,
|
||||
formParams,
|
||||
postBody,
|
||||
contentTypes,
|
||||
accepts,
|
||||
returnType,
|
||||
callback
|
||||
)
|
||||
|
||||
return request.then(
|
||||
function (result) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(null, result)
|
||||
}
|
||||
return result
|
||||
},
|
||||
function (error) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(error)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询协议类型任务平均指标数据
|
||||
* @param {Object} opts - parameters
|
||||
* @param {integer} opts.taskId - 任务Id
|
||||
* @param {integer} opts.startTime - 开始时间 时间戳 需小于当前时间
|
||||
* @param {integer} opts.endTime - 结束时间 时间戳 需大于开始时间
|
||||
* @param {integer} [opts.duration] - 数据点间隔时间(分钟),可选5/10/15/30/60/120/180/240/300/480/720,默认为任务调度周期,需大于任务调度周期 optional
|
||||
* @param {string} callback - callback
|
||||
@return {Object} result
|
||||
* @param boolean success
|
||||
* @param string message
|
||||
* @param protocolMetric data
|
||||
*/
|
||||
|
||||
queryProtocolAvgMetrics (opts, callback) {
|
||||
opts = opts || {}
|
||||
|
||||
if (opts.taskId === undefined || opts.taskId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'opts.taskId' when calling queryProtocolAvgMetrics"
|
||||
)
|
||||
}
|
||||
if (opts.startTime === undefined || opts.startTime === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'opts.startTime' when calling queryProtocolAvgMetrics"
|
||||
)
|
||||
}
|
||||
if (opts.endTime === undefined || opts.endTime === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'opts.endTime' when calling queryProtocolAvgMetrics"
|
||||
)
|
||||
}
|
||||
|
||||
let postBody = null
|
||||
let queryParams = {}
|
||||
if (opts.taskId !== undefined && opts.taskId !== null) {
|
||||
queryParams['taskId'] = opts.taskId
|
||||
}
|
||||
if (opts.startTime !== undefined && opts.startTime !== null) {
|
||||
queryParams['startTime'] = opts.startTime
|
||||
}
|
||||
if (opts.endTime !== undefined && opts.endTime !== null) {
|
||||
queryParams['endTime'] = opts.endTime
|
||||
}
|
||||
if (opts.duration !== undefined && opts.duration !== null) {
|
||||
queryParams['duration'] = opts.duration
|
||||
}
|
||||
|
||||
let pathParams = {
|
||||
regionId: 'jdcloud'
|
||||
}
|
||||
|
||||
let headerParams = {
|
||||
'User-Agent': 'JdcloudSdkNode/1.0.0 detection/3.0.0'
|
||||
}
|
||||
|
||||
let contentTypes = ['application/json']
|
||||
let accepts = ['application/json']
|
||||
|
||||
// 扩展自定义头
|
||||
if (opts['x-extra-header']) {
|
||||
for (let extraHeader in opts['x-extra-header']) {
|
||||
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
||||
contentTypes = opts['x-extra-header']['content-type']
|
||||
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
||||
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
||||
accepts = opts['x-extra-header']['accept']
|
||||
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
||||
accepts = opts['x-extra-header']['accept'].split(',')
|
||||
}
|
||||
}
|
||||
|
||||
let formParams = {}
|
||||
|
||||
let returnType = null
|
||||
|
||||
this.config.logger(
|
||||
`call queryProtocolAvgMetrics with params:\npathParams:${JSON.stringify(
|
||||
pathParams
|
||||
)},\nqueryParams:${JSON.stringify(
|
||||
queryParams
|
||||
)}, \nheaderParams:${JSON.stringify(
|
||||
headerParams
|
||||
)}, \nformParams:${JSON.stringify(
|
||||
formParams
|
||||
)}, \npostBody:${JSON.stringify(postBody)}`,
|
||||
'DEBUG'
|
||||
)
|
||||
|
||||
let request = super.makeRequest(
|
||||
'/protocolAvgMetrics',
|
||||
'GET',
|
||||
pathParams,
|
||||
queryParams,
|
||||
headerParams,
|
||||
formParams,
|
||||
postBody,
|
||||
contentTypes,
|
||||
accepts,
|
||||
returnType,
|
||||
callback
|
||||
)
|
||||
|
||||
return request.then(
|
||||
function (result) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(null, result)
|
||||
}
|
||||
return result
|
||||
},
|
||||
function (error) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(error)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询网络类型任务平均值指标数据
|
||||
* @param {Object} opts - parameters
|
||||
* @param {integer} opts.taskId - 任务Id
|
||||
* @param {integer} opts.startTime - 开始时间 时间戳 需小于当前时间
|
||||
* @param {integer} opts.endTime - 结束时间 时间戳 需大于开始时间
|
||||
* @param {integer} [opts.duration] - 数据点间隔时间(分钟),可选5/10/15/30/60/120/180/240/300/480/720,默认为任务调度周期,需大于任务调度周期 optional
|
||||
* @param {string} callback - callback
|
||||
@return {Object} result
|
||||
* @param boolean success
|
||||
* @param string message
|
||||
* @param netMetric data
|
||||
*/
|
||||
|
||||
queryNetworkAvgMetrics (opts, callback) {
|
||||
opts = opts || {}
|
||||
|
||||
if (opts.taskId === undefined || opts.taskId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'opts.taskId' when calling queryNetworkAvgMetrics"
|
||||
)
|
||||
}
|
||||
if (opts.startTime === undefined || opts.startTime === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'opts.startTime' when calling queryNetworkAvgMetrics"
|
||||
)
|
||||
}
|
||||
if (opts.endTime === undefined || opts.endTime === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'opts.endTime' when calling queryNetworkAvgMetrics"
|
||||
)
|
||||
}
|
||||
|
||||
let postBody = null
|
||||
let queryParams = {}
|
||||
if (opts.taskId !== undefined && opts.taskId !== null) {
|
||||
queryParams['taskId'] = opts.taskId
|
||||
}
|
||||
if (opts.startTime !== undefined && opts.startTime !== null) {
|
||||
queryParams['startTime'] = opts.startTime
|
||||
}
|
||||
if (opts.endTime !== undefined && opts.endTime !== null) {
|
||||
queryParams['endTime'] = opts.endTime
|
||||
}
|
||||
if (opts.duration !== undefined && opts.duration !== null) {
|
||||
queryParams['duration'] = opts.duration
|
||||
}
|
||||
|
||||
let pathParams = {
|
||||
regionId: 'jdcloud'
|
||||
}
|
||||
|
||||
let headerParams = {
|
||||
'User-Agent': 'JdcloudSdkNode/1.0.0 detection/3.0.0'
|
||||
}
|
||||
|
||||
let contentTypes = ['application/json']
|
||||
let accepts = ['application/json']
|
||||
|
||||
// 扩展自定义头
|
||||
if (opts['x-extra-header']) {
|
||||
for (let extraHeader in opts['x-extra-header']) {
|
||||
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
||||
contentTypes = opts['x-extra-header']['content-type']
|
||||
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
||||
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
||||
accepts = opts['x-extra-header']['accept']
|
||||
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
||||
accepts = opts['x-extra-header']['accept'].split(',')
|
||||
}
|
||||
}
|
||||
|
||||
let formParams = {}
|
||||
|
||||
let returnType = null
|
||||
|
||||
this.config.logger(
|
||||
`call queryNetworkAvgMetrics with params:\npathParams:${JSON.stringify(
|
||||
pathParams
|
||||
)},\nqueryParams:${JSON.stringify(
|
||||
queryParams
|
||||
)}, \nheaderParams:${JSON.stringify(
|
||||
headerParams
|
||||
)}, \nformParams:${JSON.stringify(
|
||||
formParams
|
||||
)}, \npostBody:${JSON.stringify(postBody)}`,
|
||||
'DEBUG'
|
||||
)
|
||||
|
||||
let request = super.makeRequest(
|
||||
'/netAvgMetrics',
|
||||
'GET',
|
||||
pathParams,
|
||||
queryParams,
|
||||
headerParams,
|
||||
formParams,
|
||||
postBody,
|
||||
contentTypes,
|
||||
accepts,
|
||||
returnType,
|
||||
callback
|
||||
)
|
||||
|
||||
return request.then(
|
||||
function (result) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(null, result)
|
||||
}
|
||||
return result
|
||||
},
|
||||
function (error) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(error)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询任务成功率指标数据
|
||||
* @param {Object} opts - parameters
|
||||
* @param {integer} opts.taskId - 任务Id
|
||||
* @param {integer} opts.startTime - 开始时间 时间戳 需小于当前时间
|
||||
* @param {integer} opts.endTime - 结束时间 时间戳 需大于开始时间
|
||||
* @param {integer} [opts.duration] - 数据点间隔时间(分钟),可选5/10/15/30/60/120/180/240/300/480/720,默认为任务调度周期,需大于任务调度周期 optional
|
||||
* @param {string} callback - callback
|
||||
@return {Object} result
|
||||
* @param boolean success
|
||||
* @param string message
|
||||
* @param successRateMetric data
|
||||
*/
|
||||
|
||||
querySuccessRateMetric (opts, callback) {
|
||||
opts = opts || {}
|
||||
|
||||
if (opts.taskId === undefined || opts.taskId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'opts.taskId' when calling querySuccessRateMetric"
|
||||
)
|
||||
}
|
||||
if (opts.startTime === undefined || opts.startTime === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'opts.startTime' when calling querySuccessRateMetric"
|
||||
)
|
||||
}
|
||||
if (opts.endTime === undefined || opts.endTime === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'opts.endTime' when calling querySuccessRateMetric"
|
||||
)
|
||||
}
|
||||
|
||||
let postBody = null
|
||||
let queryParams = {}
|
||||
if (opts.taskId !== undefined && opts.taskId !== null) {
|
||||
queryParams['taskId'] = opts.taskId
|
||||
}
|
||||
if (opts.startTime !== undefined && opts.startTime !== null) {
|
||||
queryParams['startTime'] = opts.startTime
|
||||
}
|
||||
if (opts.endTime !== undefined && opts.endTime !== null) {
|
||||
queryParams['endTime'] = opts.endTime
|
||||
}
|
||||
if (opts.duration !== undefined && opts.duration !== null) {
|
||||
queryParams['duration'] = opts.duration
|
||||
}
|
||||
|
||||
let pathParams = {
|
||||
regionId: 'jdcloud'
|
||||
}
|
||||
|
||||
let headerParams = {
|
||||
'User-Agent': 'JdcloudSdkNode/1.0.0 detection/3.0.0'
|
||||
}
|
||||
|
||||
let contentTypes = ['application/json']
|
||||
let accepts = ['application/json']
|
||||
|
||||
// 扩展自定义头
|
||||
if (opts['x-extra-header']) {
|
||||
for (let extraHeader in opts['x-extra-header']) {
|
||||
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
||||
contentTypes = opts['x-extra-header']['content-type']
|
||||
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
||||
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
||||
accepts = opts['x-extra-header']['accept']
|
||||
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
||||
accepts = opts['x-extra-header']['accept'].split(',')
|
||||
}
|
||||
}
|
||||
|
||||
let formParams = {}
|
||||
|
||||
let returnType = null
|
||||
|
||||
this.config.logger(
|
||||
`call querySuccessRateMetric with params:\npathParams:${JSON.stringify(
|
||||
pathParams
|
||||
)},\nqueryParams:${JSON.stringify(
|
||||
queryParams
|
||||
)}, \nheaderParams:${JSON.stringify(
|
||||
headerParams
|
||||
)}, \nformParams:${JSON.stringify(
|
||||
formParams
|
||||
)}, \npostBody:${JSON.stringify(postBody)}`,
|
||||
'DEBUG'
|
||||
)
|
||||
|
||||
let request = super.makeRequest(
|
||||
'/successRateMetric',
|
||||
'GET',
|
||||
pathParams,
|
||||
queryParams,
|
||||
headerParams,
|
||||
formParams,
|
||||
postBody,
|
||||
contentTypes,
|
||||
accepts,
|
||||
returnType,
|
||||
callback
|
||||
)
|
||||
|
||||
return request.then(
|
||||
function (result) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(null, result)
|
||||
}
|
||||
return result
|
||||
},
|
||||
function (error) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(error)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
module.exports = DETECTION
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,333 @@
|
||||
/*
|
||||
* Copyright 2018 JDCLOUD.COM
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http:#www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* 页面测试检测接口
|
||||
* 京东云信用评分-OpenAPI页面测试检测接口
|
||||
*
|
||||
* OpenAPI spec version: v1
|
||||
* Contact:
|
||||
*
|
||||
* NOTE: This class is auto generated by the jdcloud code generator program.
|
||||
*/
|
||||
|
||||
require('../../../lib/node_loader')
|
||||
var JDCloud = require('../../../lib/core')
|
||||
var Service = JDCloud.Service
|
||||
var serviceId = 'eid'
|
||||
Service._services[serviceId] = true
|
||||
|
||||
/**
|
||||
* eid service.
|
||||
* @version 1.0.0
|
||||
*/
|
||||
|
||||
class EID extends Service {
|
||||
constructor (options = {}) {
|
||||
options._defaultEndpoint = {}
|
||||
options._defaultEndpoint.protocol =
|
||||
options._defaultEndpoint.protocol || 'https'
|
||||
options._defaultEndpoint.host =
|
||||
options._defaultEndpoint.host || 'bio-web.jdcloud.com'
|
||||
options.basePath = '/v1' // 默认要设为空""
|
||||
super(serviceId, options)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取设备评分
|
||||
* @param {Object} opts - parameters
|
||||
* @param {} [opts.tasks] - 检测任务列表,包含一个或多个元素。每个元素是个结构体,最多可添加100元素,即最多对100个设备数据进行评分。每个元素的具体结构描述见creditTask。 optional
|
||||
* @param {string} callback - callback
|
||||
@return {Object} result
|
||||
* @param eidScoreResult data
|
||||
*/
|
||||
|
||||
eidScore (opts, callback) {
|
||||
opts = opts || {}
|
||||
|
||||
let postBody = {}
|
||||
if (opts.tasks !== undefined && opts.tasks !== null) {
|
||||
postBody['tasks'] = opts.tasks
|
||||
}
|
||||
|
||||
let queryParams = {}
|
||||
|
||||
let pathParams = {
|
||||
regionId: 'jdcloud'
|
||||
}
|
||||
|
||||
let headerParams = {
|
||||
'User-Agent': 'JdcloudSdkNode/1.0.0 eid/1.0.0'
|
||||
}
|
||||
|
||||
let contentTypes = ['application/json']
|
||||
let accepts = ['application/json']
|
||||
|
||||
// 扩展自定义头
|
||||
if (opts['x-extra-header']) {
|
||||
for (let extraHeader in opts['x-extra-header']) {
|
||||
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
||||
contentTypes = opts['x-extra-header']['content-type']
|
||||
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
||||
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
||||
accepts = opts['x-extra-header']['accept']
|
||||
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
||||
accepts = opts['x-extra-header']['accept'].split(',')
|
||||
}
|
||||
}
|
||||
|
||||
let formParams = {}
|
||||
|
||||
let returnType = null
|
||||
|
||||
this.config.logger(
|
||||
`call eidScore with params:\npathParams:${JSON.stringify(
|
||||
pathParams
|
||||
)},\nqueryParams:${JSON.stringify(
|
||||
queryParams
|
||||
)}, \nheaderParams:${JSON.stringify(
|
||||
headerParams
|
||||
)}, \nformParams:${JSON.stringify(
|
||||
formParams
|
||||
)}, \npostBody:${JSON.stringify(postBody)}`,
|
||||
'DEBUG'
|
||||
)
|
||||
|
||||
let request = super.makeRequest(
|
||||
'/eidScore:check',
|
||||
'POST',
|
||||
pathParams,
|
||||
queryParams,
|
||||
headerParams,
|
||||
formParams,
|
||||
postBody,
|
||||
contentTypes,
|
||||
accepts,
|
||||
returnType,
|
||||
callback
|
||||
)
|
||||
|
||||
return request.then(
|
||||
function (result) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(null, result)
|
||||
}
|
||||
return result
|
||||
},
|
||||
function (error) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(error)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 策略下发
|
||||
* @param {Object} opts - parameters
|
||||
* @param {string} [opts.data] optional
|
||||
* @param {string} callback - callback
|
||||
@return {Object} result
|
||||
*/
|
||||
|
||||
vttok (opts, callback) {
|
||||
opts = opts || {}
|
||||
|
||||
let postBody = {}
|
||||
if (opts.data !== undefined && opts.data !== null) {
|
||||
postBody['data'] = opts.data
|
||||
}
|
||||
|
||||
let queryParams = {}
|
||||
|
||||
let pathParams = {
|
||||
regionId: 'jdcloud'
|
||||
}
|
||||
|
||||
let headerParams = {
|
||||
'User-Agent': 'JdcloudSdkNode/1.0.0 eid/1.0.0'
|
||||
}
|
||||
|
||||
let contentTypes = ['application/json']
|
||||
let accepts = ['application/json']
|
||||
|
||||
// 扩展自定义头
|
||||
if (opts['x-extra-header']) {
|
||||
for (let extraHeader in opts['x-extra-header']) {
|
||||
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
||||
contentTypes = opts['x-extra-header']['content-type']
|
||||
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
||||
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
||||
accepts = opts['x-extra-header']['accept']
|
||||
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
||||
accepts = opts['x-extra-header']['accept'].split(',')
|
||||
}
|
||||
}
|
||||
|
||||
let formParams = {}
|
||||
|
||||
let returnType = null
|
||||
|
||||
this.config.logger(
|
||||
`call vttok with params:\npathParams:${JSON.stringify(
|
||||
pathParams
|
||||
)},\nqueryParams:${JSON.stringify(
|
||||
queryParams
|
||||
)}, \nheaderParams:${JSON.stringify(
|
||||
headerParams
|
||||
)}, \nformParams:${JSON.stringify(
|
||||
formParams
|
||||
)}, \npostBody:${JSON.stringify(postBody)}`,
|
||||
'DEBUG'
|
||||
)
|
||||
|
||||
let request = super.makeRequest(
|
||||
'/sdk:vttok',
|
||||
'POST',
|
||||
pathParams,
|
||||
queryParams,
|
||||
headerParams,
|
||||
formParams,
|
||||
postBody,
|
||||
contentTypes,
|
||||
accepts,
|
||||
returnType,
|
||||
callback
|
||||
)
|
||||
|
||||
return request.then(
|
||||
function (result) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(null, result)
|
||||
}
|
||||
return result
|
||||
},
|
||||
function (error) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(error)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 设备信息上报
|
||||
* @param {Object} opts - parameters
|
||||
* @param {string} [opts.data] optional
|
||||
* @param {string} callback - callback
|
||||
@return {Object} result
|
||||
*/
|
||||
|
||||
device (opts, callback) {
|
||||
opts = opts || {}
|
||||
|
||||
let postBody = {}
|
||||
if (opts.data !== undefined && opts.data !== null) {
|
||||
postBody['data'] = opts.data
|
||||
}
|
||||
|
||||
let queryParams = {}
|
||||
|
||||
let pathParams = {
|
||||
regionId: 'jdcloud'
|
||||
}
|
||||
|
||||
let headerParams = {
|
||||
'User-Agent': 'JdcloudSdkNode/1.0.0 eid/1.0.0'
|
||||
}
|
||||
|
||||
let contentTypes = ['application/json']
|
||||
let accepts = ['application/json']
|
||||
|
||||
// 扩展自定义头
|
||||
if (opts['x-extra-header']) {
|
||||
for (let extraHeader in opts['x-extra-header']) {
|
||||
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
||||
contentTypes = opts['x-extra-header']['content-type']
|
||||
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
||||
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
||||
accepts = opts['x-extra-header']['accept']
|
||||
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
||||
accepts = opts['x-extra-header']['accept'].split(',')
|
||||
}
|
||||
}
|
||||
|
||||
let formParams = {}
|
||||
|
||||
let returnType = null
|
||||
|
||||
this.config.logger(
|
||||
`call device with params:\npathParams:${JSON.stringify(
|
||||
pathParams
|
||||
)},\nqueryParams:${JSON.stringify(
|
||||
queryParams
|
||||
)}, \nheaderParams:${JSON.stringify(
|
||||
headerParams
|
||||
)}, \nformParams:${JSON.stringify(
|
||||
formParams
|
||||
)}, \npostBody:${JSON.stringify(postBody)}`,
|
||||
'DEBUG'
|
||||
)
|
||||
|
||||
let request = super.makeRequest(
|
||||
'/sdk:device',
|
||||
'POST',
|
||||
pathParams,
|
||||
queryParams,
|
||||
headerParams,
|
||||
formParams,
|
||||
postBody,
|
||||
contentTypes,
|
||||
accepts,
|
||||
returnType,
|
||||
callback
|
||||
)
|
||||
|
||||
return request.then(
|
||||
function (result) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(null, result)
|
||||
}
|
||||
return result
|
||||
},
|
||||
function (error) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(error)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
module.exports = EID
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,771 @@
|
||||
/*
|
||||
* Copyright 2018 JDCLOUD.COM
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http:#www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* ES Snapshot API
|
||||
* es快照创建、查询,自动快照的设置、查询接口
|
||||
*
|
||||
* OpenAPI spec version: v1
|
||||
* Contact:
|
||||
*
|
||||
* NOTE: This class is auto generated by the jdcloud code generator program.
|
||||
*/
|
||||
|
||||
require('../../../lib/node_loader')
|
||||
var JDCloud = require('../../../lib/core')
|
||||
var Service = JDCloud.Service
|
||||
var serviceId = 'es'
|
||||
Service._services[serviceId] = true
|
||||
|
||||
/**
|
||||
* es service.
|
||||
* @version 1.0.1
|
||||
*/
|
||||
|
||||
JDCloud.ES = class ES extends Service {
|
||||
constructor (options = {}) {
|
||||
options._defaultEndpoint = {}
|
||||
options._defaultEndpoint.protocol =
|
||||
options._defaultEndpoint.protocol || 'https'
|
||||
options._defaultEndpoint.host =
|
||||
options._defaultEndpoint.host || 'es.jdcloud-api.com'
|
||||
options.basePath = '/v1' // 默认要设为空""
|
||||
super(serviceId, options)
|
||||
}
|
||||
|
||||
/**
|
||||
* 关闭自定义字典。同时清除用户已上传的字典
|
||||
* @param {Object} opts - parameters
|
||||
* @param {string} opts.instanceId - 实例ID
|
||||
* @param {string} regionId - ID of the region
|
||||
* @param {string} callback - callback
|
||||
@return {Object} result
|
||||
* @param string instanceId 实例ID
|
||||
*/
|
||||
|
||||
disableDicts (opts, regionId = this.config.regionId, callback) {
|
||||
if (typeof regionId === 'function') {
|
||||
callback = regionId
|
||||
regionId = this.config.regionId
|
||||
}
|
||||
|
||||
if (regionId === undefined || regionId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'regionId' when calling disableDicts"
|
||||
)
|
||||
}
|
||||
|
||||
opts = opts || {}
|
||||
|
||||
if (opts.instanceId === undefined || opts.instanceId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'opts.instanceId' when calling disableDicts"
|
||||
)
|
||||
}
|
||||
|
||||
let postBody = null
|
||||
let queryParams = {}
|
||||
|
||||
let pathParams = {
|
||||
regionId: regionId,
|
||||
instanceId: opts.instanceId
|
||||
}
|
||||
|
||||
let headerParams = {
|
||||
'User-Agent': 'JdcloudSdkNode/1.0.0 es/1.0.1'
|
||||
}
|
||||
|
||||
let contentTypes = ['application/json']
|
||||
let accepts = ['application/json']
|
||||
|
||||
// 扩展自定义头
|
||||
if (opts['x-extra-header']) {
|
||||
for (let extraHeader in opts['x-extra-header']) {
|
||||
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
||||
contentTypes = opts['x-extra-header']['content-type']
|
||||
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
||||
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
||||
accepts = opts['x-extra-header']['accept']
|
||||
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
||||
accepts = opts['x-extra-header']['accept'].split(',')
|
||||
}
|
||||
}
|
||||
|
||||
let formParams = {}
|
||||
|
||||
let returnType = null
|
||||
|
||||
this.config.logger(
|
||||
`call disableDicts with params:\npathParams:${JSON.stringify(
|
||||
pathParams
|
||||
)},\nqueryParams:${JSON.stringify(
|
||||
queryParams
|
||||
)}, \nheaderParams:${JSON.stringify(
|
||||
headerParams
|
||||
)}, \nformParams:${JSON.stringify(
|
||||
formParams
|
||||
)}, \npostBody:${JSON.stringify(postBody)}`,
|
||||
'DEBUG'
|
||||
)
|
||||
|
||||
let request = super.makeRequest(
|
||||
'/regions/{regionId}/instances/{instanceId}/dicts',
|
||||
'DELETE',
|
||||
pathParams,
|
||||
queryParams,
|
||||
headerParams,
|
||||
formParams,
|
||||
postBody,
|
||||
contentTypes,
|
||||
accepts,
|
||||
returnType,
|
||||
callback
|
||||
)
|
||||
|
||||
return request.then(
|
||||
function (result) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(null, result)
|
||||
}
|
||||
return result
|
||||
},
|
||||
function (error) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(error)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询es实例列表
|
||||
* @param {Object} opts - parameters
|
||||
* @param {integer} [opts.pageNumber] - 页码,默认1 optional
|
||||
* @param {integer} [opts.pageSize] - 分页大小,默认10 optional
|
||||
* @param {filter} [opts.filters] - 过滤条件:
|
||||
instanceId -实例Id,精确匹配,支持多个
|
||||
instanceVersion -实例版本,精确匹配,支持单个
|
||||
azId -azId,精确匹配,支持单个
|
||||
instanceName - 实例名称,模糊匹配,支持单个
|
||||
instanceStatus - 实例状态,精确匹配,支持多个(running:运行,error:错误,creating:创建中,changing:变配中,stop:已停止,processing:处理中)
|
||||
chargeMode - 计费类型,按配置postpaid_by_duration或者包年包月prepaid_by_duration
|
||||
optional
|
||||
* @param {tagFilter} [opts.tagFilters] - 标签过滤条件 optional
|
||||
* @param {string} regionId - ID of the region
|
||||
* @param {string} callback - callback
|
||||
@return {Object} result
|
||||
* @param instance instances
|
||||
* @param integer totalCount es实例总数
|
||||
*/
|
||||
|
||||
describeInstances (opts, regionId = this.config.regionId, callback) {
|
||||
if (typeof regionId === 'function') {
|
||||
callback = regionId
|
||||
regionId = this.config.regionId
|
||||
}
|
||||
|
||||
if (regionId === undefined || regionId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'regionId' when calling describeInstances"
|
||||
)
|
||||
}
|
||||
|
||||
opts = opts || {}
|
||||
|
||||
let postBody = null
|
||||
let queryParams = {}
|
||||
if (opts.pageNumber !== undefined && opts.pageNumber !== null) {
|
||||
queryParams['pageNumber'] = opts.pageNumber
|
||||
}
|
||||
if (opts.pageSize !== undefined && opts.pageSize !== null) {
|
||||
queryParams['pageSize'] = opts.pageSize
|
||||
}
|
||||
Object.assign(queryParams, super.buildFilterParam(opts.filters, 'filters'))
|
||||
Object.assign(
|
||||
queryParams,
|
||||
super.buildTagFilterParam(opts.tagFilters, 'tagFilters')
|
||||
)
|
||||
|
||||
let pathParams = {
|
||||
regionId: regionId
|
||||
}
|
||||
|
||||
let headerParams = {
|
||||
'User-Agent': 'JdcloudSdkNode/1.0.0 es/1.0.1'
|
||||
}
|
||||
|
||||
let contentTypes = ['application/json']
|
||||
let accepts = ['application/json']
|
||||
|
||||
// 扩展自定义头
|
||||
if (opts['x-extra-header']) {
|
||||
for (let extraHeader in opts['x-extra-header']) {
|
||||
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
||||
contentTypes = opts['x-extra-header']['content-type']
|
||||
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
||||
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
||||
accepts = opts['x-extra-header']['accept']
|
||||
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
||||
accepts = opts['x-extra-header']['accept'].split(',')
|
||||
}
|
||||
}
|
||||
|
||||
let formParams = {}
|
||||
|
||||
let returnType = null
|
||||
|
||||
this.config.logger(
|
||||
`call describeInstances with params:\npathParams:${JSON.stringify(
|
||||
pathParams
|
||||
)},\nqueryParams:${JSON.stringify(
|
||||
queryParams
|
||||
)}, \nheaderParams:${JSON.stringify(
|
||||
headerParams
|
||||
)}, \nformParams:${JSON.stringify(
|
||||
formParams
|
||||
)}, \npostBody:${JSON.stringify(postBody)}`,
|
||||
'DEBUG'
|
||||
)
|
||||
|
||||
let request = super.makeRequest(
|
||||
'/regions/{regionId}/instances',
|
||||
'GET',
|
||||
pathParams,
|
||||
queryParams,
|
||||
headerParams,
|
||||
formParams,
|
||||
postBody,
|
||||
contentTypes,
|
||||
accepts,
|
||||
returnType,
|
||||
callback
|
||||
)
|
||||
|
||||
return request.then(
|
||||
function (result) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(null, result)
|
||||
}
|
||||
return result
|
||||
},
|
||||
function (error) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(error)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建一个指定配置的es实例
|
||||
* @param {Object} opts - parameters
|
||||
* @param {instanceSpec} opts.instance - es实例的相关配置
|
||||
* @param {chargeSpec} [opts.charge] - 计费信息的相关配置,es只有prepaid_by_duration和postpaid_by_duration 2种计费模式 optional
|
||||
* @param {string} regionId - ID of the region
|
||||
* @param {string} callback - callback
|
||||
@return {Object} result
|
||||
* @param string orderNum 订单编号
|
||||
* @param string instanceId es实例编号
|
||||
*/
|
||||
|
||||
createInstance (opts, regionId = this.config.regionId, callback) {
|
||||
if (typeof regionId === 'function') {
|
||||
callback = regionId
|
||||
regionId = this.config.regionId
|
||||
}
|
||||
|
||||
if (regionId === undefined || regionId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'regionId' when calling createInstance"
|
||||
)
|
||||
}
|
||||
|
||||
opts = opts || {}
|
||||
|
||||
if (opts.instance === undefined || opts.instance === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'opts.instance' when calling createInstance"
|
||||
)
|
||||
}
|
||||
|
||||
let postBody = {}
|
||||
if (opts.instance !== undefined && opts.instance !== null) {
|
||||
postBody['instance'] = opts.instance
|
||||
}
|
||||
if (opts.charge !== undefined && opts.charge !== null) {
|
||||
postBody['charge'] = opts.charge
|
||||
}
|
||||
|
||||
let queryParams = {}
|
||||
|
||||
let pathParams = {
|
||||
regionId: regionId
|
||||
}
|
||||
|
||||
let headerParams = {
|
||||
'User-Agent': 'JdcloudSdkNode/1.0.0 es/1.0.1'
|
||||
}
|
||||
|
||||
let contentTypes = ['application/json']
|
||||
let accepts = ['application/json']
|
||||
|
||||
// 扩展自定义头
|
||||
if (opts['x-extra-header']) {
|
||||
for (let extraHeader in opts['x-extra-header']) {
|
||||
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
||||
contentTypes = opts['x-extra-header']['content-type']
|
||||
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
||||
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
||||
accepts = opts['x-extra-header']['accept']
|
||||
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
||||
accepts = opts['x-extra-header']['accept'].split(',')
|
||||
}
|
||||
}
|
||||
|
||||
let formParams = {}
|
||||
|
||||
let returnType = null
|
||||
|
||||
this.config.logger(
|
||||
`call createInstance with params:\npathParams:${JSON.stringify(
|
||||
pathParams
|
||||
)},\nqueryParams:${JSON.stringify(
|
||||
queryParams
|
||||
)}, \nheaderParams:${JSON.stringify(
|
||||
headerParams
|
||||
)}, \nformParams:${JSON.stringify(
|
||||
formParams
|
||||
)}, \npostBody:${JSON.stringify(postBody)}`,
|
||||
'DEBUG'
|
||||
)
|
||||
|
||||
let request = super.makeRequest(
|
||||
'/regions/{regionId}/instances',
|
||||
'POST',
|
||||
pathParams,
|
||||
queryParams,
|
||||
headerParams,
|
||||
formParams,
|
||||
postBody,
|
||||
contentTypes,
|
||||
accepts,
|
||||
returnType,
|
||||
callback
|
||||
)
|
||||
|
||||
return request.then(
|
||||
function (result) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(null, result)
|
||||
}
|
||||
return result
|
||||
},
|
||||
function (error) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(error)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询es实例的详细信息
|
||||
* @param {Object} opts - parameters
|
||||
* @param {string} opts.instanceId - 实例ID
|
||||
* @param {string} regionId - ID of the region
|
||||
* @param {string} callback - callback
|
||||
@return {Object} result
|
||||
* @param instance instance es实例详细信息
|
||||
*/
|
||||
|
||||
describeInstance (opts, regionId = this.config.regionId, callback) {
|
||||
if (typeof regionId === 'function') {
|
||||
callback = regionId
|
||||
regionId = this.config.regionId
|
||||
}
|
||||
|
||||
if (regionId === undefined || regionId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'regionId' when calling describeInstance"
|
||||
)
|
||||
}
|
||||
|
||||
opts = opts || {}
|
||||
|
||||
if (opts.instanceId === undefined || opts.instanceId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'opts.instanceId' when calling describeInstance"
|
||||
)
|
||||
}
|
||||
|
||||
let postBody = null
|
||||
let queryParams = {}
|
||||
|
||||
let pathParams = {
|
||||
regionId: regionId,
|
||||
instanceId: opts.instanceId
|
||||
}
|
||||
|
||||
let headerParams = {
|
||||
'User-Agent': 'JdcloudSdkNode/1.0.0 es/1.0.1'
|
||||
}
|
||||
|
||||
let contentTypes = ['application/json']
|
||||
let accepts = ['application/json']
|
||||
|
||||
// 扩展自定义头
|
||||
if (opts['x-extra-header']) {
|
||||
for (let extraHeader in opts['x-extra-header']) {
|
||||
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
||||
contentTypes = opts['x-extra-header']['content-type']
|
||||
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
||||
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
||||
accepts = opts['x-extra-header']['accept']
|
||||
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
||||
accepts = opts['x-extra-header']['accept'].split(',')
|
||||
}
|
||||
}
|
||||
|
||||
let formParams = {}
|
||||
|
||||
let returnType = null
|
||||
|
||||
this.config.logger(
|
||||
`call describeInstance with params:\npathParams:${JSON.stringify(
|
||||
pathParams
|
||||
)},\nqueryParams:${JSON.stringify(
|
||||
queryParams
|
||||
)}, \nheaderParams:${JSON.stringify(
|
||||
headerParams
|
||||
)}, \nformParams:${JSON.stringify(
|
||||
formParams
|
||||
)}, \npostBody:${JSON.stringify(postBody)}`,
|
||||
'DEBUG'
|
||||
)
|
||||
|
||||
let request = super.makeRequest(
|
||||
'/regions/{regionId}/instances/{instanceId}',
|
||||
'GET',
|
||||
pathParams,
|
||||
queryParams,
|
||||
headerParams,
|
||||
formParams,
|
||||
postBody,
|
||||
contentTypes,
|
||||
accepts,
|
||||
returnType,
|
||||
callback
|
||||
)
|
||||
|
||||
return request.then(
|
||||
function (result) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(null, result)
|
||||
}
|
||||
return result
|
||||
},
|
||||
function (error) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(error)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除按配置计费或包年包月已到期的es实例,包年包月未到期不可删除。
|
||||
状态为创建中和变配中的不可删除。
|
||||
|
||||
* @param {Object} opts - parameters
|
||||
* @param {string} opts.instanceId - 实例ID
|
||||
* @param {string} regionId - ID of the region
|
||||
* @param {string} callback - callback
|
||||
@return {Object} result
|
||||
*/
|
||||
|
||||
deleteInstance (opts, regionId = this.config.regionId, callback) {
|
||||
if (typeof regionId === 'function') {
|
||||
callback = regionId
|
||||
regionId = this.config.regionId
|
||||
}
|
||||
|
||||
if (regionId === undefined || regionId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'regionId' when calling deleteInstance"
|
||||
)
|
||||
}
|
||||
|
||||
opts = opts || {}
|
||||
|
||||
if (opts.instanceId === undefined || opts.instanceId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'opts.instanceId' when calling deleteInstance"
|
||||
)
|
||||
}
|
||||
|
||||
let postBody = null
|
||||
let queryParams = {}
|
||||
|
||||
let pathParams = {
|
||||
regionId: regionId,
|
||||
instanceId: opts.instanceId
|
||||
}
|
||||
|
||||
let headerParams = {
|
||||
'User-Agent': 'JdcloudSdkNode/1.0.0 es/1.0.1'
|
||||
}
|
||||
|
||||
let contentTypes = ['application/json']
|
||||
let accepts = ['application/json']
|
||||
|
||||
// 扩展自定义头
|
||||
if (opts['x-extra-header']) {
|
||||
for (let extraHeader in opts['x-extra-header']) {
|
||||
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
||||
contentTypes = opts['x-extra-header']['content-type']
|
||||
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
||||
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
||||
accepts = opts['x-extra-header']['accept']
|
||||
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
||||
accepts = opts['x-extra-header']['accept'].split(',')
|
||||
}
|
||||
}
|
||||
|
||||
let formParams = {}
|
||||
|
||||
let returnType = null
|
||||
|
||||
this.config.logger(
|
||||
`call deleteInstance with params:\npathParams:${JSON.stringify(
|
||||
pathParams
|
||||
)},\nqueryParams:${JSON.stringify(
|
||||
queryParams
|
||||
)}, \nheaderParams:${JSON.stringify(
|
||||
headerParams
|
||||
)}, \nformParams:${JSON.stringify(
|
||||
formParams
|
||||
)}, \npostBody:${JSON.stringify(postBody)}`,
|
||||
'DEBUG'
|
||||
)
|
||||
|
||||
let request = super.makeRequest(
|
||||
'/regions/{regionId}/instances/{instanceId}',
|
||||
'DELETE',
|
||||
pathParams,
|
||||
queryParams,
|
||||
headerParams,
|
||||
formParams,
|
||||
postBody,
|
||||
contentTypes,
|
||||
accepts,
|
||||
returnType,
|
||||
callback
|
||||
)
|
||||
|
||||
return request.then(
|
||||
function (result) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(null, result)
|
||||
}
|
||||
return result
|
||||
},
|
||||
function (error) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(error)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 变更es实例的配置,实例为running状态才可变更配置,每次只能变更一种且不可与原来的相同。
|
||||
实例配置(cpu核数、内存、磁盘容量、节点数量)目前只允许变大
|
||||
|
||||
* @param {Object} opts - parameters
|
||||
* @param {string} opts.instanceId - 实例ID
|
||||
* @param {string} [opts.nodeClass] - data节点规格 optional
|
||||
* @param {integer} [opts.nodeDiskGB] - data节点磁盘 optional
|
||||
* @param {integer} [opts.nodeCount] - data节点数 optional
|
||||
* @param {string} [opts.masterClass] - master节点规格 optional
|
||||
* @param {string} [opts.coordinatingClass] - coordinating节点规格 optional
|
||||
* @param {integer} [opts.coordinatingCount] - coordinating节点数 optional
|
||||
* @param {string} regionId - ID of the region
|
||||
* @param {string} callback - callback
|
||||
@return {Object} result
|
||||
* @param string orderNum 订单编号
|
||||
* @param string instanceId es实例编号
|
||||
*/
|
||||
|
||||
modifyInstanceSpec (opts, regionId = this.config.regionId, callback) {
|
||||
if (typeof regionId === 'function') {
|
||||
callback = regionId
|
||||
regionId = this.config.regionId
|
||||
}
|
||||
|
||||
if (regionId === undefined || regionId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'regionId' when calling modifyInstanceSpec"
|
||||
)
|
||||
}
|
||||
|
||||
opts = opts || {}
|
||||
|
||||
if (opts.instanceId === undefined || opts.instanceId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'opts.instanceId' when calling modifyInstanceSpec"
|
||||
)
|
||||
}
|
||||
|
||||
let postBody = {}
|
||||
if (opts.nodeClass !== undefined && opts.nodeClass !== null) {
|
||||
postBody['nodeClass'] = opts.nodeClass
|
||||
}
|
||||
if (opts.nodeDiskGB !== undefined && opts.nodeDiskGB !== null) {
|
||||
postBody['nodeDiskGB'] = opts.nodeDiskGB
|
||||
}
|
||||
if (opts.nodeCount !== undefined && opts.nodeCount !== null) {
|
||||
postBody['nodeCount'] = opts.nodeCount
|
||||
}
|
||||
if (opts.masterClass !== undefined && opts.masterClass !== null) {
|
||||
postBody['masterClass'] = opts.masterClass
|
||||
}
|
||||
if (
|
||||
opts.coordinatingClass !== undefined &&
|
||||
opts.coordinatingClass !== null
|
||||
) {
|
||||
postBody['coordinatingClass'] = opts.coordinatingClass
|
||||
}
|
||||
if (
|
||||
opts.coordinatingCount !== undefined &&
|
||||
opts.coordinatingCount !== null
|
||||
) {
|
||||
postBody['coordinatingCount'] = opts.coordinatingCount
|
||||
}
|
||||
|
||||
let queryParams = {}
|
||||
|
||||
let pathParams = {
|
||||
regionId: regionId,
|
||||
instanceId: opts.instanceId
|
||||
}
|
||||
|
||||
let headerParams = {
|
||||
'User-Agent': 'JdcloudSdkNode/1.0.0 es/1.0.1'
|
||||
}
|
||||
|
||||
let contentTypes = ['application/json']
|
||||
let accepts = ['application/json']
|
||||
|
||||
// 扩展自定义头
|
||||
if (opts['x-extra-header']) {
|
||||
for (let extraHeader in opts['x-extra-header']) {
|
||||
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
||||
contentTypes = opts['x-extra-header']['content-type']
|
||||
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
||||
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
||||
accepts = opts['x-extra-header']['accept']
|
||||
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
||||
accepts = opts['x-extra-header']['accept'].split(',')
|
||||
}
|
||||
}
|
||||
|
||||
let formParams = {}
|
||||
|
||||
let returnType = null
|
||||
|
||||
this.config.logger(
|
||||
`call modifyInstanceSpec with params:\npathParams:${JSON.stringify(
|
||||
pathParams
|
||||
)},\nqueryParams:${JSON.stringify(
|
||||
queryParams
|
||||
)}, \nheaderParams:${JSON.stringify(
|
||||
headerParams
|
||||
)}, \nformParams:${JSON.stringify(
|
||||
formParams
|
||||
)}, \npostBody:${JSON.stringify(postBody)}`,
|
||||
'DEBUG'
|
||||
)
|
||||
|
||||
let request = super.makeRequest(
|
||||
'/regions/{regionId}/instances/{instanceId}:modifyInstanceSpec',
|
||||
'POST',
|
||||
pathParams,
|
||||
queryParams,
|
||||
headerParams,
|
||||
formParams,
|
||||
postBody,
|
||||
contentTypes,
|
||||
accepts,
|
||||
returnType,
|
||||
callback
|
||||
)
|
||||
|
||||
return request.then(
|
||||
function (result) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(null, result)
|
||||
}
|
||||
return result
|
||||
},
|
||||
function (error) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(error)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
module.exports = JDCloud.ES
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,822 @@
|
||||
/*
|
||||
* Copyright 2018 JDCLOUD.COM
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http:#www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* 域名
|
||||
* httpdns OpenAPI域名接口
|
||||
*
|
||||
* OpenAPI spec version: v1
|
||||
* Contact:
|
||||
*
|
||||
* NOTE: This class is auto generated by the jdcloud code generator program.
|
||||
*/
|
||||
|
||||
require('../../../lib/node_loader')
|
||||
var JDCloud = require('../../../lib/core')
|
||||
var Service = JDCloud.Service
|
||||
var serviceId = 'httpdns'
|
||||
Service._services[serviceId] = true
|
||||
|
||||
/**
|
||||
* httpdns service.
|
||||
* @version 1.0.0
|
||||
*/
|
||||
|
||||
JDCloud.HTTPDNS = class HTTPDNS extends Service {
|
||||
constructor (options = {}) {
|
||||
options._defaultEndpoint = {}
|
||||
options._defaultEndpoint.protocol =
|
||||
options._defaultEndpoint.protocol || 'https'
|
||||
options._defaultEndpoint.host =
|
||||
options._defaultEndpoint.host || 'httpdns.jdcloud-api.com'
|
||||
options.basePath = '/v1' // 默认要设为空""
|
||||
super(serviceId, options)
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询用户名下httpdns的账户ID
|
||||
* @param {Object} opts - parameters
|
||||
* @param {string} regionId - ID of the region
|
||||
* @param {string} callback - callback
|
||||
@return {Object} result
|
||||
* @param accountId data 查询得到的账户ID结构
|
||||
*/
|
||||
|
||||
getAccountId (opts, regionId = this.config.regionId, callback) {
|
||||
if (typeof regionId === 'function') {
|
||||
callback = regionId
|
||||
regionId = this.config.regionId
|
||||
}
|
||||
|
||||
if (regionId === undefined || regionId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'regionId' when calling getAccountId"
|
||||
)
|
||||
}
|
||||
|
||||
opts = opts || {}
|
||||
|
||||
let postBody = null
|
||||
let queryParams = {}
|
||||
|
||||
let pathParams = {
|
||||
regionId: regionId
|
||||
}
|
||||
|
||||
let headerParams = {
|
||||
'User-Agent': 'JdcloudSdkNode/1.0.0 httpdns/1.0.0'
|
||||
}
|
||||
|
||||
let contentTypes = ['application/json']
|
||||
let accepts = ['application/json']
|
||||
|
||||
// 扩展自定义头
|
||||
if (opts['x-extra-header']) {
|
||||
for (let extraHeader in opts['x-extra-header']) {
|
||||
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
||||
contentTypes = opts['x-extra-header']['content-type']
|
||||
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
||||
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
||||
accepts = opts['x-extra-header']['accept']
|
||||
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
||||
accepts = opts['x-extra-header']['accept'].split(',')
|
||||
}
|
||||
}
|
||||
|
||||
let formParams = {}
|
||||
|
||||
let returnType = null
|
||||
|
||||
this.config.logger(
|
||||
`call getAccountId with params:\npathParams:${JSON.stringify(
|
||||
pathParams
|
||||
)},\nqueryParams:${JSON.stringify(
|
||||
queryParams
|
||||
)}, \nheaderParams:${JSON.stringify(
|
||||
headerParams
|
||||
)}, \nformParams:${JSON.stringify(
|
||||
formParams
|
||||
)}, \npostBody:${JSON.stringify(postBody)}`,
|
||||
'DEBUG'
|
||||
)
|
||||
|
||||
let request = this.makeRequest(
|
||||
'/regions/{regionId}/account',
|
||||
'GET',
|
||||
pathParams,
|
||||
queryParams,
|
||||
headerParams,
|
||||
formParams,
|
||||
postBody,
|
||||
contentTypes,
|
||||
accepts,
|
||||
returnType,
|
||||
callback
|
||||
)
|
||||
|
||||
return request.then(
|
||||
function (result) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(null, result)
|
||||
}
|
||||
return result
|
||||
},
|
||||
function (error) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(error)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建httpdns账户
|
||||
* @param {Object} opts - parameters
|
||||
* @param {string} regionId - ID of the region
|
||||
* @param {string} callback - callback
|
||||
@return {Object} result
|
||||
* @param account data 开户成功后得到的账户结构
|
||||
*/
|
||||
|
||||
createAccount (opts, regionId = this.config.regionId, callback) {
|
||||
if (typeof regionId === 'function') {
|
||||
callback = regionId
|
||||
regionId = this.config.regionId
|
||||
}
|
||||
|
||||
if (regionId === undefined || regionId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'regionId' when calling createAccount"
|
||||
)
|
||||
}
|
||||
|
||||
opts = opts || {}
|
||||
|
||||
let postBody = {}
|
||||
|
||||
let queryParams = {}
|
||||
|
||||
let pathParams = {
|
||||
regionId: regionId
|
||||
}
|
||||
|
||||
let headerParams = {
|
||||
'User-Agent': 'JdcloudSdkNode/1.0.0 httpdns/1.0.0'
|
||||
}
|
||||
|
||||
let contentTypes = ['application/json']
|
||||
let accepts = ['application/json']
|
||||
|
||||
// 扩展自定义头
|
||||
if (opts['x-extra-header']) {
|
||||
for (let extraHeader in opts['x-extra-header']) {
|
||||
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
||||
contentTypes = opts['x-extra-header']['content-type']
|
||||
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
||||
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
||||
accepts = opts['x-extra-header']['accept']
|
||||
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
||||
accepts = opts['x-extra-header']['accept'].split(',')
|
||||
}
|
||||
}
|
||||
|
||||
let formParams = {}
|
||||
|
||||
let returnType = null
|
||||
|
||||
this.config.logger(
|
||||
`call createAccount with params:\npathParams:${JSON.stringify(
|
||||
pathParams
|
||||
)},\nqueryParams:${JSON.stringify(
|
||||
queryParams
|
||||
)}, \nheaderParams:${JSON.stringify(
|
||||
headerParams
|
||||
)}, \nformParams:${JSON.stringify(
|
||||
formParams
|
||||
)}, \npostBody:${JSON.stringify(postBody)}`,
|
||||
'DEBUG'
|
||||
)
|
||||
|
||||
let request = this.makeRequest(
|
||||
'/regions/{regionId}/account/createAccount',
|
||||
'POST',
|
||||
pathParams,
|
||||
queryParams,
|
||||
headerParams,
|
||||
formParams,
|
||||
postBody,
|
||||
contentTypes,
|
||||
accepts,
|
||||
returnType,
|
||||
callback
|
||||
)
|
||||
|
||||
return request.then(
|
||||
function (result) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(null, result)
|
||||
}
|
||||
return result
|
||||
},
|
||||
function (error) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(error)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询httpdns账户的基本信息
|
||||
* @param {Object} opts - parameters
|
||||
* @param {string} regionId - ID of the region
|
||||
* @param {string} callback - callback
|
||||
@return {Object} result
|
||||
* @param account data 查询得到的账户结构
|
||||
*/
|
||||
|
||||
getAccountInfo (opts, regionId = this.config.regionId, callback) {
|
||||
if (typeof regionId === 'function') {
|
||||
callback = regionId
|
||||
regionId = this.config.regionId
|
||||
}
|
||||
|
||||
if (regionId === undefined || regionId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'regionId' when calling getAccountInfo"
|
||||
)
|
||||
}
|
||||
|
||||
opts = opts || {}
|
||||
|
||||
let postBody = null
|
||||
let queryParams = {}
|
||||
|
||||
let pathParams = {
|
||||
regionId: regionId
|
||||
}
|
||||
|
||||
let headerParams = {
|
||||
'User-Agent': 'JdcloudSdkNode/1.0.0 httpdns/1.0.0'
|
||||
}
|
||||
|
||||
let contentTypes = ['application/json']
|
||||
let accepts = ['application/json']
|
||||
|
||||
// 扩展自定义头
|
||||
if (opts['x-extra-header']) {
|
||||
for (let extraHeader in opts['x-extra-header']) {
|
||||
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
||||
contentTypes = opts['x-extra-header']['content-type']
|
||||
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
||||
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
||||
accepts = opts['x-extra-header']['accept']
|
||||
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
||||
accepts = opts['x-extra-header']['accept'].split(',')
|
||||
}
|
||||
}
|
||||
|
||||
let formParams = {}
|
||||
|
||||
let returnType = null
|
||||
|
||||
this.config.logger(
|
||||
`call getAccountInfo with params:\npathParams:${JSON.stringify(
|
||||
pathParams
|
||||
)},\nqueryParams:${JSON.stringify(
|
||||
queryParams
|
||||
)}, \nheaderParams:${JSON.stringify(
|
||||
headerParams
|
||||
)}, \nformParams:${JSON.stringify(
|
||||
formParams
|
||||
)}, \npostBody:${JSON.stringify(postBody)}`,
|
||||
'DEBUG'
|
||||
)
|
||||
|
||||
let request = this.makeRequest(
|
||||
'/regions/{regionId}/accountInfo',
|
||||
'GET',
|
||||
pathParams,
|
||||
queryParams,
|
||||
headerParams,
|
||||
formParams,
|
||||
postBody,
|
||||
contentTypes,
|
||||
accepts,
|
||||
returnType,
|
||||
callback
|
||||
)
|
||||
|
||||
return request.then(
|
||||
function (result) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(null, result)
|
||||
}
|
||||
return result
|
||||
},
|
||||
function (error) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(error)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建,启用,禁用httpdns服务密钥
|
||||
* @param {Object} opts - parameters
|
||||
* @param {} [opts.action] - 操作类型, create创建, enable启用, disable禁用 optional
|
||||
* @param {} [opts.key] - 操作的密钥 optional
|
||||
* @param {string} regionId - ID of the region
|
||||
* @param {string} callback - callback
|
||||
@return {Object} result
|
||||
*/
|
||||
|
||||
operateKey (opts, regionId = this.config.regionId, callback) {
|
||||
if (typeof regionId === 'function') {
|
||||
callback = regionId
|
||||
regionId = this.config.regionId
|
||||
}
|
||||
|
||||
if (regionId === undefined || regionId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'regionId' when calling operateKey"
|
||||
)
|
||||
}
|
||||
|
||||
opts = opts || {}
|
||||
|
||||
let postBody = {}
|
||||
if (opts.action !== undefined && opts.action !== null) {
|
||||
postBody['action'] = opts.action
|
||||
}
|
||||
if (opts.key !== undefined && opts.key !== null) {
|
||||
postBody['key'] = opts.key
|
||||
}
|
||||
|
||||
let queryParams = {}
|
||||
|
||||
let pathParams = {
|
||||
regionId: regionId
|
||||
}
|
||||
|
||||
let headerParams = {
|
||||
'User-Agent': 'JdcloudSdkNode/1.0.0 httpdns/1.0.0'
|
||||
}
|
||||
|
||||
let contentTypes = ['application/json']
|
||||
let accepts = ['application/json']
|
||||
|
||||
// 扩展自定义头
|
||||
if (opts['x-extra-header']) {
|
||||
for (let extraHeader in opts['x-extra-header']) {
|
||||
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
||||
contentTypes = opts['x-extra-header']['content-type']
|
||||
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
||||
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
||||
accepts = opts['x-extra-header']['accept']
|
||||
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
||||
accepts = opts['x-extra-header']['accept'].split(',')
|
||||
}
|
||||
}
|
||||
|
||||
let formParams = {}
|
||||
|
||||
let returnType = null
|
||||
|
||||
this.config.logger(
|
||||
`call operateKey with params:\npathParams:${JSON.stringify(
|
||||
pathParams
|
||||
)},\nqueryParams:${JSON.stringify(
|
||||
queryParams
|
||||
)}, \nheaderParams:${JSON.stringify(
|
||||
headerParams
|
||||
)}, \nformParams:${JSON.stringify(
|
||||
formParams
|
||||
)}, \npostBody:${JSON.stringify(postBody)}`,
|
||||
'DEBUG'
|
||||
)
|
||||
|
||||
let request = this.makeRequest(
|
||||
'/regions/{regionId}/account/operateKey',
|
||||
'POST',
|
||||
pathParams,
|
||||
queryParams,
|
||||
headerParams,
|
||||
formParams,
|
||||
postBody,
|
||||
contentTypes,
|
||||
accepts,
|
||||
returnType,
|
||||
callback
|
||||
)
|
||||
|
||||
return request.then(
|
||||
function (result) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(null, result)
|
||||
}
|
||||
return result
|
||||
},
|
||||
function (error) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(error)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询使用httpdns服务的域名
|
||||
* @param {Object} opts - parameters
|
||||
* @param {integer} opts.pageIndex - 当前页数,起始值为1
|
||||
* @param {integer} opts.pageSize - 分页查询时设置的每页行数
|
||||
* @param {string} [opts.domainName] - 关键字,按照”%domainName%”模式搜索域名 optional
|
||||
* @param {string} regionId - ID of the region
|
||||
* @param {string} callback - callback
|
||||
@return {Object} result
|
||||
* @param domainData data 分页查询返回的域名数据结构
|
||||
*/
|
||||
|
||||
getDomains (opts, regionId = this.config.regionId, callback) {
|
||||
if (typeof regionId === 'function') {
|
||||
callback = regionId
|
||||
regionId = this.config.regionId
|
||||
}
|
||||
|
||||
if (regionId === undefined || regionId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'regionId' when calling getDomains"
|
||||
)
|
||||
}
|
||||
|
||||
opts = opts || {}
|
||||
|
||||
if (opts.pageIndex === undefined || opts.pageIndex === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'opts.pageIndex' when calling getDomains"
|
||||
)
|
||||
}
|
||||
if (opts.pageSize === undefined || opts.pageSize === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'opts.pageSize' when calling getDomains"
|
||||
)
|
||||
}
|
||||
|
||||
let postBody = null
|
||||
let queryParams = {}
|
||||
if (opts.pageIndex !== undefined && opts.pageIndex !== null) {
|
||||
queryParams['pageIndex'] = opts.pageIndex
|
||||
}
|
||||
if (opts.pageSize !== undefined && opts.pageSize !== null) {
|
||||
queryParams['pageSize'] = opts.pageSize
|
||||
}
|
||||
if (opts.domainName !== undefined && opts.domainName !== null) {
|
||||
queryParams['domainName'] = opts.domainName
|
||||
}
|
||||
|
||||
let pathParams = {
|
||||
regionId: regionId
|
||||
}
|
||||
|
||||
let headerParams = {
|
||||
'User-Agent': 'JdcloudSdkNode/1.0.0 httpdns/1.0.0'
|
||||
}
|
||||
|
||||
let contentTypes = ['application/json']
|
||||
let accepts = ['application/json']
|
||||
|
||||
// 扩展自定义头
|
||||
if (opts['x-extra-header']) {
|
||||
for (let extraHeader in opts['x-extra-header']) {
|
||||
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
||||
contentTypes = opts['x-extra-header']['content-type']
|
||||
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
||||
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
||||
accepts = opts['x-extra-header']['accept']
|
||||
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
||||
accepts = opts['x-extra-header']['accept'].split(',')
|
||||
}
|
||||
}
|
||||
|
||||
let formParams = {}
|
||||
|
||||
let returnType = null
|
||||
|
||||
this.config.logger(
|
||||
`call getDomains with params:\npathParams:${JSON.stringify(
|
||||
pathParams
|
||||
)},\nqueryParams:${JSON.stringify(
|
||||
queryParams
|
||||
)}, \nheaderParams:${JSON.stringify(
|
||||
headerParams
|
||||
)}, \nformParams:${JSON.stringify(
|
||||
formParams
|
||||
)}, \npostBody:${JSON.stringify(postBody)}`,
|
||||
'DEBUG'
|
||||
)
|
||||
|
||||
let request = this.makeRequest(
|
||||
'/regions/{regionId}/domain',
|
||||
'GET',
|
||||
pathParams,
|
||||
queryParams,
|
||||
headerParams,
|
||||
formParams,
|
||||
postBody,
|
||||
contentTypes,
|
||||
accepts,
|
||||
returnType,
|
||||
callback
|
||||
)
|
||||
|
||||
return request.then(
|
||||
function (result) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(null, result)
|
||||
}
|
||||
return result
|
||||
},
|
||||
function (error) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(error)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加域名。<br>
|
||||
可以添加顶级域名除外的多级域名。
|
||||
|
||||
* @param {Object} opts - parameters
|
||||
* @param {array} opts.domainNames - 需要添加的域名数组
|
||||
* @param {string} regionId - ID of the region
|
||||
* @param {string} callback - callback
|
||||
@return {Object} result
|
||||
*/
|
||||
|
||||
addDomains (opts, regionId = this.config.regionId, callback) {
|
||||
if (typeof regionId === 'function') {
|
||||
callback = regionId
|
||||
regionId = this.config.regionId
|
||||
}
|
||||
|
||||
if (regionId === undefined || regionId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'regionId' when calling addDomains"
|
||||
)
|
||||
}
|
||||
|
||||
opts = opts || {}
|
||||
|
||||
if (opts.domainNames === undefined || opts.domainNames === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'opts.domainNames' when calling addDomains"
|
||||
)
|
||||
}
|
||||
|
||||
let postBody = {}
|
||||
if (opts.domainNames !== undefined && opts.domainNames !== null) {
|
||||
postBody['domainNames'] = opts.domainNames
|
||||
}
|
||||
|
||||
let queryParams = {}
|
||||
|
||||
let pathParams = {
|
||||
regionId: regionId
|
||||
}
|
||||
|
||||
let headerParams = {
|
||||
'User-Agent': 'JdcloudSdkNode/1.0.0 httpdns/1.0.0'
|
||||
}
|
||||
|
||||
let contentTypes = ['application/json']
|
||||
let accepts = ['application/json']
|
||||
|
||||
// 扩展自定义头
|
||||
if (opts['x-extra-header']) {
|
||||
for (let extraHeader in opts['x-extra-header']) {
|
||||
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
||||
contentTypes = opts['x-extra-header']['content-type']
|
||||
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
||||
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
||||
accepts = opts['x-extra-header']['accept']
|
||||
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
||||
accepts = opts['x-extra-header']['accept'].split(',')
|
||||
}
|
||||
}
|
||||
|
||||
let formParams = {}
|
||||
|
||||
let returnType = null
|
||||
|
||||
this.config.logger(
|
||||
`call addDomains with params:\npathParams:${JSON.stringify(
|
||||
pathParams
|
||||
)},\nqueryParams:${JSON.stringify(
|
||||
queryParams
|
||||
)}, \nheaderParams:${JSON.stringify(
|
||||
headerParams
|
||||
)}, \nformParams:${JSON.stringify(
|
||||
formParams
|
||||
)}, \npostBody:${JSON.stringify(postBody)}`,
|
||||
'DEBUG'
|
||||
)
|
||||
|
||||
let request = this.makeRequest(
|
||||
'/regions/{regionId}/domain/addDomain',
|
||||
'POST',
|
||||
pathParams,
|
||||
queryParams,
|
||||
headerParams,
|
||||
formParams,
|
||||
postBody,
|
||||
contentTypes,
|
||||
accepts,
|
||||
returnType,
|
||||
callback
|
||||
)
|
||||
|
||||
return request.then(
|
||||
function (result) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(null, result)
|
||||
}
|
||||
return result
|
||||
},
|
||||
function (error) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(error)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除域名
|
||||
* @param {Object} opts - parameters
|
||||
* @param {array} opts.domainNames - 需要删除的域名数组
|
||||
* @param {string} regionId - ID of the region
|
||||
* @param {string} callback - callback
|
||||
@return {Object} result
|
||||
*/
|
||||
|
||||
delDomains (opts, regionId = this.config.regionId, callback) {
|
||||
if (typeof regionId === 'function') {
|
||||
callback = regionId
|
||||
regionId = this.config.regionId
|
||||
}
|
||||
|
||||
if (regionId === undefined || regionId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'regionId' when calling delDomains"
|
||||
)
|
||||
}
|
||||
|
||||
opts = opts || {}
|
||||
|
||||
if (opts.domainNames === undefined || opts.domainNames === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'opts.domainNames' when calling delDomains"
|
||||
)
|
||||
}
|
||||
|
||||
let postBody = {}
|
||||
if (opts.domainNames !== undefined && opts.domainNames !== null) {
|
||||
postBody['domainNames'] = opts.domainNames
|
||||
}
|
||||
|
||||
let queryParams = {}
|
||||
|
||||
let pathParams = {
|
||||
regionId: regionId
|
||||
}
|
||||
|
||||
let headerParams = {
|
||||
'User-Agent': 'JdcloudSdkNode/1.0.0 httpdns/1.0.0'
|
||||
}
|
||||
|
||||
let contentTypes = ['application/json']
|
||||
let accepts = ['application/json']
|
||||
|
||||
// 扩展自定义头
|
||||
if (opts['x-extra-header']) {
|
||||
for (let extraHeader in opts['x-extra-header']) {
|
||||
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
||||
contentTypes = opts['x-extra-header']['content-type']
|
||||
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
||||
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
||||
accepts = opts['x-extra-header']['accept']
|
||||
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
||||
accepts = opts['x-extra-header']['accept'].split(',')
|
||||
}
|
||||
}
|
||||
|
||||
let formParams = {}
|
||||
|
||||
let returnType = null
|
||||
|
||||
this.config.logger(
|
||||
`call delDomains with params:\npathParams:${JSON.stringify(
|
||||
pathParams
|
||||
)},\nqueryParams:${JSON.stringify(
|
||||
queryParams
|
||||
)}, \nheaderParams:${JSON.stringify(
|
||||
headerParams
|
||||
)}, \nformParams:${JSON.stringify(
|
||||
formParams
|
||||
)}, \npostBody:${JSON.stringify(postBody)}`,
|
||||
'DEBUG'
|
||||
)
|
||||
|
||||
let request = this.makeRequest(
|
||||
'/regions/{regionId}/domain/delDomain',
|
||||
'POST',
|
||||
pathParams,
|
||||
queryParams,
|
||||
headerParams,
|
||||
formParams,
|
||||
postBody,
|
||||
contentTypes,
|
||||
accepts,
|
||||
returnType,
|
||||
callback
|
||||
)
|
||||
|
||||
return request.then(
|
||||
function (result) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(null, result)
|
||||
}
|
||||
return result
|
||||
},
|
||||
function (error) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(error)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
module.exports = JDCloud.HTTPDNS
|
||||
@@ -0,0 +1,628 @@
|
||||
/*
|
||||
* Copyright 2018 JDCLOUD.COM
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http:#www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* hufu-wx
|
||||
* 虎符商业化相关接口
|
||||
*
|
||||
* OpenAPI spec version: v1
|
||||
* Contact:
|
||||
*
|
||||
* NOTE: This class is auto generated by the jdcloud code generator program.
|
||||
*/
|
||||
|
||||
require('../../../lib/node_loader')
|
||||
var JDCloud = require('../../../lib/core')
|
||||
var Service = JDCloud.Service
|
||||
var serviceId = 'hufu'
|
||||
Service._services[serviceId] = true
|
||||
|
||||
/**
|
||||
* hufu service.
|
||||
* @version 1.0.7
|
||||
*/
|
||||
|
||||
class HUFU extends Service {
|
||||
constructor (options = {}) {
|
||||
options._defaultEndpoint = {}
|
||||
options._defaultEndpoint.protocol =
|
||||
options._defaultEndpoint.protocol || 'https'
|
||||
options._defaultEndpoint.host =
|
||||
options._defaultEndpoint.host || 'hufu.jdcloud-api.com'
|
||||
options.basePath = '/v1' // 默认要设为空""
|
||||
super(serviceId, options)
|
||||
}
|
||||
|
||||
/**
|
||||
* 发布版本
|
||||
* @param {Object} opts - parameters
|
||||
* @param {integer} opts.sceneId - 场景ID
|
||||
* @param {string} opts.revision - 发布的修订版本号
|
||||
* @param {string} opts.environment - 环境:test、preview、online
|
||||
* @param {string} [opts.backendServiceType] - 后端服务类型:mock、unique、vpc optional
|
||||
* @param {string} [opts.backendUrl] - 后端地址 optional
|
||||
* @param {string} [opts.description] - 描述 optional
|
||||
* @param {string} [opts.jdsfName] - 微服务网关名称 optional
|
||||
* @param {string} [opts.jdsfRegistryName] - 微服务注册中心ID optional
|
||||
* @param {string} [opts.jdsfId] - 微服务ID optional
|
||||
* @param {string} callback - callback
|
||||
@return {Object} result
|
||||
*/
|
||||
|
||||
deploy (opts, callback) {
|
||||
opts = opts || {}
|
||||
|
||||
if (opts.sceneId === undefined || opts.sceneId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'opts.sceneId' when calling deploy"
|
||||
)
|
||||
}
|
||||
if (opts.revision === undefined || opts.revision === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'opts.revision' when calling deploy"
|
||||
)
|
||||
}
|
||||
if (opts.environment === undefined || opts.environment === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'opts.environment' when calling deploy"
|
||||
)
|
||||
}
|
||||
|
||||
let postBody = {}
|
||||
if (opts.revision !== undefined && opts.revision !== null) {
|
||||
postBody['revision'] = opts.revision
|
||||
}
|
||||
if (opts.environment !== undefined && opts.environment !== null) {
|
||||
postBody['environment'] = opts.environment
|
||||
}
|
||||
if (
|
||||
opts.backendServiceType !== undefined &&
|
||||
opts.backendServiceType !== null
|
||||
) {
|
||||
postBody['backendServiceType'] = opts.backendServiceType
|
||||
}
|
||||
if (opts.backendUrl !== undefined && opts.backendUrl !== null) {
|
||||
postBody['backendUrl'] = opts.backendUrl
|
||||
}
|
||||
if (opts.description !== undefined && opts.description !== null) {
|
||||
postBody['description'] = opts.description
|
||||
}
|
||||
if (opts.jdsfName !== undefined && opts.jdsfName !== null) {
|
||||
postBody['jdsfName'] = opts.jdsfName
|
||||
}
|
||||
if (opts.jdsfRegistryName !== undefined && opts.jdsfRegistryName !== null) {
|
||||
postBody['jdsfRegistryName'] = opts.jdsfRegistryName
|
||||
}
|
||||
if (opts.jdsfId !== undefined && opts.jdsfId !== null) {
|
||||
postBody['jdsfId'] = opts.jdsfId
|
||||
}
|
||||
|
||||
let queryParams = {}
|
||||
|
||||
let pathParams = {
|
||||
regionId: 'jdcloud',
|
||||
sceneId: opts.sceneId
|
||||
}
|
||||
|
||||
let headerParams = {
|
||||
'User-Agent': 'JdcloudSdkNode/1.0.0 hufu/1.0.7'
|
||||
}
|
||||
|
||||
let contentTypes = ['application/json']
|
||||
let accepts = ['application/json']
|
||||
|
||||
// 扩展自定义头
|
||||
if (opts['x-extra-header']) {
|
||||
for (let extraHeader in opts['x-extra-header']) {
|
||||
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
||||
contentTypes = opts['x-extra-header']['content-type']
|
||||
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
||||
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
||||
accepts = opts['x-extra-header']['accept']
|
||||
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
||||
accepts = opts['x-extra-header']['accept'].split(',')
|
||||
}
|
||||
}
|
||||
|
||||
let formParams = {}
|
||||
|
||||
let returnType = null
|
||||
|
||||
this.config.logger(
|
||||
`call deploy with params:\npathParams:${JSON.stringify(
|
||||
pathParams
|
||||
)},\nqueryParams:${JSON.stringify(
|
||||
queryParams
|
||||
)}, \nheaderParams:${JSON.stringify(
|
||||
headerParams
|
||||
)}, \nformParams:${JSON.stringify(
|
||||
formParams
|
||||
)}, \npostBody:${JSON.stringify(postBody)}`,
|
||||
'DEBUG'
|
||||
)
|
||||
|
||||
let request = super.makeRequest(
|
||||
'/scenes/{sceneId}/deployments',
|
||||
'POST',
|
||||
pathParams,
|
||||
queryParams,
|
||||
headerParams,
|
||||
formParams,
|
||||
postBody,
|
||||
contentTypes,
|
||||
accepts,
|
||||
returnType,
|
||||
callback
|
||||
)
|
||||
|
||||
return request.then(
|
||||
function (result) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(null, result)
|
||||
}
|
||||
return result
|
||||
},
|
||||
function (error) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(error)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询该版本的部署详情
|
||||
* @param {Object} opts - parameters
|
||||
* @param {integer} opts.sceneId - 场景ID
|
||||
* @param {string} opts.deploymentId - 部署ID
|
||||
* @param {string} callback - callback
|
||||
@return {Object} result
|
||||
* @param deployment apiGroup
|
||||
*/
|
||||
|
||||
describeDeployment (opts, callback) {
|
||||
opts = opts || {}
|
||||
|
||||
if (opts.sceneId === undefined || opts.sceneId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'opts.sceneId' when calling describeDeployment"
|
||||
)
|
||||
}
|
||||
if (opts.deploymentId === undefined || opts.deploymentId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'opts.deploymentId' when calling describeDeployment"
|
||||
)
|
||||
}
|
||||
|
||||
let postBody = null
|
||||
let queryParams = {}
|
||||
|
||||
let pathParams = {
|
||||
regionId: 'jdcloud',
|
||||
sceneId: opts.sceneId,
|
||||
deploymentId: opts.deploymentId
|
||||
}
|
||||
|
||||
let headerParams = {
|
||||
'User-Agent': 'JdcloudSdkNode/1.0.0 hufu/1.0.7'
|
||||
}
|
||||
|
||||
let contentTypes = ['application/json']
|
||||
let accepts = ['application/json']
|
||||
|
||||
// 扩展自定义头
|
||||
if (opts['x-extra-header']) {
|
||||
for (let extraHeader in opts['x-extra-header']) {
|
||||
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
||||
contentTypes = opts['x-extra-header']['content-type']
|
||||
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
||||
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
||||
accepts = opts['x-extra-header']['accept']
|
||||
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
||||
accepts = opts['x-extra-header']['accept'].split(',')
|
||||
}
|
||||
}
|
||||
|
||||
let formParams = {}
|
||||
|
||||
let returnType = null
|
||||
|
||||
this.config.logger(
|
||||
`call describeDeployment with params:\npathParams:${JSON.stringify(
|
||||
pathParams
|
||||
)},\nqueryParams:${JSON.stringify(
|
||||
queryParams
|
||||
)}, \nheaderParams:${JSON.stringify(
|
||||
headerParams
|
||||
)}, \nformParams:${JSON.stringify(
|
||||
formParams
|
||||
)}, \npostBody:${JSON.stringify(postBody)}`,
|
||||
'DEBUG'
|
||||
)
|
||||
|
||||
let request = super.makeRequest(
|
||||
'/scenes/{sceneId}/deployments/{deploymentId}',
|
||||
'GET',
|
||||
pathParams,
|
||||
queryParams,
|
||||
headerParams,
|
||||
formParams,
|
||||
postBody,
|
||||
contentTypes,
|
||||
accepts,
|
||||
returnType,
|
||||
callback
|
||||
)
|
||||
|
||||
return request.then(
|
||||
function (result) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(null, result)
|
||||
}
|
||||
return result
|
||||
},
|
||||
function (error) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(error)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 加密
|
||||
* @param {Object} opts - parameters
|
||||
* @param {string} [opts.plaintext] - 明文 optional
|
||||
* @param {string} callback - callback
|
||||
@return {Object} result
|
||||
* @param string ciphertext 密文
|
||||
*/
|
||||
|
||||
encrypt (opts, callback) {
|
||||
opts = opts || {}
|
||||
|
||||
let postBody = {}
|
||||
if (opts.plaintext !== undefined && opts.plaintext !== null) {
|
||||
postBody['plaintext'] = opts.plaintext
|
||||
}
|
||||
|
||||
let queryParams = {}
|
||||
|
||||
let pathParams = {
|
||||
regionId: 'jdcloud'
|
||||
}
|
||||
|
||||
let headerParams = {
|
||||
'User-Agent': 'JdcloudSdkNode/1.0.0 hufu/1.0.7'
|
||||
}
|
||||
|
||||
let contentTypes = ['application/json']
|
||||
let accepts = ['application/json']
|
||||
|
||||
// 扩展自定义头
|
||||
if (opts['x-extra-header']) {
|
||||
for (let extraHeader in opts['x-extra-header']) {
|
||||
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
||||
contentTypes = opts['x-extra-header']['content-type']
|
||||
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
||||
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
||||
accepts = opts['x-extra-header']['accept']
|
||||
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
||||
accepts = opts['x-extra-header']['accept'].split(',')
|
||||
}
|
||||
}
|
||||
|
||||
let formParams = {}
|
||||
|
||||
let returnType = null
|
||||
|
||||
this.config.logger(
|
||||
`call encrypt with params:\npathParams:${JSON.stringify(
|
||||
pathParams
|
||||
)},\nqueryParams:${JSON.stringify(
|
||||
queryParams
|
||||
)}, \nheaderParams:${JSON.stringify(
|
||||
headerParams
|
||||
)}, \nformParams:${JSON.stringify(
|
||||
formParams
|
||||
)}, \npostBody:${JSON.stringify(postBody)}`,
|
||||
'DEBUG'
|
||||
)
|
||||
|
||||
let request = super.makeRequest(
|
||||
'/encrypt',
|
||||
'POST',
|
||||
pathParams,
|
||||
queryParams,
|
||||
headerParams,
|
||||
formParams,
|
||||
postBody,
|
||||
contentTypes,
|
||||
accepts,
|
||||
returnType,
|
||||
callback
|
||||
)
|
||||
|
||||
return request.then(
|
||||
function (result) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(null, result)
|
||||
}
|
||||
return result
|
||||
},
|
||||
function (error) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(error)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 加密
|
||||
* @param {Object} opts - parameters
|
||||
* @param {string} [opts.cipher] - 密文 optional
|
||||
* @param {string} callback - callback
|
||||
@return {Object} result
|
||||
* @param boolean encryptData 是否是虎符密文
|
||||
*/
|
||||
|
||||
isEncryptData (opts, callback) {
|
||||
opts = opts || {}
|
||||
|
||||
let postBody = {}
|
||||
if (opts.cipher !== undefined && opts.cipher !== null) {
|
||||
postBody['cipher'] = opts.cipher
|
||||
}
|
||||
|
||||
let queryParams = {}
|
||||
|
||||
let pathParams = {
|
||||
regionId: 'jdcloud'
|
||||
}
|
||||
|
||||
let headerParams = {
|
||||
'User-Agent': 'JdcloudSdkNode/1.0.0 hufu/1.0.7'
|
||||
}
|
||||
|
||||
let contentTypes = ['application/json']
|
||||
let accepts = ['application/json']
|
||||
|
||||
// 扩展自定义头
|
||||
if (opts['x-extra-header']) {
|
||||
for (let extraHeader in opts['x-extra-header']) {
|
||||
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
||||
contentTypes = opts['x-extra-header']['content-type']
|
||||
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
||||
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
||||
accepts = opts['x-extra-header']['accept']
|
||||
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
||||
accepts = opts['x-extra-header']['accept'].split(',')
|
||||
}
|
||||
}
|
||||
|
||||
let formParams = {}
|
||||
|
||||
let returnType = null
|
||||
|
||||
this.config.logger(
|
||||
`call isEncryptData with params:\npathParams:${JSON.stringify(
|
||||
pathParams
|
||||
)},\nqueryParams:${JSON.stringify(
|
||||
queryParams
|
||||
)}, \nheaderParams:${JSON.stringify(
|
||||
headerParams
|
||||
)}, \nformParams:${JSON.stringify(
|
||||
formParams
|
||||
)}, \npostBody:${JSON.stringify(postBody)}`,
|
||||
'DEBUG'
|
||||
)
|
||||
|
||||
let request = super.makeRequest(
|
||||
'/isEncryptData',
|
||||
'POST',
|
||||
pathParams,
|
||||
queryParams,
|
||||
headerParams,
|
||||
formParams,
|
||||
postBody,
|
||||
contentTypes,
|
||||
accepts,
|
||||
returnType,
|
||||
callback
|
||||
)
|
||||
|
||||
return request.then(
|
||||
function (result) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(null, result)
|
||||
}
|
||||
return result
|
||||
},
|
||||
function (error) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(error)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询access日志
|
||||
* @param {Object} opts - parameters
|
||||
* @param {string} [opts.call_pin] - 调用者pin optional
|
||||
* @param {string} [opts.response_status] - 响应码 optional
|
||||
* @param {string} [opts.api_name] - api名称 optional
|
||||
* @param {string} [opts.access_key] - 调用者accessKey optional
|
||||
* @param {string} [opts.host] - 请求虎符网关的域名 optional
|
||||
* @param {string} opts.startTime - 开始时间,utc格式,例如:2020-05-19T00:00:05+0800
|
||||
* @param {string} opts.endTime - 结束时间,utc格式,例如:2020-05-19T00:00:05+0800
|
||||
* @param {integer} [opts.pageNumber] - 页码 optional
|
||||
* @param {integer} [opts.pageSize] - 分页大小 optional
|
||||
* @param {string} callback - callback
|
||||
@return {Object} result
|
||||
* @param accessLog data
|
||||
* @param integer total
|
||||
*/
|
||||
|
||||
queryAccessLog (opts, callback) {
|
||||
opts = opts || {}
|
||||
|
||||
if (opts.startTime === undefined || opts.startTime === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'opts.startTime' when calling queryAccessLog"
|
||||
)
|
||||
}
|
||||
if (opts.endTime === undefined || opts.endTime === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'opts.endTime' when calling queryAccessLog"
|
||||
)
|
||||
}
|
||||
|
||||
let postBody = null
|
||||
let queryParams = {}
|
||||
if (opts.call_pin !== undefined && opts.call_pin !== null) {
|
||||
queryParams['call_pin'] = opts.call_pin
|
||||
}
|
||||
if (opts.response_status !== undefined && opts.response_status !== null) {
|
||||
queryParams['response_status'] = opts.response_status
|
||||
}
|
||||
if (opts.api_name !== undefined && opts.api_name !== null) {
|
||||
queryParams['api_name'] = opts.api_name
|
||||
}
|
||||
if (opts.access_key !== undefined && opts.access_key !== null) {
|
||||
queryParams['access_key'] = opts.access_key
|
||||
}
|
||||
if (opts.host !== undefined && opts.host !== null) {
|
||||
queryParams['host'] = opts.host
|
||||
}
|
||||
if (opts.startTime !== undefined && opts.startTime !== null) {
|
||||
queryParams['startTime'] = opts.startTime
|
||||
}
|
||||
if (opts.endTime !== undefined && opts.endTime !== null) {
|
||||
queryParams['endTime'] = opts.endTime
|
||||
}
|
||||
if (opts.pageNumber !== undefined && opts.pageNumber !== null) {
|
||||
queryParams['pageNumber'] = opts.pageNumber
|
||||
}
|
||||
if (opts.pageSize !== undefined && opts.pageSize !== null) {
|
||||
queryParams['pageSize'] = opts.pageSize
|
||||
}
|
||||
|
||||
let pathParams = {
|
||||
regionId: 'jdcloud'
|
||||
}
|
||||
|
||||
let headerParams = {
|
||||
'User-Agent': 'JdcloudSdkNode/1.0.0 hufu/1.0.7'
|
||||
}
|
||||
|
||||
let contentTypes = ['application/json']
|
||||
let accepts = ['application/json']
|
||||
|
||||
// 扩展自定义头
|
||||
if (opts['x-extra-header']) {
|
||||
for (let extraHeader in opts['x-extra-header']) {
|
||||
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
||||
contentTypes = opts['x-extra-header']['content-type']
|
||||
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
||||
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
||||
accepts = opts['x-extra-header']['accept']
|
||||
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
||||
accepts = opts['x-extra-header']['accept'].split(',')
|
||||
}
|
||||
}
|
||||
|
||||
let formParams = {}
|
||||
|
||||
let returnType = null
|
||||
|
||||
this.config.logger(
|
||||
`call queryAccessLog with params:\npathParams:${JSON.stringify(
|
||||
pathParams
|
||||
)},\nqueryParams:${JSON.stringify(
|
||||
queryParams
|
||||
)}, \nheaderParams:${JSON.stringify(
|
||||
headerParams
|
||||
)}, \nformParams:${JSON.stringify(
|
||||
formParams
|
||||
)}, \npostBody:${JSON.stringify(postBody)}`,
|
||||
'DEBUG'
|
||||
)
|
||||
|
||||
let request = super.makeRequest(
|
||||
'/access',
|
||||
'GET',
|
||||
pathParams,
|
||||
queryParams,
|
||||
headerParams,
|
||||
formParams,
|
||||
postBody,
|
||||
contentTypes,
|
||||
accepts,
|
||||
returnType,
|
||||
callback
|
||||
)
|
||||
|
||||
return request.then(
|
||||
function (result) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(null, result)
|
||||
}
|
||||
return result
|
||||
},
|
||||
function (error) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(error)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
module.exports = HUFU
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,202 @@
|
||||
/*
|
||||
* Copyright 2018 JDCLOUD.COM
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http:#www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* 大屏数据查询接口
|
||||
* 陕西苹果大屏数据查询接口
|
||||
*
|
||||
* OpenAPI spec version: v1
|
||||
* Contact:
|
||||
*
|
||||
* NOTE: This class is auto generated by the jdcloud code generator program.
|
||||
*/
|
||||
|
||||
require('../../../lib/node_loader')
|
||||
var JDCloud = require('../../../lib/core')
|
||||
var Service = JDCloud.Service
|
||||
var serviceId = 'industrydata'
|
||||
Service._services[serviceId] = true
|
||||
|
||||
/**
|
||||
* industrydata service.
|
||||
* @version 1.0.0
|
||||
*/
|
||||
|
||||
JDCloud.INDUSTRYDATA = class INDUSTRYDATA extends Service {
|
||||
constructor (options = {}) {
|
||||
options._defaultEndpoint = {}
|
||||
options._defaultEndpoint.protocol =
|
||||
options._defaultEndpoint.protocol || 'https'
|
||||
options._defaultEndpoint.host =
|
||||
options._defaultEndpoint.host || 'industrydata.cn-south-1.jdcloud-api.com'
|
||||
options.basePath = '/v1' // 默认要设为空""
|
||||
super(serviceId, options)
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据区域、行业、一级指标、二级指标、起始时间等条件查询数据
|
||||
* @param {Object} opts - parameters
|
||||
* @param {string} opts.region - 查询区域,比如某某省或某某市(可选区域以最终授权为准)
|
||||
* @param {string} opts.industry - 查询行业,比如某个水果或者农作物(可选行业以最终授权为准)
|
||||
* @param {string} opts.startDate - 查询起始时间,格式如下:yyyy-MM-dd
|
||||
* @param {string} opts.endDate - 查询结束时间,格式如下:yyyy-MM-dd
|
||||
* @param {string} opts.firstIndex - 数据对应的第一级分析指标(可选一级指标以最终授权为准)
|
||||
* @param {string} [opts.secondIndex] - 数据对应的第二级分析指标,如不填写,则默认把一级指标下的所有二级指标都查询出来(可选二级指标以最终授权为准) optional
|
||||
* @param {string} regionId - ID of the region
|
||||
* @param {string} callback - callback
|
||||
@return {Object} result
|
||||
* @param boolean status true为成功,false为失败
|
||||
* @param string message 描述信息
|
||||
* @param regionIndustryDataList data 查询数据结果
|
||||
*/
|
||||
|
||||
getLargeScreenData (opts, regionId = this.config.regionId, callback) {
|
||||
if (typeof regionId === 'function') {
|
||||
callback = regionId
|
||||
regionId = this.config.regionId
|
||||
}
|
||||
|
||||
if (regionId === undefined || regionId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'regionId' when calling getLargeScreenData"
|
||||
)
|
||||
}
|
||||
|
||||
opts = opts || {}
|
||||
|
||||
if (opts.region === undefined || opts.region === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'opts.region' when calling getLargeScreenData"
|
||||
)
|
||||
}
|
||||
if (opts.industry === undefined || opts.industry === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'opts.industry' when calling getLargeScreenData"
|
||||
)
|
||||
}
|
||||
if (opts.startDate === undefined || opts.startDate === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'opts.startDate' when calling getLargeScreenData"
|
||||
)
|
||||
}
|
||||
if (opts.endDate === undefined || opts.endDate === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'opts.endDate' when calling getLargeScreenData"
|
||||
)
|
||||
}
|
||||
if (opts.firstIndex === undefined || opts.firstIndex === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'opts.firstIndex' when calling getLargeScreenData"
|
||||
)
|
||||
}
|
||||
|
||||
let postBody = null
|
||||
let queryParams = {}
|
||||
if (opts.region !== undefined && opts.region !== null) {
|
||||
queryParams['region'] = opts.region
|
||||
}
|
||||
if (opts.industry !== undefined && opts.industry !== null) {
|
||||
queryParams['industry'] = opts.industry
|
||||
}
|
||||
if (opts.startDate !== undefined && opts.startDate !== null) {
|
||||
queryParams['startDate'] = opts.startDate
|
||||
}
|
||||
if (opts.endDate !== undefined && opts.endDate !== null) {
|
||||
queryParams['endDate'] = opts.endDate
|
||||
}
|
||||
if (opts.firstIndex !== undefined && opts.firstIndex !== null) {
|
||||
queryParams['firstIndex'] = opts.firstIndex
|
||||
}
|
||||
if (opts.secondIndex !== undefined && opts.secondIndex !== null) {
|
||||
queryParams['secondIndex'] = opts.secondIndex
|
||||
}
|
||||
|
||||
let pathParams = {
|
||||
regionId: regionId
|
||||
}
|
||||
|
||||
let headerParams = {
|
||||
'User-Agent': 'JdcloudSdkNode/1.0.0 industrydata/1.0.0'
|
||||
}
|
||||
|
||||
let contentTypes = ['application/json']
|
||||
let accepts = ['application/json']
|
||||
|
||||
// 扩展自定义头
|
||||
if (opts['x-extra-header']) {
|
||||
for (let extraHeader in opts['x-extra-header']) {
|
||||
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
||||
contentTypes = opts['x-extra-header']['content-type']
|
||||
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
||||
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
||||
accepts = opts['x-extra-header']['accept']
|
||||
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
||||
accepts = opts['x-extra-header']['accept'].split(',')
|
||||
}
|
||||
}
|
||||
|
||||
let formParams = {}
|
||||
|
||||
let returnType = null
|
||||
|
||||
this.config.logger(
|
||||
`call getLargeScreenData with params:\npathParams:${JSON.stringify(
|
||||
pathParams
|
||||
)},\nqueryParams:${JSON.stringify(
|
||||
queryParams
|
||||
)}, \nheaderParams:${JSON.stringify(
|
||||
headerParams
|
||||
)}, \nformParams:${JSON.stringify(
|
||||
formParams
|
||||
)}, \npostBody:${JSON.stringify(postBody)}`,
|
||||
'DEBUG'
|
||||
)
|
||||
|
||||
let request = this.makeRequest(
|
||||
'/regions/{regionId}/getData',
|
||||
'GET',
|
||||
pathParams,
|
||||
queryParams,
|
||||
headerParams,
|
||||
formParams,
|
||||
postBody,
|
||||
contentTypes,
|
||||
accepts,
|
||||
returnType,
|
||||
callback
|
||||
)
|
||||
|
||||
return request.then(
|
||||
function (result) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(null, result)
|
||||
}
|
||||
return result
|
||||
},
|
||||
function (error) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(error)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
module.exports = JDCloud.INDUSTRYDATA
|
||||
@@ -0,0 +1,883 @@
|
||||
/*
|
||||
* Copyright 2018 JDCLOUD.COM
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http:#www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* Instance-Voucher
|
||||
* 实例抵扣券相关接口
|
||||
*
|
||||
* OpenAPI spec version: v1
|
||||
* Contact:
|
||||
*
|
||||
* NOTE: This class is auto generated by the jdcloud code generator program.
|
||||
*/
|
||||
|
||||
require('../../../lib/node_loader')
|
||||
var JDCloud = require('../../../lib/core')
|
||||
var Service = JDCloud.Service
|
||||
var serviceId = 'instancevoucher'
|
||||
Service._services[serviceId] = true
|
||||
|
||||
/**
|
||||
* instancevoucher service.
|
||||
* @version 0.0.3
|
||||
*/
|
||||
|
||||
class INSTANCEVOUCHER extends Service {
|
||||
constructor (options = {}) {
|
||||
options._defaultEndpoint = {}
|
||||
options._defaultEndpoint.protocol =
|
||||
options._defaultEndpoint.protocol || 'https'
|
||||
options._defaultEndpoint.host =
|
||||
options._defaultEndpoint.host || 'instancevoucher.jdcloud-api.com'
|
||||
options.basePath = '/v1' // 默认要设为空""
|
||||
super(serviceId, options)
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询实例规格信息列表
|
||||
|
||||
* @param {Object} opts - parameters
|
||||
* @param {string} [opts.resourceType] - 产品类型 支持[vm, nativecontainer, pod],默认为vm optional
|
||||
* @param {string} [opts.reservedType] - 资源分配方式,支持[nonReserved] optional
|
||||
* @param {filter} [opts.filters] - Filter names: (仅支持eq)
|
||||
instanceType - 实例规格,精确匹配,支持多个
|
||||
instanceTypeFamily - 实例规格族,精确匹配,支持多个
|
||||
az - 可用区,精确匹配,支持多个
|
||||
optional
|
||||
* @param {string} regionId - ID of the region
|
||||
* @param {string} callback - callback
|
||||
@return {Object} result
|
||||
* @param instanceVoucherType instanceVoucherTypes
|
||||
*/
|
||||
|
||||
describeInstanceVoucherTypes (
|
||||
opts,
|
||||
regionId = this.config.regionId,
|
||||
callback
|
||||
) {
|
||||
if (typeof regionId === 'function') {
|
||||
callback = regionId
|
||||
regionId = this.config.regionId
|
||||
}
|
||||
|
||||
if (regionId === undefined || regionId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'regionId' when calling describeInstanceVoucherTypes"
|
||||
)
|
||||
}
|
||||
|
||||
opts = opts || {}
|
||||
|
||||
let postBody = null
|
||||
let queryParams = {}
|
||||
if (opts.resourceType !== undefined && opts.resourceType !== null) {
|
||||
queryParams['resourceType'] = opts.resourceType
|
||||
}
|
||||
if (opts.reservedType !== undefined && opts.reservedType !== null) {
|
||||
queryParams['reservedType'] = opts.reservedType
|
||||
}
|
||||
Object.assign(queryParams, super.buildFilterParam(opts.filters, 'filters'))
|
||||
|
||||
let pathParams = {
|
||||
regionId: regionId
|
||||
}
|
||||
|
||||
let headerParams = {
|
||||
'User-Agent': 'JdcloudSdkNode/1.0.0 instancevoucher/0.0.3'
|
||||
}
|
||||
|
||||
let contentTypes = ['application/json']
|
||||
let accepts = ['application/json']
|
||||
|
||||
// 扩展自定义头
|
||||
if (opts['x-extra-header']) {
|
||||
for (let extraHeader in opts['x-extra-header']) {
|
||||
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
||||
contentTypes = opts['x-extra-header']['content-type']
|
||||
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
||||
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
||||
accepts = opts['x-extra-header']['accept']
|
||||
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
||||
accepts = opts['x-extra-header']['accept'].split(',')
|
||||
}
|
||||
}
|
||||
|
||||
let formParams = {}
|
||||
|
||||
let returnType = null
|
||||
|
||||
this.config.logger(
|
||||
`call describeInstanceVoucherTypes with params:\npathParams:${JSON.stringify(
|
||||
pathParams
|
||||
)},\nqueryParams:${JSON.stringify(
|
||||
queryParams
|
||||
)}, \nheaderParams:${JSON.stringify(
|
||||
headerParams
|
||||
)}, \nformParams:${JSON.stringify(
|
||||
formParams
|
||||
)}, \npostBody:${JSON.stringify(postBody)}`,
|
||||
'DEBUG'
|
||||
)
|
||||
|
||||
let request = super.makeRequest(
|
||||
'/regions/{regionId}/instanceVoucherTypes',
|
||||
'GET',
|
||||
pathParams,
|
||||
queryParams,
|
||||
headerParams,
|
||||
formParams,
|
||||
postBody,
|
||||
contentTypes,
|
||||
accepts,
|
||||
returnType,
|
||||
callback
|
||||
)
|
||||
|
||||
return request.then(
|
||||
function (result) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(null, result)
|
||||
}
|
||||
return result
|
||||
},
|
||||
function (error) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(error)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询配额
|
||||
|
||||
* @param {Object} opts - parameters
|
||||
* @param {filter} [opts.filters] - Filter names: (仅支持eq)
|
||||
resourceType - 产品类型,精确匹配,支持多个 支持[vm, nativecontainer, pod]
|
||||
reservedType - 资源分配方式,精确匹配,支持多个 支持[nonReserved]
|
||||
optional
|
||||
* @param {string} regionId - ID of the region
|
||||
* @param {string} callback - callback
|
||||
@return {Object} result
|
||||
* @param quota quotas
|
||||
*/
|
||||
|
||||
describeQuotas (opts, regionId = this.config.regionId, callback) {
|
||||
if (typeof regionId === 'function') {
|
||||
callback = regionId
|
||||
regionId = this.config.regionId
|
||||
}
|
||||
|
||||
if (regionId === undefined || regionId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'regionId' when calling describeQuotas"
|
||||
)
|
||||
}
|
||||
|
||||
opts = opts || {}
|
||||
|
||||
let postBody = null
|
||||
let queryParams = {}
|
||||
Object.assign(queryParams, super.buildFilterParam(opts.filters, 'filters'))
|
||||
|
||||
let pathParams = {
|
||||
regionId: regionId
|
||||
}
|
||||
|
||||
let headerParams = {
|
||||
'User-Agent': 'JdcloudSdkNode/1.0.0 instancevoucher/0.0.3'
|
||||
}
|
||||
|
||||
let contentTypes = ['application/json']
|
||||
let accepts = ['application/json']
|
||||
|
||||
// 扩展自定义头
|
||||
if (opts['x-extra-header']) {
|
||||
for (let extraHeader in opts['x-extra-header']) {
|
||||
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
||||
contentTypes = opts['x-extra-header']['content-type']
|
||||
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
||||
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
||||
accepts = opts['x-extra-header']['accept']
|
||||
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
||||
accepts = opts['x-extra-header']['accept'].split(',')
|
||||
}
|
||||
}
|
||||
|
||||
let formParams = {}
|
||||
|
||||
let returnType = null
|
||||
|
||||
this.config.logger(
|
||||
`call describeQuotas with params:\npathParams:${JSON.stringify(
|
||||
pathParams
|
||||
)},\nqueryParams:${JSON.stringify(
|
||||
queryParams
|
||||
)}, \nheaderParams:${JSON.stringify(
|
||||
headerParams
|
||||
)}, \nformParams:${JSON.stringify(
|
||||
formParams
|
||||
)}, \npostBody:${JSON.stringify(postBody)}`,
|
||||
'DEBUG'
|
||||
)
|
||||
|
||||
let request = super.makeRequest(
|
||||
'/regions/{regionId}/quotas',
|
||||
'GET',
|
||||
pathParams,
|
||||
queryParams,
|
||||
headerParams,
|
||||
formParams,
|
||||
postBody,
|
||||
contentTypes,
|
||||
accepts,
|
||||
returnType,
|
||||
callback
|
||||
)
|
||||
|
||||
return request.then(
|
||||
function (result) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(null, result)
|
||||
}
|
||||
return result
|
||||
},
|
||||
function (error) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(error)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量查询实例抵扣券的详细信息<br>
|
||||
此接口支持分页查询,默认每页20条。
|
||||
|
||||
* @param {Object} opts - parameters
|
||||
* @param {integer} [opts.pageNumber] - 页码;默认为1 optional
|
||||
* @param {integer} [opts.pageSize] - 分页大小;默认为20;取值范围[10, 100] optional
|
||||
* @param {filter} [opts.filters] - Filter names: (仅支持eq)
|
||||
instanceVoucherId - 实例ID,精确匹配,支持多个
|
||||
name - 实例名称,模糊匹配,支持多个
|
||||
resourceType - 产品类型,精确匹配,支持多个 支持[vm nativecontainer pod]
|
||||
reservedType - 资源分配方式,精确匹配,支持多个 支持[nonReserved]
|
||||
status - 实例抵扣券状态,精确匹配,支持多个
|
||||
instanceTypeFamily - 实例规格族,精确匹配,支持多个(适用于非预留型)
|
||||
optional
|
||||
* @param {string} regionId - ID of the region
|
||||
* @param {string} callback - callback
|
||||
@return {Object} result
|
||||
* @param instanceVoucher instanceVouchers
|
||||
* @param integer totalCount
|
||||
*/
|
||||
|
||||
describeInstanceVouchers (opts, regionId = this.config.regionId, callback) {
|
||||
if (typeof regionId === 'function') {
|
||||
callback = regionId
|
||||
regionId = this.config.regionId
|
||||
}
|
||||
|
||||
if (regionId === undefined || regionId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'regionId' when calling describeInstanceVouchers"
|
||||
)
|
||||
}
|
||||
|
||||
opts = opts || {}
|
||||
|
||||
let postBody = null
|
||||
let queryParams = {}
|
||||
if (opts.pageNumber !== undefined && opts.pageNumber !== null) {
|
||||
queryParams['pageNumber'] = opts.pageNumber
|
||||
}
|
||||
if (opts.pageSize !== undefined && opts.pageSize !== null) {
|
||||
queryParams['pageSize'] = opts.pageSize
|
||||
}
|
||||
Object.assign(queryParams, super.buildFilterParam(opts.filters, 'filters'))
|
||||
|
||||
let pathParams = {
|
||||
regionId: regionId
|
||||
}
|
||||
|
||||
let headerParams = {
|
||||
'User-Agent': 'JdcloudSdkNode/1.0.0 instancevoucher/0.0.3'
|
||||
}
|
||||
|
||||
let contentTypes = ['application/json']
|
||||
let accepts = ['application/json']
|
||||
|
||||
// 扩展自定义头
|
||||
if (opts['x-extra-header']) {
|
||||
for (let extraHeader in opts['x-extra-header']) {
|
||||
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
||||
contentTypes = opts['x-extra-header']['content-type']
|
||||
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
||||
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
||||
accepts = opts['x-extra-header']['accept']
|
||||
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
||||
accepts = opts['x-extra-header']['accept'].split(',')
|
||||
}
|
||||
}
|
||||
|
||||
let formParams = {}
|
||||
|
||||
let returnType = null
|
||||
|
||||
this.config.logger(
|
||||
`call describeInstanceVouchers with params:\npathParams:${JSON.stringify(
|
||||
pathParams
|
||||
)},\nqueryParams:${JSON.stringify(
|
||||
queryParams
|
||||
)}, \nheaderParams:${JSON.stringify(
|
||||
headerParams
|
||||
)}, \nformParams:${JSON.stringify(
|
||||
formParams
|
||||
)}, \npostBody:${JSON.stringify(postBody)}`,
|
||||
'DEBUG'
|
||||
)
|
||||
|
||||
let request = super.makeRequest(
|
||||
'/regions/{regionId}/instanceVouchers',
|
||||
'GET',
|
||||
pathParams,
|
||||
queryParams,
|
||||
headerParams,
|
||||
formParams,
|
||||
postBody,
|
||||
contentTypes,
|
||||
accepts,
|
||||
returnType,
|
||||
callback
|
||||
)
|
||||
|
||||
return request.then(
|
||||
function (result) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(null, result)
|
||||
}
|
||||
return result
|
||||
},
|
||||
function (error) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(error)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建实例抵扣券
|
||||
|
||||
* @param {Object} opts - parameters
|
||||
* @param {instanceVoucherSpec} opts.instanceVoucherSpec - 创建实例抵扣券规格
|
||||
* @param {string} [opts.clientToken] - 保证请求幂等性 optional
|
||||
* @param {string} regionId - ID of the region
|
||||
* @param {string} callback - callback
|
||||
@return {Object} result
|
||||
* @param string instanceVoucherId 实例抵扣券 ID
|
||||
*/
|
||||
|
||||
createInstanceVoucher (opts, regionId = this.config.regionId, callback) {
|
||||
if (typeof regionId === 'function') {
|
||||
callback = regionId
|
||||
regionId = this.config.regionId
|
||||
}
|
||||
|
||||
if (regionId === undefined || regionId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'regionId' when calling createInstanceVoucher"
|
||||
)
|
||||
}
|
||||
|
||||
opts = opts || {}
|
||||
|
||||
if (
|
||||
opts.instanceVoucherSpec === undefined ||
|
||||
opts.instanceVoucherSpec === null
|
||||
) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'opts.instanceVoucherSpec' when calling createInstanceVoucher"
|
||||
)
|
||||
}
|
||||
|
||||
let postBody = {}
|
||||
if (
|
||||
opts.instanceVoucherSpec !== undefined &&
|
||||
opts.instanceVoucherSpec !== null
|
||||
) {
|
||||
postBody['instanceVoucherSpec'] = opts.instanceVoucherSpec
|
||||
}
|
||||
if (opts.clientToken !== undefined && opts.clientToken !== null) {
|
||||
postBody['clientToken'] = opts.clientToken
|
||||
}
|
||||
|
||||
let queryParams = {}
|
||||
|
||||
let pathParams = {
|
||||
regionId: regionId
|
||||
}
|
||||
|
||||
let headerParams = {
|
||||
'User-Agent': 'JdcloudSdkNode/1.0.0 instancevoucher/0.0.3'
|
||||
}
|
||||
|
||||
let contentTypes = ['application/json']
|
||||
let accepts = ['application/json']
|
||||
|
||||
// 扩展自定义头
|
||||
if (opts['x-extra-header']) {
|
||||
for (let extraHeader in opts['x-extra-header']) {
|
||||
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
||||
contentTypes = opts['x-extra-header']['content-type']
|
||||
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
||||
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
||||
accepts = opts['x-extra-header']['accept']
|
||||
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
||||
accepts = opts['x-extra-header']['accept'].split(',')
|
||||
}
|
||||
}
|
||||
|
||||
let formParams = {}
|
||||
|
||||
let returnType = null
|
||||
|
||||
this.config.logger(
|
||||
`call createInstanceVoucher with params:\npathParams:${JSON.stringify(
|
||||
pathParams
|
||||
)},\nqueryParams:${JSON.stringify(
|
||||
queryParams
|
||||
)}, \nheaderParams:${JSON.stringify(
|
||||
headerParams
|
||||
)}, \nformParams:${JSON.stringify(
|
||||
formParams
|
||||
)}, \npostBody:${JSON.stringify(postBody)}`,
|
||||
'DEBUG'
|
||||
)
|
||||
|
||||
let request = super.makeRequest(
|
||||
'/regions/{regionId}/instanceVouchers',
|
||||
'POST',
|
||||
pathParams,
|
||||
queryParams,
|
||||
headerParams,
|
||||
formParams,
|
||||
postBody,
|
||||
contentTypes,
|
||||
accepts,
|
||||
returnType,
|
||||
callback
|
||||
)
|
||||
|
||||
return request.then(
|
||||
function (result) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(null, result)
|
||||
}
|
||||
return result
|
||||
},
|
||||
function (error) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(error)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询实例抵扣券的详细信息
|
||||
|
||||
* @param {Object} opts - parameters
|
||||
* @param {string} opts.instanceVoucherId - 实例抵扣券 ID
|
||||
* @param {string} regionId - ID of the region
|
||||
* @param {string} callback - callback
|
||||
@return {Object} result
|
||||
* @param instanceVoucher instanceVoucher
|
||||
*/
|
||||
|
||||
describeInstanceVoucher (opts, regionId = this.config.regionId, callback) {
|
||||
if (typeof regionId === 'function') {
|
||||
callback = regionId
|
||||
regionId = this.config.regionId
|
||||
}
|
||||
|
||||
if (regionId === undefined || regionId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'regionId' when calling describeInstanceVoucher"
|
||||
)
|
||||
}
|
||||
|
||||
opts = opts || {}
|
||||
|
||||
if (
|
||||
opts.instanceVoucherId === undefined ||
|
||||
opts.instanceVoucherId === null
|
||||
) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'opts.instanceVoucherId' when calling describeInstanceVoucher"
|
||||
)
|
||||
}
|
||||
|
||||
let postBody = null
|
||||
let queryParams = {}
|
||||
|
||||
let pathParams = {
|
||||
regionId: regionId,
|
||||
instanceVoucherId: opts.instanceVoucherId
|
||||
}
|
||||
|
||||
let headerParams = {
|
||||
'User-Agent': 'JdcloudSdkNode/1.0.0 instancevoucher/0.0.3'
|
||||
}
|
||||
|
||||
let contentTypes = ['application/json']
|
||||
let accepts = ['application/json']
|
||||
|
||||
// 扩展自定义头
|
||||
if (opts['x-extra-header']) {
|
||||
for (let extraHeader in opts['x-extra-header']) {
|
||||
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
||||
contentTypes = opts['x-extra-header']['content-type']
|
||||
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
||||
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
||||
accepts = opts['x-extra-header']['accept']
|
||||
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
||||
accepts = opts['x-extra-header']['accept'].split(',')
|
||||
}
|
||||
}
|
||||
|
||||
let formParams = {}
|
||||
|
||||
let returnType = null
|
||||
|
||||
this.config.logger(
|
||||
`call describeInstanceVoucher with params:\npathParams:${JSON.stringify(
|
||||
pathParams
|
||||
)},\nqueryParams:${JSON.stringify(
|
||||
queryParams
|
||||
)}, \nheaderParams:${JSON.stringify(
|
||||
headerParams
|
||||
)}, \nformParams:${JSON.stringify(
|
||||
formParams
|
||||
)}, \npostBody:${JSON.stringify(postBody)}`,
|
||||
'DEBUG'
|
||||
)
|
||||
|
||||
let request = super.makeRequest(
|
||||
'/regions/{regionId}/instanceVouchers/{instanceVoucherId}',
|
||||
'GET',
|
||||
pathParams,
|
||||
queryParams,
|
||||
headerParams,
|
||||
formParams,
|
||||
postBody,
|
||||
contentTypes,
|
||||
accepts,
|
||||
returnType,
|
||||
callback
|
||||
)
|
||||
|
||||
return request.then(
|
||||
function (result) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(null, result)
|
||||
}
|
||||
return result
|
||||
},
|
||||
function (error) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(error)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除实例抵扣券
|
||||
|
||||
* @param {Object} opts - parameters
|
||||
* @param {string} opts.instanceVoucherId - 实例抵扣券 ID
|
||||
* @param {string} regionId - ID of the region
|
||||
* @param {string} callback - callback
|
||||
@return {Object} result
|
||||
*/
|
||||
|
||||
deleteInstanceVoucher (opts, regionId = this.config.regionId, callback) {
|
||||
if (typeof regionId === 'function') {
|
||||
callback = regionId
|
||||
regionId = this.config.regionId
|
||||
}
|
||||
|
||||
if (regionId === undefined || regionId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'regionId' when calling deleteInstanceVoucher"
|
||||
)
|
||||
}
|
||||
|
||||
opts = opts || {}
|
||||
|
||||
if (
|
||||
opts.instanceVoucherId === undefined ||
|
||||
opts.instanceVoucherId === null
|
||||
) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'opts.instanceVoucherId' when calling deleteInstanceVoucher"
|
||||
)
|
||||
}
|
||||
|
||||
let postBody = null
|
||||
let queryParams = {}
|
||||
|
||||
let pathParams = {
|
||||
regionId: regionId,
|
||||
instanceVoucherId: opts.instanceVoucherId
|
||||
}
|
||||
|
||||
let headerParams = {
|
||||
'User-Agent': 'JdcloudSdkNode/1.0.0 instancevoucher/0.0.3'
|
||||
}
|
||||
|
||||
let contentTypes = ['application/json']
|
||||
let accepts = ['application/json']
|
||||
|
||||
// 扩展自定义头
|
||||
if (opts['x-extra-header']) {
|
||||
for (let extraHeader in opts['x-extra-header']) {
|
||||
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
||||
contentTypes = opts['x-extra-header']['content-type']
|
||||
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
||||
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
||||
accepts = opts['x-extra-header']['accept']
|
||||
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
||||
accepts = opts['x-extra-header']['accept'].split(',')
|
||||
}
|
||||
}
|
||||
|
||||
let formParams = {}
|
||||
|
||||
let returnType = null
|
||||
|
||||
this.config.logger(
|
||||
`call deleteInstanceVoucher with params:\npathParams:${JSON.stringify(
|
||||
pathParams
|
||||
)},\nqueryParams:${JSON.stringify(
|
||||
queryParams
|
||||
)}, \nheaderParams:${JSON.stringify(
|
||||
headerParams
|
||||
)}, \nformParams:${JSON.stringify(
|
||||
formParams
|
||||
)}, \npostBody:${JSON.stringify(postBody)}`,
|
||||
'DEBUG'
|
||||
)
|
||||
|
||||
let request = super.makeRequest(
|
||||
'/regions/{regionId}/instanceVouchers/{instanceVoucherId}',
|
||||
'DELETE',
|
||||
pathParams,
|
||||
queryParams,
|
||||
headerParams,
|
||||
formParams,
|
||||
postBody,
|
||||
contentTypes,
|
||||
accepts,
|
||||
returnType,
|
||||
callback
|
||||
)
|
||||
|
||||
return request.then(
|
||||
function (result) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(null, result)
|
||||
}
|
||||
return result
|
||||
},
|
||||
function (error) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(error)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改实例抵扣券的 名称 和 描述。<br>
|
||||
name 和 description 必须要指定一个
|
||||
|
||||
* @param {Object} opts - parameters
|
||||
* @param {string} opts.instanceVoucherId - 实例抵扣券 ID
|
||||
* @param {string} [opts.name] - 实例抵扣券名称 optional
|
||||
* @param {string} [opts.description] - 实例抵扣券描述 optional
|
||||
* @param {string} regionId - ID of the region
|
||||
* @param {string} callback - callback
|
||||
@return {Object} result
|
||||
*/
|
||||
|
||||
modifyInstanceVoucherAttribute (
|
||||
opts,
|
||||
regionId = this.config.regionId,
|
||||
callback
|
||||
) {
|
||||
if (typeof regionId === 'function') {
|
||||
callback = regionId
|
||||
regionId = this.config.regionId
|
||||
}
|
||||
|
||||
if (regionId === undefined || regionId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'regionId' when calling modifyInstanceVoucherAttribute"
|
||||
)
|
||||
}
|
||||
|
||||
opts = opts || {}
|
||||
|
||||
if (
|
||||
opts.instanceVoucherId === undefined ||
|
||||
opts.instanceVoucherId === null
|
||||
) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'opts.instanceVoucherId' when calling modifyInstanceVoucherAttribute"
|
||||
)
|
||||
}
|
||||
|
||||
let postBody = {}
|
||||
if (opts.name !== undefined && opts.name !== null) {
|
||||
postBody['name'] = opts.name
|
||||
}
|
||||
if (opts.description !== undefined && opts.description !== null) {
|
||||
postBody['description'] = opts.description
|
||||
}
|
||||
|
||||
let queryParams = {}
|
||||
|
||||
let pathParams = {
|
||||
regionId: regionId,
|
||||
instanceVoucherId: opts.instanceVoucherId
|
||||
}
|
||||
|
||||
let headerParams = {
|
||||
'User-Agent': 'JdcloudSdkNode/1.0.0 instancevoucher/0.0.3'
|
||||
}
|
||||
|
||||
let contentTypes = ['application/json']
|
||||
let accepts = ['application/json']
|
||||
|
||||
// 扩展自定义头
|
||||
if (opts['x-extra-header']) {
|
||||
for (let extraHeader in opts['x-extra-header']) {
|
||||
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
||||
contentTypes = opts['x-extra-header']['content-type']
|
||||
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
||||
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
||||
accepts = opts['x-extra-header']['accept']
|
||||
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
||||
accepts = opts['x-extra-header']['accept'].split(',')
|
||||
}
|
||||
}
|
||||
|
||||
let formParams = {}
|
||||
|
||||
let returnType = null
|
||||
|
||||
this.config.logger(
|
||||
`call modifyInstanceVoucherAttribute with params:\npathParams:${JSON.stringify(
|
||||
pathParams
|
||||
)},\nqueryParams:${JSON.stringify(
|
||||
queryParams
|
||||
)}, \nheaderParams:${JSON.stringify(
|
||||
headerParams
|
||||
)}, \nformParams:${JSON.stringify(
|
||||
formParams
|
||||
)}, \npostBody:${JSON.stringify(postBody)}`,
|
||||
'DEBUG'
|
||||
)
|
||||
|
||||
let request = super.makeRequest(
|
||||
'/regions/{regionId}/instanceVouchers/{instanceVoucherId}:modifyInstanceVoucherAttribute',
|
||||
'PATCH',
|
||||
pathParams,
|
||||
queryParams,
|
||||
headerParams,
|
||||
formParams,
|
||||
postBody,
|
||||
contentTypes,
|
||||
accepts,
|
||||
returnType,
|
||||
callback
|
||||
)
|
||||
|
||||
return request.then(
|
||||
function (result) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(null, result)
|
||||
}
|
||||
return result
|
||||
},
|
||||
function (error) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(error)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
module.exports = INSTANCEVOUCHER
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,947 @@
|
||||
/*
|
||||
* Copyright 2018 JDCLOUD.COM
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http:#www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* iot-card-Related-API
|
||||
* 物联网卡服务相关API
|
||||
*
|
||||
* OpenAPI spec version: v1
|
||||
* Contact:
|
||||
*
|
||||
* NOTE: This class is auto generated by the jdcloud code generator program.
|
||||
*/
|
||||
|
||||
require('../../../lib/node_loader')
|
||||
var JDCloud = require('../../../lib/core')
|
||||
var Service = JDCloud.Service
|
||||
var serviceId = 'iotcard'
|
||||
Service._services[serviceId] = true
|
||||
|
||||
/**
|
||||
* iotcard service.
|
||||
* @version 1.0.0
|
||||
*/
|
||||
|
||||
JDCloud.IOTCARD = class IOTCARD extends Service {
|
||||
constructor (options = {}) {
|
||||
options._defaultEndpoint = {}
|
||||
options._defaultEndpoint.protocol =
|
||||
options._defaultEndpoint.protocol || 'https'
|
||||
options._defaultEndpoint.host =
|
||||
options._defaultEndpoint.host || 'openapi.myiot.jdcloud.com'
|
||||
options.basePath = '/v1' // 默认要设为空""
|
||||
super(serviceId, options)
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据物联网卡iccid查询该卡的gprs状态信息
|
||||
* @param {Object} opts - parameters
|
||||
* @param {string} opts.iccid - 物联网卡iccid
|
||||
* @param {string} regionId - ID of the region
|
||||
* @param {string} callback - callback
|
||||
@return {Object} result
|
||||
* @param string status 请求状态(0:成功;1:失败)
|
||||
* @param string message 消息描述
|
||||
* @param gprsStatusResp result 指定物联网卡的gprs状态信息
|
||||
*/
|
||||
|
||||
gprsStatus (opts, regionId = this.config.regionId, callback) {
|
||||
if (typeof regionId === 'function') {
|
||||
callback = regionId
|
||||
regionId = this.config.regionId
|
||||
}
|
||||
|
||||
if (regionId === undefined || regionId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'regionId' when calling gprsStatus"
|
||||
)
|
||||
}
|
||||
|
||||
opts = opts || {}
|
||||
|
||||
if (opts.iccid === undefined || opts.iccid === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'opts.iccid' when calling gprsStatus"
|
||||
)
|
||||
}
|
||||
|
||||
let postBody = null
|
||||
let queryParams = {}
|
||||
if (opts.iccid !== undefined && opts.iccid !== null) {
|
||||
queryParams['iccid'] = opts.iccid
|
||||
}
|
||||
|
||||
let pathParams = {
|
||||
regionId: regionId
|
||||
}
|
||||
|
||||
let headerParams = {
|
||||
'User-Agent': 'JdcloudSdkNode/1.0.0 iotcard/1.0.0'
|
||||
}
|
||||
|
||||
let contentTypes = ['application/json']
|
||||
let accepts = ['application/json']
|
||||
|
||||
// 扩展自定义头
|
||||
if (opts['x-extra-header']) {
|
||||
for (let extraHeader in opts['x-extra-header']) {
|
||||
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
||||
contentTypes = opts['x-extra-header']['content-type']
|
||||
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
||||
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
||||
accepts = opts['x-extra-header']['accept']
|
||||
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
||||
accepts = opts['x-extra-header']['accept'].split(',')
|
||||
}
|
||||
}
|
||||
|
||||
let formParams = {}
|
||||
|
||||
let returnType = null
|
||||
|
||||
this.config.logger(
|
||||
`call gprsStatus with params:\npathParams:${JSON.stringify(
|
||||
pathParams
|
||||
)},\nqueryParams:${JSON.stringify(
|
||||
queryParams
|
||||
)}, \nheaderParams:${JSON.stringify(
|
||||
headerParams
|
||||
)}, \nformParams:${JSON.stringify(
|
||||
formParams
|
||||
)}, \npostBody:${JSON.stringify(postBody)}`,
|
||||
'DEBUG'
|
||||
)
|
||||
|
||||
let request = this.makeRequest(
|
||||
'/regions/{regionId}/gprsStatus',
|
||||
'GET',
|
||||
pathParams,
|
||||
queryParams,
|
||||
headerParams,
|
||||
formParams,
|
||||
postBody,
|
||||
contentTypes,
|
||||
accepts,
|
||||
returnType,
|
||||
callback
|
||||
)
|
||||
|
||||
return request.then(
|
||||
function (result) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(null, result)
|
||||
}
|
||||
return result
|
||||
},
|
||||
function (error) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(error)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据物联网卡iccid查询该卡的开关机状态信息
|
||||
* @param {Object} opts - parameters
|
||||
* @param {string} opts.iccid - 物联网卡iccid
|
||||
* @param {string} regionId - ID of the region
|
||||
* @param {string} callback - callback
|
||||
@return {Object} result
|
||||
* @param string status 请求状态(0:成功;1:失败)
|
||||
* @param string message 消息描述
|
||||
* @param onOffStatusResp result 指定物联网卡的开关机状态信息
|
||||
*/
|
||||
|
||||
onOffStatus (opts, regionId = this.config.regionId, callback) {
|
||||
if (typeof regionId === 'function') {
|
||||
callback = regionId
|
||||
regionId = this.config.regionId
|
||||
}
|
||||
|
||||
if (regionId === undefined || regionId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'regionId' when calling onOffStatus"
|
||||
)
|
||||
}
|
||||
|
||||
opts = opts || {}
|
||||
|
||||
if (opts.iccid === undefined || opts.iccid === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'opts.iccid' when calling onOffStatus"
|
||||
)
|
||||
}
|
||||
|
||||
let postBody = null
|
||||
let queryParams = {}
|
||||
if (opts.iccid !== undefined && opts.iccid !== null) {
|
||||
queryParams['iccid'] = opts.iccid
|
||||
}
|
||||
|
||||
let pathParams = {
|
||||
regionId: regionId
|
||||
}
|
||||
|
||||
let headerParams = {
|
||||
'User-Agent': 'JdcloudSdkNode/1.0.0 iotcard/1.0.0'
|
||||
}
|
||||
|
||||
let contentTypes = ['application/json']
|
||||
let accepts = ['application/json']
|
||||
|
||||
// 扩展自定义头
|
||||
if (opts['x-extra-header']) {
|
||||
for (let extraHeader in opts['x-extra-header']) {
|
||||
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
||||
contentTypes = opts['x-extra-header']['content-type']
|
||||
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
||||
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
||||
accepts = opts['x-extra-header']['accept']
|
||||
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
||||
accepts = opts['x-extra-header']['accept'].split(',')
|
||||
}
|
||||
}
|
||||
|
||||
let formParams = {}
|
||||
|
||||
let returnType = null
|
||||
|
||||
this.config.logger(
|
||||
`call onOffStatus with params:\npathParams:${JSON.stringify(
|
||||
pathParams
|
||||
)},\nqueryParams:${JSON.stringify(
|
||||
queryParams
|
||||
)}, \nheaderParams:${JSON.stringify(
|
||||
headerParams
|
||||
)}, \nformParams:${JSON.stringify(
|
||||
formParams
|
||||
)}, \npostBody:${JSON.stringify(postBody)}`,
|
||||
'DEBUG'
|
||||
)
|
||||
|
||||
let request = this.makeRequest(
|
||||
'/regions/{regionId}/onOffStatus',
|
||||
'GET',
|
||||
pathParams,
|
||||
queryParams,
|
||||
headerParams,
|
||||
formParams,
|
||||
postBody,
|
||||
contentTypes,
|
||||
accepts,
|
||||
returnType,
|
||||
callback
|
||||
)
|
||||
|
||||
return request.then(
|
||||
function (result) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(null, result)
|
||||
}
|
||||
return result
|
||||
},
|
||||
function (error) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(error)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据物联网卡iccid查询该卡的生命周期信息
|
||||
* @param {Object} opts - parameters
|
||||
* @param {string} opts.iccid - 物联网卡iccid
|
||||
* @param {string} regionId - ID of the region
|
||||
* @param {string} callback - callback
|
||||
@return {Object} result
|
||||
* @param string status 请求状态(0:成功;1:失败)
|
||||
* @param string message 消息描述
|
||||
* @param lifeStatusResp result 指定物联网卡的生命周期信息
|
||||
*/
|
||||
|
||||
lifeStatus (opts, regionId = this.config.regionId, callback) {
|
||||
if (typeof regionId === 'function') {
|
||||
callback = regionId
|
||||
regionId = this.config.regionId
|
||||
}
|
||||
|
||||
if (regionId === undefined || regionId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'regionId' when calling lifeStatus"
|
||||
)
|
||||
}
|
||||
|
||||
opts = opts || {}
|
||||
|
||||
if (opts.iccid === undefined || opts.iccid === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'opts.iccid' when calling lifeStatus"
|
||||
)
|
||||
}
|
||||
|
||||
let postBody = null
|
||||
let queryParams = {}
|
||||
if (opts.iccid !== undefined && opts.iccid !== null) {
|
||||
queryParams['iccid'] = opts.iccid
|
||||
}
|
||||
|
||||
let pathParams = {
|
||||
regionId: regionId
|
||||
}
|
||||
|
||||
let headerParams = {
|
||||
'User-Agent': 'JdcloudSdkNode/1.0.0 iotcard/1.0.0'
|
||||
}
|
||||
|
||||
let contentTypes = ['application/json']
|
||||
let accepts = ['application/json']
|
||||
|
||||
// 扩展自定义头
|
||||
if (opts['x-extra-header']) {
|
||||
for (let extraHeader in opts['x-extra-header']) {
|
||||
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
||||
contentTypes = opts['x-extra-header']['content-type']
|
||||
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
||||
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
||||
accepts = opts['x-extra-header']['accept']
|
||||
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
||||
accepts = opts['x-extra-header']['accept'].split(',')
|
||||
}
|
||||
}
|
||||
|
||||
let formParams = {}
|
||||
|
||||
let returnType = null
|
||||
|
||||
this.config.logger(
|
||||
`call lifeStatus with params:\npathParams:${JSON.stringify(
|
||||
pathParams
|
||||
)},\nqueryParams:${JSON.stringify(
|
||||
queryParams
|
||||
)}, \nheaderParams:${JSON.stringify(
|
||||
headerParams
|
||||
)}, \nformParams:${JSON.stringify(
|
||||
formParams
|
||||
)}, \npostBody:${JSON.stringify(postBody)}`,
|
||||
'DEBUG'
|
||||
)
|
||||
|
||||
let request = this.makeRequest(
|
||||
'/regions/{regionId}/lifeStatus',
|
||||
'GET',
|
||||
pathParams,
|
||||
queryParams,
|
||||
headerParams,
|
||||
formParams,
|
||||
postBody,
|
||||
contentTypes,
|
||||
accepts,
|
||||
returnType,
|
||||
callback
|
||||
)
|
||||
|
||||
return request.then(
|
||||
function (result) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(null, result)
|
||||
}
|
||||
return result
|
||||
},
|
||||
function (error) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(error)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据物联网卡iccid查询该卡的当月套餐内的GPRS实时使用量
|
||||
* @param {Object} opts - parameters
|
||||
* @param {string} opts.iccid - 物联网卡iccid
|
||||
* @param {string} regionId - ID of the region
|
||||
* @param {string} callback - callback
|
||||
@return {Object} result
|
||||
* @param string status 请求状态(0:成功;1:失败)
|
||||
* @param string message 消息描述
|
||||
* @param gprsRealtimeInfoResp result 指定物联网卡的当月套餐内的GPRS实时使用量
|
||||
*/
|
||||
|
||||
gprsRealtimeInfo (opts, regionId = this.config.regionId, callback) {
|
||||
if (typeof regionId === 'function') {
|
||||
callback = regionId
|
||||
regionId = this.config.regionId
|
||||
}
|
||||
|
||||
if (regionId === undefined || regionId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'regionId' when calling gprsRealtimeInfo"
|
||||
)
|
||||
}
|
||||
|
||||
opts = opts || {}
|
||||
|
||||
if (opts.iccid === undefined || opts.iccid === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'opts.iccid' when calling gprsRealtimeInfo"
|
||||
)
|
||||
}
|
||||
|
||||
let postBody = null
|
||||
let queryParams = {}
|
||||
if (opts.iccid !== undefined && opts.iccid !== null) {
|
||||
queryParams['iccid'] = opts.iccid
|
||||
}
|
||||
|
||||
let pathParams = {
|
||||
regionId: regionId
|
||||
}
|
||||
|
||||
let headerParams = {
|
||||
'User-Agent': 'JdcloudSdkNode/1.0.0 iotcard/1.0.0'
|
||||
}
|
||||
|
||||
let contentTypes = ['application/json']
|
||||
let accepts = ['application/json']
|
||||
|
||||
// 扩展自定义头
|
||||
if (opts['x-extra-header']) {
|
||||
for (let extraHeader in opts['x-extra-header']) {
|
||||
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
||||
contentTypes = opts['x-extra-header']['content-type']
|
||||
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
||||
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
||||
accepts = opts['x-extra-header']['accept']
|
||||
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
||||
accepts = opts['x-extra-header']['accept'].split(',')
|
||||
}
|
||||
}
|
||||
|
||||
let formParams = {}
|
||||
|
||||
let returnType = null
|
||||
|
||||
this.config.logger(
|
||||
`call gprsRealtimeInfo with params:\npathParams:${JSON.stringify(
|
||||
pathParams
|
||||
)},\nqueryParams:${JSON.stringify(
|
||||
queryParams
|
||||
)}, \nheaderParams:${JSON.stringify(
|
||||
headerParams
|
||||
)}, \nformParams:${JSON.stringify(
|
||||
formParams
|
||||
)}, \npostBody:${JSON.stringify(postBody)}`,
|
||||
'DEBUG'
|
||||
)
|
||||
|
||||
let request = this.makeRequest(
|
||||
'/regions/{regionId}/gprsRealtimeInfo',
|
||||
'GET',
|
||||
pathParams,
|
||||
queryParams,
|
||||
headerParams,
|
||||
formParams,
|
||||
postBody,
|
||||
contentTypes,
|
||||
accepts,
|
||||
returnType,
|
||||
callback
|
||||
)
|
||||
|
||||
return request.then(
|
||||
function (result) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(null, result)
|
||||
}
|
||||
return result
|
||||
},
|
||||
function (error) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(error)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 物联网卡开机操作
|
||||
* @param {Object} opts - parameters
|
||||
* @param {array} [opts.iccids] - 物联网卡号码列表(单次提交最多不超过200个号码) optional
|
||||
* @param {string} regionId - ID of the region
|
||||
* @param {string} callback - callback
|
||||
@return {Object} result
|
||||
* @param string status 请求状态(0:成功;1:失败)
|
||||
* @param string message 消息描述
|
||||
* @param operationIotCardResp result
|
||||
*/
|
||||
|
||||
openIotCard (opts, regionId = this.config.regionId, callback) {
|
||||
if (typeof regionId === 'function') {
|
||||
callback = regionId
|
||||
regionId = this.config.regionId
|
||||
}
|
||||
|
||||
if (regionId === undefined || regionId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'regionId' when calling openIotCard"
|
||||
)
|
||||
}
|
||||
|
||||
opts = opts || {}
|
||||
|
||||
let postBody = {}
|
||||
if (opts.iccids !== undefined && opts.iccids !== null) {
|
||||
postBody['iccids'] = opts.iccids
|
||||
}
|
||||
|
||||
let queryParams = {}
|
||||
|
||||
let pathParams = {
|
||||
regionId: regionId
|
||||
}
|
||||
|
||||
let headerParams = {
|
||||
'User-Agent': 'JdcloudSdkNode/1.0.0 iotcard/1.0.0'
|
||||
}
|
||||
|
||||
let contentTypes = ['application/json']
|
||||
let accepts = ['application/json']
|
||||
|
||||
// 扩展自定义头
|
||||
if (opts['x-extra-header']) {
|
||||
for (let extraHeader in opts['x-extra-header']) {
|
||||
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
||||
contentTypes = opts['x-extra-header']['content-type']
|
||||
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
||||
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
||||
accepts = opts['x-extra-header']['accept']
|
||||
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
||||
accepts = opts['x-extra-header']['accept'].split(',')
|
||||
}
|
||||
}
|
||||
|
||||
let formParams = {}
|
||||
|
||||
let returnType = null
|
||||
|
||||
this.config.logger(
|
||||
`call openIotCard with params:\npathParams:${JSON.stringify(
|
||||
pathParams
|
||||
)},\nqueryParams:${JSON.stringify(
|
||||
queryParams
|
||||
)}, \nheaderParams:${JSON.stringify(
|
||||
headerParams
|
||||
)}, \nformParams:${JSON.stringify(
|
||||
formParams
|
||||
)}, \npostBody:${JSON.stringify(postBody)}`,
|
||||
'DEBUG'
|
||||
)
|
||||
|
||||
let request = this.makeRequest(
|
||||
'/regions/{regionId}/openIotCard',
|
||||
'POST',
|
||||
pathParams,
|
||||
queryParams,
|
||||
headerParams,
|
||||
formParams,
|
||||
postBody,
|
||||
contentTypes,
|
||||
accepts,
|
||||
returnType,
|
||||
callback
|
||||
)
|
||||
|
||||
return request.then(
|
||||
function (result) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(null, result)
|
||||
}
|
||||
return result
|
||||
},
|
||||
function (error) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(error)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 物联网卡停机操作
|
||||
* @param {Object} opts - parameters
|
||||
* @param {array} [opts.iccids] - 物联网卡号码列表(单次提交最多不超过200个号码) optional
|
||||
* @param {string} regionId - ID of the region
|
||||
* @param {string} callback - callback
|
||||
@return {Object} result
|
||||
* @param string status 请求状态(0:成功;1:失败)
|
||||
* @param string message 消息描述
|
||||
* @param operationIotCardResp result
|
||||
*/
|
||||
|
||||
closeIotCard (opts, regionId = this.config.regionId, callback) {
|
||||
if (typeof regionId === 'function') {
|
||||
callback = regionId
|
||||
regionId = this.config.regionId
|
||||
}
|
||||
|
||||
if (regionId === undefined || regionId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'regionId' when calling closeIotCard"
|
||||
)
|
||||
}
|
||||
|
||||
opts = opts || {}
|
||||
|
||||
let postBody = {}
|
||||
if (opts.iccids !== undefined && opts.iccids !== null) {
|
||||
postBody['iccids'] = opts.iccids
|
||||
}
|
||||
|
||||
let queryParams = {}
|
||||
|
||||
let pathParams = {
|
||||
regionId: regionId
|
||||
}
|
||||
|
||||
let headerParams = {
|
||||
'User-Agent': 'JdcloudSdkNode/1.0.0 iotcard/1.0.0'
|
||||
}
|
||||
|
||||
let contentTypes = ['application/json']
|
||||
let accepts = ['application/json']
|
||||
|
||||
// 扩展自定义头
|
||||
if (opts['x-extra-header']) {
|
||||
for (let extraHeader in opts['x-extra-header']) {
|
||||
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
||||
contentTypes = opts['x-extra-header']['content-type']
|
||||
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
||||
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
||||
accepts = opts['x-extra-header']['accept']
|
||||
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
||||
accepts = opts['x-extra-header']['accept'].split(',')
|
||||
}
|
||||
}
|
||||
|
||||
let formParams = {}
|
||||
|
||||
let returnType = null
|
||||
|
||||
this.config.logger(
|
||||
`call closeIotCard with params:\npathParams:${JSON.stringify(
|
||||
pathParams
|
||||
)},\nqueryParams:${JSON.stringify(
|
||||
queryParams
|
||||
)}, \nheaderParams:${JSON.stringify(
|
||||
headerParams
|
||||
)}, \nformParams:${JSON.stringify(
|
||||
formParams
|
||||
)}, \npostBody:${JSON.stringify(postBody)}`,
|
||||
'DEBUG'
|
||||
)
|
||||
|
||||
let request = this.makeRequest(
|
||||
'/regions/{regionId}/closeIotCard',
|
||||
'POST',
|
||||
pathParams,
|
||||
queryParams,
|
||||
headerParams,
|
||||
formParams,
|
||||
postBody,
|
||||
contentTypes,
|
||||
accepts,
|
||||
returnType,
|
||||
callback
|
||||
)
|
||||
|
||||
return request.then(
|
||||
function (result) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(null, result)
|
||||
}
|
||||
return result
|
||||
},
|
||||
function (error) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(error)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 物联网卡开启流量操作
|
||||
* @param {Object} opts - parameters
|
||||
* @param {array} [opts.iccids] - 物联网卡号码列表(单次提交最多不超过200个号码) optional
|
||||
* @param {string} regionId - ID of the region
|
||||
* @param {string} callback - callback
|
||||
@return {Object} result
|
||||
* @param string status 请求状态(0:成功;1:失败)
|
||||
* @param string message 消息描述
|
||||
* @param operationIotCardResp result
|
||||
*/
|
||||
|
||||
openIotFlow (opts, regionId = this.config.regionId, callback) {
|
||||
if (typeof regionId === 'function') {
|
||||
callback = regionId
|
||||
regionId = this.config.regionId
|
||||
}
|
||||
|
||||
if (regionId === undefined || regionId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'regionId' when calling openIotFlow"
|
||||
)
|
||||
}
|
||||
|
||||
opts = opts || {}
|
||||
|
||||
let postBody = {}
|
||||
if (opts.iccids !== undefined && opts.iccids !== null) {
|
||||
postBody['iccids'] = opts.iccids
|
||||
}
|
||||
|
||||
let queryParams = {}
|
||||
|
||||
let pathParams = {
|
||||
regionId: regionId
|
||||
}
|
||||
|
||||
let headerParams = {
|
||||
'User-Agent': 'JdcloudSdkNode/1.0.0 iotcard/1.0.0'
|
||||
}
|
||||
|
||||
let contentTypes = ['application/json']
|
||||
let accepts = ['application/json']
|
||||
|
||||
// 扩展自定义头
|
||||
if (opts['x-extra-header']) {
|
||||
for (let extraHeader in opts['x-extra-header']) {
|
||||
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
||||
contentTypes = opts['x-extra-header']['content-type']
|
||||
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
||||
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
||||
accepts = opts['x-extra-header']['accept']
|
||||
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
||||
accepts = opts['x-extra-header']['accept'].split(',')
|
||||
}
|
||||
}
|
||||
|
||||
let formParams = {}
|
||||
|
||||
let returnType = null
|
||||
|
||||
this.config.logger(
|
||||
`call openIotFlow with params:\npathParams:${JSON.stringify(
|
||||
pathParams
|
||||
)},\nqueryParams:${JSON.stringify(
|
||||
queryParams
|
||||
)}, \nheaderParams:${JSON.stringify(
|
||||
headerParams
|
||||
)}, \nformParams:${JSON.stringify(
|
||||
formParams
|
||||
)}, \npostBody:${JSON.stringify(postBody)}`,
|
||||
'DEBUG'
|
||||
)
|
||||
|
||||
let request = this.makeRequest(
|
||||
'/regions/{regionId}/openIotFlow',
|
||||
'POST',
|
||||
pathParams,
|
||||
queryParams,
|
||||
headerParams,
|
||||
formParams,
|
||||
postBody,
|
||||
contentTypes,
|
||||
accepts,
|
||||
returnType,
|
||||
callback
|
||||
)
|
||||
|
||||
return request.then(
|
||||
function (result) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(null, result)
|
||||
}
|
||||
return result
|
||||
},
|
||||
function (error) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(error)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 物联网卡停流量操作
|
||||
* @param {Object} opts - parameters
|
||||
* @param {array} [opts.iccids] - 物联网卡号码列表(单次提交最多不超过200个号码) optional
|
||||
* @param {string} regionId - ID of the region
|
||||
* @param {string} callback - callback
|
||||
@return {Object} result
|
||||
* @param string status 请求状态(0:成功;1:失败)
|
||||
* @param string message 消息描述
|
||||
* @param operationIotCardResp result
|
||||
*/
|
||||
|
||||
closeIotFlow (opts, regionId = this.config.regionId, callback) {
|
||||
if (typeof regionId === 'function') {
|
||||
callback = regionId
|
||||
regionId = this.config.regionId
|
||||
}
|
||||
|
||||
if (regionId === undefined || regionId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'regionId' when calling closeIotFlow"
|
||||
)
|
||||
}
|
||||
|
||||
opts = opts || {}
|
||||
|
||||
let postBody = {}
|
||||
if (opts.iccids !== undefined && opts.iccids !== null) {
|
||||
postBody['iccids'] = opts.iccids
|
||||
}
|
||||
|
||||
let queryParams = {}
|
||||
|
||||
let pathParams = {
|
||||
regionId: regionId
|
||||
}
|
||||
|
||||
let headerParams = {
|
||||
'User-Agent': 'JdcloudSdkNode/1.0.0 iotcard/1.0.0'
|
||||
}
|
||||
|
||||
let contentTypes = ['application/json']
|
||||
let accepts = ['application/json']
|
||||
|
||||
// 扩展自定义头
|
||||
if (opts['x-extra-header']) {
|
||||
for (let extraHeader in opts['x-extra-header']) {
|
||||
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
||||
contentTypes = opts['x-extra-header']['content-type']
|
||||
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
||||
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
||||
accepts = opts['x-extra-header']['accept']
|
||||
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
||||
accepts = opts['x-extra-header']['accept'].split(',')
|
||||
}
|
||||
}
|
||||
|
||||
let formParams = {}
|
||||
|
||||
let returnType = null
|
||||
|
||||
this.config.logger(
|
||||
`call closeIotFlow with params:\npathParams:${JSON.stringify(
|
||||
pathParams
|
||||
)},\nqueryParams:${JSON.stringify(
|
||||
queryParams
|
||||
)}, \nheaderParams:${JSON.stringify(
|
||||
headerParams
|
||||
)}, \nformParams:${JSON.stringify(
|
||||
formParams
|
||||
)}, \npostBody:${JSON.stringify(postBody)}`,
|
||||
'DEBUG'
|
||||
)
|
||||
|
||||
let request = this.makeRequest(
|
||||
'/regions/{regionId}/closeIotFlow',
|
||||
'POST',
|
||||
pathParams,
|
||||
queryParams,
|
||||
headerParams,
|
||||
formParams,
|
||||
postBody,
|
||||
contentTypes,
|
||||
accepts,
|
||||
returnType,
|
||||
callback
|
||||
)
|
||||
|
||||
return request.then(
|
||||
function (result) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(null, result)
|
||||
}
|
||||
return result
|
||||
},
|
||||
function (error) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(error)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
module.exports = JDCloud.IOTCARD
|
||||
@@ -0,0 +1,616 @@
|
||||
/*
|
||||
* Copyright 2018 JDCLOUD.COM
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http:#www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* iotcloudgateway开通接口
|
||||
* 用户开通iotcloudgateway服务相关接口
|
||||
*
|
||||
* OpenAPI spec version: v1
|
||||
* Contact:
|
||||
*
|
||||
* NOTE: This class is auto generated by the jdcloud code generator program.
|
||||
*/
|
||||
|
||||
require('../../../lib/node_loader')
|
||||
var JDCloud = require('../../../lib/core')
|
||||
var Service = JDCloud.Service
|
||||
var serviceId = 'iotcloudgateway'
|
||||
Service._services[serviceId] = true
|
||||
|
||||
/**
|
||||
* iotcloudgateway service.
|
||||
* @version 1.0.1
|
||||
*/
|
||||
|
||||
JDCloud.IOTCLOUDGATEWAY = class IOTCLOUDGATEWAY extends Service {
|
||||
constructor (options = {}) {
|
||||
options._defaultEndpoint = {}
|
||||
options._defaultEndpoint.protocol =
|
||||
options._defaultEndpoint.protocol || 'https'
|
||||
options._defaultEndpoint.host =
|
||||
options._defaultEndpoint.host || 'iotcloudgateway.jdcloud-api.com'
|
||||
options.basePath = '/v1' // 默认要设为空""
|
||||
super(serviceId, options)
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询iotcloudgateway实例列表
|
||||
* @param {Object} opts - parameters
|
||||
* @param {integer} [opts.pageNumber] - 页码 optional
|
||||
* @param {integer} [opts.pageSize] - 分页大小 optional
|
||||
* @param {string} regionId - ID of the region
|
||||
* @param {string} callback - callback
|
||||
@return {Object} result
|
||||
* @param instance instances
|
||||
* @param integer totalCount iotcloudgateway实例总数
|
||||
*/
|
||||
|
||||
describeInstances (opts, regionId = this.config.regionId, callback) {
|
||||
if (typeof regionId === 'function') {
|
||||
callback = regionId
|
||||
regionId = this.config.regionId
|
||||
}
|
||||
|
||||
if (regionId === undefined || regionId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'regionId' when calling describeInstances"
|
||||
)
|
||||
}
|
||||
|
||||
opts = opts || {}
|
||||
|
||||
let postBody = null
|
||||
let queryParams = {}
|
||||
if (opts.pageNumber !== undefined && opts.pageNumber !== null) {
|
||||
queryParams['pageNumber'] = opts.pageNumber
|
||||
}
|
||||
if (opts.pageSize !== undefined && opts.pageSize !== null) {
|
||||
queryParams['pageSize'] = opts.pageSize
|
||||
}
|
||||
|
||||
let pathParams = {
|
||||
regionId: regionId
|
||||
}
|
||||
|
||||
let headerParams = {
|
||||
'User-Agent': 'JdcloudSdkNode/1.0.0 iotcloudgateway/1.0.1'
|
||||
}
|
||||
|
||||
let contentTypes = ['application/json']
|
||||
let accepts = ['application/json']
|
||||
|
||||
// 扩展自定义头
|
||||
if (opts['x-extra-header']) {
|
||||
for (let extraHeader in opts['x-extra-header']) {
|
||||
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
||||
contentTypes = opts['x-extra-header']['content-type']
|
||||
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
||||
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
||||
accepts = opts['x-extra-header']['accept']
|
||||
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
||||
accepts = opts['x-extra-header']['accept'].split(',')
|
||||
}
|
||||
}
|
||||
|
||||
let formParams = {}
|
||||
|
||||
let returnType = null
|
||||
|
||||
this.config.logger(
|
||||
`call describeInstances with params:\npathParams:${JSON.stringify(
|
||||
pathParams
|
||||
)},\nqueryParams:${JSON.stringify(
|
||||
queryParams
|
||||
)}, \nheaderParams:${JSON.stringify(
|
||||
headerParams
|
||||
)}, \nformParams:${JSON.stringify(
|
||||
formParams
|
||||
)}, \npostBody:${JSON.stringify(postBody)}`,
|
||||
'DEBUG'
|
||||
)
|
||||
|
||||
let request = this.makeRequest(
|
||||
'/regions/{regionId}/instances',
|
||||
'GET',
|
||||
pathParams,
|
||||
queryParams,
|
||||
headerParams,
|
||||
formParams,
|
||||
postBody,
|
||||
contentTypes,
|
||||
accepts,
|
||||
returnType,
|
||||
callback
|
||||
)
|
||||
|
||||
return request.then(
|
||||
function (result) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(null, result)
|
||||
}
|
||||
return result
|
||||
},
|
||||
function (error) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(error)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询iotcloudgateway实例详情
|
||||
* @param {Object} opts - parameters
|
||||
* @param {string} opts.instanceId - 实例ID
|
||||
* @param {string} regionId - ID of the region
|
||||
* @param {string} callback - callback
|
||||
@return {Object} result
|
||||
* @param instance instance 实例相关信息
|
||||
*/
|
||||
|
||||
describeInstance (opts, regionId = this.config.regionId, callback) {
|
||||
if (typeof regionId === 'function') {
|
||||
callback = regionId
|
||||
regionId = this.config.regionId
|
||||
}
|
||||
|
||||
if (regionId === undefined || regionId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'regionId' when calling describeInstance"
|
||||
)
|
||||
}
|
||||
|
||||
opts = opts || {}
|
||||
|
||||
if (opts.instanceId === undefined || opts.instanceId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'opts.instanceId' when calling describeInstance"
|
||||
)
|
||||
}
|
||||
|
||||
let postBody = {}
|
||||
|
||||
let queryParams = {}
|
||||
|
||||
let pathParams = {
|
||||
regionId: regionId,
|
||||
instanceId: opts.instanceId
|
||||
}
|
||||
|
||||
let headerParams = {
|
||||
'User-Agent': 'JdcloudSdkNode/1.0.0 iotcloudgateway/1.0.1'
|
||||
}
|
||||
|
||||
let contentTypes = ['application/json']
|
||||
let accepts = ['application/json']
|
||||
|
||||
// 扩展自定义头
|
||||
if (opts['x-extra-header']) {
|
||||
for (let extraHeader in opts['x-extra-header']) {
|
||||
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
||||
contentTypes = opts['x-extra-header']['content-type']
|
||||
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
||||
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
||||
accepts = opts['x-extra-header']['accept']
|
||||
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
||||
accepts = opts['x-extra-header']['accept'].split(',')
|
||||
}
|
||||
}
|
||||
|
||||
let formParams = {}
|
||||
|
||||
let returnType = null
|
||||
|
||||
this.config.logger(
|
||||
`call describeInstance with params:\npathParams:${JSON.stringify(
|
||||
pathParams
|
||||
)},\nqueryParams:${JSON.stringify(
|
||||
queryParams
|
||||
)}, \nheaderParams:${JSON.stringify(
|
||||
headerParams
|
||||
)}, \nformParams:${JSON.stringify(
|
||||
formParams
|
||||
)}, \npostBody:${JSON.stringify(postBody)}`,
|
||||
'DEBUG'
|
||||
)
|
||||
|
||||
let request = this.makeRequest(
|
||||
'/regions/{regionId}/instances/{instanceId}:describeInstance',
|
||||
'POST',
|
||||
pathParams,
|
||||
queryParams,
|
||||
headerParams,
|
||||
formParams,
|
||||
postBody,
|
||||
contentTypes,
|
||||
accepts,
|
||||
returnType,
|
||||
callback
|
||||
)
|
||||
|
||||
return request.then(
|
||||
function (result) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(null, result)
|
||||
}
|
||||
return result
|
||||
},
|
||||
function (error) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(error)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询instance绑定的ExposedDomain
|
||||
* @param {Object} opts - parameters
|
||||
* @param {string} opts.instanceId - 实例ID
|
||||
* @param {string} regionId - ID of the region
|
||||
* @param {string} callback - callback
|
||||
@return {Object} result
|
||||
* @param string iotgwd 实例对应下行域名
|
||||
* @param string iotgwu 实例对应上行域名
|
||||
*/
|
||||
|
||||
queryInstanceExposeDomain (opts, regionId = this.config.regionId, callback) {
|
||||
if (typeof regionId === 'function') {
|
||||
callback = regionId
|
||||
regionId = this.config.regionId
|
||||
}
|
||||
|
||||
if (regionId === undefined || regionId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'regionId' when calling queryInstanceExposeDomain"
|
||||
)
|
||||
}
|
||||
|
||||
opts = opts || {}
|
||||
|
||||
if (opts.instanceId === undefined || opts.instanceId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'opts.instanceId' when calling queryInstanceExposeDomain"
|
||||
)
|
||||
}
|
||||
|
||||
let postBody = {}
|
||||
|
||||
let queryParams = {}
|
||||
|
||||
let pathParams = {
|
||||
regionId: regionId,
|
||||
instanceId: opts.instanceId
|
||||
}
|
||||
|
||||
let headerParams = {
|
||||
'User-Agent': 'JdcloudSdkNode/1.0.0 iotcloudgateway/1.0.1'
|
||||
}
|
||||
|
||||
let contentTypes = ['application/json']
|
||||
let accepts = ['application/json']
|
||||
|
||||
// 扩展自定义头
|
||||
if (opts['x-extra-header']) {
|
||||
for (let extraHeader in opts['x-extra-header']) {
|
||||
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
||||
contentTypes = opts['x-extra-header']['content-type']
|
||||
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
||||
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
||||
accepts = opts['x-extra-header']['accept']
|
||||
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
||||
accepts = opts['x-extra-header']['accept'].split(',')
|
||||
}
|
||||
}
|
||||
|
||||
let formParams = {}
|
||||
|
||||
let returnType = null
|
||||
|
||||
this.config.logger(
|
||||
`call queryInstanceExposeDomain with params:\npathParams:${JSON.stringify(
|
||||
pathParams
|
||||
)},\nqueryParams:${JSON.stringify(
|
||||
queryParams
|
||||
)}, \nheaderParams:${JSON.stringify(
|
||||
headerParams
|
||||
)}, \nformParams:${JSON.stringify(
|
||||
formParams
|
||||
)}, \npostBody:${JSON.stringify(postBody)}`,
|
||||
'DEBUG'
|
||||
)
|
||||
|
||||
let request = this.makeRequest(
|
||||
'/regions/{regionId}/instances/{instanceId}:queryInstanceExposeDomain',
|
||||
'POST',
|
||||
pathParams,
|
||||
queryParams,
|
||||
headerParams,
|
||||
formParams,
|
||||
postBody,
|
||||
contentTypes,
|
||||
accepts,
|
||||
returnType,
|
||||
callback
|
||||
)
|
||||
|
||||
return request.then(
|
||||
function (result) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(null, result)
|
||||
}
|
||||
return result
|
||||
},
|
||||
function (error) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(error)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询instance当前状态
|
||||
* @param {Object} opts - parameters
|
||||
* @param {string} opts.instanceId - 实例ID
|
||||
* @param {string} regionId - ID of the region
|
||||
* @param {string} callback - callback
|
||||
@return {Object} result
|
||||
* @param string status iotcloudgateway实例状态
|
||||
*/
|
||||
|
||||
queryInstanceStatus (opts, regionId = this.config.regionId, callback) {
|
||||
if (typeof regionId === 'function') {
|
||||
callback = regionId
|
||||
regionId = this.config.regionId
|
||||
}
|
||||
|
||||
if (regionId === undefined || regionId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'regionId' when calling queryInstanceStatus"
|
||||
)
|
||||
}
|
||||
|
||||
opts = opts || {}
|
||||
|
||||
if (opts.instanceId === undefined || opts.instanceId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'opts.instanceId' when calling queryInstanceStatus"
|
||||
)
|
||||
}
|
||||
|
||||
let postBody = {}
|
||||
|
||||
let queryParams = {}
|
||||
|
||||
let pathParams = {
|
||||
regionId: regionId,
|
||||
instanceId: opts.instanceId
|
||||
}
|
||||
|
||||
let headerParams = {
|
||||
'User-Agent': 'JdcloudSdkNode/1.0.0 iotcloudgateway/1.0.1'
|
||||
}
|
||||
|
||||
let contentTypes = ['application/json']
|
||||
let accepts = ['application/json']
|
||||
|
||||
// 扩展自定义头
|
||||
if (opts['x-extra-header']) {
|
||||
for (let extraHeader in opts['x-extra-header']) {
|
||||
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
||||
contentTypes = opts['x-extra-header']['content-type']
|
||||
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
||||
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
||||
accepts = opts['x-extra-header']['accept']
|
||||
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
||||
accepts = opts['x-extra-header']['accept'].split(',')
|
||||
}
|
||||
}
|
||||
|
||||
let formParams = {}
|
||||
|
||||
let returnType = null
|
||||
|
||||
this.config.logger(
|
||||
`call queryInstanceStatus with params:\npathParams:${JSON.stringify(
|
||||
pathParams
|
||||
)},\nqueryParams:${JSON.stringify(
|
||||
queryParams
|
||||
)}, \nheaderParams:${JSON.stringify(
|
||||
headerParams
|
||||
)}, \nformParams:${JSON.stringify(
|
||||
formParams
|
||||
)}, \npostBody:${JSON.stringify(postBody)}`,
|
||||
'DEBUG'
|
||||
)
|
||||
|
||||
let request = this.makeRequest(
|
||||
'/regions/{regionId}/instances/{instanceId}:queryInstanceStatus',
|
||||
'POST',
|
||||
pathParams,
|
||||
queryParams,
|
||||
headerParams,
|
||||
formParams,
|
||||
postBody,
|
||||
contentTypes,
|
||||
accepts,
|
||||
returnType,
|
||||
callback
|
||||
)
|
||||
|
||||
return request.then(
|
||||
function (result) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(null, result)
|
||||
}
|
||||
return result
|
||||
},
|
||||
function (error) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(error)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 下发设备控制指令
|
||||
* @param {Object} opts - parameters
|
||||
* @param {string} opts.instanceId - 实例ID
|
||||
* @param {deviceControlSpec} opts.devicecmd - iotcloudgateway实例下发设备控制指令
|
||||
* @param {string} regionId - ID of the region
|
||||
* @param {string} callback - callback
|
||||
@return {Object} result
|
||||
*/
|
||||
|
||||
deviceControl (opts, regionId = this.config.regionId, callback) {
|
||||
if (typeof regionId === 'function') {
|
||||
callback = regionId
|
||||
regionId = this.config.regionId
|
||||
}
|
||||
|
||||
if (regionId === undefined || regionId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'regionId' when calling deviceControl"
|
||||
)
|
||||
}
|
||||
|
||||
opts = opts || {}
|
||||
|
||||
if (opts.instanceId === undefined || opts.instanceId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'opts.instanceId' when calling deviceControl"
|
||||
)
|
||||
}
|
||||
if (opts.devicecmd === undefined || opts.devicecmd === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'opts.devicecmd' when calling deviceControl"
|
||||
)
|
||||
}
|
||||
|
||||
let postBody = {}
|
||||
if (opts.devicecmd !== undefined && opts.devicecmd !== null) {
|
||||
postBody['devicecmd'] = opts.devicecmd
|
||||
}
|
||||
|
||||
let queryParams = {}
|
||||
|
||||
let pathParams = {
|
||||
regionId: regionId,
|
||||
instanceId: opts.instanceId
|
||||
}
|
||||
|
||||
let headerParams = {
|
||||
'User-Agent': 'JdcloudSdkNode/1.0.0 iotcloudgateway/1.0.1'
|
||||
}
|
||||
|
||||
let contentTypes = ['application/json']
|
||||
let accepts = ['application/json']
|
||||
|
||||
// 扩展自定义头
|
||||
if (opts['x-extra-header']) {
|
||||
for (let extraHeader in opts['x-extra-header']) {
|
||||
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
||||
contentTypes = opts['x-extra-header']['content-type']
|
||||
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
||||
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
||||
accepts = opts['x-extra-header']['accept']
|
||||
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
||||
accepts = opts['x-extra-header']['accept'].split(',')
|
||||
}
|
||||
}
|
||||
|
||||
let formParams = {}
|
||||
|
||||
let returnType = null
|
||||
|
||||
this.config.logger(
|
||||
`call deviceControl with params:\npathParams:${JSON.stringify(
|
||||
pathParams
|
||||
)},\nqueryParams:${JSON.stringify(
|
||||
queryParams
|
||||
)}, \nheaderParams:${JSON.stringify(
|
||||
headerParams
|
||||
)}, \nformParams:${JSON.stringify(
|
||||
formParams
|
||||
)}, \npostBody:${JSON.stringify(postBody)}`,
|
||||
'DEBUG'
|
||||
)
|
||||
|
||||
let request = this.makeRequest(
|
||||
'/regions/{regionId}/instances/{instanceId}:deviceControl',
|
||||
'POST',
|
||||
pathParams,
|
||||
queryParams,
|
||||
headerParams,
|
||||
formParams,
|
||||
postBody,
|
||||
contentTypes,
|
||||
accepts,
|
||||
returnType,
|
||||
callback
|
||||
)
|
||||
|
||||
return request.then(
|
||||
function (result) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(null, result)
|
||||
}
|
||||
return result
|
||||
},
|
||||
function (error) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(error)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
module.exports = JDCloud.IOTCLOUDGATEWAY
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,851 @@
|
||||
/*
|
||||
* Copyright 2018 JDCLOUD.COM
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http:#www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* Vi Template
|
||||
* 视频审查模板管理相关接口
|
||||
*
|
||||
* OpenAPI spec version: v1
|
||||
* Contact:
|
||||
*
|
||||
* NOTE: This class is auto generated by the jdcloud code generator program.
|
||||
*/
|
||||
|
||||
require('../../../lib/node_loader')
|
||||
var JDCloud = require('../../../lib/core')
|
||||
var Service = JDCloud.Service
|
||||
var serviceId = 'iv'
|
||||
Service._services[serviceId] = true
|
||||
|
||||
/**
|
||||
* iv service.
|
||||
* @version 0.0.1
|
||||
*/
|
||||
|
||||
class IV extends Service {
|
||||
constructor (options = {}) {
|
||||
options._defaultEndpoint = {}
|
||||
options._defaultEndpoint.protocol =
|
||||
options._defaultEndpoint.protocol || 'https'
|
||||
options._defaultEndpoint.host =
|
||||
options._defaultEndpoint.host || 'iv.jdcloud-api.com'
|
||||
options.basePath = '/v1' // 默认要设为空""
|
||||
super(serviceId, options)
|
||||
}
|
||||
|
||||
/**
|
||||
* 提交视频审查作业
|
||||
* @param {Object} opts - parameters
|
||||
* @param {string} opts.templateId - 视频审查模板ID
|
||||
* @param {string} opts.region - 对象存储区域,输入和输入同区域
|
||||
* @param {string} [opts.inputBucket] - 输入空间 optional
|
||||
* @param {string} [opts.inputFileKey] - 输入文件 optional
|
||||
* @param {string} [opts.outputBucket] - 输入空间 optional
|
||||
* @param {string} [opts.outputFilePath] - 输入路径 optional
|
||||
* @param {string} callback - callback
|
||||
@return {Object} result
|
||||
* @param viJobSummary resultObject
|
||||
*/
|
||||
|
||||
submitViJob (opts, callback) {
|
||||
opts = opts || {}
|
||||
|
||||
if (opts.templateId === undefined || opts.templateId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'opts.templateId' when calling submitViJob"
|
||||
)
|
||||
}
|
||||
if (opts.region === undefined || opts.region === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'opts.region' when calling submitViJob"
|
||||
)
|
||||
}
|
||||
|
||||
let postBody = {}
|
||||
if (opts.templateId !== undefined && opts.templateId !== null) {
|
||||
postBody['templateId'] = opts.templateId
|
||||
}
|
||||
if (opts.region !== undefined && opts.region !== null) {
|
||||
postBody['region'] = opts.region
|
||||
}
|
||||
if (opts.inputBucket !== undefined && opts.inputBucket !== null) {
|
||||
postBody['inputBucket'] = opts.inputBucket
|
||||
}
|
||||
if (opts.inputFileKey !== undefined && opts.inputFileKey !== null) {
|
||||
postBody['inputFileKey'] = opts.inputFileKey
|
||||
}
|
||||
if (opts.outputBucket !== undefined && opts.outputBucket !== null) {
|
||||
postBody['outputBucket'] = opts.outputBucket
|
||||
}
|
||||
if (opts.outputFilePath !== undefined && opts.outputFilePath !== null) {
|
||||
postBody['outputFilePath'] = opts.outputFilePath
|
||||
}
|
||||
|
||||
let queryParams = {}
|
||||
|
||||
let pathParams = {
|
||||
regionId: 'jdcloud'
|
||||
}
|
||||
|
||||
let headerParams = {
|
||||
'User-Agent': 'JdcloudSdkNode/1.0.0 iv/0.0.1'
|
||||
}
|
||||
|
||||
let contentTypes = ['application/json']
|
||||
let accepts = ['application/json']
|
||||
|
||||
// 扩展自定义头
|
||||
if (opts['x-extra-header']) {
|
||||
for (let extraHeader in opts['x-extra-header']) {
|
||||
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
||||
contentTypes = opts['x-extra-header']['content-type']
|
||||
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
||||
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
||||
accepts = opts['x-extra-header']['accept']
|
||||
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
||||
accepts = opts['x-extra-header']['accept'].split(',')
|
||||
}
|
||||
}
|
||||
|
||||
let formParams = {}
|
||||
|
||||
let returnType = null
|
||||
|
||||
this.config.logger(
|
||||
`call submitViJob with params:\npathParams:${JSON.stringify(
|
||||
pathParams
|
||||
)},\nqueryParams:${JSON.stringify(
|
||||
queryParams
|
||||
)}, \nheaderParams:${JSON.stringify(
|
||||
headerParams
|
||||
)}, \nformParams:${JSON.stringify(
|
||||
formParams
|
||||
)}, \npostBody:${JSON.stringify(postBody)}`,
|
||||
'DEBUG'
|
||||
)
|
||||
|
||||
let request = super.makeRequest(
|
||||
'/viJobs:submit',
|
||||
'POST',
|
||||
pathParams,
|
||||
queryParams,
|
||||
headerParams,
|
||||
formParams,
|
||||
postBody,
|
||||
contentTypes,
|
||||
accepts,
|
||||
returnType,
|
||||
callback
|
||||
)
|
||||
|
||||
return request.then(
|
||||
function (result) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(null, result)
|
||||
}
|
||||
return result
|
||||
},
|
||||
function (error) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(error)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询视频审查作业摘要
|
||||
* @param {Object} opts - parameters
|
||||
* @param {string} opts.jobId - 作业ID,路径参数
|
||||
* @param {string} callback - callback
|
||||
@return {Object} result
|
||||
* @param viJobSummary resultObject
|
||||
*/
|
||||
|
||||
getViJobSummary (opts, callback) {
|
||||
opts = opts || {}
|
||||
|
||||
if (opts.jobId === undefined || opts.jobId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'opts.jobId' when calling getViJobSummary"
|
||||
)
|
||||
}
|
||||
|
||||
let postBody = null
|
||||
let queryParams = {}
|
||||
|
||||
let pathParams = {
|
||||
regionId: 'jdcloud',
|
||||
jobId: opts.jobId
|
||||
}
|
||||
|
||||
let headerParams = {
|
||||
'User-Agent': 'JdcloudSdkNode/1.0.0 iv/0.0.1'
|
||||
}
|
||||
|
||||
let contentTypes = ['application/json']
|
||||
let accepts = ['application/json']
|
||||
|
||||
// 扩展自定义头
|
||||
if (opts['x-extra-header']) {
|
||||
for (let extraHeader in opts['x-extra-header']) {
|
||||
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
||||
contentTypes = opts['x-extra-header']['content-type']
|
||||
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
||||
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
||||
accepts = opts['x-extra-header']['accept']
|
||||
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
||||
accepts = opts['x-extra-header']['accept'].split(',')
|
||||
}
|
||||
}
|
||||
|
||||
let formParams = {}
|
||||
|
||||
let returnType = null
|
||||
|
||||
this.config.logger(
|
||||
`call getViJobSummary with params:\npathParams:${JSON.stringify(
|
||||
pathParams
|
||||
)},\nqueryParams:${JSON.stringify(
|
||||
queryParams
|
||||
)}, \nheaderParams:${JSON.stringify(
|
||||
headerParams
|
||||
)}, \nformParams:${JSON.stringify(
|
||||
formParams
|
||||
)}, \npostBody:${JSON.stringify(postBody)}`,
|
||||
'DEBUG'
|
||||
)
|
||||
|
||||
let request = super.makeRequest(
|
||||
'/viJobs/{jobId}',
|
||||
'GET',
|
||||
pathParams,
|
||||
queryParams,
|
||||
headerParams,
|
||||
formParams,
|
||||
postBody,
|
||||
contentTypes,
|
||||
accepts,
|
||||
returnType,
|
||||
callback
|
||||
)
|
||||
|
||||
return request.then(
|
||||
function (result) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(null, result)
|
||||
}
|
||||
return result
|
||||
},
|
||||
function (error) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(error)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询视频审查模板列表。
|
||||
支持过滤查询:
|
||||
- templateId,eq 精确匹配模板ID,非必选
|
||||
|
||||
* @param {Object} opts - parameters
|
||||
* @param {integer} [opts.pageNumber] - 页码;默认值为 1 optional
|
||||
* @param {integer} [opts.pageSize] - 分页大小;默认值为 10;取值范围 [10, 100] optional
|
||||
* @param {filter} [opts.filters] optional
|
||||
* @param {string} callback - callback
|
||||
@return {Object} result
|
||||
* @param viTemplatePageInfo resultObject
|
||||
*/
|
||||
|
||||
listViTemplates (opts, callback) {
|
||||
opts = opts || {}
|
||||
|
||||
let postBody = null
|
||||
let queryParams = {}
|
||||
if (opts.pageNumber !== undefined && opts.pageNumber !== null) {
|
||||
queryParams['pageNumber'] = opts.pageNumber
|
||||
}
|
||||
if (opts.pageSize !== undefined && opts.pageSize !== null) {
|
||||
queryParams['pageSize'] = opts.pageSize
|
||||
}
|
||||
Object.assign(queryParams, super.buildFilterParam(opts.filters, 'filters'))
|
||||
|
||||
let pathParams = {
|
||||
regionId: 'jdcloud'
|
||||
}
|
||||
|
||||
let headerParams = {
|
||||
'User-Agent': 'JdcloudSdkNode/1.0.0 iv/0.0.1'
|
||||
}
|
||||
|
||||
let contentTypes = ['application/json']
|
||||
let accepts = ['application/json']
|
||||
|
||||
// 扩展自定义头
|
||||
if (opts['x-extra-header']) {
|
||||
for (let extraHeader in opts['x-extra-header']) {
|
||||
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
||||
contentTypes = opts['x-extra-header']['content-type']
|
||||
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
||||
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
||||
accepts = opts['x-extra-header']['accept']
|
||||
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
||||
accepts = opts['x-extra-header']['accept'].split(',')
|
||||
}
|
||||
}
|
||||
|
||||
let formParams = {}
|
||||
|
||||
let returnType = null
|
||||
|
||||
this.config.logger(
|
||||
`call listViTemplates with params:\npathParams:${JSON.stringify(
|
||||
pathParams
|
||||
)},\nqueryParams:${JSON.stringify(
|
||||
queryParams
|
||||
)}, \nheaderParams:${JSON.stringify(
|
||||
headerParams
|
||||
)}, \nformParams:${JSON.stringify(
|
||||
formParams
|
||||
)}, \npostBody:${JSON.stringify(postBody)}`,
|
||||
'DEBUG'
|
||||
)
|
||||
|
||||
let request = super.makeRequest(
|
||||
'/viTemplates',
|
||||
'GET',
|
||||
pathParams,
|
||||
queryParams,
|
||||
headerParams,
|
||||
formParams,
|
||||
postBody,
|
||||
contentTypes,
|
||||
accepts,
|
||||
returnType,
|
||||
callback
|
||||
)
|
||||
|
||||
return request.then(
|
||||
function (result) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(null, result)
|
||||
}
|
||||
return result
|
||||
},
|
||||
function (error) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(error)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建视频审查模板
|
||||
* @param {Object} opts - parameters
|
||||
* @param {string} opts.templateName - 模板名称。长度不超过128个字符。UTF-8编码。
|
||||
|
||||
* @param {integer} [opts.shotInterval] - 截图间隔 optional
|
||||
* @param {string} [opts.shotIntervalType] - 间隔类型:time, percent optional
|
||||
* @param {string} [opts.shotFormat] - 截图格式:png, jpg optional
|
||||
* @param {string} [opts.shotFrameType] - 截图帧类型:any, key optional
|
||||
* @param {integer} [opts.shotWidth] - 截图宽度 optional
|
||||
* @param {integer} [opts.shotHeight] - 截图高度 optional
|
||||
* @param {string} [opts.shotFillType] - 截图填充类型:stretch, gauss, black, white optional
|
||||
* @param {string} opts.inspectItems - 审查配置,JSON格式
|
||||
* @param {string} callback - callback
|
||||
@return {Object} result
|
||||
* @param viTemplateInfo resultObject
|
||||
*/
|
||||
|
||||
createViTemplate (opts, callback) {
|
||||
opts = opts || {}
|
||||
|
||||
if (opts.templateName === undefined || opts.templateName === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'opts.templateName' when calling createViTemplate"
|
||||
)
|
||||
}
|
||||
if (opts.inspectItems === undefined || opts.inspectItems === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'opts.inspectItems' when calling createViTemplate"
|
||||
)
|
||||
}
|
||||
|
||||
let postBody = {}
|
||||
if (opts.templateName !== undefined && opts.templateName !== null) {
|
||||
postBody['templateName'] = opts.templateName
|
||||
}
|
||||
if (opts.shotInterval !== undefined && opts.shotInterval !== null) {
|
||||
postBody['shotInterval'] = opts.shotInterval
|
||||
}
|
||||
if (opts.shotIntervalType !== undefined && opts.shotIntervalType !== null) {
|
||||
postBody['shotIntervalType'] = opts.shotIntervalType
|
||||
}
|
||||
if (opts.shotFormat !== undefined && opts.shotFormat !== null) {
|
||||
postBody['shotFormat'] = opts.shotFormat
|
||||
}
|
||||
if (opts.shotFrameType !== undefined && opts.shotFrameType !== null) {
|
||||
postBody['shotFrameType'] = opts.shotFrameType
|
||||
}
|
||||
if (opts.shotWidth !== undefined && opts.shotWidth !== null) {
|
||||
postBody['shotWidth'] = opts.shotWidth
|
||||
}
|
||||
if (opts.shotHeight !== undefined && opts.shotHeight !== null) {
|
||||
postBody['shotHeight'] = opts.shotHeight
|
||||
}
|
||||
if (opts.shotFillType !== undefined && opts.shotFillType !== null) {
|
||||
postBody['shotFillType'] = opts.shotFillType
|
||||
}
|
||||
if (opts.inspectItems !== undefined && opts.inspectItems !== null) {
|
||||
postBody['inspectItems'] = opts.inspectItems
|
||||
}
|
||||
|
||||
let queryParams = {}
|
||||
|
||||
let pathParams = {
|
||||
regionId: 'jdcloud'
|
||||
}
|
||||
|
||||
let headerParams = {
|
||||
'User-Agent': 'JdcloudSdkNode/1.0.0 iv/0.0.1'
|
||||
}
|
||||
|
||||
let contentTypes = ['application/json']
|
||||
let accepts = ['application/json']
|
||||
|
||||
// 扩展自定义头
|
||||
if (opts['x-extra-header']) {
|
||||
for (let extraHeader in opts['x-extra-header']) {
|
||||
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
||||
contentTypes = opts['x-extra-header']['content-type']
|
||||
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
||||
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
||||
accepts = opts['x-extra-header']['accept']
|
||||
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
||||
accepts = opts['x-extra-header']['accept'].split(',')
|
||||
}
|
||||
}
|
||||
|
||||
let formParams = {}
|
||||
|
||||
let returnType = null
|
||||
|
||||
this.config.logger(
|
||||
`call createViTemplate with params:\npathParams:${JSON.stringify(
|
||||
pathParams
|
||||
)},\nqueryParams:${JSON.stringify(
|
||||
queryParams
|
||||
)}, \nheaderParams:${JSON.stringify(
|
||||
headerParams
|
||||
)}, \nformParams:${JSON.stringify(
|
||||
formParams
|
||||
)}, \npostBody:${JSON.stringify(postBody)}`,
|
||||
'DEBUG'
|
||||
)
|
||||
|
||||
let request = super.makeRequest(
|
||||
'/viTemplates',
|
||||
'POST',
|
||||
pathParams,
|
||||
queryParams,
|
||||
headerParams,
|
||||
formParams,
|
||||
postBody,
|
||||
contentTypes,
|
||||
accepts,
|
||||
returnType,
|
||||
callback
|
||||
)
|
||||
|
||||
return request.then(
|
||||
function (result) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(null, result)
|
||||
}
|
||||
return result
|
||||
},
|
||||
function (error) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(error)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询视频审查模板
|
||||
* @param {Object} opts - parameters
|
||||
* @param {string} opts.templateId - 模板ID,路径参数
|
||||
* @param {string} callback - callback
|
||||
@return {Object} result
|
||||
* @param viTemplateInfo resultObject
|
||||
*/
|
||||
|
||||
getViTemplate (opts, callback) {
|
||||
opts = opts || {}
|
||||
|
||||
if (opts.templateId === undefined || opts.templateId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'opts.templateId' when calling getViTemplate"
|
||||
)
|
||||
}
|
||||
|
||||
let postBody = null
|
||||
let queryParams = {}
|
||||
|
||||
let pathParams = {
|
||||
regionId: 'jdcloud',
|
||||
templateId: opts.templateId
|
||||
}
|
||||
|
||||
let headerParams = {
|
||||
'User-Agent': 'JdcloudSdkNode/1.0.0 iv/0.0.1'
|
||||
}
|
||||
|
||||
let contentTypes = ['application/json']
|
||||
let accepts = ['application/json']
|
||||
|
||||
// 扩展自定义头
|
||||
if (opts['x-extra-header']) {
|
||||
for (let extraHeader in opts['x-extra-header']) {
|
||||
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
||||
contentTypes = opts['x-extra-header']['content-type']
|
||||
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
||||
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
||||
accepts = opts['x-extra-header']['accept']
|
||||
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
||||
accepts = opts['x-extra-header']['accept'].split(',')
|
||||
}
|
||||
}
|
||||
|
||||
let formParams = {}
|
||||
|
||||
let returnType = null
|
||||
|
||||
this.config.logger(
|
||||
`call getViTemplate with params:\npathParams:${JSON.stringify(
|
||||
pathParams
|
||||
)},\nqueryParams:${JSON.stringify(
|
||||
queryParams
|
||||
)}, \nheaderParams:${JSON.stringify(
|
||||
headerParams
|
||||
)}, \nformParams:${JSON.stringify(
|
||||
formParams
|
||||
)}, \npostBody:${JSON.stringify(postBody)}`,
|
||||
'DEBUG'
|
||||
)
|
||||
|
||||
let request = super.makeRequest(
|
||||
'/viTemplates/{templateId}',
|
||||
'GET',
|
||||
pathParams,
|
||||
queryParams,
|
||||
headerParams,
|
||||
formParams,
|
||||
postBody,
|
||||
contentTypes,
|
||||
accepts,
|
||||
returnType,
|
||||
callback
|
||||
)
|
||||
|
||||
return request.then(
|
||||
function (result) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(null, result)
|
||||
}
|
||||
return result
|
||||
},
|
||||
function (error) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(error)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改视频审查模板
|
||||
* @param {Object} opts - parameters
|
||||
* @param {string} opts.templateId - 模板ID,路径参数
|
||||
* @param {string} [opts.templateName] - 模板名称。长度不超过128个字符。UTF-8编码。
|
||||
optional
|
||||
* @param {integer} [opts.shotInterval] - 截图间隔 optional
|
||||
* @param {string} [opts.shotIntervalType] - 间隔类型:time, percent optional
|
||||
* @param {string} [opts.shotFormat] - 截图格式:png, jpg optional
|
||||
* @param {string} [opts.shotFrameType] - 截图帧类型:any, key optional
|
||||
* @param {integer} [opts.shotWidth] - 截图宽度 optional
|
||||
* @param {integer} [opts.shotHeight] - 截图高度 optional
|
||||
* @param {string} [opts.shotFillType] - 截图填充类型:stretch, gauss, black, white optional
|
||||
* @param {string} [opts.inspectItems] - 审查配置,JSON格式 optional
|
||||
* @param {string} callback - callback
|
||||
@return {Object} result
|
||||
* @param viTemplateInfo resultObject
|
||||
*/
|
||||
|
||||
updateViTemplate (opts, callback) {
|
||||
opts = opts || {}
|
||||
|
||||
if (opts.templateId === undefined || opts.templateId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'opts.templateId' when calling updateViTemplate"
|
||||
)
|
||||
}
|
||||
|
||||
let postBody = {}
|
||||
if (opts.templateName !== undefined && opts.templateName !== null) {
|
||||
postBody['templateName'] = opts.templateName
|
||||
}
|
||||
if (opts.shotInterval !== undefined && opts.shotInterval !== null) {
|
||||
postBody['shotInterval'] = opts.shotInterval
|
||||
}
|
||||
if (opts.shotIntervalType !== undefined && opts.shotIntervalType !== null) {
|
||||
postBody['shotIntervalType'] = opts.shotIntervalType
|
||||
}
|
||||
if (opts.shotFormat !== undefined && opts.shotFormat !== null) {
|
||||
postBody['shotFormat'] = opts.shotFormat
|
||||
}
|
||||
if (opts.shotFrameType !== undefined && opts.shotFrameType !== null) {
|
||||
postBody['shotFrameType'] = opts.shotFrameType
|
||||
}
|
||||
if (opts.shotWidth !== undefined && opts.shotWidth !== null) {
|
||||
postBody['shotWidth'] = opts.shotWidth
|
||||
}
|
||||
if (opts.shotHeight !== undefined && opts.shotHeight !== null) {
|
||||
postBody['shotHeight'] = opts.shotHeight
|
||||
}
|
||||
if (opts.shotFillType !== undefined && opts.shotFillType !== null) {
|
||||
postBody['shotFillType'] = opts.shotFillType
|
||||
}
|
||||
if (opts.inspectItems !== undefined && opts.inspectItems !== null) {
|
||||
postBody['inspectItems'] = opts.inspectItems
|
||||
}
|
||||
|
||||
let queryParams = {}
|
||||
|
||||
let pathParams = {
|
||||
regionId: 'jdcloud',
|
||||
templateId: opts.templateId
|
||||
}
|
||||
|
||||
let headerParams = {
|
||||
'User-Agent': 'JdcloudSdkNode/1.0.0 iv/0.0.1'
|
||||
}
|
||||
|
||||
let contentTypes = ['application/json']
|
||||
let accepts = ['application/json']
|
||||
|
||||
// 扩展自定义头
|
||||
if (opts['x-extra-header']) {
|
||||
for (let extraHeader in opts['x-extra-header']) {
|
||||
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
||||
contentTypes = opts['x-extra-header']['content-type']
|
||||
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
||||
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
||||
accepts = opts['x-extra-header']['accept']
|
||||
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
||||
accepts = opts['x-extra-header']['accept'].split(',')
|
||||
}
|
||||
}
|
||||
|
||||
let formParams = {}
|
||||
|
||||
let returnType = null
|
||||
|
||||
this.config.logger(
|
||||
`call updateViTemplate with params:\npathParams:${JSON.stringify(
|
||||
pathParams
|
||||
)},\nqueryParams:${JSON.stringify(
|
||||
queryParams
|
||||
)}, \nheaderParams:${JSON.stringify(
|
||||
headerParams
|
||||
)}, \nformParams:${JSON.stringify(
|
||||
formParams
|
||||
)}, \npostBody:${JSON.stringify(postBody)}`,
|
||||
'DEBUG'
|
||||
)
|
||||
|
||||
let request = super.makeRequest(
|
||||
'/viTemplates/{templateId}',
|
||||
'PUT',
|
||||
pathParams,
|
||||
queryParams,
|
||||
headerParams,
|
||||
formParams,
|
||||
postBody,
|
||||
contentTypes,
|
||||
accepts,
|
||||
returnType,
|
||||
callback
|
||||
)
|
||||
|
||||
return request.then(
|
||||
function (result) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(null, result)
|
||||
}
|
||||
return result
|
||||
},
|
||||
function (error) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(error)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除视频审查模板
|
||||
* @param {Object} opts - parameters
|
||||
* @param {string} opts.templateId - 模板ID,路径参数
|
||||
* @param {string} callback - callback
|
||||
@return {Object} result
|
||||
*/
|
||||
|
||||
deleteViTemplate (opts, callback) {
|
||||
opts = opts || {}
|
||||
|
||||
if (opts.templateId === undefined || opts.templateId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'opts.templateId' when calling deleteViTemplate"
|
||||
)
|
||||
}
|
||||
|
||||
let postBody = null
|
||||
let queryParams = {}
|
||||
|
||||
let pathParams = {
|
||||
regionId: 'jdcloud',
|
||||
templateId: opts.templateId
|
||||
}
|
||||
|
||||
let headerParams = {
|
||||
'User-Agent': 'JdcloudSdkNode/1.0.0 iv/0.0.1'
|
||||
}
|
||||
|
||||
let contentTypes = ['application/json']
|
||||
let accepts = ['application/json']
|
||||
|
||||
// 扩展自定义头
|
||||
if (opts['x-extra-header']) {
|
||||
for (let extraHeader in opts['x-extra-header']) {
|
||||
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
||||
contentTypes = opts['x-extra-header']['content-type']
|
||||
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
||||
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
||||
accepts = opts['x-extra-header']['accept']
|
||||
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
||||
accepts = opts['x-extra-header']['accept'].split(',')
|
||||
}
|
||||
}
|
||||
|
||||
let formParams = {}
|
||||
|
||||
let returnType = null
|
||||
|
||||
this.config.logger(
|
||||
`call deleteViTemplate with params:\npathParams:${JSON.stringify(
|
||||
pathParams
|
||||
)},\nqueryParams:${JSON.stringify(
|
||||
queryParams
|
||||
)}, \nheaderParams:${JSON.stringify(
|
||||
headerParams
|
||||
)}, \nformParams:${JSON.stringify(
|
||||
formParams
|
||||
)}, \npostBody:${JSON.stringify(postBody)}`,
|
||||
'DEBUG'
|
||||
)
|
||||
|
||||
let request = super.makeRequest(
|
||||
'/viTemplates/{templateId}',
|
||||
'DELETE',
|
||||
pathParams,
|
||||
queryParams,
|
||||
headerParams,
|
||||
formParams,
|
||||
postBody,
|
||||
contentTypes,
|
||||
accepts,
|
||||
returnType,
|
||||
callback
|
||||
)
|
||||
|
||||
return request.then(
|
||||
function (result) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(null, result)
|
||||
}
|
||||
return result
|
||||
},
|
||||
function (error) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(error)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
module.exports = IV
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Copyright 2018 JDCLOUD.COM
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http:#www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* 实例管理
|
||||
* 实例管理相关接口
|
||||
*
|
||||
* OpenAPI spec version: v1
|
||||
* Contact:
|
||||
*
|
||||
* NOTE: This class is auto generated by the jdcloud code generator program.
|
||||
*/
|
||||
|
||||
require('../../../lib/node_loader')
|
||||
var JDCloud = require('../../../lib/core')
|
||||
var Service = JDCloud.Service
|
||||
var serviceId = 'jdw'
|
||||
Service._services[serviceId] = true
|
||||
|
||||
/**
|
||||
* jdw service.
|
||||
* @version 1.0.0
|
||||
*/
|
||||
|
||||
JDCloud.JDW = class JDW extends Service {
|
||||
constructor (options = {}) {
|
||||
options._defaultEndpoint = {}
|
||||
options._defaultEndpoint.protocol =
|
||||
options._defaultEndpoint.protocol || 'https'
|
||||
options._defaultEndpoint.host =
|
||||
options._defaultEndpoint.host || 'jdw.jdcloud-api.com'
|
||||
options.basePath = '/v1' // 默认要设为空""
|
||||
super(serviceId, options)
|
||||
}
|
||||
}
|
||||
module.exports = JDCloud.JDW
|
||||
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Copyright 2018 JDCLOUD.COM
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http:#www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* JDCLOUD 态势感知续费管理 API
|
||||
* 态势感知续费管理相关信息接口
|
||||
*
|
||||
* OpenAPI spec version: v1
|
||||
* Contact:
|
||||
*
|
||||
* NOTE: This class is auto generated by the jdcloud code generator program.
|
||||
*/
|
||||
|
||||
require('../../../lib/node_loader')
|
||||
var JDCloud = require('../../../lib/core')
|
||||
var Service = JDCloud.Service
|
||||
var serviceId = 'jdworkspace'
|
||||
Service._services[serviceId] = true
|
||||
|
||||
/**
|
||||
* jdworkspace service.
|
||||
* @version 0.1.0
|
||||
*/
|
||||
|
||||
class JDWORKSPACE extends Service {
|
||||
constructor (options = {}) {
|
||||
options._defaultEndpoint = {}
|
||||
options._defaultEndpoint.protocol =
|
||||
options._defaultEndpoint.protocol || 'https'
|
||||
options._defaultEndpoint.host =
|
||||
options._defaultEndpoint.host || 'billing.release.workspace.jdcloud.com'
|
||||
options.basePath = '/v1' // 默认要设为空""
|
||||
super(serviceId, options)
|
||||
}
|
||||
}
|
||||
module.exports = JDWORKSPACE
|
||||
@@ -0,0 +1,153 @@
|
||||
/*
|
||||
* Copyright 2018 JDCLOUD.COM
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http:#www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* 配额
|
||||
* k8s 集群配额相关接口
|
||||
*
|
||||
* OpenAPI spec version: v1
|
||||
* Contact:
|
||||
*
|
||||
* NOTE: This class is auto generated by the jdcloud code generator program.
|
||||
*/
|
||||
|
||||
require('../../../lib/node_loader')
|
||||
var JDCloud = require('../../../lib/core')
|
||||
var Service = JDCloud.Service
|
||||
var serviceId = 'jke'
|
||||
Service._services[serviceId] = true
|
||||
|
||||
/**
|
||||
* jke service.
|
||||
* @version 0.1.0
|
||||
*/
|
||||
|
||||
JDCloud.JKE = class JKE extends Service {
|
||||
constructor (options = {}) {
|
||||
options._defaultEndpoint = {}
|
||||
options._defaultEndpoint.protocol =
|
||||
options._defaultEndpoint.protocol || 'https'
|
||||
options._defaultEndpoint.host =
|
||||
options._defaultEndpoint.host || 'jke.jdcloud-api.com'
|
||||
options.basePath = '/v1' // 默认要设为空""
|
||||
super(serviceId, options)
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询(k8s 集群)配额
|
||||
* @param {Object} opts - parameters
|
||||
* @param {filter} [opts.filters] - resourceTypes - 资源类型,暂时只支持[kubernetes]
|
||||
optional
|
||||
* @param {string} regionId - ID of the region
|
||||
* @param {string} callback - callback
|
||||
@return {Object} result
|
||||
* @param quota quotas
|
||||
*/
|
||||
|
||||
describeQuotas (opts, regionId = this.config.regionId, callback) {
|
||||
if (typeof regionId === 'function') {
|
||||
callback = regionId
|
||||
regionId = this.config.regionId
|
||||
}
|
||||
|
||||
if (regionId === undefined || regionId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'regionId' when calling describeQuotas"
|
||||
)
|
||||
}
|
||||
|
||||
opts = opts || {}
|
||||
|
||||
let postBody = null
|
||||
let queryParams = {}
|
||||
Object.assign(queryParams, this.buildFilterParam(opts.filters, 'filters'))
|
||||
|
||||
let pathParams = {
|
||||
regionId: regionId
|
||||
}
|
||||
|
||||
let headerParams = {
|
||||
'User-Agent': 'JdcloudSdkNode/1.0.0 jke/0.1.0'
|
||||
}
|
||||
|
||||
let contentTypes = ['application/json']
|
||||
let accepts = ['application/json']
|
||||
|
||||
// 扩展自定义头
|
||||
if (opts['x-extra-header']) {
|
||||
for (let extraHeader in opts['x-extra-header']) {
|
||||
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
||||
contentTypes = opts['x-extra-header']['content-type']
|
||||
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
||||
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
||||
accepts = opts['x-extra-header']['accept']
|
||||
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
||||
accepts = opts['x-extra-header']['accept'].split(',')
|
||||
}
|
||||
}
|
||||
|
||||
let formParams = {}
|
||||
|
||||
let returnType = null
|
||||
|
||||
this.config.logger(
|
||||
`call describeQuotas with params:\npathParams:${JSON.stringify(
|
||||
pathParams
|
||||
)},\nqueryParams:${JSON.stringify(
|
||||
queryParams
|
||||
)}, \nheaderParams:${JSON.stringify(
|
||||
headerParams
|
||||
)}, \nformParams:${JSON.stringify(
|
||||
formParams
|
||||
)}, \npostBody:${JSON.stringify(postBody)}`,
|
||||
'DEBUG'
|
||||
)
|
||||
|
||||
let request = this.makeRequest(
|
||||
'/regions/{regionId}/quotas',
|
||||
'GET',
|
||||
pathParams,
|
||||
queryParams,
|
||||
headerParams,
|
||||
formParams,
|
||||
postBody,
|
||||
contentTypes,
|
||||
accepts,
|
||||
returnType,
|
||||
callback
|
||||
)
|
||||
|
||||
return request.then(
|
||||
function (result) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(null, result)
|
||||
}
|
||||
return result
|
||||
},
|
||||
function (error) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(error)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
module.exports = JDCloud.JKE
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,643 @@
|
||||
/*
|
||||
* Copyright 2018 JDCLOUD.COM
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http:#www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* kafka topic 相关接口
|
||||
* kafka topic 相关接口
|
||||
*
|
||||
* OpenAPI spec version: v1
|
||||
* Contact:
|
||||
*
|
||||
* NOTE: This class is auto generated by the jdcloud code generator program.
|
||||
*/
|
||||
|
||||
require('../../../lib/node_loader')
|
||||
var JDCloud = require('../../../lib/core')
|
||||
var Service = JDCloud.Service
|
||||
var serviceId = 'kafka'
|
||||
Service._services[serviceId] = true
|
||||
|
||||
/**
|
||||
* kafka service.
|
||||
* @version 1.0.0
|
||||
*/
|
||||
|
||||
JDCloud.KAFKA = class KAFKA extends Service {
|
||||
constructor (options = {}) {
|
||||
options._defaultEndpoint = {}
|
||||
options._defaultEndpoint.protocol =
|
||||
options._defaultEndpoint.protocol || 'https'
|
||||
options._defaultEndpoint.host =
|
||||
options._defaultEndpoint.host || 'kafka.jdcloud-api.com'
|
||||
options.basePath = '/v1' // 默认要设为空""
|
||||
super(serviceId, options)
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询kafka实例列表
|
||||
* @param {Object} opts - parameters
|
||||
* @param {integer} [opts.pageNumber] - 页码,默认1 optional
|
||||
* @param {integer} [opts.pageSize] - 分页大小,默认10 optional
|
||||
* @param {filter} [opts.filters] - 过滤条件:
|
||||
instanceId -实例Id,精确匹配,支持多个
|
||||
instanceVersion -实例版本,精确匹配,支持单个
|
||||
instanceName - 实例名称,模糊匹配,支持单个
|
||||
instanceStatus - 实例状态,精确匹配,支持多个(running:运行,error:错误,creating:创建中,changing:变配中,stop:已停止,processing:处理中)
|
||||
chargeMode - 计费类型,按配置postpaid_by_duration或者包年包月prepaid_by_duration
|
||||
optional
|
||||
* @param {tagFilter} [opts.tagFilters] - 标签过滤条件 optional
|
||||
* @param {string} regionId - ID of the region
|
||||
* @param {string} callback - callback
|
||||
@return {Object} result
|
||||
* @param instance instances
|
||||
* @param integer totalCount kafka实例总数
|
||||
*/
|
||||
|
||||
describeInstances (opts, regionId = this.config.regionId, callback) {
|
||||
if (typeof regionId === 'function') {
|
||||
callback = regionId
|
||||
regionId = this.config.regionId
|
||||
}
|
||||
|
||||
if (regionId === undefined || regionId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'regionId' when calling describeInstances"
|
||||
)
|
||||
}
|
||||
|
||||
opts = opts || {}
|
||||
|
||||
let postBody = null
|
||||
let queryParams = {}
|
||||
if (opts.pageNumber !== undefined && opts.pageNumber !== null) {
|
||||
queryParams['pageNumber'] = opts.pageNumber
|
||||
}
|
||||
if (opts.pageSize !== undefined && opts.pageSize !== null) {
|
||||
queryParams['pageSize'] = opts.pageSize
|
||||
}
|
||||
Object.assign(queryParams, super.buildFilterParam(opts.filters, 'filters'))
|
||||
Object.assign(
|
||||
queryParams,
|
||||
super.buildTagFilterParam(opts.tagFilters, 'tagFilters')
|
||||
)
|
||||
|
||||
let pathParams = {
|
||||
regionId: regionId
|
||||
}
|
||||
|
||||
let headerParams = {
|
||||
'User-Agent': 'JdcloudSdkNode/1.0.0 kafka/1.0.0'
|
||||
}
|
||||
|
||||
let contentTypes = ['application/json']
|
||||
let accepts = ['application/json']
|
||||
|
||||
// 扩展自定义头
|
||||
if (opts['x-extra-header']) {
|
||||
for (let extraHeader in opts['x-extra-header']) {
|
||||
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
||||
contentTypes = opts['x-extra-header']['content-type']
|
||||
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
||||
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
||||
accepts = opts['x-extra-header']['accept']
|
||||
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
||||
accepts = opts['x-extra-header']['accept'].split(',')
|
||||
}
|
||||
}
|
||||
|
||||
let formParams = {}
|
||||
|
||||
let returnType = null
|
||||
|
||||
this.config.logger(
|
||||
`call describeInstances with params:\npathParams:${JSON.stringify(
|
||||
pathParams
|
||||
)},\nqueryParams:${JSON.stringify(
|
||||
queryParams
|
||||
)}, \nheaderParams:${JSON.stringify(
|
||||
headerParams
|
||||
)}, \nformParams:${JSON.stringify(
|
||||
formParams
|
||||
)}, \npostBody:${JSON.stringify(postBody)}`,
|
||||
'DEBUG'
|
||||
)
|
||||
|
||||
let request = super.makeRequest(
|
||||
'/regions/{regionId}/instances',
|
||||
'GET',
|
||||
pathParams,
|
||||
queryParams,
|
||||
headerParams,
|
||||
formParams,
|
||||
postBody,
|
||||
contentTypes,
|
||||
accepts,
|
||||
returnType,
|
||||
callback
|
||||
)
|
||||
|
||||
return request.then(
|
||||
function (result) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(null, result)
|
||||
}
|
||||
return result
|
||||
},
|
||||
function (error) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(error)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建一个指定配置的kafka实例
|
||||
* @param {Object} opts - parameters
|
||||
* @param {instanceSpec} opts.instance - kafka实例的相关配置
|
||||
* @param {chargeSpec} [opts.charge] - 计费信息的相关配置,只有prepaid_by_duration和postpaid_by_duration 2种计费模式 optional
|
||||
* @param {string} regionId - ID of the region
|
||||
* @param {string} callback - callback
|
||||
@return {Object} result
|
||||
* @param string instanceId kafka实例编号
|
||||
* @param string buyId buyId
|
||||
*/
|
||||
|
||||
createInstance (opts, regionId = this.config.regionId, callback) {
|
||||
if (typeof regionId === 'function') {
|
||||
callback = regionId
|
||||
regionId = this.config.regionId
|
||||
}
|
||||
|
||||
if (regionId === undefined || regionId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'regionId' when calling createInstance"
|
||||
)
|
||||
}
|
||||
|
||||
opts = opts || {}
|
||||
|
||||
if (opts.instance === undefined || opts.instance === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'opts.instance' when calling createInstance"
|
||||
)
|
||||
}
|
||||
|
||||
let postBody = {}
|
||||
if (opts.instance !== undefined && opts.instance !== null) {
|
||||
postBody['instance'] = opts.instance
|
||||
}
|
||||
if (opts.charge !== undefined && opts.charge !== null) {
|
||||
postBody['charge'] = opts.charge
|
||||
}
|
||||
|
||||
let queryParams = {}
|
||||
|
||||
let pathParams = {
|
||||
regionId: regionId
|
||||
}
|
||||
|
||||
let headerParams = {
|
||||
'User-Agent': 'JdcloudSdkNode/1.0.0 kafka/1.0.0'
|
||||
}
|
||||
|
||||
let contentTypes = ['application/json']
|
||||
let accepts = ['application/json']
|
||||
|
||||
// 扩展自定义头
|
||||
if (opts['x-extra-header']) {
|
||||
for (let extraHeader in opts['x-extra-header']) {
|
||||
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
||||
contentTypes = opts['x-extra-header']['content-type']
|
||||
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
||||
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
||||
accepts = opts['x-extra-header']['accept']
|
||||
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
||||
accepts = opts['x-extra-header']['accept'].split(',')
|
||||
}
|
||||
}
|
||||
|
||||
let formParams = {}
|
||||
|
||||
let returnType = null
|
||||
|
||||
this.config.logger(
|
||||
`call createInstance with params:\npathParams:${JSON.stringify(
|
||||
pathParams
|
||||
)},\nqueryParams:${JSON.stringify(
|
||||
queryParams
|
||||
)}, \nheaderParams:${JSON.stringify(
|
||||
headerParams
|
||||
)}, \nformParams:${JSON.stringify(
|
||||
formParams
|
||||
)}, \npostBody:${JSON.stringify(postBody)}`,
|
||||
'DEBUG'
|
||||
)
|
||||
|
||||
let request = super.makeRequest(
|
||||
'/regions/{regionId}/instances',
|
||||
'POST',
|
||||
pathParams,
|
||||
queryParams,
|
||||
headerParams,
|
||||
formParams,
|
||||
postBody,
|
||||
contentTypes,
|
||||
accepts,
|
||||
returnType,
|
||||
callback
|
||||
)
|
||||
|
||||
return request.then(
|
||||
function (result) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(null, result)
|
||||
}
|
||||
return result
|
||||
},
|
||||
function (error) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(error)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询kafka实例的详细信息
|
||||
* @param {Object} opts - parameters
|
||||
* @param {string} opts.instanceId - 实例ID
|
||||
* @param {string} regionId - ID of the region
|
||||
* @param {string} callback - callback
|
||||
@return {Object} result
|
||||
* @param instance instance kafka实例详细信息
|
||||
*/
|
||||
|
||||
describeInstance (opts, regionId = this.config.regionId, callback) {
|
||||
if (typeof regionId === 'function') {
|
||||
callback = regionId
|
||||
regionId = this.config.regionId
|
||||
}
|
||||
|
||||
if (regionId === undefined || regionId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'regionId' when calling describeInstance"
|
||||
)
|
||||
}
|
||||
|
||||
opts = opts || {}
|
||||
|
||||
if (opts.instanceId === undefined || opts.instanceId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'opts.instanceId' when calling describeInstance"
|
||||
)
|
||||
}
|
||||
|
||||
let postBody = null
|
||||
let queryParams = {}
|
||||
|
||||
let pathParams = {
|
||||
regionId: regionId,
|
||||
instanceId: opts.instanceId
|
||||
}
|
||||
|
||||
let headerParams = {
|
||||
'User-Agent': 'JdcloudSdkNode/1.0.0 kafka/1.0.0'
|
||||
}
|
||||
|
||||
let contentTypes = ['application/json']
|
||||
let accepts = ['application/json']
|
||||
|
||||
// 扩展自定义头
|
||||
if (opts['x-extra-header']) {
|
||||
for (let extraHeader in opts['x-extra-header']) {
|
||||
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
||||
contentTypes = opts['x-extra-header']['content-type']
|
||||
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
||||
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
||||
accepts = opts['x-extra-header']['accept']
|
||||
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
||||
accepts = opts['x-extra-header']['accept'].split(',')
|
||||
}
|
||||
}
|
||||
|
||||
let formParams = {}
|
||||
|
||||
let returnType = null
|
||||
|
||||
this.config.logger(
|
||||
`call describeInstance with params:\npathParams:${JSON.stringify(
|
||||
pathParams
|
||||
)},\nqueryParams:${JSON.stringify(
|
||||
queryParams
|
||||
)}, \nheaderParams:${JSON.stringify(
|
||||
headerParams
|
||||
)}, \nformParams:${JSON.stringify(
|
||||
formParams
|
||||
)}, \npostBody:${JSON.stringify(postBody)}`,
|
||||
'DEBUG'
|
||||
)
|
||||
|
||||
let request = super.makeRequest(
|
||||
'/regions/{regionId}/instances/{instanceId}',
|
||||
'GET',
|
||||
pathParams,
|
||||
queryParams,
|
||||
headerParams,
|
||||
formParams,
|
||||
postBody,
|
||||
contentTypes,
|
||||
accepts,
|
||||
returnType,
|
||||
callback
|
||||
)
|
||||
|
||||
return request.then(
|
||||
function (result) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(null, result)
|
||||
}
|
||||
return result
|
||||
},
|
||||
function (error) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(error)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除按配置计费或包年包月已到期的kafka实例,包年包月未到期不可删除。
|
||||
状态为创建中和变配中的不可删除。
|
||||
|
||||
* @param {Object} opts - parameters
|
||||
* @param {string} opts.instanceId - 实例ID
|
||||
* @param {string} regionId - ID of the region
|
||||
* @param {string} callback - callback
|
||||
@return {Object} result
|
||||
*/
|
||||
|
||||
deleteInstance (opts, regionId = this.config.regionId, callback) {
|
||||
if (typeof regionId === 'function') {
|
||||
callback = regionId
|
||||
regionId = this.config.regionId
|
||||
}
|
||||
|
||||
if (regionId === undefined || regionId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'regionId' when calling deleteInstance"
|
||||
)
|
||||
}
|
||||
|
||||
opts = opts || {}
|
||||
|
||||
if (opts.instanceId === undefined || opts.instanceId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'opts.instanceId' when calling deleteInstance"
|
||||
)
|
||||
}
|
||||
|
||||
let postBody = null
|
||||
let queryParams = {}
|
||||
|
||||
let pathParams = {
|
||||
regionId: regionId,
|
||||
instanceId: opts.instanceId
|
||||
}
|
||||
|
||||
let headerParams = {
|
||||
'User-Agent': 'JdcloudSdkNode/1.0.0 kafka/1.0.0'
|
||||
}
|
||||
|
||||
let contentTypes = ['application/json']
|
||||
let accepts = ['application/json']
|
||||
|
||||
// 扩展自定义头
|
||||
if (opts['x-extra-header']) {
|
||||
for (let extraHeader in opts['x-extra-header']) {
|
||||
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
||||
contentTypes = opts['x-extra-header']['content-type']
|
||||
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
||||
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
||||
accepts = opts['x-extra-header']['accept']
|
||||
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
||||
accepts = opts['x-extra-header']['accept'].split(',')
|
||||
}
|
||||
}
|
||||
|
||||
let formParams = {}
|
||||
|
||||
let returnType = null
|
||||
|
||||
this.config.logger(
|
||||
`call deleteInstance with params:\npathParams:${JSON.stringify(
|
||||
pathParams
|
||||
)},\nqueryParams:${JSON.stringify(
|
||||
queryParams
|
||||
)}, \nheaderParams:${JSON.stringify(
|
||||
headerParams
|
||||
)}, \nformParams:${JSON.stringify(
|
||||
formParams
|
||||
)}, \npostBody:${JSON.stringify(postBody)}`,
|
||||
'DEBUG'
|
||||
)
|
||||
|
||||
let request = super.makeRequest(
|
||||
'/regions/{regionId}/instances/{instanceId}',
|
||||
'DELETE',
|
||||
pathParams,
|
||||
queryParams,
|
||||
headerParams,
|
||||
formParams,
|
||||
postBody,
|
||||
contentTypes,
|
||||
accepts,
|
||||
returnType,
|
||||
callback
|
||||
)
|
||||
|
||||
return request.then(
|
||||
function (result) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(null, result)
|
||||
}
|
||||
return result
|
||||
},
|
||||
function (error) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(error)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 变更kafka实例的配置,实例为running状态才可变更配置
|
||||
|
||||
* @param {Object} opts - parameters
|
||||
* @param {string} opts.instanceId - 实例ID
|
||||
* @param {array} opts.instanceClassSpec - 变更的规格
|
||||
* @param {string} regionId - ID of the region
|
||||
* @param {string} callback - callback
|
||||
@return {Object} result
|
||||
* @param string instanceId kafka实例编号
|
||||
* @param string buyId buyId
|
||||
*/
|
||||
|
||||
modifyInstanceSpec (opts, regionId = this.config.regionId, callback) {
|
||||
if (typeof regionId === 'function') {
|
||||
callback = regionId
|
||||
regionId = this.config.regionId
|
||||
}
|
||||
|
||||
if (regionId === undefined || regionId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'regionId' when calling modifyInstanceSpec"
|
||||
)
|
||||
}
|
||||
|
||||
opts = opts || {}
|
||||
|
||||
if (opts.instanceId === undefined || opts.instanceId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'opts.instanceId' when calling modifyInstanceSpec"
|
||||
)
|
||||
}
|
||||
if (
|
||||
opts.instanceClassSpec === undefined ||
|
||||
opts.instanceClassSpec === null
|
||||
) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'opts.instanceClassSpec' when calling modifyInstanceSpec"
|
||||
)
|
||||
}
|
||||
|
||||
let postBody = {}
|
||||
if (
|
||||
opts.instanceClassSpec !== undefined &&
|
||||
opts.instanceClassSpec !== null
|
||||
) {
|
||||
postBody['instanceClassSpec'] = opts.instanceClassSpec
|
||||
}
|
||||
|
||||
let queryParams = {}
|
||||
|
||||
let pathParams = {
|
||||
regionId: regionId,
|
||||
instanceId: opts.instanceId
|
||||
}
|
||||
|
||||
let headerParams = {
|
||||
'User-Agent': 'JdcloudSdkNode/1.0.0 kafka/1.0.0'
|
||||
}
|
||||
|
||||
let contentTypes = ['application/json']
|
||||
let accepts = ['application/json']
|
||||
|
||||
// 扩展自定义头
|
||||
if (opts['x-extra-header']) {
|
||||
for (let extraHeader in opts['x-extra-header']) {
|
||||
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
||||
contentTypes = opts['x-extra-header']['content-type']
|
||||
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
||||
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
||||
accepts = opts['x-extra-header']['accept']
|
||||
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
||||
accepts = opts['x-extra-header']['accept'].split(',')
|
||||
}
|
||||
}
|
||||
|
||||
let formParams = {}
|
||||
|
||||
let returnType = null
|
||||
|
||||
this.config.logger(
|
||||
`call modifyInstanceSpec with params:\npathParams:${JSON.stringify(
|
||||
pathParams
|
||||
)},\nqueryParams:${JSON.stringify(
|
||||
queryParams
|
||||
)}, \nheaderParams:${JSON.stringify(
|
||||
headerParams
|
||||
)}, \nformParams:${JSON.stringify(
|
||||
formParams
|
||||
)}, \npostBody:${JSON.stringify(postBody)}`,
|
||||
'DEBUG'
|
||||
)
|
||||
|
||||
let request = super.makeRequest(
|
||||
'/regions/{regionId}/instances/{instanceId}:modifyInstanceSpec',
|
||||
'POST',
|
||||
pathParams,
|
||||
queryParams,
|
||||
headerParams,
|
||||
formParams,
|
||||
postBody,
|
||||
contentTypes,
|
||||
accepts,
|
||||
returnType,
|
||||
callback
|
||||
)
|
||||
|
||||
return request.then(
|
||||
function (result) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(null, result)
|
||||
}
|
||||
return result
|
||||
},
|
||||
function (error) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(error)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
module.exports = JDCloud.KAFKA
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,131 @@
|
||||
/*
|
||||
* Copyright 2018 JDCLOUD.COM
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http:#www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* 监控项相关接口
|
||||
* 监控项相关接口,提供自定义监控数据上报功能
|
||||
*
|
||||
* OpenAPI spec version: v1
|
||||
* Contact:
|
||||
*
|
||||
* NOTE: This class is auto generated by the jdcloud code generator program.
|
||||
*/
|
||||
|
||||
require('../../../lib/node_loader')
|
||||
var JDCloud = require('../../../lib/core')
|
||||
var Service = JDCloud.Service
|
||||
var serviceId = 'monitorcm'
|
||||
Service._services[serviceId] = true
|
||||
|
||||
/**
|
||||
* monitorcm service.
|
||||
* @version 1.0.0
|
||||
*/
|
||||
|
||||
JDCloud.MONITORCM = class MONITORCM extends Service {
|
||||
constructor (options = {}) {
|
||||
options._defaultEndpoint = {}
|
||||
options._defaultEndpoint.protocol =
|
||||
options._defaultEndpoint.protocol || 'https'
|
||||
options._defaultEndpoint.host =
|
||||
options._defaultEndpoint.host || 'monitor.jdcloud-api.com'
|
||||
options.basePath = '/v1' // 默认要设为空""
|
||||
super(serviceId, options)
|
||||
}
|
||||
|
||||
/**
|
||||
* 上报用户自定义监控数据
|
||||
* @param {Object} opts - parameters
|
||||
* @param {array} opts.metricDataList - 数据参数
|
||||
* @param {string} callback - callback
|
||||
@return {Object} result
|
||||
* @param boolean success
|
||||
* @param metricDataList errMetricDataList
|
||||
*/
|
||||
|
||||
putMetricData (opts, callback) {
|
||||
opts = opts || {}
|
||||
|
||||
if (opts.metricDataList === undefined || opts.metricDataList === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'opts.metricDataList' when calling putMetricData"
|
||||
)
|
||||
}
|
||||
|
||||
let postBody = {}
|
||||
if (opts.metricDataList !== undefined && opts.metricDataList !== null) {
|
||||
postBody['metricDataList'] = opts.metricDataList
|
||||
}
|
||||
|
||||
let queryParams = {}
|
||||
|
||||
let pathParams = {
|
||||
regionId: 'jdcloud'
|
||||
}
|
||||
|
||||
let headerParams = {
|
||||
'User-Agent': 'JdcloudSdkNode/1.0.0 monitorcm/1.0.0'
|
||||
}
|
||||
|
||||
let formParams = {}
|
||||
|
||||
let contentTypes = ['application/json']
|
||||
let accepts = ['application/json']
|
||||
|
||||
let returnType = null
|
||||
|
||||
this.config.logger(
|
||||
`call putMetricData with params:\npathParams:${JSON.stringify(
|
||||
pathParams
|
||||
)},\nqueryParams:${JSON.stringify(
|
||||
queryParams
|
||||
)}, \nheaderParams:${JSON.stringify(
|
||||
headerParams
|
||||
)}, \nformParams:${JSON.stringify(
|
||||
formParams
|
||||
)}, \npostBody:${JSON.stringify(postBody)}`,
|
||||
'DEBUG'
|
||||
)
|
||||
|
||||
let request = this.makeRequest(
|
||||
'/customMetrics',
|
||||
'POST',
|
||||
pathParams,
|
||||
queryParams,
|
||||
headerParams,
|
||||
formParams,
|
||||
postBody,
|
||||
contentTypes,
|
||||
accepts,
|
||||
returnType,
|
||||
callback
|
||||
)
|
||||
|
||||
return request.then(
|
||||
function (result) {
|
||||
if (callback) {
|
||||
return callback(null, result)
|
||||
}
|
||||
return result
|
||||
},
|
||||
function (error) {
|
||||
if (callback) {
|
||||
return callback(error)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
module.exports = JDCloud.MONITORCM
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,486 @@
|
||||
/*
|
||||
* Copyright 2018 JDCLOUD.COM
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http:#www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* OSS相关接口
|
||||
* OSS相关接口
|
||||
*
|
||||
* OpenAPI spec version: v1
|
||||
* Contact:
|
||||
*
|
||||
* NOTE: This class is auto generated by the jdcloud code generator program.
|
||||
*/
|
||||
|
||||
require('../../../lib/node_loader')
|
||||
var JDCloud = require('../../../lib/core')
|
||||
var Service = JDCloud.Service
|
||||
var serviceId = 'oss'
|
||||
Service._services[serviceId] = true
|
||||
|
||||
/**
|
||||
* oss service.
|
||||
* @version 0.2.2
|
||||
*/
|
||||
|
||||
JDCloud.OSS = class OSS extends Service {
|
||||
constructor (options = {}) {
|
||||
options._defaultEndpoint = {}
|
||||
options._defaultEndpoint.protocol =
|
||||
options._defaultEndpoint.protocol || 'https'
|
||||
options._defaultEndpoint.host =
|
||||
options._defaultEndpoint.host || 'oss.jdcloud-api.com'
|
||||
options.basePath = '/v1' // 默认要设为空""
|
||||
super(serviceId, options)
|
||||
}
|
||||
|
||||
/**
|
||||
* 列出当前用户的所有bucket
|
||||
|
||||
* @param {Object} opts - parameters
|
||||
* @param {string} regionId - ID of the region
|
||||
* @param {string} callback - callback
|
||||
@return {Object} result
|
||||
* @param user owner
|
||||
* @param bucket buckets
|
||||
*/
|
||||
|
||||
listBuckets (opts, regionId = this.config.regionId, callback) {
|
||||
if (typeof regionId === 'function') {
|
||||
callback = regionId
|
||||
regionId = this.config.regionId
|
||||
}
|
||||
|
||||
if (regionId === undefined || regionId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'regionId' when calling listBuckets"
|
||||
)
|
||||
}
|
||||
|
||||
opts = opts || {}
|
||||
|
||||
let postBody = null
|
||||
let queryParams = {}
|
||||
|
||||
let pathParams = {
|
||||
regionId: regionId
|
||||
}
|
||||
|
||||
let headerParams = {
|
||||
'User-Agent': 'JdcloudSdkNode/1.0.0 oss/0.2.2'
|
||||
}
|
||||
|
||||
let contentTypes = ['application/json']
|
||||
let accepts = ['application/json']
|
||||
|
||||
// 扩展自定义头
|
||||
if (opts['x-extra-header']) {
|
||||
for (let extraHeader in opts['x-extra-header']) {
|
||||
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
||||
contentTypes = opts['x-extra-header']['content-type']
|
||||
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
||||
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
||||
accepts = opts['x-extra-header']['accept']
|
||||
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
||||
accepts = opts['x-extra-header']['accept'].split(',')
|
||||
}
|
||||
}
|
||||
|
||||
let formParams = {}
|
||||
|
||||
let returnType = null
|
||||
|
||||
this.config.logger(
|
||||
`call listBuckets with params:\npathParams:${JSON.stringify(
|
||||
pathParams
|
||||
)},\nqueryParams:${JSON.stringify(
|
||||
queryParams
|
||||
)}, \nheaderParams:${JSON.stringify(
|
||||
headerParams
|
||||
)}, \nformParams:${JSON.stringify(
|
||||
formParams
|
||||
)}, \npostBody:${JSON.stringify(postBody)}`,
|
||||
'DEBUG'
|
||||
)
|
||||
|
||||
let request = this.makeRequest(
|
||||
'/regions/{regionId}/buckets',
|
||||
'GET',
|
||||
pathParams,
|
||||
queryParams,
|
||||
headerParams,
|
||||
formParams,
|
||||
postBody,
|
||||
contentTypes,
|
||||
accepts,
|
||||
returnType,
|
||||
callback
|
||||
)
|
||||
|
||||
return request.then(
|
||||
function (result) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(null, result)
|
||||
}
|
||||
return result
|
||||
},
|
||||
function (error) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(error)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建bucket
|
||||
|
||||
* @param {Object} opts - parameters
|
||||
* @param {string} opts.bucketname - bucket名字,例如:test-bucket
|
||||
* @param {string} regionId - ID of the region
|
||||
* @param {string} callback - callback
|
||||
@return {Object} result
|
||||
*/
|
||||
|
||||
putBucket (opts, regionId = this.config.regionId, callback) {
|
||||
if (typeof regionId === 'function') {
|
||||
callback = regionId
|
||||
regionId = this.config.regionId
|
||||
}
|
||||
|
||||
if (regionId === undefined || regionId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'regionId' when calling putBucket"
|
||||
)
|
||||
}
|
||||
|
||||
opts = opts || {}
|
||||
|
||||
if (opts.bucketname === undefined || opts.bucketname === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'opts.bucketname' when calling putBucket"
|
||||
)
|
||||
}
|
||||
|
||||
let postBody = {}
|
||||
|
||||
let queryParams = {}
|
||||
|
||||
let pathParams = {
|
||||
regionId: regionId,
|
||||
bucketname: opts.bucketname
|
||||
}
|
||||
|
||||
let headerParams = {
|
||||
'User-Agent': 'JdcloudSdkNode/1.0.0 oss/0.2.2'
|
||||
}
|
||||
|
||||
let contentTypes = ['application/json']
|
||||
let accepts = ['application/json']
|
||||
|
||||
// 扩展自定义头
|
||||
if (opts['x-extra-header']) {
|
||||
for (let extraHeader in opts['x-extra-header']) {
|
||||
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
||||
contentTypes = opts['x-extra-header']['content-type']
|
||||
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
||||
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
||||
accepts = opts['x-extra-header']['accept']
|
||||
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
||||
accepts = opts['x-extra-header']['accept'].split(',')
|
||||
}
|
||||
}
|
||||
|
||||
let formParams = {}
|
||||
|
||||
let returnType = null
|
||||
|
||||
this.config.logger(
|
||||
`call putBucket with params:\npathParams:${JSON.stringify(
|
||||
pathParams
|
||||
)},\nqueryParams:${JSON.stringify(
|
||||
queryParams
|
||||
)}, \nheaderParams:${JSON.stringify(
|
||||
headerParams
|
||||
)}, \nformParams:${JSON.stringify(
|
||||
formParams
|
||||
)}, \npostBody:${JSON.stringify(postBody)}`,
|
||||
'DEBUG'
|
||||
)
|
||||
|
||||
let request = this.makeRequest(
|
||||
'/regions/{regionId}/buckets/{bucketname}',
|
||||
'PUT',
|
||||
pathParams,
|
||||
queryParams,
|
||||
headerParams,
|
||||
formParams,
|
||||
postBody,
|
||||
contentTypes,
|
||||
accepts,
|
||||
returnType,
|
||||
callback
|
||||
)
|
||||
|
||||
return request.then(
|
||||
function (result) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(null, result)
|
||||
}
|
||||
return result
|
||||
},
|
||||
function (error) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(error)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除一个bucket
|
||||
|
||||
* @param {Object} opts - parameters
|
||||
* @param {string} opts.bucketname - bucket名字,例如:test-bucket
|
||||
* @param {string} regionId - ID of the region
|
||||
* @param {string} callback - callback
|
||||
@return {Object} result
|
||||
*/
|
||||
|
||||
deleteBucket (opts, regionId = this.config.regionId, callback) {
|
||||
if (typeof regionId === 'function') {
|
||||
callback = regionId
|
||||
regionId = this.config.regionId
|
||||
}
|
||||
|
||||
if (regionId === undefined || regionId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'regionId' when calling deleteBucket"
|
||||
)
|
||||
}
|
||||
|
||||
opts = opts || {}
|
||||
|
||||
if (opts.bucketname === undefined || opts.bucketname === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'opts.bucketname' when calling deleteBucket"
|
||||
)
|
||||
}
|
||||
|
||||
let postBody = null
|
||||
let queryParams = {}
|
||||
|
||||
let pathParams = {
|
||||
regionId: regionId,
|
||||
bucketname: opts.bucketname
|
||||
}
|
||||
|
||||
let headerParams = {
|
||||
'User-Agent': 'JdcloudSdkNode/1.0.0 oss/0.2.2'
|
||||
}
|
||||
|
||||
let contentTypes = ['application/json']
|
||||
let accepts = ['application/json']
|
||||
|
||||
// 扩展自定义头
|
||||
if (opts['x-extra-header']) {
|
||||
for (let extraHeader in opts['x-extra-header']) {
|
||||
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
||||
contentTypes = opts['x-extra-header']['content-type']
|
||||
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
||||
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
||||
accepts = opts['x-extra-header']['accept']
|
||||
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
||||
accepts = opts['x-extra-header']['accept'].split(',')
|
||||
}
|
||||
}
|
||||
|
||||
let formParams = {}
|
||||
|
||||
let returnType = null
|
||||
|
||||
this.config.logger(
|
||||
`call deleteBucket with params:\npathParams:${JSON.stringify(
|
||||
pathParams
|
||||
)},\nqueryParams:${JSON.stringify(
|
||||
queryParams
|
||||
)}, \nheaderParams:${JSON.stringify(
|
||||
headerParams
|
||||
)}, \nformParams:${JSON.stringify(
|
||||
formParams
|
||||
)}, \npostBody:${JSON.stringify(postBody)}`,
|
||||
'DEBUG'
|
||||
)
|
||||
|
||||
let request = this.makeRequest(
|
||||
'/regions/{regionId}/buckets/{bucketname}',
|
||||
'DELETE',
|
||||
pathParams,
|
||||
queryParams,
|
||||
headerParams,
|
||||
formParams,
|
||||
postBody,
|
||||
contentTypes,
|
||||
accepts,
|
||||
returnType,
|
||||
callback
|
||||
)
|
||||
|
||||
return request.then(
|
||||
function (result) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(null, result)
|
||||
}
|
||||
return result
|
||||
},
|
||||
function (error) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(error)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询bucket是否存在
|
||||
|
||||
* @param {Object} opts - parameters
|
||||
* @param {string} opts.bucketname - bucket名字,例如:test-bucket
|
||||
* @param {string} regionId - ID of the region
|
||||
* @param {string} callback - callback
|
||||
@return {Object} result
|
||||
*/
|
||||
|
||||
headBucket (opts, regionId = this.config.regionId, callback) {
|
||||
if (typeof regionId === 'function') {
|
||||
callback = regionId
|
||||
regionId = this.config.regionId
|
||||
}
|
||||
|
||||
if (regionId === undefined || regionId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'regionId' when calling headBucket"
|
||||
)
|
||||
}
|
||||
|
||||
opts = opts || {}
|
||||
|
||||
if (opts.bucketname === undefined || opts.bucketname === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'opts.bucketname' when calling headBucket"
|
||||
)
|
||||
}
|
||||
|
||||
let postBody = null
|
||||
let queryParams = {}
|
||||
|
||||
let pathParams = {
|
||||
regionId: regionId,
|
||||
bucketname: opts.bucketname
|
||||
}
|
||||
|
||||
let headerParams = {
|
||||
'User-Agent': 'JdcloudSdkNode/1.0.0 oss/0.2.2'
|
||||
}
|
||||
|
||||
let contentTypes = ['application/json']
|
||||
let accepts = ['application/json']
|
||||
|
||||
// 扩展自定义头
|
||||
if (opts['x-extra-header']) {
|
||||
for (let extraHeader in opts['x-extra-header']) {
|
||||
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
||||
contentTypes = opts['x-extra-header']['content-type']
|
||||
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
||||
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
||||
accepts = opts['x-extra-header']['accept']
|
||||
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
||||
accepts = opts['x-extra-header']['accept'].split(',')
|
||||
}
|
||||
}
|
||||
|
||||
let formParams = {}
|
||||
|
||||
let returnType = null
|
||||
|
||||
this.config.logger(
|
||||
`call headBucket with params:\npathParams:${JSON.stringify(
|
||||
pathParams
|
||||
)},\nqueryParams:${JSON.stringify(
|
||||
queryParams
|
||||
)}, \nheaderParams:${JSON.stringify(
|
||||
headerParams
|
||||
)}, \nformParams:${JSON.stringify(
|
||||
formParams
|
||||
)}, \npostBody:${JSON.stringify(postBody)}`,
|
||||
'DEBUG'
|
||||
)
|
||||
|
||||
let request = this.makeRequest(
|
||||
'/regions/{regionId}/buckets/{bucketname}',
|
||||
'HEAD',
|
||||
pathParams,
|
||||
queryParams,
|
||||
headerParams,
|
||||
formParams,
|
||||
postBody,
|
||||
contentTypes,
|
||||
accepts,
|
||||
returnType,
|
||||
callback
|
||||
)
|
||||
|
||||
return request.then(
|
||||
function (result) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(null, result)
|
||||
}
|
||||
return result
|
||||
},
|
||||
function (error) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(error)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
module.exports = JDCloud.OSS
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,302 @@
|
||||
/*
|
||||
* Copyright 2018 JDCLOUD.COM
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http:#www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* search
|
||||
* 搜索相关接口
|
||||
*
|
||||
* OpenAPI spec version: v1
|
||||
* Contact:
|
||||
*
|
||||
* NOTE: This class is auto generated by the jdcloud code generator program.
|
||||
*/
|
||||
|
||||
require('../../../lib/node_loader')
|
||||
var JDCloud = require('../../../lib/core')
|
||||
var Service = JDCloud.Service
|
||||
var serviceId = 'portal'
|
||||
Service._services[serviceId] = true
|
||||
|
||||
/**
|
||||
* portal service.
|
||||
* @version 0.1.4
|
||||
*/
|
||||
|
||||
JDCloud.PORTAL = class PORTAL extends Service {
|
||||
constructor (options = {}) {
|
||||
options._defaultEndpoint = {}
|
||||
options._defaultEndpoint.protocol =
|
||||
options._defaultEndpoint.protocol || 'https'
|
||||
options._defaultEndpoint.host =
|
||||
options._defaultEndpoint.host || 'portal.jdcloud-api.com'
|
||||
options.basePath = '/v1' // 默认要设为空""
|
||||
super(serviceId, options)
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询产品的详细信息
|
||||
|
||||
* @param {Object} opts - parameters
|
||||
* @param {string} opts.url - 产品url
|
||||
* @param {string} opts.lang - 中文cn 英文en
|
||||
* @param {string} opts.ak - 外部使用ak;
|
||||
* @param {string} regionId - ID of the region
|
||||
* @param {string} callback - callback
|
||||
@return {Object} result
|
||||
* @param product result 产品详情
|
||||
*/
|
||||
|
||||
describeProduct (opts, regionId = this.config.regionId, callback) {
|
||||
if (typeof regionId === 'function') {
|
||||
callback = regionId
|
||||
regionId = this.config.regionId
|
||||
}
|
||||
|
||||
if (regionId === undefined || regionId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'regionId' when calling describeProduct"
|
||||
)
|
||||
}
|
||||
|
||||
opts = opts || {}
|
||||
|
||||
if (opts.url === undefined || opts.url === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'opts.url' when calling describeProduct"
|
||||
)
|
||||
}
|
||||
if (opts.lang === undefined || opts.lang === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'opts.lang' when calling describeProduct"
|
||||
)
|
||||
}
|
||||
if (opts.ak === undefined || opts.ak === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'opts.ak' when calling describeProduct"
|
||||
)
|
||||
}
|
||||
|
||||
let postBody = null
|
||||
let queryParams = {}
|
||||
if (opts.url !== undefined && opts.url !== null) {
|
||||
queryParams['url'] = opts.url
|
||||
}
|
||||
if (opts.lang !== undefined && opts.lang !== null) {
|
||||
queryParams['lang'] = opts.lang
|
||||
}
|
||||
if (opts.ak !== undefined && opts.ak !== null) {
|
||||
queryParams['ak'] = opts.ak
|
||||
}
|
||||
|
||||
let pathParams = {
|
||||
regionId: regionId
|
||||
}
|
||||
|
||||
let headerParams = {
|
||||
'User-Agent': 'JdcloudSdkNode/1.0.0 portal/0.1.4'
|
||||
}
|
||||
|
||||
let contentTypes = ['application/json']
|
||||
let accepts = ['application/json']
|
||||
|
||||
// 扩展自定义头
|
||||
if (opts['x-extra-header']) {
|
||||
for (let extraHeader in opts['x-extra-header']) {
|
||||
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
||||
contentTypes = opts['x-extra-header']['content-type']
|
||||
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
||||
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
||||
accepts = opts['x-extra-header']['accept']
|
||||
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
||||
accepts = opts['x-extra-header']['accept'].split(',')
|
||||
}
|
||||
}
|
||||
|
||||
let formParams = {}
|
||||
|
||||
let returnType = null
|
||||
|
||||
this.config.logger(
|
||||
`call describeProduct with params:\npathParams:${JSON.stringify(
|
||||
pathParams
|
||||
)},\nqueryParams:${JSON.stringify(
|
||||
queryParams
|
||||
)}, \nheaderParams:${JSON.stringify(
|
||||
headerParams
|
||||
)}, \nformParams:${JSON.stringify(
|
||||
formParams
|
||||
)}, \npostBody:${JSON.stringify(postBody)}`,
|
||||
'DEBUG'
|
||||
)
|
||||
|
||||
let request = this.makeRequest(
|
||||
'/regions/{regionId}/product',
|
||||
'GET',
|
||||
pathParams,
|
||||
queryParams,
|
||||
headerParams,
|
||||
formParams,
|
||||
postBody,
|
||||
contentTypes,
|
||||
accepts,
|
||||
returnType,
|
||||
callback
|
||||
)
|
||||
|
||||
return request.then(
|
||||
function (result) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(null, result)
|
||||
}
|
||||
return result
|
||||
},
|
||||
function (error) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(error)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 产品页列表查询接口
|
||||
|
||||
* @param {Object} opts - parameters
|
||||
* @param {integer} opts.id - 语言类型;中文cn;英文en;
|
||||
* @param {string} opts.ak - 外部使用ak;
|
||||
* @param {string} regionId - ID of the region
|
||||
* @param {string} callback - callback
|
||||
@return {Object} result
|
||||
* @param navigation result
|
||||
*/
|
||||
|
||||
describeProductsById (opts, regionId = this.config.regionId, callback) {
|
||||
if (typeof regionId === 'function') {
|
||||
callback = regionId
|
||||
regionId = this.config.regionId
|
||||
}
|
||||
|
||||
if (regionId === undefined || regionId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'regionId' when calling describeProductsById"
|
||||
)
|
||||
}
|
||||
|
||||
opts = opts || {}
|
||||
|
||||
if (opts.id === undefined || opts.id === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'opts.id' when calling describeProductsById"
|
||||
)
|
||||
}
|
||||
if (opts.ak === undefined || opts.ak === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'opts.ak' when calling describeProductsById"
|
||||
)
|
||||
}
|
||||
|
||||
let postBody = null
|
||||
let queryParams = {}
|
||||
if (opts.id !== undefined && opts.id !== null) {
|
||||
queryParams['id'] = opts.id
|
||||
}
|
||||
if (opts.ak !== undefined && opts.ak !== null) {
|
||||
queryParams['ak'] = opts.ak
|
||||
}
|
||||
|
||||
let pathParams = {
|
||||
regionId: regionId
|
||||
}
|
||||
|
||||
let headerParams = {
|
||||
'User-Agent': 'JdcloudSdkNode/1.0.0 portal/0.1.4'
|
||||
}
|
||||
|
||||
let contentTypes = ['application/json']
|
||||
let accepts = ['application/json']
|
||||
|
||||
// 扩展自定义头
|
||||
if (opts['x-extra-header']) {
|
||||
for (let extraHeader in opts['x-extra-header']) {
|
||||
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
||||
contentTypes = opts['x-extra-header']['content-type']
|
||||
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
||||
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
||||
accepts = opts['x-extra-header']['accept']
|
||||
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
||||
accepts = opts['x-extra-header']['accept'].split(',')
|
||||
}
|
||||
}
|
||||
|
||||
let formParams = {}
|
||||
|
||||
let returnType = null
|
||||
|
||||
this.config.logger(
|
||||
`call describeProductsById with params:\npathParams:${JSON.stringify(
|
||||
pathParams
|
||||
)},\nqueryParams:${JSON.stringify(
|
||||
queryParams
|
||||
)}, \nheaderParams:${JSON.stringify(
|
||||
headerParams
|
||||
)}, \nformParams:${JSON.stringify(
|
||||
formParams
|
||||
)}, \npostBody:${JSON.stringify(postBody)}`,
|
||||
'DEBUG'
|
||||
)
|
||||
|
||||
let request = this.makeRequest(
|
||||
'/regions/{regionId}/getProductsById',
|
||||
'GET',
|
||||
pathParams,
|
||||
queryParams,
|
||||
headerParams,
|
||||
formParams,
|
||||
postBody,
|
||||
contentTypes,
|
||||
accepts,
|
||||
returnType,
|
||||
callback
|
||||
)
|
||||
|
||||
return request.then(
|
||||
function (result) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(null, result)
|
||||
}
|
||||
return result
|
||||
},
|
||||
function (error) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(error)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
module.exports = JDCloud.PORTAL
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,327 @@
|
||||
/*
|
||||
* Copyright 2018 JDCLOUD.COM
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http:#www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* JDCLOUD remote quota API
|
||||
* API JDCLOUD remote quota API
|
||||
*
|
||||
* OpenAPI spec version: v2
|
||||
* Contact:
|
||||
*
|
||||
* NOTE: This class is auto generated by the jdcloud code generator program.
|
||||
*/
|
||||
|
||||
require('../../../lib/node_loader')
|
||||
var JDCloud = require('../../../lib/core')
|
||||
var Service = JDCloud.Service
|
||||
var serviceId = 'quota'
|
||||
Service._services[serviceId] = true
|
||||
|
||||
/**
|
||||
* quota service.
|
||||
* @version 0.0.2
|
||||
*/
|
||||
|
||||
class QUOTA extends Service {
|
||||
constructor (options = {}) {
|
||||
options._defaultEndpoint = {}
|
||||
options._defaultEndpoint.protocol =
|
||||
options._defaultEndpoint.protocol || 'https'
|
||||
options._defaultEndpoint.host =
|
||||
options._defaultEndpoint.host || 'quota.jdcloud-api.com'
|
||||
options.basePath = '/v2' // 默认要设为空""
|
||||
super(serviceId, options)
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验配额
|
||||
* @param {Object} opts - parameters
|
||||
* @param {string} [opts.pin] - 用户pin optional
|
||||
* @param {integer} [opts.siteType] - 站点类型 optional
|
||||
* @param {string} [opts.appCode] - 业务线 optional
|
||||
* @param {string} [opts.serviceCode] - 资源产品线 optional
|
||||
* @param {string} [opts.region] - 地域 optional
|
||||
* @param {string} [opts.parentResourceId] - 父层资源id(针对有两层结构的服务) optional
|
||||
* @param {string} [opts.uid] - 业务唯一键 optional
|
||||
* @param {integer} [opts.quotaAmount] - 配额数量 optional
|
||||
* @param {string} regionId - ID of the region
|
||||
* @param {string} callback - callback
|
||||
@return {Object} result
|
||||
* @param boolean success
|
||||
* @param integer code
|
||||
* @param string message
|
||||
* @param verifyQuotaResVo data
|
||||
* @param string requestId
|
||||
*/
|
||||
|
||||
verifyUserQuota (opts, regionId = this.config.regionId, callback) {
|
||||
if (typeof regionId === 'function') {
|
||||
callback = regionId
|
||||
regionId = this.config.regionId
|
||||
}
|
||||
|
||||
if (regionId === undefined || regionId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'regionId' when calling verifyUserQuota"
|
||||
)
|
||||
}
|
||||
|
||||
opts = opts || {}
|
||||
|
||||
let postBody = {}
|
||||
if (opts.pin !== undefined && opts.pin !== null) {
|
||||
postBody['pin'] = opts.pin
|
||||
}
|
||||
if (opts.siteType !== undefined && opts.siteType !== null) {
|
||||
postBody['siteType'] = opts.siteType
|
||||
}
|
||||
if (opts.appCode !== undefined && opts.appCode !== null) {
|
||||
postBody['appCode'] = opts.appCode
|
||||
}
|
||||
if (opts.serviceCode !== undefined && opts.serviceCode !== null) {
|
||||
postBody['serviceCode'] = opts.serviceCode
|
||||
}
|
||||
if (opts.region !== undefined && opts.region !== null) {
|
||||
postBody['region'] = opts.region
|
||||
}
|
||||
if (opts.parentResourceId !== undefined && opts.parentResourceId !== null) {
|
||||
postBody['parentResourceId'] = opts.parentResourceId
|
||||
}
|
||||
if (opts.uid !== undefined && opts.uid !== null) {
|
||||
postBody['uid'] = opts.uid
|
||||
}
|
||||
if (opts.quotaAmount !== undefined && opts.quotaAmount !== null) {
|
||||
postBody['quotaAmount'] = opts.quotaAmount
|
||||
}
|
||||
|
||||
let queryParams = {}
|
||||
|
||||
let pathParams = {
|
||||
regionId: regionId
|
||||
}
|
||||
|
||||
let headerParams = {
|
||||
'User-Agent': 'JdcloudSdkNode/1.0.0 quota/0.0.2'
|
||||
}
|
||||
|
||||
let contentTypes = ['application/json']
|
||||
let accepts = ['application/json']
|
||||
|
||||
// 扩展自定义头
|
||||
if (opts['x-extra-header']) {
|
||||
for (let extraHeader in opts['x-extra-header']) {
|
||||
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
||||
contentTypes = opts['x-extra-header']['content-type']
|
||||
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
||||
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
||||
accepts = opts['x-extra-header']['accept']
|
||||
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
||||
accepts = opts['x-extra-header']['accept'].split(',')
|
||||
}
|
||||
}
|
||||
|
||||
let formParams = {}
|
||||
|
||||
let returnType = null
|
||||
|
||||
this.config.logger(
|
||||
`call verifyUserQuota with params:\npathParams:${JSON.stringify(
|
||||
pathParams
|
||||
)},\nqueryParams:${JSON.stringify(
|
||||
queryParams
|
||||
)}, \nheaderParams:${JSON.stringify(
|
||||
headerParams
|
||||
)}, \nformParams:${JSON.stringify(
|
||||
formParams
|
||||
)}, \npostBody:${JSON.stringify(postBody)}`,
|
||||
'DEBUG'
|
||||
)
|
||||
|
||||
let request = super.makeRequest(
|
||||
'/regions/{regionId}/userQuota:verify',
|
||||
'POST',
|
||||
pathParams,
|
||||
queryParams,
|
||||
headerParams,
|
||||
formParams,
|
||||
postBody,
|
||||
contentTypes,
|
||||
accepts,
|
||||
returnType,
|
||||
callback
|
||||
)
|
||||
|
||||
return request.then(
|
||||
function (result) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(null, result)
|
||||
}
|
||||
return result
|
||||
},
|
||||
function (error) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(error)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验配额
|
||||
* @param {Object} opts - parameters
|
||||
* @param {string} [opts.pin] - 用户pin optional
|
||||
* @param {integer} [opts.siteType] - 站点类型 optional
|
||||
* @param {string} [opts.appCode] - 业务线 optional
|
||||
* @param {string} [opts.serviceCode] - 资源产品线 optional
|
||||
* @param {string} [opts.region] - 地域 optional
|
||||
* @param {string} [opts.parentResourceId] - 父层资源id(针对有两层结构的服务) optional
|
||||
* @param {string} [opts.uid] - 业务唯一键 optional
|
||||
* @param {integer} [opts.quotaAmount] - 配额数量 optional
|
||||
* @param {string} regionId - ID of the region
|
||||
* @param {string} callback - callback
|
||||
@return {Object} result
|
||||
* @param boolean success
|
||||
* @param integer code
|
||||
* @param string message
|
||||
* @param userQuotaResVo data
|
||||
* @param string requestId
|
||||
*/
|
||||
|
||||
getUserQuotaDetail (opts, regionId = this.config.regionId, callback) {
|
||||
if (typeof regionId === 'function') {
|
||||
callback = regionId
|
||||
regionId = this.config.regionId
|
||||
}
|
||||
|
||||
if (regionId === undefined || regionId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'regionId' when calling getUserQuotaDetail"
|
||||
)
|
||||
}
|
||||
|
||||
opts = opts || {}
|
||||
|
||||
let postBody = {}
|
||||
if (opts.pin !== undefined && opts.pin !== null) {
|
||||
postBody['pin'] = opts.pin
|
||||
}
|
||||
if (opts.siteType !== undefined && opts.siteType !== null) {
|
||||
postBody['siteType'] = opts.siteType
|
||||
}
|
||||
if (opts.appCode !== undefined && opts.appCode !== null) {
|
||||
postBody['appCode'] = opts.appCode
|
||||
}
|
||||
if (opts.serviceCode !== undefined && opts.serviceCode !== null) {
|
||||
postBody['serviceCode'] = opts.serviceCode
|
||||
}
|
||||
if (opts.region !== undefined && opts.region !== null) {
|
||||
postBody['region'] = opts.region
|
||||
}
|
||||
if (opts.parentResourceId !== undefined && opts.parentResourceId !== null) {
|
||||
postBody['parentResourceId'] = opts.parentResourceId
|
||||
}
|
||||
if (opts.uid !== undefined && opts.uid !== null) {
|
||||
postBody['uid'] = opts.uid
|
||||
}
|
||||
if (opts.quotaAmount !== undefined && opts.quotaAmount !== null) {
|
||||
postBody['quotaAmount'] = opts.quotaAmount
|
||||
}
|
||||
|
||||
let queryParams = {}
|
||||
|
||||
let pathParams = {
|
||||
regionId: regionId
|
||||
}
|
||||
|
||||
let headerParams = {
|
||||
'User-Agent': 'JdcloudSdkNode/1.0.0 quota/0.0.2'
|
||||
}
|
||||
|
||||
let contentTypes = ['application/json']
|
||||
let accepts = ['application/json']
|
||||
|
||||
// 扩展自定义头
|
||||
if (opts['x-extra-header']) {
|
||||
for (let extraHeader in opts['x-extra-header']) {
|
||||
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
||||
contentTypes = opts['x-extra-header']['content-type']
|
||||
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
||||
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
||||
accepts = opts['x-extra-header']['accept']
|
||||
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
||||
accepts = opts['x-extra-header']['accept'].split(',')
|
||||
}
|
||||
}
|
||||
|
||||
let formParams = {}
|
||||
|
||||
let returnType = null
|
||||
|
||||
this.config.logger(
|
||||
`call getUserQuotaDetail with params:\npathParams:${JSON.stringify(
|
||||
pathParams
|
||||
)},\nqueryParams:${JSON.stringify(
|
||||
queryParams
|
||||
)}, \nheaderParams:${JSON.stringify(
|
||||
headerParams
|
||||
)}, \nformParams:${JSON.stringify(
|
||||
formParams
|
||||
)}, \npostBody:${JSON.stringify(postBody)}`,
|
||||
'DEBUG'
|
||||
)
|
||||
|
||||
let request = super.makeRequest(
|
||||
'/regions/{regionId}/userQuota:getDetail',
|
||||
'POST',
|
||||
pathParams,
|
||||
queryParams,
|
||||
headerParams,
|
||||
formParams,
|
||||
postBody,
|
||||
contentTypes,
|
||||
accepts,
|
||||
returnType,
|
||||
callback
|
||||
)
|
||||
|
||||
return request.then(
|
||||
function (result) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(null, result)
|
||||
}
|
||||
return result
|
||||
},
|
||||
function (error) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(error)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
module.exports = QUOTA
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,289 @@
|
||||
/*
|
||||
* Copyright 2018 JDCLOUD.COM
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http:#www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* 退款策略中心
|
||||
* 退款策略中心接口
|
||||
*
|
||||
* OpenAPI spec version: v1
|
||||
* Contact:
|
||||
*
|
||||
* NOTE: This class is auto generated by the jdcloud code generator program.
|
||||
*/
|
||||
|
||||
require('../../../lib/node_loader')
|
||||
var JDCloud = require('../../../lib/core')
|
||||
var Service = JDCloud.Service
|
||||
var serviceId = 'refund'
|
||||
Service._services[serviceId] = true
|
||||
|
||||
/**
|
||||
* refund service.
|
||||
* @version 0.0.1
|
||||
*/
|
||||
|
||||
class REFUND extends Service {
|
||||
constructor (options = {}) {
|
||||
options._defaultEndpoint = {}
|
||||
options._defaultEndpoint.protocol =
|
||||
options._defaultEndpoint.protocol || 'https'
|
||||
options._defaultEndpoint.host =
|
||||
options._defaultEndpoint.host || 'refund.jdcloud.com'
|
||||
options.basePath = '/v1' // 默认要设为空""
|
||||
super(serviceId, options)
|
||||
}
|
||||
|
||||
/**
|
||||
* 退款并删除资源
|
||||
* @param {Object} opts - parameters
|
||||
* @param {resourceRefundReq} [opts.jsonBody] optional
|
||||
* @param {string} regionId - ID of the region
|
||||
* @param {string} callback - callback
|
||||
@return {Object} result
|
||||
* @param boolean success true-请求成功,false-请求失败
|
||||
* @param integer code 结果code
|
||||
* @param string data 退款单号
|
||||
* @param string message 失败时显示原因
|
||||
*/
|
||||
|
||||
submitResourceRefund (opts, regionId = this.config.regionId, callback) {
|
||||
if (typeof regionId === 'function') {
|
||||
callback = regionId
|
||||
regionId = this.config.regionId
|
||||
}
|
||||
|
||||
if (regionId === undefined || regionId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'regionId' when calling submitResourceRefund"
|
||||
)
|
||||
}
|
||||
|
||||
opts = opts || {}
|
||||
|
||||
let postBody = {}
|
||||
if (opts.jsonBody !== undefined && opts.jsonBody !== null) {
|
||||
postBody['jsonBody'] = opts.jsonBody
|
||||
}
|
||||
|
||||
let queryParams = {}
|
||||
|
||||
let pathParams = {
|
||||
regionId: regionId
|
||||
}
|
||||
|
||||
let headerParams = {
|
||||
'User-Agent': 'JdcloudSdkNode/1.0.0 refund/0.0.1'
|
||||
}
|
||||
|
||||
let contentTypes = ['application/json']
|
||||
let accepts = ['application/json']
|
||||
|
||||
// 扩展自定义头
|
||||
if (opts['x-extra-header']) {
|
||||
for (let extraHeader in opts['x-extra-header']) {
|
||||
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
||||
contentTypes = opts['x-extra-header']['content-type']
|
||||
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
||||
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
||||
accepts = opts['x-extra-header']['accept']
|
||||
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
||||
accepts = opts['x-extra-header']['accept'].split(',')
|
||||
}
|
||||
}
|
||||
|
||||
let formParams = {}
|
||||
|
||||
let returnType = null
|
||||
|
||||
this.config.logger(
|
||||
`call submitResourceRefund with params:\npathParams:${JSON.stringify(
|
||||
pathParams
|
||||
)},\nqueryParams:${JSON.stringify(
|
||||
queryParams
|
||||
)}, \nheaderParams:${JSON.stringify(
|
||||
headerParams
|
||||
)}, \nformParams:${JSON.stringify(
|
||||
formParams
|
||||
)}, \npostBody:${JSON.stringify(postBody)}`,
|
||||
'DEBUG'
|
||||
)
|
||||
|
||||
let request = super.makeRequest(
|
||||
'/regions/{regionId}/refund:resource',
|
||||
'POST',
|
||||
pathParams,
|
||||
queryParams,
|
||||
headerParams,
|
||||
formParams,
|
||||
postBody,
|
||||
contentTypes,
|
||||
accepts,
|
||||
returnType,
|
||||
callback
|
||||
)
|
||||
|
||||
return request.then(
|
||||
function (result) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(null, result)
|
||||
}
|
||||
return result
|
||||
},
|
||||
function (error) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(error)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询退款状态
|
||||
* @param {Object} opts - parameters
|
||||
* @param {string} opts.pin
|
||||
* @param {string} [opts.refundId] optional
|
||||
* @param {string} [opts.resourceId] optional
|
||||
* @param {integer} [opts.pageNumber] - 第几页,默认值为0 optional
|
||||
* @param {integer} [opts.pageSize] - 每页条数,默认为20 optional
|
||||
* @param {string} regionId - ID of the region
|
||||
* @param {string} callback - callback
|
||||
@return {Object} result
|
||||
* @param pageInfos pageInfos
|
||||
* @param refundResult data
|
||||
*/
|
||||
|
||||
descirbeRefundStatus (opts, regionId = this.config.regionId, callback) {
|
||||
if (typeof regionId === 'function') {
|
||||
callback = regionId
|
||||
regionId = this.config.regionId
|
||||
}
|
||||
|
||||
if (regionId === undefined || regionId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'regionId' when calling descirbeRefundStatus"
|
||||
)
|
||||
}
|
||||
|
||||
opts = opts || {}
|
||||
|
||||
if (opts.pin === undefined || opts.pin === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'opts.pin' when calling descirbeRefundStatus"
|
||||
)
|
||||
}
|
||||
|
||||
let postBody = {}
|
||||
if (opts.pin !== undefined && opts.pin !== null) {
|
||||
postBody['pin'] = opts.pin
|
||||
}
|
||||
if (opts.refundId !== undefined && opts.refundId !== null) {
|
||||
postBody['refundId'] = opts.refundId
|
||||
}
|
||||
if (opts.resourceId !== undefined && opts.resourceId !== null) {
|
||||
postBody['resourceId'] = opts.resourceId
|
||||
}
|
||||
if (opts.pageNumber !== undefined && opts.pageNumber !== null) {
|
||||
postBody['pageNumber'] = opts.pageNumber
|
||||
}
|
||||
if (opts.pageSize !== undefined && opts.pageSize !== null) {
|
||||
postBody['pageSize'] = opts.pageSize
|
||||
}
|
||||
|
||||
let queryParams = {}
|
||||
|
||||
let pathParams = {
|
||||
regionId: regionId
|
||||
}
|
||||
|
||||
let headerParams = {
|
||||
'User-Agent': 'JdcloudSdkNode/1.0.0 refund/0.0.1'
|
||||
}
|
||||
|
||||
let contentTypes = ['application/json']
|
||||
let accepts = ['application/json']
|
||||
|
||||
// 扩展自定义头
|
||||
if (opts['x-extra-header']) {
|
||||
for (let extraHeader in opts['x-extra-header']) {
|
||||
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
||||
contentTypes = opts['x-extra-header']['content-type']
|
||||
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
||||
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
||||
accepts = opts['x-extra-header']['accept']
|
||||
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
||||
accepts = opts['x-extra-header']['accept'].split(',')
|
||||
}
|
||||
}
|
||||
|
||||
let formParams = {}
|
||||
|
||||
let returnType = null
|
||||
|
||||
this.config.logger(
|
||||
`call descirbeRefundStatus with params:\npathParams:${JSON.stringify(
|
||||
pathParams
|
||||
)},\nqueryParams:${JSON.stringify(
|
||||
queryParams
|
||||
)}, \nheaderParams:${JSON.stringify(
|
||||
headerParams
|
||||
)}, \nformParams:${JSON.stringify(
|
||||
formParams
|
||||
)}, \npostBody:${JSON.stringify(postBody)}`,
|
||||
'DEBUG'
|
||||
)
|
||||
|
||||
let request = super.makeRequest(
|
||||
'/regions/{regionId}/refund:status',
|
||||
'POST',
|
||||
pathParams,
|
||||
queryParams,
|
||||
headerParams,
|
||||
formParams,
|
||||
postBody,
|
||||
contentTypes,
|
||||
accepts,
|
||||
returnType,
|
||||
callback
|
||||
)
|
||||
|
||||
return request.then(
|
||||
function (result) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(null, result)
|
||||
}
|
||||
return result
|
||||
},
|
||||
function (error) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(error)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
module.exports = REFUND
|
||||
@@ -0,0 +1,317 @@
|
||||
/*
|
||||
* Copyright 2018 JDCLOUD.COM
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http:#www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* sysConfig APIs
|
||||
* 系统参数配置
|
||||
*
|
||||
* OpenAPI spec version: v1
|
||||
* Contact:
|
||||
*
|
||||
* NOTE: This class is auto generated by the jdcloud code generator program.
|
||||
*/
|
||||
|
||||
require('../../../lib/node_loader')
|
||||
var JDCloud = require('../../../lib/core')
|
||||
var Service = JDCloud.Service
|
||||
var serviceId = 'reservedinstance'
|
||||
Service._services[serviceId] = true
|
||||
|
||||
/**
|
||||
* reservedinstance service.
|
||||
* @version 0.1.2
|
||||
*/
|
||||
|
||||
class RESERVEDINSTANCE extends Service {
|
||||
constructor (options = {}) {
|
||||
options._defaultEndpoint = {}
|
||||
options._defaultEndpoint.protocol =
|
||||
options._defaultEndpoint.protocol || 'https'
|
||||
options._defaultEndpoint.host =
|
||||
options._defaultEndpoint.host || 'reservedinstance.jdcloud-api.com'
|
||||
options.basePath = '/v1' // 默认要设为空""
|
||||
super(serviceId, options)
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询实例券使用明细列表
|
||||
* @param {Object} opts - parameters
|
||||
* @param {string} [opts.reservedInstanceType] - 实例券类型 optional
|
||||
* @param {string} [opts.reservedInstanceId] - 实例券ID optional
|
||||
* @param {string} [opts.instanceId] - 抵扣实例ID optional
|
||||
* @param {string} [opts.startTime] - 使用开始时间 optional
|
||||
* @param {string} [opts.endTime] - 使用结束时间 optional
|
||||
* @param {integer} [opts.pageNo] - 页码,默认为1 optional
|
||||
* @param {integer} [opts.pageSize] - 分页大小,默认10,最大100 optional
|
||||
* @param {string} regionId - ID of the region
|
||||
* @param {string} callback - callback
|
||||
@return {Object} result
|
||||
* @param pagination pagination
|
||||
* @param deductionDetailVo result
|
||||
*/
|
||||
|
||||
describeDeductionDetails (opts, regionId = this.config.regionId, callback) {
|
||||
if (typeof regionId === 'function') {
|
||||
callback = regionId
|
||||
regionId = this.config.regionId
|
||||
}
|
||||
|
||||
if (regionId === undefined || regionId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'regionId' when calling describeDeductionDetails"
|
||||
)
|
||||
}
|
||||
|
||||
opts = opts || {}
|
||||
|
||||
let postBody = null
|
||||
let queryParams = {}
|
||||
if (
|
||||
opts.reservedInstanceType !== undefined &&
|
||||
opts.reservedInstanceType !== null
|
||||
) {
|
||||
queryParams['reservedInstanceType'] = opts.reservedInstanceType
|
||||
}
|
||||
if (
|
||||
opts.reservedInstanceId !== undefined &&
|
||||
opts.reservedInstanceId !== null
|
||||
) {
|
||||
queryParams['reservedInstanceId'] = opts.reservedInstanceId
|
||||
}
|
||||
if (opts.instanceId !== undefined && opts.instanceId !== null) {
|
||||
queryParams['instanceId'] = opts.instanceId
|
||||
}
|
||||
if (opts.startTime !== undefined && opts.startTime !== null) {
|
||||
queryParams['startTime'] = opts.startTime
|
||||
}
|
||||
if (opts.endTime !== undefined && opts.endTime !== null) {
|
||||
queryParams['endTime'] = opts.endTime
|
||||
}
|
||||
if (opts.pageNo !== undefined && opts.pageNo !== null) {
|
||||
queryParams['pageNo'] = opts.pageNo
|
||||
}
|
||||
if (opts.pageSize !== undefined && opts.pageSize !== null) {
|
||||
queryParams['pageSize'] = opts.pageSize
|
||||
}
|
||||
|
||||
let pathParams = {
|
||||
regionId: regionId
|
||||
}
|
||||
|
||||
let headerParams = {
|
||||
'User-Agent': 'JdcloudSdkNode/1.0.0 reservedinstance/0.1.2'
|
||||
}
|
||||
|
||||
let contentTypes = ['application/json']
|
||||
let accepts = ['application/json']
|
||||
|
||||
// 扩展自定义头
|
||||
if (opts['x-extra-header']) {
|
||||
for (let extraHeader in opts['x-extra-header']) {
|
||||
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
||||
contentTypes = opts['x-extra-header']['content-type']
|
||||
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
||||
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
||||
accepts = opts['x-extra-header']['accept']
|
||||
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
||||
accepts = opts['x-extra-header']['accept'].split(',')
|
||||
}
|
||||
}
|
||||
|
||||
let formParams = {}
|
||||
|
||||
let returnType = null
|
||||
|
||||
this.config.logger(
|
||||
`call describeDeductionDetails with params:\npathParams:${JSON.stringify(
|
||||
pathParams
|
||||
)},\nqueryParams:${JSON.stringify(
|
||||
queryParams
|
||||
)}, \nheaderParams:${JSON.stringify(
|
||||
headerParams
|
||||
)}, \nformParams:${JSON.stringify(
|
||||
formParams
|
||||
)}, \npostBody:${JSON.stringify(postBody)}`,
|
||||
'DEBUG'
|
||||
)
|
||||
|
||||
let request = super.makeRequest(
|
||||
'/regions/{regionId}/deductionDetails',
|
||||
'GET',
|
||||
pathParams,
|
||||
queryParams,
|
||||
headerParams,
|
||||
formParams,
|
||||
postBody,
|
||||
contentTypes,
|
||||
accepts,
|
||||
returnType,
|
||||
callback
|
||||
)
|
||||
|
||||
return request.then(
|
||||
function (result) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(null, result)
|
||||
}
|
||||
return result
|
||||
},
|
||||
function (error) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(error)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询实例抵扣券列表
|
||||
* @param {Object} opts - parameters
|
||||
* @param {string} [opts.voucherType] - 实例券类型 optional
|
||||
* @param {integer} [opts.status] - 状态(全部:不传 1.生效 2.失效) optional
|
||||
* @param {string} [opts.createTimeBegin] - 创建时间段开始时间 optional
|
||||
* @param {string} [opts.createTimeEnd] - 创建时间段结束时间 optional
|
||||
* @param {integer} [opts.pageNum] - 当前页序号(默认:1) optional
|
||||
* @param {integer} [opts.pageSize] - 每页结果数量(默认:10) optional
|
||||
* @param {string} regionId - ID of the region
|
||||
* @param {string} callback - callback
|
||||
@return {Object} result
|
||||
* @param pagination pagination 分页信息
|
||||
* @param consoleInstanceVoucherVo data
|
||||
*/
|
||||
|
||||
describeConsoleInstanceVouchers (
|
||||
opts,
|
||||
regionId = this.config.regionId,
|
||||
callback
|
||||
) {
|
||||
if (typeof regionId === 'function') {
|
||||
callback = regionId
|
||||
regionId = this.config.regionId
|
||||
}
|
||||
|
||||
if (regionId === undefined || regionId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'regionId' when calling describeConsoleInstanceVouchers"
|
||||
)
|
||||
}
|
||||
|
||||
opts = opts || {}
|
||||
|
||||
let postBody = null
|
||||
let queryParams = {}
|
||||
if (opts.voucherType !== undefined && opts.voucherType !== null) {
|
||||
queryParams['voucherType'] = opts.voucherType
|
||||
}
|
||||
if (opts.status !== undefined && opts.status !== null) {
|
||||
queryParams['status'] = opts.status
|
||||
}
|
||||
if (opts.createTimeBegin !== undefined && opts.createTimeBegin !== null) {
|
||||
queryParams['createTimeBegin'] = opts.createTimeBegin
|
||||
}
|
||||
if (opts.createTimeEnd !== undefined && opts.createTimeEnd !== null) {
|
||||
queryParams['createTimeEnd'] = opts.createTimeEnd
|
||||
}
|
||||
if (opts.pageNum !== undefined && opts.pageNum !== null) {
|
||||
queryParams['pageNum'] = opts.pageNum
|
||||
}
|
||||
if (opts.pageSize !== undefined && opts.pageSize !== null) {
|
||||
queryParams['pageSize'] = opts.pageSize
|
||||
}
|
||||
|
||||
let pathParams = {
|
||||
regionId: regionId
|
||||
}
|
||||
|
||||
let headerParams = {
|
||||
'User-Agent': 'JdcloudSdkNode/1.0.0 reservedinstance/0.1.2'
|
||||
}
|
||||
|
||||
let contentTypes = ['application/json']
|
||||
let accepts = ['application/json']
|
||||
|
||||
// 扩展自定义头
|
||||
if (opts['x-extra-header']) {
|
||||
for (let extraHeader in opts['x-extra-header']) {
|
||||
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
||||
contentTypes = opts['x-extra-header']['content-type']
|
||||
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
||||
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
||||
accepts = opts['x-extra-header']['accept']
|
||||
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
||||
accepts = opts['x-extra-header']['accept'].split(',')
|
||||
}
|
||||
}
|
||||
|
||||
let formParams = {}
|
||||
|
||||
let returnType = null
|
||||
|
||||
this.config.logger(
|
||||
`call describeConsoleInstanceVouchers with params:\npathParams:${JSON.stringify(
|
||||
pathParams
|
||||
)},\nqueryParams:${JSON.stringify(
|
||||
queryParams
|
||||
)}, \nheaderParams:${JSON.stringify(
|
||||
headerParams
|
||||
)}, \nformParams:${JSON.stringify(
|
||||
formParams
|
||||
)}, \npostBody:${JSON.stringify(postBody)}`,
|
||||
'DEBUG'
|
||||
)
|
||||
|
||||
let request = super.makeRequest(
|
||||
'/regions/{regionId}/instanceVoucher:describeConsoleInstanceVouchers',
|
||||
'GET',
|
||||
pathParams,
|
||||
queryParams,
|
||||
headerParams,
|
||||
formParams,
|
||||
postBody,
|
||||
contentTypes,
|
||||
accepts,
|
||||
returnType,
|
||||
callback
|
||||
)
|
||||
|
||||
return request.then(
|
||||
function (result) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(null, result)
|
||||
}
|
||||
return result
|
||||
},
|
||||
function (error) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(error)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
module.exports = RESERVEDINSTANCE
|
||||
@@ -0,0 +1,857 @@
|
||||
/*
|
||||
* Copyright 2018 JDCLOUD.COM
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http:#www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* Resource-Tag-APIs
|
||||
* 资源标签接口
|
||||
*
|
||||
* OpenAPI spec version: v1
|
||||
* Contact:
|
||||
*
|
||||
* NOTE: This class is auto generated by the jdcloud code generator program.
|
||||
*/
|
||||
|
||||
require('../../../lib/node_loader')
|
||||
var JDCloud = require('../../../lib/core')
|
||||
var Service = JDCloud.Service
|
||||
var serviceId = 'resourcetag'
|
||||
Service._services[serviceId] = true
|
||||
|
||||
/**
|
||||
* resourcetag service.
|
||||
* @version 0.6.0
|
||||
*/
|
||||
|
||||
class RESOURCETAG extends Service {
|
||||
constructor (options = {}) {
|
||||
options._defaultEndpoint = {}
|
||||
options._defaultEndpoint.protocol =
|
||||
options._defaultEndpoint.protocol || 'https'
|
||||
options._defaultEndpoint.host =
|
||||
options._defaultEndpoint.host || 'resource-tag.jdcloud-api.com'
|
||||
options.basePath = '/v1' // 默认要设为空""
|
||||
super(serviceId, options)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得资源与对应标签列表详情,不含资源名称和可用区。<br/>
|
||||
注意查询cdn的资源时url中regionId必须指定为cn-all。<br/>
|
||||
该接口目前不支持分页功能。
|
||||
|
||||
* @param {Object} opts - parameters
|
||||
* @param {resourceReqVo} opts.resourceVo - 资源标签参数对象
|
||||
* @param {string} regionId - ID of the region
|
||||
* @param {string} callback - callback
|
||||
@return {Object} result
|
||||
* @param resourceResVo data 资源与对应标签列表详情
|
||||
*/
|
||||
|
||||
describeResources (opts, regionId = this.config.regionId, callback) {
|
||||
if (typeof regionId === 'function') {
|
||||
callback = regionId
|
||||
regionId = this.config.regionId
|
||||
}
|
||||
|
||||
if (regionId === undefined || regionId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'regionId' when calling describeResources"
|
||||
)
|
||||
}
|
||||
|
||||
opts = opts || {}
|
||||
|
||||
if (opts.resourceVo === undefined || opts.resourceVo === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'opts.resourceVo' when calling describeResources"
|
||||
)
|
||||
}
|
||||
|
||||
let postBody = {}
|
||||
if (opts.resourceVo !== undefined && opts.resourceVo !== null) {
|
||||
postBody['resourceVo'] = opts.resourceVo
|
||||
}
|
||||
|
||||
let queryParams = {}
|
||||
|
||||
let pathParams = {
|
||||
regionId: regionId
|
||||
}
|
||||
|
||||
let headerParams = {
|
||||
'User-Agent': 'JdcloudSdkNode/1.0.0 resourcetag/0.6.0'
|
||||
}
|
||||
|
||||
let contentTypes = ['application/json']
|
||||
let accepts = ['application/json']
|
||||
|
||||
// 扩展自定义头
|
||||
if (opts['x-extra-header']) {
|
||||
for (let extraHeader in opts['x-extra-header']) {
|
||||
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
||||
contentTypes = opts['x-extra-header']['content-type']
|
||||
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
||||
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
||||
accepts = opts['x-extra-header']['accept']
|
||||
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
||||
accepts = opts['x-extra-header']['accept'].split(',')
|
||||
}
|
||||
}
|
||||
|
||||
let formParams = {}
|
||||
|
||||
let returnType = null
|
||||
|
||||
this.config.logger(
|
||||
`call describeResources with params:\npathParams:${JSON.stringify(
|
||||
pathParams
|
||||
)},\nqueryParams:${JSON.stringify(
|
||||
queryParams
|
||||
)}, \nheaderParams:${JSON.stringify(
|
||||
headerParams
|
||||
)}, \nformParams:${JSON.stringify(
|
||||
formParams
|
||||
)}, \npostBody:${JSON.stringify(postBody)}`,
|
||||
'DEBUG'
|
||||
)
|
||||
|
||||
let request = super.makeRequest(
|
||||
'/regions/{regionId}/tags:describeResources',
|
||||
'POST',
|
||||
pathParams,
|
||||
queryParams,
|
||||
headerParams,
|
||||
formParams,
|
||||
postBody,
|
||||
contentTypes,
|
||||
accepts,
|
||||
returnType,
|
||||
callback
|
||||
)
|
||||
|
||||
return request.then(
|
||||
function (result) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(null, result)
|
||||
}
|
||||
return result
|
||||
},
|
||||
function (error) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(error)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取资源标签。<br/>
|
||||
注意查询cdn资源的标签时url中regionId必须指定为cn-all。<br/>
|
||||
注意查询不限制地域时url中regionId必须指定为all-region。
|
||||
|
||||
* @param {Object} opts - parameters
|
||||
* @param {tagsReqVo} opts.tagKeysVo - 标签参数
|
||||
* @param {string} regionId - ID of the region
|
||||
* @param {string} callback - callback
|
||||
@return {Object} result
|
||||
* @param tagsResVo data 获取标签结果详情
|
||||
*/
|
||||
|
||||
describeTags (opts, regionId = this.config.regionId, callback) {
|
||||
if (typeof regionId === 'function') {
|
||||
callback = regionId
|
||||
regionId = this.config.regionId
|
||||
}
|
||||
|
||||
if (regionId === undefined || regionId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'regionId' when calling describeTags"
|
||||
)
|
||||
}
|
||||
|
||||
opts = opts || {}
|
||||
|
||||
if (opts.tagKeysVo === undefined || opts.tagKeysVo === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'opts.tagKeysVo' when calling describeTags"
|
||||
)
|
||||
}
|
||||
|
||||
let postBody = {}
|
||||
if (opts.tagKeysVo !== undefined && opts.tagKeysVo !== null) {
|
||||
postBody['tagKeysVo'] = opts.tagKeysVo
|
||||
}
|
||||
|
||||
let queryParams = {}
|
||||
|
||||
let pathParams = {
|
||||
regionId: regionId
|
||||
}
|
||||
|
||||
let headerParams = {
|
||||
'User-Agent': 'JdcloudSdkNode/1.0.0 resourcetag/0.6.0'
|
||||
}
|
||||
|
||||
let contentTypes = ['application/json']
|
||||
let accepts = ['application/json']
|
||||
|
||||
// 扩展自定义头
|
||||
if (opts['x-extra-header']) {
|
||||
for (let extraHeader in opts['x-extra-header']) {
|
||||
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
||||
contentTypes = opts['x-extra-header']['content-type']
|
||||
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
||||
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
||||
accepts = opts['x-extra-header']['accept']
|
||||
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
||||
accepts = opts['x-extra-header']['accept'].split(',')
|
||||
}
|
||||
}
|
||||
|
||||
let formParams = {}
|
||||
|
||||
let returnType = null
|
||||
|
||||
this.config.logger(
|
||||
`call describeTags with params:\npathParams:${JSON.stringify(
|
||||
pathParams
|
||||
)},\nqueryParams:${JSON.stringify(
|
||||
queryParams
|
||||
)}, \nheaderParams:${JSON.stringify(
|
||||
headerParams
|
||||
)}, \nformParams:${JSON.stringify(
|
||||
formParams
|
||||
)}, \npostBody:${JSON.stringify(postBody)}`,
|
||||
'DEBUG'
|
||||
)
|
||||
|
||||
let request = super.makeRequest(
|
||||
'/regions/{regionId}/describeTags',
|
||||
'POST',
|
||||
pathParams,
|
||||
queryParams,
|
||||
headerParams,
|
||||
formParams,
|
||||
postBody,
|
||||
contentTypes,
|
||||
accepts,
|
||||
returnType,
|
||||
callback
|
||||
)
|
||||
|
||||
return request.then(
|
||||
function (result) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(null, result)
|
||||
}
|
||||
return result
|
||||
},
|
||||
function (error) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(error)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取标签键
|
||||
* @param {Object} opts - parameters
|
||||
* @param {tagKeysReqVo} opts.tagKeysVo - 标签键参数
|
||||
* @param {string} regionId - ID of the region
|
||||
* @param {string} callback - callback
|
||||
@return {Object} result
|
||||
* @param tagKeysResVo data 获取标签键结果详情
|
||||
*/
|
||||
|
||||
describeKeys (opts, regionId = this.config.regionId, callback) {
|
||||
if (typeof regionId === 'function') {
|
||||
callback = regionId
|
||||
regionId = this.config.regionId
|
||||
}
|
||||
|
||||
if (regionId === undefined || regionId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'regionId' when calling describeKeys"
|
||||
)
|
||||
}
|
||||
|
||||
opts = opts || {}
|
||||
|
||||
if (opts.tagKeysVo === undefined || opts.tagKeysVo === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'opts.tagKeysVo' when calling describeKeys"
|
||||
)
|
||||
}
|
||||
|
||||
let postBody = {}
|
||||
if (opts.tagKeysVo !== undefined && opts.tagKeysVo !== null) {
|
||||
postBody['tagKeysVo'] = opts.tagKeysVo
|
||||
}
|
||||
|
||||
let queryParams = {}
|
||||
|
||||
let pathParams = {
|
||||
regionId: regionId
|
||||
}
|
||||
|
||||
let headerParams = {
|
||||
'User-Agent': 'JdcloudSdkNode/1.0.0 resourcetag/0.6.0'
|
||||
}
|
||||
|
||||
let contentTypes = ['application/json']
|
||||
let accepts = ['application/json']
|
||||
|
||||
// 扩展自定义头
|
||||
if (opts['x-extra-header']) {
|
||||
for (let extraHeader in opts['x-extra-header']) {
|
||||
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
||||
contentTypes = opts['x-extra-header']['content-type']
|
||||
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
||||
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
||||
accepts = opts['x-extra-header']['accept']
|
||||
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
||||
accepts = opts['x-extra-header']['accept'].split(',')
|
||||
}
|
||||
}
|
||||
|
||||
let formParams = {}
|
||||
|
||||
let returnType = null
|
||||
|
||||
this.config.logger(
|
||||
`call describeKeys with params:\npathParams:${JSON.stringify(
|
||||
pathParams
|
||||
)},\nqueryParams:${JSON.stringify(
|
||||
queryParams
|
||||
)}, \nheaderParams:${JSON.stringify(
|
||||
headerParams
|
||||
)}, \nformParams:${JSON.stringify(
|
||||
formParams
|
||||
)}, \npostBody:${JSON.stringify(postBody)}`,
|
||||
'DEBUG'
|
||||
)
|
||||
|
||||
let request = super.makeRequest(
|
||||
'/regions/{regionId}/tags:describeKeys',
|
||||
'POST',
|
||||
pathParams,
|
||||
queryParams,
|
||||
headerParams,
|
||||
formParams,
|
||||
postBody,
|
||||
contentTypes,
|
||||
accepts,
|
||||
returnType,
|
||||
callback
|
||||
)
|
||||
|
||||
return request.then(
|
||||
function (result) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(null, result)
|
||||
}
|
||||
return result
|
||||
},
|
||||
function (error) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(error)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取标签值
|
||||
* @param {Object} opts - parameters
|
||||
* @param {tagValuesReqVo} opts.tagValuesVo - 标签值参数
|
||||
* @param {string} regionId - ID of the region
|
||||
* @param {string} callback - callback
|
||||
@return {Object} result
|
||||
* @param tagValuesResVo data 获取标签值结果详情
|
||||
*/
|
||||
|
||||
describeValues (opts, regionId = this.config.regionId, callback) {
|
||||
if (typeof regionId === 'function') {
|
||||
callback = regionId
|
||||
regionId = this.config.regionId
|
||||
}
|
||||
|
||||
if (regionId === undefined || regionId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'regionId' when calling describeValues"
|
||||
)
|
||||
}
|
||||
|
||||
opts = opts || {}
|
||||
|
||||
if (opts.tagValuesVo === undefined || opts.tagValuesVo === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'opts.tagValuesVo' when calling describeValues"
|
||||
)
|
||||
}
|
||||
|
||||
let postBody = {}
|
||||
if (opts.tagValuesVo !== undefined && opts.tagValuesVo !== null) {
|
||||
postBody['tagValuesVo'] = opts.tagValuesVo
|
||||
}
|
||||
|
||||
let queryParams = {}
|
||||
|
||||
let pathParams = {
|
||||
regionId: regionId
|
||||
}
|
||||
|
||||
let headerParams = {
|
||||
'User-Agent': 'JdcloudSdkNode/1.0.0 resourcetag/0.6.0'
|
||||
}
|
||||
|
||||
let contentTypes = ['application/json']
|
||||
let accepts = ['application/json']
|
||||
|
||||
// 扩展自定义头
|
||||
if (opts['x-extra-header']) {
|
||||
for (let extraHeader in opts['x-extra-header']) {
|
||||
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
||||
contentTypes = opts['x-extra-header']['content-type']
|
||||
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
||||
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
||||
accepts = opts['x-extra-header']['accept']
|
||||
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
||||
accepts = opts['x-extra-header']['accept'].split(',')
|
||||
}
|
||||
}
|
||||
|
||||
let formParams = {}
|
||||
|
||||
let returnType = null
|
||||
|
||||
this.config.logger(
|
||||
`call describeValues with params:\npathParams:${JSON.stringify(
|
||||
pathParams
|
||||
)},\nqueryParams:${JSON.stringify(
|
||||
queryParams
|
||||
)}, \nheaderParams:${JSON.stringify(
|
||||
headerParams
|
||||
)}, \nformParams:${JSON.stringify(
|
||||
formParams
|
||||
)}, \npostBody:${JSON.stringify(postBody)}`,
|
||||
'DEBUG'
|
||||
)
|
||||
|
||||
let request = super.makeRequest(
|
||||
'/regions/{regionId}/tags:describeValues',
|
||||
'POST',
|
||||
pathParams,
|
||||
queryParams,
|
||||
headerParams,
|
||||
formParams,
|
||||
postBody,
|
||||
contentTypes,
|
||||
accepts,
|
||||
returnType,
|
||||
callback
|
||||
)
|
||||
|
||||
return request.then(
|
||||
function (result) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(null, result)
|
||||
}
|
||||
return result
|
||||
},
|
||||
function (error) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(error)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 资源标签绑定。<br/>
|
||||
注意cdn资源绑定标签时url中regionId必须指定为cn-all。
|
||||
|
||||
* @param {Object} opts - parameters
|
||||
* @param {tagResourcesReqVo} opts.tagResources - 绑定标签参数
|
||||
* @param {string} regionId - ID of the region
|
||||
* @param {string} callback - callback
|
||||
@return {Object} result
|
||||
* @param tagResourcesResVo data 资源标签绑定结果详情
|
||||
*/
|
||||
|
||||
tagResources (opts, regionId = this.config.regionId, callback) {
|
||||
if (typeof regionId === 'function') {
|
||||
callback = regionId
|
||||
regionId = this.config.regionId
|
||||
}
|
||||
|
||||
if (regionId === undefined || regionId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'regionId' when calling tagResources"
|
||||
)
|
||||
}
|
||||
|
||||
opts = opts || {}
|
||||
|
||||
if (opts.tagResources === undefined || opts.tagResources === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'opts.tagResources' when calling tagResources"
|
||||
)
|
||||
}
|
||||
|
||||
let postBody = {}
|
||||
if (opts.tagResources !== undefined && opts.tagResources !== null) {
|
||||
postBody['tagResources'] = opts.tagResources
|
||||
}
|
||||
|
||||
let queryParams = {}
|
||||
|
||||
let pathParams = {
|
||||
regionId: regionId
|
||||
}
|
||||
|
||||
let headerParams = {
|
||||
'User-Agent': 'JdcloudSdkNode/1.0.0 resourcetag/0.6.0'
|
||||
}
|
||||
|
||||
let contentTypes = ['application/json']
|
||||
let accepts = ['application/json']
|
||||
|
||||
// 扩展自定义头
|
||||
if (opts['x-extra-header']) {
|
||||
for (let extraHeader in opts['x-extra-header']) {
|
||||
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
||||
contentTypes = opts['x-extra-header']['content-type']
|
||||
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
||||
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
||||
accepts = opts['x-extra-header']['accept']
|
||||
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
||||
accepts = opts['x-extra-header']['accept'].split(',')
|
||||
}
|
||||
}
|
||||
|
||||
let formParams = {}
|
||||
|
||||
let returnType = null
|
||||
|
||||
this.config.logger(
|
||||
`call tagResources with params:\npathParams:${JSON.stringify(
|
||||
pathParams
|
||||
)},\nqueryParams:${JSON.stringify(
|
||||
queryParams
|
||||
)}, \nheaderParams:${JSON.stringify(
|
||||
headerParams
|
||||
)}, \nformParams:${JSON.stringify(
|
||||
formParams
|
||||
)}, \npostBody:${JSON.stringify(postBody)}`,
|
||||
'DEBUG'
|
||||
)
|
||||
|
||||
let request = super.makeRequest(
|
||||
'/regions/{regionId}/tags:tagResources',
|
||||
'POST',
|
||||
pathParams,
|
||||
queryParams,
|
||||
headerParams,
|
||||
formParams,
|
||||
postBody,
|
||||
contentTypes,
|
||||
accepts,
|
||||
returnType,
|
||||
callback
|
||||
)
|
||||
|
||||
return request.then(
|
||||
function (result) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(null, result)
|
||||
}
|
||||
return result
|
||||
},
|
||||
function (error) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(error)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 资源标签解绑。<br/>
|
||||
注意cdn资源解绑标签时url中regionId必须指定为cn-all。
|
||||
|
||||
* @param {Object} opts - parameters
|
||||
* @param {unTagResourcesReqVo} opts.unTagResources - 解绑标签参数
|
||||
* @param {string} regionId - ID of the region
|
||||
* @param {string} callback - callback
|
||||
@return {Object} result
|
||||
* @param unTagResourcesResVo data 资源标签解绑结果详情
|
||||
*/
|
||||
|
||||
unTagResources (opts, regionId = this.config.regionId, callback) {
|
||||
if (typeof regionId === 'function') {
|
||||
callback = regionId
|
||||
regionId = this.config.regionId
|
||||
}
|
||||
|
||||
if (regionId === undefined || regionId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'regionId' when calling unTagResources"
|
||||
)
|
||||
}
|
||||
|
||||
opts = opts || {}
|
||||
|
||||
if (opts.unTagResources === undefined || opts.unTagResources === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'opts.unTagResources' when calling unTagResources"
|
||||
)
|
||||
}
|
||||
|
||||
let postBody = {}
|
||||
if (opts.unTagResources !== undefined && opts.unTagResources !== null) {
|
||||
postBody['unTagResources'] = opts.unTagResources
|
||||
}
|
||||
|
||||
let queryParams = {}
|
||||
|
||||
let pathParams = {
|
||||
regionId: regionId
|
||||
}
|
||||
|
||||
let headerParams = {
|
||||
'User-Agent': 'JdcloudSdkNode/1.0.0 resourcetag/0.6.0'
|
||||
}
|
||||
|
||||
let contentTypes = ['application/json']
|
||||
let accepts = ['application/json']
|
||||
|
||||
// 扩展自定义头
|
||||
if (opts['x-extra-header']) {
|
||||
for (let extraHeader in opts['x-extra-header']) {
|
||||
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
||||
contentTypes = opts['x-extra-header']['content-type']
|
||||
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
||||
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
||||
accepts = opts['x-extra-header']['accept']
|
||||
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
||||
accepts = opts['x-extra-header']['accept'].split(',')
|
||||
}
|
||||
}
|
||||
|
||||
let formParams = {}
|
||||
|
||||
let returnType = null
|
||||
|
||||
this.config.logger(
|
||||
`call unTagResources with params:\npathParams:${JSON.stringify(
|
||||
pathParams
|
||||
)},\nqueryParams:${JSON.stringify(
|
||||
queryParams
|
||||
)}, \nheaderParams:${JSON.stringify(
|
||||
headerParams
|
||||
)}, \nformParams:${JSON.stringify(
|
||||
formParams
|
||||
)}, \npostBody:${JSON.stringify(postBody)}`,
|
||||
'DEBUG'
|
||||
)
|
||||
|
||||
let request = super.makeRequest(
|
||||
'/regions/{regionId}/tags:unTagResources',
|
||||
'POST',
|
||||
pathParams,
|
||||
queryParams,
|
||||
headerParams,
|
||||
formParams,
|
||||
postBody,
|
||||
contentTypes,
|
||||
accepts,
|
||||
returnType,
|
||||
callback
|
||||
)
|
||||
|
||||
return request.then(
|
||||
function (result) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(null, result)
|
||||
}
|
||||
return result
|
||||
},
|
||||
function (error) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(error)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据标签查找资源。 <br/>
|
||||
若要查找cdn产品线的资源则url中的regionId必须指定为cn-all。
|
||||
|
||||
* @param {Object} opts - parameters
|
||||
* @param {queryResourceReqVo} opts.queryResource - 查找资源id的参数对象
|
||||
* @param {string} regionId - ID of the region
|
||||
* @param {string} callback - callback
|
||||
@return {Object} result
|
||||
* @param string resourceIds
|
||||
*/
|
||||
|
||||
queryResource (opts, regionId = this.config.regionId, callback) {
|
||||
if (typeof regionId === 'function') {
|
||||
callback = regionId
|
||||
regionId = this.config.regionId
|
||||
}
|
||||
|
||||
if (regionId === undefined || regionId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'regionId' when calling queryResource"
|
||||
)
|
||||
}
|
||||
|
||||
opts = opts || {}
|
||||
|
||||
if (opts.queryResource === undefined || opts.queryResource === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'opts.queryResource' when calling queryResource"
|
||||
)
|
||||
}
|
||||
|
||||
let postBody = {}
|
||||
if (opts.queryResource !== undefined && opts.queryResource !== null) {
|
||||
postBody['queryResource'] = opts.queryResource
|
||||
}
|
||||
|
||||
let queryParams = {}
|
||||
|
||||
let pathParams = {
|
||||
regionId: regionId
|
||||
}
|
||||
|
||||
let headerParams = {
|
||||
'User-Agent': 'JdcloudSdkNode/1.0.0 resourcetag/0.6.0'
|
||||
}
|
||||
|
||||
let contentTypes = ['application/json']
|
||||
let accepts = ['application/json']
|
||||
|
||||
// 扩展自定义头
|
||||
if (opts['x-extra-header']) {
|
||||
for (let extraHeader in opts['x-extra-header']) {
|
||||
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
||||
contentTypes = opts['x-extra-header']['content-type']
|
||||
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
||||
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
||||
accepts = opts['x-extra-header']['accept']
|
||||
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
||||
accepts = opts['x-extra-header']['accept'].split(',')
|
||||
}
|
||||
}
|
||||
|
||||
let formParams = {}
|
||||
|
||||
let returnType = null
|
||||
|
||||
this.config.logger(
|
||||
`call queryResource with params:\npathParams:${JSON.stringify(
|
||||
pathParams
|
||||
)},\nqueryParams:${JSON.stringify(
|
||||
queryParams
|
||||
)}, \nheaderParams:${JSON.stringify(
|
||||
headerParams
|
||||
)}, \nformParams:${JSON.stringify(
|
||||
formParams
|
||||
)}, \npostBody:${JSON.stringify(postBody)}`,
|
||||
'DEBUG'
|
||||
)
|
||||
|
||||
let request = super.makeRequest(
|
||||
'/regions/{regionId}/queryResource',
|
||||
'POST',
|
||||
pathParams,
|
||||
queryParams,
|
||||
headerParams,
|
||||
formParams,
|
||||
postBody,
|
||||
contentTypes,
|
||||
accepts,
|
||||
returnType,
|
||||
callback
|
||||
)
|
||||
|
||||
return request.then(
|
||||
function (result) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(null, result)
|
||||
}
|
||||
return result
|
||||
},
|
||||
function (error) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(error)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
module.exports = RESOURCETAG
|
||||
@@ -0,0 +1,677 @@
|
||||
/*
|
||||
* Copyright 2018 JDCLOUD.COM
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http:#www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* 短信内容接口
|
||||
* API related to Template
|
||||
*
|
||||
* OpenAPI spec version: v1
|
||||
* Contact:
|
||||
*
|
||||
* NOTE: This class is auto generated by the jdcloud code generator program.
|
||||
*/
|
||||
|
||||
require('../../../lib/node_loader')
|
||||
var JDCloud = require('../../../lib/core')
|
||||
var Service = JDCloud.Service
|
||||
var serviceId = 'rms'
|
||||
Service._services[serviceId] = true
|
||||
|
||||
/**
|
||||
* rms service.
|
||||
* @version 1.0.0
|
||||
*/
|
||||
|
||||
JDCloud.RMS = class RMS extends Service {
|
||||
constructor (options = {}) {
|
||||
options._defaultEndpoint = {}
|
||||
options._defaultEndpoint.protocol =
|
||||
options._defaultEndpoint.protocol || 'https'
|
||||
options._defaultEndpoint.host =
|
||||
options._defaultEndpoint.host || 'rms.jdcloud-api.com'
|
||||
options.basePath = '/v1' // 默认要设为空""
|
||||
super(serviceId, options)
|
||||
}
|
||||
|
||||
/**
|
||||
* 指定短信Id群发短信
|
||||
* @param {Object} opts - parameters
|
||||
* @param {sendBatchMsgSpec} opts.sendBatchMsgSpec - 指定短信Id群发短信请求参数
|
||||
* @param {string} regionId - ID of the region
|
||||
* @param {string} callback - callback
|
||||
@return {Object} result
|
||||
* @param sendBatchMsg data 指定短信Id群发短信响应参数
|
||||
*/
|
||||
|
||||
sendBatchMsg (opts, regionId = this.config.regionId, callback) {
|
||||
if (typeof regionId === 'function') {
|
||||
callback = regionId
|
||||
regionId = this.config.regionId
|
||||
}
|
||||
|
||||
if (regionId === undefined || regionId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'regionId' when calling sendBatchMsg"
|
||||
)
|
||||
}
|
||||
|
||||
opts = opts || {}
|
||||
|
||||
if (opts.sendBatchMsgSpec === undefined || opts.sendBatchMsgSpec === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'opts.sendBatchMsgSpec' when calling sendBatchMsg"
|
||||
)
|
||||
}
|
||||
|
||||
let postBody = {}
|
||||
if (opts.sendBatchMsgSpec !== undefined && opts.sendBatchMsgSpec !== null) {
|
||||
postBody['sendBatchMsgSpec'] = opts.sendBatchMsgSpec
|
||||
}
|
||||
|
||||
let queryParams = {}
|
||||
|
||||
let pathParams = {
|
||||
regionId: regionId
|
||||
}
|
||||
|
||||
let headerParams = {
|
||||
'User-Agent': 'JdcloudSdkNode/1.0.0 rms/1.0.0'
|
||||
}
|
||||
|
||||
let contentTypes = ['application/json']
|
||||
let accepts = ['application/json']
|
||||
|
||||
// 扩展自定义头
|
||||
if (opts['x-extra-header']) {
|
||||
for (let extraHeader in opts['x-extra-header']) {
|
||||
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
||||
contentTypes = opts['x-extra-header']['content-type']
|
||||
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
||||
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
||||
accepts = opts['x-extra-header']['accept']
|
||||
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
||||
accepts = opts['x-extra-header']['accept'].split(',')
|
||||
}
|
||||
}
|
||||
|
||||
let formParams = {}
|
||||
|
||||
let returnType = null
|
||||
|
||||
this.config.logger(
|
||||
`call sendBatchMsg with params:\npathParams:${JSON.stringify(
|
||||
pathParams
|
||||
)},\nqueryParams:${JSON.stringify(
|
||||
queryParams
|
||||
)}, \nheaderParams:${JSON.stringify(
|
||||
headerParams
|
||||
)}, \nformParams:${JSON.stringify(
|
||||
formParams
|
||||
)}, \npostBody:${JSON.stringify(postBody)}`,
|
||||
'DEBUG'
|
||||
)
|
||||
|
||||
let request = this.makeRequest(
|
||||
'/regions/{regionId}/sendBatchMsg',
|
||||
'POST',
|
||||
pathParams,
|
||||
queryParams,
|
||||
headerParams,
|
||||
formParams,
|
||||
postBody,
|
||||
contentTypes,
|
||||
accepts,
|
||||
returnType,
|
||||
callback
|
||||
)
|
||||
|
||||
return request.then(
|
||||
function (result) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(null, result)
|
||||
}
|
||||
return result
|
||||
},
|
||||
function (error) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(error)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取发送状态
|
||||
* @param {Object} opts - parameters
|
||||
* @param {querySendStatusSpec} opts.querySendStatusSpec - 获取发送状态请求参数
|
||||
* @param {string} regionId - ID of the region
|
||||
* @param {string} callback - callback
|
||||
@return {Object} result
|
||||
* @param querySendStatus data
|
||||
*/
|
||||
|
||||
querySendStatus (opts, regionId = this.config.regionId, callback) {
|
||||
if (typeof regionId === 'function') {
|
||||
callback = regionId
|
||||
regionId = this.config.regionId
|
||||
}
|
||||
|
||||
if (regionId === undefined || regionId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'regionId' when calling querySendStatus"
|
||||
)
|
||||
}
|
||||
|
||||
opts = opts || {}
|
||||
|
||||
if (
|
||||
opts.querySendStatusSpec === undefined ||
|
||||
opts.querySendStatusSpec === null
|
||||
) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'opts.querySendStatusSpec' when calling querySendStatus"
|
||||
)
|
||||
}
|
||||
|
||||
let postBody = {}
|
||||
if (
|
||||
opts.querySendStatusSpec !== undefined &&
|
||||
opts.querySendStatusSpec !== null
|
||||
) {
|
||||
postBody['querySendStatusSpec'] = opts.querySendStatusSpec
|
||||
}
|
||||
|
||||
let queryParams = {}
|
||||
|
||||
let pathParams = {
|
||||
regionId: regionId
|
||||
}
|
||||
|
||||
let headerParams = {
|
||||
'User-Agent': 'JdcloudSdkNode/1.0.0 rms/1.0.0'
|
||||
}
|
||||
|
||||
let contentTypes = ['application/json']
|
||||
let accepts = ['application/json']
|
||||
|
||||
// 扩展自定义头
|
||||
if (opts['x-extra-header']) {
|
||||
for (let extraHeader in opts['x-extra-header']) {
|
||||
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
||||
contentTypes = opts['x-extra-header']['content-type']
|
||||
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
||||
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
||||
accepts = opts['x-extra-header']['accept']
|
||||
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
||||
accepts = opts['x-extra-header']['accept'].split(',')
|
||||
}
|
||||
}
|
||||
|
||||
let formParams = {}
|
||||
|
||||
let returnType = null
|
||||
|
||||
this.config.logger(
|
||||
`call querySendStatus with params:\npathParams:${JSON.stringify(
|
||||
pathParams
|
||||
)},\nqueryParams:${JSON.stringify(
|
||||
queryParams
|
||||
)}, \nheaderParams:${JSON.stringify(
|
||||
headerParams
|
||||
)}, \nformParams:${JSON.stringify(
|
||||
formParams
|
||||
)}, \npostBody:${JSON.stringify(postBody)}`,
|
||||
'DEBUG'
|
||||
)
|
||||
|
||||
let request = this.makeRequest(
|
||||
'/regions/{regionId}/querySendStatus',
|
||||
'POST',
|
||||
pathParams,
|
||||
queryParams,
|
||||
headerParams,
|
||||
formParams,
|
||||
postBody,
|
||||
contentTypes,
|
||||
accepts,
|
||||
returnType,
|
||||
callback
|
||||
)
|
||||
|
||||
return request.then(
|
||||
function (result) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(null, result)
|
||||
}
|
||||
return result
|
||||
},
|
||||
function (error) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(error)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 增加富媒体短信内容接口
|
||||
* @param {Object} opts - parameters
|
||||
* @param {string} [opts.appId] - appId参数 optional
|
||||
* @param {string} [opts.signType] - signType参数 optional
|
||||
* @param {string} [opts.purpose] - purpose参数 optional
|
||||
* @param {string} [opts.signCardType] - signCardType参数 optional
|
||||
* @param {string} [opts.aptitudes] - aptitudes参数 optional
|
||||
* @param {string} [opts.title] - title参数 optional
|
||||
* @param {string} [opts.description] - description参数 optional
|
||||
* @param {string} [opts.isTuiding] - isTuiding参数 optional
|
||||
* @param {array} [opts.content] - content参数 optional
|
||||
* @param {string} regionId - ID of the region
|
||||
* @param {string} callback - callback
|
||||
@return {Object} result
|
||||
* @param respAddTemplateData data
|
||||
* @param string message message参数
|
||||
* @param string status status参数
|
||||
*/
|
||||
|
||||
addTemplate (opts, regionId = this.config.regionId, callback) {
|
||||
if (typeof regionId === 'function') {
|
||||
callback = regionId
|
||||
regionId = this.config.regionId
|
||||
}
|
||||
|
||||
if (regionId === undefined || regionId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'regionId' when calling addTemplate"
|
||||
)
|
||||
}
|
||||
|
||||
opts = opts || {}
|
||||
|
||||
let postBody = {}
|
||||
if (opts.appId !== undefined && opts.appId !== null) {
|
||||
postBody['appId'] = opts.appId
|
||||
}
|
||||
if (opts.signType !== undefined && opts.signType !== null) {
|
||||
postBody['signType'] = opts.signType
|
||||
}
|
||||
if (opts.purpose !== undefined && opts.purpose !== null) {
|
||||
postBody['purpose'] = opts.purpose
|
||||
}
|
||||
if (opts.signCardType !== undefined && opts.signCardType !== null) {
|
||||
postBody['signCardType'] = opts.signCardType
|
||||
}
|
||||
if (opts.aptitudes !== undefined && opts.aptitudes !== null) {
|
||||
postBody['aptitudes'] = opts.aptitudes
|
||||
}
|
||||
if (opts.title !== undefined && opts.title !== null) {
|
||||
postBody['title'] = opts.title
|
||||
}
|
||||
if (opts.description !== undefined && opts.description !== null) {
|
||||
postBody['description'] = opts.description
|
||||
}
|
||||
if (opts.isTuiding !== undefined && opts.isTuiding !== null) {
|
||||
postBody['isTuiding'] = opts.isTuiding
|
||||
}
|
||||
if (opts.content !== undefined && opts.content !== null) {
|
||||
postBody['content'] = opts.content
|
||||
}
|
||||
|
||||
let queryParams = {}
|
||||
|
||||
let pathParams = {
|
||||
regionId: regionId
|
||||
}
|
||||
|
||||
let headerParams = {
|
||||
'User-Agent': 'JdcloudSdkNode/1.0.0 rms/1.0.0'
|
||||
}
|
||||
|
||||
let contentTypes = ['application/json']
|
||||
let accepts = ['application/json']
|
||||
|
||||
// 扩展自定义头
|
||||
if (opts['x-extra-header']) {
|
||||
for (let extraHeader in opts['x-extra-header']) {
|
||||
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
||||
contentTypes = opts['x-extra-header']['content-type']
|
||||
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
||||
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
||||
accepts = opts['x-extra-header']['accept']
|
||||
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
||||
accepts = opts['x-extra-header']['accept'].split(',')
|
||||
}
|
||||
}
|
||||
|
||||
let formParams = {}
|
||||
|
||||
let returnType = null
|
||||
|
||||
this.config.logger(
|
||||
`call addTemplate with params:\npathParams:${JSON.stringify(
|
||||
pathParams
|
||||
)},\nqueryParams:${JSON.stringify(
|
||||
queryParams
|
||||
)}, \nheaderParams:${JSON.stringify(
|
||||
headerParams
|
||||
)}, \nformParams:${JSON.stringify(
|
||||
formParams
|
||||
)}, \npostBody:${JSON.stringify(postBody)}`,
|
||||
'DEBUG'
|
||||
)
|
||||
|
||||
let request = this.makeRequest(
|
||||
'/regions/{regionId}/addTemplate',
|
||||
'POST',
|
||||
pathParams,
|
||||
queryParams,
|
||||
headerParams,
|
||||
formParams,
|
||||
postBody,
|
||||
contentTypes,
|
||||
accepts,
|
||||
returnType,
|
||||
callback
|
||||
)
|
||||
|
||||
return request.then(
|
||||
function (result) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(null, result)
|
||||
}
|
||||
return result
|
||||
},
|
||||
function (error) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(error)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询一个富媒体短信内容接口
|
||||
* @param {Object} opts - parameters
|
||||
* @param {string} [opts.templateId] - templateId参数 optional
|
||||
* @param {string} regionId - ID of the region
|
||||
* @param {string} callback - callback
|
||||
@return {Object} result
|
||||
* @param respQueryOneTemplateResourceList data
|
||||
* @param string description description参数
|
||||
* @param string mediaLength mediaLength参数
|
||||
* @param string type type参数
|
||||
* @param string title title参数
|
||||
* @param string isTuiding isTuiding参数
|
||||
* @param string message message参数
|
||||
* @param string status status参数
|
||||
*/
|
||||
|
||||
queryOneTemplate (opts, regionId = this.config.regionId, callback) {
|
||||
if (typeof regionId === 'function') {
|
||||
callback = regionId
|
||||
regionId = this.config.regionId
|
||||
}
|
||||
|
||||
if (regionId === undefined || regionId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'regionId' when calling queryOneTemplate"
|
||||
)
|
||||
}
|
||||
|
||||
opts = opts || {}
|
||||
|
||||
let postBody = {}
|
||||
if (opts.templateId !== undefined && opts.templateId !== null) {
|
||||
postBody['templateId'] = opts.templateId
|
||||
}
|
||||
|
||||
let queryParams = {}
|
||||
|
||||
let pathParams = {
|
||||
regionId: regionId
|
||||
}
|
||||
|
||||
let headerParams = {
|
||||
'User-Agent': 'JdcloudSdkNode/1.0.0 rms/1.0.0'
|
||||
}
|
||||
|
||||
let contentTypes = ['application/json']
|
||||
let accepts = ['application/json']
|
||||
|
||||
// 扩展自定义头
|
||||
if (opts['x-extra-header']) {
|
||||
for (let extraHeader in opts['x-extra-header']) {
|
||||
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
||||
contentTypes = opts['x-extra-header']['content-type']
|
||||
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
||||
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
||||
accepts = opts['x-extra-header']['accept']
|
||||
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
||||
accepts = opts['x-extra-header']['accept'].split(',')
|
||||
}
|
||||
}
|
||||
|
||||
let formParams = {}
|
||||
|
||||
let returnType = null
|
||||
|
||||
this.config.logger(
|
||||
`call queryOneTemplate with params:\npathParams:${JSON.stringify(
|
||||
pathParams
|
||||
)},\nqueryParams:${JSON.stringify(
|
||||
queryParams
|
||||
)}, \nheaderParams:${JSON.stringify(
|
||||
headerParams
|
||||
)}, \nformParams:${JSON.stringify(
|
||||
formParams
|
||||
)}, \npostBody:${JSON.stringify(postBody)}`,
|
||||
'DEBUG'
|
||||
)
|
||||
|
||||
let request = this.makeRequest(
|
||||
'/regions/{regionId}/queryOneTemplate',
|
||||
'POST',
|
||||
pathParams,
|
||||
queryParams,
|
||||
headerParams,
|
||||
formParams,
|
||||
postBody,
|
||||
contentTypes,
|
||||
accepts,
|
||||
returnType,
|
||||
callback
|
||||
)
|
||||
|
||||
return request.then(
|
||||
function (result) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(null, result)
|
||||
}
|
||||
return result
|
||||
},
|
||||
function (error) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(error)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询富媒体短信内容列表接口
|
||||
* @param {Object} opts - parameters
|
||||
* @param {string} [opts.appId] - appId参数 optional
|
||||
* @param {string} [opts.searchKey] - searchKey参数 optional
|
||||
* @param {string} [opts.pageNum] - pageNum参数 optional
|
||||
* @param {string} [opts.pageLimit] - pageLimit参数 optional
|
||||
* @param {string} [opts.status] - status参数 optional
|
||||
* @param {string} [opts.title] - title参数 optional
|
||||
* @param {string} [opts.startTime] - startTime参数 optional
|
||||
* @param {string} [opts.endTime] - endTime参数 optional
|
||||
* @param {string} regionId - ID of the region
|
||||
* @param {string} callback - callback
|
||||
@return {Object} result
|
||||
* @param respQueryTemplateListData data
|
||||
* @param string message message参数
|
||||
* @param string totalElements totalElements参数
|
||||
* @param string status status参数
|
||||
*/
|
||||
|
||||
queryTemplateList (opts, regionId = this.config.regionId, callback) {
|
||||
if (typeof regionId === 'function') {
|
||||
callback = regionId
|
||||
regionId = this.config.regionId
|
||||
}
|
||||
|
||||
if (regionId === undefined || regionId === null) {
|
||||
throw new Error(
|
||||
"Missing the required parameter 'regionId' when calling queryTemplateList"
|
||||
)
|
||||
}
|
||||
|
||||
opts = opts || {}
|
||||
|
||||
let postBody = {}
|
||||
if (opts.appId !== undefined && opts.appId !== null) {
|
||||
postBody['appId'] = opts.appId
|
||||
}
|
||||
if (opts.searchKey !== undefined && opts.searchKey !== null) {
|
||||
postBody['searchKey'] = opts.searchKey
|
||||
}
|
||||
if (opts.pageNum !== undefined && opts.pageNum !== null) {
|
||||
postBody['pageNum'] = opts.pageNum
|
||||
}
|
||||
if (opts.pageLimit !== undefined && opts.pageLimit !== null) {
|
||||
postBody['pageLimit'] = opts.pageLimit
|
||||
}
|
||||
if (opts.status !== undefined && opts.status !== null) {
|
||||
postBody['status'] = opts.status
|
||||
}
|
||||
if (opts.title !== undefined && opts.title !== null) {
|
||||
postBody['title'] = opts.title
|
||||
}
|
||||
if (opts.startTime !== undefined && opts.startTime !== null) {
|
||||
postBody['startTime'] = opts.startTime
|
||||
}
|
||||
if (opts.endTime !== undefined && opts.endTime !== null) {
|
||||
postBody['endTime'] = opts.endTime
|
||||
}
|
||||
|
||||
let queryParams = {}
|
||||
|
||||
let pathParams = {
|
||||
regionId: regionId
|
||||
}
|
||||
|
||||
let headerParams = {
|
||||
'User-Agent': 'JdcloudSdkNode/1.0.0 rms/1.0.0'
|
||||
}
|
||||
|
||||
let contentTypes = ['application/json']
|
||||
let accepts = ['application/json']
|
||||
|
||||
// 扩展自定义头
|
||||
if (opts['x-extra-header']) {
|
||||
for (let extraHeader in opts['x-extra-header']) {
|
||||
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
||||
contentTypes = opts['x-extra-header']['content-type']
|
||||
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
||||
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
||||
}
|
||||
|
||||
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
||||
accepts = opts['x-extra-header']['accept']
|
||||
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
||||
accepts = opts['x-extra-header']['accept'].split(',')
|
||||
}
|
||||
}
|
||||
|
||||
let formParams = {}
|
||||
|
||||
let returnType = null
|
||||
|
||||
this.config.logger(
|
||||
`call queryTemplateList with params:\npathParams:${JSON.stringify(
|
||||
pathParams
|
||||
)},\nqueryParams:${JSON.stringify(
|
||||
queryParams
|
||||
)}, \nheaderParams:${JSON.stringify(
|
||||
headerParams
|
||||
)}, \nformParams:${JSON.stringify(
|
||||
formParams
|
||||
)}, \npostBody:${JSON.stringify(postBody)}`,
|
||||
'DEBUG'
|
||||
)
|
||||
|
||||
let request = this.makeRequest(
|
||||
'/regions/{regionId}/queryTemplateList',
|
||||
'POST',
|
||||
pathParams,
|
||||
queryParams,
|
||||
headerParams,
|
||||
formParams,
|
||||
postBody,
|
||||
contentTypes,
|
||||
accepts,
|
||||
returnType,
|
||||
callback
|
||||
)
|
||||
|
||||
return request.then(
|
||||
function (result) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(null, result)
|
||||
}
|
||||
return result
|
||||
},
|
||||
function (error) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
return callback(error)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
module.exports = JDCloud.RMS
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user