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

13706 lines
364 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.
*
* Vpc-VserverGroup
* 与服务器组相关的接口
*
* 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 = 'jdfusion'
Service._services[serviceId] = true
/**
* jdfusion service.
* @version 0.3.0
*/
JDCloud.JDFUSION = class JDFUSION extends Service {
constructor (options = {}) {
options._defaultEndpoint = {}
options._defaultEndpoint.protocol =
options._defaultEndpoint.protocol || 'https'
options._defaultEndpoint.host =
options._defaultEndpoint.host || 'jdfusion.jdcloud-api.com'
options.basePath = '/v1' // 默认要设为空""
super(serviceId, options)
}
/**
* 获取当前用户的云注册信息
* @param {Object} opts - parameters
* @param {string} [opts.driver] - 只获取对应driver的云信息 optional
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param cloudInfo clouds
*/
getCloudInfos (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 getCloudInfos"
)
}
opts = opts || {}
let postBody = null
let queryParams = {}
if (opts.driver !== undefined && opts.driver !== null) {
queryParams['driver'] = opts.driver
}
let pathParams = {
regionId: regionId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call getCloudInfos with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/cloud_info',
'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 {cloudInfo} opts.cloud
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param cloudInfo cloud
*/
registCloudInfo (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 registCloudInfo"
)
}
opts = opts || {}
if (opts.cloud === undefined || opts.cloud === null) {
throw new Error(
"Missing the required parameter 'opts.cloud' when calling registCloudInfo"
)
}
let postBody = {}
if (opts.cloud !== undefined && opts.cloud !== null) {
postBody['cloud'] = opts.cloud
}
let queryParams = {}
let pathParams = {
regionId: regionId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call registCloudInfo with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/cloud_info',
'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.cloudId - 云信息ID
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param cloudInfo cloud
*/
getCloudInfoById (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 getCloudInfoById"
)
}
opts = opts || {}
if (opts.cloudId === undefined || opts.cloudId === null) {
throw new Error(
"Missing the required parameter 'opts.cloudId' when calling getCloudInfoById"
)
}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId,
cloudId: opts.cloudId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call getCloudInfoById with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/cloud_info/{cloudId}',
'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.cloudId - 云信息ID
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
*/
unregistCloudInfo (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 unregistCloudInfo"
)
}
opts = opts || {}
if (opts.cloudId === undefined || opts.cloudId === null) {
throw new Error(
"Missing the required parameter 'opts.cloudId' when calling unregistCloudInfo"
)
}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId,
cloudId: opts.cloudId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call unregistCloudInfo with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/cloud_info/{cloudId}',
'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)
}
)
}
/**
* 验证指定云信息的AK、SK
* @param {Object} opts - parameters
* @param {string} opts.cloudId - 云信息ID
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
*/
validCloudInfo (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 validCloudInfo"
)
}
opts = opts || {}
if (opts.cloudId === undefined || opts.cloudId === null) {
throw new Error(
"Missing the required parameter 'opts.cloudId' when calling validCloudInfo"
)
}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId,
cloudId: opts.cloudId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call validCloudInfo with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/cloud_info/{cloudId}/valid',
'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} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param deploymentInfo deployments
*/
getDeployments (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 getDeployments"
)
}
opts = opts || {}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call getDeployments with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/deployments',
'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 {deploymentInfo} opts.deployment - 创建deployment
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param deploymentInfo deployment
*/
createDeployment (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 createDeployment"
)
}
opts = opts || {}
if (opts.deployment === undefined || opts.deployment === null) {
throw new Error(
"Missing the required parameter 'opts.deployment' when calling createDeployment"
)
}
let postBody = {}
if (opts.deployment !== undefined && opts.deployment !== null) {
postBody['deployment'] = opts.deployment
}
let queryParams = {}
let pathParams = {
regionId: regionId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call createDeployment with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/deployments',
'POST',
pathParams,
queryParams,
headerParams,
formParams,
postBody,
contentTypes,
accepts,
returnType,
callback
)
return request.then(
function (result) {
if (callback && typeof callback === 'function') {
return callback(null, result)
}
return result
},
function (error) {
if (callback && typeof callback === 'function') {
return callback(error)
}
return Promise.reject(error)
}
)
}
/**
* 根据已有资源反向生成deployment
* @param {Object} opts - parameters
* @param {reverseDeploymentInfo} opts.reverse - 根据已有资源反向生成deployment
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param deploymentInfo deployment
*/
reverseDeployment (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 reverseDeployment"
)
}
opts = opts || {}
if (opts.reverse === undefined || opts.reverse === null) {
throw new Error(
"Missing the required parameter 'opts.reverse' when calling reverseDeployment"
)
}
let postBody = {}
if (opts.reverse !== undefined && opts.reverse !== null) {
postBody['reverse'] = opts.reverse
}
let queryParams = {}
let pathParams = {
regionId: regionId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call reverseDeployment with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/deployments:reverse',
'POST',
pathParams,
queryParams,
headerParams,
formParams,
postBody,
contentTypes,
accepts,
returnType,
callback
)
return request.then(
function (result) {
if (callback && typeof callback === 'function') {
return callback(null, result)
}
return result
},
function (error) {
if (callback && typeof callback === 'function') {
return callback(error)
}
return Promise.reject(error)
}
)
}
/**
* 查询部署信息
* @param {Object} opts - parameters
* @param {string} opts.id - Deployment ID
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param deploymentInfo deployment
*/
getDeploymentsById (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 getDeploymentsById"
)
}
opts = opts || {}
if (opts.id === undefined || opts.id === null) {
throw new Error(
"Missing the required parameter 'opts.id' when calling getDeploymentsById"
)
}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId,
id: opts.id
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call getDeploymentsById with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/deployments/{id}',
'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.id - Deployment ID
* @param {deploymentInfo} opts.deployment - 修改deployment
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param deploymentInfo deployment
*/
editDeployment (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 editDeployment"
)
}
opts = opts || {}
if (opts.id === undefined || opts.id === null) {
throw new Error(
"Missing the required parameter 'opts.id' when calling editDeployment"
)
}
if (opts.deployment === undefined || opts.deployment === null) {
throw new Error(
"Missing the required parameter 'opts.deployment' when calling editDeployment"
)
}
let postBody = {}
if (opts.deployment !== undefined && opts.deployment !== null) {
postBody['deployment'] = opts.deployment
}
let queryParams = {}
let pathParams = {
regionId: regionId,
id: opts.id
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call editDeployment with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/deployments/{id}',
'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.id - Deployment ID
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
*/
deleteDeployment (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 deleteDeployment"
)
}
opts = opts || {}
if (opts.id === undefined || opts.id === null) {
throw new Error(
"Missing the required parameter 'opts.id' when calling deleteDeployment"
)
}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId,
id: opts.id
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call deleteDeployment with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/deployments/{id}',
'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.id - Deployment ID
* @param {deployment} opts.deployment - 创建deployment
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param deploymentInfo deployment
*/
cloneDeployment (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 cloneDeployment"
)
}
opts = opts || {}
if (opts.id === undefined || opts.id === null) {
throw new Error(
"Missing the required parameter 'opts.id' when calling cloneDeployment"
)
}
if (opts.deployment === undefined || opts.deployment === null) {
throw new Error(
"Missing the required parameter 'opts.deployment' when calling cloneDeployment"
)
}
let postBody = {}
if (opts.deployment !== undefined && opts.deployment !== null) {
postBody['deployment'] = opts.deployment
}
let queryParams = {}
let pathParams = {
regionId: regionId,
id: opts.id
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call cloneDeployment with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/deployments/{id}:clone',
'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.id - Deployment ID
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
*/
dryrunDeployment (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 dryrunDeployment"
)
}
opts = opts || {}
if (opts.id === undefined || opts.id === null) {
throw new Error(
"Missing the required parameter 'opts.id' when calling dryrunDeployment"
)
}
let postBody = {}
let queryParams = {}
let pathParams = {
regionId: regionId,
id: opts.id
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call dryrunDeployment with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/deployments/{id}:dryrun',
'POST',
pathParams,
queryParams,
headerParams,
formParams,
postBody,
contentTypes,
accepts,
returnType,
callback
)
return request.then(
function (result) {
if (callback && typeof callback === 'function') {
return callback(null, result)
}
return result
},
function (error) {
if (callback && typeof callback === 'function') {
return callback(error)
}
return Promise.reject(error)
}
)
}
/**
* 应用部署
* @param {Object} opts - parameters
* @param {string} opts.id - Deployment ID
* @param {apply} opts.apply - 应用部署
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param deploymentInfo deployment
*/
applyDeployment (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 applyDeployment"
)
}
opts = opts || {}
if (opts.id === undefined || opts.id === null) {
throw new Error(
"Missing the required parameter 'opts.id' when calling applyDeployment"
)
}
if (opts.apply === undefined || opts.apply === null) {
throw new Error(
"Missing the required parameter 'opts.apply' when calling applyDeployment"
)
}
let postBody = {}
if (opts.apply !== undefined && opts.apply !== null) {
postBody['apply'] = opts.apply
}
let queryParams = {}
let pathParams = {
regionId: regionId,
id: opts.id
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call applyDeployment with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/deployments/{id}:apply',
'POST',
pathParams,
queryParams,
headerParams,
formParams,
postBody,
contentTypes,
accepts,
returnType,
callback
)
return request.then(
function (result) {
if (callback && typeof callback === 'function') {
return callback(null, result)
}
return result
},
function (error) {
if (callback && typeof callback === 'function') {
return callback(error)
}
return Promise.reject(error)
}
)
}
/**
* 查询执行结果
* @param {Object} opts - parameters
* @param {string} opts.id - deployment ID
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param taskInfo task
*/
getDeploymentResult (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 getDeploymentResult"
)
}
opts = opts || {}
if (opts.id === undefined || opts.id === null) {
throw new Error(
"Missing the required parameter 'opts.id' when calling getDeploymentResult"
)
}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId,
id: opts.id
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call getDeploymentResult with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/deployments/{id}/result',
'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.id - Deployment ID
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param deploymentApplyInfo versions
*/
getDeploymentVersions (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 getDeploymentVersions"
)
}
opts = opts || {}
if (opts.id === undefined || opts.id === null) {
throw new Error(
"Missing the required parameter 'opts.id' when calling getDeploymentVersions"
)
}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId,
id: opts.id
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call getDeploymentVersions with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/deployments/{id}/versions',
'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.id - deployment ID
* @param {string} opts.version_id - application ID
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param deploymentInfo deployment
*/
getDeploymentsVersion (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 getDeploymentsVersion"
)
}
opts = opts || {}
if (opts.id === undefined || opts.id === null) {
throw new Error(
"Missing the required parameter 'opts.id' when calling getDeploymentsVersion"
)
}
if (opts.version_id === undefined || opts.version_id === null) {
throw new Error(
"Missing the required parameter 'opts.version_id' when calling getDeploymentsVersion"
)
}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId,
id: opts.id,
version_id: opts.version_id
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call getDeploymentsVersion with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/deployments/{id}/versions/{version_id}',
'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.id - deployment ID
* @param {string} opts.version_id - application ID
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param deploymentInfo deployment
*/
rollbackDeploymentsVersion (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 rollbackDeploymentsVersion"
)
}
opts = opts || {}
if (opts.id === undefined || opts.id === null) {
throw new Error(
"Missing the required parameter 'opts.id' when calling rollbackDeploymentsVersion"
)
}
if (opts.version_id === undefined || opts.version_id === null) {
throw new Error(
"Missing the required parameter 'opts.version_id' when calling rollbackDeploymentsVersion"
)
}
let postBody = {}
let queryParams = {}
let pathParams = {
regionId: regionId,
id: opts.id,
version_id: opts.version_id
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call rollbackDeploymentsVersion with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/deployments/{id}/versions/{version_id}:rollback',
'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.id - deployment ID
* @param {string} opts.record - deployment ID
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param taskInfo task
*/
getDeploymentsResultsByIdRecord (
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 getDeploymentsResultsByIdRecord"
)
}
opts = opts || {}
if (opts.id === undefined || opts.id === null) {
throw new Error(
"Missing the required parameter 'opts.id' when calling getDeploymentsResultsByIdRecord"
)
}
if (opts.record === undefined || opts.record === null) {
throw new Error(
"Missing the required parameter 'opts.record' when calling getDeploymentsResultsByIdRecord"
)
}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId,
id: opts.id,
record: opts.record
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call getDeploymentsResultsByIdRecord with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/deployments/{id}/results/{record}',
'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.vmId] - 云主机id optional
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param cloudDataDisk disks
*/
getDisks (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 getDisks"
)
}
opts = opts || {}
let postBody = null
let queryParams = {}
if (opts.vmId !== undefined && opts.vmId !== null) {
queryParams['vmId'] = opts.vmId
}
let pathParams = {
regionId: regionId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call getDisks with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/disk_disks',
'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 {createDataDisk} opts.disk - 创建云硬盘
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param resourceTFInfo task
*/
createDisk (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 createDisk"
)
}
opts = opts || {}
if (opts.disk === undefined || opts.disk === null) {
throw new Error(
"Missing the required parameter 'opts.disk' when calling createDisk"
)
}
let postBody = {}
if (opts.disk !== undefined && opts.disk !== null) {
postBody['disk'] = opts.disk
}
let queryParams = {}
let pathParams = {
regionId: regionId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call createDisk with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/disk_disks',
'POST',
pathParams,
queryParams,
headerParams,
formParams,
postBody,
contentTypes,
accepts,
returnType,
callback
)
return request.then(
function (result) {
if (callback && typeof callback === 'function') {
return callback(null, result)
}
return result
},
function (error) {
if (callback && typeof callback === 'function') {
return callback(error)
}
return Promise.reject(error)
}
)
}
/**
* 根据云提供商查询对应的云硬盘资源信息
* @param {Object} opts - parameters
* @param {string} opts.id - 云硬盘 ID
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param cloudDataDisk disk
*/
getDiskById (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 getDiskById"
)
}
opts = opts || {}
if (opts.id === undefined || opts.id === null) {
throw new Error(
"Missing the required parameter 'opts.id' when calling getDiskById"
)
}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId,
id: opts.id
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call getDiskById with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/disk_disks/{id}',
'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.id - 云硬盘 ID
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
*/
removeDiskById (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 removeDiskById"
)
}
opts = opts || {}
if (opts.id === undefined || opts.id === null) {
throw new Error(
"Missing the required parameter 'opts.id' when calling removeDiskById"
)
}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId,
id: opts.id
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call removeDiskById with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/disk_disks/{id}',
'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.id - 云硬盘 ID
* @param {attachDataDisk} opts.attach - 云硬盘挂载至虚拟机
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param resourceTFInfo task
*/
attachDiskToVmInstanceByDiskId (
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 attachDiskToVmInstanceByDiskId"
)
}
opts = opts || {}
if (opts.id === undefined || opts.id === null) {
throw new Error(
"Missing the required parameter 'opts.id' when calling attachDiskToVmInstanceByDiskId"
)
}
if (opts.attach === undefined || opts.attach === null) {
throw new Error(
"Missing the required parameter 'opts.attach' when calling attachDiskToVmInstanceByDiskId"
)
}
let postBody = {}
if (opts.attach !== undefined && opts.attach !== null) {
postBody['attach'] = opts.attach
}
let queryParams = {}
let pathParams = {
regionId: regionId,
id: opts.id
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call attachDiskToVmInstanceByDiskId with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/disk_disks/{id}:attach',
'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.id - 云硬盘 ID
* @param {detachDataDisk} opts.detach - 从虚拟机卸载云硬盘
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
*/
detachDiskToVmInstanceByDiskId (
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 detachDiskToVmInstanceByDiskId"
)
}
opts = opts || {}
if (opts.id === undefined || opts.id === null) {
throw new Error(
"Missing the required parameter 'opts.id' when calling detachDiskToVmInstanceByDiskId"
)
}
if (opts.detach === undefined || opts.detach === null) {
throw new Error(
"Missing the required parameter 'opts.detach' when calling detachDiskToVmInstanceByDiskId"
)
}
let postBody = {}
if (opts.detach !== undefined && opts.detach !== null) {
postBody['detach'] = opts.detach
}
let queryParams = {}
let pathParams = {
regionId: regionId,
id: opts.id
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call detachDiskToVmInstanceByDiskId with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/disk_disks/{id}:detach',
'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)
}
)
}
/**
* 根据云提供商查询对应的OSS存储桶列表
* @param {Object} opts - parameters
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param ossBucketInfo buckets
*/
getBuckets (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 getBuckets"
)
}
opts = opts || {}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call getBuckets with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/oss_buckets',
'GET',
pathParams,
queryParams,
headerParams,
formParams,
postBody,
contentTypes,
accepts,
returnType,
callback
)
return request.then(
function (result) {
if (callback && typeof callback === 'function') {
return callback(null, result)
}
return result
},
function (error) {
if (callback && typeof callback === 'function') {
return callback(error)
}
return Promise.reject(error)
}
)
}
/**
* 根据给定的信息,创建OSS存储桶
* @param {Object} opts - parameters
* @param {createOSSBucket} opts.bucket - 创建OSS存储桶
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param resourceTFInfo task
*/
createBucket (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 createBucket"
)
}
opts = opts || {}
if (opts.bucket === undefined || opts.bucket === null) {
throw new Error(
"Missing the required parameter 'opts.bucket' when calling createBucket"
)
}
let postBody = {}
if (opts.bucket !== undefined && opts.bucket !== null) {
postBody['bucket'] = opts.bucket
}
let queryParams = {}
let pathParams = {
regionId: regionId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call createBucket with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/oss_buckets',
'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)
}
)
}
/**
* 根据云提供商查询对应的OSS存储桶信息
* @param {Object} opts - parameters
* @param {string} opts.name - OSS存储桶名称
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param ossBucketDetailInfo bucket
*/
getBucketByName (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 getBucketByName"
)
}
opts = opts || {}
if (opts.name === undefined || opts.name === null) {
throw new Error(
"Missing the required parameter 'opts.name' when calling getBucketByName"
)
}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId,
name: opts.name
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call getBucketByName with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/oss_buckets/{name}',
'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)
}
)
}
/**
* 删除指定ID的OSS存储桶信息
* @param {Object} opts - parameters
* @param {string} opts.name - OSS存储桶名称
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
*/
deleteBucket (opts, regionId = this.config.regionId, callback) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling deleteBucket"
)
}
opts = opts || {}
if (opts.name === undefined || opts.name === null) {
throw new Error(
"Missing the required parameter 'opts.name' when calling deleteBucket"
)
}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId,
name: opts.name
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call deleteBucket with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/oss_buckets/{name}',
'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)
}
)
}
/**
* 根据过滤条件,取得指定OSS存储桶上的文件列表
* @param {Object} opts - parameters
* @param {string} opts.name - OSS存储桶名称
* @param {string} [opts.marker] - 本次查询的起点(文件key值) optional
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param boolean isTruncated 是否已被截断(表示没有更多数据了)
* @param string marker 本次查询的起点(文件key值)
* @param ossFileInfo files
*/
getBucketFiles (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 getBucketFiles"
)
}
opts = opts || {}
if (opts.name === undefined || opts.name === null) {
throw new Error(
"Missing the required parameter 'opts.name' when calling getBucketFiles"
)
}
let postBody = null
let queryParams = {}
if (opts.marker !== undefined && opts.marker !== null) {
queryParams['marker'] = opts.marker
}
let pathParams = {
regionId: regionId,
name: opts.name
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call getBucketFiles with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/oss_buckets/{name}/files',
'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} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param transferTaskInfoWithID tasks
*/
getTransferTasks (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 getTransferTasks"
)
}
opts = opts || {}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call getTransferTasks with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/oss_transferTasks',
'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 {transferSimpleTaskInfo} [opts.task] optional
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param transferTaskInfoWithID task
*/
createTransferTask (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 createTransferTask"
)
}
opts = opts || {}
let postBody = {}
if (opts.task !== undefined && opts.task !== null) {
postBody['task'] = opts.task
}
let queryParams = {}
let pathParams = {
regionId: regionId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call createTransferTask with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/oss_transferTasks_simple',
'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)
}
)
}
/**
* 根据指定ID获取任务信息
* @param {Object} opts - parameters
* @param {string} opts.id - 用户ID
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param transferTaskInfoWithID task
*/
getTransferTaskById (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 getTransferTaskById"
)
}
opts = opts || {}
if (opts.id === undefined || opts.id === null) {
throw new Error(
"Missing the required parameter 'opts.id' when calling getTransferTaskById"
)
}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId,
id: opts.id
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call getTransferTaskById with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/oss_transferTasks/{id}',
'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)
}
)
}
/**
* 根据指定ID修改任务
* @param {Object} opts - parameters
* @param {string} opts.id - 任务ID
* @param {transferTaskInfo} [opts.task] optional
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
*/
editTransferTask (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 editTransferTask"
)
}
opts = opts || {}
if (opts.id === undefined || opts.id === null) {
throw new Error(
"Missing the required parameter 'opts.id' when calling editTransferTask"
)
}
let postBody = {}
if (opts.task !== undefined && opts.task !== null) {
postBody['task'] = opts.task
}
let queryParams = {}
let pathParams = {
regionId: regionId,
id: opts.id
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call editTransferTask with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/oss_transferTasks/{id}',
'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)
}
)
}
/**
* 根据指定ID删除任务
* @param {Object} opts - parameters
* @param {string} opts.id - 任务ID
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
*/
deleteTransferTask (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 deleteTransferTask"
)
}
opts = opts || {}
if (opts.id === undefined || opts.id === null) {
throw new Error(
"Missing the required parameter 'opts.id' when calling deleteTransferTask"
)
}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId,
id: opts.id
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call deleteTransferTask with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/oss_transferTasks/{id}',
'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)
}
)
}
/**
* 根据指定ID启动任务
* @param {Object} opts - parameters
* @param {string} opts.id - 用户ID
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
*/
startTransferTask (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 startTransferTask"
)
}
opts = opts || {}
if (opts.id === undefined || opts.id === null) {
throw new Error(
"Missing the required parameter 'opts.id' when calling startTransferTask"
)
}
let postBody = {}
let queryParams = {}
let pathParams = {
regionId: regionId,
id: opts.id
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call startTransferTask with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/oss_transferTasks/{id}:start',
'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)
}
)
}
/**
* 根据指定ID停止任务
* @param {Object} opts - parameters
* @param {string} opts.id - 用户ID
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
*/
stopTransferTask (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 stopTransferTask"
)
}
opts = opts || {}
if (opts.id === undefined || opts.id === null) {
throw new Error(
"Missing the required parameter 'opts.id' when calling stopTransferTask"
)
}
let postBody = {}
let queryParams = {}
let pathParams = {
regionId: regionId,
id: opts.id
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call stopTransferTask with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/oss_transferTasks/{id}:stop',
'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)
}
)
}
/**
* 根据指定任务id查询迁移进度
* @param {Object} opts - parameters
* @param {string} opts.id - 任务ID
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param transferTaskProgressInfo task
*/
getTransferTaskProgress (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 getTransferTaskProgress"
)
}
opts = opts || {}
if (opts.id === undefined || opts.id === null) {
throw new Error(
"Missing the required parameter 'opts.id' when calling getTransferTaskProgress"
)
}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId,
id: opts.id
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call getTransferTaskProgress with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/oss_transferTasks/{id}/progress',
'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)
}
)
}
/**
* 根据指定任务id查询迁移失败文件列表
* @param {Object} opts - parameters
* @param {string} opts.id - 任务ID
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param transferTaskFailedDetailInfo task
*/
getTransferTaskFailedFiles (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 getTransferTaskFailedFiles"
)
}
opts = opts || {}
if (opts.id === undefined || opts.id === null) {
throw new Error(
"Missing the required parameter 'opts.id' when calling getTransferTaskFailedFiles"
)
}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId,
id: opts.id
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call getTransferTaskFailedFiles with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/oss_transferTasks/{id}/failed-files',
'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)
}
)
}
/**
* 根据过滤条件,取得指定RDS实例上的账号信息
* @param {Object} opts - parameters
* @param {string} opts.instId - RDS实例ID
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param rdsAccountInfo accounts
*/
getRdsAccountsByInstId (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 getRdsAccountsByInstId"
)
}
opts = opts || {}
if (opts.instId === undefined || opts.instId === null) {
throw new Error(
"Missing the required parameter 'opts.instId' when calling getRdsAccountsByInstId"
)
}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId,
instId: opts.instId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call getRdsAccountsByInstId with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/rds_instances/{instId}/accounts',
'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)
}
)
}
/**
* 根据给定的信息,创建指定RDS实例的账户
* @param {Object} opts - parameters
* @param {string} opts.instId - RDS实例ID
* @param {createRDSAccount} opts.account - 创建RDS实例的账号信息
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param resourceTFInfo task
*/
createRdsAccounts (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 createRdsAccounts"
)
}
opts = opts || {}
if (opts.instId === undefined || opts.instId === null) {
throw new Error(
"Missing the required parameter 'opts.instId' when calling createRdsAccounts"
)
}
if (opts.account === undefined || opts.account === null) {
throw new Error(
"Missing the required parameter 'opts.account' when calling createRdsAccounts"
)
}
let postBody = {}
if (opts.account !== undefined && opts.account !== null) {
postBody['account'] = opts.account
}
let queryParams = {}
let pathParams = {
regionId: regionId,
instId: opts.instId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call createRdsAccounts with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/rds_instances/{instId}/accounts',
'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)
}
)
}
/**
* 取得指定RDS实例上的指定账号信息
* @param {Object} opts - parameters
* @param {string} opts.instId - RDS实例ID
* @param {string} opts.accountName - 账号名称
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param rdsAccountInfo account
*/
getRdsAccountsByInstIdAndAccountName (
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 getRdsAccountsByInstIdAndAccountName"
)
}
opts = opts || {}
if (opts.instId === undefined || opts.instId === null) {
throw new Error(
"Missing the required parameter 'opts.instId' when calling getRdsAccountsByInstIdAndAccountName"
)
}
if (opts.accountName === undefined || opts.accountName === null) {
throw new Error(
"Missing the required parameter 'opts.accountName' when calling getRdsAccountsByInstIdAndAccountName"
)
}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId,
instId: opts.instId,
accountName: opts.accountName
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call getRdsAccountsByInstIdAndAccountName with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/rds_instances/{instId}/accounts/{accountName}',
'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)
}
)
}
/**
* 删除指定RDS实例上,指定用户名的账号信息
* @param {Object} opts - parameters
* @param {string} opts.instId - RDS实例ID
* @param {string} opts.accountName - 账号用户名
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
*/
deleteRdsAccount (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 deleteRdsAccount"
)
}
opts = opts || {}
if (opts.instId === undefined || opts.instId === null) {
throw new Error(
"Missing the required parameter 'opts.instId' when calling deleteRdsAccount"
)
}
if (opts.accountName === undefined || opts.accountName === null) {
throw new Error(
"Missing the required parameter 'opts.accountName' when calling deleteRdsAccount"
)
}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId,
instId: opts.instId,
accountName: opts.accountName
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call deleteRdsAccount with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/rds_instances/{instId}/accounts/{accountName}',
'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)
}
)
}
/**
* 给RDS账号分配数据库权限
* @param {Object} opts - parameters
* @param {string} opts.instId - RDS实例ID
* @param {string} opts.accountName - 账号名称
* @param {dbPrivilegeInfo} opts.dbPrivilegeInfo - RDS账号对数据库的权限信息
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
*/
grantRdsAccount (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 grantRdsAccount"
)
}
opts = opts || {}
if (opts.instId === undefined || opts.instId === null) {
throw new Error(
"Missing the required parameter 'opts.instId' when calling grantRdsAccount"
)
}
if (opts.accountName === undefined || opts.accountName === null) {
throw new Error(
"Missing the required parameter 'opts.accountName' when calling grantRdsAccount"
)
}
if (opts.dbPrivilegeInfo === undefined || opts.dbPrivilegeInfo === null) {
throw new Error(
"Missing the required parameter 'opts.dbPrivilegeInfo' when calling grantRdsAccount"
)
}
let postBody = {}
if (opts.dbPrivilegeInfo !== undefined && opts.dbPrivilegeInfo !== null) {
postBody['dbPrivilegeInfo'] = opts.dbPrivilegeInfo
}
let queryParams = {}
let pathParams = {
regionId: regionId,
instId: opts.instId,
accountName: opts.accountName
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call grantRdsAccount with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/rds_instances/{instId}/accounts/{accountName}:grant',
'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)
}
)
}
/**
* 撤销RDS账号在指定数据库的所有权限
* @param {Object} opts - parameters
* @param {string} opts.instId - RDS实例ID
* @param {string} opts.accountName - 账号名称
* @param {string} opts.dbName - 数据库名称
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
*/
revokeRdsAccount (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 revokeRdsAccount"
)
}
opts = opts || {}
if (opts.instId === undefined || opts.instId === null) {
throw new Error(
"Missing the required parameter 'opts.instId' when calling revokeRdsAccount"
)
}
if (opts.accountName === undefined || opts.accountName === null) {
throw new Error(
"Missing the required parameter 'opts.accountName' when calling revokeRdsAccount"
)
}
if (opts.dbName === undefined || opts.dbName === null) {
throw new Error(
"Missing the required parameter 'opts.dbName' when calling revokeRdsAccount"
)
}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId,
instId: opts.instId,
accountName: opts.accountName,
dbName: opts.dbName
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call revokeRdsAccount with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/rds_instances/{instId}/accounts/{accountName}/databases/{dbName}:revoke',
'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)
}
)
}
/**
* 通过异步任务,给RDS账号分配数据库权限
* @param {Object} opts - parameters
* @param {string} opts.instId - RDS实例ID
* @param {string} opts.accountName - 账号名称
* @param {dbPrivilegeInfo} opts.info - RDS账号对数据库的权限信息
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param resourceTFInfo cloud
*/
grantRdsAccountsByTask (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 grantRdsAccountsByTask"
)
}
opts = opts || {}
if (opts.instId === undefined || opts.instId === null) {
throw new Error(
"Missing the required parameter 'opts.instId' when calling grantRdsAccountsByTask"
)
}
if (opts.accountName === undefined || opts.accountName === null) {
throw new Error(
"Missing the required parameter 'opts.accountName' when calling grantRdsAccountsByTask"
)
}
if (opts.info === undefined || opts.info === null) {
throw new Error(
"Missing the required parameter 'opts.info' when calling grantRdsAccountsByTask"
)
}
let postBody = {}
if (opts.info !== undefined && opts.info !== null) {
postBody['info'] = opts.info
}
let queryParams = {}
let pathParams = {
regionId: regionId,
instId: opts.instId,
accountName: opts.accountName
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call grantRdsAccountsByTask with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/rds_instances/{instId}/accounts/{accountName}:grantByTask',
'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)
}
)
}
/**
* 根据过滤条件,取得指定RDS实例上的数据库信息
* @param {Object} opts - parameters
* @param {string} opts.instId - RDS实例ID
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param rdsDBInfo dbs
*/
getRdsDatabasesByInstId (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 getRdsDatabasesByInstId"
)
}
opts = opts || {}
if (opts.instId === undefined || opts.instId === null) {
throw new Error(
"Missing the required parameter 'opts.instId' when calling getRdsDatabasesByInstId"
)
}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId,
instId: opts.instId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call getRdsDatabasesByInstId with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/rds_instances/{instId}/databases',
'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)
}
)
}
/**
* 根据给定的信息,创建指定RDS实例的数据库
* @param {Object} opts - parameters
* @param {string} opts.instId - RDS实例ID
* @param {createRDSDB} opts.database - 创建RDS实例的数据库信息
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param resourceTFInfo task
*/
createRdsDatabase (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 createRdsDatabase"
)
}
opts = opts || {}
if (opts.instId === undefined || opts.instId === null) {
throw new Error(
"Missing the required parameter 'opts.instId' when calling createRdsDatabase"
)
}
if (opts.database === undefined || opts.database === null) {
throw new Error(
"Missing the required parameter 'opts.database' when calling createRdsDatabase"
)
}
let postBody = {}
if (opts.database !== undefined && opts.database !== null) {
postBody['database'] = opts.database
}
let queryParams = {}
let pathParams = {
regionId: regionId,
instId: opts.instId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call createRdsDatabase with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/rds_instances/{instId}/databases',
'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)
}
)
}
/**
* 根据过滤条件,取得指定RDS实例上的数据库信息
* @param {Object} opts - parameters
* @param {string} opts.instId - RDS实例ID
* @param {string} opts.dbName - 数据库名称
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param rdsDBInfo db
*/
getRdsDatabaseByInstIdAndDbName (
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 getRdsDatabaseByInstIdAndDbName"
)
}
opts = opts || {}
if (opts.instId === undefined || opts.instId === null) {
throw new Error(
"Missing the required parameter 'opts.instId' when calling getRdsDatabaseByInstIdAndDbName"
)
}
if (opts.dbName === undefined || opts.dbName === null) {
throw new Error(
"Missing the required parameter 'opts.dbName' when calling getRdsDatabaseByInstIdAndDbName"
)
}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId,
instId: opts.instId,
dbName: opts.dbName
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call getRdsDatabaseByInstIdAndDbName with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/rds_instances/{instId}/databases/{dbName}',
'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)
}
)
}
/**
* 删除指定RDS实例上,指定数据库名的数据库信息
* @param {Object} opts - parameters
* @param {string} opts.instId - RDS实例ID
* @param {string} opts.dbName - 数据库名称
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
*/
deleteRdsDatabase (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 deleteRdsDatabase"
)
}
opts = opts || {}
if (opts.instId === undefined || opts.instId === null) {
throw new Error(
"Missing the required parameter 'opts.instId' when calling deleteRdsDatabase"
)
}
if (opts.dbName === undefined || opts.dbName === null) {
throw new Error(
"Missing the required parameter 'opts.dbName' when calling deleteRdsDatabase"
)
}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId,
instId: opts.instId,
dbName: opts.dbName
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call deleteRdsDatabase with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/rds_instances/{instId}/databases/{dbName}',
'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)
}
)
}
/**
* 根据云提供商查询对应的RDS实例信息
* @param {Object} opts - parameters
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param rdsInstanceDetailInfo instances
*/
getRdsInstances (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 getRdsInstances"
)
}
opts = opts || {}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call getRdsInstances with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/rds_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)
}
)
}
/**
* 根据给定的信息,创建RDS实例
* @param {Object} opts - parameters
* @param {createRDSInstance} opts.instance - 创建RDS实例
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param resourceTFInfo task
*/
createRdsInstance (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 createRdsInstance"
)
}
opts = opts || {}
if (opts.instance === undefined || opts.instance === null) {
throw new Error(
"Missing the required parameter 'opts.instance' when calling createRdsInstance"
)
}
let postBody = {}
if (opts.instance !== undefined && opts.instance !== null) {
postBody['instance'] = opts.instance
}
let queryParams = {}
let pathParams = {
regionId: regionId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call createRdsInstance with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/rds_instances',
'POST',
pathParams,
queryParams,
headerParams,
formParams,
postBody,
contentTypes,
accepts,
returnType,
callback
)
return request.then(
function (result) {
if (callback && typeof callback === 'function') {
return callback(null, result)
}
return result
},
function (error) {
if (callback && typeof callback === 'function') {
return callback(error)
}
return Promise.reject(error)
}
)
}
/**
* 查询指定ID的RDS实例信息
* @param {Object} opts - parameters
* @param {string} opts.instId - RDS实例ID
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param rdsInstanceDetailInfo instance
*/
getRdsByInstId (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 getRdsByInstId"
)
}
opts = opts || {}
if (opts.instId === undefined || opts.instId === null) {
throw new Error(
"Missing the required parameter 'opts.instId' when calling getRdsByInstId"
)
}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId,
instId: opts.instId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call getRdsByInstId with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/rds_instances/{instId}',
'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)
}
)
}
/**
* 删除指定ID的RDS实例信息
* @param {Object} opts - parameters
* @param {string} opts.instId - RDS实例ID
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
*/
deleteRdsByInstId (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 deleteRdsByInstId"
)
}
opts = opts || {}
if (opts.instId === undefined || opts.instId === null) {
throw new Error(
"Missing the required parameter 'opts.instId' when calling deleteRdsByInstId"
)
}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId,
instId: opts.instId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call deleteRdsByInstId with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/rds_instances/{instId}',
'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} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param channelInfo channels
*/
getChannels (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 getChannels"
)
}
opts = opts || {}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call getChannels with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/migration_mysqlChannels',
'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 {channelInfo} opts.channel - 创建channel
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param channelInfo channel
*/
createChannel (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 createChannel"
)
}
opts = opts || {}
if (opts.channel === undefined || opts.channel === null) {
throw new Error(
"Missing the required parameter 'opts.channel' when calling createChannel"
)
}
let postBody = {}
if (opts.channel !== undefined && opts.channel !== null) {
postBody['channel'] = opts.channel
}
let queryParams = {}
let pathParams = {
regionId: regionId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call createChannel with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/migration_mysqlChannels',
'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)
}
)
}
/**
* 删除channel
* @param {Object} opts - parameters
* @param {string} opts.id - channel ID
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
*/
deleteChannel (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 deleteChannel"
)
}
opts = opts || {}
if (opts.id === undefined || opts.id === null) {
throw new Error(
"Missing the required parameter 'opts.id' when calling deleteChannel"
)
}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId,
id: opts.id
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call deleteChannel with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/migration_mysqlChannels/{id}',
'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.id - channel ID
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
*/
startChannel (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 startChannel"
)
}
opts = opts || {}
if (opts.id === undefined || opts.id === null) {
throw new Error(
"Missing the required parameter 'opts.id' when calling startChannel"
)
}
let postBody = {}
let queryParams = {}
let pathParams = {
regionId: regionId,
id: opts.id
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call startChannel with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/migration_mysqlChannels/{id}:start',
'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.id - channel ID
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
*/
stopChannel (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 stopChannel"
)
}
opts = opts || {}
if (opts.id === undefined || opts.id === null) {
throw new Error(
"Missing the required parameter 'opts.id' when calling stopChannel"
)
}
let postBody = {}
let queryParams = {}
let pathParams = {
regionId: regionId,
id: opts.id
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call stopChannel with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/migration_mysqlChannels/{id}:stop',
'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} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param datasourceInfo datasources
*/
getDatasources (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 getDatasources"
)
}
opts = opts || {}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call getDatasources with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/migration_mysqlDatasources',
'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 {datasourceInfo} opts.datasource - 创建数据源
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param datasourceInfo datasource
*/
createDatasource (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 createDatasource"
)
}
opts = opts || {}
if (opts.datasource === undefined || opts.datasource === null) {
throw new Error(
"Missing the required parameter 'opts.datasource' when calling createDatasource"
)
}
let postBody = {}
if (opts.datasource !== undefined && opts.datasource !== null) {
postBody['datasource'] = opts.datasource
}
let queryParams = {}
let pathParams = {
regionId: regionId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call createDatasource with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/migration_mysqlDatasources',
'POST',
pathParams,
queryParams,
headerParams,
formParams,
postBody,
contentTypes,
accepts,
returnType,
callback
)
return request.then(
function (result) {
if (callback && typeof callback === 'function') {
return callback(null, result)
}
return result
},
function (error) {
if (callback && typeof callback === 'function') {
return callback(error)
}
return Promise.reject(error)
}
)
}
/**
* 删除数据源
* @param {Object} opts - parameters
* @param {string} opts.id - channel ID
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
*/
deleteDatasource (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 deleteDatasource"
)
}
opts = opts || {}
if (opts.id === undefined || opts.id === null) {
throw new Error(
"Missing the required parameter 'opts.id' when calling deleteDatasource"
)
}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId,
id: opts.id
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call deleteDatasource with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/migration_mysqlDatasources/{id}',
'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)
}
)
}
/**
* 根据数据库类型,取得RDS实例的规格
* @param {Object} opts - parameters
* @param {string} opts.engine - RDS数据库引擎,目前只支持mysql
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param rdsSpecification specifications
*/
getRdsSpecification (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 getRdsSpecification"
)
}
opts = opts || {}
if (opts.engine === undefined || opts.engine === null) {
throw new Error(
"Missing the required parameter 'opts.engine' when calling getRdsSpecification"
)
}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId,
engine: opts.engine
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call getRdsSpecification with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/rds_specification/{engine}',
'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} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param regionInfo regions
*/
getRegions (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 getRegions"
)
}
opts = opts || {}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call getRegions with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/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} opts.region - 区域id
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param azInfo azs
*/
getRegionsAvailableZones (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 getRegionsAvailableZones"
)
}
opts = opts || {}
if (opts.region === undefined || opts.region === null) {
throw new Error(
"Missing the required parameter 'opts.region' when calling getRegionsAvailableZones"
)
}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId,
region: opts.region
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call getRegionsAvailableZones with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/regions_availableZones/{region}',
'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)
}
)
}
/**
* 读取指定ID的运行结果和运行状态
* @param {Object} opts - parameters
* @param {string} opts.task - 执行请求 ID
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param taskInfo tasks
*/
getTaskInfoHistoryById (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 getTaskInfoHistoryById"
)
}
opts = opts || {}
if (opts.task === undefined || opts.task === null) {
throw new Error(
"Missing the required parameter 'opts.task' when calling getTaskInfoHistoryById"
)
}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId,
task: opts.task
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call getTaskInfoHistoryById with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/task_infos/{task}/history',
'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)
}
)
}
/**
* 读取指定ID的运行结果和运行状态
* @param {Object} opts - parameters
* @param {string} opts.task - 执行请求 ID
* @param {string} [opts.fileName] - 执行文件名称 optional
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param taskInfo task
*/
getTaskInfoById (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 getTaskInfoById"
)
}
opts = opts || {}
if (opts.task === undefined || opts.task === null) {
throw new Error(
"Missing the required parameter 'opts.task' when calling getTaskInfoById"
)
}
let postBody = null
let queryParams = {}
if (opts.fileName !== undefined && opts.fileName !== null) {
queryParams['fileName'] = opts.fileName
}
let pathParams = {
regionId: regionId,
task: opts.task
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call getTaskInfoById with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/task_infos/{task}',
'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.imageSource] - 镜像来源: system:系统官方公共镜像。 self:用户自定义镜像。 others:用户共享的镜像。 marketplace:镜像市场云市场 提供的镜像。 optional
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param imageInfo images
*/
getVmImages (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 getVmImages"
)
}
opts = opts || {}
let postBody = null
let queryParams = {}
if (opts.imageSource !== undefined && opts.imageSource !== null) {
queryParams['imageSource'] = opts.imageSource
}
let pathParams = {
regionId: regionId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call getVmImages with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/vm_images',
'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)
}
)
}
/**
* 根据云提供商查询对应的VM资源信息
* @param {Object} opts - parameters
* @param {string} opts.id - 资源实例ID
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param vmInfoDetail vm
*/
getVmInstancesById (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 getVmInstancesById"
)
}
opts = opts || {}
if (opts.id === undefined || opts.id === null) {
throw new Error(
"Missing the required parameter 'opts.id' when calling getVmInstancesById"
)
}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId,
id: opts.id
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call getVmInstancesById with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/vm_instances/{id}',
'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)
}
)
}
/**
* 通过虚拟机id删除虚拟机
* @param {Object} opts - parameters
* @param {string} opts.id - 资源实例ID
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
*/
deleteVmInstanceById (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 deleteVmInstanceById"
)
}
opts = opts || {}
if (opts.id === undefined || opts.id === null) {
throw new Error(
"Missing the required parameter 'opts.id' when calling deleteVmInstanceById"
)
}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId,
id: opts.id
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call deleteVmInstanceById with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/vm_instances/{id}',
'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} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param vmInfo vms
*/
getVmInstances (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 getVmInstances"
)
}
opts = opts || {}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call getVmInstances with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/vm_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)
}
)
}
/**
* 根据云提供商创建虚拟机
* @param {Object} opts - parameters
* @param {createVm} opts.vm - 创建VM
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param resourceTFInfo task
*/
createVmInstance (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 createVmInstance"
)
}
opts = opts || {}
if (opts.vm === undefined || opts.vm === null) {
throw new Error(
"Missing the required parameter 'opts.vm' when calling createVmInstance"
)
}
let postBody = {}
if (opts.vm !== undefined && opts.vm !== null) {
postBody['vm'] = opts.vm
}
let queryParams = {}
let pathParams = {
regionId: regionId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call createVmInstance with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/vm_instances',
'POST',
pathParams,
queryParams,
headerParams,
formParams,
postBody,
contentTypes,
accepts,
returnType,
callback
)
return request.then(
function (result) {
if (callback && typeof callback === 'function') {
return callback(null, result)
}
return result
},
function (error) {
if (callback && typeof callback === 'function') {
return callback(error)
}
return Promise.reject(error)
}
)
}
/**
* 停止运行一台实例。只有状态为 运行中(Running)的实例才可以进行此操作。
* @param {Object} opts - parameters
* @param {string} opts.id - 资源实例ID
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
*/
stopVmInstanceById (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 stopVmInstanceById"
)
}
opts = opts || {}
if (opts.id === undefined || opts.id === null) {
throw new Error(
"Missing the required parameter 'opts.id' when calling stopVmInstanceById"
)
}
let postBody = {}
let queryParams = {}
let pathParams = {
regionId: regionId,
id: opts.id
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call stopVmInstanceById with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/vm_instances/{id}:stop',
'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.id - 资源实例ID
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
*/
startVmInstanceById (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 startVmInstanceById"
)
}
opts = opts || {}
if (opts.id === undefined || opts.id === null) {
throw new Error(
"Missing the required parameter 'opts.id' when calling startVmInstanceById"
)
}
let postBody = {}
let queryParams = {}
let pathParams = {
regionId: regionId,
id: opts.id
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call startVmInstanceById with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/vm_instances/{id}:start',
'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)的实例。
* @param {Object} opts - parameters
* @param {string} opts.id - 资源实例ID
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
*/
rebootVmInstanceById (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 rebootVmInstanceById"
)
}
opts = opts || {}
if (opts.id === undefined || opts.id === null) {
throw new Error(
"Missing the required parameter 'opts.id' when calling rebootVmInstanceById"
)
}
let postBody = {}
let queryParams = {}
let pathParams = {
regionId: regionId,
id: opts.id
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call rebootVmInstanceById with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/vm_instances/{id}:reboot',
'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.az] - 可用区 optional
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param instanceTypeInfo instanceTypes
*/
getVmInstanceTypes (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 getVmInstanceTypes"
)
}
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 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call getVmInstanceTypes with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/vm_instanceTypes',
'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.name - keypair name
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param keypairInfo keypair
*/
getVmKeypairsByName (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 getVmKeypairsByName"
)
}
opts = opts || {}
if (opts.name === undefined || opts.name === null) {
throw new Error(
"Missing the required parameter 'opts.name' when calling getVmKeypairsByName"
)
}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId,
name: opts.name
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call getVmKeypairsByName with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/vm_keypairs/{name}',
'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.name - keypair name
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
*/
deleteVmKeypairByName (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 deleteVmKeypairByName"
)
}
opts = opts || {}
if (opts.name === undefined || opts.name === null) {
throw new Error(
"Missing the required parameter 'opts.name' when calling deleteVmKeypairByName"
)
}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId,
name: opts.name
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call deleteVmKeypairByName with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/vm_keypairs/{name}',
'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} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param keypairInfo keypairs
*/
getVmKeypairs (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 getVmKeypairs"
)
}
opts = opts || {}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call getVmKeypairs with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/vm_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 {createKeypair} opts.keypair - 创建keypair
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param resourceTFInfo tasks
*/
createVmKeypair (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 createVmKeypair"
)
}
opts = opts || {}
if (opts.keypair === undefined || opts.keypair === null) {
throw new Error(
"Missing the required parameter 'opts.keypair' when calling createVmKeypair"
)
}
let postBody = {}
if (opts.keypair !== undefined && opts.keypair !== null) {
postBody['keypair'] = opts.keypair
}
let queryParams = {}
let pathParams = {
regionId: regionId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call createVmKeypair with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/vm_keypairs',
'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资源信息
* @param {Object} opts - parameters
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param eipAddress eipAddresses
*/
getVpcEips (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 getVpcEips"
)
}
opts = opts || {}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call getVpcEips with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/vpc_eips',
'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 {allocateEipAddress} opts.allocate - 分配弹性公网ip
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param resourceTFInfo task
*/
createVpcEip (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 createVpcEip"
)
}
opts = opts || {}
if (opts.allocate === undefined || opts.allocate === null) {
throw new Error(
"Missing the required parameter 'opts.allocate' when calling createVpcEip"
)
}
let postBody = {}
if (opts.allocate !== undefined && opts.allocate !== null) {
postBody['allocate'] = opts.allocate
}
let queryParams = {}
let pathParams = {
regionId: regionId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call createVpcEip with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/vpc_eips',
'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资源信息
* @param {Object} opts - parameters
* @param {string} opts.id - 公网IP ID
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param eipAddress eipAddress
*/
getVpcEipById (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 getVpcEipById"
)
}
opts = opts || {}
if (opts.id === undefined || opts.id === null) {
throw new Error(
"Missing the required parameter 'opts.id' when calling getVpcEipById"
)
}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId,
id: opts.id
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call getVpcEipById with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/vpc_eips/{id}',
'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.id - 公网IP ID
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
*/
deleteVpcEipById (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 deleteVpcEipById"
)
}
opts = opts || {}
if (opts.id === undefined || opts.id === null) {
throw new Error(
"Missing the required parameter 'opts.id' when calling deleteVpcEipById"
)
}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId,
id: opts.id
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call deleteVpcEipById with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/vpc_eips/{id}',
'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)
}
)
}
/**
* 弹性公网IP绑定到虚拟机
* @param {Object} opts - parameters
* @param {string} opts.id - 公网IP ID
* @param {associateEipAddress} opts.associate - 弹性公网IP绑定到虚拟机
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param resourceTFInfo task
*/
associateVpcEipById (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 associateVpcEipById"
)
}
opts = opts || {}
if (opts.id === undefined || opts.id === null) {
throw new Error(
"Missing the required parameter 'opts.id' when calling associateVpcEipById"
)
}
if (opts.associate === undefined || opts.associate === null) {
throw new Error(
"Missing the required parameter 'opts.associate' when calling associateVpcEipById"
)
}
let postBody = {}
if (opts.associate !== undefined && opts.associate !== null) {
postBody['associate'] = opts.associate
}
let queryParams = {}
let pathParams = {
regionId: regionId,
id: opts.id
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call associateVpcEipById with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/vpc_eips/{id}:associate',
'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.id - 公网IP ID
* @param {unassociateEipAddress} opts.unassociate - 解绑公网IP
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
*/
disassociateVpcEipById (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 disassociateVpcEipById"
)
}
opts = opts || {}
if (opts.id === undefined || opts.id === null) {
throw new Error(
"Missing the required parameter 'opts.id' when calling disassociateVpcEipById"
)
}
if (opts.unassociate === undefined || opts.unassociate === null) {
throw new Error(
"Missing the required parameter 'opts.unassociate' when calling disassociateVpcEipById"
)
}
let postBody = {}
if (opts.unassociate !== undefined && opts.unassociate !== null) {
postBody['unassociate'] = opts.unassociate
}
let queryParams = {}
let pathParams = {
regionId: regionId,
id: opts.id
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call disassociateVpcEipById with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/vpc_eips/{id}:disassociate',
'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.slbid] - 负载均衡id optional
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param lbHttpListener httpListeners
*/
getLbHttpListener (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 getLbHttpListener"
)
}
opts = opts || {}
let postBody = null
let queryParams = {}
if (opts.slbid !== undefined && opts.slbid !== null) {
queryParams['slbid'] = opts.slbid
}
let pathParams = {
regionId: regionId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call getLbHttpListener with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/vpc_lbHttpListener',
'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)
}
)
}
/**
* 创建HTTP监听器
* @param {Object} opts - parameters
* @param {createLoadBalancerHTTPListener} opts.httpListener - 创建HTTP监听器
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param resourceTFInfo task
*/
createVpcLBHttpListener (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 createVpcLBHttpListener"
)
}
opts = opts || {}
if (opts.httpListener === undefined || opts.httpListener === null) {
throw new Error(
"Missing the required parameter 'opts.httpListener' when calling createVpcLBHttpListener"
)
}
let postBody = {}
if (opts.httpListener !== undefined && opts.httpListener !== null) {
postBody['httpListener'] = opts.httpListener
}
let queryParams = {}
let pathParams = {
regionId: regionId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call createVpcLBHttpListener with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/vpc_lbHttpListener',
'POST',
pathParams,
queryParams,
headerParams,
formParams,
postBody,
contentTypes,
accepts,
returnType,
callback
)
return request.then(
function (result) {
if (callback && typeof callback === 'function') {
return callback(null, result)
}
return result
},
function (error) {
if (callback && typeof callback === 'function') {
return callback(error)
}
return Promise.reject(error)
}
)
}
/**
* 根据云提供商查询对应的网卡资源信息
* @param {Object} opts - parameters
* @param {string} opts.id - 网卡 ID
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param netInterfaceInfo netInterface
*/
getVpcNetworkInterfaceById (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 getVpcNetworkInterfaceById"
)
}
opts = opts || {}
if (opts.id === undefined || opts.id === null) {
throw new Error(
"Missing the required parameter 'opts.id' when calling getVpcNetworkInterfaceById"
)
}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId,
id: opts.id
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call getVpcNetworkInterfaceById with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/vpc_networkInterfaces/{id}',
'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.id - 网卡 ID
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
*/
deleteVpcNetworkInterfaceById (
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 deleteVpcNetworkInterfaceById"
)
}
opts = opts || {}
if (opts.id === undefined || opts.id === null) {
throw new Error(
"Missing the required parameter 'opts.id' when calling deleteVpcNetworkInterfaceById"
)
}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId,
id: opts.id
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call deleteVpcNetworkInterfaceById with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/vpc_networkInterfaces/{id}',
'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.vmId] - 云主机id optional
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param netInterfaceInfo netInterfaces
*/
getVpcNetworkInterfaces (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 getVpcNetworkInterfaces"
)
}
opts = opts || {}
let postBody = null
let queryParams = {}
if (opts.vmId !== undefined && opts.vmId !== null) {
queryParams['vmId'] = opts.vmId
}
let pathParams = {
regionId: regionId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call getVpcNetworkInterfaces with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/vpc_networkInterfaces',
'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 {createNetInterface} opts.netInterface - 创建网卡
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param resourceTFInfo task
*/
createVpcNetworkInterface (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 createVpcNetworkInterface"
)
}
opts = opts || {}
if (opts.netInterface === undefined || opts.netInterface === null) {
throw new Error(
"Missing the required parameter 'opts.netInterface' when calling createVpcNetworkInterface"
)
}
let postBody = {}
if (opts.netInterface !== undefined && opts.netInterface !== null) {
postBody['netInterface'] = opts.netInterface
}
let queryParams = {}
let pathParams = {
regionId: regionId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call createVpcNetworkInterface with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/vpc_networkInterfaces',
'POST',
pathParams,
queryParams,
headerParams,
formParams,
postBody,
contentTypes,
accepts,
returnType,
callback
)
return request.then(
function (result) {
if (callback && typeof callback === 'function') {
return callback(null, result)
}
return result
},
function (error) {
if (callback && typeof callback === 'function') {
return callback(error)
}
return Promise.reject(error)
}
)
}
/**
* 网卡挂载虚拟机
* @param {Object} opts - parameters
* @param {string} opts.id - 网卡 ID
* @param {attachNetInterface} opts.attach - 网卡挂载虚拟机
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param resourceTFInfo task
*/
attachVpcNetworkInterfaceById (
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 attachVpcNetworkInterfaceById"
)
}
opts = opts || {}
if (opts.id === undefined || opts.id === null) {
throw new Error(
"Missing the required parameter 'opts.id' when calling attachVpcNetworkInterfaceById"
)
}
if (opts.attach === undefined || opts.attach === null) {
throw new Error(
"Missing the required parameter 'opts.attach' when calling attachVpcNetworkInterfaceById"
)
}
let postBody = {}
if (opts.attach !== undefined && opts.attach !== null) {
postBody['attach'] = opts.attach
}
let queryParams = {}
let pathParams = {
regionId: regionId,
id: opts.id
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call attachVpcNetworkInterfaceById with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/vpc_networkInterfaces/{id}:attach',
'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.id - 网卡 ID
* @param {detachNetInterface} opts.detach - 卸载网卡
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
*/
detachVpcNetworkInterfaceById (
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 detachVpcNetworkInterfaceById"
)
}
opts = opts || {}
if (opts.id === undefined || opts.id === null) {
throw new Error(
"Missing the required parameter 'opts.id' when calling detachVpcNetworkInterfaceById"
)
}
if (opts.detach === undefined || opts.detach === null) {
throw new Error(
"Missing the required parameter 'opts.detach' when calling detachVpcNetworkInterfaceById"
)
}
let postBody = {}
if (opts.detach !== undefined && opts.detach !== null) {
postBody['detach'] = opts.detach
}
let queryParams = {}
let pathParams = {
regionId: regionId,
id: opts.id
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call detachVpcNetworkInterfaceById with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/vpc_networkInterfaces/{id}:detach',
'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.id - SecurityGroup ID
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param securityGroupDetail securityGroup
*/
getVpcSecurityGroupById (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 getVpcSecurityGroupById"
)
}
opts = opts || {}
if (opts.id === undefined || opts.id === null) {
throw new Error(
"Missing the required parameter 'opts.id' when calling getVpcSecurityGroupById"
)
}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId,
id: opts.id
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call getVpcSecurityGroupById with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/vpc_securityGroups/{id}',
'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.id - SecurityGroup ID
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
*/
deleteVpcSecurityGroupById (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 deleteVpcSecurityGroupById"
)
}
opts = opts || {}
if (opts.id === undefined || opts.id === null) {
throw new Error(
"Missing the required parameter 'opts.id' when calling deleteVpcSecurityGroupById"
)
}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId,
id: opts.id
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call deleteVpcSecurityGroupById with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/vpc_securityGroups/{id}',
'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} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param securityGroupInfo securityGroups
*/
getVpcSecurityGroups (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 getVpcSecurityGroups"
)
}
opts = opts || {}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call getVpcSecurityGroups with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/vpc_securityGroups',
'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 {createSecurityGroup} opts.securityGroup - 创建securityGroup
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param resourceTFInfo task
*/
createVpcSecurityGroup (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 createVpcSecurityGroup"
)
}
opts = opts || {}
if (opts.securityGroup === undefined || opts.securityGroup === null) {
throw new Error(
"Missing the required parameter 'opts.securityGroup' when calling createVpcSecurityGroup"
)
}
let postBody = {}
if (opts.securityGroup !== undefined && opts.securityGroup !== null) {
postBody['securityGroup'] = opts.securityGroup
}
let queryParams = {}
let pathParams = {
regionId: regionId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call createVpcSecurityGroup with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/vpc_securityGroups',
'POST',
pathParams,
queryParams,
headerParams,
formParams,
postBody,
contentTypes,
accepts,
returnType,
callback
)
return request.then(
function (result) {
if (callback && typeof callback === 'function') {
return callback(null, result)
}
return result
},
function (error) {
if (callback && typeof callback === 'function') {
return callback(error)
}
return Promise.reject(error)
}
)
}
/**
* 新增安全组规则
* @param {Object} opts - parameters
* @param {string} opts.id - 安全组ID
* @param {createSgRule} opts.sgRule - 新增安全组规则
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param resourceTFInfo task
*/
createSecurityGroupsRule (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 createSecurityGroupsRule"
)
}
opts = opts || {}
if (opts.id === undefined || opts.id === null) {
throw new Error(
"Missing the required parameter 'opts.id' when calling createSecurityGroupsRule"
)
}
if (opts.sgRule === undefined || opts.sgRule === null) {
throw new Error(
"Missing the required parameter 'opts.sgRule' when calling createSecurityGroupsRule"
)
}
let postBody = {}
if (opts.sgRule !== undefined && opts.sgRule !== null) {
postBody['sgRule'] = opts.sgRule
}
let queryParams = {}
let pathParams = {
regionId: regionId,
id: opts.id
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call createSecurityGroupsRule with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/vpc_securityGroups/{id}/rule',
'POST',
pathParams,
queryParams,
headerParams,
formParams,
postBody,
contentTypes,
accepts,
returnType,
callback
)
return request.then(
function (result) {
if (callback && typeof callback === 'function') {
return callback(null, result)
}
return result
},
function (error) {
if (callback && typeof callback === 'function') {
return callback(error)
}
return Promise.reject(error)
}
)
}
/**
* 删除安全组规则
* @param {Object} opts - parameters
* @param {string} opts.id - 安全组ID
* @param {string} opts.ruleType - 规则类型,ingress、egress
* @param {string} opts.protocol - 协议,tcp、udp、icmp 或者 all
* @param {string} opts.fromPort - 起始端口
* @param {string} opts.toPort - 终止端口
* @param {string} [opts.nicType] - 网络类型,internet、intranet optional
* @param {string} [opts.policy] - 认证策略,accept、drop optional
* @param {string} [opts.priority] - 认证策略的权重,1-100 optional
* @param {string} [opts.cidrIp] - 目标IP地址范围 optional
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
*/
deleteSecurityGroupsRule (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 deleteSecurityGroupsRule"
)
}
opts = opts || {}
if (opts.id === undefined || opts.id === null) {
throw new Error(
"Missing the required parameter 'opts.id' when calling deleteSecurityGroupsRule"
)
}
if (opts.ruleType === undefined || opts.ruleType === null) {
throw new Error(
"Missing the required parameter 'opts.ruleType' when calling deleteSecurityGroupsRule"
)
}
if (opts.protocol === undefined || opts.protocol === null) {
throw new Error(
"Missing the required parameter 'opts.protocol' when calling deleteSecurityGroupsRule"
)
}
if (opts.fromPort === undefined || opts.fromPort === null) {
throw new Error(
"Missing the required parameter 'opts.fromPort' when calling deleteSecurityGroupsRule"
)
}
if (opts.toPort === undefined || opts.toPort === null) {
throw new Error(
"Missing the required parameter 'opts.toPort' when calling deleteSecurityGroupsRule"
)
}
let postBody = null
let queryParams = {}
if (opts.ruleType !== undefined && opts.ruleType !== null) {
queryParams['ruleType'] = opts.ruleType
}
if (opts.protocol !== undefined && opts.protocol !== null) {
queryParams['protocol'] = opts.protocol
}
if (opts.fromPort !== undefined && opts.fromPort !== null) {
queryParams['fromPort'] = opts.fromPort
}
if (opts.toPort !== undefined && opts.toPort !== null) {
queryParams['toPort'] = opts.toPort
}
if (opts.nicType !== undefined && opts.nicType !== null) {
queryParams['nicType'] = opts.nicType
}
if (opts.policy !== undefined && opts.policy !== null) {
queryParams['policy'] = opts.policy
}
if (opts.priority !== undefined && opts.priority !== null) {
queryParams['priority'] = opts.priority
}
if (opts.cidrIp !== undefined && opts.cidrIp !== null) {
queryParams['cidrIp'] = opts.cidrIp
}
let pathParams = {
regionId: regionId,
id: opts.id
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call deleteSecurityGroupsRule with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/vpc_securityGroups/{id}/rule',
'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)
}
)
}
/**
* 根据云提供商查询对应的SLB资源信息
* @param {Object} opts - parameters
* @param {string} opts.id - LB ID
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param slbInfoDetail slb
*/
getVpcSlbById (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 getVpcSlbById"
)
}
opts = opts || {}
if (opts.id === undefined || opts.id === null) {
throw new Error(
"Missing the required parameter 'opts.id' when calling getVpcSlbById"
)
}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId,
id: opts.id
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call getVpcSlbById with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/vpc_slbs/{id}',
'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)
}
)
}
/**
* 删除SLB
* @param {Object} opts - parameters
* @param {string} opts.id - LB ID
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
*/
deleteVpcSlbById (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 deleteVpcSlbById"
)
}
opts = opts || {}
if (opts.id === undefined || opts.id === null) {
throw new Error(
"Missing the required parameter 'opts.id' when calling deleteVpcSlbById"
)
}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId,
id: opts.id
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call deleteVpcSlbById with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/vpc_slbs/{id}',
'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} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param slbInfo slbs
*/
getVpcSlbs (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 getVpcSlbs"
)
}
opts = opts || {}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call getVpcSlbs with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/vpc_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 {slbInfo} opts.slb - 创建SLB
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param resourceTFInfo task
*/
createVpcSlb (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 createVpcSlb"
)
}
opts = opts || {}
if (opts.slb === undefined || opts.slb === null) {
throw new Error(
"Missing the required parameter 'opts.slb' when calling createVpcSlb"
)
}
let postBody = {}
if (opts.slb !== undefined && opts.slb !== null) {
postBody['slb'] = opts.slb
}
let queryParams = {}
let pathParams = {
regionId: regionId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call createVpcSlb with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/vpc_slbs',
'POST',
pathParams,
queryParams,
headerParams,
formParams,
postBody,
contentTypes,
accepts,
returnType,
callback
)
return request.then(
function (result) {
if (callback && typeof callback === 'function') {
return callback(null, result)
}
return result
},
function (error) {
if (callback && typeof callback === 'function') {
return callback(error)
}
return Promise.reject(error)
}
)
}
/**
* 启动负载均衡
* @param {Object} opts - parameters
* @param {string} opts.id - LB ID
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
*/
startSlb (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 startSlb"
)
}
opts = opts || {}
if (opts.id === undefined || opts.id === null) {
throw new Error(
"Missing the required parameter 'opts.id' when calling startSlb"
)
}
let postBody = {}
let queryParams = {}
let pathParams = {
regionId: regionId,
id: opts.id
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call startSlb with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/vpc_slbs/{id}:start',
'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.id - LB ID
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
*/
stopSlb (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 stopSlb"
)
}
opts = opts || {}
if (opts.id === undefined || opts.id === null) {
throw new Error(
"Missing the required parameter 'opts.id' when calling stopSlb"
)
}
let postBody = {}
let queryParams = {}
let pathParams = {
regionId: regionId,
id: opts.id
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call stopSlb with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/vpc_slbs/{id}:stop',
'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.id - 负载均衡id
* @param {integer} opts.listenerPort - 监听器端口
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
*/
deleteSlbsListener (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 deleteSlbsListener"
)
}
opts = opts || {}
if (opts.id === undefined || opts.id === null) {
throw new Error(
"Missing the required parameter 'opts.id' when calling deleteSlbsListener"
)
}
if (opts.listenerPort === undefined || opts.listenerPort === null) {
throw new Error(
"Missing the required parameter 'opts.listenerPort' when calling deleteSlbsListener"
)
}
let postBody = null
let queryParams = {}
if (opts.listenerPort !== undefined && opts.listenerPort !== null) {
queryParams['listenerPort'] = opts.listenerPort
}
let pathParams = {
regionId: regionId,
id: opts.id
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call deleteSlbsListener with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/vpc_slbs_listener/{id}',
'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.id - 负载均衡id
* @param {integer} opts.listenerPort - 监听器端口
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
*/
startSlbListener (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 startSlbListener"
)
}
opts = opts || {}
if (opts.id === undefined || opts.id === null) {
throw new Error(
"Missing the required parameter 'opts.id' when calling startSlbListener"
)
}
if (opts.listenerPort === undefined || opts.listenerPort === null) {
throw new Error(
"Missing the required parameter 'opts.listenerPort' when calling startSlbListener"
)
}
let postBody = {}
if (opts.listenerPort !== undefined && opts.listenerPort !== null) {
postBody['listenerPort'] = opts.listenerPort
}
let queryParams = {}
let pathParams = {
regionId: regionId,
id: opts.id
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call startSlbListener with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/vpc_slbs_listener/{id}:start',
'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.id - 负载均衡id
* @param {integer} opts.listenerPort - 监听器端口
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
*/
stopSlbListener (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 stopSlbListener"
)
}
opts = opts || {}
if (opts.id === undefined || opts.id === null) {
throw new Error(
"Missing the required parameter 'opts.id' when calling stopSlbListener"
)
}
if (opts.listenerPort === undefined || opts.listenerPort === null) {
throw new Error(
"Missing the required parameter 'opts.listenerPort' when calling stopSlbListener"
)
}
let postBody = {}
if (opts.listenerPort !== undefined && opts.listenerPort !== null) {
postBody['listenerPort'] = opts.listenerPort
}
let queryParams = {}
let pathParams = {
regionId: regionId,
id: opts.id
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call stopSlbListener with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/vpc_slbs_listener/{id}:stop',
'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)
}
)
}
/**
* 根据云提供商查询对应的subnet资源信息
* @param {Object} opts - parameters
* @param {string} opts.id - VPC ID
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param subnetDesInfo subnet
*/
getVpcSubnetById (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 getVpcSubnetById"
)
}
opts = opts || {}
if (opts.id === undefined || opts.id === null) {
throw new Error(
"Missing the required parameter 'opts.id' when calling getVpcSubnetById"
)
}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId,
id: opts.id
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call getVpcSubnetById with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/vpc_subnets/{id}',
'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.id - VPC ID
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
*/
deleteVpcSubnetById (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 deleteVpcSubnetById"
)
}
opts = opts || {}
if (opts.id === undefined || opts.id === null) {
throw new Error(
"Missing the required parameter 'opts.id' when calling deleteVpcSubnetById"
)
}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId,
id: opts.id
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call deleteVpcSubnetById with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/vpc_subnets/{id}',
'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)
}
)
}
/**
* 根据云提供商查询对应的subnet资源信息
* @param {Object} opts - parameters
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param subnetDesInfo subnets
*/
getVpcSubnets (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 getVpcSubnets"
)
}
opts = opts || {}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call getVpcSubnets with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/vpc_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 {createSubnet} opts.subnet - 创建subnet
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param resourceTFInfo task
*/
createVpcSubnet (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 createVpcSubnet"
)
}
opts = opts || {}
if (opts.subnet === undefined || opts.subnet === null) {
throw new Error(
"Missing the required parameter 'opts.subnet' when calling createVpcSubnet"
)
}
let postBody = {}
if (opts.subnet !== undefined && opts.subnet !== null) {
postBody['subnet'] = opts.subnet
}
let queryParams = {}
let pathParams = {
regionId: regionId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call createVpcSubnet with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/vpc_subnets',
'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)
}
)
}
/**
* 根据云提供商查询对应的VPC资源信息
* @param {Object} opts - parameters
* @param {string} opts.id - VPC ID
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param vpcInfoDetail vpc
*/
getVpcById (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 getVpcById"
)
}
opts = opts || {}
if (opts.id === undefined || opts.id === null) {
throw new Error(
"Missing the required parameter 'opts.id' when calling getVpcById"
)
}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId,
id: opts.id
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call getVpcById with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/vpc_vpcs/{id}',
'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)
}
)
}
/**
* 删除VPC
* @param {Object} opts - parameters
* @param {string} opts.id - VPC ID
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
*/
deleteVpcById (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 deleteVpcById"
)
}
opts = opts || {}
if (opts.id === undefined || opts.id === null) {
throw new Error(
"Missing the required parameter 'opts.id' when calling deleteVpcById"
)
}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId,
id: opts.id
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call deleteVpcById with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/vpc_vpcs/{id}',
'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} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param vpcListInfo vpcs
*/
getVpcs (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 getVpcs"
)
}
opts = opts || {}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call getVpcs with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/vpc_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 {vpcInfo} opts.vpc - 创建VPC
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param resourceTFInfo task
*/
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.vpc === undefined || opts.vpc === null) {
throw new Error(
"Missing the required parameter 'opts.vpc' when calling createVpc"
)
}
let postBody = {}
if (opts.vpc !== undefined && opts.vpc !== null) {
postBody['vpc'] = opts.vpc
}
let queryParams = {}
let pathParams = {
regionId: regionId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call 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 = this.makeRequest(
'/regions/{regionId}/vpc_vpcs',
'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.slbid] - 负载均衡id optional
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param vserverGroupInfo vserverGroups
*/
getVpcVServerGroups (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 getVpcVServerGroups"
)
}
opts = opts || {}
let postBody = null
let queryParams = {}
if (opts.slbid !== undefined && opts.slbid !== null) {
queryParams['slbid'] = opts.slbid
}
let pathParams = {
regionId: regionId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call getVpcVServerGroups with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/vpc_vserverGroups',
'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 {createVserverGroup} opts.vserverGroup - 创建虚拟服务器组
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param resourceTFInfo task
*/
createVpcVServerGroup (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 createVpcVServerGroup"
)
}
opts = opts || {}
if (opts.vserverGroup === undefined || opts.vserverGroup === null) {
throw new Error(
"Missing the required parameter 'opts.vserverGroup' when calling createVpcVServerGroup"
)
}
let postBody = {}
if (opts.vserverGroup !== undefined && opts.vserverGroup !== null) {
postBody['vserverGroup'] = opts.vserverGroup
}
let queryParams = {}
let pathParams = {
regionId: regionId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call createVpcVServerGroup with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/vpc_vserverGroups',
'POST',
pathParams,
queryParams,
headerParams,
formParams,
postBody,
contentTypes,
accepts,
returnType,
callback
)
return request.then(
function (result) {
if (callback && typeof callback === 'function') {
return callback(null, result)
}
return result
},
function (error) {
if (callback && typeof callback === 'function') {
return callback(error)
}
return Promise.reject(error)
}
)
}
/**
* 根据过滤条件,取得服务器组的信息
* @param {Object} opts - parameters
* @param {string} opts.id - 服务器组ID
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param vserverGroupDetail vserverGroup
*/
getVserverGroupsById (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 getVserverGroupsById"
)
}
opts = opts || {}
if (opts.id === undefined || opts.id === null) {
throw new Error(
"Missing the required parameter 'opts.id' when calling getVserverGroupsById"
)
}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId,
id: opts.id
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call getVserverGroupsById with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/vpc_vserverGroups/{id}',
'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.id - 服务器组ID
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
*/
deleteVserverGroup (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 deleteVserverGroup"
)
}
opts = opts || {}
if (opts.id === undefined || opts.id === null) {
throw new Error(
"Missing the required parameter 'opts.id' when calling deleteVserverGroup"
)
}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId,
id: opts.id
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 jdfusion/0.3.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call deleteVserverGroup with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = this.makeRequest(
'/regions/{regionId}/vpc_vserverGroups/{id}',
'DELETE',
pathParams,
queryParams,
headerParams,
formParams,
postBody,
contentTypes,
accepts,
returnType,
callback
)
return request.then(
function (result) {
if (callback && typeof callback === 'function') {
return callback(null, result)
}
return result
},
function (error) {
if (callback && typeof callback === 'function') {
return callback(error)
}
return Promise.reject(error)
}
)
}
}
module.exports = JDCloud.JDFUSION