Files
certd/packages/libs/lib-jdcloud/src/repo/cps/v1/cps.js
T
2025-04-02 23:13:55 +08:00

11517 lines
332 KiB
JavaScript

/*
* 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.
*
* Cloud-Physical-Server
* 云物理服务器私有网络操作相关的接口
*
* 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 = 'cps'
Service._services[serviceId] = true
/**
* cps service.
* @version 2.4.3
*/
class CPS extends Service {
constructor (options = {}) {
options._defaultEndpoint = {}
options._defaultEndpoint.protocol =
options._defaultEndpoint.protocol || 'https'
options._defaultEndpoint.host =
options._defaultEndpoint.host || 'cps.jdcloud-api.com'
options.basePath = '/v1' // 默认要设为空""
super(serviceId, options)
}
/**
* 查询别名IP列表
* @param {Object} opts - parameters
* @param {integer} [opts.pageNumber] - 页码;默认为1 optional
* @param {integer} [opts.pageSize] - 分页大小;默认为20;取值范围[20, 100] optional
* @param {string} [opts.subnetId] - 子网ID optional
* @param {string} [opts.instanceId] - 实例ID optional
* @param {string} [opts.cidr] - CIDR段,模糊搜索 optional
* @param {filter} [opts.filters] - aliasIpId - 别名IP id<br/>
optional
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param aliasIp aliasIps
* @param integer pageNumber 页码;默认为1
* @param integer pageSize 分页大小;默认为20;取值范围[20, 100]
* @param integer totalCount 查询结果总数
*/
describeAliasIps (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 describeAliasIps"
)
}
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
}
if (opts.subnetId !== undefined && opts.subnetId !== null) {
queryParams['subnetId'] = opts.subnetId
}
if (opts.instanceId !== undefined && opts.instanceId !== null) {
queryParams['instanceId'] = opts.instanceId
}
if (opts.cidr !== undefined && opts.cidr !== null) {
queryParams['cidr'] = opts.cidr
}
Object.assign(queryParams, super.buildFilterParam(opts.filters, 'filters'))
let pathParams = {
regionId: regionId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cps/2.4.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 describeAliasIps 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}/aliasIps',
'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)
}
)
}
/**
* 添加别名IP
* @param {Object} opts - parameters
* @param {string} [opts.clientToken] - 由客户端生成,用于保证请求的幂等性,长度不能超过36个字符;<br/>
如果多个请求使用了相同的clientToken,只会执行第一个请求,之后的请求直接返回第一个请求的结果<br/>
optional
* @param {aliasIpSpec} opts.aliasIpSpec - 别名IP配置
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param aliasIpSuccessInfo successList
* @param aliasIpErrorInfo errorList
*/
createAliasIp (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 createAliasIp"
)
}
opts = opts || {}
if (opts.aliasIpSpec === undefined || opts.aliasIpSpec === null) {
throw new Error(
"Missing the required parameter 'opts.aliasIpSpec' when calling createAliasIp"
)
}
let postBody = {}
if (opts.clientToken !== undefined && opts.clientToken !== null) {
postBody['clientToken'] = opts.clientToken
}
if (opts.aliasIpSpec !== undefined && opts.aliasIpSpec !== null) {
postBody['aliasIpSpec'] = opts.aliasIpSpec
}
let queryParams = {}
let pathParams = {
regionId: regionId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cps/2.4.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 createAliasIp 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}/aliasIps',
'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)
}
)
}
/**
* 删除别名IP
* @param {Object} opts - parameters
* @param {string} opts.aliasIpId - 别名IP ID
* @param {string} [opts.clientToken] - 由客户端生成,用于保证请求的幂等性,长度不能超过36个字符;<br/>
如果多个请求使用了相同的clientToken,只会执行第一个请求,之后的请求直接返回第一个请求的结果<br/>
optional
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param boolean success 删除操作是否成功
*/
deleteAliasIp (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 deleteAliasIp"
)
}
opts = opts || {}
if (opts.aliasIpId === undefined || opts.aliasIpId === null) {
throw new Error(
"Missing the required parameter 'opts.aliasIpId' when calling deleteAliasIp"
)
}
let postBody = null
let queryParams = {}
if (opts.clientToken !== undefined && opts.clientToken !== null) {
queryParams['clientToken'] = opts.clientToken
}
let pathParams = {
regionId: regionId,
aliasIpId: opts.aliasIpId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cps/2.4.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 deleteAliasIp 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}/aliasIps/{aliasIpId}',
'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/>
支持分页查询,默认每页20条<br/>
* @param {Object} opts - parameters
* @param {integer} [opts.pageNumber] - 页码;默认为1 optional
* @param {integer} [opts.pageSize] - 分页大小;默认为20;取值范围[20, 100] optional
* @param {string} [opts.name] - 证书名称 optional
* @param {filter} [opts.filters] - certId - 证书ID,精确匹配,支持多个<br/>
optional
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param cert certs
* @param integer pageNumber 页码;默认为1
* @param integer pageSize 分页大小;默认为20;取值范围[20, 100]
* @param integer totalCount 查询结果总数
*/
describeCerts (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 describeCerts"
)
}
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
}
if (opts.name !== undefined && opts.name !== null) {
queryParams['name'] = opts.name
}
Object.assign(queryParams, super.buildFilterParam(opts.filters, 'filters'))
let pathParams = {
regionId: regionId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cps/2.4.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 describeCerts 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}/certs',
'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.clientToken] - 由客户端生成,用于保证请求的幂等性,长度不能超过36个字符;<br/>
如果多个请求使用了相同的clientToken,只会执行第一个请求,之后的请求直接返回第一个请求的结果<br/>
optional
* @param {certSpec} opts.certSpec - 弹性公网IP配置
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param string certId 证书ID
*/
createCert (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 createCert"
)
}
opts = opts || {}
if (opts.certSpec === undefined || opts.certSpec === null) {
throw new Error(
"Missing the required parameter 'opts.certSpec' when calling createCert"
)
}
let postBody = {}
if (opts.clientToken !== undefined && opts.clientToken !== null) {
postBody['clientToken'] = opts.clientToken
}
if (opts.certSpec !== undefined && opts.certSpec !== null) {
postBody['certSpec'] = opts.certSpec
}
let queryParams = {}
let pathParams = {
regionId: regionId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cps/2.4.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 createCert 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}/certs',
'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.certId - 证书ID
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param cert cert 证书详细信息
*/
describeCert (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 describeCert"
)
}
opts = opts || {}
if (opts.certId === undefined || opts.certId === null) {
throw new Error(
"Missing the required parameter 'opts.certId' when calling describeCert"
)
}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId,
certId: opts.certId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cps/2.4.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 describeCert 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}/certs/{certId}',
'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.certId - 证书ID
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param boolean success 删除操作是否成功
*/
removeCert (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 removeCert"
)
}
opts = opts || {}
if (opts.certId === undefined || opts.certId === null) {
throw new Error(
"Missing the required parameter 'opts.certId' when calling removeCert"
)
}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId,
certId: opts.certId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cps/2.4.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 removeCert 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}/certs/{certId}',
'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 {string} opts.certId - 证书ID
* @param {string} [opts.name] - 证书名称 optional
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param string certId 证书ID
* @param string name 证书名称
* @param string certificate 证书内容
* @param string createTime 创建时间
* @param integer listenerCount 证书关联监听器数量
*/
modifyCert (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 modifyCert"
)
}
opts = opts || {}
if (opts.certId === undefined || opts.certId === null) {
throw new Error(
"Missing the required parameter 'opts.certId' when calling modifyCert"
)
}
let postBody = {}
if (opts.name !== undefined && opts.name !== null) {
postBody['name'] = opts.name
}
let queryParams = {}
let pathParams = {
regionId: regionId,
certId: opts.certId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cps/2.4.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 modifyCert 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}/certs/{certId}:modifyCert',
'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)
}
)
}
/**
* 查询弹性公网IP列表<br/>
支持分页查询,默认每页20条<br/>
* @param {Object} opts - parameters
* @param {integer} [opts.pageNumber] - 页码;默认为1 optional
* @param {integer} [opts.pageSize] - 分页大小;默认为20;取值范围[20, 100] optional
* @param {string} [opts.status] - 弹性公网IP状态,取值范围:associate、disassociate optional
* @param {string} [opts.includeLB] - 是否包含负载均衡 optional
* @param {string} [opts.chargeMode] - 支付模式,取值为:prepaid_by_duration表示预付费,postpaid_by_duration表示按配置后付费 optional
* @param {string} [opts.instanceId] - 实例Id optional
* @param {string} [opts.subnetId] - 子网Id optional
* @param {filter} [opts.filters] - elasticIpId - 弹性公网IPID,精确匹配,支持多个<br/>
elasticIp - 弹性公网IP,精确匹配,支持多个
optional
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param elasticIp elasticIps
* @param integer pageNumber 页码;默认为1
* @param integer pageSize 分页大小;默认为20;取值范围[20, 100]
* @param integer totalCount 查询结果总数
*/
describeElasticIps (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 describeElasticIps"
)
}
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
}
if (opts.status !== undefined && opts.status !== null) {
queryParams['status'] = opts.status
}
if (opts.includeLB !== undefined && opts.includeLB !== null) {
queryParams['includeLB'] = opts.includeLB
}
if (opts.chargeMode !== undefined && opts.chargeMode !== null) {
queryParams['chargeMode'] = opts.chargeMode
}
if (opts.instanceId !== undefined && opts.instanceId !== null) {
queryParams['instanceId'] = opts.instanceId
}
if (opts.subnetId !== undefined && opts.subnetId !== null) {
queryParams['subnetId'] = opts.subnetId
}
Object.assign(queryParams, super.buildFilterParam(opts.filters, 'filters'))
let pathParams = {
regionId: regionId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cps/2.4.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 describeElasticIps 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}/elasticIps',
'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)
}
)
}
/**
* 申请弹性公网IP
* @param {Object} opts - parameters
* @param {string} [opts.clientToken] - 由客户端生成,用于保证请求的幂等性,长度不能超过36个字符;<br/>
如果多个请求使用了相同的clientToken,只会执行第一个请求,之后的请求直接返回第一个请求的结果<br/>
optional
* @param {elasticIpSpec} opts.elasticIpSpec - 弹性公网IP配置
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param string elasticIpIds
*/
applyElasticIps (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 applyElasticIps"
)
}
opts = opts || {}
if (opts.elasticIpSpec === undefined || opts.elasticIpSpec === null) {
throw new Error(
"Missing the required parameter 'opts.elasticIpSpec' when calling applyElasticIps"
)
}
let postBody = {}
if (opts.clientToken !== undefined && opts.clientToken !== null) {
postBody['clientToken'] = opts.clientToken
}
if (opts.elasticIpSpec !== undefined && opts.elasticIpSpec !== null) {
postBody['elasticIpSpec'] = opts.elasticIpSpec
}
let queryParams = {}
let pathParams = {
regionId: regionId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cps/2.4.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 applyElasticIps 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}/elasticIps',
'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)
}
)
}
/**
* 查询弹性公网IP详情
* @param {Object} opts - parameters
* @param {string} opts.elasticIpId - 弹性公网IPID
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param elasticIp elasticIp 弹性公网IP详细信息
*/
describeElasticIp (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 describeElasticIp"
)
}
opts = opts || {}
if (opts.elasticIpId === undefined || opts.elasticIpId === null) {
throw new Error(
"Missing the required parameter 'opts.elasticIpId' when calling describeElasticIp"
)
}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId,
elasticIpId: opts.elasticIpId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cps/2.4.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 describeElasticIp 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}/elasticIps/{elasticIpId}',
'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)
}
)
}
/**
* 修改弹性公网IP带宽
* @param {Object} opts - parameters
* @param {string} opts.elasticIpId - 弹性公网IPID
* @param {string} [opts.clientToken] - 由客户端生成,用于保证请求的幂等性,长度不能超过36个字符;<br/>
如果多个请求使用了相同的clientToken,只会执行第一个请求,之后的请求直接返回第一个请求的结果<br/>
optional
* @param {integer} opts.bandwidth - 带宽,单位Mbps,取值范围[1,200]
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param boolean success 修改带宽是否成功
*/
modifyElasticIpBandwidth (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 modifyElasticIpBandwidth"
)
}
opts = opts || {}
if (opts.elasticIpId === undefined || opts.elasticIpId === null) {
throw new Error(
"Missing the required parameter 'opts.elasticIpId' when calling modifyElasticIpBandwidth"
)
}
if (opts.bandwidth === undefined || opts.bandwidth === null) {
throw new Error(
"Missing the required parameter 'opts.bandwidth' when calling modifyElasticIpBandwidth"
)
}
let postBody = {}
if (opts.clientToken !== undefined && opts.clientToken !== null) {
postBody['clientToken'] = opts.clientToken
}
if (opts.bandwidth !== undefined && opts.bandwidth !== null) {
postBody['bandwidth'] = opts.bandwidth
}
let queryParams = {}
let pathParams = {
regionId: regionId,
elasticIpId: opts.elasticIpId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cps/2.4.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 modifyElasticIpBandwidth 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}/elasticIps/{elasticIpId}:modifyElasticIpBandwidth',
'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)
}
)
}
/**
* 查询EIP名称
* @param {Object} opts - parameters
* @param {string} opts.elasticIpId - 弹性公网IPID
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param string name EIP名称
*/
describeElasticIpName (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 describeElasticIpName"
)
}
opts = opts || {}
if (opts.elasticIpId === undefined || opts.elasticIpId === null) {
throw new Error(
"Missing the required parameter 'opts.elasticIpId' when calling describeElasticIpName"
)
}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId,
elasticIpId: opts.elasticIpId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cps/2.4.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 describeElasticIpName 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}/elasticIp/{elasticIpId}:describeElasticIpName',
'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.az] - 可用区,精确匹配 optional
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param deviceType deviceTypes
*/
describeDeviceTypes (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 describeDeviceTypes"
)
}
opts = opts || {}
let postBody = null
let queryParams = {}
if (opts.az !== undefined && opts.az !== null) {
queryParams['az'] = opts.az
}
let pathParams = {
regionId: regionId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cps/2.4.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 describeDeviceTypes 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}/deviceTypes',
'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.deviceType - 实例类型,可调用接口(describeDeviceTypes)获取指定地域的实例类型,例如:cps.c.normal
* @param {string} [opts.osType] - 操作系统类型,取值范围:CentOS、Ubuntu、Windows optional
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param os oss
*/
describeOS (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 describeOS"
)
}
opts = opts || {}
if (opts.deviceType === undefined || opts.deviceType === null) {
throw new Error(
"Missing the required parameter 'opts.deviceType' when calling describeOS"
)
}
let postBody = null
let queryParams = {}
if (opts.deviceType !== undefined && opts.deviceType !== null) {
queryParams['deviceType'] = opts.deviceType
}
if (opts.osType !== undefined && opts.osType !== null) {
queryParams['osType'] = opts.osType
}
let pathParams = {
regionId: regionId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cps/2.4.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 describeOS 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}/os',
'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)
}
)
}
/**
* 查询某种实例类型的云物理服务器支持的RAID类型,可查询系统盘RAID类型和数据盘RAID类型
* @param {Object} opts - parameters
* @param {string} opts.deviceType - 实例类型,可调用(describeDeviceTypes)接口获取指定地域的实例类型,例如:cps.c.normal
* @param {string} [opts.volumeType] - 磁盘类型,取值范围:system、data optional
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param raid raids
*/
describeDeviceRaids (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 describeDeviceRaids"
)
}
opts = opts || {}
if (opts.deviceType === undefined || opts.deviceType === null) {
throw new Error(
"Missing the required parameter 'opts.deviceType' when calling describeDeviceRaids"
)
}
let postBody = null
let queryParams = {}
if (opts.deviceType !== undefined && opts.deviceType !== null) {
queryParams['deviceType'] = opts.deviceType
}
if (opts.volumeType !== undefined && opts.volumeType !== null) {
queryParams['volumeType'] = opts.volumeType
}
let pathParams = {
regionId: regionId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cps/2.4.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 describeDeviceRaids 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}/raids',
'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.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 = null
let queryParams = {}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cps/2.4.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 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)
}
)
}
/**
* 批量查询云物理服务器详细信息<br/>
支持分页查询,默认每页20条<br/>
* @param {Object} opts - parameters
* @param {integer} [opts.pageNumber] - 页码;默认为1 optional
* @param {integer} [opts.pageSize] - 分页大小;默认为20;取值范围[20, 100] optional
* @param {string} [opts.az] - 可用区,精确匹配 optional
* @param {string} [opts.name] - 云物理服务器名称,支持模糊匹配 optional
* @param {string} [opts.networkType] - 网络类型,精确匹配,支持basic(基础网络)、vpc(私有网络)、retail(零售中台网络) optional
* @param {string} [opts.deviceType] - 实例类型,精确匹配,调用接口(describeDeviceTypes)获取实例类型 optional
* @param {string} [opts.subnetId] - 子网ID optional
* @param {string} [opts.keypairId] - 密钥对ID optional
* @param {string} [opts.enableInternet] - 是否启用外网, yes、no optional
* @param {string} [opts.privateIp] - 内网ip optional
* @param {string} [opts.interfaceMode] - 实例网卡类型:bond(网卡bond)、dual(双网卡) optional
* @param {filter} [opts.filters] - instanceId - 云物理服务器ID,精确匹配,支持多个<br/>
status - 云物理服务器状态,参考云物理服务器状态,精确匹配,支持多个
optional
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param instance instances
* @param integer pageNumber 页码;默认为1
* @param integer pageSize 分页大小;默认为20;取值范围[20, 100]
* @param integer totalCount 查询结果总数
*/
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
}
if (opts.az !== undefined && opts.az !== null) {
queryParams['az'] = opts.az
}
if (opts.name !== undefined && opts.name !== null) {
queryParams['name'] = opts.name
}
if (opts.networkType !== undefined && opts.networkType !== null) {
queryParams['networkType'] = opts.networkType
}
if (opts.deviceType !== undefined && opts.deviceType !== null) {
queryParams['deviceType'] = opts.deviceType
}
if (opts.subnetId !== undefined && opts.subnetId !== null) {
queryParams['subnetId'] = opts.subnetId
}
if (opts.keypairId !== undefined && opts.keypairId !== null) {
queryParams['keypairId'] = opts.keypairId
}
if (opts.enableInternet !== undefined && opts.enableInternet !== null) {
queryParams['enableInternet'] = opts.enableInternet
}
if (opts.privateIp !== undefined && opts.privateIp !== null) {
queryParams['privateIp'] = opts.privateIp
}
if (opts.interfaceMode !== undefined && opts.interfaceMode !== null) {
queryParams['interfaceMode'] = opts.interfaceMode
}
Object.assign(queryParams, super.buildFilterParam(opts.filters, 'filters'))
let pathParams = {
regionId: regionId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cps/2.4.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 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)
}
)
}
/**
* 创建一台或多台指定配置的云物理服务器<br/>
- 地域与可用区<br/>
- 调用接口(describeRegiones)获取云物理服务器支持的地域与可用区<br/>
- 实例类型<br/>
- 调用接口(describeDeviceTypes)获取物理实例类型列表<br/>
- 不能使用已下线、或已售馨的实例类型<br/>
- 操作系统<br/>
- 可调用接口(describeOS)获取云物理服务器支持的操作系统列表<br/>
- 存储<br/>
- 数据盘多种RAID可选,可调用接口(describeDeviceRaids)获取服务器支持的RAID列表<br/>
- 网络<br/>
- 网络类型目前支持basic、vpc<br/>
- 线路目前只支持bgp<br/>
- 支持不启用外网,如果启用外网,带宽范围[1,200] 单位Mbps<br/>
- 其他<br/>
- 购买时长,可按年或月购买:月取值范围[1,9], 年取值范围[1,3]<br/>
- 密码设置参考公共参数规范<br/>
* @param {Object} opts - parameters
* @param {string} [opts.clientToken] - 由客户端生成,用于保证请求的幂等性,长度不能超过36个字符;<br/>
如果多个请求使用了相同的clientToken,只会执行第一个请求,之后的请求直接返回第一个请求的结果<br/>
optional
* @param {instanceSpec} opts.instanceSpec - 描述云物理服务器配置
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param string instanceIds
*/
createInstances (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 createInstances"
)
}
opts = opts || {}
if (opts.instanceSpec === undefined || opts.instanceSpec === null) {
throw new Error(
"Missing the required parameter 'opts.instanceSpec' when calling createInstances"
)
}
let postBody = {}
if (opts.clientToken !== undefined && opts.clientToken !== null) {
postBody['clientToken'] = opts.clientToken
}
if (opts.instanceSpec !== undefined && opts.instanceSpec !== null) {
postBody['instanceSpec'] = opts.instanceSpec
}
let queryParams = {}
let pathParams = {
regionId: regionId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cps/2.4.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 createInstances 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',
'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.instanceId - 云物理服务器ID
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param string name 云物理服务器名称
*/
describeInstanceName (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 describeInstanceName"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling describeInstanceName"
)
}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cps/2.4.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 describeInstanceName 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}:describeInstanceName',
'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)
}
)
}
/**
* 申请IPv6地址
* @param {Object} opts - parameters
* @param {string} opts.instanceId - 云物理服务器ID
* @param {string} [opts.clientToken] - 由客户端生成,用于保证请求的幂等性,长度不能超过36个字符;<br/>
如果多个请求使用了相同的clientToken,只会执行第一个请求,之后的请求直接返回第一个请求的结果<br/>
optional
* @param {string} [opts.ipv6Address] - IPv6地址 optional
* @param {string} opts.subnetId - 子网ID
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param string ipv6Address IPv6地址
*/
assignIpv6Address (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 assignIpv6Address"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling assignIpv6Address"
)
}
if (opts.subnetId === undefined || opts.subnetId === null) {
throw new Error(
"Missing the required parameter 'opts.subnetId' when calling assignIpv6Address"
)
}
let postBody = {}
if (opts.clientToken !== undefined && opts.clientToken !== null) {
postBody['clientToken'] = opts.clientToken
}
if (opts.ipv6Address !== undefined && opts.ipv6Address !== null) {
postBody['ipv6Address'] = opts.ipv6Address
}
if (opts.subnetId !== undefined && opts.subnetId !== null) {
postBody['subnetId'] = opts.subnetId
}
let queryParams = {}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cps/2.4.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 assignIpv6Address 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}:assignIpv6Address',
'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 {string} [opts.name] - 云物理服务器名称 optional
* @param {string} [opts.description] - 云物理服务器描述 optional
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param string name 云物理服务器名称
* @param string description 云物理服务器描述
*/
modifyInstance (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 modifyInstance"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling modifyInstance"
)
}
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,
instanceId: opts.instanceId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cps/2.4.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 modifyInstance 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}:modifyInstance',
'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)
}
)
}
/**
* 查询单个云物理服务器已安装的RAID信息,包括系统盘RAID信息和数据盘RAID信息
* @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 sysRaidTypeId 系统盘RAID类型ID
* @param string sysRaidType 系统盘RAID类型
* @param string dataRaidTypeId 数据盘RAID类型ID
* @param string dataRaidType 数据盘RAID类型
*/
describeInstanceRaid (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 describeInstanceRaid"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling describeInstanceRaid"
)
}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cps/2.4.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 describeInstanceRaid 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}:describeInstanceRaid',
'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.instanceId - 云物理服务器ID
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param boolean cpus CPU状态是否正常
* @param boolean mems 内存状态是否正常
* @param boolean disks 硬盘状态是否正常
* @param boolean nics 网卡状态是否正常
*/
describeInstanceStatus (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 describeInstanceStatus"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling describeInstanceStatus"
)
}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cps/2.4.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 describeInstanceStatus 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}:describeInstanceStatus',
'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)
}
)
}
/**
* 重启单台云物理服务器,只能重启running状态的服务器 [MFA enabled]
* @param {Object} opts - parameters
* @param {string} opts.instanceId - 云物理服务器ID
* @param {string} [opts.clientToken] - 由客户端生成,用于保证请求的幂等性,长度不能超过36个字符;<br/>
如果多个请求使用了相同的clientToken,只会执行第一个请求,之后的请求直接返回第一个请求的结果<br/>
optional
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param boolean success 重启操作是否成功
*/
restartInstance (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 restartInstance"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling restartInstance"
)
}
let postBody = {}
if (opts.clientToken !== undefined && opts.clientToken !== null) {
postBody['clientToken'] = opts.clientToken
}
let queryParams = {}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cps/2.4.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 restartInstance 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}:restartInstance',
'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)
}
)
}
/**
* 对单台云物理服务器执行关机操作,只能停止running状态的服务器 [MFA enabled]
* @param {Object} opts - parameters
* @param {string} opts.instanceId - 云物理服务器ID
* @param {string} [opts.clientToken] - 由客户端生成,用于保证请求的幂等性,长度不能超过36个字符;<br/>
如果多个请求使用了相同的clientToken,只会执行第一个请求,之后的请求直接返回第一个请求的结果<br/>
optional
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param boolean success 关机操作是否成功
*/
stopInstance (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 stopInstance"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling stopInstance"
)
}
let postBody = {}
if (opts.clientToken !== undefined && opts.clientToken !== null) {
postBody['clientToken'] = opts.clientToken
}
let queryParams = {}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cps/2.4.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 stopInstance 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}:stopInstance',
'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)
}
)
}
/**
* 对单台云物理服务器执行开机操作,只能启动stopped状态的服务器
* @param {Object} opts - parameters
* @param {string} opts.instanceId - 云物理服务器ID
* @param {string} [opts.clientToken] - 由客户端生成,用于保证请求的幂等性,长度不能超过36个字符;<br/>
如果多个请求使用了相同的clientToken,只会执行第一个请求,之后的请求直接返回第一个请求的结果<br/>
optional
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param boolean success 开机操作是否成功
*/
startInstance (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 startInstance"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling startInstance"
)
}
let postBody = {}
if (opts.clientToken !== undefined && opts.clientToken !== null) {
postBody['clientToken'] = opts.clientToken
}
let queryParams = {}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cps/2.4.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 startInstance 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}:startInstance',
'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)
}
)
}
/**
* 批量重启云物理服务器,只能重启running状态的服务器 [MFA enabled]
* @param {Object} opts - parameters
* @param {string} [opts.clientToken] - 由客户端生成,用于保证请求的幂等性,长度不能超过36个字符;<br/>
如果多个请求使用了相同的clientToken,只会执行第一个请求,之后的请求直接返回第一个请求的结果<br/>
optional
* @param {array} [opts.instanceIds] - 资源id列表 optional
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param boolean success 重启操作是否成功
*/
restartInstances (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 restartInstances"
)
}
opts = opts || {}
let postBody = {}
if (opts.clientToken !== undefined && opts.clientToken !== null) {
postBody['clientToken'] = opts.clientToken
}
if (opts.instanceIds !== undefined && opts.instanceIds !== null) {
postBody['instanceIds'] = opts.instanceIds
}
let queryParams = {}
let pathParams = {
regionId: regionId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cps/2.4.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 restartInstances 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:restartInstances',
'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)
}
)
}
/**
* 批量关闭云物理服务器,只能停止running状态的服务器 [MFA enabled]
* @param {Object} opts - parameters
* @param {string} [opts.clientToken] - 由客户端生成,用于保证请求的幂等性,长度不能超过36个字符;<br/>
如果多个请求使用了相同的clientToken,只会执行第一个请求,之后的请求直接返回第一个请求的结果<br/>
optional
* @param {array} [opts.instanceIds] - 资源id列表 optional
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param boolean success 关机操作是否成功
*/
stopInstances (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 stopInstances"
)
}
opts = opts || {}
let postBody = {}
if (opts.clientToken !== undefined && opts.clientToken !== null) {
postBody['clientToken'] = opts.clientToken
}
if (opts.instanceIds !== undefined && opts.instanceIds !== null) {
postBody['instanceIds'] = opts.instanceIds
}
let queryParams = {}
let pathParams = {
regionId: regionId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cps/2.4.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 stopInstances 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:stopInstances',
'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)
}
)
}
/**
* 批量开启云物理服务器,只能启动stopped状态的服务器
* @param {Object} opts - parameters
* @param {string} [opts.clientToken] - 由客户端生成,用于保证请求的幂等性,长度不能超过36个字符;<br/>
如果多个请求使用了相同的clientToken,只会执行第一个请求,之后的请求直接返回第一个请求的结果<br/>
optional
* @param {array} [opts.instanceIds] - 资源id列表 optional
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param boolean success 开机操作是否成功
*/
startInstances (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 startInstances"
)
}
opts = opts || {}
let postBody = {}
if (opts.clientToken !== undefined && opts.clientToken !== null) {
postBody['clientToken'] = opts.clientToken
}
if (opts.instanceIds !== undefined && opts.instanceIds !== null) {
postBody['instanceIds'] = opts.instanceIds
}
let queryParams = {}
let pathParams = {
regionId: regionId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cps/2.4.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 startInstances 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:startInstances',
'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)
}
)
}
/**
* 重装云物理服务器,只能重装stopped状态的服务器<br/>
- 可调用接口(describeOS)获取云物理服务器支持的操作系统列表
[MFA enabled]
* @param {Object} opts - parameters
* @param {string} opts.instanceId - 云物理服务器ID
* @param {string} [opts.clientToken] - 由客户端生成,用于保证请求的幂等性,长度不能超过36个字符;<br/>
如果多个请求使用了相同的clientToken,只会执行第一个请求,之后的请求直接返回第一个请求的结果<br/>
optional
* @param {reinstallInstanceSpec} opts.instanceSpec - 云物理服务器配置
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param boolean success 重装操作是否成功
*/
reinstallInstance (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 reinstallInstance"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling reinstallInstance"
)
}
if (opts.instanceSpec === undefined || opts.instanceSpec === null) {
throw new Error(
"Missing the required parameter 'opts.instanceSpec' when calling reinstallInstance"
)
}
let postBody = {}
if (opts.clientToken !== undefined && opts.clientToken !== null) {
postBody['clientToken'] = opts.clientToken
}
if (opts.instanceSpec !== undefined && opts.instanceSpec !== null) {
postBody['instanceSpec'] = opts.instanceSpec
}
let queryParams = {}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cps/2.4.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 reinstallInstance 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}:reinstallInstance',
'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)
}
)
}
/**
* 升级云物理服务器外网带宽,只能操作running或者stopped状态的服务器<br/>
- 不支持未启用外网的服务器升级带宽
- 外网带宽不支持降级
* @param {Object} opts - parameters
* @param {string} opts.instanceId - 云物理服务器ID
* @param {string} [opts.clientToken] - 由客户端生成,用于保证请求的幂等性,长度不能超过36个字符;<br/>
如果多个请求使用了相同的clientToken,只会执行第一个请求,之后的请求直接返回第一个请求的结果<br/>
optional
* @param {integer} opts.bandwidth - 外网带宽,单位Mbps,取值范围[1,200]
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param boolean success 升级带宽是否成功
*/
modifyBandwidth (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 modifyBandwidth"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling modifyBandwidth"
)
}
if (opts.bandwidth === undefined || opts.bandwidth === null) {
throw new Error(
"Missing the required parameter 'opts.bandwidth' when calling modifyBandwidth"
)
}
let postBody = {}
if (opts.clientToken !== undefined && opts.clientToken !== null) {
postBody['clientToken'] = opts.clientToken
}
if (opts.bandwidth !== undefined && opts.bandwidth !== null) {
postBody['bandwidth'] = opts.bandwidth
}
let queryParams = {}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cps/2.4.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 modifyBandwidth 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}:modifyBandwidth',
'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)
}
)
}
/**
* 绑定弹性公网IP
* @param {Object} opts - parameters
* @param {string} opts.instanceId - 云物理服务器ID
* @param {string} [opts.clientToken] - 由客户端生成,用于保证请求的幂等性,长度不能超过36个字符;<br/>
如果多个请求使用了相同的clientToken,只会执行第一个请求,之后的请求直接返回第一个请求的结果<br/>
optional
* @param {string} opts.elasticIpId - 弹性公网IPID
* @param {string} [opts.targetIp] - 私有IP optional
* @param {string} [opts.subnetId] - 主网口或辅网口的子网ID,多网口实例必填 optional
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param boolean success 绑定结果
*/
associateElasticIp (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 associateElasticIp"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling associateElasticIp"
)
}
if (opts.elasticIpId === undefined || opts.elasticIpId === null) {
throw new Error(
"Missing the required parameter 'opts.elasticIpId' when calling associateElasticIp"
)
}
let postBody = {}
if (opts.clientToken !== undefined && opts.clientToken !== null) {
postBody['clientToken'] = opts.clientToken
}
if (opts.elasticIpId !== undefined && opts.elasticIpId !== null) {
postBody['elasticIpId'] = opts.elasticIpId
}
if (opts.targetIp !== undefined && opts.targetIp !== null) {
postBody['targetIp'] = opts.targetIp
}
if (opts.subnetId !== undefined && opts.subnetId !== null) {
postBody['subnetId'] = opts.subnetId
}
let queryParams = {}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cps/2.4.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 associateElasticIp 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}:associateElasticIp',
'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)
}
)
}
/**
* 解绑弹性公网IP
* @param {Object} opts - parameters
* @param {string} opts.instanceId - 云物理服务器ID
* @param {string} [opts.clientToken] - 由客户端生成,用于保证请求的幂等性,长度不能超过36个字符;<br/>
如果多个请求使用了相同的clientToken,只会执行第一个请求,之后的请求直接返回第一个请求的结果<br/>
optional
* @param {string} opts.elasticIpId - 弹性公网IPId
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param boolean success 解绑结果
*/
disassociateElasticIp (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 disassociateElasticIp"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling disassociateElasticIp"
)
}
if (opts.elasticIpId === undefined || opts.elasticIpId === null) {
throw new Error(
"Missing the required parameter 'opts.elasticIpId' when calling disassociateElasticIp"
)
}
let postBody = {}
if (opts.clientToken !== undefined && opts.clientToken !== null) {
postBody['clientToken'] = opts.clientToken
}
if (opts.elasticIpId !== undefined && opts.elasticIpId !== null) {
postBody['elasticIpId'] = opts.elasticIpId
}
let queryParams = {}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cps/2.4.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 disassociateElasticIp 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}:disassociateElasticIp',
'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.instanceId - 云物理服务器ID
* @param {string} [opts.clientToken] - 由客户端生成,用于保证请求的幂等性,长度不能超过36个字符;<br/>
如果多个请求使用了相同的clientToken,只会执行第一个请求,之后的请求直接返回第一个请求的结果<br/>
optional
* @param {string} opts.password - 密码
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param boolean success 重置结果
*/
resetPassword (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 resetPassword"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling resetPassword"
)
}
if (opts.password === undefined || opts.password === null) {
throw new Error(
"Missing the required parameter 'opts.password' when calling resetPassword"
)
}
let postBody = {}
if (opts.clientToken !== undefined && opts.clientToken !== null) {
postBody['clientToken'] = opts.clientToken
}
if (opts.password !== undefined && opts.password !== null) {
postBody['password'] = opts.password
}
let queryParams = {}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cps/2.4.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 resetPassword 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}:resetPassword',
'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)
}
)
}
/**
* 查询可用的私有IP列表
* @param {Object} opts - parameters
* @param {string} opts.instanceId - 云物理服务器ID
* @param {string} opts.subnetId - 主网口或者辅网口的子网id
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param string availablePrivateIps
*/
describeAvailablePrivateIp (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 describeAvailablePrivateIp"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling describeAvailablePrivateIp"
)
}
if (opts.subnetId === undefined || opts.subnetId === null) {
throw new Error(
"Missing the required parameter 'opts.subnetId' when calling describeAvailablePrivateIp"
)
}
let postBody = null
let queryParams = {}
if (opts.subnetId !== undefined && opts.subnetId !== null) {
queryParams['subnetId'] = opts.subnetId
}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cps/2.4.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 describeAvailablePrivateIp 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}/availablePrivateIps',
'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.instanceId - 云物理服务器ID
* @param {integer} [opts.startTime] - 开始时间的时间戳,格式:1562915166551 optional
* @param {integer} [opts.endTime] - 结束时间的时间戳,格式:1562915166551 optional
* @param {filter} [opts.filters] - metric - 监控指标,精确匹配,支持多个,具体如下<br/>
cps.cpu.util - CPU使用率<br/>
cps.memory.util - 内存使用率<br/>
cps.memory.used - 内存使用量<br/>
cps.disk.used - 磁盘使用量<br/>
cps.disk.util - 磁盘使用率<br/>
cps.disk.bytes.read - 磁盘读流量<br/>
cps.disk.bytes.write - 磁盘写流量<br/>
cps.disk.counts.read - 磁盘读IOPS<br/>
cps.disk.counts.write - 磁盘写IOPS<br/>
cps.network.bytes.ingress - 网卡进流量<br/>
cps.network.bytes.egress - 网卡出流量<br/>
cps.network.packets.ingress - 网络进包量<br/>
cps.network.packets.egress - 网络出包量<br/>
cps.avg.load1 - CPU平均负载1min<br/>
cps.avg.load5 - CPU平均负载5min<br/>
cps.avg.load15 - CPU平均负载15min<br/>
cps.tcp.connect.total - TCP总连接数<br/>
cps.tcp.connect.established - TCP正常连接数<br/>
cps.process.total - 总进程数
optional
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param metricData metricDatas
*/
describeInstanceMonitorInfo (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 describeInstanceMonitorInfo"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling describeInstanceMonitorInfo"
)
}
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
}
Object.assign(queryParams, super.buildFilterParam(opts.filters, 'filters'))
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cps/2.4.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 describeInstanceMonitorInfo 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}/monitor',
'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.instanceId - 云物理服务器ID
* @param {integer} [opts.pageNumber] - 页码;默认为1 optional
* @param {integer} [opts.pageSize] - 分页大小;默认为20;取值范围[20, 100] optional
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param eventLog eventLogs
* @param integer pageNumber 页码;默认为1
* @param integer pageSize 分页大小;默认为20;取值范围[20, 100]
* @param integer totalCount 查询结果总数
*/
describeEventLogs (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 describeEventLogs"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling describeEventLogs"
)
}
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,
instanceId: opts.instanceId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cps/2.4.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 describeEventLogs 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}/describeEventLogs',
'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)
}
)
}
/**
* 查询IPv6地址例详情
* @param {Object} opts - parameters
* @param {string} opts.ipv6AddressId - IPv6地址ID
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param ipv6Address ipv6Address IPv6地址详细信息
*/
describeIpv6Address (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 describeIpv6Address"
)
}
opts = opts || {}
if (opts.ipv6AddressId === undefined || opts.ipv6AddressId === null) {
throw new Error(
"Missing the required parameter 'opts.ipv6AddressId' when calling describeIpv6Address"
)
}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId,
ipv6AddressId: opts.ipv6AddressId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cps/2.4.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 describeIpv6Address 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}/ipv6Addresses/{ipv6AddressId}',
'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)
}
)
}
/**
* 查询IPv6地址列表<br/>
支持分页查询,默认每页20条<br/>
* @param {Object} opts - parameters
* @param {integer} [opts.pageNumber] - 页码;默认为1 optional
* @param {integer} [opts.pageSize] - 分页大小;默认为20;取值范围[20, 100] optional
* @param {string} [opts.ipv6GatewayId] - IPv6网关ID optional
* @param {string} [opts.ipv6Address] - IPv6地址 optional
* @param {boolean} [opts.enableInternet] - 是否已开通公网 optional
* @param {filter} [opts.filters] - ipv6AddressId - IPv6地址ID,精确匹配,支持多个
optional
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param ipv6Address ipv6Addresses
* @param integer pageNumber 页码;默认为1
* @param integer pageSize 分页大小;默认为20;取值范围[20, 100]
* @param integer totalCount 查询结果总数
*/
describeIpv6Addresses (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 describeIpv6Addresses"
)
}
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
}
if (opts.ipv6GatewayId !== undefined && opts.ipv6GatewayId !== null) {
queryParams['ipv6GatewayId'] = opts.ipv6GatewayId
}
if (opts.ipv6Address !== undefined && opts.ipv6Address !== null) {
queryParams['ipv6Address'] = opts.ipv6Address
}
if (opts.enableInternet !== undefined && opts.enableInternet !== null) {
queryParams['enableInternet'] = opts.enableInternet
}
Object.assign(queryParams, super.buildFilterParam(opts.filters, 'filters'))
let pathParams = {
regionId: regionId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cps/2.4.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 describeIpv6Addresses 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}/ipv6Addresses',
'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)
}
)
}
/**
* 申请IPv6地址带宽
* @param {Object} opts - parameters
* @param {string} [opts.clientToken] - 由客户端生成,用于保证请求的幂等性,长度不能超过36个字符;<br/>
如果多个请求使用了相同的clientToken,只会执行第一个请求,之后的请求直接返回第一个请求的结果<br/>
optional
* @param {ipv6AddressSpec} opts.ipv6AddressSpec - IPv6地址配置
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param string ipv6AddressIds
*/
assignIpv6AddressesBandwidth (
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 assignIpv6AddressesBandwidth"
)
}
opts = opts || {}
if (opts.ipv6AddressSpec === undefined || opts.ipv6AddressSpec === null) {
throw new Error(
"Missing the required parameter 'opts.ipv6AddressSpec' when calling assignIpv6AddressesBandwidth"
)
}
let postBody = {}
if (opts.clientToken !== undefined && opts.clientToken !== null) {
postBody['clientToken'] = opts.clientToken
}
if (opts.ipv6AddressSpec !== undefined && opts.ipv6AddressSpec !== null) {
postBody['ipv6AddressSpec'] = opts.ipv6AddressSpec
}
let queryParams = {}
let pathParams = {
regionId: regionId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cps/2.4.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 assignIpv6AddressesBandwidth 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}/ipv6Addresses',
'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)
}
)
}
/**
* 修改IPv6公网带宽
* @param {Object} opts - parameters
* @param {string} opts.ipv6AddressId - IPv6地址ID
* @param {string} [opts.clientToken] - 由客户端生成,用于保证请求的幂等性,长度不能超过36个字符;<br/>
如果多个请求使用了相同的clientToken,只会执行第一个请求,之后的请求直接返回第一个请求的结果<br/>
optional
* @param {integer} opts.bandwidth - 带宽,单位Mbps,取值范围[1,200]
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param boolean success 修改带宽是否成功
*/
modifyIpv6AddressBandwidth (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 modifyIpv6AddressBandwidth"
)
}
opts = opts || {}
if (opts.ipv6AddressId === undefined || opts.ipv6AddressId === null) {
throw new Error(
"Missing the required parameter 'opts.ipv6AddressId' when calling modifyIpv6AddressBandwidth"
)
}
if (opts.bandwidth === undefined || opts.bandwidth === null) {
throw new Error(
"Missing the required parameter 'opts.bandwidth' when calling modifyIpv6AddressBandwidth"
)
}
let postBody = {}
if (opts.clientToken !== undefined && opts.clientToken !== null) {
postBody['clientToken'] = opts.clientToken
}
if (opts.bandwidth !== undefined && opts.bandwidth !== null) {
postBody['bandwidth'] = opts.bandwidth
}
let queryParams = {}
let pathParams = {
regionId: regionId,
ipv6AddressId: opts.ipv6AddressId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cps/2.4.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 modifyIpv6AddressBandwidth 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}/ipv6Addresses/{ipv6AddressId}:modifyIpv6AddressBandwidth',
'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)
}
)
}
/**
* 查询IPv6网关实例列表
* @param {Object} opts - parameters
* @param {integer} [opts.pageNumber] - 页码;默认为1 optional
* @param {integer} [opts.pageSize] - 分页大小;默认为20;取值范围[20, 100] optional
* @param {string} [opts.ipv6GatewayName] - IPv6网关名称 optional
* @param {filter} [opts.filters] - ipv6GatewayId - IPv6网关实例ID,精确匹配,支持多个
optional
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param ipv6Gateway ipv6Gateways
* @param integer pageNumber 页码;默认为1
* @param integer pageSize 分页大小;默认为20;取值范围[20, 100]
* @param integer totalCount 查询结果总数
*/
describeIpv6Gateways (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 describeIpv6Gateways"
)
}
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
}
if (opts.ipv6GatewayName !== undefined && opts.ipv6GatewayName !== null) {
queryParams['ipv6GatewayName'] = opts.ipv6GatewayName
}
Object.assign(queryParams, super.buildFilterParam(opts.filters, 'filters'))
let pathParams = {
regionId: regionId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cps/2.4.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 describeIpv6Gateways 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}/ipv6Gateways',
'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)
}
)
}
/**
* 查询IPv6网关实例详情
* @param {Object} opts - parameters
* @param {string} opts.ipv6GatewayId - IPv6网关ID
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param ipv6Gateway ipv6Gateway IPv6网关实例详细信息
*/
describeIpv6Gateway (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 describeIpv6Gateway"
)
}
opts = opts || {}
if (opts.ipv6GatewayId === undefined || opts.ipv6GatewayId === null) {
throw new Error(
"Missing the required parameter 'opts.ipv6GatewayId' when calling describeIpv6Gateway"
)
}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId,
ipv6GatewayId: opts.ipv6GatewayId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cps/2.4.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 describeIpv6Gateway 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}/ipv6Gateways/{ipv6GatewayId}',
'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)
}
)
}
/**
* 修改IPv6网关实例
* @param {Object} opts - parameters
* @param {string} opts.ipv6GatewayId - IPv6网关ID
* @param {string} [opts.clientToken] - 由客户端生成,用于保证请求的幂等性,长度不能超过36个字符;<br/>
如果多个请求使用了相同的clientToken,只会执行第一个请求,之后的请求直接返回第一个请求的结果<br/>
optional
* @param {string} [opts.ipv6GatewayName] - IPv6网关实例名称 optional
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param ipv6Gateway ipv6Gateway IPv6网关实例详细信息
*/
modifyIpv6Gateway (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 modifyIpv6Gateway"
)
}
opts = opts || {}
if (opts.ipv6GatewayId === undefined || opts.ipv6GatewayId === null) {
throw new Error(
"Missing the required parameter 'opts.ipv6GatewayId' when calling modifyIpv6Gateway"
)
}
let postBody = {}
if (opts.clientToken !== undefined && opts.clientToken !== null) {
postBody['clientToken'] = opts.clientToken
}
if (opts.ipv6GatewayName !== undefined && opts.ipv6GatewayName !== null) {
postBody['ipv6GatewayName'] = opts.ipv6GatewayName
}
let queryParams = {}
let pathParams = {
regionId: regionId,
ipv6GatewayId: opts.ipv6GatewayId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cps/2.4.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 modifyIpv6Gateway 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}/ipv6Gateways/{ipv6GatewayId}',
'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 optional
* @param {integer} [opts.pageSize] - 分页大小;默认为20;取值范围[20, 100] optional
* @param {string} [opts.name] - 密钥对名称 optional
* @param {filter} [opts.filters] - keypairId - 密钥对ID,精确匹配,支持多个
optional
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param keypair keypairs
* @param integer pageNumber 页码;默认为1
* @param integer pageSize 分页大小;默认为20;取值范围[20, 100]
* @param integer totalCount 查询结果总数
*/
describeKeypairs (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 describeKeypairs"
)
}
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
}
if (opts.name !== undefined && opts.name !== null) {
queryParams['name'] = opts.name
}
Object.assign(queryParams, super.buildFilterParam(opts.filters, 'filters'))
let pathParams = {
regionId: regionId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cps/2.4.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 describeKeypairs 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}/keypairs',
'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.clientToken] - 由客户端生成,用于保证请求的幂等性,长度不能超过36个字符;<br/>
如果多个请求使用了相同的clientToken,只会执行第一个请求,之后的请求直接返回第一个请求的结果<br/>
optional
* @param {string} opts.name - 密钥对名称
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param string keypairId 密钥对id
* @param string region 地域
* @param string name 密钥对名称
* @param string publicKey 公钥
* @param string fingerPrint 指纹
* @param string createTime 创建时间
* @param string updateTime 更新时间
* @param string privateKey 私钥
*/
createKeypairs (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 createKeypairs"
)
}
opts = opts || {}
if (opts.name === undefined || opts.name === null) {
throw new Error(
"Missing the required parameter 'opts.name' when calling createKeypairs"
)
}
let postBody = {}
if (opts.clientToken !== undefined && opts.clientToken !== null) {
postBody['clientToken'] = opts.clientToken
}
if (opts.name !== undefined && opts.name !== null) {
postBody['name'] = opts.name
}
let queryParams = {}
let pathParams = {
regionId: regionId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cps/2.4.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 createKeypairs 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}/keypairs',
'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.clientToken] - 由客户端生成,用于保证请求的幂等性,长度不能超过36个字符;<br/>
如果多个请求使用了相同的clientToken,只会执行第一个请求,之后的请求直接返回第一个请求的结果<br/>
optional
* @param {string} opts.name - 密钥对名称
* @param {string} opts.publicKey - 公钥
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param string keypairId 密钥对id
* @param string region 地域
* @param string name 密钥对名称
* @param string publicKey 公钥
* @param string fingerPrint 指纹
* @param string createTime 创建时间
* @param string updateTime 更新时间
*/
importKeypairs (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 importKeypairs"
)
}
opts = opts || {}
if (opts.name === undefined || opts.name === null) {
throw new Error(
"Missing the required parameter 'opts.name' when calling importKeypairs"
)
}
if (opts.publicKey === undefined || opts.publicKey === null) {
throw new Error(
"Missing the required parameter 'opts.publicKey' when calling importKeypairs"
)
}
let postBody = {}
if (opts.clientToken !== undefined && opts.clientToken !== null) {
postBody['clientToken'] = opts.clientToken
}
if (opts.name !== undefined && opts.name !== null) {
postBody['name'] = opts.name
}
if (opts.publicKey !== undefined && opts.publicKey !== null) {
postBody['publicKey'] = opts.publicKey
}
let queryParams = {}
let pathParams = {
regionId: regionId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cps/2.4.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 importKeypairs 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}/keypairs:import',
'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.keypairId - 密钥对ID
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param keypair keypair 密钥对详细信息
*/
describeKeypair (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 describeKeypair"
)
}
opts = opts || {}
if (opts.keypairId === undefined || opts.keypairId === null) {
throw new Error(
"Missing the required parameter 'opts.keypairId' when calling describeKeypair"
)
}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId,
keypairId: opts.keypairId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cps/2.4.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 describeKeypair 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}/keypairs/{keypairId}',
'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.keypairId - 密钥对ID
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param boolean success 删除操作是否成功
*/
deleteKeypairs (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 deleteKeypairs"
)
}
opts = opts || {}
if (opts.keypairId === undefined || opts.keypairId === null) {
throw new Error(
"Missing the required parameter 'opts.keypairId' when calling deleteKeypairs"
)
}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId,
keypairId: opts.keypairId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cps/2.4.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 deleteKeypairs 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}/keypairs/{keypairId}',
'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 {integer} [opts.pageNumber] - 页码;默认为1 optional
* @param {integer} [opts.pageSize] - 分页大小;默认为20;取值范围[20, 100] optional
* @param {string} [opts.name] - 名称 optional
* @param {string} [opts.loadBalancerId] - 负载均衡实例ID,精确匹配 optional
* @param {filter} [opts.filters] - listenerId - 监听器ID,精确匹配,支持多个
optional
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param listener listeners
* @param integer pageNumber 页码;默认为1
* @param integer pageSize 分页大小;默认为20;取值范围[20, 100]
* @param integer totalCount 查询结果总数
*/
describeListeners (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 describeListeners"
)
}
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
}
if (opts.name !== undefined && opts.name !== null) {
queryParams['name'] = opts.name
}
if (opts.loadBalancerId !== undefined && opts.loadBalancerId !== null) {
queryParams['loadBalancerId'] = opts.loadBalancerId
}
Object.assign(queryParams, super.buildFilterParam(opts.filters, 'filters'))
let pathParams = {
regionId: regionId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cps/2.4.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 describeListeners 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}/listeners',
'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.clientToken] - 由客户端生成,用于保证请求的幂等性,长度不能超过36个字符;<br/>
如果多个请求使用了相同的clientToken,只会执行第一个请求,之后的请求直接返回第一个请求的结果<br/>
optional
* @param {listenerSpec} opts.listenerSpec - 监听器配置
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param string listenerId 监听器ID
*/
createListener (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 createListener"
)
}
opts = opts || {}
if (opts.listenerSpec === undefined || opts.listenerSpec === null) {
throw new Error(
"Missing the required parameter 'opts.listenerSpec' when calling createListener"
)
}
let postBody = {}
if (opts.clientToken !== undefined && opts.clientToken !== null) {
postBody['clientToken'] = opts.clientToken
}
if (opts.listenerSpec !== undefined && opts.listenerSpec !== null) {
postBody['listenerSpec'] = opts.listenerSpec
}
let queryParams = {}
let pathParams = {
regionId: regionId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cps/2.4.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 createListener 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}/listeners',
'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.listenerId - 监听器ID
* @param {string} [opts.algorithm] - 调度算法 optional
* @param {string} [opts.stickySession] - 会话保持 optional
* @param {string} [opts.realIp] - 是否获取真实ip,取值范围on|off optional
* @param {string} [opts.name] - 名称 optional
* @param {string} [opts.description] - 描述 optional
* @param {string} [opts.healthCheck] - 健康检查 optional
* @param {integer} [opts.healthCheckTimeout] - 健康检查响应的最大超时时间 optional
* @param {integer} [opts.healthCheckInterval] - 健康检查响应的最大间隔时间 optional
* @param {integer} [opts.healthyThreshold] - 健康检查结果为success的阈值 optional
* @param {integer} [opts.unhealthyThreshold] - 健康检查结果为fail的阈值 optional
* @param {string} [opts.serverGroupId] - 服务器组id optional
* @param {integer} [opts.stickySessionTimeout] - 会话保持超时时间,单位s optional
* @param {string} [opts.cookieType] - 会话类型,植入Cookie or 重写Cookie optional
* @param {string} [opts.healthCheckUri] - 检查路径 optional
* @param {string} [opts.healthCheckHttpCode] - 正常态码,要使用的Http状态码 optional
* @param {string} [opts.certificateId] - 证书ID optional
* @param {array} [opts.headers] - 获取HTTP头字段:X-Forwarded-For、X-Forwarded-Proto、X- Forwarded-Port、X-Forwarded-LBIP optional
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param listener listener 监听器详细信息
*/
modifyListener (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 modifyListener"
)
}
opts = opts || {}
if (opts.listenerId === undefined || opts.listenerId === null) {
throw new Error(
"Missing the required parameter 'opts.listenerId' when calling modifyListener"
)
}
let postBody = {}
if (opts.algorithm !== undefined && opts.algorithm !== null) {
postBody['algorithm'] = opts.algorithm
}
if (opts.stickySession !== undefined && opts.stickySession !== null) {
postBody['stickySession'] = opts.stickySession
}
if (opts.realIp !== undefined && opts.realIp !== null) {
postBody['realIp'] = opts.realIp
}
if (opts.name !== undefined && opts.name !== null) {
postBody['name'] = opts.name
}
if (opts.description !== undefined && opts.description !== null) {
postBody['description'] = opts.description
}
if (opts.healthCheck !== undefined && opts.healthCheck !== null) {
postBody['healthCheck'] = opts.healthCheck
}
if (
opts.healthCheckTimeout !== undefined &&
opts.healthCheckTimeout !== null
) {
postBody['healthCheckTimeout'] = opts.healthCheckTimeout
}
if (
opts.healthCheckInterval !== undefined &&
opts.healthCheckInterval !== null
) {
postBody['healthCheckInterval'] = opts.healthCheckInterval
}
if (opts.healthyThreshold !== undefined && opts.healthyThreshold !== null) {
postBody['healthyThreshold'] = opts.healthyThreshold
}
if (
opts.unhealthyThreshold !== undefined &&
opts.unhealthyThreshold !== null
) {
postBody['unhealthyThreshold'] = opts.unhealthyThreshold
}
if (opts.serverGroupId !== undefined && opts.serverGroupId !== null) {
postBody['serverGroupId'] = opts.serverGroupId
}
if (
opts.stickySessionTimeout !== undefined &&
opts.stickySessionTimeout !== null
) {
postBody['stickySessionTimeout'] = opts.stickySessionTimeout
}
if (opts.cookieType !== undefined && opts.cookieType !== null) {
postBody['cookieType'] = opts.cookieType
}
if (opts.healthCheckUri !== undefined && opts.healthCheckUri !== null) {
postBody['healthCheckUri'] = opts.healthCheckUri
}
if (
opts.healthCheckHttpCode !== undefined &&
opts.healthCheckHttpCode !== null
) {
postBody['healthCheckHttpCode'] = opts.healthCheckHttpCode
}
if (opts.certificateId !== undefined && opts.certificateId !== null) {
postBody['certificateId'] = opts.certificateId
}
if (opts.headers !== undefined && opts.headers !== null) {
postBody['headers'] = opts.headers
}
let queryParams = {}
let pathParams = {
regionId: regionId,
listenerId: opts.listenerId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cps/2.4.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 modifyListener 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}/listeners/{listenerId}:modifyListenerAttributes',
'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.listenerId - 监听器ID
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param listener listener 监听器详细信息
*/
describeListener (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 describeListener"
)
}
opts = opts || {}
if (opts.listenerId === undefined || opts.listenerId === null) {
throw new Error(
"Missing the required parameter 'opts.listenerId' when calling describeListener"
)
}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId,
listenerId: opts.listenerId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cps/2.4.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 describeListener 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}/listeners/{listenerId}',
'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.listenerId - 监听器ID
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param boolean success 删除操作是否成功
*/
deleteListener (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 deleteListener"
)
}
opts = opts || {}
if (opts.listenerId === undefined || opts.listenerId === null) {
throw new Error(
"Missing the required parameter 'opts.listenerId' when calling deleteListener"
)
}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId,
listenerId: opts.listenerId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cps/2.4.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 deleteListener 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}/listeners/{listenerId}',
'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 {string} opts.listenerId - 监听器ID
* @param {string} [opts.clientToken] - 由客户端生成,用于保证请求的幂等性,长度不能超过36个字符;<br/>
如果多个请求使用了相同的clientToken,只会执行第一个请求,之后的请求直接返回第一个请求的结果<br/>
optional
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param boolean success 开启监听器是否成功
*/
startListener (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 startListener"
)
}
opts = opts || {}
if (opts.listenerId === undefined || opts.listenerId === null) {
throw new Error(
"Missing the required parameter 'opts.listenerId' when calling startListener"
)
}
let postBody = {}
if (opts.clientToken !== undefined && opts.clientToken !== null) {
postBody['clientToken'] = opts.clientToken
}
let queryParams = {}
let pathParams = {
regionId: regionId,
listenerId: opts.listenerId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cps/2.4.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 startListener 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}/listeners/{listenerId}:startListener',
'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.listenerId - 监听器ID
* @param {string} [opts.clientToken] - 由客户端生成,用于保证请求的幂等性,长度不能超过36个字符;<br/>
如果多个请求使用了相同的clientToken,只会执行第一个请求,之后的请求直接返回第一个请求的结果<br/>
optional
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param boolean success 关闭监听器是否成功
*/
stopListener (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 stopListener"
)
}
opts = opts || {}
if (opts.listenerId === undefined || opts.listenerId === null) {
throw new Error(
"Missing the required parameter 'opts.listenerId' when calling stopListener"
)
}
let postBody = {}
if (opts.clientToken !== undefined && opts.clientToken !== null) {
postBody['clientToken'] = opts.clientToken
}
let queryParams = {}
let pathParams = {
regionId: regionId,
listenerId: opts.listenerId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cps/2.4.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 stopListener 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}/listeners/{listenerId}:stopListener',
'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 {integer} [opts.pageNumber] - 页码;默认为1 optional
* @param {integer} [opts.pageSize] - 分页大小;默认为20;取值范围[20, 100] optional
* @param {string} [opts.status] - 状态 optional
* @param {string} [opts.name] - 名称 optional
* @param {string} [opts.vpcId] - 私有网络ID,精确匹配 optional
* @param {boolean} [opts.bindEip] - 是否绑定eip optional
* @param {filter} [opts.filters] - loadBalancerId - 负载均衡实例ID,精确匹配,支持多个
optional
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param loadBalancer loadBalancers
* @param integer pageNumber 页码;默认为1
* @param integer pageSize 分页大小;默认为20;取值范围[20, 100]
* @param integer totalCount 查询结果总数
*/
describeLoadBalancers (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 describeLoadBalancers"
)
}
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
}
if (opts.status !== undefined && opts.status !== null) {
queryParams['status'] = opts.status
}
if (opts.name !== undefined && opts.name !== null) {
queryParams['name'] = opts.name
}
if (opts.vpcId !== undefined && opts.vpcId !== null) {
queryParams['vpcId'] = opts.vpcId
}
if (opts.bindEip !== undefined && opts.bindEip !== null) {
queryParams['bindEip'] = opts.bindEip
}
Object.assign(queryParams, super.buildFilterParam(opts.filters, 'filters'))
let pathParams = {
regionId: regionId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cps/2.4.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 describeLoadBalancers 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}/slbs',
'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.clientToken] - 由客户端生成,用于保证请求的幂等性,长度不能超过36个字符;<br/>
如果多个请求使用了相同的clientToken,只会执行第一个请求,之后的请求直接返回第一个请求的结果<br/>
optional
* @param {loadBalancerSpec} opts.loadBalancerSpec - 负载均衡配置
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param string loadBalancerId 负载均衡实例ID
*/
createLoadBalancer (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 createLoadBalancer"
)
}
opts = opts || {}
if (opts.loadBalancerSpec === undefined || opts.loadBalancerSpec === null) {
throw new Error(
"Missing the required parameter 'opts.loadBalancerSpec' when calling createLoadBalancer"
)
}
let postBody = {}
if (opts.clientToken !== undefined && opts.clientToken !== null) {
postBody['clientToken'] = opts.clientToken
}
if (opts.loadBalancerSpec !== undefined && opts.loadBalancerSpec !== null) {
postBody['loadBalancerSpec'] = opts.loadBalancerSpec
}
let queryParams = {}
let pathParams = {
regionId: regionId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cps/2.4.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 createLoadBalancer 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}/slbs',
'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.loadBalancerId - 负载均衡实例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
* @param loadBalancer loadBalancer 负载均衡实例详细信息
*/
modifyLoadBalancer (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 modifyLoadBalancer"
)
}
opts = opts || {}
if (opts.loadBalancerId === undefined || opts.loadBalancerId === null) {
throw new Error(
"Missing the required parameter 'opts.loadBalancerId' when calling modifyLoadBalancer"
)
}
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,
loadBalancerId: opts.loadBalancerId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cps/2.4.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 modifyLoadBalancer 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}/slbs/{loadBalancerId}:modifyLoadBalancerAttributes',
'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.loadBalancerId - 负载均衡实例ID
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param loadBalancer loadBalancer 负载均衡实例详细信息
*/
describeLoadBalancer (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 describeLoadBalancer"
)
}
opts = opts || {}
if (opts.loadBalancerId === undefined || opts.loadBalancerId === null) {
throw new Error(
"Missing the required parameter 'opts.loadBalancerId' when calling describeLoadBalancer"
)
}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId,
loadBalancerId: opts.loadBalancerId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cps/2.4.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 describeLoadBalancer 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}/slbs/{loadBalancerId}',
'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.loadBalancerId - 负载均衡实例ID
* @param {string} [opts.clientToken] - 由客户端生成,用于保证请求的幂等性,长度不能超过36个字符;<br/>
如果多个请求使用了相同的clientToken,只会执行第一个请求,之后的请求直接返回第一个请求的结果<br/>
optional
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param boolean success 开启负载均衡实例是否成功
*/
startLoadBalancer (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 startLoadBalancer"
)
}
opts = opts || {}
if (opts.loadBalancerId === undefined || opts.loadBalancerId === null) {
throw new Error(
"Missing the required parameter 'opts.loadBalancerId' when calling startLoadBalancer"
)
}
let postBody = {}
if (opts.clientToken !== undefined && opts.clientToken !== null) {
postBody['clientToken'] = opts.clientToken
}
let queryParams = {}
let pathParams = {
regionId: regionId,
loadBalancerId: opts.loadBalancerId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cps/2.4.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 startLoadBalancer 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}/slbs/{loadBalancerId}:startLoadBalancer',
'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.loadBalancerId - 负载均衡实例ID
* @param {string} [opts.clientToken] - 由客户端生成,用于保证请求的幂等性,长度不能超过36个字符;<br/>
如果多个请求使用了相同的clientToken,只会执行第一个请求,之后的请求直接返回第一个请求的结果<br/>
optional
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param boolean success 关闭负载均衡实例是否成功
*/
stopLoadBalancer (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 stopLoadBalancer"
)
}
opts = opts || {}
if (opts.loadBalancerId === undefined || opts.loadBalancerId === null) {
throw new Error(
"Missing the required parameter 'opts.loadBalancerId' when calling stopLoadBalancer"
)
}
let postBody = {}
if (opts.clientToken !== undefined && opts.clientToken !== null) {
postBody['clientToken'] = opts.clientToken
}
let queryParams = {}
let pathParams = {
regionId: regionId,
loadBalancerId: opts.loadBalancerId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cps/2.4.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 stopLoadBalancer 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}/slbs/{loadBalancerId}:stopLoadBalancer',
'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)
}
)
}
/**
* 绑定弹性公网IP
* @param {Object} opts - parameters
* @param {string} opts.loadBalancerId - 负载均衡实例ID
* @param {string} [opts.clientToken] - 由客户端生成,用于保证请求的幂等性,长度不能超过36个字符;<br/>
如果多个请求使用了相同的clientToken,只会执行第一个请求,之后的请求直接返回第一个请求的结果<br/>
optional
* @param {string} opts.elasticIpId - 弹性公网IPId
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param boolean success 绑定结果
*/
associateElasticIpLB (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 associateElasticIpLB"
)
}
opts = opts || {}
if (opts.loadBalancerId === undefined || opts.loadBalancerId === null) {
throw new Error(
"Missing the required parameter 'opts.loadBalancerId' when calling associateElasticIpLB"
)
}
if (opts.elasticIpId === undefined || opts.elasticIpId === null) {
throw new Error(
"Missing the required parameter 'opts.elasticIpId' when calling associateElasticIpLB"
)
}
let postBody = {}
if (opts.clientToken !== undefined && opts.clientToken !== null) {
postBody['clientToken'] = opts.clientToken
}
if (opts.elasticIpId !== undefined && opts.elasticIpId !== null) {
postBody['elasticIpId'] = opts.elasticIpId
}
let queryParams = {}
let pathParams = {
regionId: regionId,
loadBalancerId: opts.loadBalancerId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cps/2.4.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 associateElasticIpLB 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}/slbs/{loadBalancerId}:associateElasticIp',
'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)
}
)
}
/**
* 解绑弹性公网IP
* @param {Object} opts - parameters
* @param {string} opts.loadBalancerId - 负载均衡实例ID
* @param {string} [opts.clientToken] - 由客户端生成,用于保证请求的幂等性,长度不能超过36个字符;<br/>
如果多个请求使用了相同的clientToken,只会执行第一个请求,之后的请求直接返回第一个请求的结果<br/>
optional
* @param {string} opts.elasticIpId - 弹性公网IPId
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param boolean success 解绑结果
*/
disassociateElasticIpLB (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 disassociateElasticIpLB"
)
}
opts = opts || {}
if (opts.loadBalancerId === undefined || opts.loadBalancerId === null) {
throw new Error(
"Missing the required parameter 'opts.loadBalancerId' when calling disassociateElasticIpLB"
)
}
if (opts.elasticIpId === undefined || opts.elasticIpId === null) {
throw new Error(
"Missing the required parameter 'opts.elasticIpId' when calling disassociateElasticIpLB"
)
}
let postBody = {}
if (opts.clientToken !== undefined && opts.clientToken !== null) {
postBody['clientToken'] = opts.clientToken
}
if (opts.elasticIpId !== undefined && opts.elasticIpId !== null) {
postBody['elasticIpId'] = opts.elasticIpId
}
let queryParams = {}
let pathParams = {
regionId: regionId,
loadBalancerId: opts.loadBalancerId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cps/2.4.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 disassociateElasticIpLB 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}/slbs/{loadBalancerId}:disassociateElasticIp',
'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)
}
)
}
/**
* 查询SLB名称
* @param {Object} opts - parameters
* @param {string} opts.loadBalancerId - 负载均衡实例ID
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param string name SLB名称
*/
describeSlbsName (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 describeSlbsName"
)
}
opts = opts || {}
if (opts.loadBalancerId === undefined || opts.loadBalancerId === null) {
throw new Error(
"Missing the required parameter 'opts.loadBalancerId' when calling describeSlbsName"
)
}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId,
loadBalancerId: opts.loadBalancerId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cps/2.4.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 describeSlbsName 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}/slbs/{loadBalancerId}:describeSlbsName',
'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.networkType] - 网络类型basic(基础网络)、vpc(私有网络)、retail(零售中台网络), 默认basic optional
* @param {string} callback - callback
@return {Object} result
* @param region regions
*/
describeRegiones (opts, callback) {
opts = opts || {}
let postBody = null
let queryParams = {}
if (opts.networkType !== undefined && opts.networkType !== null) {
queryParams['networkType'] = opts.networkType
}
let pathParams = {
regionId: 'jdcloud'
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cps/2.4.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 describeRegiones 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',
'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} callback - callback
@return {Object} result
* @param region regions
*/
describeCPSLBRegions (opts, callback) {
opts = opts || {}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: 'jdcloud'
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cps/2.4.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 describeCPSLBRegions 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(
'/cpslbRegions',
'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.routeTableId - 路由表ID
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param routeTable routeTable 路由表详细信息
*/
describeRouteTable (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 describeRouteTable"
)
}
opts = opts || {}
if (opts.routeTableId === undefined || opts.routeTableId === null) {
throw new Error(
"Missing the required parameter 'opts.routeTableId' when calling describeRouteTable"
)
}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId,
routeTableId: opts.routeTableId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cps/2.4.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 describeRouteTable 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}/routeTables/{routeTableId}',
'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.pageNumber] - 页码;默认为1 optional
* @param {integer} [opts.pageSize] - 分页大小;默认为20;取值范围[20, 100] optional
* @param {string} [opts.name] - 名称 optional
* @param {string} [opts.vpcId] - 私有网络ID,精确匹配 optional
* @param {filter} [opts.filters] - routeTableId - 路由表ID,精确匹配,支持多个
optional
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param routeTable routeTables
* @param integer pageNumber 页码;默认为1
* @param integer pageSize 分页大小;默认为20;取值范围[20, 100]
* @param integer totalCount 查询结果总数
*/
describeRouteTables (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 describeRouteTables"
)
}
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
}
if (opts.name !== undefined && opts.name !== null) {
queryParams['name'] = opts.name
}
if (opts.vpcId !== undefined && opts.vpcId !== null) {
queryParams['vpcId'] = opts.vpcId
}
Object.assign(queryParams, super.buildFilterParam(opts.filters, 'filters'))
let pathParams = {
regionId: regionId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cps/2.4.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 describeRouteTables 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}/routeTables',
'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)
}
)
}
/**
* 查询次要CIDR列表
* @param {Object} opts - parameters
* @param {string} opts.subnetId - 子网ID
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param secondaryCidr secondaryCidrs
*/
describeSecondaryCidrs (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 describeSecondaryCidrs"
)
}
opts = opts || {}
if (opts.subnetId === undefined || opts.subnetId === null) {
throw new Error(
"Missing the required parameter 'opts.subnetId' when calling describeSecondaryCidrs"
)
}
let postBody = null
let queryParams = {}
if (opts.subnetId !== undefined && opts.subnetId !== null) {
queryParams['subnetId'] = opts.subnetId
}
let pathParams = {
regionId: regionId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cps/2.4.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 describeSecondaryCidrs 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}/secondaryCidrs',
'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)
}
)
}
/**
* 添加次要CIDR
* @param {Object} opts - parameters
* @param {string} [opts.clientToken] - 由客户端生成,用于保证请求的幂等性,长度不能超过36个字符;<br/>
如果多个请求使用了相同的clientToken,只会执行第一个请求,之后的请求直接返回第一个请求的结果<br/>
optional
* @param {secondaryCidrSpec} opts.secondaryCidrSpec - 次要cidr配置
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param string secondaryCidrId 次要cidr的ID
*/
createSecondaryCidr (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 createSecondaryCidr"
)
}
opts = opts || {}
if (
opts.secondaryCidrSpec === undefined ||
opts.secondaryCidrSpec === null
) {
throw new Error(
"Missing the required parameter 'opts.secondaryCidrSpec' when calling createSecondaryCidr"
)
}
let postBody = {}
if (opts.clientToken !== undefined && opts.clientToken !== null) {
postBody['clientToken'] = opts.clientToken
}
if (
opts.secondaryCidrSpec !== undefined &&
opts.secondaryCidrSpec !== null
) {
postBody['secondaryCidrSpec'] = opts.secondaryCidrSpec
}
let queryParams = {}
let pathParams = {
regionId: regionId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cps/2.4.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 createSecondaryCidr 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}/secondaryCidrs',
'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)
}
)
}
/**
* 删除次要CIDR
* @param {Object} opts - parameters
* @param {string} opts.secondaryCidrId - 次要CIDR ID
* @param {string} [opts.clientToken] - 由客户端生成,用于保证请求的幂等性,长度不能超过36个字符;<br/>
如果多个请求使用了相同的clientToken,只会执行第一个请求,之后的请求直接返回第一个请求的结果<br/>
optional
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param boolean success 删除操作是否成功
*/
deleteSecondaryCidr (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 deleteSecondaryCidr"
)
}
opts = opts || {}
if (opts.secondaryCidrId === undefined || opts.secondaryCidrId === null) {
throw new Error(
"Missing the required parameter 'opts.secondaryCidrId' when calling deleteSecondaryCidr"
)
}
let postBody = null
let queryParams = {}
if (opts.clientToken !== undefined && opts.clientToken !== null) {
queryParams['clientToken'] = opts.clientToken
}
let pathParams = {
regionId: regionId,
secondaryCidrId: opts.secondaryCidrId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cps/2.4.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 deleteSecondaryCidr 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}/secondaryCidrs/{secondaryCidrId}',
'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 {string} opts.serverGroupId - 服务器组ID
* @param {integer} [opts.pageNumber] - 页码;默认为1 optional
* @param {integer} [opts.pageSize] - 分页大小;默认为20;取值范围[20, 100] optional
* @param {string} [opts.listenerId] - 监听器Id optional
* @param {filter} [opts.filters] - serverId - 后端服务器ID,精确匹配,支持多个
optional
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param server servers
* @param integer pageNumber 页码;默认为1
* @param integer pageSize 分页大小;默认为20;取值范围[20, 100]
* @param integer totalCount 查询结果总数
*/
describeServers (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 describeServers"
)
}
opts = opts || {}
if (opts.serverGroupId === undefined || opts.serverGroupId === null) {
throw new Error(
"Missing the required parameter 'opts.serverGroupId' when calling describeServers"
)
}
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
}
if (opts.listenerId !== undefined && opts.listenerId !== null) {
queryParams['listenerId'] = opts.listenerId
}
Object.assign(queryParams, super.buildFilterParam(opts.filters, 'filters'))
let pathParams = {
regionId: regionId,
serverGroupId: opts.serverGroupId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cps/2.4.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 describeServers 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}/serverGroups/{serverGroupId}/servers',
'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.serverGroupId - 服务器组ID
* @param {string} [opts.clientToken] - 由客户端生成,用于保证请求的幂等性,长度不能超过36个字符;<br/>
如果多个请求使用了相同的clientToken,只会执行第一个请求,之后的请求直接返回第一个请求的结果<br/>
optional
* @param {array} [opts.serverSpec] - 后端服务器配置 optional
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param string serverIds
*/
addServers (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 addServers"
)
}
opts = opts || {}
if (opts.serverGroupId === undefined || opts.serverGroupId === null) {
throw new Error(
"Missing the required parameter 'opts.serverGroupId' when calling addServers"
)
}
let postBody = {}
if (opts.clientToken !== undefined && opts.clientToken !== null) {
postBody['clientToken'] = opts.clientToken
}
if (opts.serverSpec !== undefined && opts.serverSpec !== null) {
postBody['serverSpec'] = opts.serverSpec
}
let queryParams = {}
let pathParams = {
regionId: regionId,
serverGroupId: opts.serverGroupId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cps/2.4.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 addServers 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}/serverGroups/{serverGroupId}/servers',
'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.serverGroupId - 服务器组ID
* @param {string} opts.serverId - 后端服务器ID
* @param {integer} [opts.weight] - 权重 optional
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param string serverId 后端服务器ID
* @param string instanceId 后端云物理服务器ID
* @param string privateIp 内网Ip
* @param integer port 端口
* @param integer weight 后端云物理服务器权重
*/
modifyServer (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 modifyServer"
)
}
opts = opts || {}
if (opts.serverGroupId === undefined || opts.serverGroupId === null) {
throw new Error(
"Missing the required parameter 'opts.serverGroupId' when calling modifyServer"
)
}
if (opts.serverId === undefined || opts.serverId === null) {
throw new Error(
"Missing the required parameter 'opts.serverId' when calling modifyServer"
)
}
let postBody = {}
if (opts.weight !== undefined && opts.weight !== null) {
postBody['weight'] = opts.weight
}
let queryParams = {}
let pathParams = {
regionId: regionId,
serverGroupId: opts.serverGroupId,
serverId: opts.serverId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cps/2.4.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 modifyServer 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}/serverGroups/{serverGroupId}/servers/{serverId}',
'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.serverGroupId - 服务器组ID
* @param {string} opts.serverId - 后端服务器ID
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param boolean success 删除操作是否成功
*/
removeServer (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 removeServer"
)
}
opts = opts || {}
if (opts.serverGroupId === undefined || opts.serverGroupId === null) {
throw new Error(
"Missing the required parameter 'opts.serverGroupId' when calling removeServer"
)
}
if (opts.serverId === undefined || opts.serverId === null) {
throw new Error(
"Missing the required parameter 'opts.serverId' when calling removeServer"
)
}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId,
serverGroupId: opts.serverGroupId,
serverId: opts.serverId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cps/2.4.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 removeServer 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}/serverGroups/{serverGroupId}/servers/{serverId}',
'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 {integer} [opts.pageNumber] - 页码;默认为1 optional
* @param {integer} [opts.pageSize] - 分页大小;默认为20;取值范围[20, 100] optional
* @param {string} [opts.name] - 名称 optional
* @param {string} [opts.loadBalancerId] - 负载均衡ID optional
* @param {filter} [opts.filters] - serverGroupId - 虚拟服务器组ID,精确匹配,支持多个
optional
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param serverGroup serverGroups
* @param integer pageNumber 页码;默认为1
* @param integer pageSize 分页大小;默认为20;取值范围[20, 100]
* @param integer totalCount 查询结果总数
*/
describeServerGroups (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 describeServerGroups"
)
}
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
}
if (opts.name !== undefined && opts.name !== null) {
queryParams['name'] = opts.name
}
if (opts.loadBalancerId !== undefined && opts.loadBalancerId !== null) {
queryParams['loadBalancerId'] = opts.loadBalancerId
}
Object.assign(queryParams, super.buildFilterParam(opts.filters, 'filters'))
let pathParams = {
regionId: regionId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cps/2.4.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 describeServerGroups 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}/serverGroups',
'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.clientToken] - 由客户端生成,用于保证请求的幂等性,长度不能超过36个字符;<br/>
如果多个请求使用了相同的clientToken,只会执行第一个请求,之后的请求直接返回第一个请求的结果<br/>
optional
* @param {serverGroupSpec} opts.serverGroupSpec - 虚拟服务器组配置
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param string serverGroupId 服务器组ID
*/
createServerGroup (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 createServerGroup"
)
}
opts = opts || {}
if (opts.serverGroupSpec === undefined || opts.serverGroupSpec === null) {
throw new Error(
"Missing the required parameter 'opts.serverGroupSpec' when calling createServerGroup"
)
}
let postBody = {}
if (opts.clientToken !== undefined && opts.clientToken !== null) {
postBody['clientToken'] = opts.clientToken
}
if (opts.serverGroupSpec !== undefined && opts.serverGroupSpec !== null) {
postBody['serverGroupSpec'] = opts.serverGroupSpec
}
let queryParams = {}
let pathParams = {
regionId: regionId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cps/2.4.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 createServerGroup 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}/serverGroups',
'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.serverGroupId - 服务器组ID
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param serverGroup serverGroup 服务器组详细信息
*/
describeServerGroup (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 describeServerGroup"
)
}
opts = opts || {}
if (opts.serverGroupId === undefined || opts.serverGroupId === null) {
throw new Error(
"Missing the required parameter 'opts.serverGroupId' when calling describeServerGroup"
)
}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId,
serverGroupId: opts.serverGroupId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cps/2.4.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 describeServerGroup 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}/serverGroups/{serverGroupId}',
'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.serverGroupId - 服务器组ID
* @param {string} [opts.name] - 名称 optional
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param string loadBalancerId 负载均衡ID
* @param string serverGroupId 服务器组ID
* @param string name 名称
*/
modifyServerGroup (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 modifyServerGroup"
)
}
opts = opts || {}
if (opts.serverGroupId === undefined || opts.serverGroupId === null) {
throw new Error(
"Missing the required parameter 'opts.serverGroupId' when calling modifyServerGroup"
)
}
let postBody = {}
if (opts.name !== undefined && opts.name !== null) {
postBody['name'] = opts.name
}
let queryParams = {}
let pathParams = {
regionId: regionId,
serverGroupId: opts.serverGroupId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cps/2.4.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 modifyServerGroup 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}/serverGroups/{serverGroupId}',
'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.serverGroupId - 服务器组ID
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param boolean success 删除操作是否成功
*/
deleteServerGroup (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 deleteServerGroup"
)
}
opts = opts || {}
if (opts.serverGroupId === undefined || opts.serverGroupId === null) {
throw new Error(
"Missing the required parameter 'opts.serverGroupId' when calling deleteServerGroup"
)
}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId,
serverGroupId: opts.serverGroupId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cps/2.4.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 deleteServerGroup 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}/serverGroups/{serverGroupId}',
'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 {string} opts.az - 可用区, 如cn-east-1a;可调用接口(describeRegiones)获取云物理服务器在该地域支持的可用区
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param subnet subnet 子网详细信息
*/
describeBasicSubnet (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 describeBasicSubnet"
)
}
opts = opts || {}
if (opts.az === undefined || opts.az === null) {
throw new Error(
"Missing the required parameter 'opts.az' when calling describeBasicSubnet"
)
}
let postBody = null
let queryParams = {}
if (opts.az !== undefined && opts.az !== null) {
queryParams['az'] = opts.az
}
let pathParams = {
regionId: regionId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cps/2.4.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 describeBasicSubnet 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}/subnet',
'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.pageNumber] - 页码;默认为1 optional
* @param {integer} [opts.pageSize] - 分页大小;默认为20;取值范围[20, 100] optional
* @param {string} [opts.az] - 可用区,精确匹配 optional
* @param {string} [opts.name] - 子网名称 optional
* @param {string} [opts.vpcId] - 私有网络ID,精确匹配 optional
* @param {filter} [opts.filters] - subnetId - 子网ID,精确匹配,支持多个
optional
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param subnet subnets
* @param integer pageNumber 页码;默认为1
* @param integer pageSize 分页大小;默认为20;取值范围[20, 100]
* @param integer totalCount 查询结果总数
*/
describeSubnets (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 describeSubnets"
)
}
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
}
if (opts.az !== undefined && opts.az !== null) {
queryParams['az'] = opts.az
}
if (opts.name !== undefined && opts.name !== null) {
queryParams['name'] = opts.name
}
if (opts.vpcId !== undefined && opts.vpcId !== null) {
queryParams['vpcId'] = opts.vpcId
}
Object.assign(queryParams, super.buildFilterParam(opts.filters, 'filters'))
let pathParams = {
regionId: regionId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cps/2.4.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 describeSubnets 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}/subnets',
'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.clientToken] - 由客户端生成,用于保证请求的幂等性,长度不能超过36个字符;<br/>
如果多个请求使用了相同的clientToken,只会执行第一个请求,之后的请求直接返回第一个请求的结果<br/>
optional
* @param {subnetSpec} opts.subnetSpec - 子网配置
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param string subnetId 子网ID
*/
createSubnet (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 createSubnet"
)
}
opts = opts || {}
if (opts.subnetSpec === undefined || opts.subnetSpec === null) {
throw new Error(
"Missing the required parameter 'opts.subnetSpec' when calling createSubnet"
)
}
let postBody = {}
if (opts.clientToken !== undefined && opts.clientToken !== null) {
postBody['clientToken'] = opts.clientToken
}
if (opts.subnetSpec !== undefined && opts.subnetSpec !== null) {
postBody['subnetSpec'] = opts.subnetSpec
}
let queryParams = {}
let pathParams = {
regionId: regionId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cps/2.4.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 createSubnet 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}/subnets',
'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)
}
)
}
/**
* 申请IPv6网段
* @param {Object} opts - parameters
* @param {string} opts.subnetId - 子网ID
* @param {string} [opts.clientToken] - 由客户端生成,用于保证请求的幂等性,长度不能超过36个字符;<br/>
如果多个请求使用了相同的clientToken,只会执行第一个请求,之后的请求直接返回第一个请求的结果<br/>
optional
* @param {string} [opts.ipv6Cidr] - 子网IPv6 CIDR optional
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param boolean success 申请操作是否成功
*/
assignIpv6Cidr (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 assignIpv6Cidr"
)
}
opts = opts || {}
if (opts.subnetId === undefined || opts.subnetId === null) {
throw new Error(
"Missing the required parameter 'opts.subnetId' when calling assignIpv6Cidr"
)
}
let postBody = {}
if (opts.clientToken !== undefined && opts.clientToken !== null) {
postBody['clientToken'] = opts.clientToken
}
if (opts.ipv6Cidr !== undefined && opts.ipv6Cidr !== null) {
postBody['ipv6Cidr'] = opts.ipv6Cidr
}
let queryParams = {}
let pathParams = {
regionId: regionId,
subnetId: opts.subnetId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cps/2.4.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 assignIpv6Cidr 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}/subnets/{subnetId}:assignIpv6Cidr',
'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.subnetId - 子网ID
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param subnet subnet 子网详细信息
*/
describeSubnet (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 describeSubnet"
)
}
opts = opts || {}
if (opts.subnetId === undefined || opts.subnetId === null) {
throw new Error(
"Missing the required parameter 'opts.subnetId' when calling describeSubnet"
)
}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId,
subnetId: opts.subnetId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cps/2.4.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 describeSubnet 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}/subnets/{subnetId}',
'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.subnetId - 子网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
* @param subnet subnet 子网详细信息
*/
modifySubnet (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 modifySubnet"
)
}
opts = opts || {}
if (opts.subnetId === undefined || opts.subnetId === null) {
throw new Error(
"Missing the required parameter 'opts.subnetId' when calling modifySubnet"
)
}
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,
subnetId: opts.subnetId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cps/2.4.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 modifySubnet 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}/subnets/{subnetId}',
'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.subnetId - 子网ID
* @param {string} [opts.clientToken] - 由客户端生成,用于保证请求的幂等性,长度不能超过36个字符;<br/>
如果多个请求使用了相同的clientToken,只会执行第一个请求,之后的请求直接返回第一个请求的结果<br/>
optional
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param boolean success 删除操作是否成功
*/
deleteSubnet (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 deleteSubnet"
)
}
opts = opts || {}
if (opts.subnetId === undefined || opts.subnetId === null) {
throw new Error(
"Missing the required parameter 'opts.subnetId' when calling deleteSubnet"
)
}
let postBody = null
let queryParams = {}
if (opts.clientToken !== undefined && opts.clientToken !== null) {
queryParams['clientToken'] = opts.clientToken
}
let pathParams = {
regionId: regionId,
subnetId: opts.subnetId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cps/2.4.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 deleteSubnet 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}/subnets/{subnetId}',
'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 {string} opts.vpcId - 私有网络ID
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param vpc vpc 私有网络详细信息
*/
describeVpc (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 describeVpc"
)
}
opts = opts || {}
if (opts.vpcId === undefined || opts.vpcId === null) {
throw new Error(
"Missing the required parameter 'opts.vpcId' when calling describeVpc"
)
}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId,
vpcId: opts.vpcId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cps/2.4.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 describeVpc 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}/vpcs/{vpcId}',
'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.vpcId - 私有网络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
* @param vpc vpc 私有网络详细信息
*/
modifyVpc (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 modifyVpc"
)
}
opts = opts || {}
if (opts.vpcId === undefined || opts.vpcId === null) {
throw new Error(
"Missing the required parameter 'opts.vpcId' when calling modifyVpc"
)
}
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,
vpcId: opts.vpcId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cps/2.4.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 modifyVpc 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}/vpcs/{vpcId}',
'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.vpcId - 私有网络ID
* @param {string} [opts.clientToken] - 由客户端生成,用于保证请求的幂等性,长度不能超过36个字符;<br/>
如果多个请求使用了相同的clientToken,只会执行第一个请求,之后的请求直接返回第一个请求的结果<br/>
optional
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param boolean success 删除操作是否成功
*/
deleteVpc (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 deleteVpc"
)
}
opts = opts || {}
if (opts.vpcId === undefined || opts.vpcId === null) {
throw new Error(
"Missing the required parameter 'opts.vpcId' when calling deleteVpc"
)
}
let postBody = null
let queryParams = {}
if (opts.clientToken !== undefined && opts.clientToken !== null) {
queryParams['clientToken'] = opts.clientToken
}
let pathParams = {
regionId: regionId,
vpcId: opts.vpcId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cps/2.4.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 deleteVpc 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}/vpcs/{vpcId}',
'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 {integer} [opts.pageNumber] - 页码;默认为1 optional
* @param {integer} [opts.pageSize] - 分页大小;默认为20;取值范围[20, 100] optional
* @param {string} [opts.name] - 私有网络名称 optional
* @param {filter} [opts.filters] - vpcId - 私有网络ID,精确匹配,支持多个
optional
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param vpc vpcs
* @param integer pageNumber 页码;默认为1
* @param integer pageSize 分页大小;默认为20;取值范围[20, 100]
* @param integer totalCount 查询结果总数
*/
describeVpcs (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 describeVpcs"
)
}
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
}
if (opts.name !== undefined && opts.name !== null) {
queryParams['name'] = opts.name
}
Object.assign(queryParams, super.buildFilterParam(opts.filters, 'filters'))
let pathParams = {
regionId: regionId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cps/2.4.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 describeVpcs 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}/vpcs',
'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.clientToken] - 由客户端生成,用于保证请求的幂等性,长度不能超过36个字符;<br/>
如果多个请求使用了相同的clientToken,只会执行第一个请求,之后的请求直接返回第一个请求的结果<br/>
optional
* @param {vpcSpec} opts.vpcSpec - 子网配置
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param string vpcId 私有网络ID
*/
createVpc (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 createVpc"
)
}
opts = opts || {}
if (opts.vpcSpec === undefined || opts.vpcSpec === null) {
throw new Error(
"Missing the required parameter 'opts.vpcSpec' when calling createVpc"
)
}
let postBody = {}
if (opts.clientToken !== undefined && opts.clientToken !== null) {
postBody['clientToken'] = opts.clientToken
}
if (opts.vpcSpec !== undefined && opts.vpcSpec !== null) {
postBody['vpcSpec'] = opts.vpcSpec
}
let queryParams = {}
let pathParams = {
regionId: regionId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cps/2.4.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 createVpc 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}/vpcs',
'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)
}
)
}
/**
* 申请开通IPv6网关
* @param {Object} opts - parameters
* @param {string} opts.vpcId - 私有网络ID
* @param {string} [opts.clientToken] - 由客户端生成,用于保证请求的幂等性,长度不能超过36个字符;<br/>
如果多个请求使用了相同的clientToken,只会执行第一个请求,之后的请求直接返回第一个请求的结果<br/>
optional
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param boolean success 申请操作是否成功
*/
assignIpv6Gateway (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 assignIpv6Gateway"
)
}
opts = opts || {}
if (opts.vpcId === undefined || opts.vpcId === null) {
throw new Error(
"Missing the required parameter 'opts.vpcId' when calling assignIpv6Gateway"
)
}
let postBody = {}
if (opts.clientToken !== undefined && opts.clientToken !== null) {
postBody['clientToken'] = opts.clientToken
}
let queryParams = {}
let pathParams = {
regionId: regionId,
vpcId: opts.vpcId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cps/2.4.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 assignIpv6Gateway 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}/vpcs/{vpcId}:assignIpv6Gateway',
'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 = CPS