perf: 支持京东云dns申请证书

This commit is contained in:
xiaojunnuo
2025-04-02 23:13:55 +08:00
parent 8145808c43
commit 04d79f9117
280 changed files with 421914 additions and 51 deletions
@@ -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