mirror of
https://github.com/certd/certd.git
synced 2026-05-18 06:17:31 +08:00
perf: 支持京东云dns申请证书
This commit is contained in:
@@ -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
|
||||
Reference in New Issue
Block a user